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..db1669387 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 @@ -42,8 +42,8 @@ msgstr "" #: ../../bugs.rst:11 msgid "" "It can be sometimes faster to fix bugs yourself and contribute patches to " -"Python as it streamlines the process and involves less people. Learn how to :" -"ref:`contribute `." +"Python as it streamlines the process and involves less people. Learn how " +"to :ref:`contribute `." msgstr "" "バグを自分で直して Python にパッチを送る方が、やり取りに無駄が無く関わる人数" "も少なく済むこともあります。\n" @@ -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..8137d8afb 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 @@ -42,9 +42,9 @@ msgstr "" #: ../../c-api/abstract.rst:14 msgid "" "It is not possible to use these functions on objects that are not properly " -"initialized, such as a list object that has been created by :c:func:" -"`PyList_New`, but whose items have not been set to some non-\\ ``NULL`` " -"value yet." +"initialized, such as a list object that has been created " +"by :c:func:`PyList_New`, but whose items have not been set to some non-\\ " +"``NULL`` value yet." msgstr "" "これらの関数は、 :c:func:`PyList_New` で作成された後に ``NULL`` 以外の値を設" "定されていないリストのような、適切に初期化されていないオブジェクトに対して使" diff --git a/c-api/allocation.po b/c-api/allocation.po index 270c704f4..8eb4f1b3b 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,33 @@ 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`." +"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,130 +70,157 @@ 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:" -"`PyObject_Malloc` to allocate memory and initializing it like :c:func:" -"`PyObject_Init`. The caller will own the only reference to the object (i.e. " -"its reference count will be one)." +"Python type object *typeobj* (``PyTypeObject*``) by " +"calling :c:func:`PyObject_Malloc` to allocate memory and initializing it " +"like :c:func:`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." +"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__`)." +"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." +"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 "" +"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*." +"(``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." +"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..9cfd47655 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." +"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." +"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..d068eab6b 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -19,42 +19,42 @@ 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`." +"methods. Additional information and examples are available " +"in :ref:`extending-index`." msgstr "" +"これらの関数は、独自の拡張関数やメソッドを作成するときに便利です。\n" +"追加の情報や例は :ref:`extending-index` を参照してください。" #: ../../c-api/arg.rst:12 msgid "" -"The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:" -"func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use " -"*format strings* which are used to tell the function about the expected " -"arguments. The format strings use the same syntax for each of these " -"functions." +"The first three of these functions " +"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " +"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " +"the function about the expected arguments. The format strings use the same " +"syntax for each of these functions." msgstr "" -"最初に説明する 3 つの関数、 :c:func:`PyArg_ParseTuple`, :c:func:" -"`PyArg_ParseTupleAndKeywords`,および :c:func:`PyArg_Parse` はいずれも *書式文" -"字列 (format string)* を使います。書式文字列は、関数が受け取るはずの引数に関" -"する情報を伝えるのに用いられます。いずれの関数における書式文字列も、同じ書式" -"を使っています。" +"最初に説明する 3 つの関" +"数、 :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`,およ" +"び :c:func:`PyArg_Parse` はいずれも *書式文字列 (format string)* を使います。" +"書式文字列は、関数が受け取るはずの引数に関する情報を伝えるのに用いられます。" +"いずれの関数における書式文字列も、同じ書式を使っています。" #: ../../c-api/arg.rst:19 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`." +"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 \\*]" @@ -165,15 +187,15 @@ msgstr "" "をその変数に記録します。C 文字列は NUL で終端されています。Python の文字列型" "は、 null コードポイントが途中に埋め込まれていてはなりません; もし埋め込まれ" "ていれば :exc:`ValueError` 例外を送出します。Unicode オブジェクトは " -"``'utf-8'`` を使って C 文字列に変換されます。変換に失敗すると :exc:" -"`UnicodeError` を送出します。" +"``'utf-8'`` を使って C 文字列に変換されます。変換に失敗する" +"と :exc:`UnicodeError` を送出します。" #: ../../c-api/arg.rst:90 msgid "" "This format does not accept :term:`bytes-like objects `. " "If you want to accept filesystem paths and convert them to C character " -"strings, it is preferable to use the ``O&`` format with :c:func:" -"`PyUnicode_FSConverter` as *converter*." +"strings, it is preferable to use the ``O&`` format " +"with :c:func:`PyUnicode_FSConverter` as *converter*." msgstr "" "このフォーマットは :term:`bytes-like objects ` をサポート" "しません。\n" @@ -186,8 +208,8 @@ msgid "" "Previously, :exc:`TypeError` was raised when embedded null code points were " "encountered in the Python string." msgstr "" -"以前は Python 文字列に null コードポイントが埋め込まれていたときに :exc:" -"`TypeError` を送出していました。" +"以前は Python 文字列に null コードポイントが埋め込まれていたとき" +"に :exc:`TypeError` を送出していました。" #: ../../c-api/arg.rst:100 msgid "``s*`` (:class:`str` or :term:`bytes-like object`) [Py_buffer]" @@ -208,13 +230,12 @@ msgstr "" #: ../../c-api/arg.rst:106 msgid "" -"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" -"c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" 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 "" @@ -299,11 +331,11 @@ msgstr "" #: ../../c-api/arg.rst:145 msgid "" -"``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" -"`Py_ssize_t`]" +"``y#`` (read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" -"``y#`` (読み出し専用の :term:`bytes-like object`) [const char \\*, :c:type:" -"`Py_ssize_t`]" +"``y#`` (読み出し専用の :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:146 msgid "" @@ -334,14 +366,14 @@ msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" #: ../../c-api/arg.rst:155 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " -"attempting any conversion. Raises :exc:`TypeError` if the object is not a :" -"class:`bytearray` object. The C variable may also be declared as :c:expr:" -"`PyObject*`." +"attempting any conversion. Raises :exc:`TypeError` if the object is not " +"a :class:`bytearray` object. The C variable may also be declared " +"as :c:expr:`PyObject*`." msgstr "" "Python オブジェクトとして :class:`bytearray` オブジェクトを要求し、いかなる変" -"換もおこないません。 もしオブジェクトが :class:`bytearray` でなければ、 :exc:" -"`TypeError` を送出します。C 変数は :c:expr:`PyObject*` として宣言しても構いま" -"せん。" +"換もおこないません。 もしオブジェクトが :class:`bytearray` でなけれ" +"ば、 :exc:`TypeError` を送出します。C 変数は :c:expr:`PyObject*` として宣言し" +"ても構いません。" #: ../../c-api/arg.rst:159 msgid "``U`` (:class:`str`) [PyObject \\*]" @@ -365,8 +397,8 @@ msgstr "``w*`` (読み書き可能な :term:`bytes-like object`) [Py_buffer]" msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to call :c:func:" -"`PyBuffer_Release` when it is done with the buffer." +"The buffer may contain embedded null bytes. The caller have to " +"call :c:func:`PyBuffer_Release` when it is done with the buffer." msgstr "" "このフォーマットは、読み書き可能な buffer interface を実装したオブジェクトを" "受け付けます。 呼び出し元から渡された :c:type:`Py_buffer` 構造体に値を格納し" @@ -407,8 +439,8 @@ msgstr "" msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " -"newly allocated storage. The caller is responsible for calling :c:func:" -"`PyMem_Free` to free the allocated buffer after use." +"newly allocated storage. The caller is responsible for " +"calling :c:func:`PyMem_Free` to free the allocated buffer after use." msgstr "" ":c:func:`PyArg_ParseTuple` を使うと、必要なサイズのバッファを確保し、そのバッ" "ファにエンコード後のデータをコピーして、 *\\*buffer* がこの新たに確保された記" @@ -435,21 +467,19 @@ msgstr "" #: ../../c-api/arg.rst:192 msgid "" -"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" -"`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char " +"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" msgstr "" -"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" -"`Py_ssize_t` \\*buffer_length]" +"``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,24 +560,31 @@ 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:" -"`complex` can also use the corresponding special methods :meth:`~object." -"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " -"convert the Python object to the required type." -msgstr "" +"numbers. Formats that require :class:`int`, :class:`float` " +"or :class:`complex` can also use the corresponding special " +"methods :meth:`~object.__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 +598,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 +739,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]" @@ -732,10 +768,14 @@ msgstr "``O`` (object) [PyObject \\*]" #: ../../c-api/arg.rst:317 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " -"program thus receives the actual object that was passed. A new :term:" -"`strong reference` to the object is not created (i.e. its reference count is " -"not increased). The pointer stored is not ``NULL``." +"program thus receives the actual object that was passed. A " +"new :term:`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 \\*]" @@ -751,13 +791,12 @@ msgid "" msgstr "" "Python オブジェクトを C の Python オブジェクト型ポインタに保存します。 ``O`` " "に似ていますが、二つの C の引数をとります: 一つ目の引数は Python の型オブジェ" -"クトへのアドレスで、二つ目の引数はオブジェクトへのポインタが保存されている (:" -"c:expr:`PyObject*` の) C の変数へのアドレスです。Python オブジェクトが指定し" -"た型ではない場合、 :exc:`TypeError` を送出します。" +"クトへのアドレスで、二つ目の引数はオブジェクトへのポインタが保存されている " +"(: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 "" @@ -767,22 +806,21 @@ msgid "" "*converter* function in turn is called as follows::" msgstr "" "Python オブジェクトを *converter* 関数を介して C の変数に変換します。二つの引" -"数をとります: 一つ目は関数で、二つ目は (任意の型の) C 変数へのアドレスを :c:" -"expr:`void *` 型に変換したものです。 *converter* は以下のようにして呼び出され" -"ます::" +"数をとります: 一つ目は関数で、二つ目は (任意の型の) C 変数へのアドレス" +"を :c: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 "" -"where *object* is the Python object to be converted and *address* is the :c:" -"expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " -"returned *status* should be ``1`` for a successful conversion and ``0`` if " -"the conversion has failed. When the conversion fails, the *converter* " -"function should raise an exception and leave the content of *address* " -"unmodified." +"where *object* is the Python object to be converted and *address* is " +"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " +"function. The returned *status* should be ``1`` for a successful conversion " +"and ``0`` if the conversion has failed. When the conversion fails, the " +"*converter* function should raise an exception and leave the content of " +"*address* unmodified." msgstr "" "ここで *object* は変換対象の Python オブジェクトで、 *address* は " "``PyArg_Parse*`` に渡した :c:expr:`void*` 型の引数です。戻り値 *status* は変" @@ -790,7 +828,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 +835,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`." +"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,37 +870,47 @@ 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 :" -"term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " +"borrowed-buffer>` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or " +"a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " "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)*]" @@ -935,8 +987,8 @@ msgstr "``;``" #: ../../c-api/arg.rst:426 msgid "" "The list of format units ends here; the string after the semicolon is used " -"as the error message *instead* of the default error message. ``:`` and ``;" -"`` mutually exclude each other." +"as the error message *instead* of the default error message. ``:`` and " +"``;`` mutually exclude each other." msgstr "" "この文字があると、書式単位の記述はそこで終わります; セミコロン以降の文字列" "は、デフォルトエラーメッセージを *置き換える* エラーメッセージとして使われま" @@ -948,6 +1000,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 +1056,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 +1064,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." +"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 +1086,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." +"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 +1113,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 +1137,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 +1164,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,20 +1202,30 @@ 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 "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -"この例における :c:func:`PyArg_UnpackTuple` 呼び出しは、 :c:func:" -"`PyArg_ParseTuple` を使った以下の呼び出しと全く等価です::" +"この例における :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 +1233,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" @@ -1169,10 +1275,10 @@ msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " "Buffers provided by the caller are never referenced by the objects created " -"by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:" -"`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your " -"code is responsible for calling :c:func:`free` for that memory once :c:func:" -"`Py_BuildValue` returns." +"by :c:func:`Py_BuildValue`. In other words, if your code " +"invokes :c:func:`malloc` and passes the allocated memory " +"to :c:func:`Py_BuildValue`, your code is responsible for " +"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." msgstr "" "書式単位 ``s`` や ``s#`` の場合のように、オブジェクトを構築する際にデータを供" "給するためにメモリバッファをパラメタとして渡す場合には、指定したデータはコ" @@ -1212,14 +1318,15 @@ msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -"null終端された C 文字列を、 ``'utf-8'`` エンコーディングを用いて、 Python :" -"class:`str` オブジェクトに変換します。もし C 文字列ポインタが ``NULL`` の場" -"合、 ``None`` になります。" +"null終端された C 文字列を、 ``'utf-8'`` エンコーディングを用いて、 " +"Python :class:`str` オブジェクトに変換します。もし C 文字列ポインタが " +"``NULL`` の場合、 ``None`` になります。" #: ../../c-api/arg.rst:616 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 "" @@ -1227,9 +1334,9 @@ msgid "" "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -"C 文字列とその長さを ``'utf-8'`` エンコーディングを使って Python :class:" -"`str` オブジェクトに変換します。C 文字列ポインタが ``NULL`` の場合、長さは無" -"視され、 ``None`` になります。" +"C 文字列とその長さを ``'utf-8'`` エンコーディングを使って " +"Python :class:`str` オブジェクトに変換します。C 文字列ポインタが ``NULL`` の" +"場合、長さは無視され、 ``None`` になります。" #: ../../c-api/arg.rst:621 msgid "``y`` (:class:`bytes`) [const char \\*]" @@ -1245,7 +1352,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 +1492,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,15 +1506,21 @@ 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 " "is a ``NULL`` pointer, it is assumed that this was caused because the call " -"producing the argument found an error and set an exception. Therefore, :c:" -"func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " -"no exception has been raised yet, :exc:`SystemError` is set." -msgstr "" +"producing the argument found an error and set an exception. " +"Therefore, :c: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 +1540,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*]" @@ -1437,9 +1551,9 @@ msgstr "``O&`` (object) [*converter*, *anything*]" #: ../../c-api/arg.rst:726 msgid "" "Convert *anything* to a Python object through a *converter* function. The " -"function is called with *anything* (which should be compatible with :c:expr:" -"`void*`) as its argument and should return a \"new\" Python object, or " -"``NULL`` if an error occurred." +"function is called with *anything* (which should be compatible " +"with :c:expr:`void*`) as its argument and should return a \"new\" Python " +"object, or ``NULL`` if an error occurred." msgstr "" "*anything* を *converter* 関数を介して Python オブジェクトに変換します。この" "関数は *anything* (:c:expr:`void*` と互換の型でなければなりません) を引数にし" @@ -1450,34 +1564,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..f4cc88252 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 @@ -36,10 +36,10 @@ msgid "" "normal creation and deletion functions don't apply to booleans. The " "following macros are available, however." msgstr "" -"Python の Bool 型は整数のサブクラスとして実装されています。ブール型の値は、 :" -"c:data:`Py_False` と :c:data:`Py_True` の 2 つしかありません。従って、通常の" -"生成/削除関数はブール型にはあてはまりません。とはいえ、以下のマクロが利用で" -"きます。" +"Python の Bool 型は整数のサブクラスとして実装されています。ブール型の値" +"は、 :c:data:`Py_False` と :c:data:`Py_True` の 2 つしかありません。従って、" +"通常の生成/削除関数はブール型にはあてはまりません。とはいえ、以下のマクロが" +"利用できます。" #: ../../c-api/bool.rst:16 msgid "" @@ -59,11 +59,11 @@ msgstr "" #: ../../c-api/bool.rst:28 msgid "" -"The Python ``False`` object. This object has no methods and is :term:" -"`immortal`." +"The Python ``False`` object. This object has no methods and " +"is :term:`immortal`." msgstr "" -"Python の ``False`` オブジェクト。このオブジェクトはメソッドを持たず、 :term:" -"`immortal` です。" +"Python の ``False`` オブジェクト。このオブジェクトはメソッドを持た" +"ず、 :term:`immortal` です。" #: ../../c-api/bool.rst:31 msgid ":c:data:`Py_False` is :term:`immortal`." @@ -71,11 +71,11 @@ msgstr ":c:data:`Py_False` は :term:`immortal` です。" #: ../../c-api/bool.rst:37 msgid "" -"The Python ``True`` object. This object has no methods and is :term:" -"`immortal`." +"The Python ``True`` object. This object has no methods and " +"is :term:`immortal`." msgstr "" -"Python の ``True`` オブジェクト。このオブジェクトはメソッドを持たず、 :term:" -"`immortal` です。" +"Python の ``True`` オブジェクト。このオブジェクトはメソッドを持た" +"ず、 :term:`immortal` です。" #: ../../c-api/bool.rst:40 msgid ":c:data:`Py_True` is :term:`immortal`." diff --git a/c-api/buffer.po b/c-api/buffer.po index c8874d0c3..8f8a23552 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 @@ -35,16 +35,16 @@ msgstr "バッファプロトコル (buffer Protocol)" #: ../../c-api/buffer.rst:18 msgid "" "Certain objects available in Python wrap access to an underlying memory " -"array or *buffer*. Such objects include the built-in :class:`bytes` and :" -"class:`bytearray`, and some extension types like :class:`array.array`. Third-" -"party libraries may define their own types for special purposes, such as " -"image processing or numeric analysis." +"array or *buffer*. Such objects include the built-in :class:`bytes` " +"and :class:`bytearray`, and some extension types like :class:`array.array`. " +"Third-party libraries may define their own types for special purposes, such " +"as image processing or numeric analysis." msgstr "" "Pythonで利用可能ないくつかのオブジェクトは、下層にあるメモリ配列または " -"*buffer* へのアクセスを提供します。このようなオブジェクトとして、組み込みの :" -"class:`bytes` や :class:`bytearray` 、 :class:`array.array` のようないくつか" -"の拡張型が挙げられます。サードバーティのライブラリは画像処理や数値解析のよう" -"な特別な目的のために、それら自身の型を定義することができます。" +"*buffer* へのアクセスを提供します。このようなオブジェクトとして、組み込み" +"の :class:`bytes` や :class:`bytearray` 、 :class:`array.array` のようないく" +"つかの拡張型が挙げられます。サードバーティのライブラリは画像処理や数値解析の" +"ような特別な目的のために、それら自身の型を定義することができます。" #: ../../c-api/buffer.rst:24 msgid "" @@ -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 "" @@ -92,23 +99,24 @@ msgstr "" #: ../../c-api/buffer.rst:47 msgid "" -"An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase." -"write` method of file objects: any object that can export a series of bytes " -"through the buffer interface can be written to a file. While :meth:`!write` " -"only needs read-only access to the internal contents of the object passed to " -"it, other methods such as :meth:`~io.BufferedIOBase.readinto` need write " -"access to the contents of their argument. The buffer interface allows " -"objects to selectively allow or reject exporting of read-write and read-only " -"buffers." -msgstr "" -"bufferインターフェースの利用者の一例は、ファイルオブジェクトの :meth:`~io." -"BufferedIOBase.write` メソッドです: bufferインターフェースを通して一連のバイ" -"ト列を提供できるどんなオブジェクトでもファイルに書き込むことができます。 :" -"meth:`!write` は、その引数として渡されたオブジェクトの内部要素に対する読み出" -"し専用アクセスのみを必要としますが、 :meth:`~io.BufferedIOBase.readinto` のよ" -"うな他のメソッドでは、その引数の内容に対する書き込みアクセスが必要です。" -"bufferインターフェースにより、オブジェクトは読み書き両方、読み出し専用バッ" -"ファへのアクセスを許可するかそれとも拒否するか選択することができます。" +"An example consumer of the buffer interface is " +"the :meth:`~io.BufferedIOBase.write` method of file objects: any object that " +"can export a series of bytes through the buffer interface can be written to " +"a file. While :meth:`!write` only needs read-only access to the internal " +"contents of the object passed to it, other methods such " +"as :meth:`~io.BufferedIOBase.readinto` need write access to the contents of " +"their argument. The buffer interface allows objects to selectively allow or " +"reject exporting of read-write and read-only buffers." +msgstr "" +"bufferインターフェースの利用者の一例は、ファイルオブジェクト" +"の :meth:`~io.BufferedIOBase.write` メソッドです: bufferインターフェースを通" +"して一連のバイト列を提供できるどんなオブジェクトでもファイルに書き込むことが" +"できます。 :meth:`!write` は、その引数として渡されたオブジェクトの内部要素に" +"対する読み出し専用アクセスのみを必要とします" +"が、 :meth:`~io.BufferedIOBase.readinto` のような他のメソッドでは、その引数の" +"内容に対する書き込みアクセスが必要です。bufferインターフェースにより、オブ" +"ジェクトは読み書き両方、読み出し専用バッファへのアクセスを許可するかそれとも" +"拒否するか選択することができます。" #: ../../c-api/buffer.rst:55 msgid "" @@ -140,11 +148,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" @@ -177,20 +186,20 @@ msgid "" "buffer is needed, a :ref:`memoryview ` object can be " "created." msgstr "" -"Pythonインタプリタによって提供される多くのデータ型とは異なり、バッファは :c:" -"type:`PyObject` ポインタではなく、シンプルなC 構造体です。そのため、作成とコ" -"ピーが非常に簡単に行えます。バッファの一般的なラッパーが必要なときは、 :ref:" -"`memoryview ` オブジェクトが作成されます。" +"Pythonインタプリタによって提供される多くのデータ型とは異なり、バッファ" +"は :c:type:`PyObject` ポインタではなく、シンプルなC 構造体です。そのため、作" +"成とコピーが非常に簡単に行えます。バッファの一般的なラッパーが必要なとき" +"は、 :ref:`memoryview ` オブジェクトが作成されます。" #: ../../c-api/buffer.rst:92 msgid "" "For short instructions how to write an exporting object, see :ref:`Buffer " -"Object Structures `. For obtaining a buffer, see :c:func:" -"`PyObject_GetBuffer`." +"Object Structures `. For obtaining a buffer, " +"see :c:func:`PyObject_GetBuffer`." msgstr "" "エクスポートされるオブジェクトを書く方法の短い説明には、 :ref:`Buffer Object " -"Structures ` を参照してください。バッファを取得するには、 :c:" -"func:`PyObject_GetBuffer` を参照してください。" +"Structures ` を参照してください。バッファを取得するに" +"は、 :c:func:`PyObject_GetBuffer` を参照してください。" #: ../../c-api/buffer.rst:100 msgid "" @@ -212,19 +221,22 @@ 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 "" -"As a special case, for *temporary* buffers that are wrapped by :c:func:" -"`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this field is " -"``NULL``. In general, exporting objects MUST NOT use this scheme." +"As a special case, for *temporary* buffers that are wrapped " +"by :c:func:`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this " +"field is ``NULL``. In general, exporting objects MUST NOT use this scheme." msgstr "" ":c:func:`PyMemoryView_FromBuffer` または :c:func:`PyBuffer_FillInfo` によって" "ラップされた *一時的な* バッファである特別なケースでは、このフィールドは " @@ -246,49 +258,48 @@ msgstr "" msgid "" "Accessing ``((char *)buf)[0] up to ((char *)buf)[len-1]`` is only valid if " "the buffer has been obtained by a request that guarantees contiguity. In " -"most cases such a request will be :c:macro:`PyBUF_SIMPLE` or :c:macro:" -"`PyBUF_WRITABLE`." +"most cases such a request will be :c:macro:`PyBUF_SIMPLE` " +"or :c:macro:`PyBUF_WRITABLE`." msgstr "" "``((char *)buf)[0]`` から ``((char *)buf)[len-1]`` の範囲へのアクセスは、連続" "性 (contiguity) を保証するリクエストによって取得されたバッファに対してのみ許" "されます。\n" -"多くの場合に、そのようなリクエストは :c:macro:`PyBUF_SIMPLE` または :c:macro:" -"`PyBUF_WRITABLE` です。" +"多くの場合に、そのようなリクエストは :c:macro:`PyBUF_SIMPLE` また" +"は :c:macro:`PyBUF_WRITABLE` です。" #: ../../c-api/buffer.rst:135 msgid "" "An indicator of whether the buffer is read-only. This field is controlled by " "the :c:macro:`PyBUF_WRITABLE` flag." msgstr "" -"バッファが読み出し専用であるか示します。このフィールドは :c:macro:" -"`PyBUF_WRITABLE` フラグで制御できます。" +"バッファが読み出し専用であるか示します。このフィールド" +"は :c:macro:`PyBUF_WRITABLE` フラグで制御できます。" #: ../../c-api/buffer.rst:140 msgid "" -"Item size in bytes of a single element. Same as the value of :func:`struct." -"calcsize` called on non-``NULL`` :c:member:`~Py_buffer.format` values." +"Item size in bytes of a single element. Same as the value " +"of :func:`struct.calcsize` called on non-" +"``NULL`` :c:member:`~Py_buffer.format` values." msgstr "" "要素一つ分のbyte単位のサイズ。\n" ":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." +"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 "" "If :c:member:`~Py_buffer.shape` is present, the equality ``product(shape) * " -"itemsize == len`` still holds and the consumer can use :c:member:`~Py_buffer." -"itemsize` to navigate the buffer." +"itemsize == len`` still holds and the consumer can " +"use :c:member:`~Py_buffer.itemsize` to navigate the buffer." msgstr "" ":c:member:`~Py_buffer.shape` が存在する場合、 ``product(shape) * itemsize == " "len`` の等式が守られ、利用者は :c:member:`~Py_buffer.itemsize` を buffer を読" @@ -296,44 +307,54 @@ msgstr "" #: ../../c-api/buffer.rst:152 msgid "" -"If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of a :c:macro:" -"`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the consumer must " -"disregard :c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``." +"If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of " +"a :c:macro:`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the " +"consumer must disregard :c:member:`~Py_buffer.itemsize` and assume " +"``itemsize == 1``." msgstr "" -":c:macro:`PyBUF_SIMPLE` または :c:macro:`PyBUF_WRITABLE` で要求した結果、 :c:" -"member:`~Py_buffer.shape` が ``NULL`` であれば、消費者は :c:member:" -"`~Py_buffer.itemsize` を無視して ``itemsize == 1`` と見なさなければなりませ" -"ん。" +":c:macro:`PyBUF_SIMPLE` または :c:macro:`PyBUF_WRITABLE` で要求した結" +"果、 :c:member:`~Py_buffer.shape` が ``NULL`` であれば、消費者" +"は :c:member:`~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 " -"a scalar. In this case, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." -"strides` and :c:member:`~Py_buffer.suboffsets` MUST be ``NULL``. The maximum " -"number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." -msgstr "" +"a scalar. In this " +"case, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.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 "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "indicating the shape of the memory as an n-dimensional array. Note that " -"``shape[0] * ... * shape[ndim-1] * itemsize`` MUST be equal to :c:member:" -"`~Py_buffer.len`." +"``shape[0] * ... * shape[ndim-1] * itemsize`` MUST be equal " +"to :c:member:`~Py_buffer.len`." msgstr "" -"メモリ上のN次元配列の形を示す、長さが :c:member:`~Py_buffer.ndim` である :c:" -"type:`Py_ssize_t` の配列です。\n" +"メモリ上のN次元配列の形を示す、長さが :c:member:`~Py_buffer.ndim` であ" +"る :c:type:`Py_ssize_t` の配列です。\n" "``shape[0] * ... * shape[ndim-1] * itemsize`` は :c:member:`~Py_buffer.len` " "と等しくなければなりません。" @@ -346,27 +367,26 @@ 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 "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "giving the number of bytes to skip to get to a new element in each dimension." msgstr "" -"各次元において新しい値を得るためにスキップするバイト数を示す、長さ :c:member:" -"`~Py_buffer.ndim` の :c:type:`Py_ssize_t` の配列。" +"各次元において新しい値を得るためにスキップするバイト数を示す、長" +"さ :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 +443,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" @@ -464,19 +487,16 @@ msgstr "リクエストに依存しないフィールド" #: ../../c-api/buffer.rst:249 msgid "" "The following fields are not influenced by *flags* and must always be filled " -"in with the correct values: :c:member:`~Py_buffer.obj`, :c:member:" -"`~Py_buffer.buf`, :c:member:`~Py_buffer.len`, :c:member:`~Py_buffer." -"itemsize`, :c:member:`~Py_buffer.ndim`." +"in with the correct " +"values: :c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`, :c:member:`~Py_buffer.len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -"下記のフィールドは *flags* の影響を受けずに、常に正しい値で設定されます。: :" -"c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`, :c:member:`~Py_buffer." -"len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`." +"下記のフィールドは *flags* の影響を受けずに、常に正しい値で設定されま" +"す。: :c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`, :c:member:`~Py_buffer.len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`." #: ../../c-api/buffer.rst:254 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 +504,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 "" @@ -497,22 +524,25 @@ msgstr "" #: ../../c-api/buffer.rst:270 msgid "" ":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next " -"section. Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:" -"`PyBUF_WRITABLE` can be used as a stand-alone flag to request a simple " -"writable buffer." +"section. Since :c:macro:`PyBUF_SIMPLE` is defined as " +"0, :c:macro:`PyBUF_WRITABLE` can be used as a stand-alone flag to request a " +"simple writable buffer." msgstr "" ":c:macro:`PyBUF_WRITABLE` は、次の節に出てくるどのフラグとも \\| を取ってかま" "いません。\n" -":c:macro:`PyBUF_SIMPLE` は 0 と定義されているので、 :c:macro:" -"`PyBUF_WRITABLE` は単純な書き込み可能なバッファを要求する単独のフラグとして使" -"えます。" +":c:macro:`PyBUF_SIMPLE` は 0 と定義されているの" +"で、 :c:macro:`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." +":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 +608,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" @@ -667,20 +697,21 @@ msgstr "NumPy スタイル: shape, strides" #: ../../c-api/buffer.rst:364 msgid "" -"The logical structure of NumPy-style arrays is defined by :c:member:" -"`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." -"shape` and :c:member:`~Py_buffer.strides`." +"The logical structure of NumPy-style arrays is defined " +"by :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer.shape` " +"and :c:member:`~Py_buffer.strides`." msgstr "" -"NumPy スタイルの配列の論理的構造は :c:member:`~Py_buffer.itemsize`, :c:" -"member:`~Py_buffer.ndim`, :c:member:`~Py_buffer.shape`, :c:member:" -"`~Py_buffer.strides` で定義されます。" +"NumPy スタイルの配列の論理的構造" +"は :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides` " +"で定義されます。" #: ../../c-api/buffer.rst:367 msgid "" -"If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." -"buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " -"that case, both :c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer." -"strides` are ``NULL``." +"If ``ndim == 0``, the memory location pointed to " +"by :c:member:`~Py_buffer.buf` is interpreted as a scalar of " +"size :c:member:`~Py_buffer.itemsize`. In that case, " +"both :c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer.strides` are " +"``NULL``." msgstr "" "``ndim == 0`` の場合は、 :c:member:`~Py_buffer.buf` が指すメモリの場所は、サ" "イズが :c:member:`~Py_buffer.itemsize` のスカラ値として解釈されます。\n" @@ -698,12 +729,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 +748,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 +775,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 +832,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 +846,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" @@ -810,61 +878,67 @@ msgstr "" #: ../../c-api/buffer.rst:456 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " -"the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" -"`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." +"the exporter cannot provide a buffer of the exact type, it MUST " +"raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" "*exporter* に *flags* で指定された方法で *view* を埋めるように要求します。も" -"し exporter が指定されたとおりにバッファを提供できない場合、 :exc:" -"`BufferError` を送出し、 ``view->obj`` を ``NULL`` に設定した上で、 ``-1`` を" -"返さなければなりません。" +"し exporter が指定されたとおりにバッファを提供できない場" +"合、 :exc:`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 "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " -"to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" -"`free`. Thus, after the consumer is done with the buffer, :c:func:" -"`PyBuffer_Release` must be called exactly once." +"to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` " +"and :c:func:`free`. Thus, after the consumer is done with the " +"buffer, :c:func:`PyBuffer_Release` must be called exactly once." msgstr "" -":c:func:`malloc` と :c:func:`free` のように、呼び出しに成功した :c:func:" -"`PyObject_GetBuffer` と対になる :c:func:`PyBuffer_Release` の呼び出しがなけれ" -"なればなりません。\n" +":c:func:`malloc` と :c:func:`free` のように、呼び出しに成功し" +"た :c:func:`PyObject_GetBuffer` と対になる :c:func:`PyBuffer_Release` の呼び" +"出しがなけれなればなりません。\n" "従って、バッファの利用が済んだら :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 "" -"It is an error to call this function on a buffer that was not obtained via :" -"c:func:`PyObject_GetBuffer`." +"It is an error to call this function on a buffer that was not obtained " +"via :c:func:`PyObject_GetBuffer`." 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." +"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 +972,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 +1016,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 +1051,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..26af1cdb3 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 @@ -69,20 +69,18 @@ msgstr "ダイレクト API 関数" #: ../../c-api/bytearray.rst:42 msgid "" -"Return a new bytearray object from any object, *o*, that implements the :ref:" -"`buffer protocol `." +"Return a new bytearray object from any object, *o*, that implements " +"the :ref:`buffer protocol `." 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..9f06932c7 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,48 +289,48 @@ 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 " "buffer is always null, regardless of whether there are any other null " "bytes. The data must not be modified in any way, unless the object was just " "created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be " -"deallocated. If *o* is not a bytes object at all, :c:func:" -"`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`." +"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,21 +339,22 @@ 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 "" "Previously, :exc:`TypeError` was raised when embedded null bytes were " "encountered in the bytes object." msgstr "" -"以前は bytes オブジェクトにヌルバイトが埋め込まれていたときに :exc:" -"`TypeError` を送出していました。" +"以前は bytes オブジェクトにヌルバイトが埋め込まれていたとき" +"に :exc:`TypeError` を送出していました。" #: ../../c-api/bytes.rst:178 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.)" +"*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 `." +"*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..2465b211d 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -21,85 +21,105 @@ 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." +"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, " -"some third-party extensions use *tp_call* directly (rather than using :c:" -"func:`PyObject_Call`). Therefore, a class supporting vectorcall must also " -"implement :c:member:`~PyTypeObject.tp_call`. Moreover, the callable must " -"behave the same regardless of which protocol is used. The recommended way to " -"achieve this is by setting :c:member:`~PyTypeObject.tp_call` to :c:func:" -"`PyVectorcall_Call`. This bears repeating:" -msgstr "" +"some third-party extensions use *tp_call* directly (rather than " +"using :c:func:`PyObject_Call`). Therefore, a class supporting vectorcall " +"must also implement :c:member:`~PyTypeObject.tp_call`. Moreover, the " +"callable must behave the same regardless of which protocol is used. The " +"recommended way to 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" +"繰り返しますが、次の点が重要です。" + +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:57 -msgid "" -"A class supporting vectorcall **must** also implement :c:member:" -"`~PyTypeObject.tp_call` with the same semantics." -msgstr "" - -#: ../../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,27 +128,39 @@ 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." -"tp_vectorcall_offset` to the offset inside the object structure where a " -"*vectorcallfunc* appears. This is a pointer to a function with the following " -"signature:" +"Classes can implement the vectorcall protocol by enabling " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag and " +"setting :c:member:`~PyTypeObject.tp_vectorcall_offset` to the offset inside " +"the object structure where a *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 +183,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*." +"`: 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``." +"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 +365,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 +382,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 +404,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 +433,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 +444,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 +455,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 +479,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 +518,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." +"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:expr:`PyObject *` args だけを引数に渡す場合" +"は、 :c:func:`PyObject_CallFunctionObjArgs` がより速い方法であることを覚えて" +"おいてください。" #: ../../c-api/call.rst:279 msgid "The type of *format* was changed from ``char *``." @@ -490,9 +541,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 +550,13 @@ 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." +"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` がより速い方法であることを覚えておいてくださ" -"い。 " +":c:expr:`PyObject *` args だけを引数に渡す場合" +"は、 :c:func:`PyObject_CallMethodObjArgs` がより速い方法であることを覚えてお" +"いてください。" #: ../../c-api/call.rst:300 msgid "The types of *name* and *format* were changed from ``char *``." @@ -515,9 +564,9 @@ msgstr "*name* と *format* の型が ``char *`` から変更されました。" #: ../../c-api/call.rst:306 msgid "" -"Call a callable Python object *callable*, with a variable number of :c:expr:" -"`PyObject *` arguments. The arguments are provided as a variable number of " -"parameters followed by *NULL*." +"Call a callable Python object *callable*, with a variable number " +"of :c:expr:`PyObject *` arguments. The arguments are provided as a variable " +"number of parameters followed by *NULL*." msgstr "" "呼び出し可能な Python オブジェクト *callable* を可変数個の :c:expr:`PyObject " "*` 引数とともに呼び出します。引数列は末尾に *NULL* がついた可変数個のパラメタ" @@ -541,62 +590,79 @@ 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*." +"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 " "is *args[0]*, and the *args* array starting at *args[1]* represents the " "arguments of the call. There must be at least one positional argument. " -"*nargsf* is the number of positional arguments including *args[0]*, plus :c:" -"macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` if the value of ``args[0]`` may " -"temporarily be changed. Keyword arguments can be passed just like in :c:func:" -"`PyObject_Vectorcall`." +"*nargsf* is the number of positional arguments including *args[0]*, " +"plus :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` if the value of ``args[0]`` " +"may 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..edd7ebde3 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 "" @@ -110,9 +108,9 @@ msgid "" "should be specified as ``modulename.attributename``. This will enable other " "modules to import the capsule using :c:func:`PyCapsule_Import`." msgstr "" -"このカプセルがモジュールの属性として保存される場合、 *name* は ``modulename." -"attributename`` と指定されるべきです。こうすると、他のモジュールがそのカプセ" -"ルを :c:func:`PyCapsule_Import` でインポートすることができます。" +"このカプセルがモジュールの属性として保存される場合、 *name* は " +"``modulename.attributename`` と指定されるべきです。こうすると、他のモジュール" +"がそのカプセルを :c:func:`PyCapsule_Import` でインポートすることができます。" #: ../../c-api/capsule.rst:62 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 "" @@ -141,8 +143,8 @@ msgstr "" #: ../../c-api/capsule.rst:76 msgid "" "It is legal for a capsule to have a ``NULL`` destructor. This makes a " -"``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :" -"c:func:`PyErr_Occurred` to disambiguate." +"``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` " +"or :c:func:`PyErr_Occurred` to disambiguate." msgstr "" "カプセルは ``NULL`` をデストラクタとして持つことができます。従って、戻り値の " "``NULL`` がエラーを指してない可能性があります。 :c:func:`PyCapsule_IsValid` " @@ -159,8 +161,8 @@ msgstr "" #: ../../c-api/capsule.rst:86 msgid "" "It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL`` " -"return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:" -"`PyErr_Occurred` to disambiguate." +"return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` " +"or :c:func:`PyErr_Occurred` to disambiguate." msgstr "" "カプセルは ``NULL`` をコンテキストとして持つことができます。従って、戻り値の " "``NULL`` がエラーを指してない可能性があります。 :c:func:`PyCapsule_IsValid` " @@ -177,32 +179,35 @@ msgstr "" #: ../../c-api/capsule.rst:96 msgid "" "It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` " -"return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:" -"`PyErr_Occurred` to disambiguate." +"return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` " +"or :c:func:`PyErr_Occurred` to disambiguate." msgstr "" "カプセルは ``NULL`` を name として持つことができます。従って、戻り値の " "``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..6bc4f2d93 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,108 @@ msgstr "" "コードオブジェクトを表現するために利用されるC構造体。この型のフィールドは何時" "でも変更され得ます。" -#: ../../c-api/code.rst:24 msgid "" -"This is an instance of :c:type:`PyTypeObject` representing the Python :ref:" -"`code object `." +"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." +"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 "" @@ -143,83 +158,106 @@ msgstr "" #: ../../c-api/code.rst:101 msgid "" -"For efficiently iterating over the line numbers in a code object, use :pep:" -"`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." +"For efficiently iterating over the line numbers in a code object, " +"use :pep:`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." +"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.)" +"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 +267,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 +287,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``." +"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 +311,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 +348,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`." +"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..0a3e386f2 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 "" @@ -63,8 +66,8 @@ msgstr "汎用の codec ベースの encode API." msgid "" "*object* is passed through the encoder function found for the given " "*encoding* using the error handling method defined by *errors*. *errors* " -"may be ``NULL`` to use the default method defined for the codec. Raises a :" -"exc:`LookupError` if no encoder can be found." +"may be ``NULL`` to use the default method defined for the codec. Raises " +"a :exc:`LookupError` if no encoder can be found." msgstr "" "*encoding* に応じて見つかったエンコーダ関数に対して *object* を渡します。\n" "エラーハンドリングメソッドは *errors* で指定します。\n" @@ -80,8 +83,8 @@ msgstr "汎用の codec ベースのデコード API." msgid "" "*object* is passed through the decoder function found for the given " "*encoding* using the error handling method defined by *errors*. *errors* " -"may be ``NULL`` to use the default method defined for the codec. Raises a :" -"exc:`LookupError` if no encoder can be found." +"may be ``NULL`` to use the default method defined for the codec. Raises " +"a :exc:`LookupError` if no encoder can be found." msgstr "" "*encoding* に応じて見つかったデコーダ関数に対して *object* を渡します。\n" "エラーハンドリングメソッドは *errors* で指定します。\n" @@ -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." +"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*." @@ -161,9 +163,9 @@ msgstr "" #: ../../c-api/codec.rst:88 msgid "" -"The callback gets a single argument, an instance of :exc:" -"`UnicodeEncodeError`, :exc:`UnicodeDecodeError` or :exc:" -"`UnicodeTranslateError` that holds information about the problematic " +"The callback gets a single argument, an instance " +"of :exc:`UnicodeEncodeError`, :exc:`UnicodeDecodeError` " +"or :exc:`UnicodeTranslateError` that holds information about the problematic " "sequence of characters or bytes and their offset in the original string " "(see :ref:`unicodeexceptions` for functions to extract this information). " "The callback must either raise the given exception, or return a two-item " @@ -171,13 +173,14 @@ msgid "" "integer giving the offset in the original string at which encoding/decoding " "should be resumed." msgstr "" -"コールバックは1つの引数として、 :exc:`UnicodeEncodeError`, :exc:" -"`UnicodeDecodeError`, :exc:`UnicodeTranslateError` のどれかのインスタンスを受" -"け取ります。このインスタンスは問題のある文字列やバイト列に関する情報と、その" -"元の文字列中のオフセットを持っています。(その情報を取得するための関数について" -"は :ref:`unicodeexceptions` を参照してください。) コールバックは渡された例外" -"を発生させるか、2要素のタプルに問題のシーケンスの代替と、 encode/decode を再" -"開する元の文字列中のオフセットとなる整数を格納して返します。" +"コールバックは1つの引数とし" +"て、 :exc:`UnicodeEncodeError`, :exc:`UnicodeDecodeError`, :exc:`UnicodeTranslateError` " +"のどれかのインスタンスを受け取ります。このインスタンスは問題のある文字列やバ" +"イト列に関する情報と、その元の文字列中のオフセットを持っています。(その情報を" +"取得するための関数については :ref:`unicodeexceptions` を参照してください。) " +"コールバックは渡された例外を発生させるか、2要素のタプルに問題のシーケンスの代" +"替と、 encode/decode を再開する元の文字列中のオフセットとなる整数を格納して返" +"します。" #: ../../c-api/codec.rst:98 msgid "Return ``0`` on success, ``-1`` on error." diff --git a/c-api/complex.po b/c-api/complex.po index 9d7ceae70..782706a56 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 "" @@ -82,14 +84,14 @@ msgstr "二つの複素数の和を C の :c:type:`Py_complex` 型で返しま #: ../../c-api/complex.rst:49 msgid "" -"Return the difference between two complex numbers, using the C :c:type:" -"`Py_complex` representation." +"Return the difference between two complex numbers, using the " +"C :c:type:`Py_complex` representation." msgstr "二つの複素数の差を C の :c:type:`Py_complex` 型で返します。" #: ../../c-api/complex.rst:55 msgid "" -"Return the negation of the complex number *num*, using the C :c:type:" -"`Py_complex` representation." +"Return the negation of the complex number *num*, using the " +"C :c:type:`Py_complex` representation." msgstr "複素数 *num* の符号反転 C の :c:type:`Py_complex` 型で返します。" #: ../../c-api/complex.rst:61 @@ -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`." +"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` 型で返します。" +"Return the exponentiation of *num* by *exp*, using the " +"C :c:type:`Py_complex` representation." +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" @@ -149,8 +148,8 @@ msgstr "" #: ../../c-api/complex.rst:102 msgid "" -"Return true if its argument is a :c:type:`PyComplexObject` or a subtype of :" -"c:type:`PyComplexObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyComplexObject` or a subtype " +"of :c:type:`PyComplexObject`. This function always succeeds." msgstr "" "引数が :c:type:`PyComplexObject` か :c:type:`PyComplexObject` のサブタイプで" "あるときに真を返します。この関数は常に成功します。" @@ -163,72 +162,94 @@ 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." +"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 " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " -"success." +"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 ``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 " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " -"defined then it falls back to :meth:`~object.__index__`." +"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 :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." +"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..1e8475a5b 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 @@ -31,14 +31,15 @@ msgstr "コンテキスト変数オブジェクト" #: ../../c-api/contextvars.rst:15 msgid "" "In Python 3.7.1 the signatures of all context variables C APIs were " -"**changed** to use :c:type:`PyObject` pointers instead of :c:type:" -"`PyContext`, :c:type:`PyContextVar`, and :c:type:`PyContextToken`, e.g.::" +"**changed** to use :c:type:`PyObject` pointers instead " +"of :c:type:`PyContext`, :c:type:`PyContextVar`, " +"and :c:type:`PyContextToken`, e.g.::" msgstr "" -"Python 3.7.1 で全てのコンテキスト変数の C API のシグネチャは、 :c:type:" -"`PyContext`, :c:type:`PyContextVar`, :c:type:`PyContextToken` の代わりに :c:" -"type:`PyObject` ポインタを使うように **変更** されました。例えば::" +"Python 3.7.1 で全てのコンテキスト変数の C API のシグネチャ" +"は、 :c:type:`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 +47,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 +168,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.)" +"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``." +"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 +232,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,20 +290,19 @@ 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 "" -"Reset the state of the *var* context variable to that it was in before :c:" -"func:`PyContextVar_Set` that returned the *token* was called. This function " -"returns ``0`` on success and ``-1`` on error." +"Reset the state of the *var* context variable to that it was in " +"before :c:func:`PyContextVar_Set` that returned the *token* was called. This " +"function returns ``0`` on success and ``-1`` on error." msgstr "" -"*var* コンテキスト変数の状態をリセットし、 *token* を返した :c:func:" -"`PyContextVar_Set` が呼ばれる前の状態に戻します。\n" +"*var* コンテキスト変数の状態をリセットし、 *token* を返し" +"た :c:func:`PyContextVar_Set` が呼ばれる前の状態に戻します。\n" "この関数は成功したら ``0`` 、失敗したら ``-1`` を返します。" diff --git a/c-api/conversion.po b/c-api/conversion.po index f525e64b3..a6c1c587f 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 @@ -34,8 +34,8 @@ msgstr "数値変換と、書式化文字列出力のための関数群。" #: ../../c-api/conversion.rst:13 msgid "" "Output not more than *size* bytes to *str* according to the format string " -"*format* and the extra arguments. See the Unix man page :manpage:" -"`snprintf(3)`." +"*format* and the extra arguments. See the Unix man " +"page :manpage:`snprintf(3)`." msgstr "" "書式文字列 *format* と追加の引数から、 *size* バイトを超えない文字列を *str* " "に出力します。 Unix man page の :manpage:`snprintf(3)` を参照してください。" @@ -43,8 +43,8 @@ msgstr "" #: ../../c-api/conversion.rst:19 msgid "" "Output not more than *size* bytes to *str* according to the format string " -"*format* and the variable argument list *va*. Unix man page :manpage:" -"`vsnprintf(3)`." +"*format* and the variable argument list *va*. Unix man " +"page :manpage:`vsnprintf(3)`." msgstr "" "書式文字列 *format* と可変長引数リスト *va* から、 *size* バイトを超えない文" "字列を *str* に出力します。 Unix man page の :manpage:`vsnprintf(3)` を参照し" @@ -57,11 +57,11 @@ msgid "" "is to guarantee consistent behavior in corner cases, which the Standard C " "functions do not." msgstr "" -":c:func:`PyOS_snprintf` と :c:func:`PyOS_vsnprintf` は標準Cライブラリの :c:" -"func:`snprintf` と :c:func:`vsnprintf` 関数をラップします。これらの関数の目的" -"は、C標準ライブラリが保証していないコーナーケースでの動作を保証することです。" +":c:func:`PyOS_snprintf` と :c:func:`PyOS_vsnprintf` は標準Cライブラリ" +"の :c: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 +70,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 +118,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 +135,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." +"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 "" @@ -170,13 +189,13 @@ msgstr "" #: ../../c-api/conversion.rst:95 msgid "" -"If ``endptr`` is ``NULL``, convert the whole string. Raise :exc:" -"`ValueError` and return ``-1.0`` if the string is not a valid representation " -"of a floating-point number." +"If ``endptr`` is ``NULL``, convert the whole string. " +"Raise :exc:`ValueError` and return ``-1.0`` if the string is not a valid " +"representation of a floating-point number." msgstr "" "``endptr`` が ``NULL`` の場合、変換は文字列全体に対して行われます。文字列が正" -"しい浮動小数点数の表現になっていない場合は ``-1.0`` を返して :exc:" -"`ValueError` を発生させます。" +"しい浮動小数点数の表現になっていない場合は ``-1.0`` を返し" +"て :exc:`ValueError` を発生させます。" #: ../../c-api/conversion.rst:99 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..9e768c655 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 @@ -33,18 +33,18 @@ msgstr "DateTime オブジェクト" msgid "" "Various date and time objects are supplied by the :mod:`datetime` module. " "Before using any of these functions, the header file :file:`datetime.h` must " -"be included in your source (note that this is not included by :file:`Python." -"h`), and the macro :c:macro:`!PyDateTime_IMPORT` must be invoked, usually as " -"part of the module initialisation function. The macro puts a pointer to a C " -"structure into a static variable, :c:data:`!PyDateTimeAPI`, that is used by " -"the following macros." +"be included in your source (note that this is not included " +"by :file:`Python.h`), and the macro :c:macro:`!PyDateTime_IMPORT` must be " +"invoked, usually as part of the module initialisation function. The macro " +"puts a pointer to a C structure into a static variable, :c:data:`!" +"PyDateTimeAPI`, that is used by the following macros." msgstr "" ":mod:`datetime` モジュールでは、様々な日付オブジェクトや時刻オブジェクトを提" -"供しています。以下に示す関数を使う場合には、あらかじめヘッダファイル :file:" -"`datetime.h` をソースに include し (:file:`Python.h` はこのファイルを " -"include しません)、 :c:macro:`!PyDateTime_IMPORT` マクロを、通常はモジュール" -"初期化関数から、起動しておく必要があります。このマクロは以下のマクロで使われ" -"る静的変数 :c:data:`!PyDateTimeAPI` に C 構造体へのポインタを入れます。" +"供しています。以下に示す関数を使う場合には、あらかじめヘッダファイ" +"ル :file:`datetime.h` をソースに include し (:file:`Python.h` はこのファイル" +"を include しません)、 :c:macro:`!PyDateTime_IMPORT` マクロを、通常はモジュー" +"ル初期化関数から、起動しておく必要があります。このマクロは以下のマクロで使わ" +"れる静的変数 :c:data:`!PyDateTimeAPI` に C 構造体へのポインタを入れます。" #: ../../c-api/datetime.rst:18 msgid "This subtype of :c:type:`PyObject` represents a Python date object." @@ -97,8 +97,8 @@ msgstr "" #: ../../c-api/datetime.rst:49 msgid "" "This instance of :c:type:`PyTypeObject` represents Python type for the " -"difference between two datetime values; it is the same object as :class:" -"`datetime.timedelta` in the Python layer." +"difference between two datetime values; it is the same object " +"as :class:`datetime.timedelta` in the Python layer." msgstr "" #: ../../c-api/datetime.rst:55 @@ -116,11 +116,11 @@ msgstr "UTCシングルトンにアクセスするためのマクロ:" #: ../../c-api/datetime.rst:63 msgid "" -"Returns the time zone singleton representing UTC, the same object as :attr:" -"`datetime.timezone.utc`." +"Returns the time zone singleton representing UTC, the same object " +"as :attr:`datetime.timezone.utc`." msgstr "" -"UTCタイムゾーンに相当するシングルトンを返します。これは :attr:`datetime." -"timezone.utc` と同じオブジェクトです。" +"UTCタイムゾーンに相当するシングルトンを返します。これ" +"は :attr:`datetime.timezone.utc` と同じオブジェクトです。" #: ../../c-api/datetime.rst:69 msgid "Type-check macros:" @@ -239,8 +239,8 @@ msgid "" "Return a :class:`datetime.datetime` object with the specified year, month, " "day, hour, minute, second, microsecond and fold." msgstr "" -"指定された年、月、日、時、分、秒、マイクロ秒、fold の :class:`datetime." -"datetime` オブジェクトを返します。" +"指定された年、月、日、時、分、秒、マイクロ秒、fold " +"の :class:`datetime.datetime` オブジェクトを返します。" #: ../../c-api/datetime.rst:159 msgid "" @@ -274,28 +274,28 @@ msgid "" "Return a :class:`datetime.timezone` object with an unnamed fixed offset " "represented by the *offset* argument." msgstr "" -"*offset* 引数で指定した固定オフセットを持つ、名前のない :class:`datetime." -"timezone` オブジェクトを返します。" +"*offset* 引数で指定した固定オフセットを持つ、名前のな" +"い :class:`datetime.timezone` オブジェクトを返します。" #: ../../c-api/datetime.rst:189 msgid "" "Return a :class:`datetime.timezone` object with a fixed offset represented " "by the *offset* argument and with tzname *name*." msgstr "" -"*offset*引数で指定した固定のオフセットと、*name* のタイムゾーン名を持つ :" -"class:`datetime.timezone` オブジェクトを返します。" +"*offset*引数で指定した固定のオフセットと、*name* のタイムゾーン名を持" +"つ :class:`datetime.timezone` オブジェクトを返します。" #: ../../c-api/datetime.rst:195 msgid "" "Macros to extract fields from date objects. The argument must be an " -"instance of :c:type:`PyDateTime_Date`, including subclasses (such as :c:type:" -"`PyDateTime_DateTime`). The argument must not be ``NULL``, and the type is " -"not checked:" +"instance of :c:type:`PyDateTime_Date`, including subclasses (such " +"as :c:type:`PyDateTime_DateTime`). The argument must not be ``NULL``, and " +"the type is not checked:" msgstr "" "以下のマクロは date オブジェクトからフィールド値を取り出すためのものです。引" -"数は :c:type:`PyDateTime_Date` またはそのサブクラス (例えば :c:type:" -"`PyDateTime_DateTime`)の インスタンスでなければなりません。引数を ``NULL`` " -"にしてはならず、型チェックは行いません:" +"数は :c:type:`PyDateTime_Date` またはそのサブクラス (例え" +"ば :c:type:`PyDateTime_DateTime`)の インスタンスでなければなりません。引数" +"を ``NULL`` にしてはならず、型チェックは行いません:" #: ../../c-api/datetime.rst:202 msgid "Return the year, as a positive int." @@ -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..aafa17f94 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 @@ -71,10 +71,10 @@ msgid "" "read-only behavior. This is normally used to create a view to prevent " "modification of the dictionary for non-dynamic class types." msgstr "" -"あるマップ型オブジェクトに対して、読み出し専用に制限された :class:`types." -"MappingProxyType` オブジェクトを返します。通常、この関数は動的でないクラス型 " -"(non-dynamic class type) のクラス辞書が変更されないようにビューを作成するため" -"に使われます。" +"あるマップ型オブジェクトに対して、読み出し専用に制限され" +"た :class:`types.MappingProxyType` オブジェクトを返します。通常、この関数は動" +"的でないクラス型 (non-dynamic class type) のクラス辞書が変更されないように" +"ビューを作成するために使われます。" #: ../../c-api/dict.rst:48 msgid "Empty an existing dictionary of all key-value pairs." @@ -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*`." +"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*." @@ -103,10 +105,10 @@ msgstr "*p* と同じキーと値のペアが入った新たな辞書を返し #: ../../c-api/dict.rst:74 msgid "" -"Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" -"term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " -"on success or ``-1`` on failure. This function *does not* steal a reference " -"to *val*." +"Insert *val* into the dictionary *p* with a key of *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return " +"``0`` on success or ``-1`` on failure. This function *does not* steal a " +"reference to *val*." msgstr "" "辞書 *p* に、 *key* をキーとして値 *val* を挿入します。\n" "*key* はハッシュ可能(:term:`hashable`)でなければなりません。ハッシュ可能でな" @@ -114,75 +116,85 @@ 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*`." +"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 "" -"Remove the entry in dictionary *p* with key *key*. *key* must be :term:" -"`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " -"dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on " -"failure." +"Remove the entry in dictionary *p* with key *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is " +"not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or " +"``-1`` on failure." msgstr "" "辞書 *p* から *key* をキーとするエントリを除去します。 *key* は :term:`ハッ" -"シュ可能 ` でなければなりません; ハッシュ可能でない場合、 :exc:" -"`TypeError` を送出します。*key* が辞書になければ、:exc:`KeyError` を送出しま" -"す。成功した場合には ``0`` を、失敗した場合には ``-1`` を返します。" +"シュ可能 ` でなければなりません; ハッシュ可能でない場" +"合、 :exc:`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*`." +"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." +"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,36 @@ 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*`." +"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." +"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*`." +"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 +252,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 +262,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,29 +291,32 @@ 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 "" -"Similar to :meth:`dict.pop`, but without the default value and not raising :" -"exc:`KeyError` if the key missing." +"Similar to :meth:`dict.pop`, but without the default value and not " +"raising :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,37 +341,34 @@ 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 " -"first call to this function to start the iteration; the function returns " -"true for each pair in the dictionary, and false once all pairs have been " -"reported. The parameters *pkey* and *pvalue* should either point to :c:expr:" -"`PyObject*` variables that will be filled in with each key and value, " -"respectively, or may be ``NULL``. Any references returned through them are " -"borrowed. *ppos* should not be altered during iteration. Its value " -"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" -"この値は内部的な辞書構造体のオフセットを表現しており、構造体はスパースなの" -"で、オフセットの値に一貫性がないためです。" +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 first call to this function to start the iteration; the " +"function returns true for each pair in the dictionary, and false once all " +"pairs have been reported. The parameters *pkey* and *pvalue* should either " +"point to :c:expr:`PyObject*` variables that will be filled in with each key " +"and value, respectively, or may be ``NULL``. Any references returned " +"through them are borrowed. *ppos* should not be altered during iteration. " +"Its value 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" +"この関数は辞書内の各ペアについて真を返し、すべてのペアを返し終わると偽を返し" +"ます。\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 +378,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 +396,6 @@ msgstr "" "応する値を変更しても大丈夫になりましたが、キーの集合を変更しないことが前提で" "す。以下に例を示します::" -#: ../../c-api/dict.rst:275 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -374,15 +415,32 @@ 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 "" "The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:" -"`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +"threading>` build without external synchronization. You can " +"use :c:macro:`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 +448,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,28 +462,29 @@ 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 "" -"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." -"update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " -"to the iterating over a sequence of key value pairs if the second argument " -"has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " +"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to " +"``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall " +"back to the iterating over a sequence of key value pairs if the second " +"argument has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " "exception was raised." msgstr "" -"C で表せば ``PyDict_Merge(a, b, 1)`` と同じで、また Python の ``a." -"update(b)`` と似ていますが、 :c:func:`PyDict_Update` は第二引数が \"keys\" 属" -"性を持たない場合にキー/値ペアのシーケンスを反復することはありません。成功した" -"場合には ``0`` を返し、例外が送出された場合には ``-1`` を返します。" +"C で表せば ``PyDict_Merge(a, b, 1)`` と同じで、また Python の " +"``a.update(b)`` と似ていますが、 :c:func:`PyDict_Update` は第二引数が " +"\"keys\" 属性を持たない場合にキー/値ペアのシーケンスを反復することはありませ" +"ん。成功した場合には ``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 +492,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.)" +"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 " +"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 +576,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 +614,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``." +"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 +644,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..dc7533c7d 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,18 +133,21 @@ 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 " -"variables :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." -"last_traceback` are also set to the type, value and traceback of this " -"exception, respectively." +"variables :data:`sys.last_type`, :data:`sys.last_value` " +"and :data:`sys.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 "" @@ -232,8 +254,8 @@ msgstr "" msgid "" "This function sets the error indicator and returns ``NULL``. *exception* " "should be a Python exception class. The *format* and subsequent parameters " -"help format the error message; they have the same meaning and values as in :" -"c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." +"help format the error message; they have the same meaning and values as " +"in :c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." msgstr "" "この関数はエラーインジケータを設定し ``NULL`` を返します。 *exception* は" "Python例外クラスであるべきです。 *format* と以降の引数はエラーメッセージを作" @@ -272,27 +294,41 @@ 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 " "constructs a tuple object whose first item is the integer :c:data:`errno` " -"value and whose second item is the corresponding error message (gotten from :" -"c:func:`!strerror`), and then calls ``PyErr_SetObject(type, object)``. On " -"Unix, when the :c:data:`errno` value is :c:macro:`!EINTR`, indicating an " -"interrupted system call, this calls :c:func:`PyErr_CheckSignals`, and if " -"that set the error indicator, leaves it set to that. The function always " -"returns ``NULL``, so a wrapper function around a system call can write " -"``return PyErr_SetFromErrno(type);`` when the system call returns an error." -msgstr "" +"value and whose second item is the corresponding error message (gotten " +"from :c:func:`!strerror`), and then calls ``PyErr_SetObject(type, " +"object)``. On Unix, when the :c:data:`errno` value is :c:macro:`!EINTR`, " +"indicating an interrupted system call, this " +"calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator, " +"leaves it set to that. The function always 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 +351,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 +363,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,14 +385,17 @@ 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 " -"encoding (:func:`os.fsdecode`) and passed to the constructor of :exc:" -"`OSError` as a third parameter to be used to define the :attr:`!filename` " -"attribute of the exception instance." +"encoding (:func:`os.fsdecode`) and passed to the constructor " +"of :exc:`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,40 +513,42 @@ 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. " "*stack_level* is a positive number giving a number of stack frames; the " "warning will be issued from the currently executing line of code in that " -"stack frame. A *stack_level* of 1 is the function calling :c:func:" -"`PyErr_WarnEx`, 2 is the function above that, and so forth." +"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 "" -"Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:" -"`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default " -"warning category is :c:data:`PyExc_RuntimeWarning`. The standard Python " -"warning categories are available as global variables whose names are " -"enumerated at :ref:`standardwarningcategories`." +"Warning categories must be subclasses " +"of :c:data:`PyExc_Warning`; :c:data:`PyExc_Warning` is a subclass " +"of :c:data:`PyExc_Exception`; the default warning category " +"is :c:data:`PyExc_RuntimeWarning`. The standard Python warning categories " +"are available as global variables whose names are enumerated " +"at :ref:`standardwarningcategories`." msgstr "" -"警告カテゴリは :c:data:`PyExc_Warning` のサブクラスでなければなりません。 :c:" -"data:`PyExc_Warning` は :c:data:`PyExc_Exception` のサブクラスです。\n" +"警告カテゴリは :c:data:`PyExc_Warning` のサブクラスでなければなりませ" +"ん。 :c:data:`PyExc_Warning` は :c:data:`PyExc_Exception` のサブクラスで" +"す。\n" "デフォルトの警告カテゴリは :c:data:`PyExc_RuntimeWarning` です。\n" "標準の Python 警告カテゴリは、 :ref:`standardwarningcategories` で名前が列挙" "されているグローバル変数として利用可能です。" #: ../../c-api/exceptions.rst:365 msgid "" -"For information about warning control, see the documentation for the :mod:" -"`warnings` module and the :option:`-W` option in the command line " +"For information about warning control, see the documentation for " +"the :mod:`warnings` module and the :option:`-W` option in the command line " "documentation. There is no C API for warning control." msgstr "" "警告をコントロールするための情報については、 :mod:`warnings` モジュールのド" @@ -511,9 +558,10 @@ msgstr "" #: ../../c-api/exceptions.rst:372 msgid "" "Issue a warning message with explicit control over all warning attributes. " -"This is a straightforward wrapper around the Python function :func:`warnings." -"warn_explicit`; see there for more information. The *module* and *registry* " -"arguments may be set to ``NULL`` to get the default effect described there." +"This is a straightforward wrapper around the Python " +"function :func:`warnings.warn_explicit`; see there for more information. " +"The *module* and *registry* arguments may be set to ``NULL`` to get the " +"default effect described there." msgstr "" "すべての警告の属性を明示的に制御した警告メッセージを出します。これは Python " "関数 :func:`warnings.warn_explicit` の直接的なラッパーで、さらに情報を得るに" @@ -523,8 +571,8 @@ msgstr "" #: ../../c-api/exceptions.rst:383 msgid "" "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " -"*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:" -"`filesystem encoding and error handler`." +"*module* are UTF-8 encoded strings, and *filename* is decoded from " +"the :term:`filesystem encoding and error handler`." msgstr "" ":c:func:`PyErr_WarnExplicitObject` に似ていますが、 *message* と *module* が " "UTF-8 エンコードされた文字列であるところが異なり、 *filename* は :term:`ファ" @@ -533,20 +581,22 @@ msgstr "" #: ../../c-api/exceptions.rst:390 msgid "" -"Function similar to :c:func:`PyErr_WarnEx`, but use :c:func:" -"`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" -"encoded string." +"Function similar to :c:func:`PyErr_WarnEx`, but " +"use :c:func:`PyUnicode_FromFormat` to format the warning message. *format* " +"is an ASCII-encoded string." msgstr "" ":c:func:`PyErr_WarnEx` に似たような関数ですが、警告メッセージをフォーマットす" "るのに :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`." +"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" @@ -557,30 +607,32 @@ msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " "functions or to :c:func:`PyErr_Restore`). If not set, return ``NULL``. You " -"do not own a reference to the return value, so you do not need to :c:func:" -"`Py_DECREF` it." +"do not own a reference to the return value, so you do not need " +"to :c:func:`Py_DECREF` it." msgstr "" "エラーインジケータが設定されているかテストします。設定されている場合は、例外" "の *型* (``PyErr_Set*`` 関数の一つあるいは :c:func:`PyErr_Restore` への最も新" "しい呼び出しに対する第一引数)を返します。設定されていない場合は ``NULL`` を返" -"します。あなたは戻り値への参照を持っていませんので、それに :c:func:" -"`Py_DECREF` する必要はありません。" +"します。あなたは戻り値への参照を持っていませんので、それ" +"に :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 "" -"Do not compare the return value to a specific exception; use :c:func:" -"`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " -"fail since the exception may be an instance instead of a class, in the case " -"of a class exception, or it may be a subclass of the expected exception.)" +"Do not compare the return value to a specific exception; " +"use :c:func:`PyErr_ExceptionMatches` instead, shown below. (The comparison " +"could easily fail since the exception may be an instance instead of a class, " +"in the case of a class exception, or it may be a subclass of the expected " +"exception.)" msgstr "" -"戻り値を特定の例外と比較しないでください。その代わりに、下に示す :c:func:" -"`PyErr_ExceptionMatches` を使ってください。(比較は簡単に失敗するでしょう。な" -"ぜなら、例外はクラスではなくインスタンスかもしれないし、あるいは、クラス例外" -"の場合は期待される例外のサブクラスかもしれないからです。)" +"戻り値を特定の例外と比較しないでください。その代わりに、下に示" +"す :c:func:`PyErr_ExceptionMatches` を使ってください。(比較は簡単に失敗するで" +"しょう。なぜなら、例外はクラスではなくインスタンスかもしれないし、あるいは、" +"クラス例外の場合は期待される例外のサブクラスかもしれないからです。)" #: ../../c-api/exceptions.rst:428 msgid "" @@ -643,11 +695,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 +712,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 +729,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 +746,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 +769,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 +816,37 @@ 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::" +"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." +"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 "" @@ -772,15 +857,17 @@ msgid "" msgstr "" "この関数は、通常は例外を扱うコードでは使用されません。正確に言うと、これは例" "外の状態を一時的に保存し、元に戻す必要があるコードで使用することができます。" -"例外の状態を元に戻す、もしくはクリアするには :c:func:" -"`PyErr_SetHandledException` を使ってください。" +"例外の状態を元に戻す、もしくはクリアするに" +"は :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,15 +881,21 @@ 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*, " -"not to an exception that was freshly raised. Returns new references for the " -"three objects, any of which may be ``NULL``. Does not modify the exception " -"info state. This function is kept for backwards compatibility. Prefer " -"using :c:func:`PyErr_GetHandledException`." +"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*, not to an exception that was freshly raised. Returns new " +"references for the three objects, any of which may be ``NULL``. Does not " +"modify the exception 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 "" @@ -822,8 +915,8 @@ msgid "" "exception that was *already caught*, not to an exception that was freshly " "raised. This function steals the references of the arguments. To clear the " "exception state, pass ``NULL`` for all three arguments. This function is " -"kept for backwards compatibility. Prefer using :c:func:" -"`PyErr_SetHandledException`." +"kept for backwards compatibility. Prefer " +"using :c:func:`PyErr_SetHandledException`." msgstr "" #: ../../c-api/exceptions.rst:617 @@ -865,8 +958,8 @@ msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " "is set and the function returns ``-1`` immediately (such that other pending " -"signals may not have been handled yet: they will be on the next :c:func:" -"`PyErr_CheckSignals()` invocation)." +"signals may not have been handled yet: they will be on the " +"next :c:func:`PyErr_CheckSignals()` invocation)." msgstr "" #: ../../c-api/exceptions.rst:655 @@ -883,52 +976,62 @@ msgstr "" #: ../../c-api/exceptions.rst:662 msgid "" -"The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" -"`KeyboardInterrupt` exception." +"The default Python signal handler for :c:macro:`!SIGINT` raises " +"the :exc:`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." +"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 "" -"Simulate the effect of a signal arriving. The next time :c:func:" -"`PyErr_CheckSignals` is called, the Python signal handler for the given " -"signal number will be called." +"Simulate the effect of a signal arriving. The next " +"time :c:func:`PyErr_CheckSignals` is called, the Python signal handler for " +"the given signal number will be called." msgstr "" "シグナルが到達した効果をシミュレートします。\n" "次に :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." +"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 +1065,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 +1072,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 +1087,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 +1126,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,30 +1163,29 @@ 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 "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " "the exceptions that need to be raised. This list contains the unhandled part " -"of *orig*, if any, as well as the exceptions that were raised from the :" -"keyword:`!except*` clauses (so they have a different traceback from *orig*) " -"and those that were reraised (and have the same traceback as *orig*). Return " -"the :exc:`ExceptionGroup` that needs to be reraised in the end, or ``None`` " -"if there is nothing to reraise." +"of *orig*, if any, as well as the exceptions that were raised from " +"the :keyword:`!except*` clauses (so they have a different traceback from " +"*orig*) and those that were reraised (and have the same traceback as " +"*orig*). Return the :exc:`ExceptionGroup` that needs to be reraised in the " +"end, or ``None`` if there is nothing to reraise." msgstr "" #: ../../c-api/exceptions.rst:827 @@ -1094,9 +1205,9 @@ msgid "" "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -"*encoding*, *object*, *length*, *start*, *end*, *reason* 属性をもった :class:" -"`UnicodeDecodeError` オブジェクトを作成します。 *encoding* および *reason* " -"は UTF-8 エンコードされた文字列です。" +"*encoding*, *object*, *length*, *start*, *end*, *reason* 属性をもっ" +"た :class:`UnicodeDecodeError` オブジェクトを作成します。 *encoding* および " +"*reason* は UTF-8 エンコードされた文字列です。" #: ../../c-api/exceptions.rst:840 msgid "Return the *encoding* attribute of the given exception object." @@ -1116,27 +1227,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 +1262,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 +1278,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 +1297,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 +1305,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,34 +1335,35 @@ 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 "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -":c:func:`Py_EnterRecursiveCall` を終了させます。 :c:func:" -"`Py_EnterRecursiveCall` の *成功した* 呼び出しに対し 1 回呼ばなければなりませ" -"ん。" +":c:func:`Py_EnterRecursiveCall` を終了させま" +"す。 :c:func:`Py_EnterRecursiveCall` の *成功した* 呼び出しに対し 1 回呼ばな" +"ければなりません。" #: ../../c-api/exceptions.rst:943 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " -"requires special recursion handling. In addition to protecting the stack, :" -"c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent " -"cycles. The following two functions facilitate this functionality. " +"requires special recursion handling. In addition to protecting the " +"stack, :c:member:`~PyTypeObject.tp_repr` also needs to track objects to " +"prevent cycles. The following two functions facilitate this functionality. " "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" "コンテナ型に対し :c:member:`~PyTypeObject.tp_repr` を適切に実装するには、特殊" -"な再帰の処理が求められます。スタックの防護に加え、 :c:member:`~PyTypeObject." -"tp_repr` は循環処理を避けるためにオブジェクトを辿っていく必要があります。次" -"の 2 つの関数はその機能を容易にします。実質的には、これらは :func:`reprlib." -"recursive_repr` と同等な C の実装です。" +"な再帰の処理が求められます。スタックの防護に加" +"え、 :c:member:`~PyTypeObject.tp_repr` は循環処理を避けるためにオブジェクトを" +"辿っていく必要があります。次の 2 つの関数はその機能を容易にします。実質的に" +"は、これらは :func:`reprlib.recursive_repr` と同等な C の実装です。" #: ../../c-api/exceptions.rst:951 msgid "" @@ -1254,8 +1377,9 @@ msgstr "" msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " -"should return a string object indicating a cycle. As examples, :class:" -"`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." +"should return a string object indicating a cycle. As " +"examples, :class:`dict` objects return ``{...}`` and :class:`list` objects " +"return ``[...]``." msgstr "" "そのオブジェクトが既に処理されたものだった場合、この関数は正の整数を返しま" "す。その場合、 :c:member:`~PyTypeObject.tp_repr` の実装は、循環を示す文字列オ" @@ -1268,21 +1392,22 @@ msgid "" "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -"再帰回数の上限に達した場合は、この関数は負の整数を返します。この場合、 :c:" -"member:`~PyTypeObject.tp_repr` の実装は一般的には ``NULL`` を返すべきです。" +"再帰回数の上限に達した場合は、この関数は負の整数を返します。この場" +"合、 :c:member:`~PyTypeObject.tp_repr` の実装は一般的には ``NULL`` を返すべき" +"です。" #: ../../c-api/exceptions.rst:964 msgid "" -"Otherwise, the function returns zero and the :c:member:`~PyTypeObject." -"tp_repr` implementation can continue normally." +"Otherwise, the function returns zero and " +"the :c:member:`~PyTypeObject.tp_repr` implementation can continue normally." msgstr "" "それ以外の場合は、関数はゼロを返し、 :c:member:`~PyTypeObject.tp_repr` の実装" "は通常どおり処理を続けてかまいません。" #: ../../c-api/exceptions.rst:969 msgid "" -"Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" -"c:func:`Py_ReprEnter` that returns zero." +"Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation " +"of :c:func:`Py_ReprEnter` that returns zero." msgstr "" ":c:func:`Py_ReprEnter` を終了させます。 0 を返した :c:func:`Py_ReprEnter` の" "呼び出しに対し 1 回呼ばなければなりません。" @@ -1294,9 +1419,9 @@ msgstr "標準例外" #: ../../c-api/exceptions.rst:978 msgid "" "All standard Python exceptions are available as global variables whose names " -"are ``PyExc_`` followed by the Python exception name. These have the type :" -"c:expr:`PyObject*`; they are all class objects. For completeness, here are " -"all the variables:" +"are ``PyExc_`` followed by the Python exception name. These have the " +"type :c:expr:`PyObject*`; they are all class objects. For completeness, " +"here are all the variables:" msgstr "" "``PyExc_`` の後ろにPythonの例外名が続く名前をもつグローバル変数として、すべて" "の標準Python例外が利用可能です。これらは型 :c:expr:`PyObject*` を持ち、すべて" @@ -1756,23 +1881,11 @@ msgstr ":exc:`ZeroDivisionError`" #: ../../c-api/exceptions.rst:1151 msgid "" -":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" -"`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" -"`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:" -"data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:" -"`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:" -"`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:" -"`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` and :c:data:" -"`PyExc_TimeoutError` were introduced following :pep:`3151`." -msgstr "" -":c:data:`PyExc_BlockingIOError` 、 :c:data:`PyExc_BrokenPipeError` 、 :c:" -"data:`PyExc_ChildProcessError` 、 :c:data:`PyExc_ConnectionError` 、 :c:data:" -"`PyExc_ConnectionAbortedError` 、 :c:data:`PyExc_ConnectionRefusedError` 、 :" -"c:data:`PyExc_ConnectionResetError` 、 :c:data:`PyExc_FileExistsError` 、 :c:" -"data:`PyExc_FileNotFoundError` 、 :c:data:`PyExc_InterruptedError` 、 :c:" -"data:`PyExc_IsADirectoryError` 、 :c:data:`PyExc_NotADirectoryError` 、 :c:" -"data:`PyExc_PermissionError` 、 :c:data:`PyExc_ProcessLookupError` 、 :c:" -"data:`PyExc_TimeoutError` は :pep:`3151` により導入されました。" +":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` " +"and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`." +msgstr "" +":c:data:`PyExc_BlockingIOError` 、 :c:data:`PyExc_BrokenPipeError` 、 :c:data:`PyExc_ChildProcessError` 、 :c:data:`PyExc_ConnectionError` 、 :c:data:`PyExc_ConnectionAbortedError` 、 :c:data:`PyExc_ConnectionRefusedError` 、 :c:data:`PyExc_ConnectionResetError` 、 :c:data:`PyExc_FileExistsError` 、 :c:data:`PyExc_FileNotFoundError` 、 :c:data:`PyExc_InterruptedError` 、 :c:data:`PyExc_IsADirectoryError` 、 :c:data:`PyExc_NotADirectoryError` 、 :c:data:`PyExc_PermissionError` 、 :c:data:`PyExc_ProcessLookupError` 、 :c:data:`PyExc_TimeoutError` " +"は :pep:`3151` により導入されました。" #: ../../c-api/exceptions.rst:1161 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." @@ -1803,9 +1916,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 +2051,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 +2064,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..de220b84a 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -22,35 +22,36 @@ 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 " -"from the C standard library. In Python 3, files and streams use the new :" -"mod:`io` module, which defines several layers over the low-level unbuffered " -"I/O of the operating system. The functions described below are convenience " -"C wrappers over these new APIs, and meant mostly for internal error " -"reporting in the interpreter; third-party code is advised to access the :mod:" -"`io` APIs instead." +"from the C standard library. In Python 3, files and streams use the " +"new :mod:`io` module, which defines several layers over the low-level " +"unbuffered I/O of the operating system. The functions described below are " +"convenience C wrappers over these new APIs, and meant mostly for internal " +"error 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." @@ -88,37 +88,37 @@ msgstr "*name* 属性の無視。" #: ../../c-api/file.rst:41 msgid "" "Return the file descriptor associated with *p* as an :c:expr:`int`. If the " -"object is an integer, its value is returned. If not, the object's :meth:" -"`~io.IOBase.fileno` method is called if it exists; the method must return an " -"integer, which is returned as the file descriptor value. Sets an exception " -"and returns ``-1`` on failure." +"object is an integer, its value is returned. If not, the " +"object's :meth:`~io.IOBase.fileno` method is called if it exists; the method " +"must return an integer, which is returned as the file descriptor value. " +"Sets an exception and returns ``-1`` on failure." msgstr "" "*p* に関連づけられる ファイルディスクリプタを :c:expr:`int` として返します。" -"オブジェクトが整数なら、その値を返します。 整数でない場合、オブジェクトに :" -"meth:`~io.IOBase.fileno` メソッドがあれば呼び出します; このメソッドの返り値" -"は、ファイル記述子の値として返される整数でなければなりません。失敗すると例外" -"を設定して ``-1`` を返します。" +"オブジェクトが整数なら、その値を返します。 整数でない場合、オブジェクト" +"に :meth:`~io.IOBase.fileno` メソッドがあれば呼び出します; このメソッドの返り" +"値は、ファイル記述子の値として返される整数でなければなりません。失敗すると例" +"外を設定して ``-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." -"readline` method. If *n* is ``0``, exactly one line is read, regardless of " -"the length of the line. If *n* is greater than ``0``, no more than *n* " -"bytes will be read from the file; a partial line can be returned. In both " -"cases, an empty string is returned if the end of the file is reached " -"immediately. If *n* is less than ``0``, however, one line is read " -"regardless of length, but :exc:`EOFError` is raised if the end of the file " -"is reached immediately." +"object *p*. *p* may be a file object or any object with " +"a :meth:`~io.IOBase.readline` method. If *n* is ``0``, exactly one line is " +"read, regardless of the length of the line. If *n* is greater than ``0``, " +"no more than *n* bytes will be read from the file; a partial line can be " +"returned. In both cases, an empty string is returned if the end of the file " +"is reached immediately. If *n* is less than ``0``, however, one line is " +"read 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:" -"`PyFile_SetOpenCodeHook` の呼び出しは失敗します。\n" -"この関数が失敗したときは、インタープリタが初期化されていた場合、 -1 を返して" -"例外をセットします。" +"いったんフックを設定すると、削除も置き換えもできず、その後" +"の :c:func:`PyFile_SetOpenCodeHook` の呼び出しは失敗します。\n" +"失敗すると -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..e48c9402e 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -19,31 +19,33 @@ 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 "" -"Return true if its argument is a :c:type:`PyFloatObject` or a subtype of :c:" -"type:`PyFloatObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyFloatObject` or a subtype " +"of :c:type:`PyFloatObject`. This function always succeeds." msgstr "" "引数が :c:type:`PyFloatObject` か :c:type:`PyFloatObject` のサブタイプである" "ときに真を返します。この関数は常に成功します。" @@ -71,15 +73,22 @@ 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." -"__float__` method, this method will first be called to convert *pyfloat* " -"into a float. If :meth:`!__float__` is not defined then it falls back to :" -"meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one " -"should call :c:func:`PyErr_Occurred` to check for errors." -msgstr "" +"*pyfloat* is not a Python floating-point object but has " +"a :meth:`~object.__float__` method, this method will first be called to " +"convert *pyfloat* into a float. If :meth:`!__float__` is not defined then it " +"falls back to :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`." +"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,17 +125,16 @@ 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 "" "The pack and unpack functions provide an efficient platform-independent way " "to store floating-point values as byte strings. The Pack routines produce a " -"bytes string from a C :c:expr:`double`, and the Unpack routines produce a C :" -"c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) specifies " -"the number of bytes in the bytes string." +"bytes string from a C :c:expr:`double`, and the Unpack routines produce a " +"C :c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) " +"specifies the number of bytes in the bytes string." msgstr "" #: ../../c-api/float.rst:90 @@ -156,25 +163,26 @@ 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 "" -"The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an :c:expr:" -"`int` argument, non-zero if you want the bytes string in little-endian " -"format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero if you " -"want big-endian format (exponent first, at *p*). The :c:macro:" -"`PY_BIG_ENDIAN` constant can be used to use the native endian: it is equal " -"to ``1`` on big endian processor, or ``0`` on little endian processor." +"The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is " +"an :c:expr:`int` argument, non-zero if you want the bytes string in little-" +"endian format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero " +"if you want big-endian format (exponent first, at *p*). " +"The :c:macro:`PY_BIG_ENDIAN` constant can be used to use the native endian: " +"it is equal 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,38 +196,36 @@ 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 "" -"The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an :c:" -"expr:`int` argument, non-zero if the bytes string is in little-endian format " -"(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-" -"endian (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant can " -"be used to use the native endian: it is equal to ``1`` on big endian " +"The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is " +"an :c:expr:`int` argument, non-zero if the bytes string is in little-endian " +"format (exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if " +"big-endian (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant " +"can be used to use the native endian: it is equal to ``1`` on big endian " "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`)." +"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 +233,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..b76f9c330 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,139 +33,141 @@ 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." +"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 ````." +"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 " -"allows modifying the locals. In all other cases (classes, modules, :func:" -"`exec`, :func:`eval`) it returns the mapping representing the frame locals " -"directly (as described for :func:`locals`)." +"allows modifying the locals. In all other cases (classes, " +"modules, :func:`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 "" -"As part of :pep:`667`, return an instance of :c:var:" -"`PyFrameLocalsProxy_Type`." +"As part of :pep:`667`, return an instance " +"of :c:var:`PyFrameLocalsProxy_Type`." msgstr "" #: ../../c-api/frame.rst:140 @@ -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..18f2b5da9 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 @@ -38,17 +38,17 @@ msgstr "関数に使われるCの構造体。" #: ../../c-api/function.rst:22 msgid "" "This is an instance of :c:type:`PyTypeObject` and represents the Python " -"function type. It is exposed to Python programmers as ``types." -"FunctionType``." +"function type. It is exposed to Python programmers as " +"``types.FunctionType``." msgstr "" ":c:type:`PyTypeObject` 型のインスタンスで、 Python の関数型を表します。これ" "は Python プログラムに ``types.FunctionType`` として公開されています。" #: ../../c-api/function.rst:28 msgid "" -"Return true if *o* is a function object (has type :c:data:" -"`PyFunction_Type`). The parameter must not be ``NULL``. This function " -"always succeeds." +"Return true if *o* is a function object (has " +"type :c:data:`PyFunction_Type`). The parameter must not be ``NULL``. This " +"function always succeeds." msgstr "" "*o* が関数オブジェクト (:c:data:`PyFunction_Type` 型である) 場合に真を返しま" "す。パラメータは ``NULL`` にできません。この関数は常に成功します。" @@ -65,30 +65,31 @@ msgstr "" #: ../../c-api/function.rst:37 msgid "" -"The function's docstring and name are retrieved from the code object. :attr:" -"`~function.__module__` is retrieved from *globals*. The argument defaults, " -"annotations and closure are set to ``NULL``. :attr:`~function.__qualname__` " -"is set to the same value as the code object's :attr:`~codeobject." -"co_qualname` field." +"The function's docstring and name are retrieved from the code " +"object. :attr:`~function.__module__` is retrieved from *globals*. The " +"argument defaults, annotations and closure are set to " +"``NULL``. :attr:`~function.__qualname__` is set to the same value as the " +"code object's :attr:`~codeobject.co_qualname` field." msgstr "" "関数のドキュメント文字列と名前はコードオブジェクトから取得されます。\n" ":attr:`~function.__module__` は *globals* から取得されます。\n" -"引数のデフォルト値やアノテーション、クロージャは ``NULL`` に設定されます。 :" -"attr:`~function.__qualname__` はコードオブジェクトの :attr:`~codeobject." -"co_qualname` フィールドと同じ値に設定されます。" +"引数のデフォルト値やアノテーション、クロージャは ``NULL`` に設定されま" +"す。 :attr:`~function.__qualname__` はコードオブジェクト" +"の :attr:`~codeobject.co_qualname` フィールドと同じ値に設定されます。" #: ../../c-api/function.rst:46 msgid "" -"As :c:func:`PyFunction_New`, but also allows setting the function object's :" -"attr:`~function.__qualname__` attribute. *qualname* should be a unicode " -"object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute is set " -"to the same value as the code object's :attr:`~codeobject.co_qualname` field." +"As :c:func:`PyFunction_New`, but also allows setting the function " +"object's :attr:`~function.__qualname__` attribute. *qualname* should be a " +"unicode object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute " +"is set to the same value as the code " +"object's :attr:`~codeobject.co_qualname` field." msgstr "" -":c:func:`PyFunction_New` に似ていますが、関数オブジェクトの :attr:`~function." -"__qualname__` 属性に値をセットできます。\n" +":c:func:`PyFunction_New` に似ていますが、関数オブジェクト" +"の :attr:`~function.__qualname__` 属性に値をセットできます。\n" "*qualname* はユニコードオブジェクトか ``NULL`` でなくてはなりません。" -"``NULL`` だった場合、 :attr:`!__qualname__` 属性にはコードオブジェクトの :" -"attr:`~codeobject.co_qualname` フィールドと同じ値がセットされます。" +"``NULL`` だった場合、 :attr:`!__qualname__` 属性にはコードオブジェクト" +"の :attr:`~codeobject.co_qualname` フィールドと同じ値がセットされます。" #: ../../c-api/function.rst:57 msgid "Return the code object associated with the function object *op*." @@ -98,18 +99,22 @@ 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 +137,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 +181,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.)" +"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." +"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 +263,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``." +"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 +280,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..3cf5773b1 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,16 @@ 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 +75,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 "" @@ -94,11 +100,11 @@ msgstr "" #: ../../c-api/gcsupport.rst:37 msgid "" -"Before fields which refer to other containers are invalidated, :c:func:" -"`PyObject_GC_UnTrack` must be called." +"Before fields which refer to other containers are " +"invalidated, :c:func:`PyObject_GC_UnTrack` must be called." msgstr "" -"他のコンテナを参照しているフィールドを無効化する前に、 :c:func:" -"`PyObject_GC_UnTrack` を呼び出さなければなりません。" +"他のコンテナを参照しているフィールドを無効化する前" +"に、 :c:func:`PyObject_GC_UnTrack` を呼び出さなければなりません。" #: ../../c-api/gcsupport.rst:40 msgid "" @@ -108,102 +114,122 @@ msgstr "" #: ../../c-api/gcsupport.rst:43 msgid "" -"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a :" -"c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its " -"subclass or subclasses." +"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least " +"a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from " +"its 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 " -"interpreter will automatically populate the :c:member:`~PyTypeObject." -"tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:" -"`~PyTypeObject.tp_clear` fields if the type inherits from a class that " -"implements the garbage collector protocol and the child class does *not* " -"include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +"interpreter will automatically populate " +"the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a " +"class that 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." +"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." +"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." +"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." +"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)." +"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." +"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 +238,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 +253,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`." +"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." +"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." +"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`" @@ -303,23 +334,24 @@ msgstr ":c:member:`~PyTypeObject.tp_free`" msgid "" "Remove the object *op* from the set of container objects tracked by the " "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " -"this object to add it back to the set of tracked objects. The deallocator (:" -"c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object " -"before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` " -"handler become invalid." +"this object to add it back to the set of tracked objects. The deallocator " +"(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the " +"object before any of the fields used by " +"the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." msgstr "" "オブジェクト *op* を、コレクタによって追跡されるオブジェクトの集合から除去し" "ます。このオブジェクトに対して :c:func:`PyObject_GC_Track` を再度呼び出して、" -"追跡されるオブジェクトの集合に戻すことも可能です。 :c:member:`~PyTypeObject." -"tp_traverse` ハンドラの対象となるフィールドが正しくない状態になる前に、デアロ" -"ケータ (:c:member:`~PyTypeObject.tp_dealloc` ハンドラ) はオブジェクトに対し" -"て、この関数を呼び出すべきです。" +"追跡されるオブジェクトの集合に戻すことも可能で" +"す。 :c:member:`~PyTypeObject.tp_traverse` ハンドラの対象となるフィールドが正" +"しくない状態になる前に、デアロケータ (: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 "" @@ -331,12 +363,12 @@ msgstr "" #: ../../c-api/gcsupport.rst:216 msgid "" -"Type of the visitor function passed to the :c:member:`~PyTypeObject." -"tp_traverse` handler. The function should be called with an object to " -"traverse as *object* and the third parameter to the :c:member:`~PyTypeObject." -"tp_traverse` handler as *arg*. The Python core uses several visitor " -"functions to implement cyclic garbage detection; it's not expected that " -"users will need to write their own visitor functions." +"Type of the visitor function passed to " +"the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be " +"called with an object to traverse as *object* and the third parameter to " +"the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core " +"uses several visitor functions to implement cyclic garbage detection; it's " +"not expected that users will need to write their own visitor functions." msgstr "" ":c:member:`~PyTypeObject.tp_traverse` ハンドラに渡されるビジター関数 " "(visitor function) の型です。この関数は、探索するオブジェクトを *object* とし" @@ -373,15 +405,15 @@ msgstr "" #: ../../c-api/gcsupport.rst:235 msgid "" -"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:" -"func:`Py_VISIT` macro is provided. In order to use this macro, the :c:" -"member:`~PyTypeObject.tp_traverse` implementation must name its arguments " -"exactly *visit* and *arg*:" +"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, " +"a :c:func:`Py_VISIT` macro is provided. In order to use this macro, " +"the :c:member:`~PyTypeObject.tp_traverse` implementation must name its " +"arguments exactly *visit* and *arg*:" msgstr "" -":c:member:`~PyTypeObject.tp_traverse` ハンドラを簡潔に書くために、 :c:func:" -"`Py_VISIT` マクロが提供されています。このマクロを使うためには、 :c:member:" -"`~PyTypeObject.tp_traverse` の実装関数の引数は、一文字も違わず *visit* と " -"*arg* でなければなりません:" +":c:member:`~PyTypeObject.tp_traverse` ハンドラを簡潔に書くため" +"に、 :c:func:`Py_VISIT` マクロが提供されています。このマクロを使うために" +"は、 :c:member:`~PyTypeObject.tp_traverse` の実装関数の引数は、一文字も違わ" +"ず *visit* と *arg* でなければなりません:" #: ../../c-api/gcsupport.rst:242 msgid "" @@ -404,8 +436,8 @@ msgstr "" #: ../../c-api/gcsupport.rst:255 msgid "" -"The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:" -"`inquiry` type, or ``NULL`` if the object is immutable." +"The :c:member:`~PyTypeObject.tp_clear` handler must be of " +"the :c:type:`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" ":c:member:`~PyTypeObject.tp_clear` ハンドラは :c:type:`inquiry` 型であるか、" "オブジェクトが不変 (immutable) な場合は ``NULL`` でなければなりません。" @@ -426,82 +458,103 @@ 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." +"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 " -"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " -"``0`` to stop iteration. Other return values are reserved for now so " -"behavior on returning anything else is undefined." +"Type of the visitor function to be passed " +"to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* " +"passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue " +"iteration, return ``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..ab630d584 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 @@ -30,13 +30,13 @@ msgstr "ジェネレータオブジェクト" msgid "" "Generator objects are what Python uses to implement generator iterators. " "They are normally created by iterating over a function that yields values, " -"rather than explicitly calling :c:func:`PyGen_New` or :c:func:" -"`PyGen_NewWithQualName`." +"rather than explicitly calling :c:func:`PyGen_New` " +"or :c:func:`PyGen_NewWithQualName`." msgstr "" "ジェネレータオブジェクトは、 Python がジェネレータイテレータを実装するのに" -"使っているオブジェクトです。ジェネレータオブジェクトは通常、 :c:func:" -"`PyGen_New` や :c:func:`PyGen_NewWithQualName` の明示的な呼び出しではなく、" -"値を yield する関数のイテレーションにより生成されます。" +"使っているオブジェクトです。ジェネレータオブジェクトは通" +"常、 :c:func:`PyGen_New` や :c:func:`PyGen_NewWithQualName` の明示的な呼び出" +"しではなく、値を yield する関数のイテレーションにより生成されます。" #: ../../c-api/gen.rst:15 msgid "The C structure used for generator objects." @@ -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..3bbd49118 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,100 @@ 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 `." +"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." +"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..fe086ac87 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 *`." +"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`." @@ -71,9 +72,10 @@ msgstr "" #: ../../c-api/import.rst:40 ../../c-api/import.rst:56 msgid "" "The return value is a new reference to the imported module or top-level " -"package, or ``NULL`` with an exception set on failure. Like for :func:" -"`__import__`, the return value when a submodule of a package was requested " -"is normally the top-level package, unless a non-empty *fromlist* was given." +"package, or ``NULL`` with an exception set on failure. Like " +"for :func:`__import__`, the return value when a submodule of a package was " +"requested is normally the top-level package, unless a non-empty *fromlist* " +"was given." msgstr "" "戻り値は、インポートされたモジュールかトップレベルパッケージへの新しい参照" "か、失敗した場合は例外を設定して ``NULL`` を返します。\n" @@ -83,8 +85,8 @@ msgstr "" #: ../../c-api/import.rst:46 msgid "" -"Failing imports remove incomplete module objects, like with :c:func:" -"`PyImport_ImportModule`." +"Failing imports remove incomplete module objects, like " +"with :c:func:`PyImport_ImportModule`." msgstr "" "インポートが失敗した場合は、:c:func:`PyImport_ImportModule` と同様に不完全な" "モジュールのオブジェクトを削除します。" @@ -96,8 +98,8 @@ msgid "" "calls this function directly." msgstr "" "モジュールをインポートします。モジュールのインポートについては組み込みの " -"Python 関数 :func:`__import__` を読むとよく分かります。というのも、標準の :" -"func:`__import__` はこの関数を直接呼び出しているからです。" +"Python 関数 :func:`__import__` を読むとよく分かります。というのも、標準" +"の :func:`__import__` はこの関数を直接呼び出しているからです。" #: ../../c-api/import.rst:66 msgid "" @@ -111,7 +113,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,101 +120,124 @@ 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:" -"`PyImport_ImportModule` or one of its variants to import a module. Package " -"structures implied by a dotted name for *name* are not created if not " -"already present." +"already loaded, you will get an empty module object. " +"Use :c:func:`PyImport_ImportModule` or one of its variants to import a " +"module. Package 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 " "function :func:`compile`, load the module. Return a new reference to the " "module object, or ``NULL`` with an exception set if an error occurred. " "*name* is removed from :data:`sys.modules` in error cases, even if *name* " -"was already in :data:`sys.modules` on entry to :c:func:" -"`PyImport_ExecCodeModule`. Leaving incompletely initialized modules in :" -"data:`sys.modules` is dangerous, as imports of such modules have no way to " -"know that the module object is an unknown (and probably damaged with respect " -"to the module author's intents) state." -msgstr "" +"was already in :data:`sys.modules` on entry " +"to :c:func:`PyImport_ExecCodeModule`. Leaving incompletely initialized " +"modules in :data:`sys.modules` is dangerous, as imports of such modules have " +"no way to 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 "" "The module's :attr:`~module.__file__` attribute will be set to the code " -"object's :attr:`~codeobject.co_filename`. If applicable, :attr:`~module." -"__cached__` will also be set." +"object's :attr:`~codeobject.co_filename`. If " +"applicable, :attr:`~module.__cached__` will also be set." msgstr "" #: ../../c-api/import.rst:148 msgid "" -"This function will reload the module if it was already imported. See :c:" -"func:`PyImport_ReloadModule` for the intended way to reload a module." +"This function will reload the module if it was already imported. " +"See :c:func:`PyImport_ReloadModule` for the intended way to reload a module." msgstr "" "この関数は、すでにインポートされているモジュールの場合には再ロードを行いま" "す。意図的にモジュールの再ロードを行う方法は :c:func:`PyImport_ReloadModule` " @@ -229,11 +253,11 @@ msgstr "" #: ../../c-api/import.rst:154 msgid "" -"See also :c:func:`PyImport_ExecCodeModuleEx` and :c:func:" -"`PyImport_ExecCodeModuleWithPathnames`." +"See also :c:func:`PyImport_ExecCodeModuleEx` " +"and :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -":c:func:`PyImport_ExecCodeModuleEx` と :c:func:" -"`PyImport_ExecCodeModuleWithPathnames` も参照してください。" +":c:func:`PyImport_ExecCodeModuleEx` " +"と :c:func:`PyImport_ExecCodeModuleWithPathnames` も参照してください。" #: ../../c-api/import.rst:157 msgid "" @@ -241,11 +265,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`." @@ -260,8 +286,8 @@ msgstr "" #: ../../c-api/import.rst:179 msgid "" -"Setting :attr:`~module.__cached__` is deprecated. See :class:`~importlib." -"machinery.ModuleSpec` for alternatives." +"Setting :attr:`~module.__cached__` is deprecated. " +"See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" #: ../../c-api/import.rst:186 @@ -276,15 +302,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 "" @@ -312,8 +338,8 @@ msgstr "" #: ../../c-api/import.rst:219 msgid "" -"Return the dictionary used for the module administration (a.k.a. ``sys." -"modules``). Note that this is a per-interpreter variable." +"Return the dictionary used for the module administration (a.k.a. " +"``sys.modules``). Note that this is a per-interpreter variable." msgstr "" "モジュール管理のための辞書 (いわゆる ``sys.modules``)を返します。この辞書はイ" "ンタプリタごとに一つだけある変数なので注意してください。" @@ -329,24 +355,34 @@ 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` " "dict. If it wasn't yet cached, traverse :data:`sys.path_hooks` until a hook " "is found that can handle the path item. Return ``None`` if no hook could; " "this tells our caller that the :term:`path based finder` could not find a " -"finder for this path item. Cache the result in :data:`sys." -"path_importer_cache`. Return a new reference to the finder object." -msgstr "" +"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 "" "Load a frozen module named *name*. Return ``1`` for success, ``0`` if the " "module is not found, and ``-1`` with an exception set if the initialization " -"failed. To access the imported module on a successful load, use :c:func:" -"`PyImport_ImportModule`. (Note the misnomer --- this function would reload " -"the module if it was already imported.)" +"failed. To access the imported module on a successful load, " +"use :c:func:`PyImport_ImportModule`. (Note the misnomer --- this function " +"would reload the module if it was already imported.)" msgstr "" "*name* という名前のフリーズ (freeze) されたモジュールをロードします。成功する" "と ``1`` を、モジュールが見つからなかった場合には ``0`` を、初期化が失敗した" @@ -359,21 +395,19 @@ 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 "" "This is the structure type definition for frozen module descriptors, as " "generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the " -"Python source distribution). Its definition, found in :file:`Include/import." -"h`, is::" +"Python source distribution). Its definition, found in :file:`Include/" +"import.h`, is::" msgstr "" ":program:`freeze` ユーティリティが生成するようなフリーズ化モジュールデスクリ" "プタの構造体型定義です。 (Python ソース配布物の :file:`Tools/freeze/` を参照" @@ -390,11 +424,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,32 +461,41 @@ 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:" -"member:`~_inittab.name` field; failure to provide the sentinel value can " -"result in a memory fault. Returns ``0`` on success or ``-1`` if insufficient " -"memory could be allocated to extend the internal table. In the event of " -"failure, no modules are added to the internal table. This must be called " -"before :c:func:`Py_Initialize`." -msgstr "" +"array must end with a sentinel entry which contains ``NULL`` for " +"the :c:member:`~_inittab.name` field; failure to provide the sentinel value " +"can result in a memory fault. Returns ``0`` on success or ``-1`` if " +"insufficient memory could be allocated to extend the internal table. In the " +"event of 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 "" @@ -458,43 +503,44 @@ msgid "" "or :c:func:`PyImport_ExtendInittab` must be called before each Python " "initialization." msgstr "" -"Python が複数回初期化される場合、:c:func:`PyImport_AppendInittab` または :c:" -"func:`PyImport_ExtendInittab` は、それぞれの初期化の前に呼び出される必要があ" -"ります。" +"Python が複数回初期化される場合、:c:func:`PyImport_AppendInittab` また" +"は :c: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." +"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..063e8305e 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 @@ -29,9 +29,9 @@ msgstr "Python/C API リファレンスマニュアル" #: ../../c-api/index.rst:7 msgid "" "This manual documents the API used by C and C++ programmers who want to " -"write extension modules or embed Python. It is a companion to :ref:" -"`extending-index`, which describes the general principles of extension " -"writing but does not document the API functions in detail." +"write extension modules or embed Python. It is a companion " +"to :ref:`extending-index`, which describes the general principles of " +"extension writing but does not document the API functions in detail." msgstr "" "このマニュアルでは、拡張モジュールを書いたり Python インタプリタをアプリケー" "ションに埋め込んだりしたい C/C++ プログラマが利用できる API について述べてい" diff --git a/c-api/init.po b/c-api/init.po index 0b2539498..c0079b238 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,26 +194,21 @@ 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 "" "Despite their apparent similarity to some of the functions listed above, the " "following functions **should not be called** before the interpreter has been " -"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" -"`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" -"`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" -"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, " +"and :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:90 @@ -230,8 +218,8 @@ msgstr "グローバルな設定変数" #: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " -"features and options. By default, these flags are controlled by :ref:" -"`command line options `." +"features and options. By default, these flags are controlled " +"by :ref:`command line options `." msgstr "" "Python には、様々な機能やオプションを制御するグローバルな設定のための変数があ" "ります。\n" @@ -241,27 +229,29 @@ msgstr "" #: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " -"times that the option was set. For example, ``-b`` sets :c:data:" -"`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to " -"2." +"times that the option was set. For example, ``-b`` " +"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " +"sets :c:data:`Py_BytesWarningFlag` to 2." msgstr "" "オプションでフラグがセットされると、フラグの値はそのオプションがセットされた" "回数になります。\n" "例えば、 ``-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 `." +"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 "" -"Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" -"class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " -"or equal to ``2``." +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " +"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " +"greater or equal to ``2``." msgstr "" ":class:`bytes` または :class:`bytearray` を :class:`str` と比較した場合、また" "は、 :class:`bytes` を :class:`int` と比較した場合に警告を発生させます。\n" @@ -271,12 +261,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 `." +"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 +284,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 `." +"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,17 +309,19 @@ 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 `." +"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 "" -"Suppress error messages when calculating the module search path in :c:func:" -"`Py_GetPath`." +"Suppress error messages when calculating the module search path " +"in :c:func:`Py_GetPath`." msgstr "" ":c:func:`Py_GetPath` の中でモジュール検索パスを割り出しているときのエラーメッ" "セージを抑制します。" @@ -336,12 +332,16 @@ 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, " +"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 +359,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 `." +"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." +"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 `." +"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 +404,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 `." +"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 `." +"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 +439,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 `." +"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 +471,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 `." +"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." +"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,58 +502,64 @@ 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 `." +"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 "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" ":mod:`site` モジュールの import と、そのモジュールが行なっていた site ごと" "の :data:`sys.path` への操作を無効にします。後で :mod:`site` を明示的に " -"import しても、これらの操作は実行されません (実行したい場合は、 :func:`site." -"main` を呼び出してください)。" +"import しても、これらの操作は実行されません (実行したい場合" +"は、 :func:`site.main` を呼び出してください)。" #: ../../c-api/init.rst:271 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 `." +"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 "" -"Don't add the :data:`user site-packages directory ` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory ` " +"to :data:`sys.path`." msgstr "" -":data:`ユーザのサイトパッケージのディレクトリ ` を :data:" -"`sys.path` に追加しません。" +":data:`ユーザのサイトパッケージのディレクトリ ` " +"を :data:`sys.path` に追加しません。" #: ../../c-api/init.rst:284 msgid "" -"Set by the :option:`-s` and :option:`-I` options, and the :envvar:" -"`PYTHONNOUSERSITE` environment variable." +"Set by the :option:`-s` and :option:`-I` options, and " +"the :envvar:`PYTHONNOUSERSITE` environment variable." 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 `." +"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 +568,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 " -"`." +"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 +587,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 `." +"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 +607,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 `." +"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 "" @@ -615,8 +643,9 @@ msgstr "インタープリタの初期化と終了処理" #: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " -"this should be called before using any other Python/C API functions; see :" -"ref:`Before Python Initialization ` for the few exceptions." +"this should be called before using any other Python/C API functions; " +"see :ref:`Before Python Initialization ` for the few " +"exceptions." msgstr "" "Python インタープリタを初期化します。\n" "Python の埋め込みを行うアプリケーションでは、他のあらゆる Python/C API を使用" @@ -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,34 +717,48 @@ 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:" -"`Py_NewInterpreter` below) that were created and not yet destroyed since the " -"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 "" +"of Python/C API functions, and destroy all sub-interpreters " +"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " +"destroyed since the 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." +"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 +807,12 @@ msgid "" "stdout and stderr files." msgstr "" -#: ../../c-api/init.rst:462 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"_PySys_ClearAuditHooks`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython._PySys_ClearAuditHooks`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython._PySys_ClearAuditHooks`` " -"を送出します。 " +"を送出します。" #: ../../c-api/init.rst:469 msgid "" @@ -772,14 +822,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 +838,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 +860,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 +884,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::" +"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,32 +902,51 @@ 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:" -"`Py_InitializeFromConfig` directly, and all settings will be applied as " -"described elsewhere in this documentation. If this function is instead " -"called *after* a preceding runtime initialization API call, then exactly " -"which environmental and command line configuration settings will be updated " -"is version dependent (as it depends on which settings correctly support " -"being modified after they have already been set once when the runtime was " -"first initialized)." -msgstr "" +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " +"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " +"applied as described elsewhere in this documentation. If this function is " +"instead called *after* a preceding runtime initialization API call, then " +"exactly which environmental and command line configuration settings will be " +"updated is version dependent (as it depends on which settings correctly " +"support 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." -"run_module`) specified on the command line or in the configuration. If none " -"of these values are set, runs the interactive Python prompt (REPL) using the " -"``__main__`` module's global namespace." +"Executes the command (:c:member:`PyConfig.run_command`), the script " +"(:c:member:`PyConfig.run_filename`) or the module " +"(:c:member:`PyConfig.run_module`) specified on the command line or in the " +"configuration. If none 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 "" @@ -891,38 +973,44 @@ msgstr "" #: ../../c-api/init.rst:562 msgid "" "This function always finalizes the Python interpreter regardless of whether " -"it returns a value or immediately exits the process due to an unhandled :exc:" -"`SystemExit` exception." +"it returns a value or immediately exits the process due to an " +"unhandled :exc:`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`." +"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 `." +"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 "" @@ -938,21 +1026,21 @@ msgid "" "this storage." msgstr "" "この関数を呼び出すなら、最初に :c:func:`Py_Initialize` を呼び出すよりも前に呼" -"び出さなければなりません。この関数はインタプリタにプログラムの :c:func:" -"`main` 関数に指定した ``argv[0]`` 引数の値を教えます (ワイドキャラクタに変換" -"されます)。この引数値は、 :c:func:`Py_GetPath` や、以下に示すその他の関数が、" -"インタプリタの実行可能形式から Python ランタイムライブラリへの相対パスを取得" -"するために使われます。デフォルトの値は ``'python'`` です。引数はゼロ終端され" -"たワイドキャラクタ文字列で、静的な記憶領域に入っていなければならず、その内容" -"はプログラムの実行中に変更してはなりません。 Python インタプリタ内のコード" -"で、この記憶領域の内容を変更するものは一切ありません。" +"び出さなければなりません。この関数はインタプリタにプログラム" +"の :c:func:`main` 関数に指定した ``argv[0]`` 引数の値を教えます (ワイドキャラ" +"クタに変換されます)。この引数値は、 :c:func:`Py_GetPath` や、以下に示すその他" +"の関数が、インタプリタの実行可能形式から Python ランタイムライブラリへの相対" +"パスを取得するために使われます。デフォルトの値は ``'python'`` です。引数はゼ" +"ロ終端されたワイドキャラクタ文字列で、静的な記憶領域に入っていなければなら" +"ず、その内容はプログラムの実行中に変更してはなりません。 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." +"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 "" @@ -975,8 +1063,8 @@ msgstr "" #: ../../c-api/init.rst:624 ../../c-api/init.rst:719 msgid "" -"Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys." -"executable`) instead." +"Use :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`) instead." msgstr "" #: ../../c-api/init.rst:631 @@ -995,10 +1083,10 @@ msgstr "" #: ../../c-api/init.rst:647 msgid "" -"Use :c:func:`PyConfig_Get(\"base_prefix\") ` (:data:`sys." -"base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") ` " -"(:data:`sys.prefix`) if :ref:`virtual environments ` need to be " -"handled." +"Use :c:func:`PyConfig_Get(\"base_prefix\") ` " +"(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") " +"` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." msgstr "" #: ../../c-api/init.rst:656 @@ -1008,11 +1096,11 @@ msgid "" "with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " -"caller should not modify its value. This corresponds to the :makevar:" -"`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" -"prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.base_exec_prefix``. It is only " -"useful on Unix." +"caller should not modify its value. This corresponds to " +"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " +"the ``--exec-prefix`` argument to the :program:`configure` script at build " +"time. The value is available to Python code as ``sys.base_exec_prefix``. " +"It is only useful on Unix." msgstr "" #: ../../c-api/init.rst:667 @@ -1056,10 +1144,10 @@ msgstr "" #: ../../c-api/init.rst:684 msgid "" -"System administrators will know how to configure the :program:`mount` or :" -"program:`automount` programs to share :file:`/usr/local` between platforms " -"while having :file:`/usr/local/plat` be a different filesystem for each " -"platform." +"System administrators will know how to configure the :program:`mount` " +"or :program:`automount` programs to share :file:`/usr/local` between " +"platforms while having :file:`/usr/local/plat` be a different filesystem for " +"each platform." msgstr "" "システム管理者は、 :program:`mount` や :program:`automount` プログラムを使っ" "て、各プラットフォーム用の :file:`/usr/local/plat` を異なったファイルシステム" @@ -1068,10 +1156,11 @@ msgstr "" #: ../../c-api/init.rst:695 msgid "" -"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." -"base_exec_prefix`) instead. Use :c:func:`PyConfig_Get(\"exec_prefix\") " -"` (:data:`sys.exec_prefix`) if :ref:`virtual environments " -"` need to be handled." +"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." msgstr "" #: ../../c-api/init.rst:707 @@ -1098,8 +1187,8 @@ msgstr "" #: ../../c-api/init.rst:748 msgid "" -"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` (:data:" -"`sys.path`) instead." +"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` " +"(:data:`sys.path`) instead." msgstr "" #: ../../c-api/init.rst:754 @@ -1110,17 +1199,16 @@ 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 "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " "period. The returned string points into static storage; the caller should " -"not modify its value. The value is available to Python code as :data:`sys." -"version`." +"not modify its value. The value is available to Python code " +"as :data:`sys.version`." msgstr "" "第一ワード (最初のスペース文字まで) は、現在の Python のバージョンです; 最初" "の文字は、ピリオドで区切られたメジャーバージョンとマイナーバージョンです。関" @@ -1128,9 +1216,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 +1265,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 +1286,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 `." +"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 "" @@ -1242,8 +1330,8 @@ msgstr "" #: ../../c-api/init.rst:846 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " -"path of the directory where the script is located is prepended to :data:`sys." -"path`." +"path of the directory where the script is located is prepended " +"to :data:`sys.path`." msgstr "" "存在するスクリプトの名前が ``argv[0]`` に渡された場合、そのスクリプトがある場" "所の絶対パスを :data:`sys.path` の先頭に追加します。" @@ -1258,45 +1346,52 @@ 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 "" "On versions before 3.1.3, you can achieve the same effect by manually " -"popping the first :data:`sys.path` element after having called :c:func:" -"`PySys_SetArgv`, for example using::" +"popping the first :data:`sys.path` element after having " +"called :c:func:`PySys_SetArgv`, for example using::" msgstr "" "3.1.3 より前のバージョンでは、 :c:func:`PySys_SetArgv` の呼び出しが完了した後" "に :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 `." +"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 "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " -"``1`` unless the :program:`python` interpreter was started with the :option:" -"`-I`." +"``1`` unless the :program:`python` interpreter was started with " +"the :option:`-I`." msgstr "" "この関数は、 :program:`python` インタプリタが :option:`-I` オプション付きで実" "行されている場合を除き :c:func:`PySys_SetArgvEx` の *updatepath* に ``1`` を" @@ -1306,12 +1401,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 " -"`." +"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 "" @@ -1335,15 +1432,15 @@ msgstr "" #: ../../c-api/init.rst:924 msgid "" -"Return the default \"home\", that is, the value set by :c:member:`PyConfig." -"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " -"is set." +"Return the default \"home\", that is, the value set " +"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " +"environment variable if it is set." msgstr "" #: ../../c-api/init.rst:934 msgid "" -"Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:" -"`PYTHONHOME` environment variable instead." +"Use :c:func:`PyConfig_Get(\"home\") ` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" #: ../../c-api/init.rst:942 @@ -1367,12 +1464,13 @@ msgstr "" #: ../../c-api/init.rst:960 msgid "" -"Therefore, the rule exists that only the thread that has acquired the :term:" -"`GIL` may operate on Python objects or call Python/C API functions. In order " -"to emulate concurrency of execution, the interpreter regularly tries to " -"switch threads (see :func:`sys.setswitchinterval`). The lock is also " -"released around potentially blocking I/O operations like reading or writing " -"a file, so that other Python threads can run in the meantime." +"Therefore, the rule exists that only the thread that has acquired " +"the :term:`GIL` may operate on Python objects or call Python/C API " +"functions. In order to emulate concurrency of execution, the interpreter " +"regularly tries to switch threads (see :func:`sys.setswitchinterval`). The " +"lock is also released around potentially blocking I/O operations like " +"reading or writing a file, so that other Python threads can run in the " +"meantime." msgstr "" "このため、 :term:`GIL` を獲得したスレッドだけが Python オブジェクトを操作した" "り、 Python/C API 関数を呼び出したりできるというルールがあります。並行処理を" @@ -1384,10 +1482,10 @@ msgstr "" #: ../../c-api/init.rst:970 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " -"inside a data structure called :c:type:`PyThreadState`, known as a :term:" -"`thread state`. Each OS thread has a thread-local pointer to a :c:type:" -"`PyThreadState`; a thread state referenced by this pointer is considered to " -"be :term:`attached `." +"inside a data structure called :c:type:`PyThreadState`, known as " +"a :term:`thread state`. Each OS thread has a thread-local pointer to " +"a :c:type:`PyThreadState`; a thread state referenced by this pointer is " +"considered to be :term:`attached `." msgstr "" #: ../../c-api/init.rst:975 @@ -1404,28 +1502,30 @@ msgstr "" #: ../../c-api/init.rst:982 msgid "" "In general, there will always be an :term:`attached thread state` when using " -"Python's C API. Only in some specific cases (such as in a :c:macro:" -"`Py_BEGIN_ALLOW_THREADS` block) will the thread not have an attached thread " -"state. If uncertain, check if :c:func:`PyThreadState_GetUnchecked` returns " -"``NULL``." +"Python's C API. Only in some specific cases (such as in " +"a :c:macro:`Py_BEGIN_ALLOW_THREADS` block) will the thread not have an " +"attached thread state. If uncertain, check " +"if :c:func:`PyThreadState_GetUnchecked` returns ``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 +1533,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 +1555,6 @@ msgstr "" msgid "The block above expands to the following code::" msgstr "上のブロックは次のコードに展開されます::" -#: ../../c-api/init.rst:1013 msgid "" "PyThreadState *_save;\n" "\n" @@ -1461,24 +1562,28 @@ 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 "" "The :term:`attached thread state` holds the :term:`GIL` for the entire " -"interpreter. When detaching the :term:`attached thread state`, the :term:" -"`GIL` is released, allowing other threads to attach a thread state to their " -"own thread, thus getting the :term:`GIL` and can start executing. The " -"pointer to the prior :term:`attached thread state` is stored as a local " +"interpreter. When detaching the :term:`attached thread state`, " +"the :term:`GIL` is released, allowing other threads to attach a thread state " +"to their own thread, thus getting the :term:`GIL` and can start executing. " +"The pointer to the prior :term:`attached thread state` is stored as a local " "variable. Upon reaching :c:macro:`Py_END_ALLOW_THREADS`, the thread state " -"that was previously :term:`attached ` is passed to :c:" -"func:`PyEval_RestoreThread`. This function will block until another releases " -"its :term:`thread state `, thus allowing the old :" -"term:`thread state ` to get re-attached and the C API " -"can be called again." +"that was previously :term:`attached ` is passed " +"to :c:func:`PyEval_RestoreThread`. This function will block until another " +"releases its :term:`thread state `, thus allowing the " +"old :term:`thread state ` to get re-attached and the " +"C API can be called again." msgstr "" #: ../../c-api/init.rst:1035 @@ -1486,15 +1591,15 @@ msgid "" "For :term:`free-threaded ` builds, the :term:`GIL` is " "normally out of the question, but detaching the :term:`thread state " "` is still required for blocking I/O and long " -"operations. The difference is that threads don't have to wait for the :term:" -"`GIL` to be released to attach their thread state, allowing true multi-core " -"parallelism." +"operations. The difference is that threads don't have to wait for " +"the :term:`GIL` to be released to attach their thread state, allowing true " +"multi-core parallelism." msgstr "" #: ../../c-api/init.rst:1041 msgid "" -"Calling system I/O functions is the most common use case for detaching the :" -"term:`thread state `, but it can also be useful " +"Calling system I/O functions is the most common use case for detaching " +"the :term:`thread state `, but it can also be useful " "before calling long-running computations which don't need access to Python " "objects, such as compression or cryptographic functions operating over " "memory buffers. For example, the standard :mod:`zlib` and :mod:`hashlib` " @@ -1508,22 +1613,22 @@ msgstr "Python 以外で作られたスレッド" #: ../../c-api/init.rst:1054 msgid "" -"When threads are created using the dedicated Python APIs (such as the :mod:" -"`threading` module), a thread state is automatically associated to them and " -"the code showed above is therefore correct. However, when threads are " -"created from C (for example by a third-party library with its own thread " -"management), they don't hold the :term:`GIL`, because they don't have an :" -"term:`attached thread state`." +"When threads are created using the dedicated Python APIs (such as " +"the :mod:`threading` module), a thread state is automatically associated to " +"them and the code showed above is therefore correct. However, when threads " +"are created from C (for example by a third-party library with its own thread " +"management), they don't hold the :term:`GIL`, because they don't have " +"an :term:`attached thread state`." msgstr "" #: ../../c-api/init.rst:1061 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " -"must first register these threads with the interpreter by creating an :term:" -"`attached thread state` before you can start using the Python/C API. When " -"you are done, you should detach the :term:`thread state `, and finally free it." +"must first register these threads with the interpreter by creating " +"an :term:`attached thread state` before you can start using the Python/C " +"API. When you are done, you should detach the :term:`thread state `, and finally free it." msgstr "" #: ../../c-api/init.rst:1068 @@ -1553,13 +1658,13 @@ msgstr "" msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " -"supports the creation of additional interpreters (using :c:func:" -"`Py_NewInterpreter`), but mixing multiple interpreters and the " -"``PyGILState_*`` API is unsupported. This is because :c:func:" -"`PyGILState_Ensure` and similar functions default to :term:`attaching " -"` a :term:`thread state` for the main interpreter, " -"meaning that the thread can't safely interact with the calling " -"subinterpreter." +"supports the creation of additional interpreters " +"(using :c:func:`Py_NewInterpreter`), but mixing multiple interpreters and " +"the ``PyGILState_*`` API is unsupported. This is " +"because :c:func:`PyGILState_Ensure` and similar functions default " +"to :term:`attaching ` a :term:`thread state` for the " +"main interpreter, meaning that the thread can't safely interact with the " +"calling subinterpreter." msgstr "" #: ../../c-api/init.rst:1092 @@ -1598,11 +1703,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 +1713,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` " @@ -1621,14 +1729,29 @@ msgid "" "of additional (non-Python) locks that need to be acquired before or reset " "after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " "be used to accomplish the same thing. Additionally, when extending or " -"embedding Python, calling :c:func:`fork` directly rather than through :func:" -"`os.fork` (and returning to or calling into Python) may result in a deadlock " -"by one of Python's internal locks being held by a thread that is defunct " -"after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " -"locks, but is not always able to." -msgstr "" +"embedding Python, calling :c:func:`fork` directly rather than " +"through :func:`os.fork` (and returning to or calling into Python) may result " +"in a deadlock by one of Python's internal locks being held by a thread that " +"is defunct 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 +1763,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" @@ -1648,18 +1781,18 @@ msgstr "" #: ../../c-api/init.rst:1159 msgid "" "In the late stage of :term:`interpreter shutdown`, after attempting to wait " -"for non-daemon threads to exit (though this can be interrupted by :class:" -"`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime is " -"marked as *finalizing*: :c:func:`Py_IsFinalizing` and :func:`sys." -"is_finalizing` return true. At this point, only the *finalization thread* " -"that initiated finalization (typically the main thread) is allowed to " -"acquire the :term:`GIL`." +"for non-daemon threads to exit (though this can be interrupted " +"by :class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the " +"runtime is marked as *finalizing*: :c:func:`Py_IsFinalizing` " +"and :func:`sys.is_finalizing` return true. At this point, only the " +"*finalization thread* that initiated finalization (typically the main " +"thread) is allowed to acquire the :term:`GIL`." msgstr "" #: ../../c-api/init.rst:1167 msgid "" -"If any thread, other than the finalization thread, attempts to attach a :" -"term:`thread state` during finalization, either explicitly or implicitly, " +"If any thread, other than the finalization thread, attempts to attach " +"a :term:`thread state` during finalization, either explicitly or implicitly, " "the thread enters **a permanently blocked state** where it remains until the " "program exits. In most cases this is harmless, but this can result in " "deadlock if a later stage of finalization attempts to acquire a lock owned " @@ -1714,28 +1847,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 +1882,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." +"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,28 +1982,43 @@ 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`. " "This may be called as many times as desired by a thread as long as each call " "is matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls as long as the thread state is restored to " -"its previous state before the Release(). For example, normal usage of the :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " -"is acceptable." -msgstr "" +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls as long as the thread state is " +"restored to its previous state before the Release(). For example, normal " +"usage of the :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:" -"func:`PyGILState_Release` to ensure Python is left in the same state. Even " -"though recursive calls are allowed, these handles *cannot* be shared - each " -"unique call to :c:func:`PyGILState_Ensure` must save the handle for its call " -"to :c:func:`PyGILState_Release`." -msgstr "" +"state` when :c:func:`PyGILState_Ensure` was called, and must be passed " +"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " +"Even though recursive calls are allowed, these handles *cannot* be shared - " +"each 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 "" @@ -1872,9 +2038,9 @@ msgstr "" #: ../../c-api/init.rst:1334 msgid "" "Release any resources previously acquired. After this call, Python's state " -"will be the same as it was prior to the corresponding :c:func:" -"`PyGILState_Ensure` call (but generally this state will be unknown to the " -"caller, hence the use of the GILState API)." +"will be the same as it was prior to the " +"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " +"will be unknown to the caller, hence the use of the GILState API)." msgstr "" "獲得したすべてのリソースを解放します。この関数を呼び出すと、Pythonの状態は対" "応する :c:func:`PyGILState_Ensure` を呼び出す前と同じとなります (通常、この状" @@ -1883,11 +2049,11 @@ msgstr "" #: ../../c-api/init.rst:1339 msgid "" -"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" -"func:`PyGILState_Release` on the same thread." +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " +"to :c:func:`PyGILState_Release` on the same thread." msgstr "" -":c:func:`PyGILState_Ensure` を呼び出す場合は、必ず同一スレッド内で対応する :" -"c:func:`PyGILState_Release` を呼び出してください。" +":c:func:`PyGILState_Ensure` を呼び出す場合は、必ず同一スレッド内で対応す" +"る :c:func:`PyGILState_Release` を呼び出してください。" #: ../../c-api/init.rst:1344 msgid "" @@ -1900,28 +2066,28 @@ msgstr "" #: ../../c-api/init.rst:1350 msgid "" "This function does not account for :term:`thread states ` " -"created by something other than :c:func:`PyGILState_Ensure` (such as :c:func:" -"`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` or :c:func:" -"`PyThreadState_GetUnchecked` for most cases." +"created by something other than :c:func:`PyGILState_Ensure` (such " +"as :c:func:`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` " +"or :c:func:`PyThreadState_GetUnchecked` for most cases." msgstr "" #: ../../c-api/init.rst:1359 msgid "" "Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " "otherwise. This function can be called from any thread at any time. Only if " -"it has had its :term:`thread state ` initialized via :" -"c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a helper/" -"diagnostic function. It can be useful for example in callback contexts or " -"memory allocation functions when knowing that the :term:`GIL` is locked can " -"allow the caller to perform sensitive actions or otherwise behave " +"it has had its :term:`thread state ` initialized " +"via :c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a " +"helper/diagnostic function. It can be useful for example in callback " +"contexts or memory allocation functions when knowing that the :term:`GIL` is " +"locked can allow the caller to perform sensitive actions or otherwise behave " "differently." msgstr "" #: ../../c-api/init.rst:1369 msgid "" "If the current Python process has ever created a subinterpreter, this " -"function will *always* return ``1``. Prefer :c:func:" -"`PyThreadState_GetUnchecked` for most cases." +"function will *always* return ``1``. " +"Prefer :c:func:`PyThreadState_GetUnchecked` for most cases." msgstr "" #: ../../c-api/init.rst:1376 @@ -1934,40 +2100,39 @@ msgstr "" #: ../../c-api/init.rst:1382 msgid "" -"This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" -"``. Note that it contains an opening brace; it must be matched with a " -"following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further " -"discussion of this macro." +"This macro expands to ``{ PyThreadState *_save; _save = " +"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " +"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " +"for further discussion of this macro." msgstr "" -"このマクロを展開すると ``{ PyThreadState *_save; _save = PyEval_SaveThread();" -"`` になります。マクロに開き波括弧が入っていることに注意してください; この波括" -"弧は後で :c:macro:`Py_END_ALLOW_THREADS` マクロと対応させなければなりません。" -"マクロについての詳しい議論は上記を参照してください。" +"このマクロを展開すると ``{ PyThreadState *_save; _save = " +"PyEval_SaveThread();`` になります。マクロに開き波括弧が入っていることに注意し" +"てください; この波括弧は後で :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." +"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 "" -"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" -"c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " +"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" "このマクロを展開すると ``PyEval_RestoreThread(_save);`` になります: 閉じ波括" "弧のない :c:macro:`Py_END_ALLOW_THREADS` と同じです。" #: ../../c-api/init.rst:1404 msgid "" -"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " +"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" "このマクロを展開すると ``_save = PyEval_SaveThread();`` になります: 開き波括" @@ -1983,60 +2148,70 @@ 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`." +":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." +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_New`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython.PyInterpreterState_New`` " -"を送出します。 " +"を送出します。" #: ../../c-api/init.rst:1430 msgid "" -"Reset all information in an interpreter state object. There must be an :" -"term:`attached thread state` for the the interpreter." +"Reset all information in an interpreter state object. There must be " +"an :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." +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_Clear`` with no arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``cpython." -"PyInterpreterState_Clear`` を送出します。 " +"引数無しで :ref:`監査イベント ` " +"``cpython.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`." +"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 `" +"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 +2223,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`." +"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 +2317,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 +2332,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 +2377,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 "" @@ -2215,29 +2398,36 @@ msgstr "" #: ../../c-api/init.rst:1611 msgid "" -"The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" -"`unsigned long`." +"The type of the *id* parameter changed from :c:expr:`long` " +"to :c:expr:`unsigned long`." 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." +"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 +2437,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." +"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 +2472,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,155 +2481,174 @@ 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 "" -"You can switch between sub-interpreters using the :c:func:" -"`PyThreadState_Swap` function. You can create and destroy them using the " -"following functions:" +"You can switch between sub-interpreters using " +"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " +"using the following functions:" 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`." +"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)." +"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 " -"is currently active. Otherwise only multi-phase init extension modules (see :" -"pep:`489`) may be imported. (Also see :c:macro:" -"`Py_mod_multiple_interpreters`.)" +"is currently active. Otherwise only multi-phase init extension modules " +"(see :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``." +"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``." +"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 "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " "interpreter has separate, independent versions of all imported modules, " -"including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:" -"`sys`. The table of loaded modules (``sys.modules``) and the module search " -"path (``sys.path``) are also separate. The new environment has no ``sys." -"argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, " -"``sys.stdout`` and ``sys.stderr`` (however these refer to the same " -"underlying file descriptors)." +"including the fundamental modules :mod:`builtins`, :mod:`__main__` " +"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " +"module search path (``sys.path``) are also separate. The new environment " +"has no ``sys.argv`` variable. It has new standard I/O stream file objects " +"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " +"same underlying file descriptors)." msgstr "" "新しいサブインタプリタ (sub-interpreter) を生成します。サブインタプリタとは、" "(ほぼ完全に) 個別に分割された Python コードの実行環境です。特に、新しいサブイ" "ンタプリタは、 import されるモジュール全てについて個別のバージョンを持ち、こ" -"れには基盤となるモジュール :mod:`builtins`, :mod:`__main__` および :mod:" -"`sys` も含まれます。ロード済みのモジュールからなるテーブル (``sys." -"modules``) およびモジュール検索パス (``sys.path``) もサブインタプリタ毎に別" -"個のものになります。新たなサブインタプリタ環境には ``sys.argv`` 変数がありま" -"せん。また、サブインタプリタは新たな標準 I/O ストリーム ``sys.stdin``, ``sys." -"stdout``, ``sys.stderr`` を持ちます (とはいえ、これらのストリームは根底にある" -"同じファイル記述子を参照しています)。" +"れには基盤となるモジュール :mod:`builtins`, :mod:`__main__` およ" +"び :mod:`sys` も含まれます。ロード済みのモジュールからなるテーブル " +"(``sys.modules``) およびモジュール検索パス (``sys.path``) もサブインタプリタ" +"毎に別個のものになります。新たなサブインタプリタ環境には ``sys.argv`` 変数が" +"ありません。また、サブインタプリタは新たな標準 I/O ストリーム ``sys.stdin``, " +"``sys.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,27 +2658,47 @@ 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 " "returning. On success, the returned thread state will be :term:`attached " -"`. If the sub-interpreter is created with its own :" -"term:`GIL` then the :term:`attached thread state` of the calling interpreter " -"will be detached. When the function returns, the new interpreter's :term:" -"`thread state` will be :term:`attached ` to the " -"current thread and the previous interpreter's :term:`attached thread state` " -"will remain detached." -msgstr "" +"`. If the sub-interpreter is created with its " +"own :term:`GIL` then the :term:`attached thread state` of the calling " +"interpreter will be detached. When the function returns, the new " +"interpreter's :term:`thread state` will be :term:`attached ` to the 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,71 +2715,109 @@ 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`." +"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." +"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 "" -"For modules using single-phase initialization, e.g. :c:func:" -"`PyModule_Create`, the first time a particular extension is imported, it is " -"initialized normally, and a (shallow) copy of its module's dictionary is " -"squirreled away. When the same extension is imported by another " -"(sub-)interpreter, a new module is initialized and filled with the contents " -"of this copy; the extension's ``init`` function is not called. Objects in " -"the module's dictionary thus end up shared across (sub-)interpreters, which " -"might cause unwanted behavior (see `Bugs and caveats`_ below)." +"For modules using single-phase initialization, " +"e.g. :c:func:`PyModule_Create`, the first time a particular extension is " +"imported, it is initialized normally, and a (shallow) copy of its module's " +"dictionary is squirreled away. When the same extension is imported by " +"another (sub-)interpreter, a new module is initialized and filled with the " +"contents of this copy; the extension's ``init`` function is not called. " +"Objects in the module's dictionary thus end up shared across " +"(sub-)interpreters, which 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:" -"`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's " -"``initmodule`` function *is* called again. As with multi-phase " -"initialization, this means that only C-level static and global variables are " -"shared between these modules." +"after the interpreter has been completely re-initialized by " +"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " +"the extension's ``initmodule`` function *is* called again. As with multi-" +"phase 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 " -"behavior. The result is an unisolated sub-interpreter that shares the main " -"interpreter's GIL, allows fork/exec, allows daemon threads, and allows " -"single-phase init modules." +"Create a new sub-interpreter. This is essentially just a wrapper " +"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " +"the existing behavior. The result is an unisolated sub-interpreter that " +"shares the main 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 +2835,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 +2847,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 +2898,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 +2905,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 "" @@ -2629,10 +2918,10 @@ msgid "" "delicate, because these APIs assume a bijection between Python thread states " "and OS-level threads, an assumption broken by the presence of sub-" "interpreters. It is highly recommended that you don't switch sub-" -"interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:" -"`ctypes`) using these APIs to allow calling of Python code from non-Python " -"created threads will probably be broken when using sub-interpreters." +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " +"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" +"Python created threads will probably be broken when using sub-interpreters." msgstr "" "サブインタプリタを ``PyGILState_*`` API と組み合わせるのが難しいことにも注意" "してください。これらのAPIはPythonのスレッド状態とOSレベルスレッドが1対1で対応" @@ -2682,26 +2971,31 @@ 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 "" "This function doesn't need an :term:`attached thread state`. However, to " -"call this function in a subinterpreter, the caller must have an :term:" -"`attached thread state`. Otherwise, the function *func* can be scheduled to " -"be called from the wrong interpreter." +"call this function in a subinterpreter, the caller must have " +"an :term:`attached thread state`. Otherwise, the function *func* can be " +"scheduled to be called from the wrong interpreter." msgstr "" #: ../../c-api/init.rst:1993 @@ -2710,8 +3004,8 @@ msgid "" "no guarantee that *func* will be called as quick as possible. If the main " "thread is busy executing a system call, *func* won't be called before the " "system call returns. This function is generally **not** suitable for " -"calling Python code from arbitrary C threads. Instead, use the :ref:" -"`PyGILState API`." +"calling Python code from arbitrary C threads. Instead, use " +"the :ref:`PyGILState API`." msgstr "" "これは、非常に特別な場合にのみ役立つ、低レベルな関数です。 *func* が可能な限" "り早く呼び出される保証はありません。メインスレッドがシステムコールを実行する" @@ -2720,13 +3014,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,17 +3056,21 @@ 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 " "the registration function as *obj*, *frame* is the frame object to which the " -"event pertains, *what* is one of the constants :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`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " -"value of *what*:" -msgstr "" +"event pertains, *what* is one of the " +"constants :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`, " +"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 +3080,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 +3108,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 +3132,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 +3155,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." +"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,88 +3198,115 @@ 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." +"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``. " "If the profile function needs to maintain state, using a different value for " "*obj* for each thread provides a convenient and thread-safe place to store " -"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 "" +"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 " -"events and per-opcode events, but does not receive any event related to C " -"function objects being called. Any trace function registered using :c:func:" -"`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:" -"`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " -"*what* parameter." +"Set the tracing function to *func*. This is similar " +"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " +"line-number events and per-opcode events, but does not receive any event " +"related to C function objects being called. Any trace function registered " +"using :c:func:`PyEval_SetTrace` will not " +"receive :c:data:`PyTrace_C_CALL`, :c:data:`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 " -"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " -"about to be destroyed (when **event** is set to :c:data:" -"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " -"provided when :c:func:`PyRefTracer_SetTracer` was called." +"The type of the trace function registered " +"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " +"object that has been just created (when **event** is set " +"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " +"set to :c:data:`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 +3331,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" @@ -3104,10 +3429,10 @@ msgstr "" #: ../../c-api/init.rst:2284 msgid "" -"None of these API functions handle memory management on behalf of the :c:" -"expr:`void*` values. You need to allocate and deallocate them yourself. If " -"the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions " -"don't do refcount operations on them either." +"None of these API functions handle memory management on behalf of " +"the :c:expr:`void*` values. You need to allocate and deallocate them " +"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " +"these functions don't do refcount operations on them either." msgstr "" "この API 関数はどれも :c:expr:`void*` 値の代わりにメモリ管理を行うことはしま" "せん。\n" @@ -3127,8 +3452,8 @@ msgid "" msgstr "" "TSS API は、 CPython インタプリタに含まれている既存の TLS API を置き換えるた" "めに導入されました。\n" -"この API は、スレッドキーの表現に :c:expr:`int` の代わりに新しい型 :c:type:" -"`Py_tss_t` を使います。" +"この API は、スレッドキーの表現に :c:expr:`int` の代わりに新しい" +"型 :c:type:`Py_tss_t` を使います。" #: ../../c-api/init.rst:2300 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" @@ -3151,8 +3476,8 @@ msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -":ref:`Py_LIMITED_API ` が定義されていないときは、この型の :c:macro:" -"`Py_tss_NEEDS_INIT` による静的メモリ確保ができます。" +":ref:`Py_LIMITED_API ` が定義されていないときは、この型" +"の :c:macro:`Py_tss_NEEDS_INIT` による静的メモリ確保ができます。" #: ../../c-api/init.rst:2316 msgid "" @@ -3176,43 +3501,52 @@ 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." +"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`." +"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,29 +3554,42 @@ 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 " -"destroyed key is able to be initialized again by :c:func:" -"`PyThread_tss_create`. This function can be called repeatedly on the same " -"key -- calling it on an already destroyed key is a no-op." +"destroyed key is able to be initialized again " +"by :c:func:`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 +3601,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 +3608,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,68 +3625,86 @@ 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 "" "Critical sections avoid deadlocks by implicitly suspending active critical " -"sections and releasing the locks during calls to :c:func:" -"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " -"recent critical section is resumed, and its locks reacquired. This means " -"the critical section API provides weaker guarantees than traditional locks " -"-- they are useful because their behavior is similar to the :term:`GIL`." +"sections and releasing the locks during calls " +"to :c:func:`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is " +"called, the most recent critical section is resumed, and its locks " +"reacquired. This means the critical section API provides weaker guarantees " +"than traditional locks -- they are useful because their behavior is similar " +"to the :term:`GIL`." msgstr "" #: ../../c-api/init.rst:2475 @@ -3347,20 +3715,24 @@ 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 " -"lock more than one object at once, because the inner critical section may " -"suspend the outer critical sections. This API does not provide a way to " -"lock more than two objects at once." +"Operations that need to lock two objects at once must " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " +"sections to lock more than one object at once, because the inner critical " +"section may 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,52 +3743,63 @@ 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 " "critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " -"if the code triggered by the finalizer blocks and calls :c:func:" -"`PyEval_SaveThread`." +"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 +3808,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 +3864,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 +3915,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 +3965,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..36a21b0be 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,619 +497,487 @@ 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 `" +":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 "" -"Public: Can by get by :c:func:`PyConfig_Get` and set by :c:func:" -"`PyConfig_Set`." +"Public: Can by get by :c:func:`PyConfig_Get` and set " +"by :c:func:`PyConfig_Set`." msgstr "" #: ../../c-api/init_config.rst:549 msgid "" -"Read-only: Can by get by :c:func:`PyConfig_Get`, but cannot be set by :c:" -"func:`PyConfig_Set`." +"Read-only: Can by get by :c:func:`PyConfig_Get`, but cannot be set " +"by :c: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." +"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 "" -"Python can be initialized with :c:func:`Py_InitializeFromConfig` and the :c:" -"type:`PyConfig` structure. It can be preinitialized with :c:func:" -"`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." +"Python can be initialized with :c:func:`Py_InitializeFromConfig` and " +"the :c:type:`PyConfig` structure. It can be preinitialized " +"with :c:func:`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." msgstr "" "Pythonは :c:func:`Py_InitializeFromConfig` と :c:type:`PyConfig` 構造体を" "使って初期化できます。:c:func:`Py_PreInitialize` と :c:type:`PyPreConfig` " @@ -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 `." +"``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,141 @@ 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``." +"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 `." +"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`." +"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,99 +1475,113 @@ 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`)" +"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." +"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." +"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`." +"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 " -"arguments, the command line arguments must also be passed to preinitialize " -"Python, since they have an effect on the pre-configuration like encodings. " -"For example, the :option:`-X utf8 <-X>` command line option enables the :ref:" -"`Python UTF-8 Mode `." +"For :ref:`Python Configuration ` " +"(:c:func:`PyPreConfig_InitPythonConfig`), if Python is initialized with " +"command line arguments, the command line arguments must also be passed to " +"preinitialize Python, since they have an effect on the pre-configuration " +"like encodings. 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``." +"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,237 +1600,264 @@ 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`." +"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 " -"arguments are parsed. Since Python arguments are stripped from :c:member:" -"`PyConfig.argv`, parsing arguments twice would parse the application options " -"as Python options." +"arguments are parsed. Since Python arguments are stripped " +"from :c:member:`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``." +"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 "" "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " -"In that case, the Python preinitialization configuration (:c:type:" -"`PyPreConfig`) in based on the :c:type:`PyConfig`. If configuration fields " -"which are in common with :c:type:`PyPreConfig` are tuned, they must be set " -"before calling a :c:type:`PyConfig` method:" +"In that case, the Python preinitialization configuration " +"(:c:type:`PyPreConfig`) in based on the :c:type:`PyConfig`. If configuration " +"fields which are in common with :c:type:`PyPreConfig` are tuned, they must " +"be set before calling a :c:type:`PyConfig` method:" 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)." +"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:" -"func:`main` function with the difference that the first entry should refer " -"to the script file to be executed rather than the executable hosting the " -"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." +"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:func:`main` function with the difference that the first " +"entry should refer to the script file to be executed rather than the " +"executable hosting the 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`." +"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:" +"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." +"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,476 +1867,495 @@ 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." +"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`." +"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." +"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." +"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." +"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`." +"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." +"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`." +":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." +"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`." +":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." +"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." +"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." +"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 " -"taken from the command line or environment or otherwise default to 4300 (:" -"data:`sys.int_info.default_max_str_digits`). A value of ``0`` disables the " -"limitation. Values greater than zero but less than 640 (:data:`sys.int_info." -"str_digits_check_threshold`) are unsupported and will produce an error." +"taken from the command line or environment or otherwise default to 4300 " +"(:data:`sys.int_info.default_max_str_digits`). A value of ``0`` disables " +"the 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." +"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`." +"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." +"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`." +"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`." +"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,261 +2365,294 @@ 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)." +"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`)." +"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``." +"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." +"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` " -"copies :c:member:`~PyConfig.argv` into :c:member:`~PyConfig.orig_argv` " -"before modifying :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig." -"parse_argv` is non-zero)." +"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` copies :c:member:`~PyConfig.argv` " +"into :c:member:`~PyConfig.orig_argv` 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." +"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``." +"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." +"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 "" -"If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:" -"`__PYVENV_LAUNCHER__` environment variable if set." +"If the ``WITH_NEXT_FRAMEWORK`` macro is defined, " +"use :envvar:`__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`." +"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." +"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 +2667,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`." +":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 " +"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." +"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." +"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." +"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,99 +2898,115 @@ 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." +"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 (``," -"``)." +"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." +"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`." +":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`." +"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 " -"Python preinitialization and before the Python initialization. If Python is " -"initialized multiple times, :c:func:`PyImport_AppendInittab` or :c:func:" -"`PyImport_ExtendInittab` must be called before each Python initialization." +"If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` " +"or :c:func:`PyImport_ExtendInittab` are used, they must be set or called " +"after Python preinitialization and before the Python initialization. If " +"Python is 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 +3034,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 +3068,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,112 +3129,120 @@ 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." +":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." +":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 "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " -"Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" -"`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." +"Mode ` (:pep:`540`) depending on the LC_CTYPE " +"locale, :envvar:`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`)" +"``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`" @@ -3210,25 +3265,25 @@ msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" #: ../../c-api/init_config.rst:2209 -msgid "" -":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." -"module_search_paths`" -msgstr "" -":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." -"module_search_paths`" +msgid ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" +msgstr ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" #: ../../c-api/init_config.rst:2211 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." -"module_search_paths_set` is equal to ``0``, :c:member:`~PyConfig." -"module_search_paths` is overridden and :c:member:`~PyConfig." -"module_search_paths_set` is set to ``1``." +"configuration to fill unset fields. " +"If :c:member:`~PyConfig.module_search_paths_set` is equal to " +"``0``, :c:member:`~PyConfig.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,90 +3302,92 @@ 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." +"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`." +"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." -"user_site_directory` is non-zero and the user's site-package directory " -"exists, the :mod:`site` module appends the user's site-package directory to :" -"data:`sys.path`." +"modified by the :mod:`site` module. " +"If :c:member:`~PyConfig.user_site_directory` is non-zero and the user's site-" +"package directory 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 +3397,40 @@ 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`." +"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`." +"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..e4fed7cc4 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 " @@ -40,19 +39,21 @@ msgid "" "API. The first reason is to write *extension modules* for specific purposes; " "these are C modules that extend the Python interpreter. This is probably " "the most common use. The second reason is to use Python as a component in a " -"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`) と呼びます。" +"larger application; this technique is generally referred to " +"as :dfn:`embedding` Python in an application." +msgstr "" +"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,16 +136,18 @@ msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include " #: ../../c-api/intro.rst:64 msgid "" "This implies inclusion of the following standard headers: ````, " -"````, ````, ````, ```` and ```` (if available)." +"````, ````, ````, ```` and " +"```` (if available)." msgstr "" "をソースコードに記述します。この行を記述すると、標準ヘッダ: ````, " -"````, ````, ````, ````, ```` を (利用できれば) インクルードします。" +"````, ````, ````, ````, " +"```` を (利用できれば) インクルードします。" #: ../../c-api/intro.rst:70 msgid "" @@ -191,46 +197,49 @@ msgstr "" #: ../../c-api/intro.rst:89 msgid "" "The header files are typically installed with Python. On Unix, these are " -"located in the directories :file:`{prefix}/include/pythonversion/` and :file:" -"`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` " -"and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding " -"parameters to Python's :program:`configure` script and *version* is ``'%d." -"%d' % sys.version_info[:2]``. On Windows, the headers are installed in :" -"file:`{prefix}/include`, where ``prefix`` is the installation directory " -"specified to the installer." -msgstr "" -"ヘッダファイル群は通常 Python と共にインストールされます。 Unixでは :file:" -"`{prefix}/include/pythonversion/` および :file:`{exec_prefix}/include/" -"pythonversion/` に置かれます。 :option:`prefix <--prefix>` と :option:" -"`exec_prefix <--exec-prefix>` は Python をビルドする際の :program:" -"`configure` スクリプトに与えたパラメタに対応し、 *version* は ``'%d.%d' % " -"sys.version_info[:2]`` に対応します。 Windows では、ヘッダは :file:`{prefix}/" -"include` に置かれます。 ``prefix`` はインストーラに指定したインストールディレ" -"クトリです。" +"located in the directories :file:`{prefix}/include/pythonversion/` " +"and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--" +"prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the " +"corresponding parameters to Python's :program:`configure` script and " +"*version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers " +"are installed in :file:`{prefix}/include`, where ``prefix`` is the " +"installation directory specified to the installer." +msgstr "" +"ヘッダファイル群は通常 Python と共にインストールされます。 Unixで" +"は :file:`{prefix}/include/pythonversion/` および :file:`{exec_prefix}/" +"include/pythonversion/` に置かれます。 :option:`prefix <--prefix>` " +"と :option:`exec_prefix <--exec-prefix>` は Python をビルドする際" +"の :program:`configure` スクリプトに与えたパラメタに対応し、 *version* は " +"``'%d.%d' % sys.version_info[:2]`` に対応します。 Windows では、ヘッダ" +"は :file:`{prefix}/include` に置かれます。 ``prefix`` はインストーラに指定し" +"たインストールディレクトリです。" #: ../../c-api/intro.rst:98 msgid "" "To include the headers, place both directories (if different) on your " "compiler's search path for includes. Do *not* place the parent directories " "on the search path and then use ``#include ``; this will " -"break on multi-platform builds since the platform independent headers under :" -"option:`prefix <--prefix>` include the platform specific headers from :" -"option:`exec_prefix <--exec-prefix>`." +"break on multi-platform builds since the platform independent headers " +"under :option:`prefix <--prefix>` include the platform specific headers " +"from :option:`exec_prefix <--exec-prefix>`." msgstr "" "ヘッダをインクルードするには、各ヘッダの入ったディレクトリ (別々のディレクト" "リの場合は両方) を、コンパイラがインクルードファイルを検索するためのパスに入" -"れます。親ディレクトリをサーチパスに入れて、 ``#include `` のようにしては *なりません* ; :option:`prefix <--prefix>` 内のプラット" -"フォームに依存しないヘッダは、 :option:`exec_prefix <--exec-prefix>` からプ" -"ラットフォーム依存のヘッダをインクルードしているので、このような操作を行うと" -"複数のプラットフォームでのビルドができなくなります。" +"れます。親ディレクトリをサーチパスに入れて、 ``#include `` のようにしては *なりません* ; :option:`prefix <--prefix>` 内のプ" +"ラットフォームに依存しないヘッダは、 :option:`exec_prefix <--exec-prefix>` か" +"らプラットフォーム依存のヘッダをインクルードしているので、このような操作を行" +"うと複数のプラットフォームでのビルドができなくなります。" -#: ../../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." +"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`)." +"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 " @@ -479,30 +524,33 @@ msgid "" "are treated the same way by the Python language in most situations (e.g., " "assignments, scope rules, and argument passing), it is only fitting that " "they should be represented by a single C type. Almost all Python objects " -"live on the heap: you never declare an automatic or static variable of type :" -"c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can " -"be declared. The sole exception are the type objects; since these must " +"live on the heap: you never declare an automatic or static variable of " +"type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` " +"can be declared. The sole exception are the type objects; since these must " "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 "" -"All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" -"`reference count`. An object's type determines what kind of object it is (e." -"g., an integer, a list, or a user-defined function; there are many more as " -"explained in :ref:`types`). For each of the well-known types there is a " -"macro to check whether an object is of that type; for instance, " +"All Python objects (even Python integers) have a :dfn:`type` and " +"a :dfn:`reference count`. An object's type determines what kind of object " +"it is (e.g., an integer, a list, or a user-defined function; there are many " +"more as explained in :ref:`types`). For each of the well-known types there " +"is a macro to check whether an object is of that type; for instance, " "``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is " "a Python list." msgstr "" @@ -538,21 +586,20 @@ msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " "increment its reference count by one), and :c:func:`Py_DECREF` to release " -"that reference (i.e. decrement the reference count by one). The :c:func:" -"`Py_DECREF` macro is considerably more complex than the incref one, since it " -"must check whether the reference count becomes zero and then cause the " -"object's deallocator to be called. The deallocator is a function pointer " -"contained in the object's type structure. The type-specific deallocator " -"takes care of releasing references for other objects contained in the object " -"if this is a compound object type, such as a list, as well as performing any " -"additional finalization that's needed. There's no chance that the reference " -"count can overflow; at least as many bits are used to hold the reference " -"count as there are distinct memory locations in virtual memory (assuming " -"``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count " -"increment is a simple operation." -msgstr "" - -#: ../../c-api/intro.rst:357 +"that reference (i.e. decrement the reference count by one). " +"The :c:func:`Py_DECREF` macro is considerably more complex than the incref " +"one, since it must check whether the reference count becomes zero and then " +"cause the object's deallocator to be called. The deallocator is a function " +"pointer contained in the object's type structure. The type-specific " +"deallocator takes care of releasing references for other objects contained " +"in the object if this is a compound object type, such as a list, as well as " +"performing any additional finalization that's needed. There's no chance " +"that the reference count can overflow; at least as many bits are used to " +"hold the reference count as there are distinct memory locations in virtual " +"memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the " +"reference count increment is a simple operation." +msgstr "" + 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,19 +616,39 @@ 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 " "conceivably remove the object from the list, releasing that reference, and " "possibly deallocating it. The real danger is that innocent-looking " "operations may invoke arbitrary Python code which could do this; there is a " -"code path which allows control to flow back to the user from a :c:func:" -"`Py_DECREF`, so almost any operation is potentially dangerous." +"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 " @@ -603,14 +675,28 @@ msgid "" "shared). \"Owning a reference\" means being responsible for calling " "Py_DECREF on it when the reference is no longer needed. Ownership can also " "be transferred, meaning that the code that receives ownership of the " -"reference then becomes responsible for eventually releasing it by calling :c:" -"func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or " -"passing on this responsibility (usually to its caller). When a function " -"passes ownership of a reference on to its caller, the caller is said to " -"receive a *new* reference. When no ownership is transferred, the caller is " -"said to *borrow* the reference. Nothing needs to be done for a :term:" -"`borrowed reference`." -msgstr "" +"reference then becomes responsible for eventually releasing it by " +"calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer " +"needed---or passing on this responsibility (usually to its caller). When a " +"function passes ownership of a reference on to its caller, the caller is " +"said to receive a *new* reference. When no ownership is transferred, the " +"caller is 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 "" @@ -628,25 +714,24 @@ msgstr "" #: ../../c-api/intro.rst:417 msgid "" -"Few functions steal references; the two notable exceptions are :c:func:" -"`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " -"the item (but not to the tuple or list into which the item is put!). These " -"functions were designed to steal a reference because of a common idiom for " -"populating a tuple or list with newly created objects; for example, the code " -"to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting " -"about error handling for the moment; a better way to code this is shown " -"below)::" -msgstr "" -"参照を盗み取る関数はほとんどありません; 例外としてよく知られているのは、 :c:" -"func:`PyList_SetItem` と :c:func:`PyTuple_SetItem` で、これらはシーケンスに入" -"れる要素に対する参照を盗み取ります (しかし、要素の入る先のタプルやリストの参" -"照は盗み取りません!)。これらの関数は、リストやタプルの中に新たに作成されたオ" -"ブジェクトを入れていく際の常套的な書き方をしやすくするために、参照を盗み取る" -"ように設計されています; 例えば、 ``(1, 2, \"three\")`` というタプルを生成する" -"コードは以下のようになります (とりあえず例外処理のことは忘れておきます; もっ" -"とよい書き方を後で示します)::" - -#: ../../c-api/intro.rst:425 +"Few functions steal references; the two notable exceptions " +"are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a " +"reference to the item (but not to the tuple or list into which the item is " +"put!). These functions were designed to steal a reference because of a " +"common idiom for populating a tuple or list with newly created objects; for " +"example, the code to create the tuple ``(1, 2, \"three\")`` could look like " +"this (forgetting about error handling for the moment; a better way to code " +"this is shown below)::" +msgstr "" +"参照を盗み取る関数はほとんどありません; 例外としてよく知られているの" +"は、 :c:func:`PyList_SetItem` と :c:func:`PyTuple_SetItem` で、これらはシーケ" +"ンスに入れる要素に対する参照を盗み取ります (しかし、要素の入る先のタプルやリ" +"ストの参照は盗み取りません!)。これらの関数は、リストやタプルの中に新たに作成" +"されたオブジェクトを入れていく際の常套的な書き方をしやすくするために、参照を" +"盗み取るように設計されています; 例えば、 ``(1, 2, \"three\")`` というタプルを" +"生成するコードは以下のようになります (とりあえず例外処理のことは忘れておきま" +"す; もっとよい書き方を後で示します)::" + 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 "" @@ -663,39 +754,39 @@ msgid "" "although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab " "another reference before calling the reference-stealing function." msgstr "" -"ここで、 :c:func:`PyLong_FromLong` は新しい参照を返し、すぐに :c:func:" -"`PyTuple_SetItem` に盗まれます。参照が盗まれた後もそのオブジェクトを利用した" -"い場合は、参照盗む関数を呼び出す前に、 :c:func:`Py_INCREF` を利用してもう一つ" -"の参照を取得してください。" +"ここで、 :c:func:`PyLong_FromLong` は新しい参照を返し、すぐ" +"に :c:func:`PyTuple_SetItem` に盗まれます。参照が盗まれた後もそのオブジェクト" +"を利用したい場合は、参照盗む関数を呼び出す前に、 :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." +"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 "" -"Equivalent code for populating a list can be written using :c:func:" -"`PyList_New` and :c:func:`PyList_SetItem`." +"Equivalent code for populating a list can be written " +"using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" -"同じく、リストに値を入れていくコードは :c:func:`PyList_New` と :c:func:" -"`PyList_SetItem` で書けます。" +"同じく、リストに値を入れていくコードは :c:func:`PyList_New` " +"と :c:func:`PyList_SetItem` で書けます。" #: ../../c-api/intro.rst:445 msgid "" "However, in practice, you will rarely use these ways of creating and " -"populating a tuple or list. There's a generic function, :c:func:" -"`Py_BuildValue`, that can create most common objects from C values, directed " -"by a :dfn:`format string`. For example, the above two blocks of code could " -"be replaced by the following (which also takes care of the error checking)::" +"populating a tuple or list. There's a generic " +"function, :c:func:`Py_BuildValue`, that can create most common objects from " +"C values, directed by a :dfn:`format string`. For example, the above two " +"blocks of code could be replaced by the following (which also takes care of " +"the error checking)::" msgstr "" "しかし実際には、タプルやリストを生成して値を入れる際には、上記のような方法は" "ほとんど使いません。より汎用性のある関数、 :c:func:`Py_BuildValue` があり、ほ" @@ -710,8 +801,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 +815,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 +844,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 "" @@ -763,9 +882,9 @@ msgstr "" "対する参照を返すような多くの関数は、参照に対する所有権を呼び出し側に与えま" "す。理由は簡単です: 多くの場合、関数が返すオブジェクトはその場で (on the " "fly) 生成されるため、呼び出し側が得る参照は生成されたオブジェクトに対する唯一" -"の参照になるからです。従って、 :c:func:`PyObject_GetItem` や :c:func:" -"`PySequence_GetItem` のように、オブジェクトに対する参照を返す汎用の関数は、常" -"に新たな参照を返します (呼び出し側が参照の所有者になります)。" +"の参照になるからです。従って、 :c:func:`PyObject_GetItem` " +"や :c:func:`PySequence_GetItem` のように、オブジェクトに対する参照を返す汎用" +"の関数は、常に新たな参照を返します (呼び出し側が参照の所有者になります)。" #: ../../c-api/intro.rst:495 msgid "" @@ -779,11 +898,11 @@ msgid "" msgstr "" "重要なのは、関数が返す参照の所有権を持てるかどうかは、どの関数を呼び出すかだ" "けによる、と理解することです --- 関数呼び出し時の *お飾り* (関数に引数として" -"渡したオブジェクトの型) は *この問題には関係ありません!* 従って、 :c:func:" -"`PyList_GetItem` を使ってリスト内の要素を得た場合には、参照の所有者にはなりま" -"せん --- が、同じ要素を同じリストから :c:func:`PySequence_GetItem` (図らずも" -"この関数は全く同じ引数をとります) を使って取り出すと、返されたオブジェクトに" -"対する参照を得ます。" +"渡したオブジェクトの型) は *この問題には関係ありません!* 従っ" +"て、 :c:func:`PyList_GetItem` を使ってリスト内の要素を得た場合には、参照の所" +"有者にはなりません --- が、同じ要素を同じリストか" +"ら :c:func:`PySequence_GetItem` (図らずもこの関数は全く同じ引数をとります) を" +"使って取り出すと、返されたオブジェクトに対する参照を得ます。" #: ../../c-api/intro.rst:507 msgid "" @@ -795,7 +914,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 +937,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 +988,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" @@ -858,19 +1023,20 @@ msgstr "型" #: ../../c-api/intro.rst:573 msgid "" "There are few other data types that play a significant role in the Python/C " -"API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" -"`double` and :c:expr:`char*`. A few structure types are used to describe " -"static tables used to list the functions exported by a module or the data " -"attributes of a new object type, and another is used to describe the value " -"of a complex number. These will be discussed together with the functions " -"that use them." +"API; most are simple C types such " +"as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A " +"few structure types are used to describe static tables used to list the " +"functions exported by a module or the data attributes of a new object type, " +"and another is used to describe the value of a complex number. These will " +"be discussed together with the functions that use them." msgstr "" "他にも Python/C API において重要な役割を持つデータ型がいくつかあります; ほと" -"んどは :c:expr:`int`, :c:expr:`long`, :c:expr:`double`, および :c:expr:" -"`char*` といった、単なる C のデータ型です。また、モジュールで公開している関数" -"を列挙する際に用いられる静的なテーブルや、新しいオブジェクト型におけるデータ" -"属性を記述したり、複素数の値を記述したりするために構造体をいくつか使っていま" -"す。これらの型については、その型を使う関数とともに説明してゆきます。" +"んどは :c:expr:`int`, :c:expr:`long`, :c:expr:`double`, およ" +"び :c:expr:`char*` といった、単なる C のデータ型です。また、モジュールで公開" +"している関数を列挙する際に用いられる静的なテーブルや、新しいオブジェクト型に" +"おけるデータ属性を記述したり、複素数の値を記述したりするために構造体をいくつ" +"か使っています。これらの型については、その型を使う関数とともに説明してゆきま" +"す。" #: ../../c-api/intro.rst:583 msgid "" @@ -922,76 +1088,73 @@ 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 " -"of two states: an exception has occurred, or not. The function :c:func:" -"`PyErr_Occurred` can be used to check for this: it returns a borrowed " -"reference to the exception type object when an exception has occurred, and " -"``NULL`` otherwise. There are a number of functions to set the exception " -"state: :c:func:`PyErr_SetString` is the most common (though not the most " -"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` は例外状態情報を消し去" -"る関数です。" - -#: ../../c-api/intro.rst:627 +"of two states: an exception has occurred, or not. The " +"function :c:func:`PyErr_Occurred` can be used to check for this: it returns " +"a borrowed reference to the exception type object when an exception has " +"occurred, and ``NULL`` otherwise. There are a number of functions to set " +"the exception state: :c:func:`PyErr_SetString` is the most common (though " +"not the most general) function to set the exception state, " +"and :c:func:`PyErr_Clear` clears the exception state." +msgstr "" +"例外状態は、スレッドごとの記憶領域で管理されます。\n" +"スレッドを使わないアプリケーションでは、グローバルな記憶領域を使うことに相当" +"します。\n" +"スレッドは、例外が発生しているか、していないかの 2 つの状態のいずれかを取りま" +"す。\n" +":c:func:`PyErr_Occurred` でこれを調べられます。\n" +"例外が発生していれば、その例外の型オブジェクトへの借用参照を返し、それ以外の" +"場合は ``NULL`` を返します。\n" +"例外状態を設定する関数はいくつかあり、:c:func:`PyErr_SetString` が最もよく使" +"われますが、最も汎用的な関数というわけではありません。\n" +":c:func:`PyErr_Clear` は例外状態を消去します。" + msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " -"traceback. These have the same meanings as the Python result of ``sys." -"exc_info()``; however, they are not the same: the Python objects represent " -"the last exception being handled by a Python :keyword:`try` ... :keyword:" -"`except` statement, while the C level exception state only exists while an " -"exception is being passed on between C functions until it reaches the Python " -"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 のバイトコードイ" -"ンタプリタのメインループに到達するまで、例外が関数の間で受け渡しされている間" -"だけです。" - -#: ../../c-api/intro.rst:639 +"traceback. These have the same meanings as the Python result of " +"``sys.exc_info()``; however, they are not the same: the Python objects " +"represent the last exception being handled by a " +"Python :keyword:`try` ... :keyword:`except` statement, while the C level " +"exception state only exists while an exception is being passed on between C " +"functions until it reaches the Python bytecode interpreter's main loop, " +"which takes care of transferring it to ``sys.exc_info()`` and friends." +msgstr "" +"完全な例外状態は、例外の型、対応する例外の値、トレースバックの 3 つのオブジェ" +"クトからなり、いずれも ``NULL`` になりえます。\n" +"これらは Python の ``sys.exc_info()`` の結果と同じ意味を持ちますが、同じもの" +"ではありません。\n" +"Python 側のオブジェクトは、Python の :keyword:`try` ... :keyword:`except` 文" +"で現在処理している最後の例外を表します。\n" +"一方、C レベルの例外状態が存在するのは、例外が C 関数の間で受け渡され、" +"Python バイトコードインタープリタのメインループに到達するまでの間だけです。\n" +"メインループが、例外を ``sys.exc_info()`` などに移す処理を行います。" + 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." -"exc_info`, which returns the per-thread exception state for Python code. " -"Also, the semantics of both ways to access the exception state have changed " -"so that a function which catches an exception will save and restore its " -"thread's exception state so as to preserve the exception state of its " -"caller. This prevents common bugs in exception handling code caused by an " -"innocent-looking function overwriting the exception being handled; it also " -"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) が変更され、ある関数が例外を捕捉すると、その" -"関数を実行しているスレッドの例外状態情報を保存して、呼び出し側の例外状態情報" -"を維持するようになりました。この変更によって、無害そうに見える関数が現在扱っ" -"ている例外を上書きすることで引き起こされる、例外処理コードでよくおきていたバ" -"グを抑止しています; また、トレースバック内のスタックフレームで参照されている" -"オブジェクトがしばしば不必要に寿命を永らえていたのをなくしています。" - -#: ../../c-api/intro.rst:650 +"the exception state from Python code is to call the " +"function :func:`sys.exc_info`, which returns the per-thread exception state " +"for Python code. Also, the semantics of both ways to access the exception " +"state have changed so that a function which catches an exception will save " +"and restore its thread's exception state so as to preserve the exception " +"state of its caller. This prevents common bugs in exception handling code " +"caused by an innocent-looking function overwriting the exception being " +"handled; it also 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` の呼び出しを推奨します。\n" +"この関数は、Python コードから使う、スレッドごとの例外状態を返します。\n" +"また、両方の例外状態へのアクセス方法の意味が変更され、例外を捕捉する関数が、" +"呼び出し元の例外状態を保つためにスレッドの例外状態を保存・復元するようになり" +"ました。\n" +"これにより、無害に見える関数が処理中の例外を上書きすることで生じる、例外処理" +"コードのよくあるバグを防ぎます。\n" +"トレースバック内のスタックフレームが参照するオブジェクトの寿命が、不必要に延" +"びることも減らします。" + 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 +1164,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 +1178,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 +1194,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,29 +1249,71 @@ 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 "" "This example represents an endorsed use of the ``goto`` statement in C! It " -"illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" -"`PyErr_Clear` to handle specific exceptions, and the use of :c:func:" -"`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the " -"``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a " -"``NULL`` reference). It is important that the variables used to hold owned " -"references are initialized to ``NULL`` for this to work; likewise, the " -"proposed return value is initialized to ``-1`` (failure) and only set to " -"success after the final call made is successful." +"illustrates the use of :c:func:`PyErr_ExceptionMatches` " +"and :c:func:`PyErr_Clear` to handle specific exceptions, and the use " +"of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` " +"(note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when " +"confronted with a ``NULL`` reference). It is important that the variables " +"used to hold owned references are initialized to ``NULL`` for this to work; " +"likewise, the proposed return value is initialized to ``-1`` (failure) and " +"only set to success after the final call made is successful." msgstr "" "なんとこの例は C で ``goto`` 文を使うお勧めの方法まで示していますね! この例で" -"は、特定の例外を処理するために :c:func:`PyErr_ExceptionMatches` および :c:" -"func:`PyErr_Clear` をどう使うかを示しています。また、所有権を持っている参照" -"で、値が ``NULL`` になるかもしれないものを捨てるために :c:func:`Py_XDECREF` " -"をどう使うかも示しています (関数名に ``'X'`` が付いていることに注意してくださ" -"い; :c:func:`Py_DECREF` は ``NULL`` 参照に出くわすとクラッシュします)。正しく" -"動作させるためには、所有権を持つ参照を保持するための変数を ``NULL`` で初期化" -"することが重要です; 同様に、あらかじめ戻り値を定義する際には値を ``-1`` (失" -"敗) で初期化しておいて、最後の関数呼び出しまでうまくいった場合にのみ ``0`` " -"(成功) に設定します。" +"は、特定の例外を処理するために :c:func:`PyErr_ExceptionMatches` およ" +"び :c:func:`PyErr_Clear` をどう使うかを示しています。また、所有権を持っている" +"参照で、値が ``NULL`` になるかもしれないものを捨てるため" +"に :c:func:`Py_XDECREF` をどう使うかも示しています (関数名に ``'X'`` が付い" +"ていることに注意してください; :c:func:`Py_DECREF` は ``NULL`` 参照に出くわす" +"とクラッシュします)。正しく動作させるためには、所有権を持つ参照を保持するため" +"の変数を ``NULL`` で初期化することが重要です; 同様に、あらかじめ戻り値を定義" +"する際には値を ``-1`` (失敗) で初期化しておいて、最後の関数呼び出しまでうまく" +"いった場合にのみ ``0`` (成功) に設定します。" #: ../../c-api/intro.rst:740 msgid "Embedding Python" @@ -1125,16 +1339,17 @@ msgid "" "initializes the module search path (``sys.path``)." msgstr "" "基本的な初期化処理を行う関数は :c:func:`Py_Initialize` です。この関数はロード" -"済みのモジュールからなるテーブルを作成し、土台となるモジュール :mod:" -"`builtins`, :mod:`__main__`, および :mod:`sys` を作成します。また、モジュール" -"検索パス (``sys.path``) の初期化も行います。" +"済みのモジュールからなるテーブルを作成し、土台となるモジュー" +"ル :mod:`builtins`, :mod:`__main__`, および :mod:`sys` を作成します。また、モ" +"ジュール検索パス (``sys.path``) の初期化も行います。" #: ../../c-api/intro.rst:760 msgid "" -":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." -"argv``). If this variable is needed by Python code that will be executed " -"later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` " -"must be set: see :ref:`Python Initialization Configuration `." +":c:func:`Py_Initialize` does not set the \"script argument list\" " +"(``sys.argv``). If this variable is needed by Python code that will be " +"executed later, setting :c:member:`PyConfig.argv` " +"and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/intro.rst:765 @@ -1162,53 +1377,55 @@ msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" "python{X.Y}`. (In fact, this particular path is also the \"fallback\" " -"location, used when no executable file named :file:`python` is found along :" -"envvar:`PATH`.) The user can override this behavior by setting the " +"location, used when no executable file named :file:`python` is found " +"along :envvar:`PATH`.) The user can override this behavior by setting the " "environment variable :envvar:`PYTHONHOME`, or insert additional directories " "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" "例えば、 Python 実行形式が :file:`/usr/local/bin/python` で見つかったとする" "と、ライブラリが :file:`/usr/local/lib/python{X.Y}` にあるものと仮定します。 " "(実際には、このパスは \"フォールバック (fallback)\" のライブラリ位置でもあ" -"り、 :file:`python` が :envvar:`PATH` 上に無い場合に使われます。) ユーザは :" -"envvar:`PYTHONHOME` を設定することでこの動作をオーバーライドしたり、 :envvar:" -"`PYTHONPATH` を設定して追加のディレクトリを標準モジュール検索パスの前に挿入し" -"たりできます。" +"り、 :file:`python` が :envvar:`PATH` 上に無い場合に使われます。) ユーザ" +"は :envvar:`PYTHONHOME` を設定することでこの動作をオーバーライドした" +"り、 :envvar:`PYTHONPATH` を設定して追加のディレクトリを標準モジュール検索パ" +"スの前に挿入したりできます。" #: ../../c-api/intro.rst:788 msgid "" -"The embedding application can steer the search by setting :c:member:" -"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " -"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " -"is still inserted in front of the standard path. An application that " -"requires total control has to provide its own implementation of :c:func:" -"`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" -"func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." +"The embedding application can steer the search by " +"setting :c:member:`PyConfig.program_name` *before* " +"calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` " +"still overrides this and :envvar:`PYTHONPATH` is still inserted in front of " +"the standard path. An application that requires total control has to " +"provide its own implementation " +"of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, " +"and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/" +"getpath.c`)." msgstr "" #: ../../c-api/intro.rst:799 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " -"application may want to start over (make another call to :c:func:" -"`Py_Initialize`) or the application is simply done with its use of Python " -"and wants to free memory allocated by Python. This can be accomplished by " -"calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` " -"returns true if Python is currently in the initialized state. More " -"information about these functions is given in a later chapter. Notice that :" -"c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python " -"interpreter, e.g. memory allocated by extension modules currently cannot be " -"released." +"application may want to start over (make another call " +"to :c:func:`Py_Initialize`) or the application is simply done with its use " +"of Python and wants to free memory allocated by Python. This can be " +"accomplished by calling :c:func:`Py_FinalizeEx`. The " +"function :c:func:`Py_IsInitialized` returns true if Python is currently in " +"the initialized state. More information about these functions is given in a " +"later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all " +"memory allocated by the Python interpreter, e.g. memory allocated by " +"extension modules currently cannot be released." msgstr "" "たまに、 Python を初期化前の状態にもどしたいことがあります。例えば、あるアプ" -"リケーションでは実行を最初からやりなおし (start over) させる (:c:func:" -"`Py_Initialize` をもう一度呼び出させる) ようにしたいかもしれません。あるい" -"は、アプリケーションが Python を一旦使い終えて、Python が確保したメモリを解放" -"させたいかもしれません。 :c:func:`Py_FinalizeEx` を使うとこうした処理を実現で" -"きます。また、関数 :c:func:`Py_IsInitialized` は、Python が現在初期化済みの" -"状態にある場合に真を返します。これらの関数についてのさらなる情報は、後の章で" -"説明します。 :c:func:`Py_FinalizeEx` がPythonインタプリタに確保された全てのメ" -"モリを *解放するわけではない* ことに注意してください。例えば、拡張モジュール" -"によって確保されたメモリは、現在のところ解放する事ができません。" +"リケーションでは実行を最初からやりなおし (start over) させる " +"(:c:func:`Py_Initialize` をもう一度呼び出させる) ようにしたいかもしれません。" +"あるいは、アプリケーションが Python を一旦使い終えて、Python が確保したメモリ" +"を解放させたいかもしれません。 :c:func:`Py_FinalizeEx` を使うとこうした処理を" +"実現できます。また、関数 :c:func:`Py_IsInitialized` は、Python が現在初期化" +"済みの状態にある場合に真を返します。これらの関数についてのさらなる情報は、後" +"の章で説明します。 :c:func:`Py_FinalizeEx` がPythonインタプリタに確保された全" +"てのメモリを *解放するわけではない* ことに注意してください。例えば、拡張モ" +"ジュールによって確保されたメモリは、現在のところ解放する事ができません。" #: ../../c-api/intro.rst:813 msgid "Debugging Builds" @@ -1227,11 +1444,11 @@ msgstr "" #: ../../c-api/intro.rst:819 msgid "" -"A full list of the various types of debugging builds is in the file :file:" -"`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " -"available that support tracing of reference counts, debugging the memory " -"allocator, or low-level profiling of the main interpreter loop. Only the " -"most frequently used builds will be described in the remainder of this " +"A full list of the various types of debugging builds is in the " +"file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. " +"Builds are available that support tracing of reference counts, debugging the " +"memory allocator, or low-level profiling of the main interpreter loop. Only " +"the most frequently used builds will be described in the remainder of this " "section." msgstr "" "Pythonデバッグ版ビルドの全ての種類のリストが、Pythonソース配布(source " @@ -1244,11 +1461,11 @@ msgstr "" msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:" -"`--with-pydebug` to the :file:`./configure` command. It is also implied by " -"the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:" -"macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is " -"disabled." +"build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by " +"adding :option:`--with-pydebug` to the :file:`./configure` command. It is " +"also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` " +"macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler " +"optimization is disabled." msgstr "" #: ../../c-api/intro.rst:835 @@ -1259,27 +1476,28 @@ msgstr "" #: ../../c-api/intro.rst:838 msgid "" -"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" -"`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " -"circular doubly linked list of active objects is maintained by adding two " -"extra fields to every :c:type:`PyObject`. Total allocations are tracked as " -"well. Upon exit, all existing references are printed. (In interactive mode " -"this happens after every statement run by the interpreter.)" -msgstr "" -":c:macro:`Py_TRACE_REFS` を宣言すると、参照トレースが有効になります (:option:" -"`configure --with-trace-refs オプション <--with-trace-refs>` を参照してくださ" -"い)。全ての :c:type:`PyObject` に二つのフィールドを追加することで、使用中のオ" -"ブジェクトの循環二重連結リストが管理されます。全ての割り当て(allocation)がト" -"レースされます。終了時に、全ての残っているオブジェクトが表示されます。 (イン" -"タラクティブモードでは、インタプリタによる文の実行のたびに表示されます。)" +"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see " +"the :option:`configure --with-trace-refs option <--with-trace-refs>`). When " +"defined, a circular doubly linked list of active objects is maintained by " +"adding two extra fields to every :c:type:`PyObject`. Total allocations are " +"tracked as well. Upon exit, all existing references are printed. (In " +"interactive mode this happens after every statement run by the interpreter.)" +msgstr "" +":c:macro:`Py_TRACE_REFS` を宣言すると、参照トレースが有効になります " +"(:option:`configure --with-trace-refs オプション <--with-trace-refs>` を参照" +"してください)。全ての :c:type:`PyObject` に二つのフィールドを追加することで、" +"使用中のオブジェクトの循環二重連結リストが管理されます。全ての割り当て" +"(allocation)がトレースされます。終了時に、全ての残っているオブジェクトが表示" +"されます。 (インタラクティブモードでは、インタプリタによる文の実行のたびに表" +"示されます。)" #: ../../c-api/intro.rst:845 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." msgstr "" -"より詳しい情報については、Pythonのソース配布(source distribution)の中の :" -"file:`Misc/SpecialBuilds.txt` を参照してください。" +"より詳しい情報については、Pythonのソース配布(source distribution)の中" +"の :file:`Misc/SpecialBuilds.txt` を参照してください。" #: ../../c-api/intro.rst:298 msgid "object" @@ -1289,33 +1507,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 +1537,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 +1554,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 +1607,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..97ba8e005 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,43 @@ 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." +"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 +74,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..d32f187a1 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 @@ -30,10 +30,10 @@ msgstr "イテレータオブジェクト (iterator object)" #: ../../c-api/iterator.rst:8 msgid "" "Python provides two general-purpose iterator objects. The first, a sequence " -"iterator, works with an arbitrary sequence supporting the :meth:`~object." -"__getitem__` method. The second works with a callable object and a sentinel " -"value, calling the callable for each item in the sequence, and ending the " -"iteration when the sentinel value is returned." +"iterator, works with an arbitrary sequence supporting " +"the :meth:`~object.__getitem__` method. The second works with a callable " +"object and a sentinel value, calling the callable for each item in the " +"sequence, and ending the iteration when the sentinel value is returned." msgstr "" "Python では二種類のイテレータオブジェクトを提供しています。一つ目はシーケンス" "イテレータで、 :meth:`~object.__getitem__` メソッドをサポートする任意のシーケ" @@ -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..03fd24f3d 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,16 +64,23 @@ 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:" -"`PySequence_SetItem` or expose the object to Python code before setting all " -"items to a real object with :c:func:`PyList_SetItem` or :c:func:" -"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is " -"fully initialized: :c:func:`PyList_SetItem()` and :c:func:" -"`PyList_SET_ITEM()`." +"``NULL``. Thus you cannot use abstract API functions such " +"as :c:func:`PySequence_SetItem` or expose the object to Python code before " +"setting all items to a real object with :c:func:`PyList_SetItem` " +"or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the " +"list is 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,22 +143,26 @@ 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>`." +"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 "" -"This macro \"steals\" a reference to *item*, and, unlike :c:func:" -"`PyList_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in *list* at position *i* will be leaked." +"This macro \"steals\" a reference to *item*, and, " +"unlike :c:func:`PyList_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in *list* at position *i* will be " +"leaked." msgstr "" -"このマクロは *item* への参照を \"盗み取り\" ます。また、 :c:func:" -"`PyList_SetItem` と違って、要素の置き換えが生じても置き換えられるオブジェクト" -"への参照を放棄 *しません* ; その結果、 *list* 中の位置 *i* で参照されていたオ" -"ブジェクトがメモリリークを引き起こします。" +"このマクロは *item* への参照を \"盗み取り\" ます。ま" +"た、 :c:func:`PyList_SetItem` と違って、要素の置き換えが生じても置き換えられ" +"るオブジェクトへの参照を放棄 *しません* ; その結果、 *list* 中の位置 *i* で参" +"照されていたオブジェクトがメモリリークを引き起こします。" #: ../../c-api/list.rst:114 msgid "" @@ -157,8 +171,8 @@ msgid "" "Analogous to ``list.insert(index, item)``." msgstr "" "要素 *item* をリスト *list* のインデックス *index* の前に挿入します。成功する" -"と ``0`` を返します。失敗すると ``-1`` を返し、例外をセットします。``list." -"insert(index, item)`` に類似した機能です。" +"と ``0`` を返します。失敗すると ``-1`` を返し、例外をセットします。" +"``list.insert(index, item)`` に類似した機能です。" #: ../../c-api/list.rst:121 msgid "" @@ -198,31 +212,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..9fa3b68d6 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 "" @@ -58,8 +58,8 @@ msgstr "" #: ../../c-api/long.rst:29 msgid "" -"Return true if its argument is a :c:type:`PyLongObject` or a subtype of :c:" -"type:`PyLongObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyLongObject` or a subtype " +"of :c:type:`PyLongObject`. This function always succeeds." msgstr "" "引数が :c:type:`PyLongObject` か :c:type:`PyLongObject` のサブタイプであると" "きに真を返します。この関数は常に成功します。" @@ -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." +"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,35 +167,48 @@ 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 "" "Create a Python integer from the pointer *p*. The pointer value can be " "retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -"ポインタ *p* から Python 整数値を生成します。ポインタの値は :c:func:" -"`PyLong_AsVoidPtr` を適用した結果から取得されます。" +"ポインタ *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,31 +216,45 @@ 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 "" -"Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" -"expr:`long`." +"Raise :exc:`OverflowError` if the value of *obj* is out of range for " +"a :c:expr:`long`." msgstr "" "もし *obj* の値が :c:expr:`long` の範囲外であれば、 :exc:`OverflowError` を送" "出します。" @@ -241,10 +271,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,74 +285,90 @@ 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`." +"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." +"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 "" -"Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" -"expr:`long long`." +"Raise :exc:`OverflowError` if the value of *obj* is out of range for " +"a :c:expr:`long long`." msgstr "" -"もし *obj* の値が :c:expr:`long long` の範囲外であれば、 :exc:" -"`OverflowError` を送出します。" +"もし *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." +"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 "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -"*pylong* を表す C の :c:type:`Py_ssize_t` を返します。 *pylong* は :c:type:" -"`PyLongObject` のインスタンスでなければなりません。" +"*pylong* を表す C の :c:type:`Py_ssize_t` を返します。 *pylong* " +"は :c:type:`PyLongObject` のインスタンスでなければなりません。" #: ../../c-api/long.rst:274 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"type:`Py_ssize_t`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:type:`Py_ssize_t`." msgstr "" -"もし *pylong* の値が :c:type:`Py_ssize_t` の範囲外であれば、 :exc:" -"`OverflowError` を送出します。" +"もし *pylong* の値が :c:type:`Py_ssize_t` の範囲外であれ" +"ば、 :exc:`OverflowError` を送出します。" #: ../../c-api/long.rst:286 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -"*pylong* を表す C の :c:expr:`unsigned long` を返します。 *pylong* は :c:" -"type:`PyLongObject` のインスタンスでなければなりません。" +"*pylong* を表す C の :c:expr:`unsigned long` を返します。 *pylong* " +"は :c:type:`PyLongObject` のインスタンスでなければなりません。" #: ../../c-api/long.rst:289 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"expr:`unsigned long`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:expr:`unsigned long`." msgstr "" -"もし *pylong* の値が :c:expr:`unsigned long` の範囲外であれば、 :exc:" -"`OverflowError` を送出します。" +"もし *pylong* の値が :c:expr:`unsigned long` の範囲外であれ" +"ば、 :exc:`OverflowError` を送出します。" #: ../../c-api/long.rst:292 msgid "" @@ -339,16 +383,16 @@ msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -"*pylong* を表す C の :c:type:`size_t` を返します。 *pylong* は :c:type:" -"`PyLongObject` のインスタンスでなければなりません。" +"*pylong* を表す C の :c:type:`size_t` を返します。 *pylong* " +"は :c:type:`PyLongObject` のインスタンスでなければなりません。" #: ../../c-api/long.rst:305 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"type:`size_t`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:type:`size_t`." msgstr "" -"もし *pylong* の値が :c:type:`size_t` の範囲外であれば、 :exc:" -"`OverflowError` を送出します。" +"もし *pylong* の値が :c:type:`size_t` の範囲外であれ" +"ば、 :exc:`OverflowError` を送出します。" #: ../../c-api/long.rst:308 msgid "" @@ -363,16 +407,16 @@ msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -"*pylong* を表す C の :c:expr:`unsigned long long` を返します。 *pylong* は :" -"c:type:`PyLongObject` のインスタンスでなければなりません。" +"*pylong* を表す C の :c:expr:`unsigned long long` を返します。 *pylong* " +"は :c:type:`PyLongObject` のインスタンスでなければなりません。" #: ../../c-api/long.rst:320 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" -"c:expr:`unsigned long long`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"an :c:expr:`unsigned long long`." msgstr "" -"もし *pylong* の値が :c:expr:`unsigned long long` の範囲外であれば、 :exc:" -"`OverflowError` を送出します。" +"もし *pylong* の値が :c:expr:`unsigned long long` の範囲外であれ" +"ば、 :exc:`OverflowError` を送出します。" #: ../../c-api/long.rst:323 msgid "" @@ -389,12 +433,16 @@ 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`." +"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 +460,16 @@ 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`." +"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,58 +487,60 @@ 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`." +"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 "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -"*pylong* を表す C の :c:expr:`double` を返します。 *pylong* は :c:type:" -"`PyLongObject` のインスタンスでなければなりません。" +"*pylong* を表す C の :c:expr:`double` を返します。 *pylong* " +"は :c:type:`PyLongObject` のインスタンスでなければなりません。" #: ../../c-api/long.rst:411 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"expr:`double`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:expr:`double`." msgstr "" -"もし *pylong* の値が :c:expr:`double` の範囲外であれば、 :exc:" -"`OverflowError` を送出します。" +"もし *pylong* の値が :c:expr:`double` の範囲外であれ" +"ば、 :exc:`OverflowError` を送出します。" #: ../../c-api/long.rst:414 msgid "" @@ -495,17 +549,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`." +"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 +567,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 +602,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 +633,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 +699,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 +752,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 +775,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 +793,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,243 +801,278 @@ 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 " "result in Python code executing and other threads being allowed to run, " "which could cause changes to other objects or values in use. When *flags* is " -"``-1``, this option is not set, and non-integer values will raise :exc:" -"`TypeError`." +"``-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`." +"“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." +"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." +"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``." +"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``." +"``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``." +"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 +1080,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`." +"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`." +"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 +1169,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 +1220,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..78b1da85a 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 @@ -29,13 +29,12 @@ msgstr "マップ型プロトコル (mapping protocol)" #: ../../c-api/mapping.rst:8 msgid "" -"See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and :c:func:" -"`PyObject_DelItem`." +"See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`." msgstr "" -":c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem`, :c:func:" -"`PyObject_DelItem` も参照してください。" +":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*`." +"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*`." +"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*`." +"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 "" @@ -126,25 +147,26 @@ msgstr "" #: ../../c-api/mapping.rst:105 msgid "" "Exceptions which occur when this calls :meth:`~object.__getitem__` method " -"are silently ignored. For proper error handling, use :c:func:" -"`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` or :c:func:" -"`PyObject_GetItem()` instead." +"are silently ignored. For proper error handling, " +"use :c:func:`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` " +"or :c:func:`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*`." +"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 "" "Exceptions that occur when this calls :meth:`~object.__getitem__` method or " "while creating the temporary :class:`str` object are silently ignored. For " -"proper error handling, use :c:func:`PyMapping_HasKeyStringWithError`, :c:" -"func:`PyMapping_GetOptionalItemString` or :c:func:`PyMapping_GetItemString` " -"instead." +"proper error handling, " +"use :c:func:`PyMapping_HasKeyStringWithError`, :c:func:`PyMapping_GetOptionalItemString` " +"or :c:func:`PyMapping_GetItemString` instead." msgstr "" #: ../../c-api/mapping.rst:129 diff --git a/c-api/marshal.po b/c-api/marshal.po index 04689e3b6..8b7c343e7 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." +"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 "" @@ -67,8 +69,8 @@ msgstr "" #: ../../c-api/marshal.rst:29 ../../c-api/marshal.rst:37 msgid "" -"This function can fail, in which case it sets the error indicator. Use :c:" -"func:`PyErr_Occurred` to check for that." +"This function can fail, in which case it sets the error indicator. " +"Use :c:func:`PyErr_Occurred` to check for that." msgstr "" "この関数は失敗することがあり、その場合はエラー指示子を設定します。それを確認" "するために :c:func:`PyErr_Occurred` を使います。" @@ -99,9 +101,9 @@ msgid "" "for reading. Only a 32-bit value can be read in using this function, " "regardless of the native size of :c:expr:`long`." msgstr "" -"読み出し用に開かれた :c:expr:`FILE*` 内のデータストリームから、 C の :c:expr:" -"`long` 型データを読み出して返します。この関数は、ネイティブの :c:expr:`long` " -"のサイズに関係なく、 32 ビットの値だけを読み出せます。" +"読み出し用に開かれた :c:expr:`FILE*` 内のデータストリームから、 C " +"の :c:expr:`long` 型データを読み出して返します。この関数は、ネイティブ" +"の :c:expr:`long` のサイズに関係なく、 32 ビットの値だけを読み出せます。" #: ../../c-api/marshal.rst:55 ../../c-api/marshal.rst:65 msgid "" @@ -116,9 +118,9 @@ msgid "" "for reading. Only a 16-bit value can be read in using this function, " "regardless of the native size of :c:expr:`short`." msgstr "" -"読み出し用に開かれた :c:expr:`FILE*` 内のデータストリームから、 C の :c:expr:" -"`short` 型データを読み出して返します。この関数は、ネイティブの :c:expr:" -"`short` のサイズに関係なく、 16 ビットの値だけを読み出せます。" +"読み出し用に開かれた :c:expr:`FILE*` 内のデータストリームから、 C " +"の :c:expr:`short` 型データを読み出して返します。この関数は、ネイティブ" +"の :c:expr:`short` のサイズに関係なく、 16 ビットの値だけを読み出せます。" #: ../../c-api/marshal.rst:71 msgid "" @@ -134,8 +136,9 @@ msgid "" "On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError` " "or :exc:`TypeError`) and returns ``NULL``." msgstr "" -"エラーの場合、適切な例外 (:exc:`EOFError`, :exc:`ValueError`, :exc:" -"`TypeError`) を設定し ``NULL`` を返します。" +"エラーの場合、適切な例外 " +"(:exc:`EOFError`, :exc:`ValueError`, :exc:`TypeError`) を設定し ``NULL`` を返" +"します。" #: ../../c-api/marshal.rst:80 msgid "" diff --git a/c-api/memory.po b/c-api/memory.po index 15dc441c0..c17fd11bf 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 @@ -92,25 +92,25 @@ msgstr "" #: ../../c-api/memory.rst:49 msgid "" "To avoid memory corruption, extension writers should never try to operate on " -"Python objects with the functions exported by the C library: :c:func:" -"`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`. This will " -"result in mixed calls between the C allocator and the Python memory manager " -"with fatal consequences, because they implement different algorithms and " -"operate on different heaps. However, one may safely allocate and release " -"memory blocks with the C library allocator for individual purposes, as shown " -"in the following example::" +"Python objects with the functions exported by the C " +"library: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " +"and :c:func:`free`. This will result in mixed calls between the C " +"allocator and the Python memory manager with fatal consequences, because " +"they implement different algorithms and operate on different heaps. " +"However, one may safely allocate and release memory blocks with the C " +"library allocator for individual purposes, as shown in the following " +"example::" msgstr "" "メモリ管理の崩壊を避けるため、拡張モジュールの作者は決して Python オブジェク" -"トを C ライブラリが公開している関数: :c:func:`malloc` 、 :c:func:" -"`calloc` 、 :c:func:`realloc` および :c:func:`free` で操作しようとしてはなり" -"ません。こうした関数を使うと、C のメモリ操作関数と Python メモリマネージャと" -"の間で関数呼び出しが交錯します。 C のメモリ操作関数とPython メモリマネージャ" -"は異なるアルゴリズムで実装されていて、異なるヒープを操作するため、呼び出しの" -"交錯は致命的な結果を招きます。とはいえ、個別の目的のためなら、 C ライブラリの" -"メモリ操作関数を使って安全にメモリを確保したり解放したりできます。例えば、以" -"下がそのような例です::" +"トを C ライブラリが公開している関" +"数: :c:func:`malloc` 、 :c:func:`calloc` 、 :c:func:`realloc` およ" +"び :c:func:`free` で操作しようとしてはなりません。こうした関数を使うと、C の" +"メモリ操作関数と Python メモリマネージャとの間で関数呼び出しが交錯します。 C " +"のメモリ操作関数とPython メモリマネージャは異なるアルゴリズムで実装されてい" +"て、異なるヒープを操作するため、呼び出しの交錯は致命的な結果を招きます。とは" +"いえ、個別の目的のためなら、 C ライブラリのメモリ操作関数を使って安全にメモリ" +"を確保したり解放したりできます。例えば、以下がそのような例です::" -#: ../../c-api/memory.rst:58 msgid "" "PyObject *res;\n" "char *buf = (char *) malloc(BUFSIZ); /* for I/O */\n" @@ -122,6 +122,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 +191,8 @@ msgstr "" "生成される時と、シャットダウン時に :ref:`pymalloc メモリアロケータ " "` の統計情報を表示できます。" -#: ../../c-api/memory.rst:96 msgid "Allocator Domains" -msgstr "" +msgstr "アロケータドメイン" #: ../../c-api/memory.rst:100 msgid "" @@ -199,11 +207,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 +217,81 @@ 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`." +"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 `." +"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 @@ -325,13 +353,13 @@ msgstr "" #: ../../c-api/memory.rst:184 msgid "" -"Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" -"func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:" -"`PyMem_RawCalloc`." +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` " +"or :c:func:`PyMem_RawCalloc`." msgstr "" -"*p* が ``NULL`` でない限り、*p* はそれより前の :c:func:`PyMem_RawMalloc`, :c:" -"func:`PyMem_RawRealloc`, :c:func:`PyMem_RawCalloc` の呼び出しにより返されなけ" -"ればなりません。" +"*p* が ``NULL`` でない限り、*p* はそれより前" +"の :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc`, :c:func:`PyMem_RawCalloc` " +"の呼び出しにより返されなければなりません。" #: ../../c-api/memory.rst:188 msgid "" @@ -344,14 +372,14 @@ msgstr "" #: ../../c-api/memory.rst:194 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " -"previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:" -"func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has been " -"called before, undefined behavior occurs." +"previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` " +"or :c:func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has " +"been called before, undefined behavior occurs." msgstr "" -"*p* が指すメモリブロックを解放します。 *p* は以前呼び出した :c:func:" -"`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc`, :c:func:`PyMem_RawCalloc` の" -"返した値でなければなりません。それ以外の場合や ``PyMem_RawFree(p)`` を呼び出" -"した後だった場合、未定義の動作になります。" +"*p* が指すメモリブロックを解放します。 *p* は以前呼び出し" +"た :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc`, :c:func:`PyMem_RawCalloc` " +"の返した値でなければなりません。それ以外の場合や ``PyMem_RawFree(p)`` を呼び" +"出した後だった場合、未定義の動作になります。" #: ../../c-api/memory.rst:199 ../../c-api/memory.rst:268 #: ../../c-api/memory.rst:377 @@ -374,14 +402,15 @@ msgstr "" #: ../../c-api/memory.rst:211 msgid "" -"The :ref:`default memory allocator ` uses the :" -"ref:`pymalloc memory allocator `." +"The :ref:`default memory allocator ` uses " +"the :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 "" @@ -421,12 +450,12 @@ msgstr "" #: ../../c-api/memory.rst:254 msgid "" -"Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" -"func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "" -"*p* が ``NULL`` でない限り、*p* はそれより前の :c:func:`PyMem_Malloc`, :c:" -"func:`PyMem_Realloc` または :c:func:`PyMem_Calloc` の呼び出しにより返されなけ" -"ればなりません。" +"*p* が ``NULL`` でない限り、*p* はそれより前" +"の :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` また" +"は :c:func:`PyMem_Calloc` の呼び出しにより返されなければなりません。" #: ../../c-api/memory.rst:257 msgid "" @@ -439,14 +468,14 @@ msgstr "" #: ../../c-api/memory.rst:263 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " -"previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:" -"`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been called before, " -"undefined behavior occurs." +"previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` " +"or :c:func:`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been " +"called before, undefined behavior occurs." msgstr "" -"*p* が指すメモリブロックを解放します。 *p* は以前呼び出した :c:func:" -"`PyMem_Malloc`、 :c:func:`PyMem_Realloc`、または :c:func:`PyMem_Calloc` の返" -"した値でなければなりません。それ以外の場合や ``PyMem_Free(p)`` を呼び出した後" -"だった場合、未定義の動作になります。" +"*p* が指すメモリブロックを解放します。 *p* は以前呼び出し" +"た :c:func:`PyMem_Malloc`、 :c:func:`PyMem_Realloc`、また" +"は :c:func:`PyMem_Calloc` の返した値でなければなりません。それ以外の場合や " +"``PyMem_Free(p)`` を呼び出した後だった場合、未定義の動作になります。" #: ../../c-api/memory.rst:270 msgid "" @@ -456,20 +485,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,18 +558,20 @@ 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 "" -"The :ref:`default object allocator ` uses the :" -"ref:`pymalloc memory allocator `." +"The :ref:`default object allocator ` uses " +"the :ref:`pymalloc memory allocator `." msgstr "" #: ../../c-api/memory.rst:336 @@ -568,13 +605,13 @@ msgstr "" #: ../../c-api/memory.rst:363 msgid "" -"Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" -"func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:" -"`PyObject_Calloc`." +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` " +"or :c:func:`PyObject_Calloc`." msgstr "" -"*p* が ``NULL`` でない限り、*p* はそれより前の :c:func:`PyObject_Malloc`, :c:" -"func:`PyObject_Realloc` または :c:func:`PyObject_Calloc` の呼び出しにより返さ" -"れなければなりません。" +"*p* が ``NULL`` でない限り、*p* はそれより前" +"の :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` また" +"は :c:func:`PyObject_Calloc` の呼び出しにより返されなければなりません。" #: ../../c-api/memory.rst:366 msgid "" @@ -587,32 +624,36 @@ msgstr "" #: ../../c-api/memory.rst:372 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " -"previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:" -"func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has been " -"called before, undefined behavior occurs." +"previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` " +"or :c:func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has " +"been called before, undefined behavior occurs." msgstr "" -"*p* が指すメモリブロックを解放します。 *p* は以前呼び出した :c:func:" -"`PyObject_Malloc`、 :c:func:`PyObject_Realloc`、または :c:func:" -"`PyObject_Calloc` の返した値でなければなりません。それ以外の場合や " -"``PyObject_Free(p)`` を呼び出した後だった場合、未定義の動作になります。" +"*p* が指すメモリブロックを解放します。 *p* は以前呼び出し" +"た :c:func:`PyObject_Malloc`、 :c:func:`PyObject_Realloc`、また" +"は :c:func:`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." +"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." +"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 +667,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 +757,20 @@ 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`." +"``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 +778,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 +848,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." +"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 +916,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`." +"allocator may be called in different interpreters that do not share " +"a :term:`GIL`." msgstr "" +"ほかのドメインでも、:term:`GIL` を共有しない異なるインタープリタから呼び出さ" +"れる場合があるため、アロケータはスレッドセーフでなければなりません。" #: ../../c-api/memory.rst:511 msgid "" @@ -897,73 +939,85 @@ msgid "" "the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " "debug hooks on top on the new allocator." msgstr "" -"新しいアロケータがフックでない (1つ前のアロケータを呼び出さない) 場合、 :c:" -"func:`PyMem_SetupDebugHooks` 関数を呼び出して、新しいアロケータの上にデバッグ" -"フックを再度設置しなければなりません。" +"新しいアロケータがフックでない (1つ前のアロケータを呼び出さない) 場" +"合、 :c: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 " -"restrictions over the installed allocator other than the ones imposed by the " -"domain (for instance, the Raw Domain allows the allocator to be called " -"without an :term:`attached thread state`). See :ref:`the section on " -"allocator domains ` for more information." +"It can be called after :c:func:`Py_PreInitialize` and " +"before :c:func:`Py_InitializeFromConfig` to install a custom memory " +"allocator. There are no restrictions over the installed allocator other than " +"the ones imposed by the domain (for instance, the Raw Domain allows the " +"allocator to be called 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**." +"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 " +"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 +1026,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 +1089,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 +1136,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 +1173,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,24 +1191,42 @@ 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:" -"`tracemalloc` to get the traceback where a memory block was allocated. The " -"debug hooks now also check if there is an :term:`attached thread state` when " -"functions of :c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` " -"domains are called." +"compiled in release mode. On error, the debug hooks now " +"use :mod:`tracemalloc` to get the traceback where a memory block was " +"allocated. The debug hooks now also check if there is an :term:`attached " +"thread state` when 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" @@ -1138,39 +1237,41 @@ msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " "\"arenas\" with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB " -"on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` and :c:func:" -"`PyMem_RawRealloc` for allocations larger than 512 bytes." +"on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` " +"and :c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" #: ../../c-api/memory.rst:661 msgid "" "*pymalloc* is the :ref:`default allocator ` of " -"the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:" -"`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." +"the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) " +"and :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" #: ../../c-api/memory.rst:665 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``)." +"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 +1292,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 +1307,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 +1322,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 +1362,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 +1373,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 +1398,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 +1435,16 @@ 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`." +"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 +1454,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..e675d3ad3 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 "" @@ -101,33 +100,34 @@ msgid "" "allowed to create subclasses of :class:`memoryview`. This function always " "succeeds." msgstr "" -"*obj* が memoryview オブジェクトの場合に真を返します。現在のところ、 :class:" -"`memoryview` のサブクラスの作成は許可されていません。この関数は常に成功しま" -"す。" +"*obj* が memoryview オブジェクトの場合に真を返します。現在のとこ" +"ろ、 :class:`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." +"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..d5d703552 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 "" @@ -44,9 +46,9 @@ msgstr "" #: ../../c-api/method.rst:23 msgid "" -"Return true if *o* is an instance method object (has type :c:data:" -"`PyInstanceMethod_Type`). The parameter must not be ``NULL``. This function " -"always succeeds." +"Return true if *o* is an instance method object (has " +"type :c:data:`PyInstanceMethod_Type`). The parameter must not be ``NULL``. " +"This function always succeeds." msgstr "" "*o* がインスタンスメソッドオブジェクト (:c:data:`PyInstanceMethod_Type` 型で" "ある) 場合に真を返します。パラメータは ``NULL`` にできません。この関数は常に" @@ -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..30ed5ef22 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 @@ -35,8 +35,8 @@ msgid "" "This is exposed to Python programs as ``types.ModuleType``." msgstr "" "この :c:type:`PyTypeObject` のインスタンスは Python のモジュールオブジェクト" -"型を表現します。このオブジェクトは、Python プログラムには ``types." -"ModuleType`` として公開されています。" +"型を表現します。このオブジェクトは、Python プログラムには " +"``types.ModuleType`` として公開されています。" #: ../../c-api/module.rst:21 msgid "" @@ -48,31 +48,36 @@ msgstr "" #: ../../c-api/module.rst:27 msgid "" -"Return true if *p* is a module object, but not a subtype of :c:data:" -"`PyModule_Type`. This function always succeeds." +"Return true if *p* is a module object, but not a subtype " +"of :c:data:`PyModule_Type`. This function always succeeds." 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." -"__package__` and :attr:`~module.__loader__` attributes are filled in (all " -"but :attr:`!__name__` are set to ``None``). The caller is responsible for " -"setting a :attr:`~module.__file__` attribute." -msgstr "" +"module's :attr:`!" +"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes are filled in (all 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 "" @@ -98,18 +103,20 @@ msgstr "" #: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " -"functions rather than directly manipulate a module's :attr:`~object." -"__dict__`." +"functions rather than directly manipulate a " +"module's :attr:`~object.__dict__`." 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 "" @@ -122,12 +129,12 @@ msgstr "" #: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " -"memory allocated at module creation time, or ``NULL``. See :c:member:" -"`PyModuleDef.m_size`." +"memory allocated at module creation time, or ``NULL``. " +"See :c:member:`PyModuleDef.m_size`." msgstr "" "モジュールの \"state\"(モジュールを生成したタイミングで確保されるメモリブロッ" -"クへのポインター) か、なければ ``NULL`` を返します。 :c:member:`PyModuleDef." -"m_size` を参照してください。" +"クへのポインター) か、なければ ``NULL`` を返しま" +"す。 :c:member:`PyModuleDef.m_size` を参照してください。" #: ../../c-api/module.rst:102 msgid "" @@ -138,13 +145,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." +"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 "" @@ -159,9 +170,9 @@ msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -":c:func:`PyModule_GetFilename` はエンコードできないファイル名に対しては :exc:" -"`UnicodeEncodeError` を送出します。これの代わりに :c:func:" -"`PyModule_GetFilenameObject` を使用してください。" +":c:func:`PyModule_GetFilename` はエンコードできないファイル名に対して" +"は :exc:`UnicodeEncodeError` を送出します。これの代わり" +"に :c:func:`PyModule_GetFilenameObject` を使用してください。" #: ../../c-api/module.rst:133 msgid "Initializing C modules" @@ -175,17 +186,18 @@ msgid "" "See :ref:`building` or :ref:`extending-with-embedding` for details." msgstr "" "通常、モジュールオブジェクトは拡張モジュール (初期化関数をエクスポートしてい" -"る共有ライブラリ) または組み込まれたモジュール (:c:func:" -"`PyImport_AppendInittab` を使って初期化関数が追加されているモジュール) から作" -"られます。\n" +"る共有ライブラリ) または組み込まれたモジュール " +"(:c:func:`PyImport_AppendInittab` を使って初期化関数が追加されているモジュー" +"ル) から作られます。\n" "詳細については :ref:`building` または :ref:`extending-with-embedding` を見て" "ください。" #: ../../c-api/module.rst:140 msgid "" -"The initialization function can either pass a module definition instance to :" -"c:func:`PyModule_Create`, and return the resulting module object, or request " -"\"multi-phase initialization\" by returning the definition struct itself." +"The initialization function can either pass a module definition instance " +"to :c:func:`PyModule_Create`, and return the resulting module object, or " +"request \"multi-phase initialization\" by returning the definition struct " +"itself." msgstr "" "初期化関数は、モジュール定義のインスタンスを :c:func:`PyModule_Create` に渡し" "て出来上がったモジュールオブジェクトを返してもよいですし、もしくは定義構造体" @@ -213,8 +225,8 @@ msgstr "新しいモジュールの名前。" #: ../../c-api/module.rst:160 msgid "" -"Docstring for the module; usually a docstring variable created with :c:macro:" -"`PyDoc_STRVAR` is used." +"Docstring for the module; usually a docstring variable created " +"with :c:macro:`PyDoc_STRVAR` is used." msgstr "" "モジュールの docstring。たいてい docstring は :c:macro:`PyDoc_STRVAR` を利用" "して生成されます。" @@ -225,16 +237,16 @@ msgid "" "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -"モジュールの状態は、静的なグローバルな領域ではなく :c:func:" -"`PyModule_GetState` で取得できるモジュールごとのメモリ領域に保持されているこ" -"とがあります。\n" +"モジュールの状態は、静的なグローバルな領域ではな" +"く :c:func:`PyModule_GetState` で取得できるモジュールごとのメモリ領域に保持さ" +"れていることがあります。\n" "これによってモジュールは複数のサブ・インタプリターで安全に使えます。" #: ../../c-api/module.rst:169 msgid "" "This memory area is allocated based on *m_size* on module creation, and " -"freed when the module object is deallocated, after the :c:member:" -"`~PyModuleDef.m_free` function has been called, if present." +"freed when the module object is deallocated, after " +"the :c:member:`~PyModuleDef.m_free` function has been called, if present." msgstr "" "このメモリ領域は *m_size* に基づいてモジュール作成時に確保され、モジュールオ" "ブジェクトが破棄されるときに、 :c:member:`~PyModuleDef.m_free` 関数があればそ" @@ -265,8 +277,9 @@ msgstr "詳細は :PEP:`3121` を参照。" #: ../../c-api/module.rst:185 msgid "" -"A pointer to a table of module-level functions, described by :c:type:" -"`PyMethodDef` values. Can be ``NULL`` if no functions are present." +"A pointer to a table of module-level functions, described " +"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " +"present." msgstr "" ":c:type:`PyMethodDef` で定義される、モジュールレベル関数のテーブルへのポイン" "ター。関数が存在しない場合は ``NULL`` を設定することが可能。" @@ -304,8 +317,8 @@ msgid "" "allocated yet. This is the case immediately after the module is created and " "before the module is executed (:c:data:`Py_mod_exec` function). More " "precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " -"greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"greater than 0 and the module state (as returned " +"by :c:func:`PyModule_GetState`) is ``NULL``." msgstr "" #: ../../c-api/module.rst:213 ../../c-api/module.rst:234 @@ -356,8 +369,8 @@ msgstr "" #: ../../c-api/module.rst:261 msgid "" "Create a new module object, given the definition in *def*. This behaves " -"like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" -"`PYTHON_API_VERSION`." +"like :c:func:`PyModule_Create2` with *module_api_version* set " +"to :c:macro:`PYTHON_API_VERSION`." msgstr "" #: ../../c-api/module.rst:268 @@ -382,12 +395,12 @@ msgstr "" #: ../../c-api/module.rst:279 msgid "" "Before it is returned from in the initialization function, the resulting " -"module object is typically populated using functions like :c:func:" -"`PyModule_AddObjectRef`." +"module object is typically populated using functions " +"like :c:func:`PyModule_AddObjectRef`." msgstr "" -"モジュールオブジェクトが初期化関数から返される前に、たいていは :c:func:" -"`PyModule_AddObjectRef` などの関数を使ってモジュールオブジェクトにメンバを所" -"属させます。" +"モジュールオブジェクトが初期化関数から返される前に、たいてい" +"は :c:func:`PyModule_AddObjectRef` などの関数を使ってモジュールオブジェクトに" +"メンバを所属させます。" #: ../../c-api/module.rst:285 msgid "Multi-phase initialization" @@ -411,9 +424,10 @@ msgid "" "normal garbage collection -- as with Python modules. By default, multiple " "modules created from the same definition should be independent: changes to " "one should not affect the others. This means that all state should be " -"specific to the module object (using e.g. using :c:func:" -"`PyModule_GetState`), or its contents (such as the module's :attr:`~object." -"__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." +"specific to the module object (using e.g. " +"using :c:func:`PyModule_GetState`), or its contents (such as the " +"module's :attr:`~object.__dict__` or individual classes created " +"with :c:func:`PyType_FromSpec`)." msgstr "" #: ../../c-api/module.rst:304 @@ -430,12 +444,13 @@ msgstr "" #: ../../c-api/module.rst:308 msgid "" "To request multi-phase initialization, the initialization function " -"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" -"c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` " -"instance must be initialized with the following function:" +"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-" +"empty :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized with the following function:" msgstr "" -"多段階初期化を要求するために、初期化関数 (PyInit_modulename) は空でない :c:" -"member:`~PyModuleDef.m_slots` を持つ :c:type:`PyModuleDef` を返します。\n" +"多段階初期化を要求するために、初期化関数 (PyInit_modulename) は空でな" +"い :c:member:`~PyModuleDef.m_slots` を持つ :c:type:`PyModuleDef` を返しま" +"す。\n" "これを返す前に、 ``PyModuleDef`` インスタンスは次の関数で初期化されなくてはい" "けません:" @@ -497,15 +512,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 "" @@ -523,20 +537,21 @@ msgid "" "to their place in the module hierarchy and be imported under different names " "through symlinks, all while sharing a single module definition." msgstr "" -"``Py_mod_create`` が設定されていない場合は、インポート機構は :c:func:" -"`PyModule_New` を使って通常のモジュールオブジェクトを生成します。\n" +"``Py_mod_create`` が設定されていない場合は、インポート機構" +"は :c:func:`PyModule_New` を使って通常のモジュールオブジェクトを生成しま" +"す。\n" "モジュールの名前は定義ではなく *spec* から取得され、これによって拡張モジュー" "ルが動的にモジュール階層における位置を調整できたり、シンボリックリンクを通し" "て同一のモジュール定義を共有しつつ別の名前でインポートできたりします。" #: ../../c-api/module.rst:368 msgid "" -"There is no requirement for the returned object to be an instance of :c:type:" -"`PyModule_Type`. Any type can be used, as long as it supports setting and " -"getting import-related attributes. However, only ``PyModule_Type`` instances " -"may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, " -"``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than " -"``Py_mod_create``." +"There is no requirement for the returned object to be an instance " +"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " +"setting and getting import-related attributes. However, only " +"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" +"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " +"slots other than ``Py_mod_create``." msgstr "" "返されるオブジェクトが :c:type:`PyModule_Type` のインスタンスである必要はあり" "ません。\n" @@ -570,27 +585,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 +616,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 +791,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 +831,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,15 +848,20 @@ 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*. " -"For names that aren't known at compile time, prefer calling :c:func:" -"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " -"details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." -msgstr "" +"For names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more 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 +871,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 +886,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." +"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 +921,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." +"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." +"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 "" @@ -971,8 +1054,8 @@ msgstr "" #: ../../c-api/module.rst:699 msgid "" "Attaches the module object passed to the function to the interpreter state. " -"This allows the module object to be accessible via :c:func:" -"`PyState_FindModule`." +"This allows the module object to be accessible " +"via :c:func:`PyState_FindModule`." msgstr "" "関数に渡されたモジュールオブジェクトを、インタプリタの state に連結します。こ" "の関数を使うことで :c:func:`PyState_FindModule` からモジュールオブジェクトに" @@ -993,19 +1076,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 +1117,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..aff3d734b 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 @@ -36,8 +36,8 @@ msgid "" msgstr "" "``None`` に対する :c:type:`PyTypeObject` は、 Python/C API では直接公開されて" "いないので注意してください。 ``None`` は単量子 (singleton) なので、オブジェク" -"トの同一性テスト (C では ``==``) を使うだけで十分だからです。同じ理由から、 :" -"c:func:`!PyNone_Check` 関数はありません。" +"トの同一性テスト (C では ``==``) を使うだけで十分だからです。同じ理由か" +"ら、 :c:func:`!PyNone_Check` 関数はありません。" #: ../../c-api/none.rst:18 msgid "" @@ -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..019445940 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 "" @@ -178,9 +185,9 @@ msgid "" "Returns the \"bitwise exclusive or\" of *o1* by *o2* on success, or ``NULL`` " "on failure. This is the equivalent of the Python expression ``o1 ^ o2``." msgstr "" -"成功すると *o1* と *o2* の \"ビット単位排他的論理和 (bitwise exclusive " -"or)\" を返し、失敗すると ``NULL`` を返します。Python の式 ``o1 ^ o2`` と同じ" -"です。" +"成功すると *o1* と *o2* の \"ビット単位排他的論理和 (bitwise exclusive or)" +"\" を返し、失敗すると ``NULL`` を返します。Python の式 ``o1 ^ o2`` と同じで" +"す。" #: ../../c-api/number.rst:135 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 "" @@ -314,9 +327,9 @@ msgid "" "on failure. The operation is done *in-place* when *o1* supports it. This " "is the equivalent of the Python statement ``o1 ^= o2``." msgstr "" -"成功すると *o1* と *o2* の \"ビット単位排他的論理和 (bitwise exclusive " -"or)\" を返し、失敗すると ``NULL`` を返します。*o1* が *in-place* 演算をサポー" -"トする場合、in-place 演算を行います。Python の文 ``o1 ^= o2`` と同じです。" +"成功すると *o1* と *o2* の \"ビット単位排他的論理和 (bitwise exclusive or)" +"\" を返し、失敗すると ``NULL`` を返します。*o1* が *in-place* 演算をサポート" +"する場合、in-place 演算を行います。Python の文 ``o1 ^= o2`` と同じです。" #: ../../c-api/number.rst:234 msgid "" @@ -346,8 +359,8 @@ msgstr "" #: ../../c-api/number.rst:257 msgid "" -"Returns the *o* converted to a Python int on success or ``NULL`` with a :exc:" -"`TypeError` exception raised on failure." +"Returns the *o* converted to a Python int on success or ``NULL`` with " +"a :exc:`TypeError` exception raised on failure." msgstr "" "*o* をPythonのint型に変換し、成功したらその値を返します。失敗したら ``NULL`` " "が返され、 :exc:`TypeError` 例外が送出されます。" @@ -365,14 +378,14 @@ msgid "" "Returns the integer *n* converted to base *base* as a string. The *base* " "argument must be one of 2, 8, 10, or 16. For base 2, 8, or 16, the returned " "string is prefixed with a base marker of ``'0b'``, ``'0o'``, or ``'0x'``, " -"respectively. If *n* is not a Python int, it is converted with :c:func:" -"`PyNumber_Index` first." +"respectively. If *n* is not a Python int, it is converted " +"with :c:func:`PyNumber_Index` first." msgstr "" "*base* 進数に変換された整数 *n* を文字列として返します。 *base* 引数は2, 8, " "10または16のいずれかでなければなりません。 基数2、8、16について、返される文" "字列の先頭には基数マーカー ``'0b'`` 、 ``'0o'`` または ``'0x'`` が、それぞれ" -"付与されます。 もし *n* が Python のint型でなければ、まず :c:func:" -"`PyNumber_Index` で変換されます。" +"付与されます。 もし *n* が Python のint型でなければ、ま" +"ず :c:func:`PyNumber_Index` で変換されます。" #: ../../c-api/number.rst:276 msgid "" @@ -385,18 +398,18 @@ msgstr "" #: ../../c-api/number.rst:279 msgid "" -"If *o* can be converted to a Python int but the attempt to convert to a :c:" -"type:`Py_ssize_t` value would raise an :exc:`OverflowError`, then the *exc* " -"argument is the type of exception that will be raised (usually :exc:" -"`IndexError` or :exc:`OverflowError`). If *exc* is ``NULL``, then the " -"exception is cleared and the value is clipped to ``PY_SSIZE_T_MIN`` for a " -"negative integer or ``PY_SSIZE_T_MAX`` for a positive integer." -msgstr "" -"もし *o* がPythonのintに変換できたのに、:c:type:`Py_ssize_t` への変換が :exc:" -"`OverflowError` になる場合は、 *exc* 引数で渡された型 (普通は :exc:" -"`IndexError` か :exc:`OverflowError`) の例外を送出します。もし、 *exc* が " -"``NULL`` なら、例外はクリアされて、値が負の場合は ``PY_SSIZE_T_MIN`` へ、正の" -"場合は ``PY_SSIZE_T_MAX`` へと制限されます。" +"If *o* can be converted to a Python int but the attempt to convert to " +"a :c:type:`Py_ssize_t` value would raise an :exc:`OverflowError`, then the " +"*exc* argument is the type of exception that will be raised " +"(usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is ``NULL``, " +"then the exception is cleared and the value is clipped to ``PY_SSIZE_T_MIN`` " +"for a negative integer or ``PY_SSIZE_T_MAX`` for a positive integer." +msgstr "" +"もし *o* がPythonのintに変換できたのに、:c:type:`Py_ssize_t` への変換" +"が :exc:`OverflowError` になる場合は、 *exc* 引数で渡された型 (普通" +"は :exc:`IndexError` か :exc:`OverflowError`) の例外を送出します。もし、 " +"*exc* が ``NULL`` なら、例外はクリアされて、値が負の場合は " +"``PY_SSIZE_T_MIN`` へ、正の場合は ``PY_SSIZE_T_MAX`` へと制限されます。" #: ../../c-api/number.rst:289 msgid "" diff --git a/c-api/objbuffer.po b/c-api/objbuffer.po index fd539e63f..baf5f2a50 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 @@ -46,22 +46,24 @@ msgstr "" #: ../../c-api/objbuffer.rst:15 msgid "" "Therefore, it is recommended that you call :c:func:`PyObject_GetBuffer` (or " -"the ``y*`` or ``w*`` :ref:`format codes ` with the :c:func:" -"`PyArg_ParseTuple` family of functions) to get a buffer view over an object, " -"and :c:func:`PyBuffer_Release` when the buffer view can be released." +"the ``y*`` or ``w*`` :ref:`format codes ` with " +"the :c:func:`PyArg_ParseTuple` family of functions) to get a buffer view " +"over an object, and :c:func:`PyBuffer_Release` when the buffer view can be " +"released." msgstr "" -"従って、あるオブジェクトのバッファビューを取得するために、 :c:func:" -"`PyObject_GetBuffer` (もしくは ``y*`` および ``w*`` :ref:`フォーマットコー" -"ド ` で :c:func:`PyArg_ParseTuple` やその仲間) を呼び出し、バッ" -"ファビューを解放するときには :c:func:`PyBuffer_Release` を呼び出します。" +"従って、あるオブジェクトのバッファビューを取得するため" +"に、 :c:func:`PyObject_GetBuffer` (もしくは ``y*`` および ``w*`` :ref:`" +"フォーマットコード ` で :c:func:`PyArg_ParseTuple` やその仲間) " +"を呼び出し、バッファビューを解放するときには :c:func:`PyBuffer_Release` を呼" +"び出します。" #: ../../c-api/objbuffer.rst:23 msgid "" "Returns a pointer to a read-only memory location usable as character-based " "input. The *obj* argument must support the single-segment character buffer " "interface. On success, returns ``0``, sets *buffer* to the memory location " -"and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:" -"`TypeError` on error." +"and *buffer_len* to the buffer length. Returns ``-1`` and sets " +"a :exc:`TypeError` on error." msgstr "" "文字ベースの入力として使える読み出し専用メモリ上の位置へのポインタを返しま" "す。 *obj* 引数は単一セグメントからなる文字バッファインターフェースをサポート" @@ -74,8 +76,8 @@ msgid "" "Returns a pointer to a read-only memory location containing arbitrary data. " "The *obj* argument must support the single-segment readable buffer " "interface. On success, returns ``0``, sets *buffer* to the memory location " -"and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:" -"`TypeError` on error." +"and *buffer_len* to the buffer length. Returns ``-1`` and sets " +"a :exc:`TypeError` on error." msgstr "" "任意のデータを収めた読み出し専用のメモリ上の位置へのポインタを返します。 " "*obj* 引数は単一セグメントからなる読み出し可能バッファインターフェースをサ" diff --git a/c-api/object.po b/c-api/object.po index 81747047f..ee336bbcc 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." +"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,70 +149,90 @@ 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)." +"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 "" -"Flag to be used with multiple functions that print the object (like :c:func:" -"`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " -"function would use the :func:`str` of the object instead of the :func:`repr`." +"Flag to be used with multiple functions that print the object " +"(like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, " +"these 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 :" -"func:`sys.unraisablehook`. For proper error handling, use :c:func:" -"`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" -"`PyObject_GetAttr` instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods aren't propagated, but instead " +"given to :func:`sys.unraisablehook`. For proper error handling, " +"use :c:func:`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*`." +"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 "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods or while creating the temporary :class:" -"`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods or while creating the " +"temporary :class:`str` object are silently ignored. For proper error " +"handling, " +"use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " "or :c:func:`PyObject_GetAttrString` instead." msgstr "" @@ -238,62 +246,76 @@ 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." +"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*`." +"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." +"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." +"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 " -"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " -"silenced. If an error other than :exc:`AttributeError` is raised, return " -"``-1`` and set *\\*result* to ``NULL``." +"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 ``0`` and set *\\*result* to ``NULL``; " +"the :exc:`AttributeError` is 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 "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " -"of classes in the object's MRO as well as an attribute in the object's :attr:" -"`~object.__dict__` (if present). As outlined in :ref:`descriptors`, data " -"descriptors take preference over instance attributes, while non-data " -"descriptors don't. Otherwise, an :exc:`AttributeError` is raised." +"of classes in the object's MRO as well as an attribute in the " +"object's :attr:`~object.__dict__` (if present). As outlined " +"in :ref:`descriptors`, data descriptors take preference over instance " +"attributes, while non-data descriptors don't. Otherwise, " +"an :exc:`AttributeError` is raised." msgstr "" "型オブジェクトの ``tp_getattro`` スロットに置かれる、属性を取得する総称的な関" -"数です。この関数は、 (もし存在すれば) オブジェクトの属性 :attr:`~object." -"__dict__` に加え、オブジェクトの MRO にあるクラスの辞書にあるデスクリプタを探" -"します。 :ref:`descriptors` で概要が述べられている通り、データのデスクリプタ" -"はインスタンスの属性より優先され、非データデスクリプタは後回しにされます。見" -"付からなかった場合は :exc:`AttributeError` を送出します。" +"数です。この関数は、 (もし存在すれば) オブジェクトの属" +"性 :attr:`~object.__dict__` に加え、オブジェクトの MRO にあるクラスの辞書にあ" +"るデスクリプタを探します。 :ref:`descriptors` で概要が述べられている通り、" +"データのデスクリプタはインスタンスの属性より優先され、非データデスクリプタは" +"後回しにされます。見付からなかった場合は :exc:`AttributeError` を送出します。" #: ../../c-api/object.rst:191 msgid "" @@ -311,34 +333,41 @@ msgid "" "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -"*v* が ``NULL`` のとき、アトリビュートは削除されます。この動作は :c:func:" -"`PyObject_DelAttr` のため、非推奨となっていますが、削除される予定はありませ" -"ん。" +"*v* が ``NULL`` のとき、アトリビュートは削除されます。この動作" +"は :c:func:`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*`." +"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 "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -"*v* が ``NULL`` の場合は属性が削除されますが、この機能は非推奨であり :c:func:" -"`PyObject_DelAttrString` を使うのが望ましいです。" +"*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*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." -msgstr "" +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For 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 "" @@ -351,8 +380,8 @@ msgid "" "returned, otherwise an :exc:`AttributeError` is raised and ``-1`` is " "returned." msgstr "" -"属性の設定と削除を行う汎用的な関数で、型オブジェクトの :c:member:" -"`~PyTypeObject.tp_setattro` スロットに置かれます。\n" +"属性の設定と削除を行う汎用的な関数で、型オブジェクト" +"の :c:member:`~PyTypeObject.tp_setattro` スロットに置かれます。\n" "オブジェクトの MRO にあるクラスの辞書からデータディスクリプタを探し、見付かっ" "た場合はインスタンスの辞書にある属性の設定や削除よりも優先されます。\n" "そうでない場合は、(もし存在すれば) オブジェクトの :attr:`~object.__dict__` に" @@ -368,22 +397,29 @@ 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*`." +"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*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object for lookup." -msgstr "" +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` " +"directly. For 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 +429,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 +436,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,55 +454,72 @@ 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`, :" -"c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to " -"``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the " -"equivalent of the Python expression ``o1 op o2``, where ``op`` is the " -"operator corresponding to *opid*. Returns the value of the comparison on " -"success, or ``NULL`` on failure." -msgstr "" +"which must be one " +"of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, " +"or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, " +"or ``>=`` respectively. This is the equivalent of the Python expression ``o1 " +"op o2``, where ``op`` is the 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 "" @@ -486,10 +543,10 @@ msgstr "" #: ../../c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " -"but escape the non-ASCII characters in the string returned by :c:func:" -"`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This generates a " -"string similar to that returned by :c:func:`PyObject_Repr` in Python 2. " -"Called by the :func:`ascii` built-in function." +"but escape the non-ASCII characters in the string returned " +"by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This " +"generates a string similar to that returned by :c:func:`PyObject_Repr` in " +"Python 2. Called by the :func:`ascii` built-in function." msgstr "" ":c:func:`PyObject_Repr` と同様、オブジェクト *o* の文字列表現を計算します" "が、 :c:func:`PyObject_Repr` によって返された文字列に含まれる非 ASCII 文字" @@ -544,16 +601,19 @@ msgstr "" msgid "" "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " -"*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in :attr:`cls.__mro__ `." +"*derived* is a subclass of *cls* if it is a direct or indirect subclass, " +"i.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 +624,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." +"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 +666,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 +695,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 +704,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 +732,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 +739,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,27 +772,30 @@ 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*`." +"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 " "``NULL`` if there was an error. If the argument is ``NULL``, this is like " "the Python ``dir()``, returning the names of the current locals; in this " -"case, if no execution frame is active then ``NULL`` is returned but :c:func:" -"`PyErr_Occurred` will return false." +"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,85 +809,100 @@ 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." +"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. " -"This is typically a new iterator but if the argument is an :class:" -"`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns " -"``NULL`` if the object cannot be iterated." +"This is the equivalent to the Python expression ``aiter(o)``. Takes " +"an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for " +"it. This is typically a new iterator but if the argument is " +"an :class:`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`)." +"`; 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." +"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`." +"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 +922,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,70 +939,86 @@ 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 " "should be used instead of checking if the reference count is ``1``. Starting " "with Python 3.14, the interpreter internally avoids some reference count " -"modifications when loading objects onto the operands stack by :term:" -"`borrowing ` references when possible, which means that " -"a reference count of ``1`` by itself does not guarantee that a function " -"argument uniquely referenced." -msgstr "" +"modifications when loading objects onto the operands stack " +"by :term:`borrowing ` references when possible, which " +"means that 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 +1033,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 +1040,31 @@ 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,37 +1108,83 @@ 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 "" -"On a :term:`free threaded ` build, this checks if *op*'s :" -"term:`reference count` is equal to one and additionally checks if *op* is " -"only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-" -"safe on free threaded builds; prefer this function." +"On a :term:`free threaded ` build, this checks if " +"*op*'s :term:`reference count` is equal to one and additionally checks if " +"*op* is only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** " +"thread-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..77b3e7a60 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 @@ -43,15 +43,15 @@ msgstr "Python オブジェクト *o* の参照カウントを取得します。 #: ../../c-api/refcounting.rst:18 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are :term:" -"`immortal` and have a very high refcount that does not reflect the actual " -"number of references. Consequently, do not rely on the returned value to be " -"accurate, other than a value of 0 or 1." +"the object are actually held. For example, some objects " +"are :term:`immortal` and have a very high refcount that does not reflect the " +"actual number of references. Consequently, do not rely on the returned " +"value to be accurate, other than a value of 0 or 1." msgstr "" "戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映しているとは" -"限らないことに注意してください。例えば、一部のオブジェクトは永続 (:term:" -"`immortal`) であり、実際の参照の数を反映しない非常に高い参照数を持ちます。し" -"たがって、 0 か 1 の値以外では、正確な戻り値に頼らないでください。" +"限らないことに注意してください。例えば、一部のオブジェクトは永続 " +"(:term:`immortal`) であり、実際の参照の数を反映しない非常に高い参照数を持ちま" +"す。したがって、 0 か 1 の値以外では、正確な戻り値に頼らないでください。" #: ../../c-api/refcounting.rst:24 msgid "" @@ -68,11 +68,12 @@ msgid "" "that instead." msgstr "" -#: ../../c-api/refcounting.rst:33 msgid "" -"See also the function :c:func:" -"`PyUnstable_Object_IsUniqueReferencedTemporary()`." +"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 " +"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." +"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,16 +239,17 @@ 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." +"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 " +"The deallocation function can cause arbitrary Python code to be invoked " +"(e.g. when a class instance with a :meth:`~object.__del__` method is " "deallocated). While exceptions in such code are not propagated, the " "executed code has free access to all Python global variables. This means " "that any object that is reachable from a global variable should be in a " @@ -241,15 +258,27 @@ 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 +287,71 @@ 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." +"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 +360,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..b78102e80 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,48 +37,62 @@ 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." +"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 " -"frame object and will remain alive as long as the frame object does. Unlike :" -"c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls to this " -"function in the same frame will update the contents of the cached dictionary " -"to reflect changes in the state of the local variables rather than returning " -"a new snapshot." -msgstr "" +"frame object and will remain alive as long as the frame object does. " +"Unlike :c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls " +"to this function in the same frame will update the contents of the cached " +"dictionary 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." +"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 +102,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." +"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`." +"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." +"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*." +"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..6c165b0dc 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -18,24 +18,29 @@ 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:" -"`~object.__getitem__` method, unless they are :class:`dict` subclasses, " -"since in general it is impossible to determine what type of keys the class " -"supports. This function always succeeds." +"otherwise. Note that it returns ``1`` for Python classes with " +"a :meth:`~object.__getitem__` method, unless they are :class:`dict` " +"subclasses, 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 "" @@ -150,8 +154,8 @@ msgid "" "This is equivalent to the Python expression ``o.count(value)``." msgstr "" "*o* における *value* の出現回数、すなわち ``o[key] == value`` となる *key* " -"の個数を返します。失敗すると ``-1`` を返します。Python の式 ``o." -"count(value)`` と同じです。" +"の個数を返します。失敗すると ``-1`` を返します。Python の式 " +"``o.count(value)`` と同じです。" #: ../../c-api/sequence.rst:103 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 "" @@ -238,11 +241,11 @@ msgstr "" #: ../../c-api/sequence.rst:157 msgid "" -"Returns the length of *o*, assuming that *o* was returned by :c:func:" -"`PySequence_Fast` and that *o* is not ``NULL``. The size can also be " -"retrieved by calling :c:func:`PySequence_Size` on *o*, but :c:func:" -"`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list or " -"tuple." +"Returns the length of *o*, assuming that *o* was returned " +"by :c:func:`PySequence_Fast` and that *o* is not ``NULL``. The size can " +"also be retrieved by calling :c:func:`PySequence_Size` on *o*, " +"but :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* " +"is a list or tuple." msgstr "" "*o* が ``NULL`` でなく、 :c:func:`PySequence_Fast` が返したオブジェクトである" "と仮定して、 *o* の長さを返します。 *o* のサイズは :c:func:`PySequence_Size` " @@ -251,8 +254,9 @@ msgstr "" #: ../../c-api/sequence.rst:166 msgid "" -"Return the *i*\\ th element of *o*, assuming that *o* was returned by :c:" -"func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within bounds." +"Return the *i*\\ th element of *o*, assuming that *o* was returned " +"by :c:func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within " +"bounds." msgstr "" "*o* が ``NULL`` でなく、 :c:func:`PySequence_Fast` が返したオブジェクトであ" "り、かつ *i* がインデクスの範囲内にあると仮定して、 *o* の *i* 番目の要素を返" @@ -263,9 +267,9 @@ msgid "" "Return the underlying array of PyObject pointers. Assumes that *o* was " "returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." msgstr "" -"PyObject ポインタの背後にあるアレイを返します。この関数では、 *o* は :c:func:" -"`PySequence_Fast` の返したオブジェクトであり、 ``NULL`` でないものと仮定して" -"います。" +"PyObject ポインタの背後にあるアレイを返します。この関数では、 *o* " +"は :c:func:`PySequence_Fast` の返したオブジェクトであり、 ``NULL`` でないもの" +"と仮定しています。" #: ../../c-api/sequence.rst:175 msgid "" @@ -277,16 +281,15 @@ 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:" -"`PySequence_Check` on *o* is true and without adjustment for negative " -"indices." +"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form " +"of :c:func:`PySequence_GetItem` but without checking " +"that :c:func:`PySequence_Check` on *o* is true and without adjustment for " +"negative indices." msgstr "" -"*o* の *i* 番目の要素を返し、失敗すると ``NULL`` を返します。 :c:func:" -"`PySequence_GetItem` の高速版であり、:c:func:`PySequence_Check` で *o* が真を" -"返すかどうかの検証や、負の添え字の調整を行いません。 " +"*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..16c388a89 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 @@ -32,34 +32,28 @@ msgstr "Set オブジェクト" msgid "" "This section details the public API for :class:`set` and :class:`frozenset` " "objects. Any functionality not listed below is best accessed using either " -"the abstract object protocol (including :c:func:`PyObject_CallMethod`, :c:" -"func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, :c:func:" -"`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, and :c:" -"func:`PyObject_GetIter`) or the abstract number protocol (including :c:func:" -"`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, :c:func:" -"`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, :c:func:" -"`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, and :c:func:" -"`PyNumber_InPlaceXor`)." +"the abstract object protocol " +"(including :c:func:`PyObject_CallMethod`, :c:func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, :c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, " +"and :c:func:`PyObject_GetIter`) or the abstract number protocol " +"(including :c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, :c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, :c:func:`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, " +"and :c:func:`PyNumber_InPlaceXor`)." msgstr "" "このセクションでは :class:`set` と :class:`frozenset` の公開 API について詳し" -"く述べます。以降で説明していない機能は、抽象オブジェクトプロトコル (:c:func:" -"`PyObject_CallMethod`, :c:func:`PyObject_RichCompareBool`, :c:func:" -"`PyObject_Hash`, :c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:" -"`PyObject_Print`, :c:func:`PyObject_GetIter` を含む) か抽象数値プロトコル (:" -"c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, :" -"c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, :c:func:" -"`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, :c:func:" -"`PyNumber_InPlaceXor` を含む) を使って利用できます。" +"く述べます。以降で説明していない機能は、抽象オブジェクトプロトコル " +"(:c:func:`PyObject_CallMethod`, :c:func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, :c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, :c:func:`PyObject_GetIter` " +"を含む) か抽象数値プロトコル " +"(:c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, :c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, :c:func:`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, :c:func:`PyNumber_InPlaceXor` " +"を含む) を使って利用できます。" #: ../../c-api/set.rst:29 msgid "" "This subtype of :c:type:`PyObject` is used to hold the internal data for " -"both :class:`set` and :class:`frozenset` objects. It is like a :c:type:" -"`PyDictObject` in that it is a fixed size for small sets (much like tuple " -"storage) and will point to a separate, variable sized block of memory for " -"medium and large sized sets (much like list storage). None of the fields of " -"this structure should be considered public and all are subject to change. " -"All access should be done through the documented API rather than by " +"both :class:`set` and :class:`frozenset` objects. It is like " +"a :c:type:`PyDictObject` in that it is a fixed size for small sets (much " +"like tuple storage) and will point to a separate, variable sized block of " +"memory for medium and large sized sets (much like list storage). None of the " +"fields of this structure should be considered public and all are subject to " +"change. All access should be done through the documented API rather than by " "manipulating the values in the structure." msgstr "" "この :c:type:`PyObject` を継承した型は、 :class:`set` と :class:`frozenset` " @@ -72,16 +66,16 @@ msgstr "" #: ../../c-api/set.rst:40 msgid "" -"This is an instance of :c:type:`PyTypeObject` representing the Python :class:" -"`set` type." +"This is an instance of :c:type:`PyTypeObject` representing the " +"Python :class:`set` type." msgstr "" "この :c:type:`PyTypeObject` のインスタンスは、Python の :class:`set` 型を表し" "ます。" #: ../../c-api/set.rst:46 msgid "" -"This is an instance of :c:type:`PyTypeObject` representing the Python :class:" -"`frozenset` type." +"This is an instance of :c:type:`PyTypeObject` representing the " +"Python :class:`frozenset` type." msgstr "" "この :c:type:`PyTypeObject` のインスタンスは、Python の :class:`frozenset` 型" "を表します。" @@ -162,8 +156,8 @@ msgstr "" msgid "" "Return a new :class:`frozenset` containing objects returned by the " "*iterable*. The *iterable* may be ``NULL`` to create a new empty frozenset. " -"Return the new set on success or ``NULL`` on failure. Raise :exc:" -"`TypeError` if *iterable* is not actually iterable." +"Return the new set on success or ``NULL`` on failure. " +"Raise :exc:`TypeError` if *iterable* is not actually iterable." msgstr "" "*iterable* が返すオブジェクトを含む新しい :class:`frozenset` を返します。\n" "*iterable* が ``NULL`` のときは、空の frozenset を返します。\n" @@ -172,32 +166,41 @@ msgstr "" #: ../../c-api/set.rst:104 msgid "" -"The following functions and macros are available for instances of :class:" -"`set` or :class:`frozenset` or instances of their subtypes." +"The following functions and macros are available for instances " +"of :class:`set` or :class:`frozenset` or instances of their subtypes." 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." +"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 " "function does not automatically convert unhashable sets into temporary " -"frozensets. Raise a :exc:`TypeError` if the *key* is unhashable. Raise :exc:" -"`SystemError` if *anyset* is not a :class:`set`, :class:`frozenset`, or an " -"instance of a subtype." +"frozensets. Raise a :exc:`TypeError` if the *key* is unhashable. " +"Raise :exc:`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 "" @@ -206,8 +209,8 @@ msgid "" "values of brand new frozensets before they are exposed to other code). " "Return ``0`` on success or ``-1`` on failure. Raise a :exc:`TypeError` if " "the *key* is unhashable. Raise a :exc:`MemoryError` if there is no room to " -"grow. Raise a :exc:`SystemError` if *set* is not an instance of :class:" -"`set` or its subtype." +"grow. Raise a :exc:`SystemError` if *set* is not an instance " +"of :class:`set` or its subtype." msgstr "" ":class:`set` のインスタンスに *key* を追加します。\n" ":class:`frozenset` に対しても動作します (:c:func:`PyTuple_SetItem` のように、" @@ -215,16 +218,16 @@ msgstr "" "成功したら ``0`` を、失敗したら ``-1`` を返します。\n" "*key* がハッシュ可能でない場合は、 :exc:`TypeError` を送出します。\n" "*set* を大きくする余裕がない場合は、 :exc:`MemoryError` を送出します。\n" -"*set* が :class:`set` かそのサブタイプのインスタンスでない場合は、 :exc:" -"`SystemError` を送出します。" +"*set* が :class:`set` かそのサブタイプのインスタンスでない場合" +"は、 :exc:`SystemError` を送出します。" #: ../../c-api/set.rst:142 msgid "" "The following functions are available for instances of :class:`set` or its " "subtypes but not for instances of :class:`frozenset` or its subtypes." msgstr "" -"以降の関数は、 :class:`set` とそのサブタイプに対して利用可能です。 :class:" -"`frozenset` とそのサブタイプには利用できません。" +"以降の関数は、 :class:`set` とそのサブタイプに対して利用可能で" +"す。 :class:`frozenset` とそのサブタイプには利用できません。" #: ../../c-api/set.rst:148 msgid "" @@ -232,8 +235,9 @@ msgid "" "``-1`` if an error is encountered. Does not raise :exc:`KeyError` for " "missing keys. Raise a :exc:`TypeError` if the *key* is unhashable. Unlike " "the Python :meth:`~frozenset.discard` method, this function does not " -"automatically convert unhashable sets into temporary frozensets. Raise :exc:" -"`SystemError` if *set* is not an instance of :class:`set` or its subtype." +"automatically convert unhashable sets into temporary frozensets. " +"Raise :exc:`SystemError` if *set* is not an instance of :class:`set` or its " +"subtype." msgstr "" #: ../../c-api/set.rst:158 @@ -247,15 +251,18 @@ msgstr "" "ら削除します。\n" "失敗したら ``NULL`` を返します。\n" "set が空の場合には :exc:`KeyError` を送出します。\n" -"*set* が :class:`set` とそのサブタイプのインスタンスでない場合は、 :exc:" -"`SystemError` を送出します。" +"*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." +"``-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..9b7ab74a5 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 @@ -33,8 +33,8 @@ msgid "" "The type object for slice objects. This is the same as :class:`slice` in " "the Python layer." msgstr "" -"スライスオブジェクトの型オブジェクトです。これは、Pythonレイヤにおける :" -"class:`slice` と同じオブジェクトです。" +"スライスオブジェクトの型オブジェクトです。これは、Pythonレイヤにおけ" +"る :class:`slice` と同じオブジェクトです。" #: ../../c-api/slice.rst:17 msgid "" @@ -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 ::" +"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,38 +174,49 @@ 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." +"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 "" -"The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" -"`Py_None`, it is an :term:`immortal` singleton object." +"The Python ``Ellipsis`` object. This object has no methods. " +"Like :c:data:`Py_None`, it is an :term:`immortal` singleton object." msgstr "" "Python の ``Ellipsis`` オブジェクト。このオブジェクトにはメソッドがありませ" "ん。 :c:data:`Py_None` と同様、これは :term:`immortal` でシングルトンなオブ" diff --git a/c-api/stable.po b/c-api/stable.po index 1e71009d2..d702f76dc 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -18,85 +18,103 @@ 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 :" -"ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 will " -"work on 3.10.8 and vice versa, but will need to be compiled separately for " -"3.9.x and 3.11.x." +"compatible across a minor release (if these are compiled the same way; " +"see :ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 " +"will 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 " -"use this API, consider reaching out to `CPython developers `_ to discuss adding public API for your use " -"case." +"use this API, consider reaching out to `CPython developers `_ 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" @@ -185,8 +203,8 @@ msgstr "" #: ../../c-api/stable.rst:111 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " -"``python3.dll`` rather than a version-specific library such as ``python39." -"dll``." +"``python3.dll`` rather than a version-specific library such as " +"``python39.dll``." msgstr "" "Windows では、 Stable ABI を使用する拡張機能は、 ``python39.dll`` のような" "バージョン固有のライブラリではなく、 ``python3.dll`` に対してリンクする必要が" @@ -275,9 +293,10 @@ msgstr "制限付きAPIの注意点" #: ../../c-api/stable.rst:154 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " -"that code conforms to the :ref:`Limited API ` or the :ref:" -"`Stable ABI `. ``Py_LIMITED_API`` only covers definitions, but " -"an API also includes other issues, such as expected semantics." +"that code conforms to the :ref:`Limited API ` or " +"the :ref:`Stable ABI `. ``Py_LIMITED_API`` only covers " +"definitions, but an API also includes other issues, such as expected " +"semantics." msgstr "" #: ../../c-api/stable.rst:159 @@ -344,9 +363,9 @@ msgstr "プラットフォームで考慮すべき点" #: ../../c-api/stable.rst:189 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " -"lower-level libraries and compiler options. For the purposes of the :ref:" -"`Stable ABI `, these details define a “platform”. They usually " -"depend on the OS type and processor architecture" +"lower-level libraries and compiler options. For the purposes of " +"the :ref:`Stable ABI `, these details define a “platform”. They " +"usually depend on the OS type and processor architecture" msgstr "" #: ../../c-api/stable.rst:194 @@ -371,6 +390,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..888f24e42 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 "" @@ -76,11 +80,11 @@ msgstr "" #: ../../c-api/structures.rst:38 msgid "" -"This is an extension of :c:type:`PyObject` that adds the :c:member:" -"`~PyVarObject.ob_size` field. This is only used for objects that have some " -"notion of *length*. This type does not often appear in the Python/C API. " -"Access to the members must be done by using the macros :c:macro:" -"`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." +"This is an extension of :c:type:`PyObject` that adds " +"the :c:member:`~PyVarObject.ob_size` field. This is only used for objects " +"that have some notion of *length*. This type does not often appear in the " +"Python/C API. Access to the members must be done by using the " +"macros :c:macro:`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." msgstr "" #: ../../c-api/structures.rst:47 @@ -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*." @@ -194,8 +203,8 @@ msgstr "" #: ../../c-api/structures.rst:150 msgid "" -"This is a macro which expands to initialization values for a new :c:type:" -"`PyObject` type. This macro expands to::" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyObject` type. This macro expands to::" msgstr "" "新しい :c:type:`PyObject` 型のための初期値に展開するマクロです。このマクロは" "次のように展開されます。 ::" @@ -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::" +"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,48 +366,58 @@ 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 "" -"This is the typical calling convention, where the methods have the type :c:" -"type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The " -"first one is the *self* object for methods; for module functions, it is the " -"module object. The second parameter (often called *args*) is a tuple object " -"representing all arguments. This parameter is typically processed using :c:" -"func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." +"This is the typical calling convention, where the methods have the " +"type :c:type:`PyCFunction`. The function expects two :c:expr:`PyObject*` " +"values. The first one is the *self* object for methods; for module " +"functions, it is the module object. The second parameter (often called " +"*args*) is a tuple object representing all arguments. This parameter is " +"typically processed using :c:func:`PyArg_ParseTuple` " +"or :c:func:`PyArg_UnpackTuple`." msgstr "" ":c:type:`PyCFunction` 型のメソッドで典型的に使われる呼び出し規約です。関数" "は :c:expr:`PyObject*` 型の引数値を二つ要求します。最初の引数はメソッドの " "*self* オブジェクトです; モジュール関数の場合、これはモジュールオブジェクトで" "す。第二のパラメタ (よく *args* と呼ばれます) は、全ての引数を表現するタプル" -"オブジェクトです。パラメタは通常、 :c:func:`PyArg_ParseTuple` や :c:func:" -"`PyArg_UnpackTuple` で処理されます。" +"オブジェクトです。パラメタは通常、 :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:" -"`METH_FASTCALL | METH_KEYWORDS ` and :ref:" -"`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `." +"Can only be used in certain combinations with other " +"flags: :ref:`METH_VARARGS | METH_KEYWORDS `, :ref:`METH_FASTCALL | METH_KEYWORDS ` and :ref:`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 +425,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 +439,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 +461,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,21 +507,33 @@ 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." +"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 " -"``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with the " -"*self* parameter, and a :c:expr:`PyObject*` parameter representing the " +"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 ``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with " +"the *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,124 +574,155 @@ 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 " "wrappers are loaded before the method table, the existence of a " -"*sq_contains* slot, for example, would generate a wrapped method named :meth:" -"`~object.__contains__` and preclude the loading of a corresponding " -"PyCFunction with the same name. With the flag defined, the PyCFunction will " -"be loaded in place of the wrapper object and will co-exist with the slot. " -"This is helpful because calls to PyCFunctions are optimized more than " -"wrapper object calls." -msgstr "" +"*sq_contains* slot, for example, would generate a wrapped method " +"named :meth:`~object.__contains__` and preclude the loading of a " +"corresponding PyCFunction with the same name. With the flag defined, the " +"PyCFunction will be loaded in place of the wrapper object and will co-exist " +"with the slot. 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-" -"only access. Certain types, like :c:macro:`Py_T_STRING`, imply :c:macro:" -"`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and legacy :c:macro:" -"`T_OBJECT`) members can be deleted." +"only access. Certain types, like :c:macro:`Py_T_STRING`, " +"imply :c:macro:`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 " -"``\"__vectorcalloffset__\"``, corresponding to :c:member:`~PyTypeObject." -"tp_vectorcall_offset` in type objects. This member must be defined with " -"``Py_T_PYSSIZET``, and either ``Py_READONLY`` or ``Py_READONLY | " -"Py_RELATIVE_OFFSET``. For example::" +"``\"__vectorcalloffset__\"``, corresponding " +"to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. This " +"member must be defined with ``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,98 +730,119 @@ 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 " -"``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " +"The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` " +"and :c:member:`~PyTypeObject.tp_weaklistoffset` can be defined similarly " +"using ``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " "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 "" -"Can only be used as part of :c:member:`Py_tp_members ` :c:type:`slot ` when creating a class using " -"negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case." +"Can only be used as part of :c:member:`Py_tp_members " +"` :c:type:`slot ` when creating a " +"class using negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in " +"that case." msgstr "" #: ../../c-api/structures.rst:570 msgid "" -"This flag is only used in :c:type:`PyType_Slot`. When setting :c:member:" -"`~PyTypeObject.tp_members` during class creation, Python clears it and sets :" -"c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." +"This flag is only used in :c:type:`PyType_Slot`. When " +"setting :c:member:`~PyTypeObject.tp_members` during class creation, Python " +"clears it and sets :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,21 +850,25 @@ 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 "" -"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. The :c:" -"macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The new " -"names are now always available. Previously, these required ``#include " +"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. " +"The :c:macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The " +"new names are now always available. Previously, these required ``#include " "\"structmember.h\"``. The header is still available and it provides the old " "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 +876,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`." +"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 +906,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 +921,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,163 +940,162 @@ 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 "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -"型のプロパティのようなアクセスを定義するための構造体です。 :c:member:" -"`PyTypeObject.tp_getset` スロットの説明も参照してください。" +"型のプロパティのようなアクセスを定義するための構造体で" +"す。 :c:member:`PyTypeObject.tp_getset` スロットの説明も参照してください。" #: ../../c-api/structures.rst:700 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 +1109,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..09e04d378 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -18,27 +18,32 @@ 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 " -"returned. If the object implements the :class:`os.PathLike` interface, then :" -"meth:`~os.PathLike.__fspath__` is returned as long as it is a :class:`str` " -"or :class:`bytes` object. Otherwise :exc:`TypeError` is raised and ``NULL`` " -"is returned." +"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 returned. If the object implements the :class:`os.PathLike` interface, " +"then :meth:`~os.PathLike.__fspath__` is returned as long as it is " +"a :class:`str` 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 "" @@ -59,17 +68,20 @@ msgid "" "the current process. Only available on systems where :c:func:`fork` is " "defined." msgstr "" -"プロセスがフォークする前に、いくつかの内部状態を準備するための関数です。:c:" -"func:`fork` や現在のプロセスを複製するその他の類似の関数を呼び出す前にこの関" -"数を呼びださなければなりません。:c:func:`fork` が定義されているシステムでのみ" -"利用できます。" +"プロセスがフォークする前に、いくつかの内部状態を準備するための関数で" +"す。:c:func:`fork` や現在のプロセスを複製するその他の類似の関数を呼び出す前に" +"この関数を呼びださなければなりません。: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,23 +113,31 @@ 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 "" ":func:`os.register_at_fork` allows registering custom Python functions to be " -"called by :c:func:`PyOS_BeforeFork()`, :c:func:`PyOS_AfterFork_Parent` and :" -"c:func:`PyOS_AfterFork_Child`." +"called by :c:func:`PyOS_BeforeFork()`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`." msgstr "" -":func:`os.register_at_fork` を利用すると :c:func:`PyOS_BeforeFork()`、:c:" -"func:`PyOS_AfterFork_Parent` :c:func:`PyOS_AfterFork_Child` によって呼び出さ" -"れるカスタムのPython関数を登録できます。" +":func:`os.register_at_fork` を利用する" +"と :c:func:`PyOS_BeforeFork()`、:c:func:`PyOS_AfterFork_Parent` :c:func:`PyOS_AfterFork_Child` " +"によって呼び出されるカスタムのPython関数を登録できます。" #: ../../c-api/sys.rst:90 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!" +"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 `." +"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." +"preinit>` 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 "" @@ -189,9 +226,10 @@ msgstr "" #: ../../c-api/sys.rst:144 msgid "" -"Return a pointer to a newly allocated wide character string, use :c:func:" -"`PyMem_RawFree` to free the memory. If size is not ``NULL``, write the " -"number of wide characters excluding the null character into ``*size``" +"Return a pointer to a newly allocated wide character string, " +"use :c:func:`PyMem_RawFree` to free the memory. If size is not ``NULL``, " +"write the number of wide characters excluding the null character into " +"``*size``" msgstr "" "新しくメモリ確保されたワイドキャラクター文字列へのポインタを返します。\n" "このメモリを解放するのには :c:func:`PyMem_RawFree` を使ってください。\n" @@ -208,12 +246,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`." +"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 "" @@ -230,11 +271,11 @@ msgstr "" #: ../../c-api/sys.rst:164 msgid "" -"The :c:func:`PyUnicode_DecodeFSDefaultAndSize` and :c:func:" -"`PyUnicode_DecodeLocaleAndSize` functions." +"The :c:func:`PyUnicode_DecodeFSDefaultAndSize` " +"and :c:func:`PyUnicode_DecodeLocaleAndSize` functions." msgstr "" -":c:func:`PyUnicode_DecodeFSDefaultAndSize` および :c:func:" -"`PyUnicode_DecodeLocaleAndSize` 関数。" +":c:func:`PyUnicode_DecodeFSDefaultAndSize` およ" +"び :c:func:`PyUnicode_DecodeLocaleAndSize` 関数。" #: ../../c-api/sys.rst:169 ../../c-api/sys.rst:211 msgid "" @@ -244,11 +285,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;" +"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 +315,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 +339,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." +"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`." +"*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`." +"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" @@ -430,9 +481,9 @@ msgstr "" #: ../../c-api/sys.rst:303 msgid "" -"Function similar to PySys_WriteStdout() but format the message using :c:func:" -"`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary " -"length." +"Function similar to PySys_WriteStdout() but format the message " +"using :c:func:`PyUnicode_FromFormatV` and don't truncate the message to an " +"arbitrary length." msgstr "" "PySys_WriteStdout() に似た関数ですが、 :c:func:`PyUnicode_FromFormatV` を使っ" "てメッセージをフォーマットし、メッセージを任意の長さに切り詰めたりはしませ" @@ -448,70 +499,84 @@ msgstr "" #: ../../c-api/sys.rst:318 msgid "" -"Return the current dictionary of :option:`-X` options, similarly to :data:" -"`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." +"Return the current dictionary of :option:`-X` options, similarly " +"to :data:`sys._xoptions`. On error, ``NULL`` is returned and an exception " +"is set." 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." +"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 +588,35 @@ 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)." +"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,45 +624,60 @@ 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 " "make it dangerous to continue using the Python interpreter; e.g., when the " "object administration appears to be corrupted. On Unix, the standard C " -"library function :c:func:`!abort` is called which will attempt to produce a :" -"file:`core` file." +"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 "" "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " -"the standard C library function ``exit(status)``. If :c:func:" -"`Py_FinalizeEx` indicates an error, the exit status is set to 120." +"the standard C library function ``exit(status)``. " +"If :c:func:`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" "現在のプロセスを終了します。:c:func:`Py_FinalizeEx` を呼び出した後、標準Cライ" "ブラリ関数の ``exit(status)`` を呼び出します。:c:func:`Py_FinalizeEx` がエ" @@ -613,32 +700,28 @@ msgid "" msgstr "" ":c:func:`Py_FinalizeEx` から呼び出される後始末処理を行う関数 (cleanup " "function) を登録します。後始末関数は引数無しで呼び出され、値を返しません。最" -"大で 32 の後始末処理関数を登録できます。登録に成功すると、 :c:func:" -"`Py_AtExit` は ``0`` を返します; 失敗すると ``-1`` を返します。最後に登録し" -"た後始末処理関数から先に呼び出されます。各関数は高々一度しか呼び出されませ" -"ん。 Python の内部的な終了処理は後始末処理関数より以前に完了しているので、 " -"*func* からはいかなる Python API も呼び出してはなりません。" +"大で 32 の後始末処理関数を登録できます。登録に成功する" +"と、 :c:func:`Py_AtExit` は ``0`` を返します; 失敗すると ``-1`` を返します。" +"最後に登録した後始末処理関数から先に呼び出されます。各関数は高々一度しか呼び" +"出されません。 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..4731f9977 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,27 +83,30 @@ 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 "" "Return the object at position *pos* in the tuple pointed to by *p*. If " -"*pos* is negative or out of bounds, return ``NULL`` and set an :exc:" -"`IndexError` exception." +"*pos* is negative or out of bounds, return ``NULL`` and set " +"an :exc:`IndexError` exception." msgstr "" "*p* の指すタプルオブジェクト内の、位置 *pos* にあるオブジェクトを返します。 " "*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`." +"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,32 +154,36 @@ 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>`." +"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 "" -"This function \"steals\" a reference to *o*, and, unlike :c:func:" -"`PyTuple_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in the tuple at position *pos* will be leaked." +"This function \"steals\" a reference to *o*, and, " +"unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in the tuple at position *pos* will be " +"leaked." msgstr "" -"この関数は *o* への参照を \"盗み取り\" ます。また、 :c:func:" -"`PyTuple_SetItem` と違って、要素の置き換えが生じても置き換えられるオブジェク" -"トへの参照を放棄 *しません* ; その結果、タプル中の位置 *pos* で参照されていた" -"オブジェクトがメモリリークを引き起こします。" +"この関数は *o* への参照を \"盗み取り\" ます。ま" +"た、 :c:func:`PyTuple_SetItem` と違って、要素の置き換えが生じても置き換えられ" +"るオブジェクトへの参照を放棄 *しません* ; その結果、タプル中の位置 *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 " @@ -180,18 +194,24 @@ msgid "" "Client code should never assume that the resulting value of ``*p`` will be " "the same as before calling this function. If the object referenced by ``*p`` " "is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` " -"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:" -"`SystemError`." -msgstr "" -"タプルをリサイズする際に使えます。 *newsize* はタプルの新たな長さです。タプル" -"は変更不能なオブジェクト *ということになっている* ので、この関数はこのオブ" -"ジェクトに対してただ一つしか参照がない時以外には使ってはなりません。タプルが" -"コード中の他の部分ですでに参照されている場合には、この関数を *使ってはなりま" -"せん* 。タプルは常に指定サイズの末尾まで伸縮します。成功した場合には ``0`` を" -"返します。クライアントコードは、 ``*p`` の値が呼び出し前と同じになると期待し" -"てはなりません。 ``*p`` が置き換えられた場合、オリジナルの ``*p`` は破壊され" -"ます。失敗すると ``-1`` を返し、 ``*p`` を ``NULL`` に設定して、 :exc:" -"`MemoryError` または :exc:`SystemError` を送出します。" +"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` " +"or :exc:`SystemError`." +msgstr "" +"タプルのサイズ変更に使えます。\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 msgid "Struct Sequence Objects" @@ -199,10 +219,10 @@ msgstr "Struct Sequence オブジェクト" #: ../../c-api/tuple.rst:138 msgid "" -"Struct sequence objects are the C equivalent of :func:`~collections." -"namedtuple` objects, i.e. a sequence whose items can also be accessed " -"through attributes. To create a struct sequence, you first have to create a " -"specific struct sequence type." +"Struct sequence objects are the C equivalent " +"of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can " +"also be accessed through attributes. To create a struct sequence, you first " +"have to create a specific struct sequence type." msgstr "" "struct sequence オブジェクトは :func:`~collections.namedtuple` オブジェクトと" "等価なC オブジェクトです。 つまり、その要素に属性を通してアクセスすることがで" @@ -212,67 +232,76 @@ msgstr "" #: ../../c-api/tuple.rst:145 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " -"Instances of the resulting type can be created with :c:func:" -"`PyStructSequence_New`." +"Instances of the resulting type can be created " +"with :c:func:`PyStructSequence_New`." 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:" -"member:`~PyStructSequence_Desc.fields` array of the :c:type:" -"`PyStructSequence_Desc` determines which field of the struct sequence is " -"described." -msgstr "" +"tuple, all fields are typed as :c:expr:`PyObject*`. The index in " +"the :c:member:`~PyStructSequence_Desc.fields` array of " +"the :c:type:`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." +"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." @@ -284,24 +313,24 @@ msgstr "型が ``char *`` から変更されました。" #: ../../c-api/tuple.rst:214 msgid "" -"Creates an instance of *type*, which must have been created with :c:func:" -"`PyStructSequence_NewType`." +"Creates an instance of *type*, which must have been created " +"with :c:func:`PyStructSequence_NewType`." msgstr "" -"*type* のインスタンスを生成します。 *type* は :c:func:" -"`PyStructSequence_NewType` によって事前に生成していなければなりません。" +"*type* のインスタンスを生成します。 *type* " +"は :c:func:`PyStructSequence_NewType` によって事前に生成していなければなりま" +"せん。" #: ../../c-api/tuple.rst:222 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 "" @@ -309,21 +338,20 @@ msgid "" "Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " "new instances." msgstr "" -"struct sequence *p* の *pos* の位置にあるフィールドに値 *o* を設定します。:c:" -"func:`PyTuple_SET_ITEM` のように、生成したてのインスタンスに対してのみ使用す" -"べきです。" +"struct sequence *p* の *pos* の位置にあるフィールドに値 *o* を設定しま" +"す。:c:func:`PyTuple_SET_ITEM` のように、生成したてのインスタンスに対してのみ" +"使用すべきです。" #: ../../c-api/tuple.rst:247 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..f0846f75e 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 @@ -33,63 +33,80 @@ msgstr "組み込み型を記述する際に用いられる、オブジェクト #: ../../c-api/type.rst:18 msgid "" -"This is the type object for type objects; it is the same object as :class:" -"`type` in the Python layer." +"This is the type object for type objects; it is the same object " +"as :class:`type` in the Python layer." 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 " -"flag bits are guaranteed to be stable across Python releases, but access to :" -"c:member:`~PyTypeObject.tp_flags` itself is not part of the :ref:`limited " -"API `." +"flag bits are guaranteed to be stable across Python releases, but access " +"to :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,164 +118,221 @@ 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.)" +"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`." +"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` " -"reports a change to *type*. (The callback may be called only once for a " -"series of consecutive modifications to *type*, if :c:func:`!_PyType_Lookup` " -"is not called on *type* between the modifications; this is an implementation " -"detail and subject to change.)" +"Mark *type* as watched. The callback granted *watcher_id* " +"by :c:func:`PyType_AddWatcher` will be called " +"whenever :c:func:`PyType_Modified` reports a change to *type*. (The callback " +"may be called only once for a series of consecutive modifications to *type*, " +"if :c:func:`!_PyType_Lookup` 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." +"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." +"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:" -"`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar` (except the memory is " -"guaranteed to be zeroed before initialization), and should be paired with :c:" -"func:`PyObject_GC_Del` in :c:member:`~PyTypeObject.tp_free`. Otherwise, it " -"behaves like :c:macro:`PyObject_New` or :c:macro:`PyObject_NewVar` (except " -"the memory is guaranteed to be zeroed before initialization) and should be " -"paired with :c:func:`PyObject_Free` in :c:member:`~PyTypeObject.tp_free`." +"For types that support garbage collection (i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set), this function behaves " +"like :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar` (except the " +"memory is guaranteed to be zeroed before initialization), and should be " +"paired with :c:func:`PyObject_GC_Del` in :c:member:`~PyTypeObject.tp_free`. " +"Otherwise, it behaves like :c:macro:`PyObject_New` " +"or :c:macro:`PyObject_NewVar` (except 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." +"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 " "protocol will be automatically implemented from its parents. On the " -"contrary, if the type being created does include :c:macro:" -"`Py_TPFLAGS_HAVE_GC` in its flags then it **must** implement the GC protocol " -"itself by at least implementing the :c:member:`~PyTypeObject.tp_traverse` " -"handle." +"contrary, if the type being created does " +"include :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags then it **must** " +"implement the GC protocol 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." +"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." +"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\"``." +"{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." +"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 +345,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 "" @@ -301,88 +378,102 @@ msgid "" "not return the intended result. ``Py_TYPE(self)`` may be a *subclass* of the " "intended class, and subclasses are not necessarily defined in the same " "module as their superclass. See :c:type:`PyCMethod` to get the class that " -"defines the method. See :c:func:`PyType_GetModuleByDef` for cases when :c:" -"type:`!PyCMethod` cannot be used." +"defines the method. See :c:func:`PyType_GetModuleByDef` for cases " +"when :c: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`." +"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 "" -"Find the first superclass whose module was created from the given :c:type:" -"`PyModuleDef` *def*, and return that module." +"Find the first superclass whose module was created from the " +"given :c:type:`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:" -"member:`~PyTypeObject.tp_init` or :c:member:`~PyNumberMethods.nb_add`) and " -"other places where a method's defining class cannot be passed using the :c:" -"type:`PyCMethod` calling convention." +"This function is intended to be used together " +"with :c:func:`PyModule_GetState()` to get module state from slot methods " +"(such as :c:member:`~PyTypeObject.tp_init` " +"or :c:member:`~PyNumberMethods.nb_add`) and 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 "" -"Find the first superclass in *type*'s :term:`method resolution order` whose :" -"c:macro:`Py_tp_token` token is equal to the given one." +"Find the first superclass in *type*'s :term:`method resolution order` " +"whose :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 +481,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`)." +"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 +495,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 "" @@ -422,23 +515,27 @@ msgstr "" msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " -"the module is associated with the new type and can later be retrieved with :" -"c:func:`PyType_GetModule`. The associated module is not inherited by " +"the module is associated with the new type and can later be retrieved " +"with :c:func:`PyType_GetModule`. The associated module is not inherited by " "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-" -"provided base types or metaclasses, prefer :ref:`calling ` :py:" -"class:`type` (or the metaclass) over ``PyType_From*`` functions. " +"Note that this function does *not* fully match the behavior of " +"calling :py:class:`type() ` or using the :keyword:`class` statement. " +"With user-provided base types or metaclasses, prefer :ref:`calling ` :py: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 +543,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." @@ -531,8 +633,8 @@ msgstr "" #: ../../c-api/type.rst:463 msgid "" -"If positive, specifies the size of the instance in bytes. It is used to set :" -"c:member:`PyTypeObject.tp_basicsize`." +"If positive, specifies the size of the instance in bytes. It is used to " +"set :c:member:`PyTypeObject.tp_basicsize`." msgstr "" #: ../../c-api/type.rst:466 @@ -544,21 +646,21 @@ msgstr "" #: ../../c-api/type.rst:469 msgid "" "If negative, the absolute value specifies how much space instances of the " -"class need *in addition* to the superclass. Use :c:func:" -"`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved " -"this way. For negative :c:member:`!basicsize`, Python will insert padding " -"when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment " -"requirements." +"class need *in addition* to the superclass. " +"Use :c:func:`PyObject_GetTypeData` to get a pointer to subclass-specific " +"memory reserved this way. For negative :c:member:`!basicsize`, Python will " +"insert padding when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s " +"alignment requirements." msgstr "" -#: ../../c-api/type.rst:479 msgid "Previously, this field could not be negative." -msgstr "" +msgstr "以前はこのフィールドを負にできませんでした。" #: ../../c-api/type.rst:483 msgid "" -"Size of one element of a variable-size type, in bytes. Used to set :c:member:" -"`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." +"Size of one element of a variable-size type, in bytes. Used to " +"set :c:member:`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation " +"for caveats." msgstr "" #: ../../c-api/type.rst:487 @@ -575,21 +677,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`." @@ -597,8 +700,8 @@ msgstr "" #: ../../c-api/type.rst:507 msgid "" -"If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" -"`PyType_FromSpecWithBases` sets it automatically." +"If the ``Py_TPFLAGS_HEAPTYPE`` flag is not " +"set, :c:func:`PyType_FromSpecWithBases` sets it automatically." msgstr "" #: ../../c-api/type.rst:512 @@ -623,10 +726,9 @@ msgstr "" #: ../../c-api/type.rst:532 msgid "" -"Slot IDs are named like the field names of the structures :c:type:" -"`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" -"type:`PyMappingMethods` and :c:type:`PyAsyncMethods` with an added ``Py_`` " -"prefix. For example, use:" +"Slot IDs are named like the field names of the " +"structures :c:type:`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:type:`PyMappingMethods` " +"and :c:type:`PyAsyncMethods` with an added ``Py_`` prefix. For example, use:" msgstr "" #: ../../c-api/type.rst:538 @@ -647,70 +749,73 @@ 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)" +":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)" +":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 "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " -"vectorcall or to support Python older than 3.12), specify the offset in :c:" -"member:`Py_tp_members `. See :ref:`PyMemberDef " -"documentation ` for details." +"vectorcall or to support Python older than 3.12), specify the offset " +"in :c:member:`Py_tp_members `. " +"See :ref:`PyMemberDef 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`, " +":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 "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " -"some platforms. To avoid issues, use the *bases* argument of :c:func:" -"`PyType_FromSpecWithBases` instead." +"some platforms. To avoid issues, use the *bases* argument " +"of :c:func:`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 `." +":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 +837,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,44 +856,50 @@ 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``." +"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 "" -"Used as a value with :c:data:`Py_tp_token` to set the token to the class's :" -"c:type:`PyType_Spec`. Expands to ``NULL``." +"Used as a value with :c:data:`Py_tp_token` to set the token to the " +"class's :c:type:`PyType_Spec`. Expands to ``NULL``." msgstr "" #: ../../c-api/type.rst:8 diff --git a/c-api/typehints.po b/c-api/typehints.po index 6e15352ed..0ec424c5c 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -17,36 +17,39 @@ 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 "" "Create a :ref:`GenericAlias ` object. Equivalent to " "calling the Python class :class:`types.GenericAlias`. The *origin* and " "*args* arguments set the ``GenericAlias``\\ 's ``__origin__`` and " -"``__args__`` attributes respectively. *origin* should be a :c:expr:" -"`PyTypeObject*`, and *args* can be a :c:expr:`PyTupleObject*` or any " -"``PyObject*``. If *args* passed is not a tuple, a 1-tuple is automatically " -"constructed and ``__args__`` is set to ``(args,)``. Minimal checking is done " -"for the arguments, so the function will succeed even if *origin* is not a " -"type. The ``GenericAlias``\\ 's ``__parameters__`` attribute is constructed " -"lazily from ``__args__``. On failure, an exception is raised and ``NULL`` " -"is returned." +"``__args__`` attributes respectively. *origin* should be " +"a :c:expr:`PyTypeObject*`, and *args* can be a :c:expr:`PyTupleObject*` or " +"any ``PyObject*``. If *args* passed is not a tuple, a 1-tuple is " +"automatically constructed and ``__args__`` is set to ``(args,)``. Minimal " +"checking is done for the arguments, so the function will succeed even if " +"*origin* is not a type. The ``GenericAlias``\\ 's ``__parameters__`` " +"attribute is constructed lazily from ``__args__``. On failure, an exception " +"is raised and ``NULL`` is returned." msgstr "" ":ref:`GenericAlias ` オブジェクトを生成します。Pythonクラ" "ス :class:`types.GenericAlias` を呼び出すことと同等です。引数 *origin* と " @@ -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,14 +77,13 @@ 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 "" "The C type of the object returned by :c:func:`Py_GenericAlias`. Equivalent " "to :class:`types.GenericAlias` in Python." msgstr "" -":c:func:`Py_GenericAlias` により返されるCの型オブジェクトです。Pythonの :" -"class:`types.GenericAlias` と同等です。" +":c:func:`Py_GenericAlias` により返されるCの型オブジェクトです。Python" +"の :class:`types.GenericAlias` と同等です。" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index f02894596..70b34d8f6 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 "" @@ -66,11 +64,11 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use of :c:type:" -"`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use " +"of :c:type:`PyTypeObject`." msgstr "" -"以下のクイックリファレンスに加えて、 :ref:`typedef-examples` 節では :c:type:" -"`PyTypeObject` の意味と使い方を一目で理解できる例を載せています。" +"以下のクイックリファレンスに加えて、 :ref:`typedef-examples` 節で" +"は :c:type:`PyTypeObject` の意味と使い方を一目で理解できる例を載せています。" #: ../../c-api/typeobj.rst:29 msgid "Quick Reference" @@ -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:" +"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,29 +1292,130 @@ 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 :" -"c:func:`!type_new`, usually called from a class statement). Note that :c:" -"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." -"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. " +"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " +"(created by :c:func:`!type_new`, usually called from a class statement). " +"Note that :c:data:`PyType_Type` (the metatype) " +"initializes :c:member:`~PyTypeObject.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 "" "This is the type object's reference count, initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects `, the type's instances (objects whose :c:member:" -"`~PyObject.ob_type` points back to the type) do *not* count as references. " -"But for :ref:`dynamically allocated type objects `, the " -"instances *do* count as references." +"objects `, the type's instances (objects " +"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " +"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." msgstr "" #: ../../c-api/typeobj.rst:504 ../../c-api/typeobj.rst:527 @@ -1394,13 +1481,18 @@ 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." +"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 @@ -1428,33 +1520,46 @@ msgstr "" #: ../../c-api/typeobj.rst:541 msgid "" -"This field should be accessed using the :c:func:`Py_SIZE()` and :c:func:" -"`Py_SET_SIZE()` macros." +"This field should be accessed using the :c:func:`Py_SIZE()` " +"and :c:func:`Py_SET_SIZE()` macros." msgstr "" #: ../../c-api/typeobj.rst:550 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.)" +"\"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 " "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" -"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." -"tp_name` initializer ``\"P.Q.M.T\"``." -msgstr "" +"example, a type named :class:`!T` defined in module :mod:`!M` in " +"subpackage :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,30 +1571,35 @@ 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 "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" -"`~type.__module__` attribute is undefined (unless explicitly set in the " -"dictionary, as explained above). This means your type will be impossible to " -"pickle. Additionally, it will not be listed in module documentations " -"created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and " +"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " +"in the dictionary, as explained above). This means your type will be " +"impossible to pickle. Additionally, it will not be listed in module " +"documentations 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`)." +"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,23 +1607,32 @@ 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 " -"non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length " -"instances, all instances have the same size, given in :c:member:`!" -"tp_basicsize`. (Exceptions to this rule can be made using :c:func:" -"`PyUnstable_Object_GC_NewWithExtraData`.)" +"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 non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" +"length instances, all instances have the same size, given in :c:member:`!" +"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." +"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 "" @@ -1522,67 +1641,83 @@ msgid "" "field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " "used for other purposes. For example, :py:type:`int` instances use the bits " "of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " -"underlying storage and its size should be accessed using :c:func:" -"`PyLong_Export`." +"underlying storage and its size should be accessed " +"using :c:func:`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." +"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. " "For example, the :py:type:`list` type has fixed-length instances, yet those " -"instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:" -"`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" -"`PyList_Size` instead.)" +"instances have a :c:member:`~PyVarObject.ob_size` field. (As " +"with :py:type:`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." +"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 " -"include the struct used to declare the base type. In other words, :c:member:" -"`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" -"tp_basicsize`." +"include the struct used to declare the base type. In other " +"words, :c:member:`!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:" -"member:`~PyVarObject.ob_size` should be included). These are usually defined " -"by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " -"respectively." +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " +"whether :c:member:`~PyVarObject.ob_size` should be included). These are " +"usually defined 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`." +"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 +1725,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." +"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`)." +"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." +"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.::" +"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 +1866,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 +1930,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,65 +1980,97 @@ 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`." +"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:" -"`~object.__call__` in Python code, only *tp_call* is updated, likely making " -"it inconsistent with the vectorcall function. Since 3.12, setting " -"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag." -msgstr "" - -#: ../../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 "" +"` to implement the vectorcall protocol. When a user " +"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " +"likely making it inconsistent with the vectorcall function. Since 3.12, " +"setting ``__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 による最適化が無効になります。" + +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,25 +2088,25 @@ 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`" +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 "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" "このフィールドは :c:member:`~PyTypeObject.tp_getattro` と共にサブタイプに継承" "されます: すなわち、サブタイプの :c:member:`~PyTypeObject.tp_getattr` およ" "び :c:member:`~PyTypeObject.tp_getattro` が共に ``NULL`` の場合、サブタイプは" -"基底タイプから :c:member:`~PyTypeObject.tp_getattr` と :c:member:" -"`~PyTypeObject.tp_getattro` を両方とも継承します。" +"基底タイプから :c:member:`~PyTypeObject.tp_getattr` " +"と :c:member:`~PyTypeObject.tp_getattro` を両方とも継承します。" #: ../../c-api/typeobj.rst:861 ../../c-api/typeobj.rst:1061 msgid "" @@ -1877,25 +2125,25 @@ 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`" +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 "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" "このフィールドは :c:member:`~PyTypeObject.tp_setattro` と共にサブタイプに継承" "されます: すなわち、サブタイプの :c:member:`~PyTypeObject.tp_setattr` およ" "び :c:member:`~PyTypeObject.tp_setattro` が共に ``NULL`` の場合、サブタイプは" -"基底タイプから :c:member:`~PyTypeObject.tp_setattr` と :c:member:" -"`~PyTypeObject.tp_setattro` を両方とも継承します。" +"基底タイプから :c:member:`~PyTypeObject.tp_setattr` " +"と :c:member:`~PyTypeObject.tp_setattro` を両方とも継承します。" #: ../../c-api/typeobj.rst:878 msgid "" @@ -1923,21 +2171,18 @@ msgstr "" #: ../../c-api/typeobj.rst:895 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`repr`." +"An optional pointer to a function that implements the built-in " +"function :func:`repr`." 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 +2190,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 @@ -2025,19 +2271,17 @@ msgstr "" #: ../../c-api/typeobj.rst:960 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`hash`." +"An optional pointer to a function that implements the built-in " +"function :func:`hash`." 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 +2292,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`." +"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 "" @@ -2063,8 +2310,8 @@ msgid "" "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set to :c:func:" -"`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" "このフィールドは明示的に :c:func:`PyObject_HashNotImplemented` に設定すること" "で、親 type からのハッシュメソッドの継承をブロックすることができます。これは " @@ -2074,65 +2321,63 @@ 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`" +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 "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" -"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " -"are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " +"of :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash`, when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" "このフィールドは :c:member:`~PyTypeObject.tp_richcompare` と共にサブタイプに" -"継承されます: すなわち、サブタイプの :c:member:`~PyTypeObject." -"tp_richcompare` および :c:member:`~PyTypeObject.tp_hash` が両方とも ``NULL`` " -"のとき、サブタイプは基底タイプから :c:member:`~PyTypeObject.tp_richcompare` " +"継承されます: すなわち、サブタイプ" +"の :c:member:`~PyTypeObject.tp_richcompare` およ" +"び :c:member:`~PyTypeObject.tp_hash` が両方とも ``NULL`` のとき、サブタイプは" +"基底タイプから :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 "" -"An optional pointer to a function that implements the built-in operation :" -"func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " -"the constructor for that type. This constructor calls :c:func:" -"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " -"this handler.)" +"An optional pointer to a function that implements the built-in " +"operation :func:`str`. (Note that :class:`str` is a type now, " +"and :func:`str` calls the constructor for that type. This constructor " +"calls :c:func:`PyObject_Str` to do the actual work, " +"and :c:func:`PyObject_Str` will call 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 "" @@ -2151,62 +2396,59 @@ msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -"このフィールドが設定されていない場合、文字列表現を返すためには :c:func:" -"`PyObject_Repr` が呼び出されます。" +"このフィールドが設定されていない場合、文字列表現を返すために" +"は :c:func:`PyObject_Repr` が呼び出されます。" #: ../../c-api/typeobj.rst:1037 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 "" -"It is usually convenient to set this field to :c:func:" -"`PyObject_GenericGetAttr`, which implements the normal way of looking for " -"object attributes." +"It is usually convenient to set this field " +"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " +"looking for object attributes." msgstr "" "通常の属性検索を実装している :c:func:`PyObject_GenericGetAttr` をこのフィー" "ルドに設定しておくとたいていの場合は便利です。" #: ../../c-api/typeobj.rst:1050 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" "このフィールドは :c:member:`~PyTypeObject.tp_getattr` と共にサブタイプに継承" "されます: すなわち、サブタイプの :c:member:`~PyTypeObject.tp_getattr` およ" "び :c:member:`~PyTypeObject.tp_getattro` が共に ``NULL`` の場合、サブタイプは" -"基底タイプから :c:member:`~PyTypeObject.tp_getattr` と :c:member:" -"`~PyTypeObject.tp_getattro` を両方とも継承します。" +"基底タイプから :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 "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " -"supported. It is usually convenient to set this field to :c:func:" -"`PyObject_GenericSetAttr`, which implements the normal way of setting object " -"attributes." +"supported. It is usually convenient to set this field " +"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " +"setting object attributes." msgstr "" "さらに、*value* に ``NULL`` を指定して属性を削除できるようにしなければなりま" "せん。\n" @@ -2215,21 +2457,22 @@ msgstr "" #: ../../c-api/typeobj.rst:1076 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" "このフィールドは :c:member:`~PyTypeObject.tp_setattr` と共にサブタイプに継承" "されます: すなわち、サブタイプの :c:member:`~PyTypeObject.tp_setattr` およ" "び :c:member:`~PyTypeObject.tp_setattro` が共に ``NULL`` の場合、サブタイプは" -"基底タイプから :c:member:`~PyTypeObject.tp_setattr` と :c:member:" -"`~PyTypeObject.tp_setattro` を両方とも継承します。" +"基底タイプから :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 "" @@ -2238,8 +2481,8 @@ msgid "" "in :ref:`buffer-structs`." msgstr "" "バッファインターフェースを実装しているオブジェクトにのみ関連する、一連の" -"フィールド群が入った別の構造体を指すポインタです。構造体内の各フィールドは :" -"ref:`buffer-structs` で説明します。" +"フィールド群が入った別の構造体を指すポインタです。構造体内の各フィールド" +"は :ref:`buffer-structs` で説明します。" #: ../../c-api/typeobj.rst:1093 msgid "" @@ -2253,24 +2496,23 @@ msgstr "" msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " -"fields in the type object (or in the extension structures referenced via :c:" -"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." -"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" -"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " -"valid; if such a flag bit is clear, the type fields it guards must not be " -"accessed and must be considered to have a zero or ``NULL`` value instead." +"fields in the type object (or in the extension structures referenced " +"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " +"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " +"always present are valid; if such a flag bit is clear, the type fields it " +"guards must not be accessed and must be considered to have a zero or " +"``NULL`` value instead." msgstr "" "このフィールドは様々なフラグからなるビットマスクです。いくつかのフラグは、特" "定の状況において変則的なセマンティクスが適用されることを示します; その他のフ" -"ラグは、型オブジェクト (あるいは :c:member:`~PyTypeObject.tp_as_number` 、 :" -"c:member:`~PyTypeObject.tp_as_sequence` 、 :c:member:`~PyTypeObject." -"tp_as_mapping` 、 および :c:member:`~PyTypeObject.tp_as_buffer` が参照してい" -"る拡張機能構造体) の特定のフィールドのうち、過去から現在までずっと存在してい" -"たわけではないものが有効になっていることを示すために使われます; フラグビット" -"がクリアされていれば、フラグが保護しているフィールドにはアクセスしない代わり" -"に、その値はゼロか ``NULL`` になっているとみなさなければなりません。" +"ラグは、型オブジェクト (あるい" +"は :c:member:`~PyTypeObject.tp_as_number` 、 :c:member:`~PyTypeObject.tp_as_sequence` 、 :c:member:`~PyTypeObject.tp_as_mapping` 、 " +"および :c:member:`~PyTypeObject.tp_as_buffer` が参照している拡張機能構造体) " +"の特定のフィールドのうち、過去から現在までずっと存在していたわけではないもの" +"が有効になっていることを示すために使われます; フラグビットがクリアされていれ" +"ば、フラグが保護しているフィールドにはアクセスしない代わりに、その値はゼロか " +"``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 " @@ -2279,36 +2521,50 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. 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` fields, i.e. if the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" -"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " -"the subtype exist and have ``NULL`` values." -msgstr "" +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~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 "" "The following bit masks are currently defined; these can be ORed together " -"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." -"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " -"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" -"zero." +"using the ``|`` operator to form the value of " +"the :c:member:`~PyTypeObject.tp_flags` field. The " +"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " +"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." msgstr "" "以下に挙げるビットマスクは現在定義されているものです; フラグは ``|`` 演算子で" "論理和を取って :c:member:`~PyTypeObject.tp_flags` フィールドの値を作成できま" "す。 :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 " @@ -2316,10 +2572,21 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" -"`support garbage collection ` as they can form a " -"reference cycle with their own module object." -msgstr "" +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " +"also :ref:`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 @@ -2339,8 +2606,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1165 msgid "" -"This bit is set when the type object has been fully initialized by :c:func:" -"`PyType_Ready`." +"This bit is set when the type object has been fully initialized " +"by :c:func:`PyType_Ready`." msgstr "" "型オブジェクトが :c:func:`PyType_Ready` で完全に初期化されるとセットされる" "ビットです。" @@ -2353,73 +2620,95 @@ 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 " -"be allocated using :c:macro:`PyObject_GC_New` or :c:func:" -"`PyType_GenericAlloc` and deallocated (see :c:member:`~PyTypeObject." -"tp_free`) using :c:func:`PyObject_GC_Del`. More information in section :ref:" -"`supporting-cycle-detection`." -msgstr "" - -#: ../../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-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` " -"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " -"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" -"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " -"values." +"be allocated using :c:macro:`PyObject_GC_New` " +"or :c:func:`PyType_GenericAlloc` and deallocated " +"(see :c:member:`~PyTypeObject.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` を参照してください。" + +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`" + +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` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~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``." +"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." +"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,65 +2716,75 @@ 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." +"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`." +"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 "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have their :c:member:`~PyTypeObject." -"tp_flags` set appropriately, or the code that interacts with such types will " -"behave differently depending on what kind of check is used." +"types that inherit from built-ins should have " +"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " +"interacts with such types will behave differently depending on what kind of " +"check is used." msgstr "" "これらのフラグは :c:func:`PyLong_Check` のような関数が、型がとある組み込み型" "のサブクラスかどうかを素早く判断するのに使われます;\n" @@ -2503,139 +2802,174 @@ 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." +"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." +"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." +"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." +"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`." +"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`." +"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." @@ -2663,11 +2997,11 @@ msgstr "" #: ../../c-api/typeobj.rst:1463 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of a :c:" -"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " -"on each of the instance's members that are Python objects that the instance " -"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" -"`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of " +"a :c:member:`~PyTypeObject.tp_traverse` function simply " +"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " +"objects that the instance owns. For example, this is function :c:func:`!" +"local_traverse` from the :mod:`!_thread` extension module::" msgstr "" #: ../../c-api/typeobj.rst:1469 @@ -2694,24 +3028,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 +3058,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::" +"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);" @@ -2752,194 +3086,264 @@ msgstr "" #: ../../c-api/typeobj.rst:1516 msgid "" -"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:" -"func:`!local_traverse` to have these specific names; don't name them just " -"anything." +"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters " +"to :c:func:`!local_traverse` to have these specific names; don't name them " +"just anything." msgstr "" #: ../../c-api/typeobj.rst:1520 msgid "" "Instances of :ref:`heap-allocated types ` hold a reference to " -"their type. Their traversal function must therefore either visit :c:func:" -"`Py_TYPE(self) `, or delegate this responsibility by calling " -"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " -"superclass). If they do not, the type object may not be garbage-collected." +"their type. Their traversal function must therefore either " +"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " +"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" +"allocated 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." +"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 " "integers. However, it may be convenient to clear all references, and write " -"the type's :c:member:`~PyTypeObject.tp_dealloc` function to invoke :c:member:" -"`!tp_clear` to avoid code duplication. (Beware that :c:member:`!tp_clear` " -"might have already been called. Prefer calling idempotent functions like :c:" -"func:`Py_CLEAR`.)" +"the type's :c:member:`~PyTypeObject.tp_dealloc` function to " +"invoke :c:member:`!tp_clear` to avoid code duplication. (Beware " +"that :c:member:`!tp_clear` 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`." +"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:" +"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, " "on the other hand, is a superset: it must release *all* resources it owns, " "including references to objects that cannot participate in a reference cycle " -"(e.g., integers) as well as the object's own memory (by calling :c:member:" -"`~PyTypeObject.tp_free`)." -msgstr "" +"(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:`!" -"tp_clear` must not deallocate the object's own memory (:c:member:" -"`~PyTypeObject.tp_free`). The destructor, on the other hand, is only called " -"when no (strong) references exist, and as such, must safely destroy the " -"object itself by deallocating it." +"tp_clear` must not deallocate the object's own memory " +"(:c:member:`~PyTypeObject.tp_free`). The destructor, on the other hand, is " +"only called 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." +"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 " "in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For " -"example, the tuple type does not implement a :c:member:`~PyTypeObject." -"tp_clear` function, because it's possible to prove that no reference cycle " -"can be composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." -"tp_clear` functions of other types are responsible for breaking any cycle " -"containing a tuple. This isn't immediately obvious, and there's rarely a " -"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." -msgstr "" +"example, the tuple type does not implement " +"a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to " +"prove that no reference cycle can be composed entirely of tuples. Therefore " +"the :c:member:`~PyTypeObject.tp_clear` functions of other types are " +"responsible for breaking any cycle 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 +3356,6 @@ msgstr "" "スから Python オブジェクトだと思われるメンバへの参照を外し、それらのメンバへ" "のポインタに ``NULL`` をセットすべきです::" -#: ../../c-api/typeobj.rst:1651 msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -2965,13 +3368,22 @@ 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 :" -"c:func:`Py_DECREF`) until after the pointer to the contained object is set " -"to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released " +"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " +"set to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2980,25 +3392,42 @@ 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 "" -"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_ClearManagedDict` like this::" +"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_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." +"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 +3435,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 "" @@ -3029,12 +3458,13 @@ msgstr "" #: ../../c-api/typeobj.rst:1711 msgid "" -"The following constants are defined to be used as the third argument for :c:" -"member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" +"The following constants are defined to be used as the third argument " +"for :c:member:`~PyTypeObject.tp_richcompare` and " +"for :c:func:`PyObject_RichCompare`:" msgstr "" -":c:member:`~PyTypeObject.tp_richcompare` および :c:func:" -"`PyObject_RichCompare` 関数の第三引数に使うための定数としては以下が定義されて" -"います:" +":c:member:`~PyTypeObject.tp_richcompare` およ" +"び :c:func:`PyObject_RichCompare` 関数の第三引数に使うための定数としては以下" +"が定義されています:" #: ../../c-api/typeobj.rst:1717 msgid "Constant" @@ -3084,12 +3514,11 @@ msgid "" msgstr "" "比較した結果に応じて ``Py_True`` か ``Py_False`` を返します。\n" "VAL_A と VAL_B は C の比較演算によって順序付け可能でなければなりません(例え" -"ばこれらは C言語の整数か浮動小数点数になるでしょう)。三番目の引数には :c:" -"func:`PyObject_RichCompare` と同様に要求された演算を指定します。" +"ばこれらは 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." @@ -3097,31 +3526,34 @@ msgstr "エラー時には例外を設定して、関数から ``NULL`` でリ #: ../../c-api/typeobj.rst:1752 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" -"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_hash`: a subtype " +"inherits :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" "このフィールドは :c:member:`~PyTypeObject.tp_hash` と共にサブタイプに継承され" "ます: すなわち、サブタイプの :c:member:`~PyTypeObject.tp_richcompare` およ" "び :c:member:`~PyTypeObject.tp_hash` が両方とも ``NULL`` のとき、サブタイプは" -"基底タイプから :c:member:`~PyTypeObject.tp_richcompare` と :c:member:" -"`~PyTypeObject.tp_hash` を両方とも継承します。" +"基底タイプから :c:member:`~PyTypeObject.tp_richcompare` " +"と :c:member:`~PyTypeObject.tp_hash` を両方とも継承します。" #: ../../c-api/typeobj.rst:1759 msgid "" -":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." -"tp_richcompare` implementation, which may be inherited. However, if only :c:" -"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " -"is used and instances of the type will not be able to participate in any " -"comparisons." +":c:data:`PyBaseObject_Type` provides " +"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " +"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " +"not even the inherited function is used and instances of the type will not " +"be able to participate in any 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 "" @@ -3129,15 +3561,15 @@ msgid "" "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of type :c:expr:" -"`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of " +"type :c:expr:`PyObject*` which is initialized to ``NULL``." msgstr "" "型のインスタンスが弱参照可能な場合、このフィールドはゼロよりも大きな数にな" "り、インスタンス構造体における弱参照リストの先頭を示すオフセットが入ります " -"(GC ヘッダがある場合には無視します); このオフセット値は :c:func:" -"`PyObject_ClearWeakRefs` および ``PyWeakref_*`` 関数が利用します。インスタン" -"ス構造体には、 ``NULL`` に初期化された :c:expr:`PyObject*` 型のフィールドが" -"入っていなければなりません。" +"(GC ヘッダがある場合には無視します); このオフセット値" +"は :c:func:`PyObject_ClearWeakRefs` および ``PyWeakref_*`` 関数が利用します。" +"インスタンス構造体には、 ``NULL`` に初期化された :c:expr:`PyObject*` 型の" +"フィールドが入っていなければなりません。" #: ../../c-api/typeobj.rst:1778 msgid "" @@ -3147,11 +3579,13 @@ 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,51 +3601,53 @@ 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." +"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 "" "An optional pointer to a function that returns an :term:`iterator` for the " -"object. Its presence normally signals that the instances of this type are :" -"term:`iterable` (although sequences may be iterable without this function)." +"object. Its presence normally signals that the instances of this type " +"are :term:`iterable` (although sequences may be iterable without this " +"function)." msgstr "" "オプションの変数で、そのオブジェクトの :term:`イテレータ ` を返す関" -"数へのポインタです。この値が存在することは、通常この型のインスタンスが :term:" -"`イテレート可能 ` であることを示しています (しかし、シーケンスはこ" -"の関数がなくてもイテレート可能です)。" +"数へのポインタです。この値が存在することは、通常この型のインスタンス" +"が :term:`イテレート可能 ` であることを示しています (しかし、シーケ" +"ンスはこの関数がなくてもイテレート可能です)。" #: ../../c-api/typeobj.rst:1805 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 "" -"An optional pointer to a function that returns the next item in an :term:" -"`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in " +"an :term:`iterator`. The signature is::" 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 "" -"When the iterator is exhausted, it must return ``NULL``; a :exc:" -"`StopIteration` exception may or may not be set. When another error occurs, " -"it must return ``NULL`` too. Its presence signals that the instances of " -"this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; " +"a :exc:`StopIteration` exception may or may not be set. When another error " +"occurs, it must return ``NULL`` too. Its presence signals that the " +"instances of this type are iterators." msgstr "" "イテレータの要素がなくなると、この関数は ``NULL`` を返さなければなりませ" "ん。 :exc:`StopIteration` 例外は設定してもしなくても良いです。その他のエラー" @@ -3234,20 +3670,20 @@ msgstr "この関数のシグネチャは :c:func:`PyIter_Next` と同じです #: ../../c-api/typeobj.rst:1839 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMethodDef` structures, declaring regular methods of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -"オプションのポインタで、この型の正規 (regular) のメソッドを宣言している :c:" -"type:`PyMethodDef` 構造体からなる、 ``NULL`` で終端された静的な配列を指しま" -"す。" +"オプションのポインタで、この型の正規 (regular) のメソッドを宣言してい" +"る :c:type:`PyMethodDef` 構造体からなる、 ``NULL`` で終端された静的な配列を指" +"します。" #: ../../c-api/typeobj.rst:1842 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -"配列の各要素ごとに、メソッドデスクリプタの入った、要素が型の辞書 (下記の :c:" -"member:`~PyTypeObject.tp_dict` 参照) に追加されます。" +"配列の各要素ごとに、メソッドデスクリプタの入った、要素が型の辞書 (下記" +"の :c:member:`~PyTypeObject.tp_dict` 参照) に追加されます。" #: ../../c-api/typeobj.rst:1847 msgid "" @@ -3259,9 +3695,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1853 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMemberDef` structures, declaring regular data members (fields or slots) " -"of instances of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " +"or slots) of instances of this type." msgstr "" "オプションのポインタで、型の正規 (regular) のデータメンバ (フィールドおよびス" "ロット) を宣言している :c:type:`PyMemberDef` 構造体からなる、 ``NULL`` で終端" @@ -3272,8 +3708,8 @@ msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -"配列の各要素ごとに、メンバデスクリプタの入った要素が型の辞書 (下記の :c:" -"member:`~PyTypeObject.tp_dict` 参照) に追加されます。" +"配列の各要素ごとに、メンバデスクリプタの入った要素が型の辞書 (下記" +"の :c:member:`~PyTypeObject.tp_dict` 参照) に追加されます。" #: ../../c-api/typeobj.rst:1862 msgid "" @@ -3285,9 +3721,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1868 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyGetSetDef` structures, declaring computed attributes of instances of this " -"type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " +"instances of this type." msgstr "" "オプションのポインタで、インスタンスの算出属性 (computed attribute) を宣言し" "ている :c:type:`PyGetSetDef` 構造体からなる、 ``NULL`` で終端された静的な配列" @@ -3321,27 +3757,31 @@ 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 "" -"However, the unary '&' operator applied to a non-static variable like :c:" -"data:`PyBaseObject_Type` is not required to produce an address constant. " -"Compilers may support this (gcc does), MSVC does not. Both compilers are " -"strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable " +"like :c:data:`PyBaseObject_Type` is not required to produce an address " +"constant. Compilers may support this (gcc does), MSVC does not. Both " +"compilers are 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,29 +3800,37 @@ 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 " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations (like :meth:`~object." -"__add__`). Once initialization for the type has finished, this field should " -"be treated as read-only." +"they don't correspond to overloaded operations " +"(like :meth:`~object.__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." +"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." +"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,16 +3840,17 @@ 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 "" -"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" -"member:`~PyTypeObject.tp_dict` with the dictionary C-API." +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " +"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" ":c:member:`~PyTypeObject.tp_dict` に :c:func:`PyDict_SetItem` を使ったり、辞" "書 C-API で編集するのは安全ではありません。" @@ -3416,9 +3865,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,26 +3876,26 @@ 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 "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " -"of the type of the instance variable dictionary; this offset is used by :c:" -"func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used " +"by :c:func:`PyObject_GenericGetAttr`." msgstr "" "型のインスタンスにインスタンス変数の入った辞書がある場合、このフィールドは非" "ゼロの値になり、型のインスタンスデータ構造体におけるインスタンス変数辞書への" @@ -3461,149 +3910,172 @@ 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:" -"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " -"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." +"only. To get the pointer to the dictionary " +"call :c:func:`PyObject_GenericGetDict`. " +"Calling :c:func:`PyObject_GenericGetDict` may 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`." +"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`." +"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." +"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__`." +"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 "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " -"when an instance is created normally by calling its type, after the type's :" -"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " -"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " -"of some other type that is not a subtype of the original type, no :c:member:" -"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." -"tp_new` returns an instance of a subtype of the original type, the " -"subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the " +"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " +"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " +"instance of some other type that is not a subtype of the original type, " +"no :c:member:`~PyTypeObject.tp_init` function is called; " +"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " +"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" ":c:member:`~PyTypeObject.tp_init` 関数のフィールドが ``NULL`` でない場合、通" -"常の型を呼び出す方法のインスタンス生成において、型の :c:member:" -"`~PyTypeObject.tp_new` 関数がインスタンスを返した後に呼び出されます。 :c:" -"member:`~PyTypeObject.tp_new` が元の型のサブタイプでない別の型を返す場合、 :" -"c:member:`~PyTypeObject.tp_init` は全く呼び出されません; :c:member:" -"`~PyTypeObject.tp_new` が元の型のサブタイプのインスタンスを返す場合、サブタイ" -"プの :c:member:`~PyTypeObject.tp_init` が呼び出されます。" +"常の型を呼び出す方法のインスタンス生成において、型" +"の :c:member:`~PyTypeObject.tp_new` 関数がインスタンスを返した後に呼び出され" +"ます。 :c:member:`~PyTypeObject.tp_new` が元の型のサブタイプでない別の型を返" +"す場合、 :c:member:`~PyTypeObject.tp_init` は全く呼び出されませ" +"ん; :c:member:`~PyTypeObject.tp_new` が元の型のサブタイプのインスタンスを返す" +"場合、サブタイプの :c:member:`~PyTypeObject.tp_init` が呼び出されます。" #: ../../c-api/typeobj.rst:2051 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`." +"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 "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " -"to the type. Note that *subtype* doesn't have to equal the type whose :c:" -"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " -"that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type " +"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " +"subtype of that type (but not an unrelated type)." msgstr "" "*subtype* 引数は生成するオブジェクトの型です; *args* および *kwds* 引数は、型" -"を呼び出すときの位置引数およびキーワード引数です。*subtype* は :c:member:" -"`~PyTypeObject.tp_new` 関数を呼び出すときに使う型と同じである必要はないことに" -"注意してください; その型の (無関係ではない) サブタイプのこともあります。" +"を呼び出すときの位置引数およびキーワード引数です。*subtype* " +"は :c:member:`~PyTypeObject.tp_new` 関数を呼び出すときに使う型と同じである必" +"要はないことに注意してください; その型の (無関係ではない) サブタイプのことも" +"あります。" #: ../../c-api/typeobj.rst:2099 msgid "" @@ -3612,41 +4084,49 @@ msgid "" "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place in :c:member:" -"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " -"be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place " +"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " +"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" ":c:member:`~PyTypeObject.tp_new` 関数は ``subtype->tp_alloc(subtype, " "nitems)`` を呼び出してオブジェクトのメモリ領域を確保し、初期化で絶対に必要と" "される処理だけを行います。省略したり繰り返したりしても問題のない初期化処理" "は :c:member:`~PyTypeObject.tp_init` ハンドラ内に配置しなければなりません。だ" -"いたいの目安としては、変更不能な型では初期化は全て :c:member:`~PyTypeObject." -"tp_new` で行い、一方、変更可能な型ではほとんどの初期化を :c:member:" -"`~PyTypeObject.tp_init` に回すべきです。" +"いたいの目安としては、変更不能な型では初期化は全" +"て :c:member:`~PyTypeObject.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 "" -"This field is inherited by subtypes, except it is not inherited by :ref:" -"`static types ` whose :c:member:`~PyTypeObject.tp_base` is " -"``NULL`` or ``&PyBaseObject_Type``." +"This field is inherited by subtypes, except it is not inherited " +"by :ref:`static types ` " +"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " +"``&PyBaseObject_Type``." msgstr "" -"サブタイプはこのフィールドを継承します。例外として、 :c:member:" -"`~PyTypeObject.tp_base` が ``NULL`` か ``&PyBaseObject_Type`` になっている :" -"ref:`静的な型 ` では継承しません。" +"サブタイプはこのフィールドを継承します。例外とし" +"て、 :c:member:`~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,92 +4135,113 @@ 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`." +"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 " -"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:" -"`~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`." +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~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." +"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 " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " -"and dynamically allocated instances, and the statically allocated instances " -"are not collectible. Such types should define this function; it should " -"return ``1`` for a collectible instance, and ``0`` for a non-collectible " -"instance. The signature is::" -msgstr "" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " +"of statically and dynamically allocated instances, and the statically " +"allocated instances are not collectible. Such types should define this " +"function; it should 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 "" -"(The only example of this are types themselves. The metatype, :c:data:" -"`PyType_Type`, defines this function to distinguish between statically and :" -"ref:`dynamically allocated types `.)" +"(The only example of this are types themselves. The " +"metatype, :c:data:`PyType_Type`, defines this function to distinguish " +"between statically and :ref:`dynamically allocated types `.)" msgstr "" -"(上記のような型の例は、型オブジェクト自体です。メタタイプ :c:data:" -"`PyType_Type` は、型のメモリ確保が静的か :ref:`動的 ` かを区別す" -"るためにこの関数を定義しています。)" +"(上記のような型の例は、型オブジェクト自体です。メタタイ" +"プ :c:data:`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." +"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 "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " -"` can be used instead of the *bases* argument of :c:func:" -"`PyType_FromSpecWithBases`. The argument form is preferred." +"` can be used instead of the *bases* argument " +"of :c:func:`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 @@ -3759,8 +4260,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2214 msgid "" -"This field is not inherited; it is calculated fresh by :c:func:" -"`PyType_Ready`." +"This field is not inherited; it is calculated fresh " +"by :c:func:`PyType_Ready`." msgstr "" "このフィールドは継承されません; フィールドの値は :c:func:`PyType_Ready` で毎" "回計算されます。" @@ -3769,43 +4270,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__`." +"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 +4323,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." +"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 +4373,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 +4386,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,24 +4397,27 @@ 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." +"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 "" "Python might mark the object as *finalized*. Currently, Python always marks " -"objects whose type supports garbage collection (i.e., the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`) and " -"never marks other types of objects; this might change in a future version." +"objects whose type supports garbage collection (i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`) and never marks other types of " +"objects; this might change in a future version." msgstr "" #: ../../c-api/typeobj.rst:2332 @@ -3897,7 +4426,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,98 +4434,141 @@ 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:" +"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 " -"type does not support garbage collection, i.e., the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still be manually " -"finalized by calling :c:func:`PyObject_CallFinalizer` or :c:func:" -"`PyObject_CallFinalizerFromDealloc`." +"type does not support garbage collection, i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still " +"be manually 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." +"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." +"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." +"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." +"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 " -"to back up the exception at the beginning by calling :c:func:" -"`PyErr_GetRaisedException` and restore the exception at the end by calling :" -"c:func:`PyErr_SetRaisedException`. If an exception is encountered in the " -"middle of the finalizer, log and clear it with :c:func:" -"`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" -msgstr "" +"to back up the exception at the beginning by " +"calling :c:func:`PyErr_GetRaisedException` and restore the exception at the " +"end by calling :c:func:`PyErr_SetRaisedException`. If an exception is " +"encountered in the 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 +4590,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." +"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 +4663,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,18 +4672,22 @@ 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." -"tp_init`. When doing this for user-subclassable types, note that both can be " -"overridden (using :py:func:`~object.__new__` and :py:func:`~object." -"__init__`, respectively)." -msgstr "" +"specific :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_init`. When doing this for user-subclassable " +"types, note that both can be 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 +4698,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`." +"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." +"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`." +"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 +4792,6 @@ msgstr "" msgid "Here is the structure definition::" msgstr "以下は構造体の定義です::" -#: ../../c-api/typeobj.rst:2541 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -4228,6 +4836,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 +4894,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" @@ -4266,9 +4919,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2652 msgid "" -"This function is used by :c:func:`PyMapping_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. This slot may be set to " -"``NULL`` if the object has no defined length." +"This function is used by :c:func:`PyMapping_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " +"set to ``NULL`` if the object has no defined length." msgstr "" "この関数は :c:func:`PyMapping_Size` や :c:func:`PyObject_Size` から利用され、" "それらと同じシグネチャを持っています。オブジェクトが定義された長さを持たない" @@ -4276,25 +4929,32 @@ msgstr "" #: ../../c-api/typeobj.rst:2658 msgid "" -"This function is used by :c:func:`PyObject_GetItem` and :c:func:" -"`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for the :c:func:" -"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." +"This function is used by :c:func:`PyObject_GetItem` " +"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for " +"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " +"otherwise." msgstr "" "この関数は :c:func:`PyObject_GetItem` および :c:func:`PySequence_GetSlice` か" "ら利用され、:c:func:`!PyObject_GetItem` と同じシグネチャを持っています。この" "スロットは :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:" -"`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used " +"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " +"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "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 +4968,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." +"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 +5000,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,24 +5007,42 @@ 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`` にできます。" + +msgid "" +"Negative indexes are handled as follows: if " +"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " +"and the sequence length is used to compute a positive index which is passed " +"to :c:member:`~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:2714 -msgid "" -"Negative indexes are handled as follows: if the :c:member:" -"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " -"length is used to compute a positive index which is passed to :c:member:" -"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " -"index is passed as is to the function." -msgstr "" - -#: ../../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:" -"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" -"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " -"``NULL`` if the object does not support item assignment and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`, after trying the item assignment and " +"deletion via the :c: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,17 +5055,23 @@ 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 " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via the :" -"c:member:`~PyNumberMethods.nb_inplace_add` slot." +"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 +5080,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 +5110,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 "" @@ -4431,8 +5125,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2779 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" -"expr:`view->obj` to ``NULL`` and return ``-1``." +"Check if the request can be met. If not, raise :exc:`BufferError`, " +"set :c:expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" #: ../../c-api/typeobj.rst:2782 @@ -4464,8 +5158,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2793 msgid "" -"Re-export: Each member of the tree acts as the exporting object and sets :c:" -"expr:`view->obj` to a new reference to itself." +"Re-export: Each member of the tree acts as the exporting object and " +"sets :c:expr:`view->obj` to a new reference to itself." msgstr "" "再エクスポート: ツリーの各要素がエクスポートされるオブジェクトとして振る舞" "い、自身への新しい参照を :c:expr:`view->obj` へセットします。" @@ -4493,16 +5187,14 @@ msgstr "" #: ../../c-api/typeobj.rst:2805 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " -"exporter and must remain valid until there are no consumers left. :c:member:" -"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." -"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." -"internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers " +"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " +"and :c:member:`~Py_buffer.internal` are read-only for the consumer." msgstr "" ":c:type:`Py_buffer` 構造体の中から参照している全てのメモリはエクスポータに属" -"し、コンシューマがいなくなるまで有効でなくてはなりません。 :c:member:" -"`~Py_buffer.format` 、 :c:member:`~Py_buffer.shape` 、 :c:member:`~Py_buffer." -"strides` 、 :c:member:`~Py_buffer.suboffsets` 、 :c:member:`~Py_buffer." -"internal` はコンシューマからは読み出し専用です。" +"し、コンシューマがいなくなるまで有効でなくてはなりませ" +"ん。 :c:member:`~Py_buffer.format` 、 :c:member:`~Py_buffer.shape` 、 :c:member:`~Py_buffer.strides` 、 :c:member:`~Py_buffer.suboffsets` 、 :c:member:`~Py_buffer.internal` " +"はコンシューマからは読み出し専用です。" #: ../../c-api/typeobj.rst:2812 msgid "" @@ -4520,9 +5212,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 +5236,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 "" @@ -4581,13 +5271,12 @@ msgstr "async オブジェクト構造体" #: ../../c-api/typeobj.rst:2860 msgid "" -"This structure holds pointers to the functions required to implement :term:" -"`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to " +"implement :term:`awaitable` and :term:`asynchronous iterator` objects." msgstr "" "この構造体は :term:`awaitable` オブジェクトと :term:`asynchronous iterator` " "オブジェクトを実装するのに必要な関数へのポインタを保持しています。" -#: ../../c-api/typeobj.rst:2865 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -4596,10 +5285,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 +5311,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." +"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,52 +5330,65 @@ 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 " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." -"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." -"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " -"field should be initialized to *nitems* and the length of the allocated " -"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " -"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " -"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." -msgstr "" +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " +"and :c:member:`~PyObject.ob_type` set to the type argument. If the " +"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " +"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " +"*nitems* and the length of the allocated memory block should be " +"``tp_basicsize + nitems*tp_itemsize``, rounded up to 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 "" "This function should not do any other instance initialization, not even to " -"allocate additional memory; that should be done by :c:member:`~PyTypeObject." -"tp_new`." +"allocate additional memory; that should be done " +"by :c:member:`~PyTypeObject.tp_new`." msgstr "" "この関数では他のいかなるインスタンス初期化も行ってはなりません。追加のメモリ" -"割り当てすらも行ってはなりません。そのような処理は :c:member:`~PyTypeObject." -"tp_new` で行われるべきです。" +"割り当てすらも行ってはなりません。そのような処理" +"は :c:member:`~PyTypeObject.tp_new` で行われるべきです。" #: ../../c-api/typeobj.rst:2941 msgid "See :c:member:`~PyTypeObject.tp_free`." @@ -4762,11 +5470,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 +5489,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 +5512,6 @@ msgstr "" "より冗長な初期化子を用いた古いコードを(特にCPythonのコードベース中で)見かけ" "ることがあるかもしれません::" -#: ../../c-api/typeobj.rst:3056 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4835,6 +5554,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 +5625,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::" +"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 +5650,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 +5680,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 +5708,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..4376dd600 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 "" @@ -140,8 +149,8 @@ msgstr "" msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " -"canonical representation has the correct character size; use :c:func:" -"`PyUnicode_KIND` to select the right function." +"canonical representation has the correct character size; " +"use :c:func:`PyUnicode_KIND` to select the right function." msgstr "" "文字に直接アクセスするために、 UCS1, UCS2, UCS4 のいずれかの整数型にキャスト" "された正統な表現形式へのポインタを返します。\n" @@ -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,17 +199,23 @@ 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 "" -"Read a code point from a canonical representation *data* (as obtained with :" -"c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +"Read a code point from a canonical representation *data* (as obtained " +"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" "正統な表現形式となっている (:c:func:`PyUnicode_DATA` で取得した) *data* から" "コードポイントを読み取ります。\n" @@ -209,8 +224,8 @@ msgstr "" #: ../../c-api/unicode.rst:160 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " -"\"canonical\" representation. This is less efficient than :c:func:" -"`PyUnicode_READ` if you do multiple consecutive reads." +"\"canonical\" representation. This is less efficient " +"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" "Unicode オブジェクト *unicode* から文字を読み取ります。\n" "この Unicode オブジェクトは \"正統な\" 表現形式でなければなりません。\n" @@ -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`." +"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,93 +425,104 @@ 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:" -"`PyUnicode_WRITE` or similar. Since strings are supposed to be immutable, " -"take care to not “use” the result while it is being modified. In particular, " -"before it's filled with its final contents, a string:" +"After creation, the string can be filled " +"by :c:func:`PyUnicode_WriteChar`, :c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:`PyUnicode_WRITE` " +"or similar. Since strings are supposed to be immutable, 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 "" -"Create a new Unicode object with the given *kind* (possible values are :c:" -"macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" -"`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " -"1, 2 or 4 bytes per character, as given by the kind." +"Create a new Unicode object with the given *kind* (possible values " +"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " +"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " +"units of 1, 2 or 4 bytes per character, as given by the kind." msgstr "" -"与えられた *kind* (取り得る値は :c:macro:`PyUnicode_1BYTE_KIND` などの :c:" -"func:`PyUnicode_KIND` が返す値です) の Unicode オブジェクトを生成します。\n" +"与えられた *kind* (取り得る値は :c:macro:`PyUnicode_1BYTE_KIND` など" +"の :c:func:`PyUnicode_KIND` が返す値です) の Unicode オブジェクトを生成しま" +"す。\n" "*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`)." +"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 +532,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 +539,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 +563,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." +"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 +613,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 +655,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 +675,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 +704,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 +752,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 +811,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`." +"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`." +"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 +889,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 +920,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 +927,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 +953,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 +970,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." @@ -976,24 +1017,23 @@ msgstr "" #: ../../c-api/unicode.rst:633 msgid "" -"Append the string *right* to the end of *p_left*. *p_left* must point to a :" -"term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " +"Append the string *right* to the end of *p_left*. *p_left* must point to " +"a :term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " "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 +1044,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`." +"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,41 +1076,46 @@ 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 "" -"Fill a string with a character: write *fill_char* into ``unicode[start:" -"start+length]``." +"Fill a string with a character: write *fill_char* into " +"``unicode[start:start+length]``." msgstr "" "文字列を文字で埋めます: ``unicode[start:start+length]`` で *fill_char* を埋め" "ることになります。" @@ -1091,56 +1135,66 @@ 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 "" "This function checks that *unicode* is a Unicode object, that the index is " -"not out of bounds, and that the object's reference count is one). See :c:" -"func:`PyUnicode_WRITE` for a version that skips these checks, making them " -"your responsibility." +"not out of bounds, and that the object's reference count is one). " +"See :c:func:`PyUnicode_WRITE` for a version that skips these checks, making " +"them your responsibility." msgstr "" #: ../../c-api/unicode.rst:746 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast to :c:func:" -"`PyUnicode_READ_CHAR`, which performs no error checking." +"Unicode object and the index is not out of bounds, in contrast " +"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" "文字列から文字を読み取ります。\n" "エラーチェックを行わない :c:func:`PyUnicode_READ_CHAR` とは対照的に、この関数" "は *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 "" -"Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" -"func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" -"`MemoryError` set. The returned buffer always has an extra null code point " -"appended." +"Copy the string *unicode* into a new UCS4 buffer that is allocated " +"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " +"a :exc:`MemoryError` set. The returned buffer always has an extra null code " +"point appended." msgstr "" "文字列 *unicode* を :c:func:`PyMem_Malloc` でメモリ確保された新しい UCS4 型の" "バッファにコピーします。\n" @@ -1159,7 +1213,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 +1220,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`." +"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." @@ -1185,35 +1247,45 @@ msgstr ":c:func:`Py_DecodeLocale` 関数。" #: ../../c-api/unicode.rst:814 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. Previously, :c:func:" -"`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " -"locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" "この関数は、 Android 以外では現在のロケールエンコーディングを " "``surrogateescape`` エラーハンドラで使うようになりました。\n" "以前は、 :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 " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " -"``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" -"`bytes` object. *unicode* cannot contain embedded null characters." +"``\"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`." +"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." @@ -1222,9 +1294,9 @@ msgstr ":c:func:`Py_EncodeLocale` 関数。" #: ../../c-api/unicode.rst:849 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. Previously, :c:func:" -"`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " -"locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" "この関数は、 Android 以外では現在のロケールエンコーディングを " "``surrogateescape`` エラーハンドラで使うようになりました。\n" @@ -1235,24 +1307,27 @@ 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 :" -"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"-- obtained directly or through the :class:`os.PathLike` interface -- " +"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " "objects are output as-is. *result* must be an address of a C variable of " "type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " "variable to a new :term:`strong reference` to a :ref:`bytes object " @@ -1260,85 +1335,124 @@ 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` " -"interface -- to :class:`str` using :c:func:" -"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " -"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" -"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" -"`strong reference` to a :ref:`Unicode object ` which must be " -"released when it is no longer used and return a non-zero value (:c:macro:" -"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " -"result. On failure, return ``0`` with an exception set." -msgstr "" +"interface -- to :class:`str` " +"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " +"output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " +"the variable to a new :term:`strong reference` to a :ref:`Unicode object " +"` which must be released when it is no longer used and " +"return a non-zero value (:c:macro:`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`." +"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`." +"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`." +"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,61 +1462,87 @@ 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." +"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:" -"expr:`wchar_t*` string is null-terminated in case this is required by the " -"application. Also, note that the :c:expr:`wchar_t*` string might contain " +"terminated. It is the responsibility of the caller to make sure that " +"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " +"the application. Also, note that the :c:expr:`wchar_t*` string might contain " "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 " "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " -"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." +"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 +1566,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 +1603,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 +1627,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 +1687,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 +1708,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,29 +1722,38 @@ 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*. " "As a result, strings containing null characters will remain in the returned " "string, which some C functions might interpret as the end of the string, " -"leading to truncation. If truncation is an issue, it is recommended to use :" -"c:func:`PyUnicode_AsUTF8AndSize` instead." +"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 +1781,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 "" @@ -1667,10 +1828,11 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" "*consumed* が ``NULL`` のとき、 :c:func:`PyUnicode_DecodeUTF32` と同じように" -"振る舞います。 *consumed* が ``NULL`` でないとき、 :c:func:" -"`PyUnicode_DecodeUTF32Stateful` は末尾の不完全な (4 で割り切れない長さのバイ" -"ト列などの) UTF-32 バイト列をエラーとして扱いません。末尾の不完全なバイト列は" -"デコードされず、デコードされたバイト数が *consumed* に格納されます。" +"振る舞います。 *consumed* が ``NULL`` でないと" +"き、 :c:func:`PyUnicode_DecodeUTF32Stateful` は末尾の不完全な (4 で割り切れな" +"い長さのバイト列などの) UTF-32 バイト列をエラーとして扱いません。末尾の不完全" +"なバイト列はデコードされず、デコードされたバイト数が *consumed* に格納されま" +"す。" #: ../../c-api/unicode.rst:1203 msgid "" @@ -1734,10 +1896,11 @@ msgid "" "*consumed*." msgstr "" "*consumed* が ``NULL`` の場合、 :c:func:`PyUnicode_DecodeUTF16` と同じように" -"動作します。 *consumed* が ``NULL`` でない場合、 :c:func:" -"`PyUnicode_DecodeUTF16Stateful` は末尾の不完全な UTF-16 バイト列 (奇数長のバ" -"イト列や分割されたサロゲートペア) をエラーとみなしません。これらのバイト列は" -"デコードされず、デコードされたバイト数を *consumed* に返します。" +"動作します。 *consumed* が ``NULL`` でない場" +"合、 :c:func:`PyUnicode_DecodeUTF16Stateful` は末尾の不完全な UTF-16 バイト" +"列 (奇数長のバイト列や分割されたサロゲートペア) をエラーとみなしません。これ" +"らのバイト列はデコードされず、デコードされたバイト数を *consumed* に返しま" +"す。" #: ../../c-api/unicode.rst:1254 msgid "" @@ -1759,11 +1922,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 +1950,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 +1978,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 +2041,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 +2095,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 +2103,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 +2121,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 +2154,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 +2190,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 "" @@ -2021,15 +2206,17 @@ msgid "" "will be stored in *consumed*." msgstr "" "*consumed* が ``NULL`` のとき、 :c:func:`PyUnicode_DecodeMBCS` と同じ動作をし" -"ます。 *consumed* が ``NULL`` でないとき、 :c:func:" -"`PyUnicode_DecodeMBCSStateful` は文字列の最後にあるマルチバイト文字の前半バイ" -"トをデコードせず、 *consumed* にデコードしたバイト数を格納します。" +"ます。 *consumed* が ``NULL`` でないと" +"き、 :c:func:`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 +2228,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." +"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 +2267,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 +2274,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 +2342,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 +2383,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 "" @@ -2223,49 +2418,45 @@ msgstr "" #: ../../c-api/unicode.rst:1600 msgid "" -"This function returns ``-1`` upon failure, so one should call :c:func:" -"`PyErr_Occurred` to check for errors." +"This function returns ``-1`` upon failure, so one should " +"call :c:func:`PyErr_Occurred` to check for errors." 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." +"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 +2464,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 +2511,17 @@ 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`." +"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,37 +2546,53 @@ 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. " -"If there is an existing interned string that is the same as :c:expr:" -"`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " -"the old string object and creating a new :term:`strong reference` to the " -"interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " -"interns it." -msgstr "" +"If there is an existing interned string that is the same " +"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " +"reference to the old string object and creating a new :term:`strong " +"reference` to the 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." +"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,214 +2600,231 @@ 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." +"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 " "unbounded number of different strings, such as ones coming from user input, " -"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace` directly." +"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." +"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 +2836,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..154bee94c 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 @@ -41,22 +41,29 @@ msgstr "" #: ../../c-api/veryhigh.rst:14 msgid "" "Several of these functions accept a start symbol from the grammar as a " -"parameter. The available start symbols are :c:data:`Py_eval_input`, :c:data:" -"`Py_file_input`, and :c:data:`Py_single_input`. These are described " -"following the functions which accept them as parameters." +"parameter. The available start symbols " +"are :c:data:`Py_eval_input`, :c:data:`Py_file_input`, " +"and :c:data:`Py_single_input`. These are described 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:" -"`FILE` structure for different C libraries can be different and " +"One particular issue which needs to be handled carefully is that " +"the :c:type:`FILE` structure for different C libraries can be different and " "incompatible. Under Windows (at least), it is possible for dynamically " "linked extensions to actually use different libraries, so care should be " "taken that :c:expr:`FILE*` parameters are only passed to these functions if " "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 "" @@ -85,20 +92,21 @@ msgstr "" #: ../../c-api/veryhigh.rst:48 msgid "" "If *fp* refers to a file associated with an interactive device (console or " -"terminal input or Unix pseudo-terminal), return the value of :c:func:" -"`PyRun_InteractiveLoop`, otherwise return the result of :c:func:" -"`PyRun_SimpleFile`. *filename* is decoded from the filesystem encoding (:" -"func:`sys.getfilesystemencoding`). If *filename* is ``NULL``, this function " -"uses ``\"???\"`` as the filename. If *closeit* is true, the file is closed " -"before ``PyRun_SimpleFileExFlags()`` returns." +"terminal input or Unix pseudo-terminal), return the value " +"of :c:func:`PyRun_InteractiveLoop`, otherwise return the result " +"of :c:func:`PyRun_SimpleFile`. *filename* is decoded from the filesystem " +"encoding (:func:`sys.getfilesystemencoding`). If *filename* is ``NULL``, " +"this function uses ``\"???\"`` as the filename. If *closeit* is true, the " +"file is closed before ``PyRun_SimpleFileExFlags()`` returns." msgstr "" "*fp* が対話的デバイス (コンソールや端末入力あるいは Unix 仮想端末) と関連づけ" "られたファイルを参照している場合は、 :c:func:`PyRun_InteractiveLoop` の値を返" "します。それ以外の場合は、 :c:func:`PyRun_SimpleFile` の結果を返します。 " -"*filename* はファイルシステムのエンコーディング (:func:`sys." -"getfilesystemencoding`) でデコードされます。 *filename* が ``NULL`` ならば、" -"この関数はファイル名として ``\"???\"`` を使います。*closeit* が真なら、ファイ" -"ルは ``PyRun_SimpleFileExFlags()`` が処理を戻す前に閉じられます。" +"*filename* はファイルシステムのエンコーディング " +"(:func:`sys.getfilesystemencoding`) でデコードされます。 *filename* が " +"``NULL`` ならば、この関数はファイル名として ``\"???\"`` を使います。" +"*closeit* が真なら、ファイルは ``PyRun_SimpleFileExFlags()`` が処理を戻す前に" +"閉じられます。" #: ../../c-api/veryhigh.rst:60 msgid "" @@ -122,12 +130,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." +"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 "" @@ -182,8 +191,8 @@ msgstr "" msgid "" "Read and execute a single statement from a file associated with an " "interactive device according to the *flags* argument. The user will be " -"prompted using ``sys.ps1`` and ``sys.ps2``. *filename* is decoded from the :" -"term:`filesystem encoding and error handler`." +"prompted using ``sys.ps1`` and ``sys.ps2``. *filename* is decoded from " +"the :term:`filesystem encoding and error handler`." msgstr "" "対話的デバイスに関連付けられたファイルから文を一つ読み込み、 *flags* に従って" "実行します。 ``sys.ps1`` と ``sys.ps2`` を使って、ユーザにプロンプトを表示し" @@ -194,15 +203,15 @@ msgstr "" msgid "" "Returns ``0`` when the input was executed successfully, ``-1`` if there was " "an exception, or an error code from the :file:`errcode.h` include file " -"distributed as part of Python if there was a parse error. (Note that :file:" -"`errcode.h` is not included by :file:`Python.h`, so must be included " -"specifically if needed.)" +"distributed as part of Python if there was a parse error. (Note " +"that :file:`errcode.h` is not included by :file:`Python.h`, so must be " +"included specifically if needed.)" msgstr "" "入力が正常に実行されたときは ``0`` を返します。例外が発生した場合は ``-1`` を" -"返します。パースエラーの場合はPythonの一部として配布されている :file:" -"`errcode.h` インクルードファイルにあるエラーコードを返します。 (:file:" -"`Python.h` は :file:`errcode.h` をインクルードしません。従って、 必要な場合は" -"その都度インクルードしなければならないことに注意してください。)" +"返します。パースエラーの場合はPythonの一部として配布されてい" +"る :file:`errcode.h` インクルードファイルにあるエラーコードを返します。 " +"(:file:`Python.h` は :file:`errcode.h` をインクルードしません。従って、 必要" +"な場合はその都度インクルードしなければならないことに注意してください。)" #: ../../c-api/veryhigh.rst:124 msgid "" @@ -243,11 +252,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 "" @@ -270,8 +280,8 @@ msgstr "" #: ../../c-api/veryhigh.rst:162 msgid "" -"The result must be a string allocated by :c:func:`PyMem_RawMalloc` or :c:" -"func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred." +"The result must be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred." msgstr "" "返り値は :c:func:`PyMem_RawMalloc` または :c:func:`PyMem_RawRealloc` でメモリ" "確保した文字列、あるいはエラーが起きた場合には ``NULL`` でなければなりませ" @@ -279,13 +289,13 @@ msgstr "" #: ../../c-api/veryhigh.rst:165 msgid "" -"The result must be allocated by :c:func:`PyMem_RawMalloc` or :c:func:" -"`PyMem_RawRealloc`, instead of being allocated by :c:func:`PyMem_Malloc` or :" -"c:func:`PyMem_Realloc`." +"The result must be allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, instead of being allocated " +"by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`." msgstr "" -"返り値は、 :c:func:`PyMem_Malloc` や :c:func:`PyMem_Realloc` ではなく、 :c:" -"func:`PyMem_RawMalloc` または :c:func:`PyMem_RawRealloc` でメモリ確保したもの" -"でなければなりません。" +"返り値は、 :c:func:`PyMem_Malloc` や :c:func:`PyMem_Realloc` ではな" +"く、 :c:func:`PyMem_RawMalloc` または :c:func:`PyMem_RawRealloc` でメモリ確保" +"したものでなければなりません。" #: ../../c-api/veryhigh.rst:176 msgid "" @@ -348,8 +358,8 @@ msgid "" "Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read " "from *fp* instead of an in-memory string. *filename* should be the name of " "the file, it is decoded from the :term:`filesystem encoding and error " -"handler`. If *closeit* is true, the file is closed before :c:func:" -"`PyRun_FileExFlags` returns." +"handler`. If *closeit* is true, the file is closed " +"before :c:func:`PyRun_FileExFlags` returns." msgstr "" ":c:func:`PyRun_StringFlags` と似ていますが、Pythonソースコードをメモリ内の文" "字列ではなく *fp* から読み込みます。 *filename* はそのファイルの名前でなけれ" @@ -378,11 +388,12 @@ msgstr "" msgid "" "Parse and compile the Python source code in *str*, returning the resulting " "code object. The start token is given by *start*; this can be used to " -"constrain the code which can be compiled and should be :c:data:" -"`Py_eval_input`, :c:data:`Py_file_input`, or :c:data:`Py_single_input`. The " -"filename specified by *filename* is used to construct the code object and " -"may appear in tracebacks or :exc:`SyntaxError` exception messages. This " -"returns ``NULL`` if the code cannot be parsed or compiled." +"constrain the code which can be compiled and should " +"be :c:data:`Py_eval_input`, :c:data:`Py_file_input`, " +"or :c:data:`Py_single_input`. The filename specified by *filename* is used " +"to construct the code object and may appear in tracebacks " +"or :exc:`SyntaxError` exception messages. This returns ``NULL`` if the code " +"cannot be parsed or compiled." msgstr "" #: ../../c-api/veryhigh.rst:241 @@ -417,7 +428,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,15 +435,16 @@ 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 "" -"Evaluate an execution frame. This is a simplified interface to :c:func:" -"`PyEval_EvalFrameEx`, for backward compatibility." +"Evaluate an execution frame. This is a simplified interface " +"to :c:func:`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" "実行フレームを評価します。これは :c:func:`PyEval_EvalFrameEx` に対するシンプ" "ルなインターフェースで、後方互換性のためのものです。" @@ -450,8 +461,8 @@ msgstr "" "Python のインタープリタの主要な、直接的な関数です。実行フレーム *f* に関連付" "けられたコードオブジェクトを実行します。 バイトコードを解釈して、必要に応じて" "呼び出しを実行します。 追加の *throwflag* 引数はほとんど無視できます。 - も" -"し true なら、 すぐに例外を発生させます。これはジェネレータオブジェクトの :" -"meth:`~generator.throw` メソッドで利用されます。" +"し true なら、 すぐに例外を発生させます。これはジェネレータオブジェクト" +"の :meth:`~generator.throw` メソッドで利用されます。" #: ../../c-api/veryhigh.rst:288 msgid "" @@ -508,42 +519,48 @@ 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." +"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." +"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 +570,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..aec30ac51 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,17 @@ 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." +"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..a44ab835e 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 @@ -28,6 +28,6 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" diff --git a/distutils/apiref.po b/distutils/apiref.po index 599c17489..0098c7660 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 @@ -51,9 +51,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/apiref.rst:19 msgid ":mod:`distutils.core` --- Core Distutils functionality" @@ -63,13 +63,15 @@ msgstr ":mod:`distutils.core` --- Distutils のコア機能" msgid "" "The :mod:`distutils.core` module is the only module that needs to be " "installed to use the Distutils. It provides the :func:`setup` (which is " -"called from the setup script). Indirectly provides the :class:`distutils." -"dist.Distribution` and :class:`distutils.cmd.Command` class." +"called from the setup script). Indirectly provides " +"the :class:`distutils.dist.Distribution` and :class:`distutils.cmd.Command` " +"class." msgstr "" -"Distutilsを使うためにインストールする必要がある唯一のモジュールが :mod:" -"`distutils.core` モジュールです。 :func:`setup` 関数 (セットアップスクリプト" -"から呼び出されます)を提供します。間接的に :class:`distutils.dist." -"Distribution` クラスと :class:`distutils.cmd.Command` クラスを提供します。" +"Distutilsを使うためにインストールする必要がある唯一のモジュール" +"が :mod:`distutils.core` モジュールです。 :func:`setup` 関数 (セットアップス" +"クリプトから呼び出されます)を提供します。間接的" +"に :class:`distutils.dist.Distribution` クラス" +"と :class:`distutils.cmd.Command` クラスを提供します。" #: ../../distutils/apiref.rst:33 msgid "" @@ -162,8 +164,8 @@ msgstr "*maintainer*" #: ../../distutils/apiref.rst:61 msgid "" "The name of the current maintainer, if different from the author. Note that " -"if the maintainer is provided, distutils will use it as the author in :file:" -"`PKG-INFO`" +"if the maintainer is provided, distutils will use it as the author " +"in :file:`PKG-INFO`" msgstr "" "作者と違う場合の、現在のメンテナーの名前です。 maintainer 引数が与えられた場" "合、 distutils は :file:`PKG-INFO` で作者として使用します" @@ -351,24 +353,24 @@ msgstr "パッケージからディレクトリ名へのマッピング" #: ../../distutils/apiref.rst:127 msgid "" -"Run a setup script in a somewhat controlled environment, and return the :" -"class:`distutils.dist.Distribution` instance that drives things. This is " -"useful if you need to find out the distribution meta-data (passed as " +"Run a setup script in a somewhat controlled environment, and return " +"the :class:`distutils.dist.Distribution` instance that drives things. This " +"is useful if you need to find out the distribution meta-data (passed as " "keyword args from *script* to :func:`setup`), or the contents of the config " "files or command-line." msgstr "" -"制御された環境でセットアップスクリプトを実行し、いろいろなものを操作する :" -"class:`distutils.dist.Distribution` クラスのインスタンスを返します。これは" -"ディストリビューションのメタデータ(キーワード引数 *script* として関数 :func:" -"`setup` に渡される)を参照したり、設定ファイルやコマンドラインの内容を調べる時" -"に便利です。" +"制御された環境でセットアップスクリプトを実行し、いろいろなものを操作す" +"る :class:`distutils.dist.Distribution` クラスのインスタンスを返します。これ" +"はディストリビューションのメタデータ(キーワード引数 *script* として関" +"数 :func:`setup` に渡される)を参照したり、設定ファイルやコマンドラインの内容" +"を調べる時に便利です。" #: ../../distutils/apiref.rst:133 msgid "" -"*script_name* is a file that will be read and run with :func:`exec`. ``sys." -"argv[0]`` will be replaced with *script* for the duration of the call. " -"*script_args* is a list of strings; if supplied, ``sys.argv[1:]`` will be " -"replaced by *script_args* for the duration of the call." +"*script_name* is a file that will be read and run with :func:`exec`. " +"``sys.argv[0]`` will be replaced with *script* for the duration of the " +"call. *script_args* is a list of strings; if supplied, ``sys.argv[1:]`` " +"will be replaced by *script_args* for the duration of the call." msgstr "" "*script* は :func:`exec` で読み込まれるファイルです。 ``sys.argv[0]`` は、呼" "び出しのために *script_name* と置換されます。 *script_args* は文字列のリスト" @@ -405,11 +407,11 @@ msgstr "*config*" #: ../../distutils/apiref.rst:149 msgid "" -"Stop after config files have been parsed (and their data stored in the :" -"class:`Distribution` instance)" +"Stop after config files have been parsed (and their data stored in " +"the :class:`Distribution` instance)" msgstr "" -"設定ファイルをパーズしたあと停止する(そしてそのデータは :class:" -"`Distribution` インスタンスに保存される)。" +"設定ファイルをパーズしたあと停止する(そしてそのデータ" +"は :class:`Distribution` インスタンスに保存される)。" #: ../../distutils/apiref.rst:153 msgid "*commandline*" @@ -682,9 +684,9 @@ msgid "" "See the :func:`setup` function for a list of keyword arguments accepted by " "the Distribution constructor. :func:`setup` creates a Distribution instance." msgstr "" -"Distribution のコンストラクタが取りうるキーワード引数のリストに関しては、 :" -"func:`setup` 関数を見てください。 :func:`setup` は Distribution のインスタン" -"スを作ります。" +"Distribution のコンストラクタが取りうるキーワード引数のリストに関して" +"は、 :func:`setup` 関数を見てください。 :func:`setup` は Distribution のイン" +"スタンスを作ります。" #: ../../distutils/apiref.rst:304 msgid "" @@ -716,10 +718,10 @@ msgid "" "options for the compiler --- macro definitions, include directories, link " "path, libraries and the like." msgstr "" -"このモジュールは :class:`CCompiler` クラスの抽象ベースクラスを提供します。 :" -"class:`CCompiler` のインスタンスはプロジェクトにおける全てのコンパイルおよび" -"リンクに使われます。コンパイラのオプションを設定するためのメソッドが提供され" -"ます --- マクロ定義、includeディレクトリ、リンクパス、ライブラリなど。" +"このモジュールは :class:`CCompiler` クラスの抽象ベースクラスを提供しま" +"す。 :class:`CCompiler` のインスタンスはプロジェクトにおける全てのコンパイル" +"およびリンクに使われます。コンパイラのオプションを設定するためのメソッドが提" +"供されます --- マクロ定義、includeディレクトリ、リンクパス、ライブラリなど。" #: ../../distutils/apiref.rst:328 msgid "This module provides the following functions." @@ -766,8 +768,8 @@ msgstr "指定されたプラットフォームのデフォルトコンパイラ #: ../../distutils/apiref.rst:356 msgid "" "*osname* should be one of the standard Python OS names (i.e. the ones " -"returned by ``os.name``) and *platform* the common value returned by ``sys." -"platform`` for the platform in question." +"returned by ``os.name``) and *platform* the common value returned by " +"``sys.platform`` for the platform in question." msgstr "" "問い合わせの *osname* はPython標準のOS名(``os.name`` で返されるもの)のひとつ" "であるべきで、 *platform* は ``sys.platform`` で返される共通の値です。" @@ -777,8 +779,8 @@ msgid "" "The default values are ``os.name`` and ``sys.platform`` in case the " "parameters are not given." msgstr "" -"パラメータが指定されていない場合のデフォルト値は ``os.name`` と ``sys." -"platform`` です。" +"パラメータが指定されていない場合のデフォルト値は ``os.name`` と " +"``sys.platform`` です。" #: ../../distutils/apiref.rst:366 msgid "" @@ -786,30 +788,30 @@ msgid "" "supplied platform/compiler combination. *plat* defaults to ``os.name`` (eg. " "``'posix'``, ``'nt'``), and *compiler* defaults to the default compiler for " "that platform. Currently only ``'posix'`` and ``'nt'`` are supported, and " -"the default compilers are \"traditional Unix interface\" (:class:" -"`UnixCCompiler` class) and Visual C++ (:class:`MSVCCompiler` class). Note " -"that it's perfectly possible to ask for a Unix compiler object under " -"Windows, and a Microsoft compiler object under Unix---if you supply a value " -"for *compiler*, *plat* is ignored." +"the default compilers are \"traditional Unix interface\" " +"(:class:`UnixCCompiler` class) and Visual C++ (:class:`MSVCCompiler` " +"class). Note that it's perfectly possible to ask for a Unix compiler object " +"under Windows, and a Microsoft compiler object under Unix---if you supply a " +"value for *compiler*, *plat* is ignored." msgstr "" "指定されたプラットフォーム/コンパイラの組み合わせ向けに、 CCompilerサブクラス" -"のインスタンスを生成するファクトリ関数です。 *plat* のデフォルト値は ``os." -"name`` (例: ``'posix'``, ``'nt'``), *compiler*)、 *compiler* のデフォルト値は" -"プラトフォームのデフォルトコンパイラです。現在は ``'posix'`` と ``'nt'`` だけ" -"がサポートされています、デフォルトのコンパイラは \"traditional Unix " -"interface\" (:class:`UnixCCompiler` クラス) と、 Visual C++ (:class:" -"`MSVCCompiler` クラス) です。 WindowsでUnixコンパイラオブジェクトを要求するこ" -"とも、UnixでMicrosoft コンパイラオブジェクトを要求することも可能です。 " -"*compiler* 引数を与えると *plat* は無視されます。" +"のインスタンスを生成するファクトリ関数です。 *plat* のデフォルト値は " +"``os.name`` (例: ``'posix'``, ``'nt'``), *compiler*)、 *compiler* のデフォル" +"ト値はプラトフォームのデフォルトコンパイラです。現在は ``'posix'`` と " +"``'nt'`` だけがサポートされています、デフォルトのコンパイラは \"traditional " +"Unix interface\" (:class:`UnixCCompiler` クラス) と、 Visual C++ " +"(:class:`MSVCCompiler` クラス) です。 WindowsでUnixコンパイラオブジェクトを要" +"求することも、UnixでMicrosoft コンパイラオブジェクトを要求することも可能で" +"す。 *compiler* 引数を与えると *plat* は無視されます。" #: ../../distutils/apiref.rst:382 msgid "" "Print list of available compilers (used by the :option:`!--help-compiler` " "options to :command:`build`, :command:`build_ext`, :command:`build_clib`)." msgstr "" -"利用可能なコンパイラのリストを表示します (:command:`build`, :command:" -"`build_ext`, :command:`build_clib` の、 :option:`!--help-compiler` オプション" -"で使われます)。" +"利用可能なコンパイラのリストを表示します " +"(:command:`build`, :command:`build_ext`, :command:`build_clib` " +"の、 :option:`!--help-compiler` オプションで使われます)。" #: ../../distutils/apiref.rst:388 msgid "" @@ -851,10 +853,10 @@ msgstr "" "各サブクラスのコンストラクタは Compiler クラスのインスタンスを作ります。フラ" "グは *verbose* (冗長な出力を表示します)、 *dry_run* (実際にはそのステップを実" "行しません)、そして *force* (依存関係を無視して全て再ビルドします)です。これ" -"らのフラグは全てデフォルト値が ``0`` (無効)になっています。 :class:" -"`CCompiler` またはサブクラスを直接インスタンス化したくない場合には、かわり" -"に :func:`distutils.CCompiler.new_compiler` ファクトリ関数を利用してくださ" -"い。" +"らのフラグは全てデフォルト値が ``0`` (無効)になっていま" +"す。 :class:`CCompiler` またはサブクラスを直接インスタンス化したくない場合に" +"は、かわりに :func:`distutils.CCompiler.new_compiler` ファクトリ関数を利用し" +"てください。" #: ../../distutils/apiref.rst:407 msgid "" @@ -870,23 +872,23 @@ msgid "" "The compiler is instructed to search directories in the order in which they " "are supplied by successive calls to :meth:`add_include_dir`." msgstr "" -"*dir* をヘッダファイル探索ディレクトリのリストに追加します。コンパイラは :" -"meth:`add_include_dir` を呼び出した順にディレクトリを探索するよう指定されま" -"す。" +"*dir* をヘッダファイル探索ディレクトリのリストに追加します。コンパイラ" +"は :meth:`add_include_dir` を呼び出した順にディレクトリを探索するよう指定され" +"ます。" #: ../../distutils/apiref.rst:420 msgid "" "Set the list of directories that will be searched to *dirs* (a list of " "strings). Overrides any preceding calls to :meth:`add_include_dir`; " -"subsequent calls to :meth:`add_include_dir` add to the list passed to :meth:" -"`set_include_dirs`. This does not affect any list of standard include " -"directories that the compiler may search by default." +"subsequent calls to :meth:`add_include_dir` add to the list passed " +"to :meth:`set_include_dirs`. This does not affect any list of standard " +"include directories that the compiler may search by default." msgstr "" "探索されるディレクトリのリストを *dirs* (文字列のリスト)に設定します。先に実" -"行された :meth:`add_include_dir` は上書きされます。後で実行する :meth:" -"`add_include_dir` は :meth:`set_include_dirs` のリストにディレクトリを追加し" -"ます。これはコンパイラがデフォルトで探索する標準インクルードディレクトリには" -"影響しません。" +"行された :meth:`add_include_dir` は上書きされます。後で実行す" +"る :meth:`add_include_dir` は :meth:`set_include_dirs` のリストにディレクトリ" +"を追加します。これはコンパイラがデフォルトで探索する標準インクルードディレク" +"トリには影響しません。" #: ../../distutils/apiref.rst:429 msgid "" @@ -926,8 +928,8 @@ msgstr "" msgid "" "Add *dir* to the list of directories that will be searched for libraries " "specified to :meth:`add_library` and :meth:`set_libraries`. The linker will " -"be instructed to search for libraries in the order they are supplied to :" -"meth:`add_library_dir` and/or :meth:`set_library_dirs`." +"be instructed to search for libraries in the order they are supplied " +"to :meth:`add_library_dir` and/or :meth:`set_library_dirs`." msgstr "" ":meth:`add_library` と :meth:`set_libraries` で指定されたライブラリを探索する" "ディレクトリのリストに *dir* を追加します。リンカは :meth:`add_library_dir` " @@ -981,11 +983,11 @@ msgid "" "precedence." msgstr "" "このコンパイラオブジェクトで実行される全てのコンパイルで利用されるプリプロ" -"セッサのマクロ定義を消します。同じマクロを :meth:`define_macro` で定義し、 :" -"meth:`undefine_macro` で定義を削除した場合、後で呼び出されたものが優先される" -"(複数の再定義と削除を含みます)。もしコンパイルごと(すなわち :meth:`compile` " -"の呼び出しごと)にマクロが再定義/削除される場合も後で呼び出されたものが優先さ" -"れます。" +"セッサのマクロ定義を消します。同じマクロを :meth:`define_macro` で定義" +"し、 :meth:`undefine_macro` で定義を削除した場合、後で呼び出されたものが優先" +"される(複数の再定義と削除を含みます)。もしコンパイルごと(すなわ" +"ち :meth:`compile` の呼び出しごと)にマクロが再定義/削除される場合も後で呼び出" +"されたものが優先されます。" #: ../../distutils/apiref.rst:498 msgid "" @@ -1012,8 +1014,8 @@ msgid "" "The following methods implement methods for autodetection of compiler " "options, providing some functionality similar to GNU :program:`autoconf`." msgstr "" -"以下のメソッドはコンパイラオプションの自動検出を実装しており、 GNU :program:" -"`autoconf` に似たいくつかの機能を提供します。" +"以下のメソッドはコンパイラオプションの自動検出を実装しており、 " +"GNU :program:`autoconf` に似たいくつかの機能を提供します。" #: ../../distutils/apiref.rst:515 msgid "" @@ -1129,8 +1131,8 @@ msgstr "" "コマンドラインをもつプラットフォーム(Unix, DOS/Windows)では、それぞれの文字列" "は実行ファイル名と(省略可能な)引数リストに分割されます。(文字列の分割は Unix " "のシェルが行うものに似ています: 単語はスペースで区切られますが、クォートと" -"バックスラッシュでオーバーライドできます。 :func:`distutils.util." -"split_quoted` をごらんください。)" +"バックスラッシュでオーバーライドできま" +"す。 :func:`distutils.util.split_quoted` をごらんください。)" #: ../../distutils/apiref.rst:580 msgid "The following methods invoke stages in the build process." @@ -1154,12 +1156,12 @@ msgid "" "compiled, but all corresponding object filenames will be returned." msgstr "" "*sources* はファイル名のリストである必要があります。おそらく C/C++ ファイルで" -"すが、実際にはコンパイラとコンパイラクラスで扱えるもの(例: :class:" -"`MSVCCompiler` はリソースファイルを *sources* にとることができます)なら何でも" -"指定できます。 *sources* のソースファイルひとつずつに対応するオブジェクトファ" -"イル名のリストを返します。実装に依存しますが、全てのソースファイルがコンパイ" -"ルされる必要はありません。しかし全ての対応するオブジェクトファイル名が返りま" -"す。" +"すが、実際にはコンパイラとコンパイラクラスで扱えるもの" +"(例: :class:`MSVCCompiler` はリソースファイルを *sources* にとることができま" +"す)なら何でも指定できます。 *sources* のソースファイルひとつずつに対応するオ" +"ブジェクトファイル名のリストを返します。実装に依存しますが、全てのソースファ" +"イルがコンパイルされる必要はありません。しかし全ての対応するオブジェクトファ" +"イル名が返ります。" #: ../../distutils/apiref.rst:595 msgid "" @@ -1241,16 +1243,17 @@ msgstr "失敗すると :exc:`CompileError` を起こします。" msgid "" "Link a bunch of stuff together to create a static library file. The \"bunch " "of stuff\" consists of the list of object files supplied as *objects*, the " -"extra object files supplied to :meth:`add_link_object` and/or :meth:" -"`set_link_objects`, the libraries supplied to :meth:`add_library` and/or :" -"meth:`set_libraries`, and the libraries supplied as *libraries* (if any)." +"extra object files supplied to :meth:`add_link_object` and/" +"or :meth:`set_link_objects`, the libraries supplied to :meth:`add_library` " +"and/or :meth:`set_libraries`, and the libraries supplied as *libraries* (if " +"any)." msgstr "" "静的ライブラリファイルを作るために元ファイル群をリンクします。「元ファイル" "群」は *objects* で指定されたオブジェクトファイルのリストを基礎にしています。" -"追加のオブジェクトファイルを :meth:`add_link_object` および/または :meth:" -"`set_link_objects` で指定し、追加のライブラリを :meth:`add_library` および/ま" -"たは :meth:`set_libraries` で指定します。そして *libraries* で指定されたライ" -"ブラリです。" +"追加のオブジェクトファイルを :meth:`add_link_object` および/また" +"は :meth:`set_link_objects` で指定し、追加のライブラリを :meth:`add_library` " +"および/または :meth:`set_libraries` で指定します。そして *libraries* で指定さ" +"れたライブラリです。" #: ../../distutils/apiref.rst:635 msgid "" @@ -1324,8 +1327,8 @@ msgstr "" msgid "" "*library_dirs*, if supplied, should be a list of directories to search for " "libraries that were specified as bare library names (ie. no directory " -"component). These are on top of the system default and those supplied to :" -"meth:`add_library_dir` and/or :meth:`set_library_dirs`. " +"component). These are on top of the system default and those supplied " +"to :meth:`add_library_dir` and/or :meth:`set_library_dirs`. " "*runtime_library_dirs* is a list of directories that will be embedded into " "the shared library and used to search for other shared libraries that " "\\*it\\* depends on at run-time. (This may only be relevant on Unix.)" @@ -1376,8 +1379,8 @@ msgid "" "are as for the :meth:`link` method." msgstr "" "実行ファイルをリンクします。 *output_progname* は実行ファイルの名前です。 " -"*objects* はリンクされるオブジェクトのファイル名のリストです。他の引数は :" -"meth:`link` メソッドと同じです。" +"*objects* はリンクされるオブジェクトのファイル名のリストです。他の引数" +"は :meth:`link` メソッドと同じです。" #: ../../distutils/apiref.rst:702 msgid "" @@ -1386,8 +1389,8 @@ msgid "" "are as for the :meth:`link` method." msgstr "" "共有ライブラリをリンクします。 *output_libname* は出力先のライブラリ名です。 " -"*objects* はリンクされるオブジェクトのファイル名のリストです。他の引数は :" -"meth:`link` メソッドと同じです。" +"*objects* はリンクされるオブジェクトのファイル名のリストです。他の引数" +"は :meth:`link` メソッドと同じです。" #: ../../distutils/apiref.rst:709 msgid "" @@ -1404,16 +1407,17 @@ msgid "" "Preprocess a single C/C++ source file, named in *source*. Output will be " "written to file named *output_file*, or *stdout* if *output_file* not " "supplied. *macros* is a list of macro definitions as for :meth:`compile`, " -"which will augment the macros set with :meth:`define_macro` and :meth:" -"`undefine_macro`. *include_dirs* is a list of directory names that will be " -"added to the default list, in the same way as :meth:`add_include_dir`." +"which will augment the macros set with :meth:`define_macro` " +"and :meth:`undefine_macro`. *include_dirs* is a list of directory names that " +"will be added to the default list, in the same way " +"as :meth:`add_include_dir`." msgstr "" "*source* で指定されたひとつの C/C++ソースファイルをプリプロセスします。出力先" "のファイルは *output_file* か、もし *output_file* が指定されていなければ " "*stdout* になります。 *macros* は :meth:`compile` と同様にマクロ定義のリスト" "で、 :meth:`define_macro` や :meth:`undefine_macro` によって引数になります。 " -"*include_dirs* はデフォルトのリストに追加されるディレクトリ名のリストで、 :" -"meth:`add_include_dir` と同じ方法で扱われます。" +"*include_dirs* はデフォルトのリストに追加されるディレクトリ名のリスト" +"で、 :meth:`add_include_dir` と同じ方法で扱われます。" #: ../../distutils/apiref.rst:723 msgid "Raises :exc:`PreprocessError` on failure." @@ -1424,8 +1428,8 @@ msgid "" "The following utility methods are defined by the :class:`CCompiler` class, " "for use by the various concrete subclasses." msgstr "" -"以下のユーティリティメソッドは具体的なサブクラスで使うために、 :class:" -"`CCompiler` クラスで定義されています。" +"以下のユーティリティメソッドは具体的なサブクラスで使うため" +"に、 :class:`CCompiler` クラスで定義されています。" #: ../../distutils/apiref.rst:731 msgid "" @@ -1515,12 +1519,13 @@ msgstr ":mod:`distutils.unixccompiler` --- Unix C コンパイラ" #: ../../distutils/apiref.rst:809 msgid "" -"This module provides the :class:`UnixCCompiler` class, a subclass of :class:" -"`CCompiler` that handles the typical Unix-style command-line C compiler:" +"This module provides the :class:`UnixCCompiler` class, a subclass " +"of :class:`CCompiler` that handles the typical Unix-style command-line C " +"compiler:" msgstr "" -"このモジュールは :class:`UnixCCompiler` クラスを提供します。 :class:" -"`CCompiler` クラスのサブクラスで、典型的なUnixスタイルのコマンドラインCコンパ" -"イラを扱います:" +"このモジュールは :class:`UnixCCompiler` クラスを提供しま" +"す。 :class:`CCompiler` クラスのサブクラスで、典型的なUnixスタイルのコマンド" +"ラインCコンパイラを扱います:" #: ../../distutils/apiref.rst:812 msgid "macros defined with :option:`!-Dname[=value]`" @@ -1553,8 +1558,8 @@ msgstr "" #: ../../distutils/apiref.rst:825 msgid "" -"link static library handled by :program:`ar` command (possibly with :program:" -"`ranlib`)" +"link static library handled by :program:`ar` command (possibly " +"with :program:`ranlib`)" msgstr "" "静的ライブラリは :program:`ar` コマンドで処理されます (:program:`ranlib` を使" "うかもしれません)" @@ -1576,11 +1581,12 @@ msgid "" "to compile Python. For Python 2.3 and earlier, the compiler was Visual " "Studio 6. For Python 2.4 and 2.5, the compiler is Visual Studio .NET 2003." msgstr "" -"このモジュールは :class:`MSVCCompiler` クラスを提供します。抽象クラス :class:" -"`CCompiler` の具象クラスでMicrosoft Visual Studio向けのものです。一般的に、拡" -"張モジュールはPythonをコンパイルしたのと同じコンパイラでコンパイルする必要が" -"あります。Python 2.3 やそれ以前では、コンパイラはVisual Studio 6でした。 " -"Python 2.4 と Python 2.5 では、コンパイラは Visual Studio .NET 2003 です。" +"このモジュールは :class:`MSVCCompiler` クラスを提供します。抽象クラ" +"ス :class:`CCompiler` の具象クラスでMicrosoft Visual Studio向けのものです。一" +"般的に、拡張モジュールはPythonをコンパイルしたのと同じコンパイラでコンパイル" +"する必要があります。Python 2.3 やそれ以前では、コンパイラはVisual Studio 6で" +"した。 Python 2.4 と Python 2.5 では、コンパイラは Visual Studio .NET 2003 で" +"す。" #: ../../distutils/apiref.rst:845 msgid "" @@ -1596,8 +1602,8 @@ msgstr "" "択を上書きするためには、環境変数 *DISTUTILS_USE_SDK* と *MSSdk* の両方を設定" "する必要があります。 *MSSdk* は現在の環境をセットアップした ``SetEnv.Cmd`` ス" "クリプト、もしくは環境変数がSDKをインストールした時に登録されたものであること" -"を示します。 *DISTUTILS_USE_SDK* はdistutilsのユーザーが明示的に :class:" -"`MSVCCompiler` が選んだコンパイラを上書きすることを示します。" +"を示します。 *DISTUTILS_USE_SDK* はdistutilsのユーザーが明示的" +"に :class:`MSVCCompiler` が選んだコンパイラを上書きすることを示します。" #: ../../distutils/apiref.rst:855 msgid ":mod:`distutils.bcppcompiler` --- Borland Compiler" @@ -1605,11 +1611,11 @@ msgstr ":mod:`distutils.bcppcompiler` --- Borland コンパイラ" #: ../../distutils/apiref.rst:860 msgid "" -"This module provides :class:`BorlandCCompiler`, a subclass of the abstract :" -"class:`CCompiler` class for the Borland C++ compiler." +"This module provides :class:`BorlandCCompiler`, a subclass of the " +"abstract :class:`CCompiler` class for the Borland C++ compiler." msgstr "" -"このモジュールは :class:`BorlandCCompiler` クラスを提供します。抽象クラス :" -"class:`CCompiler` の具象クラスでBorland C++ コンパイラ向けです。" +"このモジュールは :class:`BorlandCCompiler` クラスを提供します。抽象クラ" +"ス :class:`CCompiler` の具象クラスでBorland C++ コンパイラ向けです。" #: ../../distutils/apiref.rst:865 msgid ":mod:`distutils.cygwincompiler` --- Cygwin Compiler" @@ -1617,15 +1623,15 @@ msgstr ":mod:`distutils.cygwincompiler` --- Cygwin コンパイラ" #: ../../distutils/apiref.rst:870 msgid "" -"This module provides the :class:`CygwinCCompiler` class, a subclass of :" -"class:`UnixCCompiler` that handles the Cygwin port of the GNU C compiler to " -"Windows. It also contains the Mingw32CCompiler class which handles the " +"This module provides the :class:`CygwinCCompiler` class, a subclass " +"of :class:`UnixCCompiler` that handles the Cygwin port of the GNU C compiler " +"to Windows. It also contains the Mingw32CCompiler class which handles the " "mingw32 port of GCC (same as cygwin in no-cygwin mode)." msgstr "" -"このモジュールは :class:`CygwinCCompiler` クラスを提供します。 :class:" -"`UnixCCompiler` のサブクラスで Cygwinに移植されたWindows用の GNU C コンパイラ" -"向けです。さらに Mingw32CCompiler クラスを含んでおり、これは mingw32 向けに移" -"植された GCC (cygwinの no-cygwin モードと同じ)向けです。" +"このモジュールは :class:`CygwinCCompiler` クラスを提供しま" +"す。 :class:`UnixCCompiler` のサブクラスで Cygwinに移植されたWindows用の GNU " +"C コンパイラ向けです。さらに Mingw32CCompiler クラスを含んでおり、これは " +"mingw32 向けに移植された GCC (cygwinの no-cygwin モードと同じ)向けです。" #: ../../distutils/apiref.rst:877 msgid ":mod:`distutils.archive_util` --- Archiving utilities" @@ -1680,8 +1686,8 @@ msgstr "" "``'bzip2'`` または ``None`` である必要があります。 ``'compress'`` メソッドに" "ついては、 :program:`compress` で指定される圧縮ユーティリティにパスが通ってい" "る必要があるので、おそらくこれは Unix だけで有効でしょう。出力 tar ファイル" -"は :file:`base_dir.tar` という名前になり、圧縮によって拡張子が付きます(``." -"gz``, ``.bz2``, ``.xz`` または ``.Z``)。出力ファイル名が返ります。" +"は :file:`base_dir.tar` という名前になり、圧縮によって拡張子が付きます" +"(``.gz``, ``.bz2``, ``.xz`` または ``.Z``)。出力ファイル名が返ります。" #: ../../distutils/apiref.rst:914 msgid "Added support for the ``xz`` compression." @@ -1690,17 +1696,17 @@ msgstr "``xz`` 形式のサポートが追加されました。" #: ../../distutils/apiref.rst:920 msgid "" "Create a zip file from all files in and under *base_dir*. The output zip " -"file will be named *base_name* + :file:`.zip`. Uses either the :mod:" -"`zipfile` Python module (if available) or the InfoZIP :file:`zip` utility " -"(if installed and found on the default search path). If neither tool is " -"available, raises :exc:`DistutilsExecError`. Returns the name of the " -"output zip file." +"file will be named *base_name* + :file:`.zip`. Uses either " +"the :mod:`zipfile` Python module (if available) or the InfoZIP :file:`zip` " +"utility (if installed and found on the default search path). If neither " +"tool is available, raises :exc:`DistutilsExecError`. Returns the name of " +"the output zip file." msgstr "" "*base_dir* 以下の全ファイルから、zipファイルを作成します。出力されるzipファイ" "ルは *base_name* + :file:`.zip` という名前になります。 :mod:`zipfile` Python" "モジュール(利用可能なら)またはInfoZIP :file:`zip` ユーティリティ(インストール" -"されていてパスが通っているなら)を使います。もしどちらも利用できなければ、 :" -"exc:`DistutilsExecError` が起きます。出力zipファイル名が返ります。" +"されていてパスが通っているなら)を使います。もしどちらも利用できなけれ" +"ば、 :exc:`DistutilsExecError` が起きます。出力zipファイル名が返ります。" #: ../../distutils/apiref.rst:928 msgid ":mod:`distutils.dep_util` --- Dependency checking" @@ -1720,8 +1726,8 @@ msgstr "" msgid "" "Return true if *source* exists and is more recently modified than *target*, " "or if *source* exists and *target* doesn't. Return false if both exist and " -"*target* is the same age or newer than *source*. Raise :exc:" -"`DistutilsFileError` if *source* does not exist." +"*target* is the same age or newer than *source*. " +"Raise :exc:`DistutilsFileError` if *source* does not exist." msgstr "" "*source* が存在して、 *target* より最近変更されている、または *source* が存在" "して、 *target* が存在していない場合は真を返します。両方が存在していて、 " @@ -1732,8 +1738,8 @@ msgstr "" msgid "" "Walk two filename lists in parallel, testing if each source is newer than " "its corresponding target. Return a pair of lists (*sources*, *targets*) " -"where source is newer than target, according to the semantics of :func:" -"`newer`." +"where source is newer than target, according to the semantics " +"of :func:`newer`." msgstr "" "ふたつのファイル名リストを並列に探索して、それぞれのソースが対応するターゲッ" "トより新しいかをテストします。 :func:`newer` の意味でターゲットよりソースが新" @@ -1779,11 +1785,11 @@ msgstr "" msgid "" "Create a directory and any missing ancestor directories. If the directory " "already exists (or if *name* is the empty string, which means the current " -"directory, which of course exists), then do nothing. Raise :exc:" -"`DistutilsFileError` if unable to create some directory along the way (eg. " -"some sub-path exists, but is a file rather than a directory). If *verbose* " -"is true, print a one-line summary of each mkdir to stdout. Return the list " -"of directories actually created." +"directory, which of course exists), then do nothing. " +"Raise :exc:`DistutilsFileError` if unable to create some directory along the " +"way (eg. some sub-path exists, but is a file rather than a directory). If " +"*verbose* is true, print a one-line summary of each mkdir to stdout. Return " +"the list of directories actually created." msgstr "" "ディレクトリと、必要な親ディレクトリを作成します。もしディレクトリが既に存在" "している(*name* が空文字列の場合、カレントディレクトリを示すのでもちろん存在" @@ -1810,32 +1816,32 @@ msgstr "" #: ../../distutils/apiref.rst:1004 msgid "" "Copy an entire directory tree *src* to a new location *dst*. Both *src* and " -"*dst* must be directory names. If *src* is not a directory, raise :exc:" -"`DistutilsFileError`. If *dst* does not exist, it is created with :func:" -"`mkpath`. The end result of the copy is that every file in *src* is copied " -"to *dst*, and directories under *src* are recursively copied to *dst*. " -"Return the list of files that were copied or might have been copied, using " -"their output name. The return value is unaffected by *update* or *dry_run*: " -"it is simply the list of all files under *src*, with the names changed to be " -"under *dst*." +"*dst* must be directory names. If *src* is not a directory, " +"raise :exc:`DistutilsFileError`. If *dst* does not exist, it is created " +"with :func:`mkpath`. The end result of the copy is that every file in " +"*src* is copied to *dst*, and directories under *src* are recursively " +"copied to *dst*. Return the list of files that were copied or might have " +"been copied, using their output name. The return value is unaffected by " +"*update* or *dry_run*: it is simply the list of all files under *src*, with " +"the names changed to be under *dst*." msgstr "" "*src* ディレクトリツリー全体を *dst* にコピーします。 *src* と *dst* はどちら" -"もディレクトリ名である必要があります。もし *src* がディレクトリでなければ、 :" -"exc:`DistutilsFileError` を起こします。もし *dst* が存在しなければ、 :func:" -"`mkpath` で作成されます。実行結果は、 *src* 以下の全てのファイルが *dst* にコ" -"ピーされ、 *src* 以下の全てのディレクトリが *dst* に再帰的にコピーされます。" -"コピーされた(またはされるはず)のファイルのリストを返します。返り値は " -"*update* または *dry_run* に影響されません: *src* 以下の全ファイルを単に " -"*dst* 以下に改名したリストが返されます。" +"もディレクトリ名である必要があります。もし *src* がディレクトリでなけれ" +"ば、 :exc:`DistutilsFileError` を起こします。もし *dst* が存在しなけれ" +"ば、 :func:`mkpath` で作成されます。実行結果は、 *src* 以下の全てのファイル" +"が *dst* にコピーされ、 *src* 以下の全てのディレクトリが *dst* に再帰的にコ" +"ピーされます。コピーされた(またはされるはず)のファイルのリストを返します。返" +"り値は *update* または *dry_run* に影響されません: *src* 以下の全ファイルを単" +"に *dst* 以下に改名したリストが返されます。" #: ../../distutils/apiref.rst:1014 msgid "" -"*preserve_mode* and *preserve_times* are the same as for :func:`distutils." -"file_util.copy_file`; note that they only apply to regular files, not to " -"directories. If *preserve_symlinks* is true, symlinks will be copied as " -"symlinks (on platforms that support them!); otherwise (the default), the " -"destination of the symlink will be copied. *update* and *verbose* are the " -"same as for :func:`copy_file`." +"*preserve_mode* and *preserve_times* are the same as " +"for :func:`distutils.file_util.copy_file`; note that they only apply to " +"regular files, not to directories. If *preserve_symlinks* is true, symlinks " +"will be copied as symlinks (on platforms that support them!); otherwise (the " +"default), the destination of the symlink will be copied. *update* and " +"*verbose* are the same as for :func:`copy_file`." msgstr "" "*preserve_mode* と *preserve_times* は :func:`distutils.file_util.copy_file` " "のものと同じです; それらは通常のファイルにのみ適用され、ディレクトリには適用" @@ -1847,8 +1853,8 @@ msgstr "" #: ../../distutils/apiref.rst:1022 msgid "" "Files in *src* that begin with :file:`.nfs` are skipped (more information on " -"these files is available in answer D2 of the `NFS FAQ page `_)." +"these files is available in answer D2 of the `NFS FAQ page `_)." msgstr "" #: ../../distutils/apiref.rst:1026 @@ -1905,12 +1911,12 @@ msgid "" "to copy file contents." msgstr "" "*link* は値を ``'hard'`` または ``'sym'`` に設定することでコピーのかわりに" -"ハードリンク(:func:`os.link` を使います)またはシンボリックリンク(:func:`os." -"symlink` を使います)を許可します。 ``None`` (デフォルト)の時には、ファイルは" -"コピーされます。 *link* をサポートしていないシステムで有効にしないでくださ" -"い。 :func:`copy_file` はハードリンク、シンボリックリンクが可能かチェックして" -"いません。ファイルの内容をコピーするために :func:`_copy_file_contents` を利用" -"しています。" +"ハードリンク(:func:`os.link` を使います)またはシンボリックリンク" +"(:func:`os.symlink` を使います)を許可します。 ``None`` (デフォルト)の時に" +"は、ファイルはコピーされます。 *link* をサポートしていないシステムで有効にし" +"ないでください。 :func:`copy_file` はハードリンク、シンボリックリンクが可能か" +"チェックしていません。ファイルの内容をコピーするため" +"に :func:`_copy_file_contents` を利用しています。" #: ../../distutils/apiref.rst:1064 msgid "" @@ -2136,25 +2142,25 @@ msgid "" ":envvar:`PLAT` - description of the current platform, including hardware and " "OS (see :func:`get_platform`)" msgstr "" -":envvar:`PLAT` - ハードウェアとOSを含む現在のプラットフォームの説明。 (:func:" -"`get_platform` を参照)" +":envvar:`PLAT` - ハードウェアとOSを含む現在のプラットフォームの説明。 " +"(:func:`get_platform` を参照)" #: ../../distutils/apiref.rst:1194 msgid "" "Perform shell/Perl-style variable substitution on *s*. Every occurrence of " "``$`` followed by a name is considered a variable, and variable is " -"substituted by the value found in the *local_vars* dictionary, or in ``os." -"environ`` if it's not in *local_vars*. *os.environ* is first checked/" -"augmented to guarantee that it contains certain values: see :func:" -"`check_environ`. Raise :exc:`ValueError` for any variables not found in " -"either *local_vars* or ``os.environ``." +"substituted by the value found in the *local_vars* dictionary, or in " +"``os.environ`` if it's not in *local_vars*. *os.environ* is first checked/" +"augmented to guarantee that it contains certain values: " +"see :func:`check_environ`. Raise :exc:`ValueError` for any variables not " +"found in either *local_vars* or ``os.environ``." msgstr "" "shell/Perlスタイルの変数置換を *s* について行います。全ての ``$`` に名前が続" "いたものは変数とみなされ、辞書 *local_vars* でみつかった値に置換されます。 " -"*local_vars* で見つからなかった場合には ``os.environ`` で置換されます。 *os." -"environ* は最初にある値を含んでいることをチェックされます: :func:" -"`check_environ` を参照。 *local_vars* or ``os.environ`` のどちらにも値が見つ" -"からなかった場合、 :exc:`ValueError` を起こします。" +"*local_vars* で見つからなかった場合には ``os.environ`` で置換されます。 " +"*os.environ* は最初にある値を含んでいることをチェックされま" +"す: :func:`check_environ` を参照。 *local_vars* or ``os.environ`` のどちらに" +"も値が見つからなかった場合、 :exc:`ValueError` を起こします。" #: ../../distutils/apiref.rst:1201 msgid "" @@ -2205,8 +2211,8 @@ msgstr "真偽値をあらわす文字列を真(1)または偽(0)に変換しま #: ../../distutils/apiref.rst:1232 msgid "" "True values are ``y``, ``yes``, ``t``, ``true``, ``on`` and ``1``; false " -"values are ``n``, ``no``, ``f``, ``false``, ``off`` and ``0``. Raises :exc:" -"`ValueError` if *val* is anything else." +"values are ``n``, ``no``, ``f``, ``false``, ``off`` and ``0``. " +"Raises :exc:`ValueError` if *val* is anything else." msgstr "" "真の値は ``y``, ``yes``, ``t``, ``true``, ``on`` そして ``1`` です。偽の値は " "``n``, ``no``, ``f``, ``false``, ``off`` そして ``0`` です。 *val* が上のど" @@ -2214,10 +2220,11 @@ msgstr "" #: ../../distutils/apiref.rst:1239 msgid "" -"Byte-compile a collection of Python source files to :file:`.pyc` files in a :" -"file:`__pycache__` subdirectory (see :pep:`3147` and :pep:`488`). *py_files* " -"is a list of files to compile; any files that don't end in :file:`.py` are " -"silently skipped. *optimize* must be one of the following:" +"Byte-compile a collection of Python source files to :file:`.pyc` files in " +"a :file:`__pycache__` subdirectory (see :pep:`3147` and :pep:`488`). " +"*py_files* is a list of files to compile; any files that don't end " +"in :file:`.py` are silently skipped. *optimize* must be one of the " +"following:" msgstr "" "Python ソースファイル群をバイトコンパイルして :file:`__pycache__` サブディレ" "クトリ内に :file:`.pyc` ファイルを出力します。(:pep:`3147` と :pep:`488` を参" @@ -2396,19 +2403,19 @@ msgid "" "is the \"negative alias\" of :option:`!--verbose`, then :option:`!--quiet` " "on the command line sets *verbose* to false." msgstr "" -"真偽値をとるオプションは \"負のエイリアス\" を持ちます。--- たとえば :option:" -"`!--quiet` の \"負のエイリアス\" が :option:`!--verbose` の場合、コマンドライ" -"ンで :option:`!--quiet` を指定すると *verbose* は偽になります。" +"真偽値をとるオプションは \"負のエイリアス\" を持ちます。--- たとえ" +"ば :option:`!--quiet` の \"負のエイリアス\" が :option:`!--verbose` の場合、" +"コマンドラインで :option:`!--quiet` を指定すると *verbose* は偽になります。" #: ../../distutils/apiref.rst:1362 msgid "" "Wrapper function. *options* is a list of ``(long_option, short_option, " -"help_string)`` 3-tuples as described in the constructor for :class:" -"`FancyGetopt`. *negative_opt* should be a dictionary mapping option names to " -"option names, both the key and value should be in the *options* list. " -"*object* is an object which will be used to store values (see the :meth:" -"`getopt` method of the :class:`FancyGetopt` class). *args* is the argument " -"list. Will use ``sys.argv[1:]`` if you pass ``None`` as *args*." +"help_string)`` 3-tuples as described in the constructor " +"for :class:`FancyGetopt`. *negative_opt* should be a dictionary mapping " +"option names to option names, both the key and value should be in the " +"*options* list. *object* is an object which will be used to store values " +"(see the :meth:`getopt` method of the :class:`FancyGetopt` class). *args* is " +"the argument list. Will use ``sys.argv[1:]`` if you pass ``None`` as *args*." msgstr "" "ラッパ関数。 *options* は :class:`FancyGetopt` のコンストラクタで説明されてい" "る ``(long_option, short_option, help_string)`` の3要素タプルのリストです。 " @@ -2463,8 +2470,8 @@ msgid "" "passed-in *args* list, which is left untouched." msgstr "" "もし *args* が ``None`` もしくは与えられない場合には、 ``sys.argv[1:]`` を使" -"います。もし *object* が ``None`` もしくは与えられない場合には、新しく :" -"class:`OptionDummy` インスタンスを作成し、オプションの値を保存したのち " +"います。もし *object* が ``None`` もしくは与えられない場合には、新し" +"く :class:`OptionDummy` インスタンスを作成し、オプションの値を保存したのち " "``(args, object)`` のタプルを返します。もし *object* が提供されていれば、その" "場で変更され、 :func:`getopt` は *args* のみを返します。どちらのケースでも、" "返された *args* は渡された *args* リスト(これは変更されません)の変更されたコ" @@ -2521,8 +2528,8 @@ msgid "" msgstr "" "このモジュールは :func:`spawn` 関数を提供します。これは様々なプラットフォーム" "依存の他プログラムをサブプロセスとして実行する関数に対するフロントエンドに" -"なっています。与えられた実行ファイルの名前からパスを探索する :func:" -"`find_executable` 関数も提供しています。" +"なっています。与えられた実行ファイルの名前からパスを探索す" +"る :func:`find_executable` 関数も提供しています。" #: ../../distutils/apiref.rst:1451 msgid ":mod:`distutils.sysconfig` --- System configuration information" @@ -2546,10 +2553,10 @@ msgstr "" ":mod:`distutils.sysconfig` モジュールでは、 Python の低水準の設定情報へのアク" "セス手段を提供しています。アクセスできる設定情報変数は、プラットフォームと設" "定自体に大きく左右されます。また、特定の変数は、使っているバージョンの " -"Python のビルドプロセスに左右されます; こうした変数は、 Unix システムでは、 :" -"file:`Makefile` や Python と一緒にインストールされる設定ヘッダから探し出され" -"ます。設定ファイルのヘッダは、2.2 以降のバージョンでは :file:`pyconfig.h` 、" -"それ以前のバージョンでは :file:`config.h` です。" +"Python のビルドプロセスに左右されます; こうした変数は、 Unix システムで" +"は、 :file:`Makefile` や Python と一緒にインストールされる設定ヘッダから探し" +"出されます。設定ファイルのヘッダは、2.2 以降のバージョンで" +"は :file:`pyconfig.h` 、それ以前のバージョンでは :file:`config.h` です。" #: ../../distutils/apiref.rst:1471 msgid "" @@ -2596,10 +2603,10 @@ msgid "" "platforms the header will have been supplied directly by the Python source " "distribution. The file is a platform-specific text file." msgstr "" -"設定ヘッダのフルパス名を返します。 Unixの場合、このヘッダファイルは :program:" -"`configure` スクリプトによって生成されるヘッダファイル名です; 他のプラット" -"フォームでは、ヘッダは Python ソース配布物中で直接与えられています。ファイル" -"はプラットフォーム固有のテキストファイルです。" +"設定ヘッダのフルパス名を返します。 Unixの場合、このヘッダファイル" +"は :program:`configure` スクリプトによって生成されるヘッダファイル名です; 他" +"のプラットフォームでは、ヘッダは Python ソース配布物中で直接与えられていま" +"す。ファイルはプラットフォーム固有のテキストファイルです。" #: ../../distutils/apiref.rst:1510 msgid "" @@ -2625,8 +2632,8 @@ msgid "" "Return the directory for either the general or platform-dependent C include " "files. If *plat_specific* is true, the platform-dependent include directory " "is returned; if false or omitted, the platform-independent directory is " -"returned. If *prefix* is given, it is used as either the prefix instead of :" -"const:`PREFIX`, or as the exec-prefix instead of :const:`EXEC_PREFIX` if " +"returned. If *prefix* is given, it is used as either the prefix instead " +"of :const:`PREFIX`, or as the exec-prefix instead of :const:`EXEC_PREFIX` if " "*plat_specific* is true." msgstr "" "C インクルードファイルディレクトリについて、一般的なディレクトリ名か、プラッ" @@ -2643,10 +2650,10 @@ msgid "" "installation. If *plat_specific* is true, the platform-dependent include " "directory is returned; if false or omitted, the platform-independent " "directory is returned. If *prefix* is given, it is used as either the " -"prefix instead of :const:`PREFIX`, or as the exec-prefix instead of :const:" -"`EXEC_PREFIX` if *plat_specific* is true. If *standard_lib* is true, the " -"directory for the standard library is returned rather than the directory for " -"the installation of third-party extensions." +"prefix instead of :const:`PREFIX`, or as the exec-prefix instead " +"of :const:`EXEC_PREFIX` if *plat_specific* is true. If *standard_lib* is " +"true, the directory for the standard library is returned rather than the " +"directory for the installation of third-party extensions." msgstr "" "ライブラリディレクトリについて、一般的なディレクトリ名か、プラットフォーム依" "存のディレクトリ名のいずれかを返します。 *plat_specific* が真であれば、プラッ" @@ -2666,8 +2673,8 @@ msgstr "" #: ../../distutils/apiref.rst:1546 msgid "" -"Do any platform-specific customization of a :class:`distutils.ccompiler." -"CCompiler` instance." +"Do any platform-specific customization of " +"a :class:`distutils.ccompiler.CCompiler` instance." msgstr "" ":class:`distutils.ccompiler.CCompiler` インスタンスに対して、プラットフォーム" "固有のカスタマイズを行います。" @@ -2751,24 +2758,24 @@ msgstr "" msgid "" ":class:`TextFile` instances are create with either *filename*, *file*, or " "both. :exc:`RuntimeError` is raised if both are ``None``. *filename* should " -"be a string, and *file* a file object (or something that provides :meth:" -"`readline` and :meth:`close` methods). It is recommended that you supply " -"at least *filename*, so that :class:`TextFile` can include it in warning " -"messages. If *file* is not supplied, :class:`TextFile` creates its own " -"using the :func:`open` built-in function." +"be a string, and *file* a file object (or something that " +"provides :meth:`readline` and :meth:`close` methods). It is recommended " +"that you supply at least *filename*, so that :class:`TextFile` can include " +"it in warning messages. If *file* is not supplied, :class:`TextFile` " +"creates its own using the :func:`open` built-in function." msgstr "" ":class:`TextFile` のインスタンスは *filename*, *file*,またはその両方をとって" "作成されます。両方が ``None`` の場合 :exc:`RuntimeError` が起きます。 " "*filename* は文字列、 *file* はファイルオブジェクト(または :meth:`readline` " -"と :meth:`close` のメソッドを提供する何か) である必要があります。 :class:" -"`TextFile` が生成する警告メッセージに含めることができるので、 *filename* を与" -"えることが推奨されます、もし *file* が提供されなければ、 :class:`TextFile` は" -"組み込みの :func:`open` を利用して自分で作成します。" +"と :meth:`close` のメソッドを提供する何か) である必要がありま" +"す。 :class:`TextFile` が生成する警告メッセージに含めることができるので、 " +"*filename* を与えることが推奨されます、もし *file* が提供されなけれ" +"ば、 :class:`TextFile` は組み込みの :func:`open` を利用して自分で作成します。" #: ../../distutils/apiref.rst:1601 msgid "" -"The options are all boolean, and affect the values returned by :meth:" -"`readline`" +"The options are all boolean, and affect the values returned " +"by :meth:`readline`" msgstr "オプションは全て真偽値で、 :meth:`readline` で返される値に影響します。" #: ../../distutils/apiref.rst:1606 @@ -2864,10 +2871,10 @@ msgstr "" #: ../../distutils/apiref.rst:1650 msgid "" "Note that since *rstrip_ws* can strip the trailing newline, the semantics " -"of :meth:`readline` must differ from those of the built-in file object's :" -"meth:`readline` method! In particular, :meth:`readline` returns ``None`` " -"for end-of-file: an empty string might just be a blank line (or an all-" -"whitespace line), if *rstrip_ws* is true but *skip_blanks* is not." +"of :meth:`readline` must differ from those of the built-in file " +"object's :meth:`readline` method! In particular, :meth:`readline` returns " +"``None`` for end-of-file: an empty string might just be a blank line (or an " +"all-whitespace line), if *rstrip_ws* is true but *skip_blanks* is not." msgstr "" "*rstrip_ws* は行末の改行を削除するので、 :meth:`readline` のセマンティクスが" "組み込みファイルオブジェクトの :meth:`readline` メソッドとは変わってしまいま" @@ -2909,13 +2916,13 @@ msgstr "" #: ../../distutils/apiref.rst:1681 msgid "" "Read and return a single logical line from the current file (or from an " -"internal buffer if lines have previously been \"unread\" with :meth:" -"`unreadline`). If the *join_lines* option is true, this may involve " -"reading multiple physical lines concatenated into a single string. Updates " -"the current line number, so calling :meth:`warn` after :meth:`readline` " -"emits a warning about the physical line(s) just read. Returns ``None`` on " -"end-of-file, since the empty string can occur if *rstrip_ws* is true but " -"*strip_blanks* is not." +"internal buffer if lines have previously been \"unread\" " +"with :meth:`unreadline`). If the *join_lines* option is true, this may " +"involve reading multiple physical lines concatenated into a single string. " +"Updates the current line number, so calling :meth:`warn` " +"after :meth:`readline` emits a warning about the physical line(s) just " +"read. Returns ``None`` on end-of-file, since the empty string can occur if " +"*rstrip_ws* is true but *strip_blanks* is not." msgstr "" "現在のファイル(または :meth:`unreadline` で\"unread\"を直前に行っていればバッ" "ファ)から論理行を1行読み込んで返します。もし *join_lines* オプションが真な" @@ -2936,11 +2943,11 @@ msgstr "" msgid "" "Push *line* (a string) onto an internal buffer that will be checked by " "future :meth:`readline` calls. Handy for implementing a parser with line-at-" -"a-time lookahead. Note that lines that are \"unread\" with :meth:" -"`unreadline` are not subsequently re-cleansed (whitespace stripped, or " -"whatever) when read with :meth:`readline`. If multiple calls are made to :" -"meth:`unreadline` before a call to :meth:`readline`, the lines will be " -"returned most in most recent first order." +"a-time lookahead. Note that lines that are \"unread\" " +"with :meth:`unreadline` are not subsequently re-cleansed (whitespace " +"stripped, or whatever) when read with :meth:`readline`. If multiple calls " +"are made to :meth:`unreadline` before a call to :meth:`readline`, the lines " +"will be returned most in most recent first order." msgstr "" "*line* (文字列)を次の :meth:`readline` 用に、内部バッファにpushします。行の先" "読みを必要とするパーサを実装する時に便利です。 :meth:`unreadline` で" @@ -2965,8 +2972,8 @@ msgid "" "Abstract base class for defining command classes, the \"worker bees\" of the " "Distutils. A useful analogy for command classes is to think of them as " "subroutines with local variables called *options*. The options are declared " -"in :meth:`initialize_options` and defined (given their final values) in :" -"meth:`finalize_options`, both of which must be defined by every command " +"in :meth:`initialize_options` and defined (given their final values) " +"in :meth:`finalize_options`, both of which must be defined by every command " "class. The distinction between the two is necessary because option values " "might come from the outside world (command line, config file, ...), and any " "options dependent on other options must be computed after these outside " @@ -2988,8 +2995,8 @@ msgstr "" #: ../../distutils/apiref.rst:1747 msgid "" -"The class constructor takes a single argument *dist*, a :class:`~distutils." -"core.Distribution` instance." +"The class constructor takes a single argument *dist*, " +"a :class:`~distutils.core.Distribution` instance." msgstr "" "このクラスのコンストラクタは、 :class:`~distutils.core.Distribution` インスタ" "ンス *dist* 1 つを引数に取ります。" @@ -3006,24 +3013,25 @@ msgstr "" #: ../../distutils/apiref.rst:1756 msgid "" "A new command lives in a module in the :mod:`distutils.command` package. " -"There is a sample template in that directory called :file:" -"`command_template`. Copy this file to a new module with the same name as " -"the new command you're implementing. This module should implement a class " -"with the same name as the module (and the command). So, for instance, to " -"create the command ``peel_banana`` (so that users can run ``setup.py " -"peel_banana``), you'd copy :file:`command_template` to :file:`distutils/" -"command/peel_banana.py`, then edit it so that it's implementing the class :" -"class:`peel_banana`, a subclass of :class:`distutils.cmd.Command`." +"There is a sample template in that directory " +"called :file:`command_template`. Copy this file to a new module with the " +"same name as the new command you're implementing. This module should " +"implement a class with the same name as the module (and the command). So, " +"for instance, to create the command ``peel_banana`` (so that users can run " +"``setup.py peel_banana``), you'd copy :file:`command_template` " +"to :file:`distutils/command/peel_banana.py`, then edit it so that it's " +"implementing the class :class:`peel_banana`, a subclass " +"of :class:`distutils.cmd.Command`." msgstr "" "新しいコマンドは :mod:`distutils.command` パッケージ中のモジュールに作られま" "す。 :file:`command_template` というディレクトリにサンプルのテンプレートがあ" "ります。このファイルを実装しようとしているコマンドと同名の新しいモジュールに" "コピーしてください。このモジュールはモジュール(とコマンド)と同じ名前のクラス" "を実装する必要があります。そのため、 ``peel_banana`` コマンド(ユーザは " -"``setup.py peel_banana`` と実行できます)を実装する際には、 :file:" -"`command_template` を :file:`distutils/command/peel_banana.py` にコピーし、 :" -"class:`distutils.cmd.Command` のサブクラス :class:`peel_banana` クラスを実装" -"するように編集してください。" +"``setup.py peel_banana`` と実行できます)を実装する際に" +"は、 :file:`command_template` を :file:`distutils/command/peel_banana.py` に" +"コピーし、 :class:`distutils.cmd.Command` のサブクラス :class:`peel_banana` " +"クラスを実装するように編集してください。" #: ../../distutils/apiref.rst:1766 msgid "Subclasses of :class:`Command` must define the following methods." @@ -3035,9 +3043,9 @@ msgid "" "Set default values for all the options that this command supports. Note " "that these defaults may be overridden by other commands, by the setup " "script, by config files, or by the command-line. Thus, this is not the " -"place to code dependencies between options; generally, :meth:" -"`initialize_options` implementations are just a bunch of ``self.foo = None`` " -"assignments." +"place to code dependencies between options; " +"generally, :meth:`initialize_options` implementations are just a bunch of " +"``self.foo = None`` assignments." msgstr "" "このコマンドがサポートする全てのオプションのデフォルト値を設定します。これら" "のデフォルトは他のコマンドやセットアップスクリプト、設定ファイル、コマンドラ" @@ -3057,9 +3065,9 @@ msgstr "" "このコマンドがサポートする全てのオプションの最終的な値を設定します。これは可" "能な限り遅く呼び出されます。つまりコマンドラインや他のコマンドによるオプショ" "ンの代入のあとに呼び出されます。そのため、オプション間の依存関係を記述するの" -"に適した場所です。もし *foo* が *bar* に依存しており、かつまだ *foo* が :" -"meth:`initialize_options` で定義された値のままなら、 *foo* を *bar* から代入" -"しても安全です。" +"に適した場所です。もし *foo* が *bar* に依存しており、かつまだ *foo* " +"が :meth:`initialize_options` で定義された値のままなら、 *foo* を *bar* から" +"代入しても安全です。" #: ../../distutils/apiref.rst:1789 msgid "" @@ -3069,11 +3077,11 @@ msgid "" "files, and finalized in :meth:`finalize_options`. All terminal output and " "filesystem interaction should be done by :meth:`run`." msgstr "" -"コマンドの本体です。実行するべきアクションを実装しています。 :meth:" -"`initialize_options` で初期化され、他のコマンドされ、セットアップスクリプト、" -"コマンドライン、設定ファイルでカスタマイズされ、 :meth:`finalize_options` で" -"設定されたオプションがアクションを制御します。端末への出力とファイルシステム" -"とのやりとりは全て :meth:`run` が行います。" +"コマンドの本体です。実行するべきアクションを実装していま" +"す。 :meth:`initialize_options` で初期化され、他のコマンドされ、セットアップ" +"スクリプト、コマンドライン、設定ファイルでカスタマイズさ" +"れ、 :meth:`finalize_options` で設定されたオプションがアクションを制御しま" +"す。端末への出力とファイルシステムとのやりとりは全て :meth:`run` が行います。" #: ../../distutils/apiref.rst:1798 msgid "" @@ -3163,8 +3171,8 @@ msgstr "" msgid "" "Alternative implementation of build_py which also runs the 2to3 conversion " "library on each .py file that is going to be installed. To use this in a " -"setup.py file for a distribution that is designed to run with both Python 2." -"x and 3.x, add::" +"setup.py file for a distribution that is designed to run with both Python " +"2.x and 3.x, add::" msgstr "" "インストールされる各 .py ファイル上で 2to3 変換ライブラリをさらに実行する " "build_py の代替実装。Python 2.x と 3.x の両方で動くことを意図した配布物におい" diff --git a/distutils/builtdist.po b/distutils/builtdist.po index 4782154a8..d4975cd8d 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 @@ -36,9 +36,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/builtdist.rst:9 msgid "" @@ -115,20 +115,20 @@ msgid "" "considered \"dumb\" because it has to be unpacked in a specific location to " "work.)" msgstr "" -"すると、Distutils はモジュール配布物 (ここでは Distutils 自体) をビルド" -"し、\"偽の (fake)\" インストールを (:file:`build` ディレクトリで) 行います。" -"そして現在のプラットフォームにおける標準の形式でビルド済み配布物を生成しま" -"す。デフォルトのビルド済み形式とは、Unixでは \"ダム (dumb)\" の tar ファイル" -"で、 Windows ではシンプルな実行形式のインストーラになります。(tar ファイル" -"は、特定の場所に手作業で解凍しないと動作しないので、 \"ダム: 賢くない\" 形式" -"とみなします。)" +"すると、Distutils はモジュール配布物 (ここでは Distutils 自体) をビルドし、" +"\"偽の (fake)\" インストールを (:file:`build` ディレクトリで) 行います。そし" +"て現在のプラットフォームにおける標準の形式でビルド済み配布物を生成します。デ" +"フォルトのビルド済み形式とは、Unixでは \"ダム (dumb)\" の tar ファイルで、 " +"Windows ではシンプルな実行形式のインストーラになります。(tar ファイルは、特定" +"の場所に手作業で解凍しないと動作しないので、 \"ダム: 賢くない\" 形式とみなし" +"ます。)" #: ../../distutils/builtdist.rst:46 msgid "" -"Thus, the above command on a Unix system creates :file:`Distutils-1.0.{plat}." -"tar.gz`; unpacking this tarball from the right place installs the Distutils " -"just as though you had downloaded the source distribution and run ``python " -"setup.py install``. (The \"right place\" is either the root of the " +"Thus, the above command on a Unix system creates :file:`Distutils-1.0." +"{plat}.tar.gz`; unpacking this tarball from the right place installs the " +"Distutils just as though you had downloaded the source distribution and run " +"``python setup.py install``. (The \"right place\" is either the root of the " "filesystem or Python's :file:`{prefix}` directory, depending on the options " "given to the :command:`bdist_dumb` command; the default is to make dumb " "distributions relative to :file:`{prefix}`.)" @@ -332,20 +332,21 @@ msgid "" "You don't have to use the :command:`bdist` command with the :option:`!--" "formats` option; you can also use the command that directly implements the " "format you're interested in. Some of these :command:`bdist` \"sub-" -"commands\" actually generate several similar formats; for instance, the :" -"command:`bdist_dumb` command generates all the \"dumb\" archive formats " -"(``tar``, ``gztar``, ``bztar``, ``xztar``, ``ztar``, and ``zip``), and :" -"command:`bdist_rpm` generates both binary and source RPMs. The :command:" -"`bdist` sub-commands, and the formats generated by each, are:" +"commands\" actually generate several similar formats; for instance, " +"the :command:`bdist_dumb` command generates all the \"dumb\" archive formats " +"(``tar``, ``gztar``, ``bztar``, ``xztar``, ``ztar``, and ``zip``), " +"and :command:`bdist_rpm` generates both binary and source RPMs. " +"The :command:`bdist` sub-commands, and the formats generated by each, are:" msgstr "" ":command:`bdist` コマンドを使うとき、必ず :option:`!--formats` オプションを" "使わなければならないわけではありません; 自分の使いたい形式をダイレクトに実装" "しているコマンドも使えます。こうした :command:`bdist` \"サブコマンド (sub-" -"command)\" は、実際には類似のいくつかの形式を生成できます; 例えば、 :command:" -"`bdist_dumb` コマンドは、全ての \"ダム\" アーカイブ形式 (``tar``, ``gztar``, " -"``bztar``, ``xztar``, ``ztar``, および ``zip``) を作成できますし、 :command:" -"`bdist_rpm` はバイナリ RPM とソース RPM の両方を生成できます。 :command:" -"`bdist` サブコマンドと、それぞれが生成する形式を以下に示します:" +"command)\" は、実際には類似のいくつかの形式を生成できます; 例え" +"ば、 :command:`bdist_dumb` コマンドは、全ての \"ダム\" アーカイブ形式 " +"(``tar``, ``gztar``, ``bztar``, ``xztar``, ``ztar``, および ``zip``) を作成で" +"きますし、 :command:`bdist_rpm` はバイナリ RPM とソース RPM の両方を生成でき" +"ます。 :command:`bdist` サブコマンドと、それぞれが生成する形式を以下に示しま" +"す:" #: ../../distutils/builtdist.rst:135 msgid "Command" @@ -401,8 +402,8 @@ msgstr "" #: ../../distutils/builtdist.rst:167 msgid "" -"The usual way to create an RPM of your module distribution is to run the :" -"command:`bdist_rpm` command::" +"The usual way to create an RPM of your module distribution is to run " +"the :command:`bdist_rpm` command::" msgstr "" "通常、モジュール配布物の RPM を作成するには、 :command:`bdist_rpm` コマンドを" "使います::" @@ -427,11 +428,12 @@ msgstr "" #: ../../distutils/builtdist.rst:182 msgid "" "Creating RPM packages is driven by a :file:`.spec` file, much as using the " -"Distutils is driven by the setup script. To make your life easier, the :" -"command:`bdist_rpm` command normally creates a :file:`.spec` file based on " -"the information you supply in the setup script, on the command line, and in " -"any Distutils configuration files. Various options and sections in the :" -"file:`.spec` file are derived from options in the setup script as follows:" +"Distutils is driven by the setup script. To make your life easier, " +"the :command:`bdist_rpm` command normally creates a :file:`.spec` file based " +"on the information you supply in the setup script, on the command line, and " +"in any Distutils configuration files. Various options and sections in " +"the :file:`.spec` file are derived from options in the setup script as " +"follows:" msgstr "" "Distutils が setup スクリプトで制御されているのとほとんど同じく、 RPM パッ" "ケージの作成は、 :file:`.spec` で制御されています。 RPM の作成を簡便に解決す" @@ -515,8 +517,8 @@ msgid "" "through options to the :command:`bdist_rpm` command as follows:" msgstr "" "また、 :file:`.spec` ファイル内の多くのオプションは、 setup スクリプト中に対" -"応するオプションがありません。これらのほとんどは、以下に示す :command:" -"`bdist_rpm` コマンドのオプションで扱えます:" +"応するオプションがありません。これらのほとんどは、以下に示" +"す :command:`bdist_rpm` コマンドのオプションで扱えます:" #: ../../distutils/builtdist.rst:214 msgid ":command:`bdist_rpm` option" @@ -566,12 +568,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" @@ -637,17 +635,17 @@ msgid "" "If you distribute or package many Python module distributions, you might " "want to put options that apply to all of them in your personal Distutils " "configuration file (:file:`~/.pydistutils.cfg`). If you want to temporarily " -"disable this file, you can pass the :option:`!--no-user-cfg` option to :file:" -"`setup.py`." +"disable this file, you can pass the :option:`!--no-user-cfg` option " +"to :file:`setup.py`." msgstr "" "明らかに、これらのオプションの中からいくつかだけを提供することでさえ、退屈で" -"間違いを起こしやすいものでしょう。なので通常は、それらを setup 設定ファイル :" -"file:`setup.cfg` に収めるのが最適な方法です --- :ref:`setup-config` を参照し" -"てください。多くの Python モジュールの配布物を頒布したりパッケージングする場" -"合は、それら全てに適用するオプションをあなた専用の Distutils 設定ファイル (:" -"file:`~/.pydistutils.cfg`) に収めたいと思うかもしれません。このファイルを一時" -"的に無効にしたければ、 :option:`!--no-user-cfg` を :file:`setup.py` に渡せま" -"す。" +"間違いを起こしやすいものでしょう。なので通常は、それらを setup 設定ファイ" +"ル :file:`setup.cfg` に収めるのが最適な方法です --- :ref:`setup-config` を参" +"照してください。多くの Python モジュールの配布物を頒布したりパッケージングす" +"る場合は、それら全てに適用するオプションをあなた専用の Distutils 設定ファイ" +"ル (:file:`~/.pydistutils.cfg`) に収めたいと思うかもしれません。このファイル" +"を一時的に無効にしたければ、 :option:`!--no-user-cfg` を :file:`setup.py` に" +"渡せます。" #: ../../distutils/builtdist.rst:248 msgid "" @@ -663,9 +661,9 @@ msgid "" "Distutils setup script; in fact, much of the information in the setup " "script winds up in the :file:`.spec` file)" msgstr "" -"RPM パッケージの内容を記述する :file:`.spec` ファイルを作成します (:file:`." -"spec` ファイルは setup スクリプトに似たファイルです; 実際、 setup スクリプト" -"のほとんどの情報が :file:`.spec` ファイルから引き揚げられます)" +"RPM パッケージの内容を記述する :file:`.spec` ファイルを作成します " +"(:file:`.spec` ファイルは setup スクリプトに似たファイルです; 実際、 setup ス" +"クリプトのほとんどの情報が :file:`.spec` ファイルから引き揚げられます)" #: ../../distutils/builtdist.rst:255 msgid "create the source RPM" @@ -690,13 +688,13 @@ msgstr "" #: ../../distutils/builtdist.rst:263 msgid "" -"If you wish, you can separate these three steps. You can use the :option:" -"`!--spec-only` option to make :command:`bdist_rpm` just create the :file:`." -"spec` file and exit; in this case, the :file:`.spec` file will be written to " -"the \"distribution directory\"---normally :file:`dist/`, but customizable " -"with the :option:`!--dist-dir` option. (Normally, the :file:`.spec` file " -"winds up deep in the \"build tree,\" in a temporary directory created by :" -"command:`bdist_rpm`.)" +"If you wish, you can separate these three steps. You can use " +"the :option:`!--spec-only` option to make :command:`bdist_rpm` just create " +"the :file:`.spec` file and exit; in this case, the :file:`.spec` file will " +"be written to the \"distribution directory\"---normally :file:`dist/`, but " +"customizable with the :option:`!--dist-dir` option. (Normally, " +"the :file:`.spec` file winds up deep in the \"build tree,\" in a temporary " +"directory created by :command:`bdist_rpm`.)" msgstr "" "望むなら、これらの三つのステップを分割できます。 :command:`bdist_rpm` コマン" "ドに :option:`!--spec-only` を指定すれば、単に :file:`.spec` を作成して終了し" @@ -855,9 +853,9 @@ msgid "" "documentation of the :c:func:`SHGetSpecialFolderPath` function." msgstr "" "どの種類のフォルダを取得できるかは、特定の Windows のバージョンごとに異なりま" -"す。また、おそらく設定によっても異なるでしょう。詳細については、 :c:func:" -"`SHGetSpecialFolderPath` 関数に関する Microsoft のドキュメントを参照してくだ" -"さい。" +"す。また、おそらく設定によっても異なるでしょう。詳細について" +"は、 :c:func:`SHGetSpecialFolderPath` 関数に関する Microsoft のドキュメントを" +"参照してください。" #: ../../distutils/builtdist.rst:385 msgid "" @@ -867,8 +865,8 @@ msgid "" "specifies the command line arguments, if any. *workdir* is the working " "directory for the program. *iconpath* is the file containing the icon for " "the shortcut, and *iconindex* is the index of the icon in the file " -"*iconpath*. Again, for details consult the Microsoft documentation for the :" -"class:`IShellLink` interface." +"*iconpath*. Again, for details consult the Microsoft documentation for " +"the :class:`IShellLink` interface." msgstr "" "この関数はショートカットを作成します。 *target* はショートカットによって起動" "されるプログラムへのパスです。 *description* はショートカットに対する説明で" diff --git a/distutils/commandref.po b/distutils/commandref.po index 2331199f2..b95828924 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 @@ -32,9 +32,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/commandref.rst:24 msgid "Installing modules: the :command:`install` command family" @@ -43,12 +43,12 @@ msgstr "モジュールをインストールする: :command:`install` コマン #: ../../distutils/commandref.rst:26 msgid "" "The install command ensures that the build commands have been run and then " -"runs the subcommands :command:`install_lib`, :command:`install_data` and :" -"command:`install_scripts`." +"runs the subcommands :command:`install_lib`, :command:`install_data` " +"and :command:`install_scripts`." msgstr "" ":command:`install` コマンドは最初にビルドコマンドを実行しておいてから、サブコ" -"マンド :command:`install_lib` を実行します。 :command:`install_data` and :" -"command:`install_scripts`." +"マンド :command:`install_lib` を実行します。 :command:`install_data` " +"and :command:`install_scripts`." #: ../../distutils/commandref.rst:37 msgid ":command:`install_data`" diff --git a/distutils/configfile.po b/distutils/configfile.po index 2c39db65e..7b5b0b9f6 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 @@ -34,9 +34,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/configfile.rst:9 msgid "" @@ -44,11 +44,11 @@ msgid "" "distribution *a priori*: you may need to get some information from the user, " "or from the user's system, in order to proceed. As long as that information " "is fairly simple---a list of directories to search for C header files or " -"libraries, for example---then providing a configuration file, :file:`setup." -"cfg`, for users to edit is a cheap and easy way to solicit it. " -"Configuration files also let you provide default values for any command " -"option, which the installer can then override either on the command-line or " -"by editing the config file." +"libraries, for example---then providing a configuration " +"file, :file:`setup.cfg`, for users to edit is a cheap and easy way to " +"solicit it. Configuration files also let you provide default values for any " +"command option, which the installer can then override either on the command-" +"line or by editing the config file." msgstr "" "時に、配布物をビルドする際に必要な全ての設定を *あらかじめ* 書ききれない状況" "が起きます: 例えば、ビルドを進めるために、ユーザに関する情報や、ユーザのシス" @@ -80,11 +80,11 @@ msgstr "" #: ../../distutils/configfile.rst:32 msgid "" -"installers can override some of what you put in :file:`setup.py` by editing :" -"file:`setup.cfg`" +"installers can override some of what you put in :file:`setup.py` by " +"editing :file:`setup.cfg`" msgstr "" -"インストール作業者は、作者が :file:`setup.py` に設定した項目のいくつかを :" -"file:`setup.cfg` を変更して上書きできます" +"インストール作業者は、作者が :file:`setup.py` に設定した項目のいくつか" +"を :file:`setup.cfg` を変更して上書きできます" #: ../../distutils/configfile.rst:35 msgid "" @@ -99,8 +99,8 @@ msgid "" "installers can override anything in :file:`setup.cfg` using the command-line " "options to :file:`setup.py`" msgstr "" -"インストール作業者は、 :file:`setup.cfg` に書かれたどんな設定も :file:`setup." -"py` のコマンドラインオプションで上書きできます" +"インストール作業者は、 :file:`setup.cfg` に書かれたどんな設定" +"も :file:`setup.py` のコマンドラインオプションで上書きできます" #: ../../distutils/configfile.rst:41 msgid "The basic syntax of the configuration file is simple:" @@ -108,21 +108,21 @@ msgstr "設定ファイルの基本的な構文は簡単なものです:" #: ../../distutils/configfile.rst:49 msgid "" -"where *command* is one of the Distutils commands (e.g. :command:`build_py`, :" -"command:`install`), and *option* is one of the options that command " -"supports. Any number of options can be supplied for each command, and any " -"number of command sections can be included in the file. Blank lines are " -"ignored, as are comments, which run from a ``'#'`` character until the end " -"of the line. Long option values can be split across multiple lines simply " -"by indenting the continuation lines." -msgstr "" -"ここで、 *command* は Distutils コマンドのうちの一つ (例えば :command:" -"`build_py`, :command:`install`) で、 *option* はそのコマンドでサポートされて" -"いるオプションのうちの一つです。各コマンドには任意の数のオプションを設定で" -"き、一つの設定ファイル中には任意の数のコマンドセクションを収められます。空白" -"行は無視されます、 ``'#'`` 文字で開始して行末まで続くコメントも同様に無視され" -"ます。長いオプション設定値は、継続行をインデントするだけで複数行にわたって記" -"述できます。" +"where *command* is one of the Distutils commands " +"(e.g. :command:`build_py`, :command:`install`), and *option* is one of the " +"options that command supports. Any number of options can be supplied for " +"each command, and any number of command sections can be included in the " +"file. Blank lines are ignored, as are comments, which run from a ``'#'`` " +"character until the end of the line. Long option values can be split across " +"multiple lines simply by indenting the continuation lines." +msgstr "" +"ここで、 *command* は Distutils コマンドのうちの一つ (例え" +"ば :command:`build_py`, :command:`install`) で、 *option* はそのコマンドでサ" +"ポートされているオプションのうちの一つです。各コマンドには任意の数のオプショ" +"ンを設定でき、一つの設定ファイル中には任意の数のコマンドセクションを収められ" +"ます。空白行は無視されます、 ``'#'`` 文字で開始して行末まで続くコメントも同様" +"に無視されます。長いオプション設定値は、継続行をインデントするだけで複数行に" +"わたって記述できます。" #: ../../distutils/configfile.rst:57 msgid "" @@ -151,10 +151,10 @@ msgid "" msgstr "" "例えば、拡張モジュールを \"その場 (in-place)\" でビルドしたい --- すなわち、" "配布物が拡張モジュール :mod:`pkg.ext` を含み、コンパイルされた拡張モジュール" -"ファイル (Unix の場合は :file:`ext.so`) を pure Python モジュール :mod:`pkg." -"mod1` および :mod:`pkg.mod2` と同じソースディレクトリに配置したいとします。 " -"\"その場 (in-place)\" でのビルドを確実に行いたい場合は、 :option:`!--" -"inplace` オプションが有用です。" +"ファイル (Unix の場合は :file:`ext.so`) を pure Python モジュー" +"ル :mod:`pkg.mod1` および :mod:`pkg.mod2` と同じソースディレクトリに配置した" +"いとします。 \"その場 (in-place)\" でのビルドを確実に行いたい場合" +"は、 :option:`!--inplace` オプションが有用です。" #: ../../distutils/configfile.rst:90 msgid "" @@ -163,11 +163,11 @@ msgid "" "to \"set and forget\" this option, by encoding it in :file:`setup.cfg`, the " "configuration file for this distribution:" msgstr "" -"しかしこの場合、必ず明示的に :command:`build_ext` コマンドを設定し、かつ :" -"option:`!--inplace` オプションを忘れずに指定しなければなりません。これを確実" -"に行う簡単な方法は、このディストリビューションの :file:`setup.cfg` 設定ファイ" -"ルに 以下のように書いておくことで、設定を \"自動化 (set and forget)\" するこ" -"とです:" +"しかしこの場合、必ず明示的に :command:`build_ext` コマンドを設定し、か" +"つ :option:`!--inplace` オプションを忘れずに指定しなければなりません。これを" +"確実に行う簡単な方法は、このディストリビューションの :file:`setup.cfg` 設定" +"ファイルに 以下のように書いておくことで、設定を \"自動化 (set and forget)\" " +"することです:" #: ../../distutils/configfile.rst:100 msgid "" diff --git a/distutils/examples.po b/distutils/examples.po index 37087985f..bc56cc8d7 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 @@ -32,9 +32,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/examples.rst:9 msgid "" @@ -173,9 +173,9 @@ msgstr "" #: ../../distutils/examples.rst:113 msgid "" "More typically, though, you will want to distribute multiple modules in the " -"same package (or in sub-packages). For example, if the :mod:`foo` and :mod:" -"`bar` modules belong in package :mod:`foobar`, one way to layout your source " -"tree is ::" +"same package (or in sub-packages). For example, if the :mod:`foo` " +"and :mod:`bar` modules belong in package :mod:`foobar`, one way to layout " +"your source tree is ::" msgstr "" "もっと典型的なケースでは、複数のモジュールを同じパッケージ (またはサブパッ" "ケージ) に入れて配布しようと思うでしょう。例えば、 :mod:`foo` と :mod:`bar` " @@ -193,12 +193,12 @@ msgstr "" #: ../../distutils/examples.rst:134 msgid "" "If you want to put modules in directories not named for their package, then " -"you need to use the ``package_dir`` option again. For example, if the :file:" -"`src` directory holds modules in the :mod:`foobar` package::" +"you need to use the ``package_dir`` option again. For example, if " +"the :file:`src` directory holds modules in the :mod:`foobar` package::" msgstr "" "モジュールを入れるディレクトリをパッケージの名前にしたくない場合、ここでも " -"``package_dir`` オプションを使う必要があります。例えば、パッケージ :mod:" -"`foobar` のモジュールが :file:`src` に入っているとします::" +"``package_dir`` オプションを使う必要があります。例えば、パッケー" +"ジ :mod:`foobar` のモジュールが :file:`src` に入っているとします::" #: ../../distutils/examples.rst:145 msgid "an appropriate setup script would be ::" @@ -225,8 +225,9 @@ msgid "" "If you have sub-packages, they must be explicitly listed in ``packages``, " "but any entries in ``package_dir`` automatically extend to sub-packages. (In " "other words, the Distutils does *not* scan your source tree, trying to " -"figure out which directories correspond to Python packages by looking for :" -"file:`__init__.py` files.) Thus, if the default layout grows a sub-package::" +"figure out which directories correspond to Python packages by looking " +"for :file:`__init__.py` files.) Thus, if the default layout grows a sub-" +"package::" msgstr "" "サブパッケージがある場合、 ``packages`` で明示的に列挙しなければなりません" "が、 ``package_dir`` はサブパッケージへのパスを自動的に展開します。 (別の言い" @@ -272,8 +273,8 @@ msgstr "" #: ../../distutils/examples.rst:225 msgid "" -"With exactly the same source tree layout, this extension can be put in the :" -"mod:`foopkg` package simply by changing the name of the extension::" +"With exactly the same source tree layout, this extension can be put in " +"the :mod:`foopkg` package simply by changing the name of the extension::" msgstr "" ":mod:`foopkg` 拡張をルートパッケージ下に所属させたい場合、 setup スクリプトは" "以下のようにします::" @@ -345,14 +346,15 @@ msgstr "" #: ../../distutils/examples.rst:302 msgid "" -"This call reads the ``name`` metadata by running the :func:`distutils.core." -"setup` function. Although, when a source or binary distribution is created " -"with Distutils, the metadata fields are written in a static file called :" -"file:`PKG-INFO`. When a Distutils-based project is installed in Python, the :" -"file:`PKG-INFO` file is copied alongside the modules and packages of the " -"distribution under :file:`NAME-VERSION-pyX.X.egg-info`, where ``NAME`` is " -"the name of the project, ``VERSION`` its version as defined in the Metadata, " -"and ``pyX.X`` the major and minor version of Python like ``2.7`` or ``3.2``." +"This call reads the ``name`` metadata by running " +"the :func:`distutils.core.setup` function. Although, when a source or " +"binary distribution is created with Distutils, the metadata fields are " +"written in a static file called :file:`PKG-INFO`. When a Distutils-based " +"project is installed in Python, the :file:`PKG-INFO` file is copied " +"alongside the modules and packages of the distribution under :file:`NAME-" +"VERSION-pyX.X.egg-info`, where ``NAME`` is the name of the project, " +"``VERSION`` its version as defined in the Metadata, and ``pyX.X`` the major " +"and minor version of Python like ``2.7`` or ``3.2``." msgstr "" "この呼び出しは、 :func:`distutils.core.setup` 関数を実行して ``name`` メタ" "データを読み取っています。ソース配布物もしくはバイナリ配布物が Distutils で作" @@ -366,11 +368,13 @@ msgstr "" #: ../../distutils/examples.rst:312 msgid "" -"You can read back this static file, by using the :class:`distutils.dist." -"DistributionMetadata` class and its :func:`read_pkg_file` method::" +"You can read back this static file, by using " +"the :class:`distutils.dist.DistributionMetadata` class and " +"its :func:`read_pkg_file` method::" msgstr "" -":class:`distutils.dist.DistributionMetadata` クラスとその :func:" -"`read_pkg_file` メソッドを使って、この静的ファイルを読むことができます::" +":class:`distutils.dist.DistributionMetadata` クラスとそ" +"の :func:`read_pkg_file` メソッドを使って、この静的ファイルを読むことができ" +"ます::" #: ../../distutils/examples.rst:326 msgid "" diff --git a/distutils/extending.po b/distutils/extending.po index dd10467dc..032d7242c 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 @@ -33,9 +33,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/extending.rst:9 msgid "" @@ -65,17 +65,17 @@ msgstr "" #: ../../distutils/extending.rst:20 msgid "" -"Most distutils command implementations are subclasses of the :class:" -"`distutils.cmd.Command` class. New commands may directly inherit from :" -"class:`Command`, while replacements often derive from :class:`Command` " +"Most distutils command implementations are subclasses of " +"the :class:`distutils.cmd.Command` class. New commands may directly inherit " +"from :class:`Command`, while replacements often derive from :class:`Command` " "indirectly, directly subclassing the command they are replacing. Commands " "are required to derive from :class:`Command`." msgstr "" "ほとんどのdistutilsのコマンド実装は :class:`distutils.cmd.Command` クラスのサ" "ブクラスとして実装されています。新しいコマンドは :class:`Command` を直接継承" -"し、置換するコマンドでは置換対象のコマンドのサブクラスにすることで :class:" -"`Command` を間接的に継承します。コマンドは :class:`Command` から派生したもの" -"である必要があります。" +"し、置換するコマンドでは置換対象のコマンドのサブクラスにすること" +"で :class:`Command` を間接的に継承します。コマンドは :class:`Command` から派" +"生したものである必要があります。" #: ../../distutils/extending.rst:35 msgid "Integrating new commands" @@ -100,8 +100,8 @@ msgid "" "the :func:`distutils.core.setup` function use them::" msgstr "" "もっとも一般的な、そしておそらくほとんどの場合にもっとも妥当な方法は、新しい" -"実装をあなたの :file:`setup.py` スクリプトに取り込み、 :func:`distutils.core." -"setup` 関数でそれらを使うようにすることです::" +"実装をあなたの :file:`setup.py` スクリプトに取り込" +"み、 :func:`distutils.core.setup` 関数でそれらを使うようにすることです::" #: ../../distutils/extending.rst:57 msgid "" @@ -129,18 +129,19 @@ msgid "" "it to an empty string on the command line causes the default to be used. " "This should never be set in a configuration file provided with a package." msgstr "" -"Python 2.4から、インストールされたPythonを変更せずに、既存の :file:`setup." -"py` スクリプトをサポートするための3つめの選択肢が利用できるようになりました。" -"これは追加のパッケージングシステムのサポートを追加するサードパーティ拡張を提" -"供することを想定していますが、これらのコマンドはdistutilsが利用されている何に" -"でも利用可能です。新しい設定オプション ``command_packages`` (コマンドラインオ" -"プション :option:`!--command-packages`) は、コマンド実装モジュールを検索する" -"追加のパッケージを指定するために利用できます。 distutilsの全てのオプションと" -"同様に、このオプションもコマンドラインまたは設定ファイルで指定できます。この" -"オプションは設定ファイル中では ``[global]`` セクションか、コマンドラインのコ" -"マンドより前でだけ設定できます。設定ファイル中で指定する場合、コマンドライン" -"で上書きすることができます。空文字列を指定するとデフォルト値が使われます。こ" -"れはパッケージと一緒に提供する設定ファイルでは指定しないでください。" +"Python 2.4から、インストールされたPythonを変更せずに、既存" +"の :file:`setup.py` スクリプトをサポートするための3つめの選択肢が利用できるよ" +"うになりました。これは追加のパッケージングシステムのサポートを追加するサード" +"パーティ拡張を提供することを想定していますが、これらのコマンドはdistutilsが利" +"用されている何にでも利用可能です。新しい設定オプション ``command_packages`` " +"(コマンドラインオプション :option:`!--command-packages`) は、コマンド実装モ" +"ジュールを検索する追加のパッケージを指定するために利用できます。 distutilsの" +"全てのオプションと同様に、このオプションもコマンドラインまたは設定ファイルで" +"指定できます。このオプションは設定ファイル中では ``[global]`` セクションか、" +"コマンドラインのコマンドより前でだけ設定できます。設定ファイル中で指定する場" +"合、コマンドラインで上書きすることができます。空文字列を指定するとデフォルト" +"値が使われます。これはパッケージと一緒に提供する設定ファイルでは指定しないで" +"ください。" #: ../../distutils/extending.rst:76 msgid "" @@ -148,24 +149,27 @@ msgid "" "packages searched for command implementations; multiple package names should " "be separated by commas. When not specified, the search is only performed in " "the :mod:`distutils.command` package. When :file:`setup.py` is run with the " -"option ``--command-packages distcmds,buildcmds``, however, the packages :mod:" -"`distutils.command`, :mod:`distcmds`, and :mod:`buildcmds` will be searched " -"in that order. New commands are expected to be implemented in modules of " -"the same name as the command by classes sharing the same name. Given the " -"example command line option above, the command :command:`bdist_openpkg` " -"could be implemented by the class :class:`distcmds.bdist_openpkg." -"bdist_openpkg` or :class:`buildcmds.bdist_openpkg.bdist_openpkg`." +"option ``--command-packages distcmds,buildcmds``, however, the " +"packages :mod:`distutils.command`, :mod:`distcmds`, and :mod:`buildcmds` " +"will be searched in that order. New commands are expected to be implemented " +"in modules of the same name as the command by classes sharing the same " +"name. Given the example command line option above, the " +"command :command:`bdist_openpkg` could be implemented by the " +"class :class:`distcmds.bdist_openpkg.bdist_openpkg` " +"or :class:`buildcmds.bdist_openpkg.bdist_openpkg`." msgstr "" "この新オプションによってコマンド実装を探すためのパッケージをいくつでも追加す" "ることができます。複数のパッケージ名はコンマで区切って指定します。指定がなけ" -"れば、検索は :mod:`distutils.command` パッケージのみで行われます。ただし :" -"file:`setup.py` がオプション ``--command-packages distcmds,buildcmds`` で実行" -"されている場合には、パッケージは :mod:`distutils.command` 、 :mod:" -"`distcmds` 、そして :mod:`buildcmds` を、この順番で検索します。新コマンドはコ" -"マンドと同じ名前のモジュールに、コマンドと同じ名前のクラスで実装されていると" -"想定しています。上のコマドラインオプションの例では、コマンド :command:" -"`bdist_openpkg` は、 :class:`distcmds.bdist_openpkg.bdist_openpkg` か、 :" -"class:`buildcmds.bdist_openpkg.bdist_openpkg` で実装されるかもしれません。" +"れば、検索は :mod:`distutils.command` パッケージのみで行われます。ただ" +"し :file:`setup.py` がオプション ``--command-packages distcmds,buildcmds`` で" +"実行されている場合には、パッケージ" +"は :mod:`distutils.command` 、 :mod:`distcmds` 、そして :mod:`buildcmds` を、" +"この順番で検索します。新コマンドはコマンドと同じ名前のモジュールに、コマンド" +"と同じ名前のクラスで実装されていると想定しています。上のコマドラインオプショ" +"ンの例では、コマンド :command:`bdist_openpkg` " +"は、 :class:`distcmds.bdist_openpkg.bdist_openpkg` " +"か、 :class:`buildcmds.bdist_openpkg.bdist_openpkg` で実装されるかもしれませ" +"ん。" #: ../../distutils/extending.rst:90 msgid "Adding new distribution types" @@ -174,15 +178,15 @@ msgstr "配布物の種類を追加する" #: ../../distutils/extending.rst:92 msgid "" "Commands that create distributions (files in the :file:`dist/` directory) " -"need to add ``(command, filename)`` pairs to ``self.distribution." -"dist_files`` so that :command:`upload` can upload it to PyPI. The " -"*filename* in the pair contains no path information, only the name of the " -"file itself. In dry-run mode, pairs should still be added to represent what " -"would have been created." +"need to add ``(command, filename)`` pairs to " +"``self.distribution.dist_files`` so that :command:`upload` can upload it to " +"PyPI. The *filename* in the pair contains no path information, only the " +"name of the file itself. In dry-run mode, pairs should still be added to " +"represent what would have been created." msgstr "" -"配布物 (:file:`dist/` ディレクトリの中のファイル) を作成するコマンドは、 :" -"command:`upload` がその配布物をPyPIにアップロードできるように、 ``(command, " -"filename)`` のペアを ``self.distribution.dist_files`` に追加する必要がありま" -"す。ペア中の *filename* はパスに関する情報を持たず、単にファイル名だけを持ち" -"ます。 dry-run モードでも、何が作成されたかを示すために、同じペアが必要になり" -"ます。" +"配布物 (:file:`dist/` ディレクトリの中のファイル) を作成するコマンド" +"は、 :command:`upload` がその配布物をPyPIにアップロードできるように、 " +"``(command, filename)`` のペアを ``self.distribution.dist_files`` に追加する" +"必要があります。ペア中の *filename* はパスに関する情報を持たず、単にファイル" +"名だけを持ちます。 dry-run モードでも、何が作成されたかを示すために、同じペア" +"が必要になります。" diff --git a/distutils/index.po b/distutils/index.po index 21a6ada1d..d40a731ba 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 @@ -69,9 +69,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/index.rst:26 msgid "" diff --git a/distutils/introduction.po b/distutils/introduction.po index 0cc9519d7..dc5eb8f64 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 @@ -33,16 +33,16 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/introduction.rst:9 msgid "" "This document covers using the Distutils to distribute your Python modules, " "concentrating on the role of developer/distributor: if you're looking for " -"information on installing Python modules, you should refer to the :ref:" -"`install-index` chapter." +"information on installing Python modules, you should refer to " +"the :ref:`install-index` chapter." msgstr "" "このドキュメントで扱っている内容は、 Distutils を使った Python モジュールの配" "布で、とりわけ開発者/配布者の役割に重点を置いています: Python モジュールのイ" @@ -202,11 +202,11 @@ msgid "" "module :file:`foo.py`. The archive file will be named :file:`foo-1.0.tar.gz` " "(or :file:`.zip`), and will unpack into a directory :file:`foo-1.0`." msgstr "" -":command:`sdist` は、 setup スクリプト :file:`setup.py` とモジュール :file:" -"`foo.py` を含むアーカイブファイル (例。 Unix の tarball や Windows の ZIP " -"ファイル) を作成します。アーカイブファイルは :file:`foo-1.0.tar.gz` (あるい" -"は :file:`.zip`) という名前になり、 :file:`foo-1.0` というディレクトリに展開" -"されます。" +":command:`sdist` は、 setup スクリプト :file:`setup.py` とモジュー" +"ル :file:`foo.py` を含むアーカイブファイル (例。 Unix の tarball や Windows " +"の ZIP ファイル) を作成します。アーカイブファイルは :file:`foo-1.0.tar.gz` " +"(あるいは :file:`.zip`) という名前になり、 :file:`foo-1.0` というディレクトリ" +"に展開されます。" #: ../../distutils/introduction.rst:99 msgid "" @@ -214,9 +214,10 @@ msgid "" "is download :file:`foo-1.0.tar.gz` (or :file:`.zip`), unpack it, and---from " "the :file:`foo-1.0` directory---run ::" msgstr "" -"エンドユーザが :mod:`foo` モジュールをインストールしたければ、 :file:" -"`foo-1.0.tar.gz` (または :file:`.zip`) をダウンロードし、それを展開して、以下" -"のスクリプトを --- :file:`foo-1.0` ディレクトリ中で --- 実行するだけです ::" +"エンドユーザが :mod:`foo` モジュールをインストールしたけれ" +"ば、 :file:`foo-1.0.tar.gz` (または :file:`.zip`) をダウンロードし、それを展" +"開して、以下のスクリプトを --- :file:`foo-1.0` ディレクトリ中で --- 実行する" +"だけです ::" #: ../../distutils/introduction.rst:105 msgid "" @@ -229,11 +230,11 @@ msgstr "" #: ../../distutils/introduction.rst:108 msgid "" "This simple example demonstrates some fundamental concepts of the Distutils. " -"First, both developers and installers have the same basic user interface, i." -"e. the setup script. The difference is which Distutils *commands* they use: " -"the :command:`sdist` command is almost exclusively for module developers, " -"while :command:`install` is more often for installers (although most " -"developers will want to install their own code occasionally)." +"First, both developers and installers have the same basic user interface, " +"i.e. the setup script. The difference is which Distutils *commands* they " +"use: the :command:`sdist` command is almost exclusively for module " +"developers, while :command:`install` is more often for installers (although " +"most developers will want to install their own code occasionally)." msgstr "" "ここで述べた簡単な例では、 Distutils の基本的な概念のいくつかを示しています。" "まず、開発者とインストール作業者は同じ基本インターフェース、すなわち setup ス" @@ -245,15 +246,17 @@ msgstr "" #: ../../distutils/introduction.rst:115 msgid "" -"Other useful built distribution formats are RPM, implemented by the :command:" -"`bdist_rpm` command, Solaris :program:`pkgtool` (:command:`bdist_pkgtool`), " -"and HP-UX :program:`swinstall` (:command:`bdist_sdux`). For example, the " -"following command will create an RPM file called :file:`foo-1.0.noarch.rpm`::" +"Other useful built distribution formats are RPM, implemented by " +"the :command:`bdist_rpm` command, Solaris :program:`pkgtool` " +"(:command:`bdist_pkgtool`), and HP-UX :program:`swinstall` " +"(:command:`bdist_sdux`). For example, the following command will create an " +"RPM file called :file:`foo-1.0.noarch.rpm`::" msgstr "" "その他の有用な配布形態としては、 :command:`bdist_rpm` に実装されている RPM 形" -"式、 Solaris :program:`pkgtool` (:command:`bdist_pkgtool`) 、 HP-UX :program:" -"`swinstall` (:command:`bdist_sdux`) があります。例えば、以下のコマンドを実行" -"すると、 :file:`foo-1.0.noarch.rpm` という名前の RPM ファイルを作成します::" +"式、 Solaris :program:`pkgtool` (:command:`bdist_pkgtool`) 、 HP-" +"UX :program:`swinstall` (:command:`bdist_sdux`) があります。例えば、以下のコ" +"マンドを実行すると、 :file:`foo-1.0.noarch.rpm` という名前の RPM ファイルを作" +"成します::" #: ../../distutils/introduction.rst:123 msgid "" @@ -311,9 +314,9 @@ msgid "" "possibly associated :file:`.pyc` files). Sometimes referred to as a \"pure " "module.\"" msgstr "" -"Python で書かれ、単一の :file:`.py` ファイル内に収められたモジュールです (:" -"file:`.pyc` ファイルと関連があります) 。 \"pure モジュール (pure module)\" " -"と呼ばれることもあります。" +"Python で書かれ、単一の :file:`.py` ファイル内に収められたモジュールです " +"(:file:`.pyc` ファイルと関連があります) 。 \"pure モジュール (pure module)" +"\" と呼ばれることもあります。" #: ../../distutils/introduction.rst:159 msgid "extension module" @@ -365,14 +368,14 @@ msgid "" "package can be found in many directories: in fact, every directory listed in " "``sys.path`` contributes modules to the root package." msgstr "" -"階層的なパッケージの根 (root) の部分にあたるパッケージです。(この部分には :" -"file:`__init__.py` ファイルがないので、本当のパッケージではありませんが、便宜" -"上そう呼びます。) 標準ライブラリの大部分はルートパッケージに入っています、ま" -"た、多くの小規模な単体のサードパーティモジュールで、他の大規模なモジュールコ" -"レクションに属していないものもここに入ります。正規のパッケージと違い、ルート" -"パッケージ上のモジュールの実体は様々なディレクトリにあります: 実際は、 ``sys." -"path`` に列挙されているディレクトリ全てが、ルートパッケージに配置されるモ" -"ジュールの内容に影響します。" +"階層的なパッケージの根 (root) の部分にあたるパッケージです。(この部分に" +"は :file:`__init__.py` ファイルがないので、本当のパッケージではありませんが、" +"便宜上そう呼びます。) 標準ライブラリの大部分はルートパッケージに入っていま" +"す、また、多くの小規模な単体のサードパーティモジュールで、他の大規模なモ" +"ジュールコレクションに属していないものもここに入ります。正規のパッケージと違" +"い、ルートパッケージ上のモジュールの実体は様々なディレクトリにあります: 実際" +"は、 ``sys.path`` に列挙されているディレクトリ全てが、ルートパッケージに配置" +"されるモジュールの内容に影響します。" #: ../../distutils/introduction.rst:179 msgid "Distutils-specific terminology" @@ -438,6 +441,6 @@ msgid "" "directory where :file:`setup.py` exists. Generally :file:`setup.py` will " "be run from this directory." msgstr "" -"ソースコードツリー (またはソース配布物) ディレクトリの最上階層で、 :file:" -"`setup.py` のある場所です。一般的には、 :file:`setup.py` はこのディレクトリ上" -"で実行します。" +"ソースコードツリー (またはソース配布物) ディレクトリの最上階層" +"で、 :file:`setup.py` のある場所です。一般的には、 :file:`setup.py` はこの" +"ディレクトリ上で実行します。" 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..1012233bc 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 @@ -37,9 +37,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/setupscript.rst:9 msgid "" @@ -49,8 +49,8 @@ msgid "" "various commands that operate on your modules do the right thing. As we saw " "in section :ref:`distutils-simple-example` above, the setup script consists " "mainly of a call to :func:`setup`, and most information supplied to the " -"Distutils by the module developer is supplied as keyword arguments to :func:" -"`setup`." +"Distutils by the module developer is supplied as keyword arguments " +"to :func:`setup`." msgstr "" "setup スクリプトは、Distutils を使ってモジュールをビルドし、配布し、インス" "トールする際の全ての動作の中心になります。 setup スクリプトの主な目的は、モ" @@ -134,27 +134,27 @@ msgid "" "install, etc.) all pure Python modules found in each package mentioned in " "the ``packages`` list. In order to do this, of course, there has to be a " "correspondence between package names and directories in the filesystem. The " -"default correspondence is the most obvious one, i.e. package :mod:" -"`distutils` is found in the directory :file:`distutils` relative to the " -"distribution root. Thus, when you say ``packages = ['foo']`` in your setup " -"script, you are promising that the Distutils will find a file :file:`foo/" -"__init__.py` (which might be spelled differently on your system, but you get " -"the idea) relative to the directory where your setup script lives. If you " -"break this promise, the Distutils will issue a warning but still process the " -"broken package anyway." +"default correspondence is the most obvious one, i.e. " +"package :mod:`distutils` is found in the directory :file:`distutils` " +"relative to the distribution root. Thus, when you say ``packages = ['foo']`` " +"in your setup script, you are promising that the Distutils will find a " +"file :file:`foo/__init__.py` (which might be spelled differently on your " +"system, but you get the idea) relative to the directory where your setup " +"script lives. If you break this promise, the Distutils will issue a warning " +"but still process the broken package anyway." msgstr "" "``packages`` オプションは、 ``packages`` リスト中で指定されている各々のパッ" "ケージについて、パッケージ内に見つかった全ての pure Python モジュールを処理 " "(ビルド、配布、インストール、等) するよう Distutils に指示します。このオプ" "ションを指定するためには、当然のことながら各パッケージ名はファイルシステム上" "のディレクトリ名と何らかの対応付けができなければなりません。デフォルトで使わ" -"れる対応関係はきわめてはっきりしたものです。すなわち、パッケージ :mod:" -"`distutils` が配布物ルートディレクトリからの相対パス :file:`distutils` で表さ" -"れるディレクトリ中にあるというものです。つまり、setup スクリプト中で " -"``packages = ['foo']`` と指定したら、スクリプトの置かれたディレクトリからの相" -"対パスで :file:`foo/__init__.py` を探し出せると Distutils に確約したことにな" -"ります。この約束を裏切ると Distutils は警告を出しますが、そのまま壊れたパッ" -"ケージの処理を継続します。" +"れる対応関係はきわめてはっきりしたものです。すなわち、パッケー" +"ジ :mod:`distutils` が配布物ルートディレクトリからの相対パ" +"ス :file:`distutils` で表されるディレクトリ中にあるというものです。つまり、" +"setup スクリプト中で ``packages = ['foo']`` と指定したら、スクリプトの置かれ" +"たディレクトリからの相対パスで :file:`foo/__init__.py` を探し出せると " +"Distutils に確約したことになります。この約束を裏切ると Distutils は警告を出し" +"ますが、そのまま壊れたパッケージの処理を継続します。" #: ../../distutils/setupscript.rst:79 msgid "" @@ -169,8 +169,8 @@ msgstr "" "はありません: 単に ``package_dir`` オプションを指定して、 Distutils に自分の" "規約を教えればよいのです。例えば、全ての Python ソースコードを :file:`lib` 下" "に置いて、 \"ルートパッケージ\" 内のモジュール (つまり、どのパッケージにも" -"入っていないモジュール) を :file:`lib` 内に入れ、 :mod:`foo` パッケージを :" -"file:`lib/foo` に入れる、といった具合にしたいのなら ::" +"入っていないモジュール) を :file:`lib` 内に入れ、 :mod:`foo` パッケージ" +"を :file:`lib/foo` に入れる、といった具合にしたいのなら ::" #: ../../distutils/setupscript.rst:88 msgid "" @@ -182,29 +182,30 @@ msgid "" msgstr "" "を setup スクリプト内に入れます。辞書内のキーはパッケージ名で、空のパッケージ" "名はルートパッケージを表します。キーに対応する値はルートパッケージからの相対" -"ディレクトリ名です、この場合、 ``packages = ['foo']`` を指定すれば、 :file:" -"`lib/foo/__init__.py` が存在すると Distutils に確約したことになります。" +"ディレクトリ名です、この場合、 ``packages = ['foo']`` を指定すれ" +"ば、 :file:`lib/foo/__init__.py` が存在すると Distutils に確約したことになり" +"ます。" #: ../../distutils/setupscript.rst:93 msgid "" -"Another possible convention is to put the :mod:`foo` package right in :file:" -"`lib`, the :mod:`foo.bar` package in :file:`lib/bar`, etc. This would be " -"written in the setup script as ::" +"Another possible convention is to put the :mod:`foo` package right " +"in :file:`lib`, the :mod:`foo.bar` package in :file:`lib/bar`, etc. This " +"would be written in the setup script as ::" msgstr "" -"もう一つの規約のあり方は :mod:`foo` パッケージを :file:`lib` に置き換え、 :" -"mod:`foo.bar` パッケージが :file:`lib/bar` にある、などとするものです。このよ" -"うな規約は、 setup スクリプトでは ::" +"もう一つの規約のあり方は :mod:`foo` パッケージを :file:`lib` に置き換" +"え、 :mod:`foo.bar` パッケージが :file:`lib/bar` にある、などとするものです。" +"このような規約は、 setup スクリプトでは ::" #: ../../distutils/setupscript.rst:99 msgid "" "A ``package: dir`` entry in the ``package_dir`` dictionary implicitly " "applies to all packages below *package*, so the :mod:`foo.bar` case is " "automatically handled here. In this example, having ``packages = ['foo', " -"'foo.bar']`` tells the Distutils to look for :file:`lib/__init__.py` and :" -"file:`lib/bar/__init__.py`. (Keep in mind that although ``package_dir`` " -"applies recursively, you must explicitly list all packages in ``packages``: " -"the Distutils will *not* recursively scan your source tree looking for any " -"directory with an :file:`__init__.py` file.)" +"'foo.bar']`` tells the Distutils to look for :file:`lib/__init__.py` " +"and :file:`lib/bar/__init__.py`. (Keep in mind that although " +"``package_dir`` applies recursively, you must explicitly list all packages " +"in ``packages``: the Distutils will *not* recursively scan your source tree " +"looking for any directory with an :file:`__init__.py` file.)" msgstr "" "のように書きます。 ``package_dir`` 辞書に ``package: dir`` のようなエントリが" "あると、 *package* の下にある全てのパッケージに対してこの規則が暗黙のうちに適" @@ -212,9 +213,9 @@ msgstr "" "``packages = ['foo', 'foo.bar']`` は、 Distutils に :file:`lib/__init__.py` " "と :file:`lib/bar/__init__.py` を探すように指示します。 (``package_dir`` は再" "帰的に適用されますが、この場合 ``packages`` の下にある全てのパッケージを明示" -"的に指定しなければならないことを心に留めておいてください: Distutils は :file:" -"`__init__.py` を持つディレクトリをソースツリーから再帰的にさがしたりは *しま" -"せん* 。)" +"的に指定しなければならないことを心に留めておいてください: Distutils " +"は :file:`__init__.py` を持つディレクトリをソースツリーから再帰的にさがしたり" +"は *しません* 。)" #: ../../distutils/setupscript.rst:112 msgid "Listing individual modules" @@ -238,9 +239,9 @@ msgstr "" msgid "" "This describes two modules, one of them in the \"root\" package, the other " "in the :mod:`pkg` package. Again, the default package/directory layout " -"implies that these two modules can be found in :file:`mod1.py` and :file:" -"`pkg/mod2.py`, and that :file:`pkg/__init__.py` exists as well. And again, " -"you can override the package/directory correspondence using the " +"implies that these two modules can be found in :file:`mod1.py` " +"and :file:`pkg/mod2.py`, and that :file:`pkg/__init__.py` exists as well. " +"And again, you can override the package/directory correspondence using the " "``package_dir`` option." msgstr "" "ここでは二つのモジュールについて述べていて、一方は \"ルート\" パッケージに入" @@ -274,19 +275,19 @@ msgstr "" #: ../../distutils/setupscript.rst:142 msgid "" "All of this is done through another keyword argument to :func:`setup`, the " -"``ext_modules`` option. ``ext_modules`` is just a list of :class:" -"`~distutils.core.Extension` instances, each of which describes a single " -"extension module. Suppose your distribution includes a single extension, " -"called :mod:`foo` and implemented by :file:`foo.c`. If no additional " -"instructions to the compiler/linker are needed, describing this extension is " -"quite simple::" +"``ext_modules`` option. ``ext_modules`` is just a list " +"of :class:`~distutils.core.Extension` instances, each of which describes a " +"single extension module. Suppose your distribution includes a single " +"extension, called :mod:`foo` and implemented by :file:`foo.c`. If no " +"additional instructions to the compiler/linker are needed, describing this " +"extension is quite simple::" msgstr "" "それらは全て、もう 1 つの :func:`setup` のオプション引数、 ``ext_modules`` オ" -"プションを通じて行われます。 ``ext_modules`` は単なる :class:`~distutils." -"core.Extension` のリストで、それぞれがある 1 つの拡張モジュールを記述していま" -"す。配布物に、 :mod:`foo` という名前の :file:`foo.c` に実装がある拡張モジュー" -"ルが 1 つ含まれているとします。コンパイラ/リンカへのこれ以上の指示が無い場合" -"は、拡張モジュールの記述は単純です::" +"プションを通じて行われます。 ``ext_modules`` は単な" +"る :class:`~distutils.core.Extension` のリストで、それぞれがある 1 つの拡張モ" +"ジュールを記述しています。配布物に、 :mod:`foo` という名前の :file:`foo.c` に" +"実装がある拡張モジュールが 1 つ含まれているとします。コンパイラ/リンカへのこ" +"れ以上の指示が無い場合は、拡張モジュールの記述は単純です::" #: ../../distutils/setupscript.rst:152 msgid "" @@ -344,8 +345,8 @@ msgstr "" #: ../../distutils/setupscript.rst:185 msgid "" "If you have a number of extensions all in the same package (or all under the " -"same base package), use the ``ext_package`` keyword argument to :func:" -"`setup`. For example, ::" +"same base package), use the ``ext_package`` keyword argument " +"to :func:`setup`. For example, ::" msgstr "" "同じパッケージ内に (または、同じ基底パッケージ下に) いくつもの拡張モジュール" "がある場合、 ``ext_package`` キーワード引数を :func:`setup` に指定します。例" @@ -353,11 +354,11 @@ msgstr "" #: ../../distutils/setupscript.rst:195 msgid "" -"will compile :file:`foo.c` to the extension :mod:`pkg.foo`, and :file:`bar." -"c` to :mod:`pkg.subpkg.bar`." +"will compile :file:`foo.c` to the extension :mod:`pkg.foo`, " +"and :file:`bar.c` to :mod:`pkg.subpkg.bar`." msgstr "" -"とすると、 :file:`foo.c` をコンパイルして :mod:`pkg.foo` にし、 :file:`bar." -"c` をコンパイルして :mod:`pkg.subpkg.bar` にします。" +"とすると、 :file:`foo.c` をコンパイルして :mod:`pkg.foo` に" +"し、 :file:`bar.c` をコンパイルして :mod:`pkg.subpkg.bar` にします。" #: ../../distutils/setupscript.rst:200 msgid "Extension source files" @@ -386,10 +387,11 @@ msgid "" "will run SWIG on the interface file and compile the resulting C/C++ file " "into your extension." msgstr "" -"ただし、 SWIG インターフェース (:file:`.i`) ファイルはリストに含められます; :" -"command:`build_ext` コマンドは、 SWIG で書かれた拡張パッケージをどう扱えばよ" -"いか心得ています: :command:`build_ext` は、インターフェースファイルを SWIG に" -"かけ、得られた C/C++ ファイルをコンパイルして拡張モジュールを生成します。" +"ただし、 SWIG インターフェース (:file:`.i`) ファイルはリストに含められま" +"す; :command:`build_ext` コマンドは、 SWIG で書かれた拡張パッケージをどう扱え" +"ばよいか心得ています: :command:`build_ext` は、インターフェースファイルを " +"SWIG にかけ、得られた C/C++ ファイルをコンパイルして拡張モジュールを生成しま" +"す。" #: ../../distutils/setupscript.rst:216 msgid "" @@ -407,9 +409,9 @@ msgstr "もしくは、次のようにコマンドラインからオプション msgid "" "On some platforms, you can include non-source files that are processed by " "the compiler and included in your extension. Currently, this just means " -"Windows message text (:file:`.mc`) files and resource definition (:file:`." -"rc`) files for Visual C++. These will be compiled to binary resource (:file:" -"`.res`) files and linked into the executable." +"Windows message text (:file:`.mc`) files and resource definition " +"(:file:`.rc`) files for Visual C++. These will be compiled to binary " +"resource (:file:`.res`) files and linked into the executable." msgstr "" "プラットフォームによっては、コンパイラで処理され、拡張モジュールに取り込まれ" "るような非ソースコードファイルを含められます。非ソースコードファイルとは、現" @@ -485,8 +487,8 @@ msgstr "" #: ../../distutils/setupscript.rst:271 msgid "" "If you must put the :file:`Numerical` include directory right into your " -"header search path, though, you can find that directory using the Distutils :" -"mod:`distutils.sysconfig` module::" +"header search path, though, you can find that directory using the " +"Distutils :mod:`distutils.sysconfig` module::" msgstr "" ":file:`Numerical` インクルードディレクトリ自体をヘッダ検索パスに置きたいのな" "ら、このディレクトリを Distutils の :mod:`distutils.sysconfig` モジュールを" @@ -657,8 +659,8 @@ msgstr "パッケージかモジュールを廃止する。" #: ../../distutils/setupscript.rst:374 msgid "" -"These relationships can be specified using keyword arguments to the :func:" -"`distutils.core.setup` function." +"These relationships can be specified using keyword arguments to " +"the :func:`distutils.core.setup` function." msgstr "" "これらの関係は、 :func:`distutils.core.setup` 関数のキーワード引数を利用して" "指定することができます。" @@ -682,8 +684,8 @@ msgid "" "``'mymodule'`` and ``'xml.parsers.expat'``." msgstr "" "あるモジュールかパッケージの任意のバージョンが必要な場合、指定する文字列はモ" -"ジュール名かパッケージ名になります。例えば、 ``'mymodule'`` や ``'xml." -"parsers.expat'`` を含みます。" +"ジュール名かパッケージ名になります。例えば、 ``'mymodule'`` や " +"``'xml.parsers.expat'`` を含みます。" #: ../../distutils/setupscript.rst:386 msgid "" @@ -821,9 +823,9 @@ msgid "" "complicated. The only clever feature is that if the first line of the script " "starts with ``#!`` and contains the word \"python\", the Distutils will " "adjust the first line to refer to the current interpreter location. By " -"default, it is replaced with the current interpreter location. The :option:" -"`!--executable` (or :option:`!-e`) option will allow the interpreter path to " -"be explicitly overridden." +"default, it is replaced with the current interpreter location. " +"The :option:`!--executable` (or :option:`!-e`) option will allow the " +"interpreter path to be explicitly overridden." msgstr "" "スクリプトとは、Python ソースコードを含むファイルで、コマンドラインから実行で" "きるよう作られているものです。スクリプトは Distutils に複雑なことを一切させま" @@ -974,16 +976,16 @@ msgstr "" #: ../../distutils/setupscript.rst:547 msgid "" "You can specify the ``data_files`` options as a simple sequence of files " -"without specifying a target directory, but this is not recommended, and the :" -"command:`install` command will print a warning in this case. To install data " -"files directly in the target directory, an empty string should be given as " -"the directory." +"without specifying a target directory, but this is not recommended, and " +"the :command:`install` command will print a warning in this case. To install " +"data files directly in the target directory, an empty string should be given " +"as the directory." msgstr "" "``data_files`` オプションは、ターゲットディレクトリを指定せずに、単にファイル" -"の列を指定できます。しかし、このやり方は推奨されておらず、指定すると :" -"command:`install` コマンドが警告を出力します。ターゲットディレクトリにデータ" -"ファイルを直接インストールしたいなら、ディレクトリ名として空文字列を指定して" -"ください。" +"の列を指定できます。しかし、このやり方は推奨されておらず、指定する" +"と :command:`install` コマンドが警告を出力します。ターゲットディレクトリに" +"データファイルを直接インストールしたいなら、ディレクトリ名として空文字列を指" +"定してください。" #: ../../distutils/setupscript.rst:553 msgid "" diff --git a/distutils/sourcedist.po b/distutils/sourcedist.po index ac0f74000..a00d60b5b 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 @@ -33,14 +33,15 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../distutils/sourcedist.rst:9 msgid "" -"As shown in section :ref:`distutils-simple-example`, you use the :command:" -"`sdist` command to create a source distribution. In the simplest case, ::" +"As shown in section :ref:`distutils-simple-example`, you use " +"the :command:`sdist` command to create a source distribution. In the " +"simplest case, ::" msgstr "" ":ref:`distutils-simple-example` 節で示したように、ソースコード配布物を作成す" "るには :command:`sdist` コマンドを使います。最も単純な例では、 ::" @@ -49,14 +50,14 @@ msgstr "" msgid "" "(assuming you haven't specified any :command:`sdist` options in the setup " "script or config file), :command:`sdist` creates the archive of the default " -"format for the current platform. The default format is a gzip'ed tar file (:" -"file:`.tar.gz`) on Unix, and ZIP file on Windows." +"format for the current platform. The default format is a gzip'ed tar file " +"(:file:`.tar.gz`) on Unix, and ZIP file on Windows." msgstr "" "のようにします (ここでは、 :command:`sdist` に関するオプションを setup スクリ" "プトや設定ファイル中で行っていないものと仮定します)。 :command:`sdist` は、現" "在のプラットフォームでのデフォルトのアーカイブ形式でアーカイブを生成します。" -"デフォルトの形式は Unixでは gzip で圧縮された tar ファイル形式 (:file:`.tar." -"gz`) で、Windows では ZIP 形式です。" +"デフォルトの形式は Unixでは gzip で圧縮された tar ファイル形式 " +"(:file:`.tar.gz`) で、Windows では ZIP 形式です。" #: ../../distutils/sourcedist.rst:19 msgid "" @@ -254,13 +255,14 @@ msgstr "" #: ../../distutils/sourcedist.rst:103 msgid "" -"Any of the standard README files (:file:`README`, :file:`README.txt`, or :" -"file:`README.rst`), :file:`setup.py` (or whatever you called your setup " +"Any of the standard README files (:file:`README`, :file:`README.txt`, " +"or :file:`README.rst`), :file:`setup.py` (or whatever you called your setup " "script), and :file:`setup.cfg`." msgstr "" -"標準 README ファイル (:file:`README`, :file:`README.txt`, :file:`README." -"rst`) のどれか、 :file:`setup.py` (または setup スクリプトにしているもの) 、" -"および :file:`setup.cfg` 。" +"標準 README ファイル " +"(:file:`README`, :file:`README.txt`, :file:`README.rst`) のどれ" +"か、 :file:`setup.py` (または setup スクリプトにしているもの) 、およ" +"び :file:`setup.cfg` 。" #: ../../distutils/sourcedist.rst:107 msgid "" @@ -283,19 +285,20 @@ msgid "" "Sometimes this is enough, but usually you will want to specify additional " "files to distribute. The typical way to do this is to write a *manifest " "template*, called :file:`MANIFEST.in` by default. The manifest template is " -"just a list of instructions for how to generate your manifest file, :file:" -"`MANIFEST`, which is the exact list of files to include in your source " -"distribution. The :command:`sdist` command processes this template and " -"generates a manifest based on its instructions and what it finds in the " +"just a list of instructions for how to generate your manifest " +"file, :file:`MANIFEST`, which is the exact list of files to include in your " +"source distribution. The :command:`sdist` command processes this template " +"and generates a manifest based on its instructions and what it finds in the " "filesystem." msgstr "" "上記のセットで十分なこともありますが、大抵他のファイルを配布物に含めたいと思" "うでしょう。普通は、 :file:`MANIFEST.in` と呼ばれる *マニフェストテンプレー" "ト (manifest template)* を使ってこれを行います。マニフェストテンプレートは、" -"ソース配布物に含めるファイルの正確なリストであるマニフェストファイル :file:" -"`MANIFEST` をどうやって作成するか指示しているリストです。 :command:`sdist` コ" -"マンドはこのテンプレートを処理し、書かれた指示とファイルシステム上に見つかっ" -"たファイルに基づいてマニフェストファイルを作成します。" +"ソース配布物に含めるファイルの正確なリストであるマニフェストファイ" +"ル :file:`MANIFEST` をどうやって作成するか指示しているリストで" +"す。 :command:`sdist` コマンドはこのテンプレートを処理し、書かれた指示とファ" +"イルシステム上に見つかったファイルに基づいてマニフェストファイルを作成しま" +"す。" #: ../../distutils/sourcedist.rst:121 msgid "" @@ -312,9 +315,9 @@ msgstr "" #: ../../distutils/sourcedist.rst:126 msgid "" -"An existing generated :file:`MANIFEST` will be regenerated without :command:" -"`sdist` comparing its modification time to the one of :file:`MANIFEST.in` " -"or :file:`setup.py`." +"An existing generated :file:`MANIFEST` will be regenerated " +"without :command:`sdist` comparing its modification time to the one " +"of :file:`MANIFEST.in` or :file:`setup.py`." msgstr "" ":command:`sdist` は :file:`MANIFEST.in` もしくは :file:`setup.py` と更新時刻" "を比較せずに、生成されて既に存在している :file:`MANIFEST` を再生成します。" @@ -366,14 +369,14 @@ msgid "" msgstr "" "その意味はかなり明白です: 配布物ルートの :file:`\\*.txt` のパターンに当て嵌ま" "る全てのファイルと、 :file:`examples` ディレクトリ以下の :file:`\\*.txt` また" -"は :file:`\\*.py` のパターンに当て嵌まる全てのファイルを含み、 :file:" -"`examples/sample?/build` のパターンに当て嵌まる全てのディレクトリを除外しま" -"す。これらの処理は、標準で含むファイル一式が定まった *後に* 行われ、マニフェ" -"ストテンプレートに明示的に指示を書くことで、標準のファイル一式からファイルを" -"除外することができます。 (もしくは、 :option:`!--no-defaults` オプションを" -"使って、標準のファイル一式の定義を全て無効にすることもできます。) マニフェス" -"トテンプレートの小言語では、他にもいくつかのコマンドが利用できます; :ref:" -"`sdist-cmd` を参照してください。" +"は :file:`\\*.py` のパターンに当て嵌まる全てのファイルを含" +"み、 :file:`examples/sample?/build` のパターンに当て嵌まる全てのディレクトリ" +"を除外します。これらの処理は、標準で含むファイル一式が定まった *後に* 行わ" +"れ、マニフェストテンプレートに明示的に指示を書くことで、標準のファイル一式か" +"らファイルを除外することができます。 (もしくは、 :option:`!--no-defaults` オ" +"プションを使って、標準のファイル一式の定義を全て無効にすることもできます。) " +"マニフェストテンプレートの小言語では、他にもいくつかのコマンドが利用できま" +"す; :ref:`sdist-cmd` を参照してください。" #: ../../distutils/sourcedist.rst:163 msgid "" @@ -397,11 +400,12 @@ msgstr "" #: ../../distutils/sourcedist.rst:171 msgid "" -"all files in directories named :file:`RCS`, :file:`CVS`, :file:`.svn`, :file:" -"`.hg`, :file:`.git`, :file:`.bzr` or :file:`_darcs`" +"all files in directories " +"named :file:`RCS`, :file:`CVS`, :file:`.svn`, :file:`.hg`, :file:`.git`, :file:`.bzr` " +"or :file:`_darcs`" msgstr "" -":file:`RCS`, :file:`CVS`, :file:`.svn`, :file:`.hg`, :file:`.git`, :file:`." -"bzr`, :file:`_darcs` といった名前のディレクトリ下にある全てのファイル" +":file:`RCS`, :file:`CVS`, :file:`.svn`, :file:`.hg`, :file:`.git`, :file:`.bzr`, :file:`_darcs` " +"といった名前のディレクトリ下にある全てのファイル" #: ../../distutils/sourcedist.rst:174 msgid "" @@ -414,17 +418,17 @@ msgstr "" #: ../../distutils/sourcedist.rst:177 msgid "" "You can disable the default set of included files with the :option:`!--no-" -"defaults` option, and you can disable the standard exclude set with :option:" -"`!--no-prune`." +"defaults` option, and you can disable the standard exclude set " +"with :option:`!--no-prune`." msgstr "" "含めるファイルのデフォルトセットは :option:`!--no-defaults` で無効化でき、標" "準で除外するセットは :option:`!--no-prune` で無効化できます。" #: ../../distutils/sourcedist.rst:181 msgid "" -"Following the Distutils' own manifest template, let's trace how the :command:" -"`sdist` command builds the list of files to include in the Distutils source " -"distribution:" +"Following the Distutils' own manifest template, let's trace how " +"the :command:`sdist` command builds the list of files to include in the " +"Distutils source distribution:" msgstr "" "Distutils 自体のマニフェストテンプレートから、 :command:`sdist` コマンドがど" "のようにして Distutils ソース配布物に含めるファイルのリストを作成するか見てみ" @@ -432,10 +436,10 @@ msgstr "" #: ../../distutils/sourcedist.rst:185 msgid "" -"include all Python source files in the :file:`distutils` and :file:" -"`distutils/command` subdirectories (because packages corresponding to those " -"two directories were mentioned in the ``packages`` option in the setup " -"script---see section :ref:`setup-script`)" +"include all Python source files in the :file:`distutils` " +"and :file:`distutils/command` subdirectories (because packages corresponding " +"to those two directories were mentioned in the ``packages`` option in the " +"setup script---see section :ref:`setup-script`)" msgstr "" ":file:`distutils` ディレクトリ、および :file:`distutils/command` サブディレク" "トリの下にある全ての Python ソースファイルを含めます (これらの二つのディレク" @@ -456,8 +460,9 @@ msgstr ":file:`test/test\\*.py` (標準のファイルセット) を含めます #: ../../distutils/sourcedist.rst:195 msgid "" -"include :file:`\\*.txt` in the distribution root (this will find :file:" -"`README.txt` a second time, but such redundancies are weeded out later)" +"include :file:`\\*.txt` in the distribution root (this will " +"find :file:`README.txt` a second time, but such redundancies are weeded out " +"later)" msgstr "" "配布物ルート下の :file:`\\*.txt` を含めます (この処理で、 :file:`README.txt` " "がもう一度見つかりますが、こうした冗長性は後で刈り取られます)" @@ -467,15 +472,15 @@ msgid "" "include anything matching :file:`\\*.txt` or :file:`\\*.py` in the sub-tree " "under :file:`examples`," msgstr "" -":file:`examples` 下にあるサブツリー内で :file:`\\*.txt` または :file:`\\*." -"py` にマッチする全てのファイルを含めます" +":file:`examples` 下にあるサブツリー内で :file:`\\*.txt` また" +"は :file:`\\*.py` にマッチする全てのファイルを含めます" #: ../../distutils/sourcedist.rst:201 msgid "" -"exclude all files in the sub-trees starting at directories matching :file:" -"`examples/sample?/build`\\ ---this may exclude files included by the " -"previous two steps, so it's important that the ``prune`` command in the " -"manifest template comes after the ``recursive-include`` command" +"exclude all files in the sub-trees starting at directories " +"matching :file:`examples/sample?/build`\\ ---this may exclude files included " +"by the previous two steps, so it's important that the ``prune`` command in " +"the manifest template comes after the ``recursive-include`` command" msgstr "" "ディレクトリ名が :file:`examples/sample?/build` にマッチするディレクトリ以下" "のサブツリー内にあるファイル全てを除外します--- この操作によって、上の二つの" @@ -485,13 +490,13 @@ msgstr "" #: ../../distutils/sourcedist.rst:206 msgid "" -"exclude the entire :file:`build` tree, and any :file:`RCS`, :file:`CVS`, :" -"file:`.svn`, :file:`.hg`, :file:`.git`, :file:`.bzr` and :file:`_darcs` " -"directories" +"exclude the entire :file:`build` tree, and " +"any :file:`RCS`, :file:`CVS`, :file:`.svn`, :file:`.hg`, :file:`.git`, :file:`.bzr` " +"and :file:`_darcs` directories" msgstr "" -":file:`build` ツリー全体、および :file:`RCS`, :file:`CVS`, :file:`.svn`, :" -"file:`.hg`, :file:`.git`, :file:`.bzr`, :file:`_darcs` ディレクトリ全てを除外" -"します。" +":file:`build` ツリー全体、およ" +"び :file:`RCS`, :file:`CVS`, :file:`.svn`, :file:`.hg`, :file:`.git`, :file:`.bzr`, :file:`_darcs` " +"ディレクトリ全てを除外します。" #: ../../distutils/sourcedist.rst:210 msgid "" @@ -522,17 +527,17 @@ msgid "" "does not have a comment indicating it is generated from :file:`MANIFEST.in`, " "then it is used as is, unaltered" msgstr "" -"マニフェストファイル (デフォルトでは :file:`MANIFEST`) が存在し、1行目に :" -"file:`MANIFEST.in` から生成されたことを示すコメントが無い場合は、変更を加えず" -"にそのまま使用します" +"マニフェストファイル (デフォルトでは :file:`MANIFEST`) が存在し、1行目" +"に :file:`MANIFEST.in` から生成されたことを示すコメントが無い場合は、変更を加" +"えずにそのまま使用します" #: ../../distutils/sourcedist.rst:227 msgid "" "if the manifest file doesn't exist or has been previously automatically " "generated, read :file:`MANIFEST.in` and create the manifest" msgstr "" -"マニフェストファイルが存在しないか、前回自動生成されていた場合は、 :file:" -"`MANIFEST.in` を読み込み、マニフェストを作成します" +"マニフェストファイルが存在しないか、前回自動生成されていた場合" +"は、 :file:`MANIFEST.in` を読み込み、マニフェストを作成します" #: ../../distutils/sourcedist.rst:230 msgid "" @@ -552,13 +557,13 @@ msgstr "" #: ../../distutils/sourcedist.rst:236 msgid "" -"There are a couple of options that modify this behaviour. First, use the :" -"option:`!--no-defaults` and :option:`!--no-prune` to disable the standard " -"\"include\" and \"exclude\" sets." +"There are a couple of options that modify this behaviour. First, use " +"the :option:`!--no-defaults` and :option:`!--no-prune` to disable the " +"standard \"include\" and \"exclude\" sets." msgstr "" "上の動作は二種類のオプションを使って変更できます。まず、標準の \"include\" お" -"よび \"exclude\" セットを無効化するには :option:`!--no-defaults` および :" -"option:`!--no-prune` を使います。" +"よび \"exclude\" セットを無効化するには :option:`!--no-defaults` およ" +"び :option:`!--no-prune` を使います。" #: ../../distutils/sourcedist.rst:240 msgid "" 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..af206845b 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 @@ -38,10 +38,10 @@ msgstr "" #: ../../extending/building.rst:12 msgid "" -"To be importable, the shared library must be available on :envvar:" -"`PYTHONPATH`, and must be named after the module name, with an appropriate " -"extension. When using setuptools, the correct filename is generated " -"automatically." +"To be importable, the shared library must be available " +"on :envvar:`PYTHONPATH`, and must be named after the module name, with an " +"appropriate extension. When using setuptools, the correct filename is " +"generated automatically." msgstr "" "インポートできるように、共有ライブラリは使える状態で :envvar:`PYTHONPATH` 上" "になければならず、ファイル名をモジュール名に揃え、適切な拡張子になっていなけ" @@ -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..a688c098f 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 @@ -70,10 +70,10 @@ msgstr "" msgid "" "So if you are embedding Python, you are providing your own main program. " "One of the things this main program has to do is initialize the Python " -"interpreter. At the very least, you have to call the function :c:func:" -"`Py_Initialize`. There are optional calls to pass command line arguments to " -"Python. Then later you can call the interpreter from any part of the " -"application." +"interpreter. At the very least, you have to call the " +"function :c:func:`Py_Initialize`. There are optional calls to pass command " +"line arguments to Python. Then later you can call the interpreter from any " +"part of the application." msgstr "" "従って、 Python の埋め込みを行う場合、自作のメインプログラムを提供しなければ" "なりません。メインプログラムがやらなければならないことの一つに、 Python イン" @@ -93,9 +93,10 @@ msgid "" msgstr "" "インタプリタを呼び出すには、異なるいくつかの方法があります: Python 文が入った" "文字列を :c:func:`PyRun_SimpleString` に渡す、 stdio ファイルポインタとファイ" -"ル名 (これはエラーメッセージ内でコードを識別するためだけのものです) を :c:" -"func:`PyRun_SimpleFile` に渡す、といった具合です。これまでの各章で説明した低" -"水準の操作を呼び出して、Python オブジェクトを構築したり使用したりもできます。" +"ル名 (これはエラーメッセージ内でコードを識別するためだけのものです) " +"を :c:func:`PyRun_SimpleFile` に渡す、といった具合です。これまでの各章で説明" +"した低水準の操作を呼び出して、Python オブジェクトを構築したり使用したりもでき" +"ます。" #: ../../extending/embedding.rst:41 msgid ":ref:`c-api-index`" @@ -125,7 +126,6 @@ msgstr "" "トを実行するためのものです。例えばこれは、一つのファイル上で何らかの操作を実" "現するのに利用できます。 ::" -#: ../../extending/embedding.rst:56 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -162,6 +162,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 "" @@ -177,17 +211,17 @@ msgstr "" #: ../../extending/embedding.rst:97 msgid "" -"Setting :c:member:`PyConfig.program_name` should be called before :c:func:" -"`Py_InitializeFromConfig` to inform the interpreter about paths to Python " -"run-time libraries. Next, the Python interpreter is initialized with :c:" -"func:`Py_Initialize`, followed by the execution of a hard-coded Python " -"script that prints the date and time. Afterwards, the :c:func:" -"`Py_FinalizeEx` call shuts the interpreter down, followed by the end of the " -"program. In a real program, you may want to get the Python script from " -"another source, perhaps a text-editor routine, a file, or a database. " -"Getting the Python code from a file can better be done by using the :c:func:" -"`PyRun_SimpleFile` function, which saves you the trouble of allocating " -"memory space and loading the file contents." +"Setting :c:member:`PyConfig.program_name` should be called " +"before :c:func:`Py_InitializeFromConfig` to inform the interpreter about " +"paths to Python run-time libraries. Next, the Python interpreter is " +"initialized with :c:func:`Py_Initialize`, followed by the execution of a " +"hard-coded Python script that prints the date and time. Afterwards, " +"the :c:func:`Py_FinalizeEx` call shuts the interpreter down, followed by the " +"end of the program. In a real program, you may want to get the Python " +"script from another source, perhaps a text-editor routine, a file, or a " +"database. Getting the Python code from a file can better be done by using " +"the :c:func:`PyRun_SimpleFile` function, which saves you the trouble of " +"allocating memory space and loading the file contents." msgstr "" #: ../../extending/embedding.rst:112 @@ -299,7 +333,6 @@ msgstr "" "Python スクリプト内で定義されている関数を実行するためのコードは以下のようにな" "ります:" -#: ../../extending/embedding.rst:162 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -374,6 +407,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 +494,6 @@ msgstr "" "(できた実行可能形式を :program:`call` と呼びましょう)、以下のような Python ス" "クリプトを実行することにします:" -#: ../../extending/embedding.rst:171 msgid "" "def multiply(a,b):\n" " print(\"Will compute\", a, \"times\", b)\n" @@ -398,45 +502,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. ::" +"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,14 +562,21 @@ 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 "" -"Once the script is loaded, the name we're looking for is retrieved using :c:" -"func:`PyObject_GetAttrString`. If the name exists, and the object returned " -"is callable, you can safely assume that it is a function. The program then " -"proceeds by constructing a tuple of arguments as normal. The call to the " -"Python function is then made with::" +"Once the script is loaded, the name we're looking for is retrieved " +"using :c:func:`PyObject_GetAttrString`. If the name exists, and the object " +"returned is callable, you can safely assume that it is a function. The " +"program then proceeds by constructing a tuple of arguments as normal. The " +"call to the Python function is then made with::" msgstr "" "ひとたびスクリプトが読み込まれると、 :c:func:`PyObject_GetAttrString` を使っ" "て必要な名前を取得できます。名前がスクリプト中に存在し、取得したオブジェクト" @@ -461,9 +584,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 +661,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,22 +713,21 @@ 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 "" -"To find out the required compiler and linker flags, you can execute the :" -"file:`python{X.Y}-config` script which is generated as part of the " +"To find out the required compiler and linker flags, you can execute " +"the :file:`python{X.Y}-config` script which is generated as part of the " "installation process (a :file:`python3-config` script may also be " "available). This script has several options, of which the following will be " "directly useful to you:" @@ -619,12 +744,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 +760,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" +"-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,27 +780,26 @@ 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 `) you will have to read your system's documentation about dynamic " -"linking and/or examine Python's :file:`Makefile` (use :func:`sysconfig." -"get_makefile_filename` to find its location) and compilation options. In " -"this case, the :mod:`sysconfig` module is a useful tool to programmatically " -"extract the configuration values that you will want to combine together. " -"For example:" -msgstr "" -"もしこの手順でうまくいかなければ(たしかにこれは全ての Unix 的なプラットフォー" -"ムで動作することを保障するものではないですが、 :ref:`bug reports ` は歓迎です)、あなたのシステムのダイナミックリンクについてのドキュメン" -"トを読み、Python の :file:`Makefile` のコンパイルオプションを調べる必要がある" -"でしょう(Makefile の場所を調べるには :func:`sysconfig.get_makefile_filename` " -"を使ってください)。この場合、 :mod:`sysconfig` モジュールが役に立つ道具になり" -"ます。これによってあなたが付け加えたいコンパイル・リンクのオプション構成をプ" -"ログラム的に抽出できます。例えば:" - -#: ../../extending/embedding.rst:346 +"linking and/or examine Python's :file:`Makefile` " +"(use :func:`sysconfig.get_makefile_filename` to find its location) and " +"compilation options. In this case, the :mod:`sysconfig` module is a useful " +"tool to programmatically extract the configuration values that you will want " +"to combine together. For example:" +msgstr "" +"この手順でうまくいかない場合は、システムの動的リンクに関するドキュメントを読" +"むか、Python の :file:`Makefile` とコンパイルオプションを調べる、あるいはその" +"両方を行う必要があります。\n" +"すべての Unix 系プラットフォームで動作する保証はありませんが、:ref:`バグ報告 " +"` は歓迎します。\n" +"Makefile の場所は :func:`sysconfig.get_makefile_filename` で調べられます。\n" +"この場合、:mod:`sysconfig` モジュールを使うと、組み合わせたい設定値をプログラ" +"ムで抽出できて便利です。\n" +"例えば、次のように使います。" + msgid "" ">>> import sysconfig\n" ">>> sysconfig.get_config_var('LIBS')\n" @@ -679,3 +807,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..24a3612d9 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 @@ -40,10 +40,10 @@ msgid "" "they can call C library functions and system calls." msgstr "" "C プログラムの書き方を知っているなら、Python に新たな組み込みモジュールを追加" -"するのはきわめて簡単です。この新たなモジュール、拡張モジュール (:dfn:" -"`extension module`) を使うと、Python が直接行えない二つのこと: 新しい組み込み" -"オブジェクトの実装、そして全ての C ライブラリ関数とシステムコールに対する呼び" -"出し、ができるようになります。" +"するのはきわめて簡単です。この新たなモジュール、拡張モジュール " +"(:dfn:`extension module`) を使うと、Python が直接行えない二つのこと: 新しい組" +"み込みオブジェクトの実装、そして全ての C ライブラリ関数とシステムコールに対す" +"る呼び出し、ができるようになります。" #: ../../extending/extending.rst:15 msgid "" @@ -80,11 +80,11 @@ msgstr "" "C 拡張のインターフェイスは CPython に固有のものであり、これによる拡張モジュー" "ルはほかの Python 実装では動作しません。多くの場合、C 拡張を書くことを避けて" "ほかの Python 実装のために移植性を確保することは可能です。たとえば、あなたが" -"したいことが C ライブラリの関数やシステムコールを呼び出すことである場合、 :" -"mod:`ctypes` あるいは `cffi `_ ライブラリの利用" -"を検討すべきです。これらのモジュールは C コードとインターフェイスし、C 拡張を" -"書いてコンパイルするのに較べて Python 実装間のより高い移植性をもった Python " -"コードを書かせてくれます。" +"したいことが C ライブラリの関数やシステムコールを呼び出すことである場" +"合、 :mod:`ctypes` あるいは `cffi `_ ライブラリ" +"の利用を検討すべきです。これらのモジュールは C コードとインターフェイスし、C " +"拡張を書いてコンパイルするのに較べて Python 実装間のより高い移植性をもった " +"Python コードを書かせてくれます。" #: ../../extending/extending.rst:40 msgid "A Simple Example" @@ -113,9 +113,9 @@ msgstr "" #: ../../extending/extending.rst:53 msgid "" "Begin by creating a file :file:`spammodule.c`. (Historically, if a module " -"is called ``spam``, the C file containing its implementation is called :file:" -"`spammodule.c`; if the module name is very long, like ``spammify``, the " -"module name can be just :file:`spammify.c`.)" +"is called ``spam``, the C file containing its implementation is " +"called :file:`spammodule.c`; if the module name is very long, like " +"``spammify``, the module name can be just :file:`spammify.c`.)" msgstr "" "まずは :file:`spammodule.c` を作成するところから始めます。 (伝統として、 " "``spam`` という名前のモジュールを作成する場合、モジュールの実装が入った C " @@ -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 "" @@ -166,19 +168,20 @@ msgstr "" msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " "or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, ``\"Python." -"h\"`` includes a few standard header files: ````, ````, " -"````, and ````. If the latter header file does not exist " -"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " -"and :c:func:`realloc` directly." +"and since they are used extensively by the Python interpreter, " +"``\"Python.h\"`` includes a few standard header files: ````, " +"````, ````, and ````. If the latter header " +"file does not exist on your system, it declares the " +"functions :c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly." msgstr "" ":file:`Python.h` で定義されているユーザから可視のシンボルは、全て接頭辞 " "``Py`` または ``PY`` が付いています。ただし、標準ヘッダファイル内の定義は除き" "ます。簡単のためと、Python 内で広範に使うことになるという理由から、 " -"``\"Python.h\"`` はいくつかの標準ヘッダファイル: ```` 、 ```` 、 ```` 、および ```` をインクルードしています。後者" -"のヘッダファイルがシステム上になければ、 ``\"Python.h\"`` が関数 :c:func:" -"`malloc` 、 :c:func:`free` および :c:func:`realloc` を直接定義します。" +"``\"Python.h\"`` はいくつかの標準ヘッダファイル: ```` 、 " +"```` 、 ```` 、および ```` をインクルードしてい" +"ます。後者のヘッダファイルがシステム上になければ、 ``\"Python.h\"`` が関" +"数 :c:func:`malloc` 、 :c:func:`free` および :c:func:`realloc` を直接定義しま" +"す。" #: ../../extending/extending.rst:85 msgid "" @@ -238,10 +241,11 @@ msgstr "" "*args* 引数は、引数の入った Python タプルオブジェクトへのポインタになります。" "タプル内の各要素は、呼び出しの際の引数リストにおける各引数に対応します。引数" "は Python オブジェクトです --- C 関数で引数を使って何かを行うには、オブジェク" -"トから C の値に変換せねばなりません。Python API の関数 :c:func:" -"`PyArg_ParseTuple` は引数の型をチェックし、C の値に変換します。 :c:func:" -"`PyArg_ParseTuple` はテンプレート文字列を使って、引数オブジェクトの型と、変換" -"された値を入れる C 変数の型を判別します。これについては後で詳しく説明します。" +"トから C の値に変換せねばなりません。Python API の関" +"数 :c:func:`PyArg_ParseTuple` は引数の型をチェックし、C の値に変換しま" +"す。 :c:func:`PyArg_ParseTuple` はテンプレート文字列を使って、引数オブジェク" +"トの型と、変換された値を入れる C 変数の型を判別します。これについては後で詳し" +"く説明します。" #: ../../extending/extending.rst:118 msgid "" @@ -291,33 +295,33 @@ msgid "" "and stored as the \"associated value\" of the exception." msgstr "" "もっともよく用いられるのは :c:func:`PyErr_SetString` です。引数は例外オブジェ" -"クトと C 文字列です。例外オブジェクトは通常、 :c:data:" -"`PyExc_ZeroDivisionError` のような定義済みのオブジェクトです。 C 文字列はエ" -"ラーの原因を示し、Python 文字列オブジェクトに変換されて例外の \"付属値\" に保" -"存されます。" +"クトと C 文字列です。例外オブジェクトは通" +"常、 :c:data:`PyExc_ZeroDivisionError` のような定義済みのオブジェクトです。 " +"C 文字列はエラーの原因を示し、Python 文字列オブジェクトに変換されて例外の " +"\"付属値\" に保存されます。" #: ../../extending/extending.rst:147 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " -"global variable :c:data:`errno`. The most general function is :c:func:" -"`PyErr_SetObject`, which takes two object arguments, the exception and its " -"associated value. You don't need to :c:func:`Py_INCREF` the objects passed " -"to any of these functions." +"global variable :c:data:`errno`. The most general function " +"is :c:func:`PyErr_SetObject`, which takes two object arguments, the " +"exception and its associated value. You don't need to :c:func:`Py_INCREF` " +"the objects passed to any of these functions." msgstr "" "もう一つ有用な関数として :c:func:`PyErr_SetFromErrno` があります。この関数は" "引数に例外だけをとり、付属値はグローバル変数 :c:data:`errno` から構築します。" "もっとも汎用的な関数は :c:func:`PyErr_SetObject` で、二つのオブジェクト、例外" -"と付属値を引数にとります。これら関数に渡すオブジェクトには :c:func:" -"`Py_INCREF` を使う必要はありません。" +"と付属値を引数にとります。これら関数に渡すオブジェクトに" +"は :c:func:`Py_INCREF` を使う必要はありません。" #: ../../extending/extending.rst:154 msgid "" -"You can test non-destructively whether an exception has been set with :c:" -"func:`PyErr_Occurred`. This returns the current exception object, or " -"``NULL`` if no exception has occurred. You normally don't need to call :c:" -"func:`PyErr_Occurred` to see whether an error occurred in a function call, " -"since you should be able to tell from the return value." +"You can test non-destructively whether an exception has been set " +"with :c:func:`PyErr_Occurred`. This returns the current exception object, " +"or ``NULL`` if no exception has occurred. You normally don't need to " +"call :c:func:`PyErr_Occurred` to see whether an error occurred in a function " +"call, since you should be able to tell from the return value." msgstr "" "例外がセットされているかどうかは、 :c:func:`PyErr_Occurred` を使って非破壊的" "に調べられます。この関数は現在の例外オブジェクトを返します。例外が発生してい" @@ -325,7 +329,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 +340,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 +359,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 "" @@ -369,60 +373,70 @@ msgid "" "pass the error on to the interpreter but wants to handle it completely by " "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" -"ある関数呼び出しでの処理の失敗によってセットされた例外を無視するには、 :c:" -"func:`PyErr_Clear` を呼び出して例外状態を明示的に消去しなくてはなりません。エ" -"ラーをインタプリタには渡したくなく、自前で (何か他の作業を行ったり、何も起こ" -"らなかったかのように見せかけるような) エラー処理を完全に行う場合にのみ、 :c:" -"func:`PyErr_Clear` を呼び出すようにすべきです。" +"ある関数呼び出しでの処理の失敗によってセットされた例外を無視するに" +"は、 :c:func:`PyErr_Clear` を呼び出して例外状態を明示的に消去しなくてはなりま" +"せん。エラーをインタプリタには渡したくなく、自前で (何か他の作業を行ったり、" +"何も起こらなかったかのように見せかけるような) エラー処理を完全に行う場合にの" +"み、 :c:func:`PyErr_Clear` を呼び出すようにすべきです。" #: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " -"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" -"`PyErr_NoMemory` and return a failure indicator itself. All the object-" -"creating functions (for example, :c:func:`PyLong_FromLong`) already do this, " -"so this note is only relevant to those who call :c:func:`malloc` directly." +"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must " +"call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All " +"the object-creating functions (for example, :c:func:`PyLong_FromLong`) " +"already do this, so this note is only relevant to those who " +"call :c:func:`malloc` directly." 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:`malloc` の呼び出し失敗は、常に例外にしなくてはなりません " +"--- :c:func:`malloc` (または :c:func:`realloc`) を直接呼び出しているコード" +"は、 :c:func:`PyErr_NoMemory` を呼び出して、失敗を示す値を返さねばなりませ" +"ん。オブジェクトを生成する全ての関数 (例えば :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 "" -"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" -"c:func:`Py_DECREF` calls for objects you have already created) when you " +"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` " +"or :c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" 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 " "as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, " "you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` " -"to mean that a file couldn't be opened (that should probably be :c:data:" -"`PyExc_OSError`). If something's wrong with the argument list, the :c:func:" -"`PyArg_ParseTuple` function usually raises :c:data:`PyExc_TypeError`. If " -"you have an argument whose value must be in a particular range or must " -"satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." -msgstr "" +"to mean that a file couldn't be opened (that should probably " +"be :c:data:`PyExc_OSError`). If something's wrong with the argument list, " +"the :c:func:`PyArg_ParseTuple` function usually " +"raises :c:data:`PyExc_TypeError`. If 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 +478,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 +499,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 +515,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 +539,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" @@ -546,8 +587,8 @@ msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" -"次の文では、 :c:func:`PyArg_ParseTuple` で得た文字列を渡して Unix 関数 :c:" -"func:`system` を呼び出しています::" +"次の文では、 :c:func:`PyArg_ParseTuple` で得た文字列を渡して Unix 関" +"数 :c:func:`system` を呼び出しています::" #: ../../extending/extending.rst:290 msgid "sts = system(command);" @@ -556,8 +597,8 @@ msgstr "" #: ../../extending/extending.rst:292 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " -"a Python object. This is done using the function :c:func:" -"`PyLong_FromLong`. ::" +"a Python object. This is done using the " +"function :c:func:`PyLong_FromLong`. ::" msgstr "" #: ../../extending/extending.rst:295 @@ -576,8 +617,8 @@ msgstr "" msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " -"``None``. You need this idiom to do so (which is implemented by the :c:" -"macro:`Py_RETURN_NONE` macro)::" +"``None``. You need this idiom to do so (which is implemented by " +"the :c:macro:`Py_RETURN_NONE` macro)::" msgstr "" "何ら有用な値を返さない関数 (:c:expr:`void` を返す関数) に対応する Python の関" "数は ``None`` を返さねばなりません。関数に ``None`` を返させるには、以下のよ" @@ -639,12 +680,13 @@ msgstr "" #: ../../extending/extending.rst:334 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" -"level parameters to be passed in as a tuple acceptable for parsing via :c:" -"func:`PyArg_ParseTuple`; more information on this function is provided below." +"level parameters to be passed in as a tuple acceptable for parsing " +"via :c:func:`PyArg_ParseTuple`; more information on this function is " +"provided below." msgstr "" -"``METH_VARARGS`` だけを使う場合、C 関数は、Python レベルでの引数が :c:func:" -"`PyArg_ParseTuple` が受理できるタプルの形式で渡されるものと想定しなければなり" -"ません; この関数についての詳細は下で説明します。" +"``METH_VARARGS`` だけを使う場合、C 関数は、Python レベルでの引数" +"が :c:func:`PyArg_ParseTuple` が受理できるタプルの形式で渡されるものと想定し" +"なければなりません; この関数についての詳細は下で説明します。" #: ../../extending/extending.rst:338 msgid "" @@ -676,9 +718,9 @@ msgstr "" #: ../../extending/extending.rst:355 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " -"initialization function. The initialization function must be named :c:func:" -"`!PyInit_name`, where *name* is the name of the module, and should be the " -"only non-\\ ``static`` item defined in the module file::" +"initialization function. The initialization function must be " +"named :c:func:`!PyInit_name`, where *name* is the name of the module, and " +"should be the only non-\\ ``static`` item defined in the module file::" msgstr "" #: ../../extending/extending.rst:360 @@ -699,24 +741,25 @@ msgstr "" #: ../../extending/extending.rst:370 msgid "" -"When the Python program imports module :mod:`!spam` for the first time, :c:" -"func:`!PyInit_spam` is called. (See below for comments about embedding " -"Python.) It calls :c:func:`PyModule_Create`, which returns a module object, " -"and inserts built-in function objects into the newly created module based " -"upon the table (an array of :c:type:`PyMethodDef` structures) found in the " -"module definition. :c:func:`PyModule_Create` returns a pointer to the module " -"object that it creates. It may abort with a fatal error for certain errors, " -"or return ``NULL`` if the module could not be initialized satisfactorily. " -"The init function must return the module object to its caller, so that it " -"then gets inserted into ``sys.modules``." +"When the Python program imports module :mod:`!spam` for the first " +"time, :c:func:`!PyInit_spam` is called. (See below for comments about " +"embedding Python.) It calls :c:func:`PyModule_Create`, which returns a " +"module object, and inserts built-in function objects into the newly created " +"module based upon the table (an array of :c:type:`PyMethodDef` structures) " +"found in the module definition. :c:func:`PyModule_Create` returns a pointer " +"to the module object that it creates. It may abort with a fatal error for " +"certain errors, or return ``NULL`` if the module could not be initialized " +"satisfactorily. The init function must return the module object to its " +"caller, so that it then gets inserted into ``sys.modules``." msgstr "" #: ../../extending/extending.rst:381 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`PyImport_Inittab` " -"table. To add the module to the initialization table, use :c:func:" -"`PyImport_AppendInittab`, optionally followed by an import of the module::" +"table. To add the module to the initialization table, " +"use :c:func:`PyImport_AppendInittab`, optionally followed by an import of " +"the module::" msgstr "" #: ../../extending/extending.rst:386 @@ -817,16 +860,17 @@ msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " "loading, the details may depend on the style of dynamic loading your system " -"uses; see the chapters about building extension modules (chapter :ref:" -"`building`) and additional information that pertains only to building on " -"Windows (chapter :ref:`building-on-windows`) for more information about this." +"uses; see the chapters about building extension modules " +"(chapter :ref:`building`) and additional information that pertains only to " +"building on Windows (chapter :ref:`building-on-windows`) for more " +"information about this." msgstr "" "新しい拡張モジュールを使えるようになるまで、まだ二つの作業: コンパイルと、" "Python システムへのリンク、が残っています。動的読み込み (dynamic loading) を" "使っているのなら、作業の詳細は自分のシステムが使っている動的読み込みの形式に" -"よって変わるかもしれません; 詳しくは、拡張モジュールのビルドに関する章 (:ref:" -"`building` 章) や、Windows におけるビルドに関係する追加情報の章 (:ref:" -"`building-on-windows` 章) を参照してください。" +"よって変わるかもしれません; 詳しくは、拡張モジュールのビルドに関する章 " +"(:ref:`building` 章) や、Windows におけるビルドに関係する追加情報の章 " +"(:ref:`building-on-windows` 章) を参照してください。" #: ../../extending/extending.rst:466 msgid "" @@ -840,13 +884,12 @@ msgstr "" "動的読み込みを使えなかったり、モジュールを常時 Python インタプリタの一部にし" "ておきたい場合には、インタプリタのビルド設定を変更して再ビルドしなければなら" "なくなるでしょう。Unixでは、幸運なことにこの作業はとても単純です: 単に自作の" -"モジュールファイル (例えば :file:`spammodule.c`) を展開したソース配布物の :" -"file:`Modules/` ディレクトリに置き、 :file:`Modules/Setup.local` に自分の" -"ファイルを説明する以下の一行:" +"モジュールファイル (例えば :file:`spammodule.c`) を展開したソース配布物" +"の :file:`Modules/` ディレクトリに置き、 :file:`Modules/Setup.local` に自分" +"のファイルを説明する以下の一行:" -#: ../../extending/extending.rst:473 msgid "spam spammodule.o" -msgstr "" +msgstr "spam spammodule.o" #: ../../extending/extending.rst:477 msgid "" @@ -857,10 +900,10 @@ msgid "" "the :file:`Setup` file.)" msgstr "" "を追加して、トップレベルのディレクトリで :program:`make` を実行して、インタプ" -"リタを再ビルドするだけです。 :file:`Modules/` サブディレクトリでも :program:" -"`make` を実行できますが、前もって ':program:`make` Makefile' を実行して :" -"file:`Makefile` を再ビルドしておかなければならりません。(この作業は :file:" -"`Setup` ファイルを変更するたびに必要です。)" +"リタを再ビルドするだけです。 :file:`Modules/` サブディレクトリで" +"も :program:`make` を実行できますが、前もって ':program:`make` Makefile' を実" +"行して :file:`Makefile` を再ビルドしておかなければならりません。(この作業" +"は :file:`Setup` ファイルを変更するたびに必要です。)" #: ../../extending/extending.rst:483 msgid "" @@ -870,9 +913,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" @@ -925,11 +967,10 @@ msgstr "" "さねばなりません。このために、コールバック登録関数 (またはその他のインター" "フェース) を提供せねばなりません。このコールバック登録関数が呼び出された際" "に、引き渡された Python 関数オブジェクトへのポインタをグローバル変数に --- あ" -"るいは、どこか適切な場所に --- 保存します (関数オブジェクトを :c:func:" -"`Py_INCREF` するようよく注意してください!)。例えば、以下のような関数がモ" -"ジュールの一部になっていることでしょう::" +"るいは、どこか適切な場所に --- 保存します (関数オブジェクト" +"を :c:func:`Py_INCREF` するようよく注意してください!)。例えば、以下のような関" +"数がモジュールの一部になっていることでしょう::" -#: ../../extending/extending.rst:517 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -955,13 +996,37 @@ 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 "" -"This function must be registered with the interpreter using the :c:macro:" -"`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" -"c:func:`PyArg_ParseTuple` function and its arguments are documented in " -"section :ref:`parsetuple`." +"This function must be registered with the interpreter using " +"the :c:macro:`METH_VARARGS` flag; this is described in " +"section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its " +"arguments are documented in section :ref:`parsetuple`." msgstr "" #: ../../extending/extending.rst:545 @@ -974,31 +1039,31 @@ msgstr "" ":c:func:`Py_XINCREF` および :c:func:`Py_XDECREF` は、オブジェクトに対する参照" "カウントをインクリメント/デクリメントするためのマクロで、 ``NULL`` ポインタが" "渡されても安全に操作できる形式です (とはいえ、上の流れでは *temp* が " -"``NULL`` になることはありません)。これらのマクロと参照カウントについては、 :" -"ref:`refcounts` で説明しています。" +"``NULL`` になることはありません)。これらのマクロと参照カウントについて" +"は、 :ref:`refcounts` で説明しています。" #: ../../extending/extending.rst:552 msgid "" -"Later, when it is time to call the function, you call the C function :c:func:" -"`PyObject_CallObject`. This function has two arguments, both pointers to " -"arbitrary Python objects: the Python function, and the argument list. The " -"argument list must always be a tuple object, whose length is the number of " -"arguments. To call the Python function with no arguments, pass in ``NULL``, " -"or an empty tuple; to call it with one argument, pass a singleton tuple. :c:" -"func:`Py_BuildValue` returns a tuple when its format string consists of zero " -"or more format codes between parentheses. For example::" -msgstr "" -"その後、コールバック関数を呼び出す時が来たら、C 関数 :c:func:" -"`PyObject_CallObject` を呼び出します。この関数には二つの引数: Python 関数と " -"Python 関数の引数リストがあり、いずれも任意の Python オブジェクトを表すポイン" -"タ型です。引数リストは常にタプルオブジェクトでなければならず、その長さは引数" -"の数になります。Python 関数を引数なしで呼び出すのなら、 ``NULL`` か空のタプル" -"を渡します; 単一の引数で関数を呼び出すのなら、単要素 (singleton) のタプルを渡" -"します。 :c:func:`Py_BuildValue` の書式文字列中に、ゼロ個または一個以上の書式" -"化コードが入った丸括弧がある場合、この関数はタプルを返します。以下に例を示し" -"ます::" - -#: ../../extending/extending.rst:561 +"Later, when it is time to call the function, you call the C " +"function :c:func:`PyObject_CallObject`. This function has two arguments, " +"both pointers to arbitrary Python objects: the Python function, and the " +"argument list. The argument list must always be a tuple object, whose " +"length is the number of arguments. To call the Python function with no " +"arguments, pass in ``NULL``, or an empty tuple; to call it with one " +"argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple " +"when its format string consists of zero or more format codes between " +"parentheses. For example::" +msgstr "" +"その後、コールバック関数を呼び出す時が来たら、C 関" +"数 :c:func:`PyObject_CallObject` を呼び出します。この関数には二つの引数: " +"Python 関数と Python 関数の引数リストがあり、いずれも任意の Python オブジェク" +"トを表すポインタ型です。引数リストは常にタプルオブジェクトでなければならず、" +"その長さは引数の数になります。Python 関数を引数なしで呼び出すのなら、 " +"``NULL`` か空のタプルを渡します; 単一の引数で関数を呼び出すのなら、単要素 " +"(singleton) のタプルを渡します。 :c:func:`Py_BuildValue` の書式文字列中に、ゼ" +"ロ個または一個以上の書式化コードが入った丸括弧がある場合、この関数はタプルを" +"返します。以下に例を示します::" + msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -1011,22 +1076,33 @@ 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 "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " "\"reference-count-neutral\" with respect to its arguments. In the example a " -"new tuple was created to serve as the argument list, which is :c:func:" -"`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." +"new tuple was created to serve as the argument list, which " +"is :c:func:`Py_DECREF`\\ -ed immediately after " +"the :c:func:`PyObject_CallObject` call." msgstr "" ":c:func:`PyObject_CallObject` は Python オブジェクトへのポインタを返します: " "これは Python 関数からの戻り値になります。 :c:func:`PyObject_CallObject` は、" "引数に対して \"参照カウント中立 (reference-count- neutral)\" です。上の例では" -"タプルを生成して引数リストとして提供しており、このタプルは :c:func:" -"`PyObject_CallObject` の呼び出し直後に :c:func:`Py_DECREF` されています。" +"タプルを生成して引数リストとして提供しており、このタプル" +"は :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 +1110,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 +1126,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 +1157,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 +1178,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 "" @@ -1108,19 +1196,19 @@ msgid "" "checked." msgstr "" "``Py_DECREF(arglist)`` が呼び出しの直後、エラーチェックよりも前に置かれている" -"ことに注意してください! また、厳密に言えば、このコードは完全ではありません: :" -"c:func:`Py_BuildValue` はメモリ不足におちいるかもしれず、チェックしておくべき" -"です。" +"ことに注意してください! また、厳密に言えば、このコードは完全ではありませ" +"ん: :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. ::" +"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 +1231,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 +1241,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 +1256,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 +1274,6 @@ msgstr "" msgid "Some example calls::" msgstr "以下にいくつかの呼び出し例を示します::" -#: ../../extending/extending.rst:668 msgid "" "int ok;\n" "int i, j;\n" @@ -1198,28 +1284,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 +1332,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 +1354,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 +1371,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,37 +1389,39 @@ 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 "" -"The *arg* and *format* parameters are identical to those of the :c:func:" -"`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " -"keywords received as the third parameter from the Python runtime. The " -"*kwlist* parameter is a ``NULL``-terminated list of strings which identify " -"the parameters; the names are matched with the type information from " -"*format* from left to right. On success, :c:func:" -"`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and " -"raises an appropriate exception." +"The *arg* and *format* parameters are identical to those of " +"the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the " +"dictionary of keywords received as the third parameter from the Python " +"runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings " +"which identify the parameters; the names are matched with the type " +"information from *format* from left to right. On " +"success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it " +"returns false and raises an appropriate exception." msgstr "" "*arg* と *format* パラメタは :c:func:`PyArg_ParseTuple` のものと同じです。 " "*kwdict* パラメタはキーワード引数の入った辞書で、 Python ランタイムシステムか" "ら第三パラメタとして受け取ります。 *kwlist* パラメタは各パラメタを識別するた" "めの文字列からなる、 ``NULL`` 終端されたリストです; 各パラメタ名は *format* " -"中の型情報に対して左から右の順に照合されます。成功すると :c:func:" -"`PyArg_ParseTupleAndKeywords` は真を返し、それ以外の場合には適切な例外を送出" -"して偽を返します。" +"中の型情報に対して左から右の順に照合されます。成功する" +"と :c:func:`PyArg_ParseTupleAndKeywords` は真を返し、それ以外の場合には適切な" +"例外を送出して偽を返します。" #: ../../extending/extending.rst:750 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " -"parameters passed in which are not present in the *kwlist* will cause :exc:" -"`TypeError` to be raised." +"parameters passed in which are not present in the *kwlist* will " +"cause :exc:`TypeError` to be raised." msgstr "" "キーワード引数を使っている場合、タプルは入れ子にして使えません! *kwlist* 内に" "存在しないキーワードパラメタが渡された場合、 :exc:`TypeError` の送出を引き起" @@ -1373,24 +1498,23 @@ 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 "" -"It recognizes a set of format units similar to the ones recognized by :c:" -"func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " -"not output) must not be pointers, just values. It returns a new Python " -"object, suitable for returning from a C function called from Python." +"It recognizes a set of format units similar to the ones recognized " +"by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the " +"function, 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 +1527,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 +1542,6 @@ msgid "" msgstr "" "以下に例を示します (左に呼び出し例を、右に構築される Python 値を示します):" -#: ../../extending/extending.rst:833 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1438,6 +1561,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" @@ -1452,24 +1592,34 @@ msgid "" "restrict the following discussion to the C case." msgstr "" "C や C++のような言語では、プログラマはヒープ上のメモリを動的に確保したり解放" -"したりする責任があります。こうした作業は C では関数 :c:func:`malloc` や :c:" -"func:`free` で行います。C++では本質的に同じ意味で演算子 ``new`` や " +"したりする責任があります。こうした作業は C では関数 :c:func:`malloc` " +"や :c: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:" -"`free`. It is important to call :c:func:`free` at the right time. If a " -"block's address is forgotten but :c:func:`free` is not called for it, the " -"memory it occupies cannot be reused until the program terminates. This is " -"called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:" -"`free` for a block and then continues to use the block, it creates a " -"conflict with reuse of the block through another :c:func:`malloc` call. " -"This is called :dfn:`using freed memory`. It has the same bad consequences " -"as referencing uninitialized data --- core dumps, wrong results, mysterious " -"crashes." -msgstr "" +"returned to the pool of available memory by exactly one call " +"to :c:func:`free`. It is important to call :c:func:`free` at the right " +"time. If a block's address is forgotten but :c:func:`free` is not called " +"for it, the memory it occupies cannot be reused until the program " +"terminates. This is called a :dfn:`memory leak`. On the other hand, if a " +"program calls :c:func:`free` for a block and then continues to use the " +"block, it creates a conflict with reuse of the block through " +"another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It " +"has the same bad consequences 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 +1697,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,22 +1709,23 @@ 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 "" "The cycle detector is able to detect garbage cycles and can reclaim them. " -"The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." -"collect` function), as well as configuration interfaces and the ability to " -"disable the detector at runtime." +"The :mod:`gc` module exposes a way to run the detector " +"(the :func:`~gc.collect` function), as well as configuration interfaces and " +"the ability to disable the detector at runtime." msgstr "" "循環参照検出機構はそのようなガベージサイクル (前述したような循環参照オブジェ" "クト) を検出して回収することができます。\n" @@ -1587,23 +1737,24 @@ 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:" -"`Py_DECREF` also frees the object when the count reaches zero. For " -"flexibility, it doesn't call :c:func:`free` directly --- rather, it makes a " -"call through a function pointer in the object's :dfn:`type object`. For " -"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`) を介します。このために (他の" -"目的もありますが)、全てのオブジェクトには自身の型オブジェクトに対するポインタ" -"が入っています。" +"the incrementing and decrementing of the reference " +"count. :c:func:`Py_DECREF` also frees the object when the count reaches " +"zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, " +"it makes a call through a function pointer in the object's :dfn:`type " +"object`. For this purpose (and others), every object also contains a " +"pointer to its type object." +msgstr "" +"参照カウントを増減するマクロとして、``Py_INCREF(x)`` と ``Py_DECREF(x)`` があ" +"ります。\n" +":c:func:`Py_DECREF` は、カウントがゼロになるとオブジェクトの解放も行いま" +"す。\n" +"柔軟性を持たせるため、:c:func:`free` を直接呼び出すのではなく、オブジェクトの" +"型オブジェクト (:dfn:`type object`) にある関数ポインターを介して呼び出しま" +"す。\n" +"この目的などのために、すべてのオブジェクトは自身の型オブジェクトへのポイン" +"ターも持っています。" #: ../../extending/extending.rst:938 msgid "" @@ -1622,11 +1773,11 @@ msgstr "" "せてください。まず、オブジェクトは \"占有 (own)\" されることはありません; し" "かし、あるオブジェクトに対する参照の所有 :dfn:`own a reference` はできます。" "オブジェクトの参照カウントは、そのオブジェクトが参照の所有を受けている回数と" -"定義されています。参照の所有者は、参照が必要なくなった際に :c:func:" -"`Py_DECREF` を呼び出す役割を担います。参照の所有権は委譲 (transfer) できま" -"す。所有参照 (owned reference) の放棄には、渡す、保存する、 :c:func:" -"`Py_DECREF` を呼び出す、という三つの方法があります。所有参照を処理し忘れる" -"と、メモリリークを引き起こします。" +"定義されています。参照の所有者は、参照が必要なくなった際" +"に :c:func:`Py_DECREF` を呼び出す役割を担います。参照の所有権は委譲 " +"(transfer) できます。所有参照 (owned reference) の放棄には、渡す、保存す" +"る、 :c:func:`Py_DECREF` を呼び出す、という三つの方法があります。所有参照を処" +"理し忘れると、メモリリークを引き起こします。" #: ../../extending/extending.rst:947 msgid "" @@ -1661,29 +1812,28 @@ msgstr "" #: ../../extending/extending.rst:961 msgid "" -"A borrowed reference can be changed into an owned reference by calling :c:" -"func:`Py_INCREF`. This does not affect the status of the owner from which " -"the reference was borrowed --- it creates a new owned reference, and gives " -"full owner responsibilities (the new owner must dispose of the reference " -"properly, as well as the previous owner)." +"A borrowed reference can be changed into an owned reference by " +"calling :c:func:`Py_INCREF`. This does not affect the status of the owner " +"from which the reference was borrowed --- it creates a new owned reference, " +"and gives full owner responsibilities (the new owner must dispose of the " +"reference 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 "" @@ -1691,9 +1841,9 @@ msgid "" "the reference. In particular, all functions whose function it is to create " "a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, " "pass ownership to the receiver. Even if the object is not actually new, you " -"still receive ownership of a new reference to that object. For instance, :c:" -"func:`PyLong_FromLong` maintains a cache of popular values and can return a " -"reference to a cached item." +"still receive ownership of a new reference to that object. For " +"instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and " +"can return a reference to a cached item." msgstr "" "オブジェクトへの参照を返すほとんどの関数は、参照とともに所有権も渡します。特" "に、 :c:func:`PyLong_FromLong` や :c:func:`Py_BuildValue` のように、新しいオ" @@ -1702,23 +1852,21 @@ 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:" -"`PyObject_GetAttrString`. The picture is less clear, here, however, since a " -"few common routines are exceptions: :c:func:`PyTuple_GetItem`, :c:func:" -"`PyList_GetItem`, :c:func:`PyDict_GetItem`, and :c:func:" -"`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` は全て、タプル、リスト、または辞書から借用参照を返しま" -"す。" +"ownership with the reference, for " +"instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, " +"however, since a few common routines are " +"exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, " +"and :c:func:`PyDict_GetItemString` all return references that you borrow " +"from the tuple, list or dictionary." +msgstr "" +"ほかのオブジェクトからオブジェクトを取り出す多くの関数も、参照とともに所有権" +"を移します。\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 "" @@ -1735,18 +1883,20 @@ msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " "use :c:func:`Py_INCREF` to become an independent owner. There are exactly " -"two important exceptions to this rule: :c:func:`PyTuple_SetItem` and :c:func:" -"`PyList_SetItem`. These functions take over ownership of the item passed to " -"them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends " -"don't take over ownership --- they are \"normal.\")" +"two important exceptions to this rule: :c:func:`PyTuple_SetItem` " +"and :c:func:`PyList_SetItem`. These functions take over ownership of the " +"item passed to them --- even if they fail! (Note " +"that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they " +"are \"normal.\")" msgstr "" "オブジェクトへの参照を別の関数に渡す場合、一般的には、関数側は呼び出し手から" -"参照を借用します --- 参照を保存する必要があるなら、関数側は :c:func:" -"`Py_INCREF` を呼び出して独立した所有者になります。とはいえ、この規則には二つ" -"の重要な例外: :c:func:`PyTuple_SetItem` と :c:func:`PyList_SetItem` がありま" -"す。これらの関数は、渡された引数要素に対して所有権を乗っ取り (take over) ま" -"す --- たとえ失敗してもです! (:c:func:`PyDict_SetItem` とその仲間は所有権を" -"乗っ取りません --- これらはいわば \"普通の\" 関数です。)" +"参照を借用します --- 参照を保存する必要があるなら、関数側" +"は :c:func:`Py_INCREF` を呼び出して独立した所有者になります。とはいえ、この規" +"則には二つの重要な例外: :c:func:`PyTuple_SetItem` " +"と :c:func:`PyList_SetItem` があります。これらの関数は、渡された引数要素に対" +"して所有権を乗っ取り (take over) ます --- たとえ失敗してもです! " +"(:c:func:`PyDict_SetItem` とその仲間は所有権を乗っ取りません --- これらはいわ" +"ば \"普通の\" 関数です。)" #: ../../extending/extending.rst:1004 msgid "" @@ -1796,7 +1946,6 @@ msgstr "" "参照を借りている際に起きる、関係ないオブジェクトに対する :c:func:`Py_DECREF` " "の使用です。例えば::" -#: ../../extending/extending.rst:1027 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1807,6 +1956,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 +1985,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 +1994,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 +2012,6 @@ msgstr "" "問題の原因が分かれば、解決は簡単です。一時的に参照回数を増やせばよいのです。" "正しく動作するバージョンは以下のようになります::" -#: ../../extending/extending.rst:1058 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1860,13 +2024,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 "" @@ -1883,13 +2060,12 @@ msgstr "" "二つ目は、借用参照がスレッドに関係しているケースです。通常は、 Python インタ" "プリタにおける複数のスレッドは、グローバルインタプリタロックがオブジェクト空" "間全体を保護しているため、互いに邪魔し合うことはありません。とはいえ、ロック" -"は :c:macro:`Py_BEGIN_ALLOW_THREADS` マクロで一時的に解除したり、 :c:macro:" -"`Py_END_ALLOW_THREADS` で再獲得したりできます。これらのマクロはブロックの起こ" -"る I/O 呼び出しの周囲によく置かれ、 I/O が完了するまでの間に他のスレッドがプ" -"ロセッサを利用できるようにします。明らかに、以下の関数は上の例と似た問題をは" -"らんでいます::" +"は :c:macro:`Py_BEGIN_ALLOW_THREADS` マクロで一時的に解除した" +"り、 :c:macro:`Py_END_ALLOW_THREADS` で再獲得したりできます。これらのマクロは" +"ブロックの起こる I/O 呼び出しの周囲によく置かれ、 I/O が完了するまでの間に他" +"のスレッドがプロセッサを利用できるようにします。明らかに、以下の関数は上の例" +"と似た問題をはらんでいます::" -#: ../../extending/extending.rst:1082 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1901,6 +2077,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" @@ -1932,18 +2117,18 @@ msgid "" "a function that may raise an exception." msgstr "" "従って、 ``NULL`` のテストはオブジェクトの \"発生源\"、すなわち値が ``NULL`` " -"になるかもしれないポインタを受け取ったときだけにしましょう。 :c:func:" -"`malloc` や、例外を送出する可能性のある関数がその例です。" +"になるかもしれないポインタを受け取ったときだけにしましょ" +"う。 :c:func:`malloc` や、例外を送出する可能性のある関数がその例です。" #: ../../extending/extending.rst:1110 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " -"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" -"func:`Py_XDECREF` do." +"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` " +"and :c:func:`Py_XDECREF` do." msgstr "" "マクロ :c:func:`Py_INCREF` および :c:func:`Py_DECREF` は ``NULL`` ポインタの" -"チェックを行いません --- しかし、これらのマクロの変化形である :c:func:" -"`Py_XINCREF` および :c:func:`Py_XDECREF` はチェックを行います。" +"チェックを行いません --- しかし、これらのマクロの変化形であ" +"る :c:func:`Py_XINCREF` および :c:func:`Py_XDECREF` はチェックを行います。" #: ../../extending/extending.rst:1114 msgid "" @@ -1981,7 +2166,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 +2177,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 +2210,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 +2224,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 +2256,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 +2266,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 +2284,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 "" @@ -2113,12 +2299,12 @@ msgid "" "of runtime type-safety; there is no feasible way to tell one unnamed Capsule " "from another." msgstr "" -"どの方法を選ぶにしても、 Capsule の name を正しく設定することは重要です。 :c:" -"func:`PyCapsule_New` は name 引数 (:c:expr:`const char \\*`) を取ります。 " -"``NULL`` を name に渡すことも許可されていますが、 name を設定することを強く推" -"奨します。正しく名前を付けられた Capsule はある程度の実行時型安全性を持ちま" -"す。名前を付けられていない Capsule を他の Capsule と区別する現実的な方法はあ" -"りません。" +"どの方法を選ぶにしても、 Capsule の name を正しく設定することは重要で" +"す。 :c:func:`PyCapsule_New` は name 引数 (:c:expr:`const char \\*`) を取りま" +"す。 ``NULL`` を name に渡すことも許可されていますが、 name を設定することを" +"強く推奨します。正しく名前を付けられた Capsule はある程度の実行時型安全性を持" +"ちます。名前を付けられていない Capsule を他の Capsule と区別する現実的な方法" +"はありません。" #: ../../extending/extending.rst:1204 msgid "" @@ -2128,9 +2314,8 @@ msgstr "" "特に、 C API を公開するための Capsule には次のルールに従った名前を付けるべき" "です::" -#: ../../extending/extending.rst:1207 msgid "modulename.attributename" -msgstr "" +msgstr "modulename.attributename" #: ../../extending/extending.rst:1209 msgid "" @@ -2173,13 +2358,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 +2372,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 +2394,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 +2479,6 @@ msgstr "" "からくりの大部分はヘッダファイル :file:`spammodule.h` 内にあり、以下のように" "なっています::" -#: ../../extending/extending.rst:1296 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -2331,12 +2529,60 @@ 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 "" -"All that a client module must do in order to have access to the function :c:" -"func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" -"import_spam` in its initialization function::" +"All that a client module must do in order to have access to the " +"function :c:func:`!PySpam_System` is to call the function (or rather " +"macro) :c:func:`!import_spam` in its initialization function::" msgstr "" #: ../../extending/extending.rst:1348 @@ -2356,15 +2602,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 "" @@ -2387,8 +2631,8 @@ msgstr "脚注" #: ../../extending/extending.rst:1375 msgid "" -"An interface for this function already exists in the standard module :mod:" -"`os` --- it was chosen as a simple and straightforward example." +"An interface for this function already exists in the standard " +"module :mod:`os` --- it was chosen as a simple and straightforward example." msgstr "" "この関数へのインターフェースはすでに標準モジュール :mod:`os` にあります --- " "この関数を選んだのは、単純で直接的な例を示したいからです。" @@ -2419,17 +2663,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..8cc4630e2 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 @@ -64,8 +64,8 @@ msgstr "" #: ../../extending/index.rst:21 msgid "" -"For a detailed description of the whole Python/C API, see the separate :ref:" -"`c-api-index`." +"For a detailed description of the whole Python/C API, see the " +"separate :ref:`c-api-index`." msgstr "" "Python/C API 全体の詳しい説明は、別のドキュメントである、 :ref:`c-api-index` " "を参照してください。" @@ -78,9 +78,10 @@ msgstr "おすすめのサードパーティツール" msgid "" "This guide only covers the basic tools for creating extensions provided as " "part of this version of CPython. Third party tools like `Cython `_, `cffi `_, `SWIG `_ and `Numba `_ offer both simpler and " -"more sophisticated approaches to creating C and C++ extensions for Python." +"cython.org/>`_, `cffi `_, `SWIG `_ and `Numba `_ offer both simpler " +"and more sophisticated approaches to creating C and C++ extensions for " +"Python." msgstr "" "このガイドがカバーするのは、このバージョンの CPython の一部として提供されてい" "る、拡張を作成するための基本的なツールだけです。\n" @@ -91,11 +92,11 @@ msgstr "" #: ../../extending/index.rst:37 msgid "" -"`Python Packaging User Guide: Binary Extensions `_" +"`Python Packaging User Guide: Binary Extensions `_" msgstr "" -"`Python Packaging User Guide: Binary Extensions `_" +"`Python Packaging User Guide: Binary Extensions `_" #: ../../extending/index.rst:38 msgid "" @@ -127,14 +128,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..b10bcdb97 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,17 +276,16 @@ 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 "" "These fields tell the runtime how much memory to allocate when new objects " "of this type are created. Python has some built-in support for variable " -"length structures (think: strings, tuples) which is where the :c:member:" -"`~PyTypeObject.tp_itemsize` field comes in. This will be dealt with " -"later. ::" +"length structures (think: strings, tuples) which is where " +"the :c:member:`~PyTypeObject.tp_itemsize` field comes in. This will be " +"dealt with later. ::" msgstr "" "これらのフィールドは、この型のオブジェクトが新しく作成されるときにどれだけの" "メモリを割り当てればよいのかをランタイムに指示します。Python には可変長の構造" @@ -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::" +"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 "" @@ -284,8 +389,8 @@ msgid "" "additional Python code to be executed may detect that an exception has been " "set. This can lead to misleading errors from the interpreter. The proper " "way to protect against this is to save a pending exception before performing " -"the unsafe action, and restoring it when done. This can be done using the :" -"c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" +"the unsafe action, and restoring it when done. This can be done using " +"the :c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" msgstr "" "メモリ解放関数でひとつ重要なのは、処理待ちの例外にいっさい手をつけないことで" "す。なぜなら、解放用の関数は Python インタプリタがスタックを元の状態に戻すと" @@ -295,10 +400,9 @@ msgstr "" "行してしまうと、それらは例外が発生していることを検知するかもしれません。これ" "はインタプリタが誤解させるエラーを発生させることにつながります。これを防ぐ正" "しい方法は、安全でない操作を実行する前に処理待ちの例外を保存しておき、終わっ" -"たらそれを元に戻すことです。これは :c:func:`PyErr_Fetch` および :c:func:" -"`PyErr_Restore` 関数を使うことによって可能になります::" +"たらそれを元に戻すことです。これは :c:func:`PyErr_Fetch` およ" +"び :c:func:`PyErr_Restore` 関数を使うことによって可能になります::" -#: ../../extending/newtypes.rst:109 msgid "" "static void\n" "my_dealloc(PyObject *obj)\n" @@ -328,29 +432,59 @@ 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:" -"`~PyTypeObject.tp_traverse` and/or :c:member:`~PyTypeObject.tp_clear`), some " -"of the object's members can have been cleared or finalized by the time :c:" -"member:`~PyTypeObject.tp_dealloc` is called. Second, in :c:member:" -"`~PyTypeObject.tp_dealloc`, your object is in an unstable state: its " -"reference count is equal to zero. Any call to a non-trivial object or API " -"(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` を再度呼び出し、二重解放からクラッシュすることにな" -"るかもしれません。" +"First, if your type supports garbage collection " +"(using :c:member:`~PyTypeObject.tp_traverse` and/" +"or :c:member:`~PyTypeObject.tp_clear`), some of the object's members can " +"have been cleared or finalized by the " +"time :c:member:`~PyTypeObject.tp_dealloc` is called. Second, " +"in :c:member:`~PyTypeObject.tp_dealloc`, your object is in an unstable " +"state: its reference count is equal to zero. Any call to a non-trivial " +"object or API (as in the example above) might end up " +"calling :c:member:`~PyTypeObject.tp_dealloc` again, causing a double free " +"and a crash." +msgstr "" +"メモリ解放関数で安全に行えることには制限があります。\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 "" @@ -358,9 +492,10 @@ msgid "" "finalization code in :c:member:`~PyTypeObject.tp_dealloc`, and instead use " "the new :c:member:`~PyTypeObject.tp_finalize` type method." msgstr "" -"Python 3.4 からは、複雑なファイナライズのコードは :c:member:`~PyTypeObject." -"tp_dealloc` に置かず、代わりに新しく導入された :c:member:`~PyTypeObject." -"tp_finalize` という型メソッドを使うことが推奨されています。" +"Python 3.4 からは、複雑なファイナライズのコード" +"は :c:member:`~PyTypeObject.tp_dealloc` に置かず、代わりに新しく導入され" +"た :c:member:`~PyTypeObject.tp_finalize` という型メソッドを使うことが推奨され" +"ています。" #: ../../extending/newtypes.rst:152 msgid ":pep:`442` explains the new finalization scheme." @@ -373,19 +508,21 @@ msgstr "オブジェクト表現" #: ../../extending/newtypes.rst:161 msgid "" "In Python, there are two ways to generate a textual representation of an " -"object: the :func:`repr` function, and the :func:`str` function. (The :func:" -"`print` function just calls :func:`str`.) These handlers are both optional." +"object: the :func:`repr` function, and the :func:`str` function. " +"(The :func:`print` function just calls :func:`str`.) These handlers are " +"both optional." msgstr "" -"Python では、オブジェクトの文字列表現を生成するのに 2つのやり方があります: :" -"func:`repr` 関数を使う方法と、 :func:`str` 関数を使う方法です。 (:func:" -"`print` 関数は単に :func:`str` を呼び出します。) これらのハンドラはどちらも省" -"略できます。" +"Python では、オブジェクトの文字列表現を生成するのに 2つのやり方がありま" +"す: :func:`repr` 関数を使う方法と、 :func:`str` 関数を使う方法です。 " +"(:func:`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 +534,6 @@ msgstr "" "表現を格納した文字列オブジェクトを返す必要があります。簡単な例は以下のような" "ものです::" -#: ../../extending/newtypes.rst:174 msgid "" "static PyObject *\n" "newdatatype_repr(PyObject *op)\n" @@ -407,37 +543,47 @@ 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." +"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 "" -"The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what the :c:" -"member:`~PyTypeObject.tp_repr` handler described above is to :func:`repr`; " -"that is, it is called when Python code calls :func:`str` on an instance of " -"your object. Its implementation is very similar to the :c:member:" -"`~PyTypeObject.tp_repr` function, but the resulting string is intended for " -"human consumption. If :c:member:`~PyTypeObject.tp_str` is not specified, " -"the :c:member:`~PyTypeObject.tp_repr` handler is used instead." -msgstr "" -":c:member:`~PyTypeObject.tp_str` ハンドラと :func:`str` の関係は、上の :c:" -"member:`~PyTypeObject.tp_repr` ハンドラと :func:`repr` の関係に相当します。つ" -"まり、これは Python のコードがオブジェクトのインスタンスに対して :func:`str` " -"を呼び出したときに呼ばれます。この関数の実装は :c:member:`~PyTypeObject." -"tp_repr` ハンドラのそれと非常に似ていますが、得られる文字列表現は人間が読むこ" -"とを意図されています。 :c:member:`~PyTypeObject.tp_str` が指定されていない場" -"合、かわりに :c:member:`~PyTypeObject.tp_repr` ハンドラが使われます。" +"The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what " +"the :c:member:`~PyTypeObject.tp_repr` handler described above is " +"to :func:`repr`; that is, it is called when Python code calls :func:`str` on " +"an instance of your object. Its implementation is very similar to " +"the :c:member:`~PyTypeObject.tp_repr` function, but the resulting string is " +"intended for human consumption. If :c:member:`~PyTypeObject.tp_str` is not " +"specified, the :c:member:`~PyTypeObject.tp_repr` handler is used instead." +msgstr "" +":c:member:`~PyTypeObject.tp_str` ハンドラと :func:`str` の関係は、上" +"の :c:member:`~PyTypeObject.tp_repr` ハンドラと :func:`repr` の関係に相当しま" +"す。つまり、これは Python のコードがオブジェクトのインスタンスに対し" +"て :func:`str` を呼び出したときに呼ばれます。この関数の実装" +"は :c:member:`~PyTypeObject.tp_repr` ハンドラのそれと非常に似ていますが、得ら" +"れる文字列表現は人間が読むことを意図されていま" +"す。 :c:member:`~PyTypeObject.tp_str` が指定されていない場合、かわり" +"に :c:member:`~PyTypeObject.tp_repr` ハンドラが使われます。" #: ../../extending/newtypes.rst:193 msgid "Here is a simple example::" msgstr "以下は簡単な例です::" -#: ../../extending/newtypes.rst:195 msgid "" "static PyObject *\n" "newdatatype_str(PyObject *op)\n" @@ -447,12 +593,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,17 +613,26 @@ 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 " -"difference is that one pair takes the name of the attribute as a :c:expr:" -"`char\\*`, while the other accepts a :c:expr:`PyObject*`. Each type can use " -"whichever pair makes more sense for the implementation's convenience. ::" +"difference is that one pair takes the name of the attribute as " +"a :c:expr:`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 +640,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 +655,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,54 +680,66 @@ 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 " "dictionary of the type object. Each descriptor controls access to one " "attribute of the instance object. Each of the tables is optional; if all " "three are ``NULL``, instances of the type will only have attributes that are " -"inherited from their base type, and should leave the :c:member:" -"`~PyTypeObject.tp_getattro` and :c:member:`~PyTypeObject.tp_setattro` fields " -"``NULL`` as well, allowing the base type to handle attributes." -msgstr "" +"inherited from their base type, and should leave " +"the :c:member:`~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 +748,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``." +"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,27 +791,41 @@ 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 " "structure. The :c:member:`~PyMemberDef.type` field should contain a type " "code like :c:macro:`Py_T_INT` or :c:macro:`Py_T_DOUBLE`; the value will be " -"used to determine how to convert Python values to and from C values. The :c:" -"member:`~PyMemberDef.flags` field is used to store flags which control how " -"the attribute can be accessed: you can set it to :c:macro:`Py_READONLY` to " -"prevent Python code from setting it." -msgstr "" +"used to determine how to convert Python values to and from C values. " +"The :c:member:`~PyMemberDef.flags` field is used to store flags which " +"control how 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 " "defined this way can have an associated doc string simply by providing the " "text in the table. An application can use the introspection API to retrieve " -"the descriptor from the class object, and get the doc string using its :attr:" -"`~type.__doc__` attribute." +"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,16 +837,22 @@ 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:" -"expr:`char\\*` and :c:expr:`PyObject*` flavors of the interface. This " +"here; the type of the name parameter is the only difference between " +"the :c:expr:`char\\*` and :c:expr:`PyObject*` flavors of the interface. This " "example effectively does the same thing as the generic example above, but " "does not use the generic support added in Python 2.2. It explains how the " "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 +865,6 @@ msgstr "" msgid "Here is an example::" msgstr "以下に例を示します。::" -#: ../../extending/newtypes.rst:337 msgid "" "static PyObject *\n" "newdatatype_getattr(PyObject *op, char *name)\n" @@ -668,18 +880,37 @@ 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 " -"instance would be called. When an attribute should be deleted, the third " -"parameter will be ``NULL``. Here is an example that simply raises an " -"exception; if this were really all you wanted, the :c:member:`~PyTypeObject." -"tp_setattr` handler should be set to ``NULL``. ::" +"The :c:member:`~PyTypeObject.tp_setattr` handler is called when " +"the :meth:`~object.__setattr__` or :meth:`~object.__delattr__` method of a " +"class instance would be called. When an attribute should be deleted, the " +"third parameter will be ``NULL``. Here is an example that simply raises an " +"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 +919,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`." +"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 +954,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 +971,6 @@ msgstr "" "これは内部ポインタのサイズが等しければ等しいと見なすデータ型のサンプル実装で" "す::" -#: ../../extending/newtypes.rst:387 msgid "" "static PyObject *\n" "newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)\n" @@ -752,6 +998,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,33 +1051,33 @@ 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 " -"the C type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, or :c:" -"type:`PyMappingMethods`, respectively. It is up to you to fill in this " +"the C type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, " +"or :c:type:`PyMappingMethods`, respectively. It is up to you to fill in this " "structure with appropriate values. You can find examples of the use of each " "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 +1087,6 @@ msgstr "" "この関数は、もし使うことにしたならば、データ型のインスタンスのハッシュ番号を" "返すようにします。次のは単純な例です::" -#: ../../extending/newtypes.rst:448 msgid "" "static Py_hash_t\n" "newdatatype_hash(PyObject *op)\n" @@ -830,18 +1100,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 "" @@ -869,26 +1153,31 @@ msgstr "" #: ../../extending/newtypes.rst:478 msgid "" -"*args* is a tuple containing the arguments to the call. You can use :c:func:" -"`PyArg_ParseTuple` to extract the arguments." +"*args* is a tuple containing the arguments to the call. You can " +"use :c:func:`PyArg_ParseTuple` to extract the arguments." msgstr "" -"*args* は呼び出しの引数を格納しているタプルです。ここから引数を取り出すには :" -"c:func:`PyArg_ParseTuple` を使います。" +"*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:" -"`PyArg_ParseTupleAndKeywords` to extract the arguments. If you do not want " -"to support keyword arguments and this is non-``NULL``, raise a :exc:" -"`TypeError` with a message saying that keyword arguments are not supported." -msgstr "" +"``NULL`` and you support keyword arguments, " +"use :c:func:`PyArg_ParseTupleAndKeywords` to extract the arguments. If you " +"do not want 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,91 +1198,142 @@ 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, " "and return a new reference. In the case of an error, they should set an " "exception and return ``NULL``. :c:member:`~PyTypeObject.tp_iter` " -"corresponds to the Python :meth:`~object.__iter__` method, while :c:member:" -"`~PyTypeObject.tp_iternext` corresponds to the Python :meth:`~iterator." -"__next__` method." -msgstr "" +"corresponds to the Python :meth:`~object.__iter__` method, " +"while :c:member:`~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 "" -"Any :term:`iterable` object must implement the :c:member:`~PyTypeObject." -"tp_iter` handler, which must return an :term:`iterator` object. Here the " -"same guidelines apply as for Python classes:" +"Any :term:`iterable` object must implement " +"the :c:member:`~PyTypeObject.tp_iter` handler, which must return " +"an :term:`iterator` object. Here the 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 "" - -#: ../../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:" -"`~PyTypeObject.tp_iter` handler should return a new reference to the " -"iterator. Its :c:member:`~PyTypeObject.tp_iternext` handler should return a " -"new reference to the next object in the iteration, if there is one. If the " -"iteration has reached the end, :c:member:`~PyTypeObject.tp_iternext` may " -"return ``NULL`` without setting an exception, or it may set :exc:" -"`StopIteration` *in addition* to returning ``NULL``; avoiding the exception " -"can yield slightly better performance. If an actual error occurs, :c:member:" -"`~PyTypeObject.tp_iternext` should always set an exception and return " -"``NULL``." -msgstr "" +"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` ハンドラも実装する必要があり" +"ます。" + +msgid "" +"Any :term:`iterator` object should implement " +"both :c:member:`~PyTypeObject.tp_iter` " +"and :c:member:`~PyTypeObject.tp_iternext`. An " +"iterator's :c:member:`~PyTypeObject.tp_iter` handler should return a new " +"reference to the iterator. Its :c:member:`~PyTypeObject.tp_iternext` " +"handler should return a new reference to the next object in the iteration, " +"if there is one. If the iteration has reached the " +"end, :c:member:`~PyTypeObject.tp_iternext` may return ``NULL`` without " +"setting an exception, or it may set :exc:`StopIteration` *in addition* to " +"returning ``NULL``; avoiding the exception can yield slightly better " +"performance. If an actual error " +"occurs, :c:member:`~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 +1341,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 +1364,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 +1384,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 +1446,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..6fce55585 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,25 +46,26 @@ 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. " -"The :c:type:`PyObject` structure itself only contains the object's :term:" -"`reference count` and a pointer to the object's \"type object\". This is " -"where the action is; the type object determines which (C) functions get " -"called by the interpreter when, for instance, an attribute gets looked up on " -"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)\" と呼ばれます。" +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. The :c:type:`PyObject` structure itself only contains the " +"object's :term:`reference count` and a pointer to the object's \"type " +"object\". This is where the action is; the type object determines which (C) " +"functions get called by the interpreter when, for instance, an attribute " +"gets looked up on an object, a method called, or it is multiplied by another " +"object. These C functions are called \"type methods\"." +msgstr "" +":term:`CPython` ランタイムは、すべての Python オブジェクト" +"を :c:expr:`PyObject*` 型の変数として扱います。\n" +"この型はすべての Python オブジェクトの「基底型」の役割を果たします。\n" +":c:type:`PyObject` 構造体自体に含まれるのは、オブジェクトの :term:`参照カウン" +"ト ` と、その「型オブジェクト」へのポインタだけです。\n" +"動作を決めるのは、この型オブジェクトです。\n" +"例えばオブジェクトの属性を検索するとき、メソッドを呼び出すとき、ほかのオブ" +"ジェクトとの乗算を行うときに、インタープリタがどの C 関数を呼び出すかを決定し" +"ます。\n" +"これらの C 関数を「型メソッド」と呼びます。" #: ../../extending/newtypes_tutorial.rst:35 msgid "" @@ -88,8 +89,8 @@ msgstr "" msgid "" "What we're showing here is the traditional way of defining *static* " "extension types. It should be adequate for most uses. The C API also " -"allows defining heap-allocated extension types using the :c:func:" -"`PyType_FromSpec` function, which isn't covered in this tutorial." +"allows defining heap-allocated extension types using " +"the :c:func:`PyType_FromSpec` function, which isn't covered in this tutorial." msgstr "" "ここで紹介している例は、 *静的な* 拡張の型を定義する伝統的な実装方法です。\n" "これはほとんどの場面で十分なものなのです。\n" @@ -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 "" @@ -258,9 +271,9 @@ msgid "" "listing all the :c:type:`PyTypeObject` fields that you don't care about and " "also to avoid caring about the fields' declaration order." msgstr "" -"上にあるように C99 スタイルの指示付き初期化子を使って、 :c:type:" -"`PyTypeObject` の特に関心の無いフィールドまで全て並べたり、フィールドを宣言す" -"る順序に気を使ったりせずに済ませるのをお薦めします。" +"上にあるように C99 スタイルの指示付き初期化子を使っ" +"て、 :c:type:`PyTypeObject` の特に関心の無いフィールドまで全て並べたり、" +"フィールドを宣言する順序に気を使ったりせずに済ませるのをお薦めします。" #: ../../extending/newtypes_tutorial.rst:105 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,46 +313,50 @@ 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:`!" -"custom` and the type is :class:`!Custom`, so we set the type name to :class:" -"`!custom.Custom`. Using the real dotted import path is important to make " -"your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" +"custom` and the type is :class:`!Custom`, so we set the type name " +"to :class:`!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 "" -"This is so that Python knows how much memory to allocate when creating new :" -"class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only " -"used for variable-sized objects and should otherwise be zero." +"This is so that Python knows how much memory to allocate when creating " +"new :class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is " +"only used for variable-sized objects and should otherwise be zero." msgstr "" "これは、新しい :class:`!Custom` インスタンスを作るときに Python が割り当てる" -"べきメモリがどのくらいなのかを知るためのものです。 :c:member:`~PyTypeObject." -"tp_itemsize` は可変サイズのオブジェクトでのみ使うものなので、サイズが可変でな" -"いオブジェクトでは 0 にすべきです。" +"べきメモリがどのくらいなのかを知るためのもので" +"す。 :c:member:`~PyTypeObject.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 +369,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,32 +402,30 @@ 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 "" -"To enable object creation, we have to provide a :c:member:`~PyTypeObject." -"tp_new` handler. This is the equivalent of the Python method :meth:`~object." -"__new__`, but has to be specified explicitly. In this case, we can just use " -"the default implementation provided by the API function :c:func:" -"`PyType_GenericNew`. ::" +"To enable object creation, we have to provide " +"a :c:member:`~PyTypeObject.tp_new` handler. This is the equivalent of the " +"Python method :meth:`~object.__new__`, but has to be specified explicitly. " +"In this case, we can just use the default implementation provided by the API " +"function :c:func:`PyType_GenericNew`. ::" msgstr "" "オブジェクトが生成できるように、 :c:member:`~PyTypeObject.tp_new` ハンドラを" "提供する必要があります。これは Python のメソッド :meth:`~object.__new__` と同" -"等のものですが、明示的に与える必要があります。今の場合では、 API 関数の :c:" -"func:`PyType_GenericNew` として提供されるデフォルトの実装をそのまま使えま" -"す。 ::" +"等のものですが、明示的に与える必要があります。今の場合では、 API 関数" +"の :c: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 "" -"Everything else in the file should be familiar, except for some code in :c:" -"func:`!PyInit_custom`::" +"Everything else in the file should be familiar, except for some code " +"in :c:func:`!PyInit_custom`::" msgstr "" "ファイルの残りの部分はきっと馴染みやすいものだと思いますが、 :c:func:`!" "PyInit_custom` の一部のコードはそうではないでしょう::" @@ -435,17 +456,18 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:188 msgid "" -"This adds the type to the module dictionary. This allows us to create :" -"class:`!Custom` instances by calling the :class:`!Custom` class:" +"This adds the type to the module dictionary. This allows us to " +"create :class:`!Custom` instances by calling the :class:`!Custom` class:" 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 +477,6 @@ msgstr "" "以上です!残りの作業はビルドだけです; :file:`custom.c` という名前のファイルに" "ここまでのコードを書き込み、" -#: ../../extending/newtypes_tutorial.rst:199 msgid "" "[build-system]\n" "requires = [\"setuptools\"]\n" @@ -465,16 +486,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 +511,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 +708,6 @@ msgstr "" msgid "The object structure is updated accordingly::" msgstr "これにしたがうと、オブジェクトの構造体は次のようになります::" -#: ../../extending/newtypes_tutorial.rst:242 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -690,6 +716,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 +731,6 @@ msgstr "" "いまや管理すべきデータができたので、オブジェクトの割り当てと解放に際してはよ" "り慎重になる必要があります。最低限、オブジェクトの解放メソッドが必要です::" -#: ../../extending/newtypes_tutorial.rst:252 msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -710,33 +741,41 @@ 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 "" -"This method first clears the reference counts of the two Python attributes. :" -"c:func:`Py_XDECREF` correctly handles the case where its argument is " -"``NULL`` (which might happen here if ``tp_new`` failed midway). It then " -"calls the :c:member:`~PyTypeObject.tp_free` member of the object's type " -"(computed by ``Py_TYPE(self)``) to free the object's memory. Note that the " -"object's type might not be :class:`!CustomType`, because the object may be " -"an instance of a subclass." -msgstr "" -"このメソッドは、まず二つのPython 属性の参照カウントをクリアします。 :c:func:" -"`Py_XDECREF` は引数が ``NULL`` のケースを正しく扱えます (これは、``tp_new`` " -"が途中で失敗した場合に起こりえます) 。このメソッドは、つぎにオブジェクトの型 " -"(``Py_TYPE(self)`` で算出します) のメンバ :c:member:`~PyTypeObject.tp_free` " -"を呼び出し、オブジェクトのメモリを開放します。オブジェクトの型が :class:`!" -"CustomType` であるとは限らない点に注意してください。なぜなら、オブジェクトは" -"サブクラスのインスタンスかもしれないからです。" +"This method first clears the reference counts of the two Python " +"attributes. :c:func:`Py_XDECREF` correctly handles the case where its " +"argument is ``NULL`` (which might happen here if ``tp_new`` failed midway). " +"It then calls the :c:member:`~PyTypeObject.tp_free` member of the object's " +"type (computed by ``Py_TYPE(self)``) to free the object's memory. Note that " +"the object's type might not be :class:`!CustomType`, because the object may " +"be an instance of a subclass." +msgstr "" +"このメソッドは、まず二つのPython 属性の参照カウントをクリアしま" +"す。 :c:func:`Py_XDECREF` は引数が ``NULL`` のケースを正しく扱えます (これ" +"は、``tp_new`` が途中で失敗した場合に起こりえます) 。このメソッドは、つぎにオ" +"ブジェクトの型 (``Py_TYPE(self)`` で算出します) のメン" +"バ :c:member:`~PyTypeObject.tp_free` を呼び出し、オブジェクトのメモリを開放し" +"ます。オブジェクトの型が :class:`!CustomType` であるとは限らない点に注意して" +"ください。なぜなら、オブジェクトはサブクラスのインスタンスかもしれないからで" +"す。" #: ../../extending/newtypes_tutorial.rst:275 msgid "" @@ -748,14 +787,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 +806,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 +830,6 @@ msgstr "" "ファーストネームとラストネームを空文字列に初期化しておきたいので、``tp_new`` " "の実装を追加することにしましょう::" -#: ../../extending/newtypes_tutorial.rst:303 msgid "" "static PyObject *\n" "Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" @@ -804,6 +852,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,30 +879,43 @@ 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:" -"`~object.__new__` method. It is not required to define a ``tp_new`` member, " -"and indeed many extension types will simply reuse :c:func:" -"`PyType_GenericNew` as done in the first version of the :class:`!Custom` " -"type above. In this case, we use the ``tp_new`` handler to initialize the " -"``first`` and ``last`` attributes to non-``NULL`` default values." -msgstr "" +"initializing) objects of the type. It is exposed in Python as " +"the :meth:`~object.__new__` method. It is not required to define a " +"``tp_new`` member, and indeed many extension types will simply " +"reuse :c:func:`PyType_GenericNew` as done in the first version of " +"the :class:`!Custom` 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 " "the type was called, and is expected to return the instance created. " "``tp_new`` handlers always accept positional and keyword arguments, but they " -"often ignore the arguments, leaving the argument handling to initializer (a." -"k.a. ``tp_init`` in C or ``__init__`` in Python) methods." +"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,56 +933,58 @@ 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 "" -"Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." -"tp_alloc` result against ``NULL`` before proceeding." +"Since memory allocation may fail, we must check " +"the :c:member:`~PyTypeObject.tp_alloc` result against ``NULL`` before " +"proceeding." msgstr "" -"メモリ割り当ては失敗するかもしれないので、先に進む前に :c:member:" -"`~PyTypeObject.tp_alloc` の結果が ``NULL`` でないかチェックしなければなりませ" -"ん。" +"メモリ割り当ては失敗するかもしれないので、先に進む前" +"に :c:member:`~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." -"__new__`), you must *not* try to determine what method to call using method " -"resolution order at runtime. Always statically determine what type you are " -"going to call, and call its :c:member:`~PyTypeObject.tp_new` directly, or " -"via ``type->tp_base->tp_new``. If you do not do this, Python subclasses of " -"your type that also inherit from other Python-defined classes may not work " -"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` を出さずに作ることが不可能になります。)" - -#: ../../extending/newtypes_tutorial.rst:372 +"that calls a base type's :c:member:`~PyTypeObject.tp_new` " +"or :meth:`~object.__new__`), you must *not* try to determine what method to " +"call using method resolution order at runtime. Always statically determine " +"what type you are going to call, and call " +"its :c:member:`~PyTypeObject.tp_new` directly, or via ``type->tp_base-" +">tp_new``. If you do not do this, Python subclasses of your type that also " +"inherit from other Python-defined classes may not work correctly. " +"(Specifically, you may not be able to create instances of such subclasses " +"without getting a :exc:`TypeError`.)" +msgstr "" +"基底型の :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` が発生する場合があります。" + 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 +1013,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." +"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 +1068,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 +1083,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 +1097,45 @@ 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;" +"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 [#]_." +"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 +1145,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 +1156,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 +1173,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 +1194,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,31 +1225,56 @@ 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 " -"take an instance as the first argument. Methods often take positional and " -"keyword arguments as well, but in this case we don't take any and don't need " -"to accept a positional argument tuple or keyword argument dictionary. This " -"method is equivalent to the Python method:" +"The method is implemented as a C function that takes a :class:`!Custom` " +"(or :class:`!Custom` subclass) instance as the first argument. Methods " +"always take an instance as the first argument. Methods often take positional " +"and keyword arguments as well, but in this case we don't take any and don't " +"need 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 " -"which case they are set to ``NULL``. It would be better to prevent deletion " -"of these attributes and to restrict the attribute values to be strings. " -"We'll see how to do that in the next section." +"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 which case they are set to ``NULL``. It would be better to " +"prevent deletion 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 +1284,6 @@ msgstr "" "さて、メソッドを定義したので、ここでメソッド定義用の配列を作成する必要があり" "ます::" -#: ../../extending/newtypes_tutorial.rst:511 msgid "" "static PyMethodDef Custom_methods[] = {\n" " {\"name\", Custom_name, METH_NOARGS,\n" @@ -1118,45 +1292,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,23 +1348,31 @@ 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 " -"previous version of our module, the instance variables :attr:`!first` and :" -"attr:`!last` could be set to non-string values or even deleted. We want to " -"make sure that these attributes always contain strings." +"previous version of our module, the instance variables :attr:`!first` " +"and :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 +1559,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 +1599,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 +1637,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 +1670,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 +1706,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 +1720,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 +1748,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 +1783,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 +1815,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,16 +1836,22 @@ 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 " -"[#]_. Besides, in the second and third versions, we allowed subclassing :" -"class:`!Custom`, and subclasses may add arbitrary attributes. For any of " -"those two reasons, :class:`!Custom` objects can participate in cycles:" +"[#]_. Besides, in the second and third versions, we allowed " +"subclassing :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 +1859,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 +2080,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,24 +2106,47 @@ 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:" -"`!visit` function takes as arguments the subobject and the extra argument " -"*arg* passed to the traversal method. It returns an integer value that must " -"be returned if it is non-zero." +"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:`!visit` function takes as arguments the subobject and the extra " +"argument *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 +2157,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 +2190,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,37 +2207,53 @@ 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!" +"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. " "Since the GC assumes reference count is not zero, we need to untrack the " "object from the GC by calling :c:func:`PyObject_GC_UnTrack` before clearing " -"members. Here is our reimplemented deallocator using :c:func:" -"`PyObject_GC_UnTrack` and ``Custom_clear``::" +"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,28 +2263,37 @@ 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 "" -"That's pretty much it. If we had written custom :c:member:`~PyTypeObject." -"tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " -"them for cyclic garbage collection. Most extensions will use the versions " +"That's pretty much it. If we had written " +"custom :c:member:`~PyTypeObject.tp_alloc` " +"or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify them for " +"cyclic garbage collection. Most extensions will use the versions " "automatically provided." msgstr "" -"これで完了です。 :c:member:`~PyTypeObject.tp_alloc` スロットまたは :c:member:" -"`~PyTypeObject.tp_free` ハンドラが書かれていれば、それらを循環ガベージコレク" -"ションに使えるよう修正すればよいのです。ほとんどの拡張機能は自動的に提供され" -"るバージョンを使うでしょう。" +"これで完了です。 :c:member:`~PyTypeObject.tp_alloc` スロットまた" +"は :c:member:`~PyTypeObject.tp_free` ハンドラが書かれていれば、それらを循環ガ" +"ベージコレクションに使えるよう修正すればよいのです。ほとんどの拡張機能は自動" +"的に提供されるバージョンを使うでしょう。" #: ../../extending/newtypes_tutorial.rst:814 msgid "Subclassing other types" @@ -1959,15 +2311,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 +2333,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 +2417,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,29 +2466,46 @@ 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. " +"This pattern is important when writing a type with " +"custom :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_dealloc` members. " "The :c:member:`~PyTypeObject.tp_new` handler should not actually create the " "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 "" -"The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." -"tp_base` specifying the type's concrete base class. Due to cross-platform " -"compiler issues, you can't fill that field directly with a reference to :c:" -"type:`PyList_Type`; it should be done later in the module initialization " -"function::" +"The :c:type:`PyTypeObject` struct supports " +"a :c:member:`~PyTypeObject.tp_base` specifying the type's concrete base " +"class. Due to cross-platform compiler issues, you can't fill that field " +"directly with a reference to :c:type:`PyList_Type`; it should be done later " +"in the module initialization function::" msgstr "" #: ../../extending/newtypes_tutorial.rst:881 @@ -2144,25 +2532,25 @@ 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 " -"existing type, it is not necessary to fill out the :c:member:`~PyTypeObject." -"tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocation function " -"from the base type will be inherited." +"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 existing type, it is not necessary to fill out " +"the :c:member:`~PyTypeObject.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 +2564,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 +2579,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..51652663c 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 "" @@ -137,25 +143,25 @@ msgid "" "files in the libraries; if it finds it, it will include all the code from " "that object file." msgstr "" -"Unix には、唯一のライブラリファイル形式 (:file:`.a`) しかありません。 :file:" -"`.a` ファイルには複数のオブジェクトファイル (:file:`.o`) 由来のコードが入って" -"います。共有オブジェクトファイル (:file:`.so`) を作成するリンク処理の段階中" -"に、リンカは定義場所の不明な識別子に遭遇することがあります。このときリンカは" -"ライブラリ内のオブジェクトファイルを検索します; もし識別子が見つかると、リン" -"カはそのオブジェクトファイルから全てのコードを取り込みます。" +"Unix には、唯一のライブラリファイル形式 (:file:`.a`) しかありませ" +"ん。 :file:`.a` ファイルには複数のオブジェクトファイル (:file:`.o`) 由来の" +"コードが入っています。共有オブジェクトファイル (:file:`.so`) を作成するリンク" +"処理の段階中に、リンカは定義場所の不明な識別子に遭遇することがあります。この" +"ときリンカはライブラリ内のオブジェクトファイルを検索します; もし識別子が見つ" +"かると、リンカはそのオブジェクトファイルから全てのコードを取り込みます。" #: ../../extending/windows.rst:76 msgid "" "In Windows, there are two types of library, a static library and an import " -"library (both called :file:`.lib`). A static library is like a Unix :file:`." -"a` file; it contains code to be included as necessary. An import library is " -"basically used only to reassure the linker that a certain identifier is " -"legal, and will be present in the program when the DLL is loaded. So the " -"linker uses the information from the import library to build the lookup " -"table for using identifiers that are not included in the DLL. When an " -"application or a DLL is linked, an import library may be generated, which " -"will need to be used for all future DLLs that depend on the symbols in the " -"application or DLL." +"library (both called :file:`.lib`). A static library is like a " +"Unix :file:`.a` file; it contains code to be included as necessary. An " +"import library is basically used only to reassure the linker that a certain " +"identifier is legal, and will be present in the program when the DLL is " +"loaded. So the linker uses the information from the import library to build " +"the lookup table for using identifiers that are not included in the DLL. " +"When an application or a DLL is linked, an import library may be generated, " +"which will need to be used for all future DLLs that depend on the symbols in " +"the application or DLL." msgstr "" "Windows では、二つの形式のライブラリ、静的ライブラリとインポートライブラリが" "あります (どちらも :file:`.lib` と呼ばれています)。静的ライブラリは Unix にお" @@ -174,9 +180,10 @@ msgid "" "share another block of code A. On Unix, you would *not* pass :file:`A.a` to " "the linker for :file:`B.so` and :file:`C.so`; that would cause it to be " "included twice, so that B and C would each have their own copy. In Windows, " -"building :file:`A.dll` will also build :file:`A.lib`. You *do* pass :file:" -"`A.lib` to the linker for B and C. :file:`A.lib` does not contain code; it " -"just contains information which will be used at runtime to access A's code." +"building :file:`A.dll` will also build :file:`A.lib`. You *do* " +"pass :file:`A.lib` to the linker for B and C. :file:`A.lib` does not " +"contain code; it just contains information which will be used at runtime to " +"access A's code." msgstr "" "二つの動的ロードモジュール、B と C を作成し、別のコードブロック A を共有する" "とします。Unix では、 :file:`A.a` を :file:`B.so` や :file:`C.so` をビルドす" @@ -199,77 +206,90 @@ 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 "" -"By default, inclusion of :file:`PC/pyconfig.h` directly or via :file:`Python." -"h` triggers an implicit, configure-aware link with the library. The header " -"file chooses :file:`pythonXY_d.lib` for Debug, :file:`pythonXY.lib` for " -"Release, and :file:`pythonX.lib` for Release with the `Limited API `_ enabled." +"By default, inclusion of :file:`PC/pyconfig.h` directly or " +"via :file:`Python.h` triggers an implicit, configure-aware link with the " +"library. The header file chooses :file:`pythonXY_d.lib` for " +"Debug, :file:`pythonXY.lib` for Release, and :file:`pythonX.lib` for Release " +"with the `Limited API `_ 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 "" -"The second command created :file:`ni.dll` (and :file:`.obj` and :file:`." -"lib`), which knows how to find the necessary functions from spam, and also " -"from the Python executable." +"The second command created :file:`ni.dll` (and :file:`.obj` " +"and :file:`.lib`), which knows how to find the necessary functions from " +"spam, and also from the Python executable." msgstr "" "二つ目のコマンドでは、 :file:`ni.dll` (および :file:`.obj` と :file:`.lib`) " "ができ、このライブラリは 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." +"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 "" @@ -279,9 +299,9 @@ msgid "" "the Python code thanks to :file:`pythonXY.lib`." msgstr "" "最初のコマンドで、三つのファイル: :file:`spam.obj` 、 :file:`spam.dll` およ" -"び :file:`spam.lib` ができます。 :file:`Spam.dll` には (:c:func:" -"`PyArg_ParseTuple` のような) Python 関数は全く入っていませんが、 :file:" -"`pythonXY.lib` のおかげで Python コードを見つけることはできます。" +"び :file:`spam.lib` ができます。 :file:`Spam.dll` には " +"(:c:func:`PyArg_ParseTuple` のような) Python 関数は全く入っていません" +"が、 :file:`pythonXY.lib` のおかげで Python コードを見つけることはできます。" #: ../../extending/windows.rst:159 msgid "" diff --git a/faq/design.po b/faq/design.po index 5ce0d2d74..646675ff8 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,34 +143,38 @@ 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 "" -"The :class:`float` type in CPython uses a C ``double`` for storage. A :" -"class:`float` object's value is stored in binary floating-point with a fixed " -"precision (typically 53 bits) and Python uses C operations, which in turn " -"rely on the hardware implementation in the processor, to perform floating-" -"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 " -"のような多くの一般的な言語と同じように振る舞います。" +"The :class:`float` type in CPython uses a C ``double`` for storage. " +"A :class:`float` object's value is stored in binary floating-point with a " +"fixed precision (typically 53 bits) and Python uses C operations, which in " +"turn rely on the hardware implementation in the processor, to perform " +"floating-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 を含む多くの一般的な言語と同じよ" +"うに振る舞います。" #: ../../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 +188,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 +196,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 +298,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 +314,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 +348,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 +375,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に書" "き換える容易さと、それと同じことを純粋なオブジェクト指向の記法で行う煩わしさ" @@ -370,20 +385,21 @@ msgstr "" msgid "" "(b) When I read code that says len(x) I *know* that it is asking for the " "length of something. This tells me two things: the result is an integer, and " -"the argument is some kind of container. To the contrary, when I read x." -"len(), I have to already know that x is some kind of container implementing " -"an interface or inheriting from a class that has a standard len(). Witness " -"the confusion we occasionally have when a class that is not implementing a " -"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()メソッドを持っているような混乱は時折見かけます。" +"the argument is some kind of container. To the contrary, when I read " +"x.len(), I have to already know that x is some kind of container " +"implementing an interface or inheriting from a class that has a standard " +"len(). Witness the confusion we occasionally have when a class that is not " +"implementing a 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() メソッドを持っているような混乱は時折見かけ" +"ます。" #: ../../faq/design.rst:189 msgid "https://mail.python.org/pipermail/python-3000/2006-November/004643.html" @@ -410,7 +426,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 +434,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 +453,23 @@ 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 ::" +"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 +515,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 +536,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,11 +586,17 @@ 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 "" -"For calling methods on objects, you can simplify yet further by using the :" -"func:`getattr` built-in to retrieve methods with a particular name::" +"For calling methods on objects, you can simplify yet further by using " +"the :func:`getattr` built-in to retrieve methods with a particular name::" msgstr "" "オブジェクトのメソッドを呼び出すには、さらに単純に :func:`getattr` 組み込み関" "数で特定の名前のメソッドを検索できます::" @@ -579,6 +612,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 +702,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 +712,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 +731,13 @@ 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 +747,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 +766,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 "" @@ -736,9 +788,9 @@ msgid "" "should explicitly close the file or use the :keyword:`with` statement; this " "will work regardless of memory management scheme::" msgstr "" -"Python の実装に依らずに動くコードを書くには、ファイルを明示的に閉じるか、 :" -"keyword:`with` 文を使ってください。これでメモリ管理のスキームに関係なく動きま" -"す::" +"Python の実装に依らずに動くコードを書くには、ファイルを明示的に閉じる" +"か、 :keyword:`with` 文を使ってください。これでメモリ管理のスキームに関係なく" +"動きます::" #: ../../faq/design.rst:369 msgid "" @@ -746,6 +798,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 +842,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 +850,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?" @@ -834,16 +888,16 @@ msgstr "" msgid "" "Lists, on the other hand, are more like arrays in other languages. They " "tend to hold a varying number of objects all of which have the same type and " -"which are operated on one-by-one. For example, :func:`os.listdir('.') ` returns a list of strings representing the files in the current " -"directory. Functions which operate on this output would generally not break " -"if you added another file or two to the directory." +"which are operated on one-by-one. For example, :func:`os.listdir('.') " +"` returns a list of strings representing the files in the " +"current directory. Functions which operate on this output would generally " +"not break if you added another file or two to the directory." msgstr "" "一方、リストは、もっと他の言語の配列に近いものです。全て同じ型の可変数のオブ" -"ジェクトを持ち、それらが一つ一つ演算される傾向にあります。例えば、 :func:`os." -"listdir('.') ` はカレントディレクトリ内にあるファイルの文字列表現" -"のリストを返します。この出力を演算する関数は一般に、ディレクトリに一つや二つ" -"の別のファイルを加えても壊れません。" +"ジェクトを持ち、それらが一つ一つ演算される傾向にあります。例え" +"ば、 :func:`os.listdir('.') ` はカレントディレクトリ内にあるファ" +"イルの文字列表現のリストを返します。この出力を演算する関数は一般に、ディレク" +"トリに一つや二つの別のファイルを加えても壊れません。" #: ../../faq/design.rst:423 msgid "" @@ -862,16 +916,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 "" @@ -920,20 +973,19 @@ msgid "" "values, this means that dictionaries take constant time -- *O*\\ (1), in Big-" "O notation -- to retrieve a key." msgstr "" -"辞書は、辞書に保存されているそれぞれのキーに対応するハッシュコードを :func:" -"`hash` ビルトイン関数で計算することで機能します。このハッシュコードはキーやプ" -"ロセスごとのシードによって大きく変化します。例えば、 ``'Python'`` のハッシュ" -"値は ``-539294296`` ですが、ビットが一つ違うだけの文字列 ``'python'`` のハッ" -"シュ値は ``1142331976`` です。そしてこのハッシュコードは、値が保存される内部" -"配列での位置を計算するために使われます。保存しているキーのハッシュ値が全て異" -"なるとすれば、一定の時間 − Big-O 記法では *O*\\ (1) − でキーを検索できること" -"になります。" +"辞書は、辞書に保存されているそれぞれのキーに対応するハッシュコード" +"を :func:`hash` ビルトイン関数で計算することで機能します。このハッシュコード" +"はキーやプロセスごとのシードによって大きく変化します。例えば、 ``'Python'`` " +"のハッシュ値は ``-539294296`` ですが、ビットが一つ違うだけの文字列 " +"``'python'`` のハッシュ値は ``1142331976`` です。そしてこのハッシュコードは、" +"値が保存される内部配列での位置を計算するために使われます。保存しているキーの" +"ハッシュ値が全て異なるとすれば、一定の時間 − Big-O 記法では *O*\\ (1) − で" +"キーを検索できることになります。" #: ../../faq/design.rst:463 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 +998,15 @@ msgid "" "would be different." msgstr "" "辞書のハッシュテーブルの実装は、キーを見つけるために、キー値から計算された" -"ハッシュ値を使います。もしキーがミュータブルなオブジェクトだったら、その値は" -"変えられ、それによりハッシュ値も変わってしまいます。しかし、キーオブジェクト" -"を変更したのが何者であれ、値が辞書のキーとして使われていたと気付けないので、" -"辞書の中のエントリを適切な場所に動かせません。そして、同じオブジェクトを探そ" -"うとしても、ハッシュ値が違うため見つかりません。古い値を探そうとしても、その" -"ハッシュバイナリから見つかるオブジェクトの値は異なるでしょうから、これも見つ" -"かりません。" +"ハッシュ値を使います。\n" +"もしキーがミュータブルなオブジェクトだったら、その値は変えられ、それにより" +"ハッシュ値も変わってしまいます。\n" +"しかし、キーオブジェクトを変更したのが何者であれ、値が辞書のキーとして使われ" +"ていたと気付けないので、辞書の中のエントリを適切な場所に動かせません。\n" +"そして、同じオブジェクトを探そうとしても、ハッシュ値が違うため見つかりませ" +"ん。\n" +"古い値を探そうとしても、そのハッシュ値に対応する格納場所で見つかるオブジェク" +"トの値は異なるでしょうから、これも見つかりません。" #: ../../faq/design.rst:474 msgid "" @@ -969,40 +1023,44 @@ 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 "" "would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` " "used in the second line differs from that in the first line. In other " -"words, dictionary keys should be compared using ``==``, not using :keyword:" -"`is`." +"words, dictionary keys should be compared using ``==``, not " +"using :keyword:`is`." msgstr "" "``[1, 2]`` の2行目のidは1行目のそれと異なってしまうために :exc:`KeyError` 例" "外を送出するでしょう。言い換えれば、辞書のキーは ``==`` を使って比較されるべ" "きであり、 :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 +1124,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 "" @@ -1078,11 +1152,11 @@ msgstr "" #: ../../faq/design.rst:534 msgid "" -"Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1." -"__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == " -"o2.__hash__()``), regardless of whether the object is in a dictionary or " -"not. If you fail to meet these restrictions dictionaries and other hash " -"based structures will misbehave." +"Furthermore it must always be the case that if ``o1 == o2`` (ie " +"``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, " +"``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in " +"a dictionary or not. If you fail to meet these restrictions dictionaries " +"and other hash based structures will misbehave." msgstr "" "さらに、そのオブジェクトが辞書に含まれるか否かにかかわらず、 ``o1 == o2`` (す" "なわち ``o1.__eq__(o2) is True``) ならばいつでも ``hash(o1) == hash(o2)`` (す" @@ -1137,38 +1211,39 @@ 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 "" "Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base " "Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` " -"to check whether an instance or a class implements a particular ABC. The :" -"mod:`collections.abc` module defines a set of useful ABCs such as :class:" -"`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and :class:" -"`~collections.abc.MutableMapping`." +"to check whether an instance or a class implements a particular ABC. " +"The :mod:`collections.abc` module defines a set of useful ABCs such " +"as :class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, " +"and :class:`~collections.abc.MutableMapping`." msgstr "" "Python 2.6 で、抽象基底クラス (Abstract Base Class, ABC) が定義できるようにな" -"る :mod:`abc` モジュールが追加されました。なので :func:`isinstance` と :func:" -"`issubclass` を使って、インスタンスやクラスが、ある ABC を実装しているかどう" -"かチェックできます。:mod:`collections.abc` モジュールでは、 :class:" -"`~collections.abc.Iterable` 、 :class:`~collections.abc.Container` 、 :class:" -"`~collections.abc.MutableMapping` などの便利な ABC が定義されています。" +"る :mod:`abc` モジュールが追加されました。なので :func:`isinstance` " +"と :func:`issubclass` を使って、インスタンスやクラスが、ある ABC を実装してい" +"るかどうかチェックできます。:mod:`collections.abc` モジュールで" +"は、 :class:`~collections.abc.Iterable` 、 :class:`~collections.abc.Container` 、 :class:`~collections.abc.MutableMapping` " +"などの便利な ABC が定義されています。" #: ../../faq/design.rst:578 msgid "" @@ -1184,18 +1259,18 @@ msgid "" "as a module interface specification and a set of examples. Many Python " "modules can be run as a script to provide a simple \"self test.\" Even " "modules which use complex external interfaces can often be tested in " -"isolation using trivial \"stub\" emulations of the external interface. The :" -"mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can " -"be used to construct exhaustive test suites that exercise every line of code " -"in a module." +"isolation using trivial \"stub\" emulations of the external interface. " +"The :mod:`doctest` and :mod:`unittest` modules or third-party test " +"frameworks can be used to construct exhaustive test suites that exercise " +"every line of code in a module." msgstr "" "モジュールのための適切なテストスイートは、回帰テストを提供し、モジュールのイ" "ンターフェース仕様や用例集としても役立ちます。多くの Python モジュールは、簡" "単な「自己テスト」を提供するスクリプトとして実行できます。複雑な外部インター" "フェースを使うモジュールさえ、外部インターフェースの細かい「スタブ」エミュ" -"レーションで単独にテストできることが多いです。 :mod:`doctest` や :mod:" -"`unittest` モジュール、あるいはサードパーティのテストフレームワークで、モ" -"ジュールのコードの全ての行に及ぶ徹底的なテストスイートを構成できます。" +"レーションで単独にテストできることが多いです。 :mod:`doctest` " +"や :mod:`unittest` モジュール、あるいはサードパーティのテストフレームワーク" +"で、モジュールのコードの全ての行に及ぶ徹底的なテストスイートを構成できます。" #: ../../faq/design.rst:589 msgid "" @@ -1210,10 +1285,11 @@ msgid "" msgstr "" "Python で大きくて複雑なアプリケーションを構築するとき、インターフェース仕様と" "同様に、適切なテスト規律も役立ちます。実際には、インターフェース仕様ではテス" -"トできないプログラムの属性もあるので、それ以上にもなりえます。例えば、 :meth:" -"`!list.append` メソッドは新しい要素をある内部リストの終わりに加えます。イン" -"ターフェース仕様ではこの :meth:`!list.append` の実装が実際にこれを行うかをテ" -"ストできませんが、テストスイートならこの機能を簡単に確かめられます。" +"トできないプログラムの属性もあるので、それ以上にもなりえます。例え" +"ば、 :meth:`!list.append` メソッドは新しい要素をある内部リストの終わりに加え" +"ます。インターフェース仕様ではこの :meth:`!list.append` の実装が実際にこれを" +"行うかをテストできませんが、テストスイートならこの機能を簡単に確かめられま" +"す。" #: ../../faq/design.rst:597 msgid "" @@ -1239,17 +1315,17 @@ msgid "" "\"spaghetti\" code that was hard to understand and revise. In a high-level " "language, it is also unneeded as long as there are ways to branch (in " "Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, " -"and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:" -"`while` and :keyword:`for` statements, possibly containing :keyword:" -"`continue` and :keyword:`break`)." +"and :keyword:`if`/:keyword:`else` expressions) and loop " +"(with :keyword:`while` and :keyword:`for` statements, possibly " +"containing :keyword:`continue` and :keyword:`break`)." msgstr "" "1970年代、人々は気付きました。秩序なき goto は、理解するのも手直しするのも困" "難という厄介な\"スパゲッティ\"コードに陥りがちであると。\n" "高水準言語では、分岐とループの手段があれば goto は不要です。\n" "(Pythonだと、分岐には :keyword:`if` 文及び :keyword:`or` ・ :keyword:`and` " "・ :keyword:`if`/:keyword:`else` 式を使います。ループには :keyword:`while` 文" -"と :keyword:`for` 文を使い、 ループ内に :keyword:`continue` ・ :keyword:" -"`break` を含むことがあります)" +"と :keyword:`for` 文を使い、 ループ内に :keyword:`continue` " +"・ :keyword:`break` を含むことがあります)" #: ../../faq/design.rst:614 msgid "" @@ -1275,6 +1351,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 +1410,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 +1425,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 +1449,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 +1491,9 @@ msgid "" " with a:\n" " print(x)" msgstr "" +"def foo(a):\n" +" with a:\n" +" print(x)" #: ../../faq/design.rst:690 msgid "" @@ -1431,6 +1525,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 +1540,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 +1561,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 @@ -1471,15 +1572,15 @@ msgstr "なぜジェネレータは with 文をサポートしないのですか msgid "" "For technical reasons, a generator used directly as a context manager would " "not work correctly. When, as is most common, a generator is used as an " -"iterator run to completion, no closing is needed. When it is, wrap it as :" -"func:`contextlib.closing(generator) ` in the :keyword:" -"`with` statement." +"iterator run to completion, no closing is needed. When it is, wrap it " +"as :func:`contextlib.closing(generator) ` in " +"the :keyword:`with` statement." msgstr "" "技術的な理由で、ジェネレータは直接コンテキストマネージャとして使ってもうまく" "動きません。最も一般的なように、ジェネレータが最後まで回りきるイテレータとし" -"て使われる場合、クローズ処理は不要です。必要な場合は、 :keyword:`with` 文で :" -"func:`contextlib.closing(generator) ` のようにラップしま" -"す。" +"て使われる場合、クローズ処理は不要です。必要な場合は、 :keyword:`with` 文" +"で :func:`contextlib.closing(generator) ` のようにラップ" +"します。" #: ../../faq/design.rst:730 msgid "Why are colons required for the if/while/def/class statements?" @@ -1497,6 +1598,8 @@ msgid "" "if a == b\n" " print(a)" msgstr "" +"if a == b\n" +" print(a)" #: ../../faq/design.rst:738 msgid "versus ::" @@ -1507,15 +1610,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 +1655,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 +1693,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..a98da53d2 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 @@ -42,8 +42,8 @@ msgstr "C で独自の関数を作ることはできますか?" #: ../../faq/extending.rst:18 msgid "" "Yes, you can create built-in modules containing functions, variables, " -"exceptions and even new types in C. This is explained in the document :ref:" -"`extending-index`." +"exceptions and even new types in C. This is explained in the " +"document :ref:`extending-index`." msgstr "" "はい。関数、変数、例外、そして新しいタイプまで含んだビルトインモジュールを C " "で作れます。これはドキュメント :ref:`extending-index` で説明されています。" @@ -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." +"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?" @@ -80,16 +81,16 @@ msgstr "独自の C 拡張を書くための別のやり方は、目的によっ #: ../../faq/extending.rst:44 msgid "" -"`Cython `_ and its relative `Pyrex `_ are compilers that accept a " -"slightly modified form of Python and generate the corresponding C code. " -"Cython and Pyrex make it possible to write an extension without having to " -"learn Python's C API." +"`Cython `_ and its relative `Pyrex `_ are compilers that " +"accept a slightly modified form of Python and generate the corresponding C " +"code. Cython and Pyrex make it possible to write an extension without " +"having to learn Python's C API." msgstr "" -"`Cython `_ とその親戚 `Pyrex `_ は、わずかに変形した Python を受" -"け取り、対応する C コードを生成します。Cython や Pyrex を使えば Python の C " -"API を習得することなく拡張を書けます。" +"`Cython `_ とその親戚 `Pyrex `_ は、わずかに変形した " +"Python を受け取り、対応する C コードを生成します。Cython や Pyrex を使えば " +"Python の C API を習得することなく拡張を書けます。" #: ../../faq/extending.rst:50 msgid "" @@ -104,10 +105,10 @@ msgstr "" "現時点で Python 拡張が存在しない C や C++ ライブラリへのインターフェースが必" "要な場合、`SWIG `_ のようなツールを使ってそのライブラリ" "のデータ型や関数をラッピングできます。\n" -"`SIP `__ 、`CXX `_ 、`Boost `_ 、" -"`Weave `_ でも C++ ライブラリをラッピングでき" -"ます。" +"`SIP `__ 、`CXX `_ 、`Boost `_ 、`Weave `_ でも C++ ライブラリ" +"をラッピングできます。" #: ../../faq/extending.rst:61 msgid "How can I execute arbitrary Python statements from C?" @@ -118,9 +119,9 @@ msgid "" "The highest-level function to do this is :c:func:`PyRun_SimpleString` which " "takes a single string argument to be executed in the context of the module " "``__main__`` and returns ``0`` for success and ``-1`` when an exception " -"occurred (including :exc:`SyntaxError`). If you want more control, use :c:" -"func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in " -"``Python/pythonrun.c``." +"occurred (including :exc:`SyntaxError`). If you want more control, " +"use :c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` " +"in ``Python/pythonrun.c``." msgstr "" "これを行う最高水準の関数は :c:func:`PyRun_SimpleString` で、一つの文字列引数" "を取り、モジュール ``__main__`` のコンテキストでそれを実行し、成功なら " @@ -138,9 +139,9 @@ msgid "" "start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it " "and returns its value." msgstr "" -"先の質問の :c:func:`PyRun_String` を、スタートシンボル :c:data:" -"`Py_eval_input` を渡して呼び出してください。これは式を解析し、評価してその値" -"を返します。" +"先の質問の :c:func:`PyRun_String` を、スタートシンボ" +"ル :c:data:`Py_eval_input` を渡して呼び出してください。これは式を解析し、評価" +"してその値を返します。" #: ../../faq/extending.rst:80 msgid "How do I extract C values from a Python object?" @@ -150,8 +151,8 @@ msgstr "Python オブジェクトから C の値を取り出すにはどうし msgid "" "That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` " "returns its length and :c:func:`PyTuple_GetItem` returns the item at a " -"specified index. Lists have similar functions, :c:func:`PyList_Size` and :c:" -"func:`PyList_GetItem`." +"specified index. Lists have similar functions, :c:func:`PyList_Size` " +"and :c:func:`PyList_GetItem`." msgstr "" "オブジェクトの型に依ります。タプルなら、 :c:func:`PyTuple_Size` が長さを返" "し、 :c:func:`PyTuple_GetItem` が指定されたインデックスの要素を返します。リス" @@ -160,25 +161,26 @@ msgstr "" #: ../../faq/extending.rst:87 msgid "" -"For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:" -"`PyBytes_AsStringAndSize` provides a pointer to its value and its length. " -"Note that Python bytes objects may contain null bytes so C's :c:func:`!" -"strlen` should not be used." +"For bytes, :c:func:`PyBytes_Size` returns its length " +"and :c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and " +"its length. Note that Python bytes objects may contain null bytes so " +"C's :c:func:`!strlen` should not be used." msgstr "" -"bytes では、 :c:func:`PyBytes_Size` がその長さを返し、 :c:func:" -"`PyBytes_AsStringAndSize` がその値へのポインタと長さを提供します。 Python の " -"bytes オブジェクトは null を含むこともできるので、 C の :c:func:`!strlen` を" -"使うべきではないことに注意してください。" +"bytes では、 :c:func:`PyBytes_Size` がその長さを返" +"し、 :c:func:`PyBytes_AsStringAndSize` がその値へのポインタと長さを提供しま" +"す。 Python の bytes オブジェクトは null を含むこともできるので、 C " +"の :c:func:`!strlen` を使うべきではないことに注意してください。" #: ../../faq/extending.rst:92 msgid "" "To test the type of an object, first make sure it isn't ``NULL``, and then " -"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:" -"`PyList_Check`, etc." +"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, " +"etc." msgstr "" "オブジェクトの型を検査するには、まず最初にそれが ``NULL`` でないことを確かめ" -"た上で、 :c:func:`PyBytes_Check` 、 :c:func:`PyTuple_Check` 、 :c:func:" -"`PyList_Check` などを使います。" +"た上" +"で、 :c:func:`PyBytes_Check` 、 :c:func:`PyTuple_Check` 、 :c:func:`PyList_Check` " +"などを使います。" #: ../../faq/extending.rst:95 msgid "" @@ -192,9 +194,9 @@ msgstr "" "いわゆる 'abstract' インターフェースから提供される、 Python オブジェクトに対" "する高レベル API もあります -- より詳しいことは ``Include/abstract.h`` を読ん" "でください。これを使うと、数値型プロトコル (:c:func:`PyNumber_Index` など) " -"や PyMapping API のマップ型プロトコルなどの役に立つプロトコルに加え、 :c:" -"func:`PySequence_Length` や :c:func:`PySequence_GetItem` などの任意の種類の " -"Python シーケンスへのインターフェースにアクセスできます。" +"や PyMapping API のマップ型プロトコルなどの役に立つプロトコルに加" +"え、 :c:func:`PySequence_Length` や :c:func:`PySequence_GetItem` などの任意の" +"種類の Python シーケンスへのインターフェースにアクセスできます。" #: ../../faq/extending.rst:104 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" @@ -216,25 +218,27 @@ msgid "" "the argument values::" msgstr "" ":c:func:`PyObject_CallMethod` 関数でオブジェクトの任意のメソッドを呼び出せま" -"す。パラメタは、オブジェクト、呼び出すメソッドの名前、 :c:func:" -"`Py_BuildValue` で使われるようなフォーマット文字列、そして引数です::" +"す。パラメタは、オブジェクト、呼び出すメソッドの名" +"前、 :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 +248,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 +257,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 +272,9 @@ msgid "" "parentheses, e.g. \"(i)\"." msgstr "" "なお、 :c:func:`PyObject_CallObject` の引数リストには *常に* タプルが必要で" -"す。関数を引数なしで呼び出すには、フォーマットに \"()\" を渡し、関数を一つの" -"引数で呼び出すには、関数を括弧でくくって例えば \"(i)\" としてください。" +"す。\n" +"関数を引数なしで呼び出すには、フォーマットに \"()\" を渡し、関数を一つの引数" +"で呼び出すには、引数の書式を括弧で囲んで例えば \"(i)\" としてください。" #: ../../faq/extending.rst:142 msgid "" @@ -290,7 +300,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 +309,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 +337,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,23 +360,22 @@ 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 "" -"If the module hasn't been imported yet (i.e. it is not yet present in :data:" -"`sys.modules`), this initializes the module; otherwise it simply returns the " -"value of ``sys.modules[\"\"]``. Note that it doesn't enter the " -"module into any namespace -- it only ensures it has been initialized and is " -"stored in :data:`sys.modules`." +"If the module hasn't been imported yet (i.e. it is not yet present " +"in :data:`sys.modules`), this initializes the module; otherwise it simply " +"returns the value of ``sys.modules[\"\"]``. Note that it " +"doesn't enter the module into any namespace -- it only ensures it has been " +"initialized and is stored in :data:`sys.modules`." msgstr "" "そのモジュールがまだインポートされていない (つまり、まだ :data:`sys.modules` " "に現れていない) なら、これはモジュールを初期化します。そうでなければ、単純に " "``sys.modules[\"\"]`` の値を返します。なお、これはモジュールをい" -"かなる名前空間にも代入しません。これはモジュールが初期化されて ':data:`sys." -"modules` に保管されていることを保証するだけです。" +"かなる名前空間にも代入しません。これはモジュールが初期化されて " +"':data:`sys.modules` に保管されていることを保証するだけです。" #: ../../faq/extending.rst:194 msgid "" @@ -357,9 +385,8 @@ msgstr "" "これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以下の" "ようにアクセスできるようになります::" -#: ../../faq/extending.rst:197 msgid "attr = PyObject_GetAttrString(module, \"\");" -msgstr "" +msgstr "attr = PyObject_GetAttrString(module, \"\");" #: ../../faq/extending.rst:199 msgid "" @@ -413,13 +440,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 +477,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\"?" @@ -532,18 +559,18 @@ msgstr "" #: ../../faq/extending.rst:285 msgid "" -"Yes, you can inherit from built-in classes such as :class:`int`, :class:" -"`list`, :class:`dict`, etc." +"Yes, you can inherit from built-in classes such " +"as :class:`int`, :class:`list`, :class:`dict`, etc." msgstr "" "はい、 :class:`int` 、 :class:`list` 、 :class:`dict` などのビルトインクラス" "から継承できます。" #: ../../faq/extending.rst:288 msgid "" -"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index." -"html) provides a way of doing this from C++ (i.e. you can inherit from an " -"extension class written in C++ using the BPL)." +"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/" +"index.html) provides a way of doing this from C++ (i.e. you can inherit from " +"an extension class written in C++ using the BPL)." msgstr "" -"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index." -"html) を使えば、これを C++ からできます。 (すなわち、BPL を使って C++ で書か" -"れた拡張クラスを継承できます)." +"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/" +"index.html) を使えば、これを C++ からできます。 (すなわち、BPL を使って C++ " +"で書かれた拡張クラスを継承できます)." diff --git a/faq/general.po b/faq/general.po index b0b75f39c..704694e2a 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 @@ -98,8 +98,8 @@ msgstr "" #: ../../faq/general.rst:42 msgid "" "Donations to the PSF are tax-exempt in the US. If you use Python and find " -"it helpful, please contribute via `the PSF donation page `_." +"it helpful, please contribute via `the PSF donation page `_." msgstr "" "PSF への寄付は米国で免税されています。Python を利用して役立ったと感じたら、" "`the PSF donation page `_ で貢献をお願" @@ -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?" @@ -368,9 +367,9 @@ msgid "" msgstr "" "開発サイクルの詳細は `Developer's Guide `__ を、 Python の後方互換性ポリシーに" -"ついては :pep:`387` を参照してください。 ドキュメント :data:`sys." -"version` 、 :data:`sys.hexversion` 、 :data:`sys.version_info` も参照してくだ" -"さい。" +"ついては :pep:`387` を参照してください。 ドキュメン" +"ト :data:`sys.version` 、 :data:`sys.hexversion` 、 :data:`sys.version_info` " +"も参照してください。" #: ../../faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" @@ -443,8 +442,8 @@ msgid "" "There are numerous tutorials and books available. The standard " "documentation includes :ref:`tutorial-index`." msgstr "" -"膨大な量の役に立つチュートリアルや書籍があります。標準のドキュメントには :" -"ref:`tutorial-index` などがあります。" +"膨大な量の役に立つチュートリアルや書籍があります。標準のドキュメントに" +"は :ref:`tutorial-index` などがあります。" #: ../../faq/general.rst:203 msgid "" @@ -460,41 +459,43 @@ 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 " "newsgroup and mailing list are gatewayed into each other -- if you can read " -"news it's unnecessary to subscribe to the mailing list. :newsgroup:`comp." -"lang.python` is high-traffic, receiving hundreds of postings every day, and " -"Usenet readers are often more able to cope with this volume." +"news it's unnecessary to subscribe to the mailing " +"list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of " +"postings every day, and 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 " -"postings per day. It's available as `the python-announce mailing list " +"Announcements of new software releases and events can be found in " +"comp.lang.python.announce, a low-traffic moderated list that receives about " +"five postings per day. It's available as `the python-announce mailing list " "`_." msgstr "" "新しいソフトウェアリリースとイベントの告知は comp.lang.python.announce で見つ" -"けられます。これは一日に 5 ポスティング程度を受ける低トラフィックの手頃なメー" -"リングリストです。`the python-announce mailing list `_ から利用可能です。" +"けられます。\n" +"これは一日に 5 ポスティング程度を受ける投稿が承認制になっている低トラフィック" +"のリストです。\n" +"`the python-announce mailing list `_ から利用可能です。" #: ../../faq/general.rst:222 msgid "" "More info about other mailing lists and newsgroups can be found at https://" "www.python.org/community/lists/." msgstr "" -"その他のメーリングリストやニュースグループについての詳しい情報は https://www." -"python.org/community/lists/ にあります。" +"その他のメーリングリストやニュースグループについての詳しい情報は https://" +"www.python.org/community/lists/ にあります。" #: ../../faq/general.rst:227 msgid "How do I get a beta test version of Python?" @@ -503,9 +504,9 @@ msgstr "Python のベータテスト版はどこで手に入りますか?" #: ../../faq/general.rst:229 msgid "" "Alpha and beta releases are available from https://www.python.org/" -"downloads/. All releases are announced on the comp.lang.python and comp." -"lang.python.announce newsgroups and on the Python home page at https://www." -"python.org/; an RSS feed of news is available." +"downloads/. All releases are announced on the comp.lang.python and " +"comp.lang.python.announce newsgroups and on the Python home page at https://" +"www.python.org/; an RSS feed of news is available." msgstr "" "アルファ/ベータリリースは https://www.python.org/downloads/ で手に入ります。" "リリースはすべて comp.lang.python や comp.lang.python.announce のニュースグ" @@ -526,8 +527,8 @@ msgstr "Python のバグ報告やパッチを上げるにはどうしたら良 #: ../../faq/general.rst:241 msgid "" -"To report a bug or submit a patch, use the issue tracker at https://github." -"com/python/cpython/issues." +"To report a bug or submit a patch, use the issue tracker at https://" +"github.com/python/cpython/issues." msgstr "" "バグの報告やパッチの提出には、issue tracker https://github.com/python/" "CPython/issues をご利用ください。" @@ -570,13 +571,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 "" @@ -593,8 +594,8 @@ msgstr "www.python.org は世界のどこにあるのですか?" #: ../../faq/general.rst:274 msgid "" "The Python project's infrastructure is located all over the world and is " -"managed by the Python Infrastructure Team. Details `here `__." +"managed by the Python Infrastructure Team. Details `here `__." msgstr "" "Pythonプロジェクトのインフラは世界中にあり、Pythonインフラストラクチャチーム" "によって管理されています。詳細は `こちら `__." @@ -606,8 +607,8 @@ msgstr "なぜ Python という名前なのですか?" #: ../../faq/general.rst:281 msgid "" "When he began implementing Python, Guido van Rossum was also reading the " -"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " +"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " "Van Rossum thought he needed a name that was short, unique, and slightly " "mysterious, so he decided to call the language Python." msgstr "" @@ -641,8 +642,8 @@ msgid "" msgstr "" "とても安定しています。1991 年以来新しい安定リリースはおよそ 6 から 18 ヶ月毎" "に出されていて、このペースが続きそうです。バージョン3.9の時点では、Pythonは" -"12ヶ月に一度のペースで新しいフィーチャーリリースを行っています (:pep:" -"`602`) 。" +"12ヶ月に一度のペースで新しいフィーチャーリリースを行っています " +"(:pep:`602`) 。" #: ../../faq/general.rst:304 msgid "" @@ -666,6 +667,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?" @@ -704,8 +709,8 @@ msgstr "Python で行われた大きなプロジェクトはありますか?" #: ../../faq/general.rst:333 msgid "" "See https://www.python.org/about/success for a list of projects that use " -"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " +"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " "different companies and organizations." msgstr "" "Python を利用しているプロジェクトのリストは https://www.python.org/about/" @@ -716,18 +721,18 @@ msgstr "" #: ../../faq/general.rst:338 msgid "" "High-profile Python projects include `the Mailman mailing list manager " -"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat `_, have written part or all of their installer and system " -"administration software in Python. Companies that use Python internally " -"include Google, Yahoo, and Lucasfilm Ltd." +"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat " +"`_, have written part or all of their installer and " +"system administration software in Python. Companies that use Python " +"internally include Google, Yahoo, and Lucasfilm Ltd." msgstr "" "注目されている Python のプロジェクトは `the Mailman mailing list manager " -"`_ や `the Zope application server `_ などです。`Red Hat `_ をはじめとするいくつか" -"の Linux ディストーションのインストーラやシステムアドミニストレーションソフト" -"ウェアは、一部や全部が Python で書かれています。内部で Python を利用している" -"企業には、Google、Yahoo、Lucasfilm Ltd. などがあります。" +"`_ や `the Zope application server `_ などです。`Red Hat `_ をはじめとする" +"いくつかの Linux ディストーションのインストーラやシステムアドミニストレーショ" +"ンソフトウェアは、一部や全部が Python で書かれています。内部で Python を利用" +"している企業には、Google、Yahoo、Lucasfilm Ltd. などがあります。" #: ../../faq/general.rst:347 msgid "What new developments are expected for Python in the future?" @@ -748,8 +753,8 @@ msgstr "" #: ../../faq/general.rst:355 msgid "" -"New development is discussed on `the python-dev mailing list `_." +"New development is discussed on `the python-dev mailing list `_." msgstr "" "新しい開発については `the python-dev mailing list `_ で議論されています。" @@ -758,7 +763,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 +771,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 +836,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 +847,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 +865,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 +897,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..4ad510702 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 @@ -47,8 +47,9 @@ msgid "" "widget set, called :ref:`tkinter `. This is probably the easiest " "to install (since it comes included with most `binary distributions `_ of Python) and use. For more info about Tk, " -"including pointers to the source, see the `Tcl/Tk home page `_. Tcl/Tk is fully portable to the macOS, Windows, and Unix platforms." +"including pointers to the source, see the `Tcl/Tk home page `_. Tcl/Tk is fully portable to the macOS, Windows, and Unix " +"platforms." msgstr "" "Python の標準的なビルドには、 :ref:`tkinter ` という Tcl/Tk ウィ" "ジェットセットのオブジェクト指向インターフェースが含まれています。これは最も" @@ -96,19 +97,19 @@ msgid "" "point to them at run-time using the :envvar:`!TCL_LIBRARY` and :envvar:`!" "TK_LIBRARY` environment variables." msgstr "" -"一つの解決策は、アプリケーションに Tcl と Tk ライブラリを同梱し、環境変数 :" -"envvar:`!TCL_LIBRARY` と :envvar:`!TK_LIBRARY` でランタイムに指定することで" -"す。" +"一つの解決策は、アプリケーションに Tcl と Tk ライブラリを同梱し、環境変" +"数 :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 "" @@ -119,10 +120,10 @@ msgid "" "file descriptor. See :ref:`tkinter-file-handlers`." msgstr "" "Windows 以外のプラットフォームについては、はい、スレッドさえ必要ありませ" -"ん! ただし、I/O コードを少し再構成しなければなりません。Tk には Xt の :c:" -"func:`!XtAddInput` コールと同等なものがあるので、ファイルディスクリプタ上で " -"I/O が可能なときに Tk メインループから呼ばれるコールバック関数を登録できま" -"す。 :ref:`tkinter-file-handlers` を参照してください。" +"ん! ただし、I/O コードを少し再構成しなければなりません。Tk には Xt " +"の :c:func:`!XtAddInput` コールと同等なものがあるので、ファイルディスクリプタ" +"上で I/O が可能なときに Tk メインループから呼ばれるコールバック関数を登録でき" +"ます。 :ref:`tkinter-file-handlers` を参照してください。" #: ../../faq/gui.rst:64 msgid "I can't get key bindings to work in Tkinter: why?" 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..3d45bf228 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 @@ -56,15 +56,15 @@ msgstr "" #: ../../faq/library.rst:21 msgid "" -"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " +"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" -"サードパーティのパッケージについては、`Python Package Index `_ を探したり、`Google `_ その他の web サーチエン" -"ジンを試してください。\"Python\" に加えて一つか二つのキーワードで興味のある話" -"題を検索すれば、たいてい役に立つものが見つかるでしょう。" +"サードパーティのパッケージについては、`Python Package Index `_ を探したり、`Google `_ その他の web サー" +"チエンジンを試してください。\"Python\" に加えて一つか二つのキーワードで興味の" +"ある話題を検索すれば、たいてい役に立つものが見つかるでしょう。" #: ../../faq/library.rst:28 msgid "Where is the math.py (socket.py, regex.py, etc.) source file?" @@ -75,15 +75,15 @@ msgstr "" msgid "" "If you can't find a source file for a module it may be a built-in or " "dynamically loaded module implemented in C, C++ or other compiled language. " -"In this case you may not have the source file or it may be something like :" -"file:`mathmodule.c`, somewhere in a C source directory (not on the Python " -"Path)." +"In this case you may not have the source file or it may be something " +"like :file:`mathmodule.c`, somewhere in a C source directory (not on the " +"Python Path)." msgstr "" "モジュールのソースファイルが見付けられない場合は、それは C 、 C++ かもしくは" "別のコンパイル言語で実装された、ビルトインもしくは動的に読み込まれるモジュー" -"ルかもしれません。この場合、ソースは手に入らないかもしれませんし、 :file:" -"`mathmodule.c` のようなものが (Python の読み込みパスに無い) C ソースディレク" -"トリのどこかにあるかもしれません。" +"ルかもしれません。この場合、ソースは手に入らないかもしれません" +"し、 :file:`mathmodule.c` のようなものが (Python の読み込みパスに無い) C ソー" +"スディレクトリのどこかにあるかもしれません。" #: ../../faq/library.rst:35 msgid "There are (at least) three kinds of modules in Python:" @@ -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 "" @@ -158,14 +160,14 @@ msgid "" "variants support the following, assuming the Python interpreter is in a " "directory on the user's :envvar:`PATH`::" msgstr "" -"スクリプトを Python インタプリタの場所に依存させたくない場合は、 :program:" -"`env` プログラムが使えます。 Python インタプリタがユーザの :envvar:`PATH` の" -"ディレクトリにあることを前提とすれば、ほとんど全ての Unix 系 OS では次の書き" -"方をサポートしています::" +"スクリプトを Python インタプリタの場所に依存させたくない場合" +"は、 :program:`env` プログラムが使えます。 Python インタプリタがユーザ" +"の :envvar:`PATH` のディレクトリにあることを前提とすれば、ほとんど全ての " +"Unix 系 OS では次の書き方をサポートしています::" #: ../../faq/library.rst:69 msgid "#!/usr/bin/env python" -msgstr "" +msgstr "#!/usr/bin/env python" #: ../../faq/library.rst:71 msgid "" @@ -173,9 +175,9 @@ msgid "" "scripts is often very minimal, so you need to use the actual absolute " "pathname of the interpreter." msgstr "" -"CGI スクリプトでこれをやっては *いけません* 。 CGI スクリプトの :envvar:" -"`PATH` 変数はたいてい最小限のものになっているので、実際のインタプリタの絶対パ" -"スを使う必要があります。" +"CGI スクリプトでこれをやっては *いけません* 。 CGI スクリプト" +"の :envvar:`PATH` 変数はたいてい最小限のものになっているので、実際のインタプ" +"リタの絶対パスを使う必要があります。" #: ../../faq/library.rst:75 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?" @@ -218,11 +224,11 @@ msgid "" "compiled by default. (Note that this is not available in the Windows " "distribution -- there is no curses module for Windows.)" msgstr "" -"Unix 系 OS において: 標準の Python ソースディストリビューションには :source:" -"`Modules` サブディレクトリに curses モジュールが付いてきますが、デフォルトで" -"はコンパイルされていません。 (これは Windows 用ディストリビューションでは利用" -"できないことに注意してください -- Windows には curses モジュールはありませ" -"ん。)" +"Unix 系 OS において: 標準の Python ソースディストリビューションに" +"は :source:`Modules` サブディレクトリに curses モジュールが付いてきますが、デ" +"フォルトではコンパイルされていません。 (これは Windows 用ディストリビューショ" +"ンでは利用できないことに注意してください -- Windows には curses モジュールは" +"ありません。)" #: ../../faq/library.rst:103 msgid "" @@ -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,14 +509,24 @@ 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 "" "Instead of trying to guess a good delay value for :func:`time.sleep`, it's " -"better to use some kind of semaphore mechanism. One idea is to use the :mod:" -"`queue` module to create a queue object, let each thread append a token to " -"the queue when it finishes, and let the main thread read as many tokens from " -"the queue as there are threads." +"better to use some kind of semaphore mechanism. One idea is to use " +"the :mod:`queue` module to create a queue object, let each thread append a " +"token to the queue when it finishes, and let the main thread read as many " +"tokens from the queue as there are threads." msgstr "" ":func:`time.sleep` の良い遅延時間を推測しようとするよりも、セマフォのような仕" "組みを使う方が良いでしょう。 1 つのアイディアは :mod:`queue` モジュールを使っ" @@ -512,8 +543,8 @@ msgid "" "The easiest way is to use the :mod:`concurrent.futures` module, especially " "the :mod:`~concurrent.futures.ThreadPoolExecutor` class." msgstr "" -"最も簡単な方法は、新しい :mod:`concurrent.futures` モジュール、特に :mod:" -"`~concurrent.futures.ThreadPoolExecutor` クラスを使うことです。" +"最も簡単な方法は、新しい :mod:`concurrent.futures` モジュール、特" +"に :mod:`~concurrent.futures.ThreadPoolExecutor` クラスを使うことです。" #: ../../faq/library.rst:295 msgid "" @@ -527,15 +558,14 @@ msgstr "" "もしくは、実行アルゴリズムを上手にコントロールしたい場合は、自身の手でロジッ" "クを書くこともできます。 :mod:`queue` モジュールを使って、ジョブのリストを含" "むキューを作ってください。 :class:`~queue.Queue` クラスはオブジェクトのリスト" -"を保持し、キューに要素を追加する ``.put(obj)`` メソッド、それら要素を返す ``." -"get()`` メソッドを持っています。このクラスは、それぞれのジョブがきっちり 1 回" -"だけ取り出されることを保証するのに必要なロック処理にも配慮します。" +"を保持し、キューに要素を追加する ``.put(obj)`` メソッド、それら要素を返す " +"``.get()`` メソッドを持っています。このクラスは、それぞれのジョブがきっちり " +"1 回だけ取り出されることを保証するのに必要なロック処理にも配慮します。" #: ../../faq/library.rst:302 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,14 +659,27 @@ 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 "" -"Consult the module's documentation for more details; the :class:`~queue." -"Queue` class provides a featureful interface." +"Consult the module's documentation for more details; " +"the :class:`~queue.Queue` class provides a featureful interface." msgstr "" -"より詳しいことはモジュールのドキュメントを調べてください; :class:`~queue." -"Queue` クラスは多機能なインターフェースを提供しています。" +"より詳しいことはモジュールのドキュメントを調べてくださ" +"い; :class:`~queue.Queue` クラスは多機能なインターフェースを提供しています。" #: ../../faq/library.rst:363 msgid "What kinds of global value mutation are thread-safe?" @@ -618,10 +696,10 @@ msgid "" msgstr "" ":term:`global interpreter lock` (GIL) が内部で使われ、Python VM で一度に一つ" "だけのスレッドが実行されることが保証されています。一般に、Python ではスレッド" -"間の切り替えをバイトコード命令の間でのみ行います。切り替えの周期は、 :func:" -"`sys.setswitchinterval` で設定できます。したがって、それぞれのバイトコード命" -"令、そしてそれぞれの命令が届く全ての C 実装コードは、 Python プログラムの観点" -"からは、アトミックです。" +"間の切り替えをバイトコード命令の間でのみ行います。切り替えの周期" +"は、 :func:`sys.setswitchinterval` で設定できます。したがって、それぞれのバイ" +"トコード命令、そしてそれぞれの命令が届く全ての C 実装コードは、 Python プログ" +"ラムの観点からは、アトミックです。" #: ../../faq/library.rst:372 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,13 +757,17 @@ 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 "" -"Operations that replace other objects may invoke those other objects' :meth:" -"`~object.__del__` method when their reference count reaches zero, and that " -"can affect things. This is especially true for the mass updates to " -"dictionaries and lists. When in doubt, use a mutex!" +"Operations that replace other objects may invoke those other " +"objects' :meth:`~object.__del__` method when their reference count reaches " +"zero, and that can affect things. This is especially true for the mass " +"updates to dictionaries and lists. When in doubt, use a mutex!" msgstr "" "他のオブジェクトを置き換えるような演算は、そのオブジェクトの参照カウントがゼ" "ロになったときに :meth:`~object.__del__` メソッドを呼び出すことがあり、これが" @@ -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,14 +847,21 @@ 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 "" "Judicious use of C extensions will also help; if you use a C extension to " "perform a time-consuming task, the extension can release the GIL while the " "thread of execution is in the C code and allow other threads to get some " -"work done. Some standard library modules such as :mod:`zlib` and :mod:" -"`hashlib` already do this." +"work done. Some standard library modules such as :mod:`zlib` " +"and :mod:`hashlib` already do this." msgstr "" "C 拡張をうまく使うことも役立ちます。C 拡張を時間のかかるタスクの実行に使え" "ば、その拡張は実行が C コードで行われている間 GIL を解放でき、その間に他のス" @@ -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" @@ -773,8 +897,9 @@ msgstr "ファイルを削除するにはどうしますか? (その他、フ #: ../../faq/library.rst:467 msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " -"see the :mod:`os` module. The two functions are identical; :func:`~os." -"unlink` is simply the name of the Unix system call for this function." +"see the :mod:`os` module. The two functions are " +"identical; :func:`~os.unlink` is simply the name of the Unix system call for " +"this function." msgstr "" "``os.remove(filename)`` または ``os.unlink(filename)`` を使ってください。ド" "キュメントは、 :mod:`os` モジュールを参照してください。この二つの関数は同じも" @@ -789,11 +914,11 @@ msgid "" "directories as long as they're empty; if you want to delete an entire " "directory tree and its contents, use :func:`shutil.rmtree`." msgstr "" -"ディレクトリを削除するには、:func:`os.rmdir` を使ってください。作成には :" -"func:`os.mkdir` を使ってください。``os.makedirs(path)`` は ``path`` の中間の" -"ディレクトリの、存在しないものを作成します。``os.removedirs(path)`` は中間の" -"ディレクトリが空である限り、それらを削除します。ディレクトリツリー全体とその" -"中身全てを削除したいなら、:func:`shutil.rmtree` を使ってください。" +"ディレクトリを削除するには、:func:`os.rmdir` を使ってください。作成に" +"は :func:`os.mkdir` を使ってください。``os.makedirs(path)`` は ``path`` の中" +"間のディレクトリの、存在しないものを作成します。``os.removedirs(path)`` は中" +"間のディレクトリが空である限り、それらを削除します。ディレクトリツリー全体と" +"その中身全てを削除したいなら、:func:`shutil.rmtree` を使ってください。" #: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." @@ -805,8 +930,8 @@ msgstr "" msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " "``f.truncate(offset)``; offset defaults to the current seek position. " -"There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os." -"open`, where *fd* is the file descriptor (a small integer)." +"There's also ``os.ftruncate(fd, offset)`` for files opened " +"with :func:`os.open`, where *fd* is the file descriptor (a small integer)." msgstr "" "ファイルを切り詰めるには、 ``f = open(filename, \"rb+\")`` を使ってファイルを" "開き、 ``f.truncate(offset)`` を使ってください; offset はデフォルトでは現在の" @@ -816,12 +941,12 @@ msgstr "" #: ../../faq/library.rst:484 msgid "" "The :mod:`shutil` module also contains a number of functions to work on " -"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and :" -"func:`~shutil.rmtree`." +"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, " +"and :func:`~shutil.rmtree`." msgstr "" -":mod:`shutil` モジュールにも、:func:`~shutil.copyfile`、 :func:`~shutil." -"copytree`、:func:`~shutil.rmtree` 等、ファイルに作用する関数がいくつか含まれ" -"ます。" +":mod:`shutil` モジュールに" +"も、:func:`~shutil.copyfile`、 :func:`~shutil.copytree`、:func:`~shutil.rmtree` " +"等、ファイルに作用する関数がいくつか含まれます。" #: ../../faq/library.rst:490 msgid "How do I copy a file?" @@ -838,12 +963,13 @@ msgid "" "preserve most (though not all) of it." msgstr "" ":mod:`shutil` モジュールに :func:`~shutil.copyfile` 関数があります。注意点と" -"して、これは Windows NTFS ボリューム上の `alternate data streams `_ も macOS HFS+ 上の " +"して、これは Windows NTFS ボリューム上の `alternate data streams `_ も macOS HFS+ 上の " "`resource forks `__ もコピーしま" "せん。ただし現在ではどちらも使われることは ほとんどありません。またファイルの" -"パーミッションやメタデータもコピーされませんが、この代わりに :func:`shutil." -"copy2` を使うとそのほとんど (すべてではありませんが) が保持されます。" +"パーミッションやメタデータもコピーされませんが、この代わり" +"に :func:`shutil.copy2` を使うとそのほとんど (すべてではありませんが) が保持" +"されます。" #: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" @@ -851,9 +977,9 @@ msgstr "バイナリデータを読み書きするにはどうしますか?" #: ../../faq/library.rst:505 msgid "" -"To read or write complex binary data formats, it's best to use the :mod:" -"`struct` module. It allows you to take a string containing binary data " -"(usually numbers) and convert it to Python objects; and vice versa." +"To read or write complex binary data formats, it's best to use " +"the :mod:`struct` module. It allows you to take a string containing binary " +"data (usually numbers) and convert it to Python objects; and vice versa." msgstr "" "複雑なバイナリデータ形式の読み書きには、:mod:`struct` モジュールを使うのが一" "番です。これでバイナリデータ (通常は数) を含む文字列を取って、 Python オブ" @@ -875,16 +1001,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 "" @@ -901,31 +1032,30 @@ msgid "" "instead (the default), the file will be open in text mode and ``f.read()`` " "will return :class:`str` objects rather than :class:`bytes` objects." msgstr "" -"バイナリデータを読み書きするには、 (ここにあるように ``\"rb\"`` を :func:" -"`open` に渡して) ファイルをバイナリモードで開く義務があります。代わりに (デ" -"フォルトの) ``\"r\"`` を使った場合は、ファイルはテキストモードで開かれ、 ``f." -"read()`` は :class:`bytes` オブジェクトではなく :class:`str` オブジェクトを返" -"します。" +"バイナリデータを読み書きするには、 (ここにあるように ``\"rb\"`` " +"を :func:`open` に渡して) ファイルをバイナリモードで開く義務があります。代わ" +"りに (デフォルトの) ``\"r\"`` を使った場合は、ファイルはテキストモードで開か" +"れ、 ``f.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 "" ":func:`os.read` is a low-level function which takes a file descriptor, a " "small integer representing the opened file. :func:`os.popen` creates a high-" "level file object, the same type returned by the built-in :func:`open` " -"function. Thus, to read *n* bytes from a pipe *p* created with :func:`os." -"popen`, you need to use ``p.read(n)``." +"function. Thus, to read *n* bytes from a pipe *p* created " +"with :func:`os.popen`, you need to use ``p.read(n)``." msgstr "" ":func:`os.read` は、開かれたファイルを表す小さな整数、ファイルディスクリプタ" -"を引数に取る、低レベルの関数です。 :func:`os.popen` は、組み込みの :func:" -"`open` 関数の返り値と同じ型の、高レベルなファイルオブジェクトを作成します。" -"従って、 :func:`os.popen` によって作成されたパイプ *p* から *n* バイト分だけ" -"読み取るには、 ``p.read(n)`` を使う必要があります。" +"を引数に取る、低レベルの関数です。 :func:`os.popen` は、組み込み" +"の :func:`open` 関数の返り値と同じ型の、高レベルなファイルオブジェクトを作成" +"します。従って、 :func:`os.popen` によって作成されたパイプ *p* から *n* バイ" +"ト分だけ読み取るには、 ``p.read(n)`` を使う必要があります。" #: ../../faq/library.rst:545 msgid "How do I access the serial (RS232) port?" @@ -1004,6 +1134,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." @@ -1032,8 +1165,8 @@ msgid "" "A summary of available frameworks is maintained by Paul Boddie at https://" "wiki.python.org/moin/WebProgramming\\ ." msgstr "" -"利用可能なフレームワークの概要は Paul Boddie によって、 https://wiki.python." -"org/moin/WebProgramming でメンテナンスされています。" +"利用可能なフレームワークの概要は Paul Boddie によって、 https://" +"wiki.python.org/moin/WebProgramming でメンテナンスされています。" #: ../../faq/library.rst:601 msgid "What module should I use to help with generating HTML?" @@ -1082,6 +1215,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 +1259,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?" @@ -1143,27 +1304,27 @@ msgstr "" #: ../../faq/library.rst:667 msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " -"an exception. It will just return the errno value. To poll, you can call :" -"meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` " -"indicate that you're connected -- or you can pass this socket to :meth:" -"`select.select` to check if it's writable." +"an exception. It will just return the errno value. To poll, you can " +"call :meth:`~socket.socket.connect_ex` again later -- ``0`` or " +"``errno.EISCONN`` indicate that you're connected -- or you can pass this " +"socket to :meth:`select.select` to check if it's writable." msgstr "" ":meth:`~socket.socket.connect_ex` メソッドを使えば例外を生成しなくて済みま" -"す。これは単に errno の値を返すでしょう。ポーリングのためには、後でまた :" -"meth:`~socket.socket.connect_ex` を呼び出すことができます -- ``0`` または " -"``errno.EISCONN`` は接続されたことを表します -- または、このソケットを :meth:" -"`select.select` に渡して書き込み可能か調べることができます。" +"す。これは単に errno の値を返すでしょう。ポーリングのためには、後でま" +"た :meth:`~socket.socket.connect_ex` を呼び出すことができます -- ``0`` また" +"は ``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" @@ -1180,13 +1341,14 @@ msgstr "はい。" #: ../../faq/library.rst:690 msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " -"` are also included with standard Python. There is also the :mod:" -"`sqlite3` module, which provides a lightweight disk-based relational " -"database." +"` are also included with standard Python. There is also " +"the :mod:`sqlite3` module, which provides a lightweight disk-based " +"relational database." msgstr "" "標準の Python には、 :mod:`DBM ` や :mod:`GDBM ` などの、" -"ディスクベースのハッシュへのインターフェースも含まれています。また、 :mod:" -"`sqlite3` モジュールは、軽量なディスクベースの関係データベースを提供します。" +"ディスクベースのハッシュへのインターフェースも含まれています。ま" +"た、 :mod:`sqlite3` モジュールは、軽量なディスクベースの関係データベースを提" +"供します。" #: ../../faq/library.rst:695 msgid "" @@ -1205,8 +1367,8 @@ msgstr "Python で永続的なオブジェクトを実装するにはどうし #: ../../faq/library.rst:703 msgid "" "The :mod:`pickle` library module solves this in a very general way (though " -"you still can't store things like open files, sockets or windows), and the :" -"mod:`shelve` library module uses pickle and (g)dbm to create persistent " +"you still can't store things like open files, sockets or windows), and " +"the :mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" ":mod:`pickle` ライブラリモジュールで、ごく一般的な方法でこれを解決できます " @@ -1235,10 +1397,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 +1415,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..80b799670 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 @@ -53,8 +53,8 @@ msgstr "はい。" #: ../../faq/programming.rst:19 msgid "" -"Several debuggers for Python are described below, and the built-in function :" -"func:`breakpoint` allows you to drop into any of them." +"Several debuggers for Python are described below, and the built-in " +"function :func:`breakpoint` allows you to drop into any of them." msgstr "" "Python 用のデバッガについては次に解説してあり、組み込みの :func:`breakpoint` " "関数でそれらのデバッガに処理を移せます。" @@ -191,11 +191,11 @@ msgid "" "can embed all your modules into a new program, which is then linked with the " "standard Python modules." msgstr "" -"一つは freeze ツールで、Python ソースツリーに `Tools/freeze `_ として含まれています。これは " -"Python バイトコードを C 配列に変換します。すべてのモジュールを新しいプログラ" -"ムに埋め込む C コンパイラで、そのプログラムは Python モジュールにリンクされま" -"す。" +"一つは freeze ツールで、Python ソースツリーに `Tools/freeze `_ として含まれています。こ" +"れは Python バイトコードを C 配列に変換します。すべてのモジュールを新しいプロ" +"グラムに埋め込む C コンパイラで、そのプログラムは Python モジュールにリンクさ" +"れます。" #: ../../faq/programming.rst:87 msgid "" @@ -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 "" @@ -565,11 +587,11 @@ msgstr "次の手順でモジュールをインポートするのが、良い習 #: ../../faq/programming.rst:301 msgid "" -"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :" -"mod:`re`" +"standard library modules -- " +"e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" msgstr "" -"標準ライブラリモジュール -- 例 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:" -"`re`" +"標準ライブラリモジュール -- " +"例 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:`re`" #: ../../faq/programming.rst:302 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,29 +841,37 @@ 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 " -"actually passed to a function when calling it. Parameters define what :term:" -"`kind of arguments ` a function can accept. For example, given " -"the function definition::" +"actually passed to a function when calling it. Parameters define " +"what :term:`kind of arguments ` a function can accept. For " +"example, given the function definition::" 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 "" @@ -994,8 +1060,8 @@ msgid "" "If you want to know if two variables refer to the same object or not, you " "can use the :keyword:`is` operator, or the built-in function :func:`id`." msgstr "" -"2つの変数が同じオブジェクトを参照しているかどうかが知りたければ、 :keyword:" -"`is` 演算子や組み込み関数 :func:`id` が使えます。" +"2つの変数が同じオブジェクトを参照しているかどうかが知りたけれ" +"ば、 :keyword:`is` 演算子や組み込み関数 :func:`id` が使えます。" #: ../../faq/programming.rst:510 msgid "How do I write a function with output parameters (call by reference)?" @@ -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 "" @@ -1216,15 +1349,15 @@ msgstr "" #: ../../faq/programming.rst:641 msgid "" -"Some objects can be copied more easily. Dictionaries have a :meth:`~dict." -"copy` method::" +"Some objects can be copied more easily. Dictionaries have " +"a :meth:`~dict.copy` method::" msgstr "" "もっと簡単にコピーできるオブジェクトもあります。辞書には :meth:`~dict.copy` " "メソッドがあります::" #: ../../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 "" @@ -1596,8 +1787,8 @@ msgstr "どうすれば SyntaxError を起こさずに整数リテラルの属 #: ../../faq/programming.rst:850 msgid "" -"Trying to lookup an ``int`` literal attribute in the normal manner gives a :" -"exc:`SyntaxError` because the period is seen as a decimal point::" +"Trying to lookup an ``int`` literal attribute in the normal manner gives " +"a :exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" "ふつうの方法で ``int`` リテラルの属性を探そうとすると、ピリオドが小数点とみな" "され、:exc:`SyntaxError` となります::" @@ -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 "" @@ -1653,11 +1849,11 @@ msgid "" "``__import__('os').system(\"rm -rf $HOME\")`` which would erase your home " "directory." msgstr "" -"文字列を数に変換するだけのために :func:`eval` を使わないでください。 :func:" -"`eval` は特に遅いですし、セキュリティ上のリスクもあります。求められない副作用" -"を持つような Python の式を渡そうとする人がいるかも知れません。例えば、あなた" -"のホームディレクトリを消去する ``__import__('os').system(\"rm -rf $HOME\")`` " -"を渡そうとする人がいるかも知れません。" +"文字列を数に変換するだけのために :func:`eval` を使わないでくださ" +"い。 :func:`eval` は特に遅いですし、セキュリティ上のリスクもあります。求めら" +"れない副作用を持つような Python の式を渡そうとする人がいるかも知れません。例" +"えば、あなたのホームディレクトリを消去する ``__import__('os').system(\"rm " +"-rf $HOME\")`` を渡そうとする人がいるかも知れません。" #: ../../faq/programming.rst:889 msgid "" @@ -1679,17 +1875,17 @@ msgid "" "in type constructor :func:`str`. If you want a hexadecimal or octal " "representation, use the built-in functions :func:`hex` or :func:`oct`. For " "fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." -"format(1.0/3.0)`` yields ``'0.333'``." +"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}" +"\".format(1.0/3.0)`` yields ``'0.333'``." msgstr "" "例えば、``144`` という数を ``'144'`` という文字列に変換したいなら、組み込み型" "のコンストラクタ :func:`str` を使ってください。\n" "十六進数や八進数にしたければ、組み込み関数の :func:`hex` や :func:`oct` を" "使ってください。\n" -"手の込んだフォーマット形式を使うなら、 :ref:`f-strings` と :ref:" -"`formatstrings` の節を参照してください。\n" -"例えば、 ``\"{:04d}\".format(144)`` は ``'0144'`` になり、 ``\"{:.3f}\"." -"format(1.0/3.0)`` は ``'0.333'`` になります。" +"手の込んだフォーマット形式を使うなら、 :ref:`f-strings` " +"と :ref:`formatstrings` の節を参照してください。\n" +"例えば、 ``\"{:04d}\".format(144)`` は ``'0144'`` になり、 ``\"{:.3f}" +"\".format(1.0/3.0)`` は ``'0.333'`` になります。" #: ../../faq/programming.rst:906 msgid "How do I modify a string in place?" @@ -1705,8 +1901,8 @@ msgid "" msgstr "" "文字列はイミュータブルなので、それはできません。殆どの場合、組み立てたい個別" "の部品から単純に新しい文字列を構成するべきです。しかし、Unicode データをイン" -"プレースに変更できるオブジェクトが必要なら、 :mod:`array` モジュールの :" -"class:`io.StringIO` オブジェクトを試してください::" +"プレースに変更できるオブジェクトが必要なら、 :mod:`array` モジュール" +"の :class:`io.StringIO` オブジェクトを試してください::" #: ../../faq/programming.rst:914 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,32 +2087,40 @@ 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 "" "Since this is typically only desired when reading text one line at a time, " "using ``S.rstrip()`` this way works well." msgstr "" -"これは典型的に一度に一行ずつテキストを読みたい時にのみ使われるので、``S." -"rstrip()`` をこの方法で使うとうまくいきます。" +"これは典型的に一度に一行ずつテキストを読みたい時にのみ使われるので、" +"``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 " -"string objects and then convert decimal strings to numeric values using :" -"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " -"parameter which is useful if the line uses something other than whitespace " -"as a separator." +"string objects and then convert decimal strings to numeric values " +"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " +"\"sep\" 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 `." @@ -2013,8 +2274,8 @@ msgid "" "Writing benchmark scripts will allow you to iterate quickly when searching " "for improvements (see the :mod:`timeit` module)." msgstr "" -"ベンチマークスクリプトを書くことで、改善箇所の捜索を素早く繰り返せます (:mod:" -"`timeit` モジュールを参照してください)。" +"ベンチマークスクリプトを書くことで、改善箇所の捜索を素早く繰り返せます " +"(:mod:`timeit` モジュールを参照してください)。" #: ../../faq/programming.rst:1086 msgid "" @@ -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 "" @@ -2056,19 +2316,18 @@ msgid "" "When the standard library provides a primitive for doing something, it is " "likely (although not guaranteed) to be faster than any alternative you may " "come up with. This is doubly true for primitives written in C, such as " -"builtins and some extension types. For example, be sure to use either the :" -"meth:`list.sort` built-in method or the related :func:`sorted` function to " -"do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"builtins and some extension types. For example, be sure to use either " +"the :meth:`list.sort` built-in method or the related :func:`sorted` function " +"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " "advanced usage)." msgstr "" "何かをするための基本要素が標準ライブラリにあるなら、自分で発明した代用品より" "もそちらのほうが、(絶対にとは言えませんが) おそらく速いです。\n" "それが組み込み型やある種の拡張型のように C で書かれたものならなおさらです。\n" -"たとえば、ソートするには、必ず :meth:`list.sort` 組み込みメソッドか :func:" -"`sorted` 関数を使ってください (また、中程度に高度な例は、 :ref:" -"`sortinghowto` を参照してください)。" +"たとえば、ソートするには、必ず :meth:`list.sort` 組み込みメソッド" +"か :func:`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`)" @@ -2148,16 +2411,18 @@ msgid "" "extend a :class:`bytearray` object using in-place concatenation (the ``+=`` " "operator)::" msgstr "" -"多くの :class:`bytes` オブジェクトを累積するのにおすすめのイディオムは、 :" -"class:`bytearray` オブジェクトをインプレース結合 (``+=`` 演算子) で拡張するこ" -"とです::" +"多くの :class:`bytes` オブジェクトを累積するのにおすすめのイディオム" +"は、 :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,18 +2542,25 @@ 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 "" -"If all elements of the list may be used as set keys (i.e. they are all :term:" -"`hashable`) this is often faster ::" +"If all elements of the list may be used as set keys (i.e. they are " +"all :term:`hashable`) this is often faster ::" msgstr "" -"リストのすべての要素が集合のキーとして使える (つまり、すべての要素が :term:" -"`hashable`) なら、おそらくこのほうが速いです ::" +"リストのすべての要素が集合のキーとして使える (つまり、すべての要素" +"が :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 "" @@ -2354,9 +2626,9 @@ msgid "" "packages define array-like structures with various characteristics as well." msgstr "" "``array`` モジュールにも固定された型を簡潔に表現する配列を作るためのメソッド" -"がありますが、リストよりもインデクスが遅いです。また、`NumPy `_ やその他のサードパーティー拡張でも、様々な特徴をもつ配列的な構造体が" -"定義されています。" +"がありますが、リストよりもインデクスが遅いです。また、`NumPy `_ やその他のサードパーティー拡張でも、様々な特徴をもつ配列的な構" +"造体が定義されています。" #: ../../faq/programming.rst:1260 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 "" @@ -2469,18 +2745,20 @@ msgstr "オブジェクトのシーケンスにメソッドや関数を適用す #: ../../faq/programming.rst:1327 msgid "" -"To call a method or function and accumulate the return values is a list, a :" -"term:`list comprehension` is an elegant solution::" +"To call a method or function and accumulate the return values is a list, " +"a :term:`list comprehension` is an elegant solution::" 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 "" @@ -2609,26 +2905,30 @@ msgstr "" "オブジェクトに :meth:`~object.__iadd__` 特殊メソッドが実装されている場合、拡" "張代入 ``+=`` が実行されるときにそれが呼び出され、その返り値が代入文で使われ" "ます; (b) リストでは、:meth:`!__iadd__` は :meth:`!extend` の呼び出しと等価" -"で、リストを返します。こんな理由で、リストでは ``+=`` は :meth:`!list." -"extend` の \"略記\" だと言ったのでした::" +"で、リストを返します。こんな理由で、リストでは ``+=`` は :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 "" @@ -2758,19 +3063,21 @@ msgstr "メソッドとは何ですか?" #: ../../faq/programming.rst:1481 msgid "" -"A method is a function on some object ``x`` that you normally call as ``x." -"name(arguments...)``. Methods are defined as functions inside the class " +"A method is a function on some object ``x`` that you normally call as " +"``x.name(arguments...)``. Methods are defined as functions inside the class " "definition::" 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?" @@ -2817,8 +3124,8 @@ msgstr "" #: ../../faq/programming.rst:1511 msgid "" -"Note that :func:`isinstance` also checks for virtual inheritance from an :" -"term:`abstract base class`. So, the test will return ``True`` for a " +"Note that :func:`isinstance` also checks for virtual inheritance from " +"an :term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" @@ -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,15 +3286,25 @@ 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 "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " -"argument string to uppercase before calling the underlying ``self._outfile." -"write()`` method. All other methods are delegated to the underlying ``self." -"_outfile`` object. The delegation is accomplished via the :meth:`~object." -"__getattr__` method; consult :ref:`the language reference ` for more information about controlling attribute access." +"argument string to uppercase before calling the underlying " +"``self._outfile.write()`` method. All other methods are delegated to the " +"underlying ``self._outfile`` object. The delegation is accomplished via " +"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " +"` for more information about controlling attribute access." msgstr "" "ここで ``UpperOut`` クラスは ``write()`` メソッドを定義しなおして、引数の文字" "列を大文字に変換してから基礎となる ``self._outfile.write()`` メソッドを呼び出" @@ -2962,20 +3313,18 @@ 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:" -"`~object.__setattr__` method too, and it must do so carefully. The basic " -"implementation of :meth:`!__setattr__` is roughly equivalent to the " +"attributes must be set as well as retrieved, the class must define " +"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " +"basic 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,37 @@ 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::" +"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." +"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 +3376,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 +3393,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 +3410,6 @@ msgstr "" "す。ちなみに、この手法は使用する基底クラスを動的に選びたいとき、例えば使える" "リソースによって選びたいときなどにも便利です。例::" -#: ../../faq/programming.rst:1651 msgid "" "class Base:\n" " ...\n" @@ -3060,6 +3419,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 +3447,6 @@ msgstr "" "静的なデータを作るには、単純にクラス属性を定義してください。その属性に新しい" "値を代入するには、代入するクラス名を明示する必要があります::" -#: ../../faq/programming.rst:1669 msgid "" "class C:\n" " count = 0 # number of times C.__init__ called\n" @@ -3092,6 +3457,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 +3488,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 +3502,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 +3516,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 +3536,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 +3566,6 @@ msgstr "" "Python では、一つのコンストラクタでデフォルトの引数を使ってすべての場合に対応" "するように書かなければなりません。例えば::" -#: ../../faq/programming.rst:1725 msgid "" "class C:\n" " def __init__(self, i=None):\n" @@ -3198,6 +3574,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 +3589,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 +3618,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 +3638,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 "" @@ -3284,9 +3679,9 @@ msgstr "いくつかの可能性があります。" #: ../../faq/programming.rst:1782 msgid "" -"The :keyword:`del` statement does not necessarily call :meth:`~object." -"__del__` -- it simply decrements the object's reference count, and if this " -"reaches zero :meth:`!__del__` is called." +"The :keyword:`del` statement does not necessarily " +"call :meth:`~object.__del__` -- it simply decrements the object's reference " +"count, and if this reaches zero :meth:`!__del__` is called." msgstr "" ":keyword:`del` 文は必ずしも :meth:`~object.__del__` を呼び出すとは限りません " "-- これは単純にオブジェクトの参照カウントを減らすもので、カウントがゼロになっ" @@ -3315,7 +3710,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 +3718,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 +3776,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 +3809,7 @@ msgstr "" "同一性テストの最も重要な特性は、オブジェクトは常にそれ自身と同一であり、 ``a " "is a`` は常に ``True`` を返すということです。 同一性テストは通常、等価性テス" "トよりも高速です。 また、等価性テストとは異なり、同一性テストは真偽値 " -"``True`` または``False`` を返すことが保証されています。" +"``True`` または ``False`` を返すことが保証されています。" #: ../../faq/programming.rst:1866 msgid "" @@ -3428,25 +3821,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 +3877,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 +3896,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 +3913,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 +3931,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 +3948,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__`::" +"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 +3966,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 +3979,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 +4025,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 +4035,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?" @@ -3619,9 +4050,10 @@ msgstr "メソッド呼び出しをキャッシュするには どうしたら #: ../../faq/programming.rst:1997 msgid "" -"The two principal tools for caching methods are :func:`functools." -"cached_property` and :func:`functools.lru_cache`. The former stores results " -"at the instance level and the latter at the class level." +"The two principal tools for caching methods " +"are :func:`functools.cached_property` and :func:`functools.lru_cache`. The " +"former stores results at the instance level and the latter at the class " +"level." msgstr "" "メソッドキャッシュの主な道具は2つあり、 :func:`functools.cached_property` " "と :func:`functools.lru_cache` です。前者はインスタンスレベル、後者はクラスレ" @@ -3658,22 +4090,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 +4127,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 "" @@ -3711,14 +4162,14 @@ msgstr "" #: ../../faq/programming.rst:2049 msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " -"class needs to define the :meth:`~object.__eq__` and :meth:`~object." -"__hash__` methods so that the cache can detect relevant attribute updates::" +"class needs to define the :meth:`~object.__eq__` " +"and :meth:`~object.__hash__` methods so that the cache can detect relevant " +"attribute updates::" msgstr "" "*station_id* が可変の場合に *lru_cache* アプローチを機能させるには、クラス" "で :meth:`~object.__eq__` と :meth:`~object.__hash__` メソッドを定義する必要" "があります。これにより、キャッシュは関連する属性の更新を検出できます::" -#: ../../faq/programming.rst:2053 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -3740,6 +4191,25 @@ 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" +"\n" +" def change_station(self, station_id):\n" +" self.station_id = station_id\n" +"\n" +" def __eq__(self, other):\n" +" return self.station_id == other.station_id\n" +"\n" +" def __hash__(self):\n" +" return hash(self.station_id)\n" +"\n" +" @lru_cache(maxsize=20)\n" +" def historic_rainfall(self, date, units='cm'):\n" +" '指定した日の降水量'\n" +" # station_id、date、units に依存する。" #: ../../faq/programming.rst:2075 msgid "Modules" @@ -3764,8 +4234,8 @@ msgstr "" "が入っている ``.pyc`` ファイルが、 ``.py`` ファイルのあるディレクトリのサブ" "ディレクトリ ``__pycache__`` に作成されます。 ``.pyc`` ファイルのファイル名" "は、 ``.py`` ファイルの名前で始まり、 ``.pyc`` で終わり、中間部分はこのファイ" -"ルを作った ``python`` バイナリに依存した文字列になります。 (詳細は :pep:" -"`3147` を参照してください。)" +"ルを作った ``python`` バイナリに依存した文字列になります。 (詳細" +"は :pep:`3147` を参照してください。)" #: ../../faq/programming.rst:2088 msgid "" @@ -3795,10 +4265,10 @@ msgstr "" #: ../../faq/programming.rst:2098 msgid "" -"Running Python on a top level script is not considered an import and no ``." -"pyc`` will be created. For example, if you have a top-level module ``foo." -"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing " -"``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"Running Python on a top level script is not considered an import and no " +"``.pyc`` will be created. For example, if you have a top-level module " +"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " +"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " "``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" @@ -3811,9 +4281,9 @@ msgstr "" #: ../../faq/programming.rst:2105 msgid "" -"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." -"pyc`` file for a module that is not imported -- you can, using the :mod:" -"`py_compile` and :mod:`compileall` modules." +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " +"``.pyc`` file for a module that is not imported -- you can, using " +"the :mod:`py_compile` and :mod:`compileall` modules." msgstr "" "``foo`` の ``.pyc`` ファイルを作成する -- つまり、インポートされていないモ" "ジュールの ``.pyc`` ファイルを作成する -- 必要がある場合、 :mod:`py_compile` " @@ -3828,11 +4298,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 +4326,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 +4340,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 +4356,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 +4375,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:" @@ -3956,8 +4434,8 @@ msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" msgstr "" -"インポートメカニズムは ``foo`` のグローバルから ``foo_var`` を読んで、 ``bar." -"foo_var = foo.foo_var`` に設定しようとします。" +"インポートメカニズムは ``foo`` のグローバルから ``foo_var`` を読んで、 " +"``bar.foo_var = foo.foo_var`` に設定しようとします。" #: ../../faq/programming.rst:2170 msgid "" @@ -3979,18 +4457,18 @@ 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 " -"variables and class variables should use constants or built-in functions " -"only. This means everything from an imported module is referenced as " -"``.``." +"Guido van Rossum recommends avoiding all uses of ``from " +"import ...``, and placing all code inside functions. Initializations of " +"global variables and class variables should use constants or built-in " +"functions 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 +4529,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 +4554,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 +4569,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 +4584,6 @@ msgstr "" "スタンスは新しいクラス定義を使うようにアップデート *されません*。これによって" "以下の矛盾した振舞いがなされえます::" -#: ../../faq/programming.rst:2231 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4116,22 +4593,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..53609361e 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,28 +153,32 @@ msgid "" ">>> \"Hello\" * 3\n" "'HelloHelloHello'" msgstr "" +">>> print(\"Hello\")\n" +"Hello\n" +">>> \"Hello\" * 3\n" +"'HelloHelloHello'" #: ../../faq/windows.rst:84 msgid "" "Many people use the interactive mode as a convenient yet highly programmable " -"calculator. When you want to end your interactive Python session, call the :" -"func:`exit` function or hold the :kbd:`Ctrl` key down while you enter a :kbd:" -"`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows command " -"prompt." +"calculator. When you want to end your interactive Python session, call " +"the :func:`exit` function or hold the :kbd:`Ctrl` key down while you enter " +"a :kbd:`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows " +"command prompt." msgstr "" "多くの人が対話モードを便利で高度なプログラム可能計算機として使っています。対" -"話式 Python セッションを終わらせたいなら、 :func:`exit` 関数を呼び出すか、 :" -"kbd:`Ctrl` キーを押しながら :kbd:`Z` を入力し \":kbd:`Enter`\" キーを押し" -"て、 Windows コマンドプロンプトに戻ってください。" +"話式 Python セッションを終わらせたいなら、 :func:`exit` 関数を呼び出す" +"か、 :kbd:`Ctrl` キーを押しながら :kbd:`Z` を入力し \":kbd:`Enter`\" キーを押" +"して、 Windows コマンドプロンプトに戻ってください。" #: ../../faq/windows.rst:90 msgid "" -"You may also find that you have a Start-menu entry such as :menuselection:" -"`Start --> Programs --> Python 3.x --> Python (command line)` that results " -"in you seeing the ``>>>`` prompt in a new window. If so, the window will " -"disappear after you call the :func:`exit` function or enter the :kbd:`Ctrl-" -"Z` character; Windows is running a single \"python\" command in the window, " -"and closes it when you terminate the interpreter." +"You may also find that you have a Start-menu entry such " +"as :menuselection:`Start --> Programs --> Python 3.x --> Python (command " +"line)` that results in you seeing the ``>>>`` prompt in a new window. If " +"so, the window will disappear after you call the :func:`exit` function or " +"enter the :kbd:`Ctrl-Z` character; Windows is running a single \"python\" " +"command in the window, and closes it when you terminate the interpreter." msgstr "" ":menuselection:`スタート --> すべてのプログラム --> Python 3.x --> Python " "(command line)` のような項目がスタートメニューに見付かるかもしれません。\n" @@ -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,13 @@ 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 "" @@ -328,9 +340,10 @@ msgstr "" msgid "" "Do **not** build Python into your .exe file directly. On Windows, Python " "must be a DLL to handle importing modules that are themselves DLL's. (This " -"is the first key undocumented fact.) Instead, link to :file:`python{NN}." -"dll`; it is typically installed in ``C:\\Windows\\System``. *NN* is the " -"Python version, a number such as \"33\" for Python 3.3." +"is the first key undocumented fact.) Instead, link " +"to :file:`python{NN}.dll`; it is typically installed in ``C:" +"\\Windows\\System``. *NN* is the Python version, a number such as \"33\" " +"for Python 3.3." msgstr "" "あなたの .exe 内に直接 Python を取り込んでビルド **しないで** 下さい。" "Windows では、それ自身が DLL になっているようなモジュールのインポートを処理す" @@ -348,12 +361,11 @@ msgid "" "merely defines symbols for the linker.)" msgstr "" "Python には、load-time に、または run-time にリンクできます。load-time なリン" -"クは、 :file:`python{NN}.lib` に対してリンクするもので、run-time なリンクは :" -"file:`python{NN}.dll` に対してリンクするものです。(一般的な注意: :file:" -"`python{NN}.lib` は :file:`python{NN}.dll` に対するいわゆる \"インポートライ" -"ブラリ\" です。これは単にリンカに対するシンボルを定義します。)" +"クは、 :file:`python{NN}.lib` に対してリンクするもので、run-time なリンク" +"は :file:`python{NN}.dll` に対してリンクするものです。(一般的な注" +"意: :file:`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 +375,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 +437,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 +475,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 "" @@ -518,22 +541,22 @@ msgstr "" #: ../../faq/windows.rst:262 msgid "" "Under any editor, mixing tabs and spaces is a bad idea. MSVC is no " -"different in this respect, and is easily configured to use spaces: Take :" -"menuselection:`Tools --> Options --> Tabs`, and for file type \"Default\" " -"set \"Tab size\" and \"Indent size\" to 4, and select the \"Insert spaces\" " -"radio button." +"different in this respect, and is easily configured to use spaces: " +"Take :menuselection:`Tools --> Options --> Tabs`, and for file type " +"\"Default\" set \"Tab size\" and \"Indent size\" to 4, and select the " +"\"Insert spaces\" radio button." msgstr "" "いかなるエディタでも、タブとスペースを混ぜるのは良くないです。 MSVC も全く同" -"じ立場であり、スペースを使うようにする設定が簡単にできます。 :menuselection:" -"`Tools --> Options --> Tabs` を選択し、ファイルタイプの \"デフォルト\" の " -"\"タブ幅\" と \"インデント幅\" に 4 を設定して、 \"スペースを挿入する\" のラ" -"ジオボタンを選択してください。" +"じ立場であり、スペースを使うようにする設定が簡単にできま" +"す。 :menuselection:`Tools --> Options --> Tabs` を選択し、ファイルタイプの " +"\"デフォルト\" の \"タブ幅\" と \"インデント幅\" に 4 を設定して、 \"スペース" +"を挿入する\" のラジオボタンを選択してください。" #: ../../faq/windows.rst:267 msgid "" "Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs and " -"spaces are causing problems in leading whitespace. You may also run the :mod:" -"`tabnanny` module to check a directory tree in batch mode." +"spaces are causing problems in leading whitespace. You may also run " +"the :mod:`tabnanny` module to check a directory tree in batch mode." msgstr "" "Python は、もしタブとスペースが混在していることで先頭の空白に問題がある場" "合、:exc:`IndentationError` または :exc:`TabError` を送出します。\n" @@ -544,15 +567,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..ebf55653e 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 @@ -83,36 +83,36 @@ msgid "" "define interfaces when other techniques like :func:`hasattr` would be clumsy " "or subtly wrong (for example with :ref:`magic methods `). " "ABCs introduce virtual subclasses, which are classes that don't inherit from " -"a class but are still recognized by :func:`isinstance` and :func:" -"`issubclass`; see the :mod:`abc` module documentation. Python comes with " -"many built-in ABCs for data structures (in the :mod:`collections.abc` " -"module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` " -"module), import finders and loaders (in the :mod:`importlib.abc` module). " -"You can create your own ABCs with the :mod:`abc` module." -msgstr "" -"(抽象基底クラス) 抽象基底クラスは :term:`duck-typing` を補完するもので、 :" -"func:`hasattr` などの別のテクニックでは不恰好であったり微妙に誤る (例えば :" -"ref:`magic methods ` の場合) 場合にインターフェースを定義する" -"方法を提供します。ABC は仮想 (virtual) サブクラスを導入します。これは親クラス" -"から継承しませんが、それでも :func:`isinstance` や :func:`issubclass` に認識" -"されます; :mod:`abc` モジュールのドキュメントを参照してください。Python に" -"は、多くの組み込み ABC が同梱されています。その対象は、(:mod:`collections." -"abc` モジュールで) データ構造、(:mod:`numbers` モジュールで) 数、(:mod:`io` " -"モジュールで) ストリーム、(:mod:`importlib.abc` モジュールで) インポートファ" -"インダ及びローダーです。 :mod:`abc` モジュールを利用して独自の ABC を作成でき" -"ます。" +"a class but are still recognized by :func:`isinstance` " +"and :func:`issubclass`; see the :mod:`abc` module documentation. Python " +"comes with many built-in ABCs for data structures (in " +"the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), " +"streams (in the :mod:`io` module), import finders and loaders (in " +"the :mod:`importlib.abc` module). You can create your own ABCs with " +"the :mod:`abc` module." +msgstr "" +"(抽象基底クラス) 抽象基底クラスは :term:`duck-typing` を補完するもの" +"で、 :func:`hasattr` などの別のテクニックでは不恰好であったり微妙に誤る (例え" +"ば :ref:`magic methods ` の場合) 場合にインターフェースを定義" +"する方法を提供します。ABC は仮想 (virtual) サブクラスを導入します。これは親ク" +"ラスから継承しませんが、それでも :func:`isinstance` や :func:`issubclass` に" +"認識されます; :mod:`abc` モジュールのドキュメントを参照してください。Python " +"には、多くの組み込み ABC が同梱されています。その対象は、" +"(:mod:`collections.abc` モジュールで) データ構造、(:mod:`numbers` モジュール" +"で) 数、(:mod:`io` モジュールで) ストリーム、(:mod:`importlib.abc` モジュール" +"で) インポートファインダ及びローダーです。 :mod:`abc` モジュールを利用して独" +"自の ABC を作成できます。" -#: ../../glossary.rst:38 msgid "annotate function" -msgstr "" +msgstr "annotate function" #: ../../glossary.rst:40 msgid "" "A function that can be called to retrieve the :term:`annotations " -"` of an object. This function is accessible as the :attr:" -"`~object.__annotate__` attribute of functions, classes, and modules. " -"Annotate functions are a subset of :term:`evaluate functions `." +"` of an object. This function is accessible as " +"the :attr:`~object.__annotate__` attribute of functions, classes, and " +"modules. Annotate functions are a subset of :term:`evaluate functions " +"`." msgstr "" #: ../../glossary.rst:44 @@ -128,20 +128,27 @@ 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 "" -"See :term:`variable annotation`, :term:`function annotation`, :pep:`484`, :" -"pep:`526`, and :pep:`649`, which describe this functionality. Also see :ref:" -"`annotations-howto` for best practices on working with annotations." +"See :term:`variable annotation`, :term:`function " +"annotation`, :pep:`484`, :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" @@ -163,14 +170,16 @@ msgid "" "following calls to :func:`complex`::" msgstr "" ":dfn:`キーワード引数`: 関数呼び出しの際に引数の前に識別子がついたもの (例: " -"``name=``) や、 ``**`` に続けた辞書の中の値として渡された引数。例えば、次の :" -"func:`complex` の呼び出しでは、 ``3`` と ``5`` がキーワード引数です::" +"``name=``) や、 ``**`` に続けた辞書の中の値として渡された引数。例えば、次" +"の :func:`complex` の呼び出しでは、 ``3`` と ``5`` がキーワード引数です::" #: ../../glossary.rst:69 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 +197,8 @@ msgid "" "complex(3, 5)\n" "complex(*(3, 5))" msgstr "" +"complex(3, 5)\n" +"complex(*(3, 5))" #: ../../glossary.rst:81 msgid "" @@ -217,13 +228,13 @@ msgstr "asynchronous context manager" #: ../../glossary.rst:91 msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`~object.__aenter__` and :meth:`~object." -"__aexit__` methods. Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` " +"and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." msgstr "" "(非同期コンテキストマネージャ)\n" ":meth:`~object.__aenter__` と :meth:`~object.__aexit__` メソッドを定義するこ" -"とで :keyword:`async with` 文内の環境を管理するオブジェクトです。 :pep:" -"`492` で導入されました。" +"とで :keyword:`async with` 文内の環境を管理するオブジェクトで" +"す。 :pep:`492` で導入されました。" #: ../../glossary.rst:94 msgid "asynchronous generator" @@ -238,8 +249,8 @@ msgid "" msgstr "" "(非同期ジェネレータ)\n" ":term:`asynchronous generator iterator` を返す関数です。\n" -":keyword:`async def` で定義されたコルーチン関数に似ていますが、 :keyword:" -"`yield` 式を持つ点で異なります。\n" +":keyword:`async def` で定義されたコルーチン関数に似ています" +"が、 :keyword:`yield` 式を持つ点で異なります。\n" ":keyword:`yield` 式は :keyword:`async for` ループで使用できる値の並びを生成す" "るのに使用されます。" @@ -273,17 +284,16 @@ msgstr "" #: ../../glossary.rst:112 msgid "" -"This is an :term:`asynchronous iterator` which when called using the :meth:" -"`~object.__anext__` method returns an awaitable object which will execute " -"the body of the asynchronous generator function until the next :keyword:" -"`yield` expression." +"This is an :term:`asynchronous iterator` which when called using " +"the :meth:`~object.__anext__` method returns an awaitable object which will " +"execute the body of the asynchronous generator function until the " +"next :keyword:`yield` expression." msgstr "" "これは :term:`asynchronous iterator` で、 :meth:`~object.__anext__` メソッド" "を使って呼ばれると awaitable オブジェクトを返します。 この awaitable オブ" "ジェクトは、次の :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 +301,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" @@ -303,9 +318,9 @@ msgid "" "method. Introduced by :pep:`492`." msgstr "" "(非同期イテラブル)\n" -":keyword:`async for` 文の中で使用できるオブジェクトです。 自身の :meth:" -"`~object.__aiter__` メソッドから :term:`asynchronous iterator` を返さなければ" -"なりません。 :pep:`492` で導入されました。" +":keyword:`async for` 文の中で使用できるオブジェクトです。 自身" +"の :meth:`~object.__aiter__` メソッドから :term:`asynchronous iterator` を返" +"さなければなりません。 :pep:`492` で導入されました。" #: ../../glossary.rst:127 msgid "asynchronous iterator" @@ -313,11 +328,12 @@ msgstr "asynchronous iterator" #: ../../glossary.rst:129 msgid "" -"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." -"__anext__` methods. :meth:`~object.__anext__` must return an :term:" -"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " -"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " -"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` " +"and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must " +"return an :term:`awaitable` object. :keyword:`async for` resolves the " +"awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` " +"method until it raises a :exc:`StopAsyncIteration` exception. Introduced " +"by :pep:`492`." msgstr "" "(非同期イテレータ)\n" ":meth:`~object.__aiter__` と :meth:`~object.__anext__` メソッドを実装したオブ" @@ -326,21 +342,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 +365,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 "" @@ -376,10 +400,10 @@ msgstr "" #: ../../glossary.rst:163 msgid "" "It is possible to give an object an attribute whose name is not an " -"identifier as defined by :ref:`identifiers`, for example using :func:" -"`setattr`, if the object allows it. Such an attribute will not be accessible " -"using a dotted expression, and would instead need to be retrieved with :func:" -"`getattr`." +"identifier as defined by :ref:`identifiers`, for example " +"using :func:`setattr`, if the object allows it. Such an attribute will not " +"be accessible using a dotted expression, and would instead need to be " +"retrieved with :func:`getattr`." msgstr "" "オブジェクトには、 :ref:`identifiers` で定義される識別子ではない名前の属性を" "与えることができます。たとえば :func:`setattr` を使い、オブジェクトがそれを許" @@ -392,14 +416,14 @@ msgstr "awaitable" #: ../../glossary.rst:170 msgid "" -"An object that can be used in an :keyword:`await` expression. Can be a :" -"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " -"also :pep:`492`." +"An object that can be used in an :keyword:`await` expression. Can be " +"a :term:`coroutine` or an object with an :meth:`~object.__await__` method. " +"See also :pep:`492`." msgstr "" "(待機可能)\n" -":keyword:`await` 式で使用することが出来るオブジェクトです。 :term:" -"`coroutine` か、 :meth:`~object.__await__` メソッドがあるオブジェクトです。 :" -"pep:`492` を参照してください。" +":keyword:`await` 式で使用することが出来るオブジェクトで" +"す。 :term:`coroutine` か、 :meth:`~object.__await__` メソッドがあるオブジェ" +"クトです。 :pep:`492` を参照してください。" #: ../../glossary.rst:173 msgid "BDFL" @@ -407,8 +431,8 @@ msgstr "BDFL" #: ../../glossary.rst:175 msgid "" -"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." +"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." msgstr "" "慈悲深き終身独裁者 (Benevolent Dictator For Life) の略です。Python の作者、" "`Guido van Rossum `_ のことです。" @@ -421,46 +445,54 @@ msgstr "binary file" msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " -"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io." -"BytesIO` and :class:`gzip.GzipFile`." +"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer " +"`, :data:`sys.stdout.buffer `, and instances " +"of :class:`io.BytesIO` and :class:`gzip.GzipFile`." msgstr "" "(バイナリファイル)\n" ":term:`bytes-like オブジェクト ` の読み込みおよび書き込み" "ができる :term:`ファイルオブジェクト ` です。\n" "バイナリファイルの例は、バイナリモード (``'rb'``, ``'wb'`` or ``'rb+'``) で開" -"かれたファイル、:data:`sys.stdin.buffer `、:data:`sys.stdout." -"buffer `、 :class:`io.BytesIO` や :class:`gzip.GzipFile`. のイン" -"スタンスです。" +"かれたファイル、:data:`sys.stdin.buffer " +"`、:data:`sys.stdout.buffer `、 :class:`io.BytesIO` " +"や :class:`gzip.GzipFile`. のインスタンスです。" #: ../../glossary.rst:186 msgid "" -"See also :term:`text file` for a file object able to read and write :class:" -"`str` objects." +"See also :term:`text file` for a file object able to read and " +"write :class:`str` objects." msgstr "" -":class:`str` オブジェクトの読み書きができるファイルオブジェクトについては、 :" -"term:`text file` も参照してください。" +":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 " -"cannot be destroyed before the last usage of the borrowed reference. The :c:" -"func:`Py_NewRef` function can be used to create a new :term:`strong " +"cannot be destroyed before the last usage of the borrowed reference. " +"The :c: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" @@ -468,38 +500,38 @@ msgstr "bytes-like object" #: ../../glossary.rst:203 msgid "" -"An object that supports the :ref:`bufferobjects` and can export a C-:term:" -"`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " -"and :class:`array.array` objects, as well as many common :class:`memoryview` " -"objects. Bytes-like objects can be used for various operations that work " -"with binary data; these include compression, saving to a binary file, and " -"sending over a socket." +"An object that supports the :ref:`bufferobjects` and can export a " +"C-:term:`contiguous` buffer. This includes " +"all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as " +"well as many common :class:`memoryview` objects. Bytes-like objects can be " +"used for various operations that work with binary data; these include " +"compression, saving to a binary file, and sending over a socket." msgstr "" ":ref:`bufferobjects` をサポートしていて、 C 言語の意味で :term:`連続した " "` バッファーを提供可能なオブジェクト。\n" -":class:`bytes`, :class:`bytearray`, :class:`array.array` や、多くの一般的な :" -"class:`memoryview` オブジェクトがこれに当たります。\n" +":class:`bytes`, :class:`bytearray`, :class:`array.array` や、多くの一般的" +"な :class:`memoryview` オブジェクトがこれに当たります。\n" "bytes-like オブジェクトは、データ圧縮、バイナリファイルへの保存、ソケットを経" "由した送信など、バイナリデータを要求するいろいろな操作に利用することができま" "す。" -#: ../../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 " -"buffer objects include :class:`bytearray` and a :class:`memoryview` of a :" -"class:`bytearray`. Other operations require the binary data to be stored in " -"immutable objects (\"read-only bytes-like objects\"); examples of these " +"buffer objects include :class:`bytearray` and a :class:`memoryview` of " +"a :class:`bytearray`. Other operations require the binary data to be stored " +"in 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" @@ -528,8 +560,8 @@ msgstr "" #: ../../glossary.rst:230 msgid "" -"A list of bytecode instructions can be found in the documentation for :ref:" -"`the dis module `." +"A list of bytecode instructions can be found in the documentation " +"for :ref:`the dis module `." msgstr "" "バイトコードの命令一覧は :ref:`dis モジュール ` にあります。" @@ -537,22 +569,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,33 +617,38 @@ 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 " -"globals or builtin namespaces. May be explicitly defined with the :keyword:" -"`nonlocal` keyword to allow write access, or implicitly defined if the " -"variable is only being read." +"globals or builtin namespaces. May be explicitly defined with " +"the :keyword:`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 +660,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 +675,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" @@ -648,76 +700,89 @@ msgstr "" "して表されます。虚数は虚数単位 (``-1`` の平方根) に実数を掛けたもので、一般に" "数学では ``i`` と書かれ、工学では ``j`` と書かれます。Python は複素数に組み込" "みで対応し、後者の表記を取っています。虚部は末尾に ``j`` をつけて書きます。例" -"えば ``3+1j`` です。 :mod:`math` モジュールの複素数版を利用するには、 :mod:" -"`cmath` を使います。複素数の使用はかなり高度な数学の機能です。必要性を感じな" -"ければ、ほぼ間違いなく無視してしまってよいでしょう。" +"えば ``3+1j`` です。 :mod:`math` モジュールの複素数版を利用するに" +"は、 :mod:`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`." +"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`." +"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 +792,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" @@ -759,15 +825,15 @@ msgstr "coroutine function" #: ../../glossary.rst:338 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " -"may be defined with the :keyword:`async def` statement, and may contain :" -"keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. " -"These were introduced by :pep:`492`." +"may be defined with the :keyword:`async def` statement, and may " +"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` " +"keywords. These were introduced by :pep:`492`." msgstr "" "(コルーチン関数)\n" ":term:`coroutine` オブジェクトを返す関数です。\n" -"コルーチン関数は :keyword:`async def` 文で実装され、:keyword:`await`、:" -"keyword:`async for`、 および :keyword:`async with` キーワードを持つことが出来" -"ます。\n" +"コルーチン関数は :keyword:`async def` 文で実装さ" +"れ、:keyword:`await`、:keyword:`async for`、 および :keyword:`async with` " +"キーワードを持つことが出来ます。\n" "これらは :pep:`492` で導入されました。" #: ../../glossary.rst:343 @@ -785,25 +851,30 @@ 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 " "values of :term:`context variables `. Each thread has its " -"own current context. Frameworks for executing asynchronous tasks (see :mod:" -"`asyncio`) associate each task with a context which becomes the current " -"context whenever the task starts or resumes execution." -msgstr "" +"own current context. Frameworks for executing asynchronous tasks " +"(see :mod:`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 +882,10 @@ msgid "" "these groups and break the reference cycles so that the memory can be " "reclaimed." msgstr "" +"(孤立した循環参照群) 循環参照によって互いを参照している一つ以上のオブジェクト" +"からなる集まりで、外部のオブジェクトから参照されていないものです。\n" +":term:`循環ガベージコレクタ ` の目的は、こうした集まりを" +"特定し、循環参照を断ち切ってメモリを回収できるようにすることです。" #: ../../glossary.rst:363 msgid "decorator" @@ -823,8 +898,8 @@ msgid "" "decorators are :func:`classmethod` and :func:`staticmethod`." msgstr "" "(デコレータ) 別の関数を返す関数で、通常、 ``@wrapper`` 構文で関数変換として適" -"用されます。デコレータの一般的な利用例は、 :func:`classmethod` と :func:" -"`staticmethod` です。" +"用されます。デコレータの一般的な利用例は、 :func:`classmethod` " +"と :func:`staticmethod` です。" #: ../../glossary.rst:369 msgid "" @@ -834,7 +909,6 @@ msgstr "" "デコレータの文法はシンタックスシュガーです。次の2つの関数定義は意味的に同じも" "のです::" -#: ../../glossary.rst:372 msgid "" "def f(arg):\n" " ...\n" @@ -844,6 +918,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,37 +940,51 @@ 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 " -"descriptor, its special binding behavior is triggered upon attribute " -"lookup. Normally, using *a.b* to get, set or delete an attribute looks up " -"the object named *b* in the class dictionary for *a*, but if *b* is a " -"descriptor, the respective descriptor method gets called. Understanding " -"descriptors is a key to a deep understanding of Python because they are the " -"basis for many features including functions, methods, properties, class " -"methods, static methods, and reference to super classes." -msgstr "" +"Any object which defines the " +"methods :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " +"special binding behavior is triggered upon attribute lookup. Normally, " +"using *a.b* to get, set or delete an attribute looks up the object named *b* " +"in the class dictionary for *a*, but if *b* is a descriptor, the respective " +"descriptor method gets called. Understanding descriptors is a key to a deep " +"understanding of Python because they are the 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 "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." msgstr "" -"デスクリプタのメソッドに関しての詳細は、 :ref:`descriptors` や :ref:" -"`Descriptor How To Guide ` を参照してください。" +"デスクリプタのメソッドに関しての詳細は、 :ref:`descriptors` " +"や :ref:`Descriptor How To Guide ` を参照してください。" #: ../../glossary.rst:398 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,13 +1006,12 @@ 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 " -"dictionary’s entries, which means that when the dictionary changes, the view " -"reflects these changes. To force the dictionary view to become a full list " -"use ``list(dictview)``. See :ref:`dict-views`." +"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 dictionary’s entries, which means that when the dictionary " +"changes, the view reflects these changes. To force the dictionary view to " +"become a full list use ``list(dictview)``. See :ref:`dict-views`." msgstr "" "(辞書ビュー)\n" ":meth:`dict.keys`、:meth:`dict.values`、:meth:`dict.items` が返すオブジェクト" @@ -925,14 +1019,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 +1033,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" @@ -952,10 +1051,10 @@ msgid "" "called or used (\"If it looks like a duck and quacks like a duck, it must be " "a duck.\") By emphasizing interfaces rather than specific types, well-" "designed code improves its flexibility by allowing polymorphic " -"substitution. Duck-typing avoids tests using :func:`type` or :func:" -"`isinstance`. (Note, however, that duck-typing can be complemented with :" -"term:`abstract base classes `.) Instead, it typically " -"employs :func:`hasattr` tests or :term:`EAFP` programming." +"substitution. Duck-typing avoids tests using :func:`type` " +"or :func:`isinstance`. (Note, however, that duck-typing can be complemented " +"with :term:`abstract base classes `.) Instead, it " +"typically employs :func:`hasattr` tests or :term:`EAFP` programming." msgstr "" "あるオブジェクトが正しいインターフェースを持っているかを決定するのにオブジェ" "クトの型を見ないプログラミングスタイルです。代わりに、単純にオブジェクトのメ" @@ -971,7 +1070,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 +1078,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 +1147,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 +1155,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 "" @@ -1069,9 +1173,9 @@ msgid "" msgstr "" "ファイルオブジェクトには実際には 3 種類あります: 生の :term:`バイナリーファイ" "ル `、バッファされた :term:`バイナリーファイル `、" -"そして :term:`テキストファイル` です。インターフェイスは :mod:" -"`io` モジュールで定義されています。ファイルオブジェクトを作る標準的な方法は :" -"func:`open` 関数を使うことです。" +"そして :term:`テキストファイル` です。インターフェイス" +"は :mod:`io` モジュールで定義されています。ファイルオブジェクトを作る標準的な" +"方法は :func:`open` 関数を使うことです。" #: ../../glossary.rst:483 msgid "file-like object" @@ -1081,45 +1185,52 @@ 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." +"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 "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.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 +1245,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 +1279,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 " +"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 +1305,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" @@ -1200,8 +1320,8 @@ msgstr "関数" msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " -"execution of the body. See also :term:`parameter`, :term:`method`, and the :" -"ref:`function` section." +"execution of the body. See also :term:`parameter`, :term:`method`, and " +"the :ref:`function` section." msgstr "" "(関数) 呼び出し側に値を返す一連の文のことです。関数には0以上の :term:`実引数 " "` を渡すことが出来ます。実体の実行時に引数を使用することが出来ま" @@ -1217,21 +1337,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`." @@ -1255,8 +1375,8 @@ msgstr "__future__" msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " -"that will become standard in a future release of Python. The :mod:" -"`__future__` module documents the possible values of *feature*. By " +"that will become standard in a future release of Python. " +"The :mod:`__future__` module documents the possible values of *feature*. By " "importing this module and evaluating its variables, you can see when a new " "feature was first added to the language and when it will (or did) become the " "default::" @@ -1268,12 +1388,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 +1462,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" @@ -1369,28 +1496,34 @@ msgstr "" #: ../../glossary.rst:616 msgid "" -"See also the :term:`single dispatch` glossary entry, the :func:`functools." -"singledispatch` decorator, and :pep:`443`." +"See also the :term:`single dispatch` glossary entry, " +"the :func:`functools.singledispatch` decorator, and :pep:`443`." msgstr "" -":term:`single dispatch`、:func:`functools.singledispatch` デコレータ、:pep:" -"`443` を参照してください。" +":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 `." +"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." +"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 +1537,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 +1546,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 +1566,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 +1574,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`." +"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 +1611,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 +1668,29 @@ msgstr "" msgid "immortal" msgstr "永続オブジェクト (immortal)" -#: ../../glossary.rst:686 msgid "" -"*Immortal objects* are a CPython implementation detail introduced in :pep:" -"`683`." +"*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." +"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" @@ -1568,10 +1721,10 @@ msgid "" "list of locations usually comes from :data:`sys.path`, but for subpackages " "it may also come from the parent package's ``__path__`` attribute." msgstr "" -":term:`path based finder` が import するモジュールを検索する場所 (または :" -"term:`path entry`) のリスト。 import 中、このリストは通常 :data:`sys.path` か" -"ら来ますが、サブパッケージの場合は親パッケージの ``__path__`` 属性からも来ま" -"す。" +":term:`path based finder` が import するモジュールを検索する場所 (また" +"は :term:`path entry`) のリスト。 import 中、このリストは通" +"常 :data:`sys.path` から来ますが、サブパッケージの場合は親パッケージの " +"``__path__`` 属性からも来ます。" #: ../../glossary.rst:709 msgid "importing" @@ -1591,8 +1744,8 @@ msgstr "importer" #: ../../glossary.rst:715 msgid "" -"An object that both finds and loads a module; both a :term:`finder` and :" -"term:`loader` object." +"An object that both finds and loads a module; both a :term:`finder` " +"and :term:`loader` object." msgstr "" "モジュールを探してロードするオブジェクト。 :term:`finder` と :term:`loader` " "のどちらでもあるオブジェクト。" @@ -1601,7 +1754,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 +1762,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,27 +1794,25 @@ 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 " -"critical internal structures. It also makes several calls to the :term:" -"`garbage collector `. This can trigger the execution of " -"code in user-defined destructors or weakref callbacks. Code executed during " -"the shutdown phase can encounter various exceptions as the resources it " -"relies on may not function anymore (common examples are library modules or " -"the warnings machinery)." -msgstr "" -"Python インタープリターはシャットダウンを要請された時に、モジュールやすべての" -"クリティカルな内部構造をなどの、すべての確保したリソースを段階的に開放する、" -"特別なフェーズに入ります。\n" -"このフェーズは :term:`ガベージコレクタ ` を複数回呼び出し" -"ます。\n" -"これによりユーザー定義のデストラクターや weakref コールバックが呼び出されるこ" -"とがあります。\n" -"シャットダウンフェーズ中に実行されるコードは、それが依存するリソースがすでに" -"機能しない(よくある例はライブラリーモジュールや warning 機構です) ために様々" -"な例外に直面します。" +"critical internal structures. It also makes several calls to " +"the :term:`garbage collector `. This can trigger the " +"execution of code in user-defined destructors or weakref callbacks. Code " +"executed during the shutdown phase can encounter various exceptions as the " +"resources it relies on may not function anymore (common examples are library " +"modules or the warnings machinery)." +msgstr "" +"Python インタープリタは、シャットダウンを要求されると、モジュールや各種の重要" +"な内部構造など、割り当てられたすべてのリソースを段階的に解放する特別な段階に" +"入ります。\n" +"また、:term:`ガベージコレクタ ` を複数回呼び出します。\n" +"これにより、ユーザー定義のデストラクタや weakref コールバックのコードが実行さ" +"れることがあります。\n" +"シャットダウン段階で実行されるコードでは、依存するリソースがすでに機能しなく" +"なっている場合があるため(よくある例はライブラリモジュールや warnings の仕組" +"みです)、さまざまな例外が発生することがあります。" #: ../../glossary.rst:746 msgid "" @@ -1669,28 +1826,47 @@ 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`, " -"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" -"`file objects `, and objects of any classes you define with an :" -"meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method " -"that implements :term:`sequence` semantics." +"and :class:`tuple`) and some non-sequence types " +"like :class:`dict`, :term:`file objects `, and objects of any " +"classes you define with an :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 " -"iterable object is passed as an argument to the built-in function :func:" -"`iter`, it returns an iterator for the object. This iterator is good for " -"one pass over the set of values. When using iterables, it is usually not " -"necessary to call :func:`iter` or deal with iterator objects yourself. The :" -"keyword:`for` statement does that automatically for you, creating a " -"temporary unnamed variable to hold the iterator for the duration of the " -"loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." -msgstr "" +"iterable object is passed as an argument to the built-in " +"function :func:`iter`, it returns an iterator for the object. This iterator " +"is good for one pass over the set of values. When using iterables, it is " +"usually not necessary to call :func:`iter` or deal with iterator objects " +"yourself. The :keyword:`for` statement does that automatically for you, " +"creating a 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" @@ -1698,34 +1874,35 @@ msgstr "iterator" #: ../../glossary.rst:770 msgid "" -"An object representing a stream of data. Repeated calls to the iterator's :" -"meth:`~iterator.__next__` method (or passing it to the built-in function :" -"func:`next`) return successive items in the stream. When no more data are " -"available a :exc:`StopIteration` exception is raised instead. At this " -"point, the iterator object is exhausted and any further calls to its :meth:`!" -"__next__` method just raise :exc:`StopIteration` again. Iterators are " -"required to have an :meth:`~iterator.__iter__` method that returns the " -"iterator object itself so every iterator is also iterable and may be used in " -"most places where other iterables are accepted. One notable exception is " -"code which attempts multiple iteration passes. A container object (such as " -"a :class:`list`) produces a fresh new iterator each time you pass it to the :" -"func:`iter` function or use it in a :keyword:`for` loop. Attempting this " -"with an iterator will just return the same exhausted iterator object used in " -"the previous iteration pass, making it appear like an empty container." -msgstr "" -"データの流れを表現するオブジェクトです。イテレータの :meth:`~iterator." -"__next__` メソッドを繰り返し呼び出す (または組み込み関数 :func:`next` に渡" -"す) と、流れの中の要素を一つずつ返します。データがなくなると、代わりに :exc:" -"`StopIteration` 例外を送出します。その時点で、イテレータオブジェクトは尽きて" -"おり、それ以降は :meth:`!__next__` を何度呼んでも :exc:`StopIteration` を送出" -"します。イテレータは、そのイテレータオブジェクト自体を返す :meth:`~iterator." -"__iter__` メソッドを実装しなければならないので、イテレータは他の iterable を" -"受理するほとんどの場所で利用できます。はっきりとした例外は複数の反復を行うよ" -"うなコードです。 (:class:`list` のような) コンテナオブジェクトは、自身を :" -"func:`iter` 関数にオブジェクトに渡したり :keyword:`for` ループ内で使うたび" -"に、新たな未使用のイテレータを生成します。これをイテレータで行おうとすると、" -"前回のイテレーションで使用済みの同じイテレータオブジェクトを単純に返すため、" -"空のコンテナのようになってしまします。" +"An object representing a stream of data. Repeated calls to the " +"iterator's :meth:`~iterator.__next__` method (or passing it to the built-in " +"function :func:`next`) return successive items in the stream. When no more " +"data are available a :exc:`StopIteration` exception is raised instead. At " +"this point, the iterator object is exhausted and any further calls to " +"its :meth:`!__next__` method just raise :exc:`StopIteration` again. " +"Iterators are required to have an :meth:`~iterator.__iter__` method that " +"returns the iterator object itself so every iterator is also iterable and " +"may be used in most places where other iterables are accepted. One notable " +"exception is code which attempts multiple iteration passes. A container " +"object (such as a :class:`list`) produces a fresh new iterator each time you " +"pass it to the :func:`iter` function or use it in a :keyword:`for` loop. " +"Attempting this with an iterator will just return the same exhausted " +"iterator object used in the previous iteration pass, making it appear like " +"an empty container." +msgstr "" +"データの流れを表現するオブジェクトです。イテレータ" +"の :meth:`~iterator.__next__` メソッドを繰り返し呼び出す (または組み込み関" +"数 :func:`next` に渡す) と、流れの中の要素を一つずつ返します。データがなくな" +"ると、代わりに :exc:`StopIteration` 例外を送出します。その時点で、イテレータ" +"オブジェクトは尽きており、それ以降は :meth:`!__next__` を何度呼んで" +"も :exc:`StopIteration` を送出します。イテレータは、そのイテレータオブジェク" +"ト自体を返す :meth:`~iterator.__iter__` メソッドを実装しなければならないの" +"で、イテレータは他の iterable を受理するほとんどの場所で利用できます。はっき" +"りとした例外は複数の反復を行うようなコードです。 (:class:`list` のような) コ" +"ンテナオブジェクトは、自身を :func:`iter` 関数にオブジェクトに渡した" +"り :keyword:`for` ループ内で使うたびに、新たな未使用のイテレータを生成しま" +"す。これをイテレータで行おうとすると、前回のイテレーションで使用済みの同じイ" +"テレータオブジェクトを単純に返すため、空のコンテナのようになってしまします。" #: ../../glossary.rst:785 msgid "More information can be found in :ref:`typeiter`." @@ -1733,9 +1910,10 @@ msgstr "詳細な情報は :ref:`typeiter` にあります。" #: ../../glossary.rst:789 msgid "" -"CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`. And also please note that the free-threading " -"CPython does not guarantee the thread-safety of iterator operations." +"CPython does not consistently apply the requirement that an iterator " +"define :meth:`~iterator.__iter__`. And also please note that the free-" +"threading CPython does not guarantee the thread-safety of iterator " +"operations." msgstr "" #: ../../glossary.rst:794 @@ -1755,33 +1933,34 @@ msgstr "" #: ../../glossary.rst:801 msgid "" "A number of tools in Python accept key functions to control how elements are " -"ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" -"meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq." -"nlargest`, and :func:`itertools.groupby`." +"ordered or grouped. They " +"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " +"and :func:`itertools.groupby`." msgstr "" "Python の多くのツールはキー関数を受け取り要素の並び順やグループ化を管理しま" "す。\n" -":func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq." -"merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, :func:`itertools." -"groupby` 等があります。" +":func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, :func:`itertools.groupby` " +"等があります。" #: ../../glossary.rst:807 msgid "" -"There are several ways to create a key function. For example. the :meth:" -"`str.lower` method can serve as a key function for case insensitive sorts. " -"Alternatively, a key function can be built from a :keyword:`lambda` " -"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." -"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " -"are three key function constructors. See the :ref:`Sorting HOW TO " -"` for examples of how to create and use key functions." +"There are several ways to create a key function. For example. " +"the :meth:`str.lower` method can serve as a key function for case " +"insensitive sorts. Alternatively, a key function can be built from " +"a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " +"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, " +"and :func:`operator.methodcaller` are three key function constructors. See " +"the :ref:`Sorting HOW TO ` for examples of how to create and " +"use key functions." msgstr "" "キー関数を作る方法はいくつかあります。\n" "例えば :meth:`str.lower` メソッドを大文字小文字を区別しないソートを行うキー関" "数として使うことが出来ます。\n" "あるいは、``lambda r: (r[0], r[2])`` のような :keyword:`lambda` 式からキー関" "数を作ることができます。\n" -"また、:func:`operator.attrgetter`, :func:`operator.itemgetter`, :func:" -"`operator.methodcaller` の 3 つのキー関数コンストラクタがあります。\n" +"ま" +"た、:func:`operator.attrgetter`, :func:`operator.itemgetter`, :func:`operator.methodcaller` " +"の 3 つのキー関数コンストラクタがあります。\n" "キー関数の作り方と使い方の例は :ref:`Sorting HOW TO ` を参照し" "てください。" @@ -1803,8 +1982,8 @@ msgid "" "is evaluated when the function is called. The syntax to create a lambda " "function is ``lambda [parameters]: expression``" msgstr "" -"(ラムダ) 無名のインライン関数で、関数が呼び出されたときに評価される 1 つの :" -"term:`式 ` を含みます。ラムダ関数を作る構文は ``lambda " +"(ラムダ) 無名のインライン関数で、関数が呼び出されたときに評価される 1 つ" +"の :term:`式 ` を含みます。ラムダ関数を作る構文は ``lambda " "[parameters]: expression`` です。" #: ../../glossary.rst:822 @@ -1837,13 +2016,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 +2051,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:" +"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 +2084,32 @@ 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) `." +"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" @@ -1941,17 +2126,18 @@ msgstr "mapping" #: ../../glossary.rst:881 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`collections.abc.Mapping` or :class:" -"`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:" -"`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" -"`collections.Counter`." -msgstr "" -"(マッピング) 任意のキー探索をサポートしていて、 :class:`collections.abc." -"Mapping` か :class:`collections.abc.MutableMapping` の :ref:`抽象基底クラス " +"methods specified in the :class:`collections.abc.Mapping` " +"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes " +"`. Examples " +"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` " +"and :class:`collections.Counter`." +msgstr "" +"(マッピング) 任意のキー探索をサポートしてい" +"て、 :class:`collections.abc.Mapping` " +"か :class:`collections.abc.MutableMapping` の :ref:`抽象基底クラス " "` で指定されたメソッドを実装しているコンテ" -"ナオブジェクトです。例えば、 :class:`dict`, :class:`collections." -"defaultdict`, :class:`collections.OrderedDict`, :class:`collections.Counter` " +"ナオブジェクトです。例え" +"ば、 :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict`, :class:`collections.Counter` " "などです。" #: ../../glossary.rst:887 @@ -1972,8 +2158,8 @@ msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" -"meta path finder が実装するメソッドについては :class:`importlib.abc." -"MetaPathFinder` を参照してください。" +"meta path finder が実装するメソッドについて" +"は :class:`importlib.abc.MetaPathFinder` を参照してください。" #: ../../glossary.rst:895 msgid "metaclass" @@ -2013,25 +2199,27 @@ msgstr "メソッド" msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " -"first :term:`argument` (which is usually called ``self``). See :term:" -"`function` and :term:`nested scope`." +"first :term:`argument` (which is usually called ``self``). " +"See :term:`function` and :term:`nested scope`." msgstr "" "(メソッド) クラス本体の中で定義された関数。そのクラスのインスタンスの属性とし" "て呼び出された場合、メソッドはインスタンスオブジェクトを第一 :term:`引数 " -"` として受け取ります (この第一引数は通常 ``self`` と呼ばれます)。 :" -"term:`関数 ` と :term:`ネストされたスコープ ` も参照" -"してください。" +"` として受け取ります (この第一引数は通常 ``self`` と呼ばれま" +"す)。 :term:`関数 ` と :term:`ネストされたスコープ ` " +"も参照してください。" #: ../../glossary.rst:914 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" @@ -2044,8 +2232,8 @@ msgid "" "into Python by the process of :term:`importing`." msgstr "" "(モジュール) Python コードの組織単位としてはたらくオブジェクトです。モジュー" -"ルは任意の Python オブジェクトを含む名前空間を持ちます。モジュールは :term:" -"`importing` の処理によって Python に読み込まれます。" +"ルは任意の Python オブジェクトを含む名前空間を持ちます。モジュール" +"は :term:`importing` の処理によって Python に読み込まれます。" #: ../../glossary.rst:925 msgid "See also :term:`package`." @@ -2063,9 +2251,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" @@ -2081,8 +2268,8 @@ msgstr "mutable" #: ../../glossary.rst:937 msgid "" -"Mutable objects can change their value but keep their :func:`id`. See also :" -"term:`immutable`." +"Mutable objects can change their value but keep their :func:`id`. See " +"also :term:`immutable`." msgstr "" "(ミュータブル) ミュータブルなオブジェクトは、 :func:`id` を変えることなく値を" "変更できます。 :term:`イミュータブル `) も参照してください。" @@ -2103,15 +2290,14 @@ msgstr "" #: ../../glossary.rst:945 msgid "" -"Several built-in types are named tuples, including the values returned by :" -"func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." -"float_info`::" +"Several built-in types are named tuples, including the values returned " +"by :func:`time.localtime` and :func:`os.stat`. Another example " +"is :data:`sys.float_info`::" msgstr "" ":func:`time.localtime` や :func:`os.stat` の返り値を含むいくつかの組み込み型" "は名前付きタプルです。\n" "他の例は :data:`sys.float_info` です::" -#: ../../glossary.rst:949 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2120,17 +2306,31 @@ 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 " "that inherits from :class:`tuple` and that defines named fields. Such a " -"class can be written by hand, or it can be created by inheriting :class:" -"`typing.NamedTuple`, or with the factory function :func:`collections." -"namedtuple`. The latter techniques also add some extra methods that may not " -"be found in hand-written or built-in named tuples." -msgstr "" +"class can be written by hand, or it can be created by " +"inheriting :class:`typing.NamedTuple`, or with the factory " +"function :func:`collections.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" @@ -2141,45 +2341,54 @@ msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " "as nested namespaces in objects (in methods). Namespaces support modularity " -"by preventing naming conflicts. For instance, the functions :func:`builtins." -"open <.open>` and :func:`os.open` are distinguished by their namespaces. " -"Namespaces also aid readability and maintainability by making it clear which " -"module implements a function. For instance, writing :func:`random.seed` or :" -"func:`itertools.islice` makes it clear that those functions are implemented " -"by the :mod:`random` and :mod:`itertools` modules, respectively." +"by preventing naming conflicts. For instance, the " +"functions :func:`builtins.open <.open>` and :func:`os.open` are " +"distinguished by their namespaces. Namespaces also aid readability and " +"maintainability by making it clear which module implements a function. For " +"instance, writing :func:`random.seed` or :func:`itertools.islice` makes it " +"clear that those functions are implemented by the :mod:`random` " +"and :mod:`itertools` modules, respectively." msgstr "" "(名前空間) 変数が格納される場所です。名前空間は辞書として実装されます。名前空" "間にはオブジェクトの (メソッドの) 入れ子になったものだけでなく、局所的なも" "の、大域的なもの、そして組み込みのものがあります。名前空間は名前の衝突を防ぐ" -"ことによってモジュール性をサポートする。例えば関数 :func:`builtins.open <." -"open>` と :func:`os.open` は名前空間で区別されています。また、どのモジュール" -"が関数を実装しているか明示することによって名前空間は可読性と保守性を支援しま" -"す。例えば、:func:`random.seed` や :func:`itertools.islice` と書くと、それぞ" -"れモジュール :mod:`random` や :mod:`itertools` で実装されていることが明らかで" -"す。" +"ことによってモジュール性をサポートする。例えば関数 :func:`builtins.open " +"<.open>` と :func:`os.open` は名前空間で区別されています。また、どのモジュー" +"ルが関数を実装しているか明示することによって名前空間は可読性と保守性を支援し" +"ます。例えば、:func:`random.seed` や :func:`itertools.islice` と書くと、それ" +"ぞれモジュール :mod:`random` や :mod:`itertools` で実装されていることが明らか" +"です。" #: ../../glossary.rst:976 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 +2418,18 @@ 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." +"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 +2444,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 +2456,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 +2493,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 +2509,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 +2538,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 +2553,8 @@ msgstr "" "個数の位置引数が与えられることを指定します。このような仮引数は、以下の " "*args* のように仮引数名の前に ``*`` をつけることで定義できます::" -#: ../../glossary.rst:1064 msgid "def func(*args, **kwargs): ..." -msgstr "" +msgstr "def func(*args, **kwargs): ..." #: ../../glossary.rst:1066 msgid "" @@ -2361,16 +2576,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`." +"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" @@ -2390,9 +2604,9 @@ msgstr "path entry finder" #: ../../glossary.rst:1085 msgid "" -"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" -"term:`path entry hook`) which knows how to locate modules given a :term:" -"`path entry`." +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " +"a :term:`path entry hook`) which knows how to locate modules given " +"a :term:`path entry`." msgstr "" ":data:`sys.path_hooks` にある callable (つまり :term:`path entry hook`) が返" "した :term:`finder` です。与えられた :term:`path entry` にあるモジュールを見" @@ -2403,31 +2617,32 @@ msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." msgstr "" -"パスエントリーファインダが実装するメソッドについては :class:`importlib.abc." -"PathEntryFinder` を参照してください。" +"パスエントリーファインダが実装するメソッドについて" +"は :class:`importlib.abc.PathEntryFinder` を参照してください。" #: ../../glossary.rst:1091 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" @@ -2435,23 +2650,24 @@ msgstr "path-like object" #: ../../glossary.rst:1102 msgid "" -"An object representing a file system path. A path-like object is either a :" -"class:`str` or :class:`bytes` object representing a path, or an object " -"implementing the :class:`os.PathLike` protocol. An object that supports the :" -"class:`os.PathLike` protocol can be converted to a :class:`str` or :class:" -"`bytes` file system path by calling the :func:`os.fspath` function; :func:" -"`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:" -"`str` or :class:`bytes` result instead, respectively. Introduced by :pep:" -"`519`." +"An object representing a file system path. A path-like object is either " +"a :class:`str` or :class:`bytes` object representing a path, or an object " +"implementing the :class:`os.PathLike` protocol. An object that supports " +"the :class:`os.PathLike` protocol can be converted to a :class:`str` " +"or :class:`bytes` file system path by calling the :func:`os.fspath` " +"function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to " +"guarantee a :class:`str` or :class:`bytes` result instead, respectively. " +"Introduced by :pep:`519`." msgstr "" "(path-like オブジェクト) ファイルシステムパスを表します。\n" -"path-like オブジェクトは、パスを表す :class:`str` オブジェクトや :class:" -"`bytes` オブジェクト、または :class:`os.PathLike` プロトコルを実装したオブ" -"ジェクトのどれかです。\n" -":class:`os.PathLike` プロトコルをサポートしているオブジェクトは :func:`os." -"fspath` を呼び出すことで :class:`str` または :class:`bytes` のファイルシステ" -"ムパスに変換できます。 :func:`os.fsdecode` と :func:`os.fsencode` はそれぞ" -"れ :class:`str` あるいは :class:`bytes` になるのを保証するのに使えます。\n" +"path-like オブジェクトは、パスを表す :class:`str` オブジェクト" +"や :class:`bytes` オブジェクト、または :class:`os.PathLike` プロトコルを実装" +"したオブジェクトのどれかです。\n" +":class:`os.PathLike` プロトコルをサポートしているオブジェクト" +"は :func:`os.fspath` を呼び出すことで :class:`str` または :class:`bytes` の" +"ファイルシステムパスに変換できます。 :func:`os.fsdecode` " +"と :func:`os.fsencode` はそれぞれ :class:`str` あるいは :class:`bytes` になる" +"のを保証するのに使えます。\n" ":pep:`519` で導入されました。" #: ../../glossary.rst:1110 @@ -2470,7 +2686,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 +2693,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 +2740,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 "" @@ -2578,26 +2794,28 @@ msgid "" "Python sometimes use a numerical counter instead::" msgstr "" "他の言語で一般的な考え方で書かれたコードではなく、Python の特に一般的なイディ" -"オムに従った考え方やコード片。例えば、Python の一般的なイディオムでは :" -"keyword:`for` 文を使ってイテラブルのすべての要素に渡ってループします。他の多" -"くの言語にはこの仕組みはないので、Python に慣れていない人は代わりに数値のカウ" -"ンターを使うかもしれません::" +"オムに従った考え方やコード片。例えば、Python の一般的なイディオムで" +"は :keyword:`for` 文を使ってイテラブルのすべての要素に渡ってループします。他" +"の多くの言語にはこの仕組みはないので、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 +2833,6 @@ msgstr "" "されています。トップレベルの関数やクラスでは、修飾名はオブジェクトの名前と同" "じです::" -#: ../../glossary.rst:1181 msgid "" ">>> class C:\n" "... class D:\n" @@ -2629,23 +2846,36 @@ 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 "" "When used to refer to modules, the *fully qualified name* means the entire " -"dotted path to the module, including any parent packages, e.g. ``email.mime." -"text``::" +"dotted path to the module, including any parent packages, e.g. " +"``email.mime.text``::" msgstr "" "モジュールへの参照で使われると、*完全修飾名 (fully qualified name)* はすべて" "の親パッケージを含む全体のドット名表記、例えば ``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" @@ -2674,11 +2904,11 @@ msgstr "regular package" #: ../../glossary.rst:1212 msgid "" -"A traditional :term:`package`, such as a directory containing an ``__init__." -"py`` file." +"A traditional :term:`package`, such as a directory containing an " +"``__init__.py`` file." msgstr "" -"伝統的な、 ``__init__.py`` ファイルを含むディレクトリとしての :term:" -"`package`。" +"伝統的な、 ``__init__.py`` ファイルを含むディレクトリとして" +"の :term:`package`。" #: ../../glossary.rst:1215 msgid "See also :term:`namespace package`." @@ -2690,8 +2920,8 @@ msgstr "REPL" #: ../../glossary.rst:1218 msgid "" -"An acronym for the \"read–eval–print loop\", another name for the :term:" -"`interactive` interpreter shell." +"An acronym for the \"read–eval–print loop\", another name for " +"the :term:`interactive` interpreter shell." msgstr "" "\"read–eval–print loop\" の頭字語で、 :term:`対話型 ` インタープ" "リターシェルの別名。" @@ -2718,55 +2948,63 @@ 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 :" -"meth:`~object.__len__` method that returns the length of the sequence. Some " -"built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " -"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." -"__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`hashable` keys rather than " -"integers." -msgstr "" +"indices via the :meth:`~object.__getitem__` special method and defines " +"a :meth:`~object.__len__` method that returns the length of the sequence. " +"Some built-in sequence types " +"are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note " +"that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!" +"__len__`, but is considered a mapping rather than a 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 "" "The :class:`collections.abc.Sequence` abstract base class defines a much " -"richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" -"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." -"__contains__`, and :meth:`~object.__reversed__`. Types that implement this " -"expanded interface can be registered explicitly using :func:`~abc.ABCMeta." -"register`. For more documentation on sequence methods generally, see :ref:" -"`Common Sequence Operations `." +"richer interface that goes beyond just :meth:`~object.__getitem__` " +"and :meth:`~object.__len__`, adding :meth:`!count`, :meth:`!" +"index`, :meth:`~object.__contains__`, and :meth:`~object.__reversed__`. " +"Types that implement this expanded interface can be registered explicitly " +"using :func:`~abc.ABCMeta.register`. For more documentation on sequence " +"methods generally, see :ref:`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`." +"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" @@ -2781,31 +3019,35 @@ msgid "" msgstr "" "(スライス) 一般に :term:`シーケンス ` の一部を含むオブジェクト。ス" "ライスは、添字表記 ``[]`` で与えられた複数の数の間にコロンを書くことで作られ" -"ます。例えば、 ``variable_name[1:3:5]`` です。角括弧 (添字) 記号は :class:" -"`slice` オブジェクトを内部で利用しています。" +"ます。例えば、 ``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" @@ -2815,8 +3057,8 @@ msgstr "special method" msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " -"with double underscores. Special methods are documented in :ref:" -"`specialnames`." +"with double underscores. Special methods are documented " +"in :ref:`specialnames`." msgstr "" "(特殊メソッド) ある型に特定の操作、例えば加算をするために Python から暗黙に呼" "び出されるメソッド。この種類のメソッドは、メソッド名の最初と最後にアンダース" @@ -2830,126 +3072,144 @@ msgstr "statement" #: ../../glossary.rst:1284 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " -"an :term:`expression` or one of several constructs with a keyword, such as :" -"keyword:`if`, :keyword:`while` or :keyword:`for`." +"an :term:`expression` or one of several constructs with a keyword, such " +"as :keyword:`if`, :keyword:`while` or :keyword:`for`." msgstr "" "(文) 文はスイート (コードの\"ブロック\") に不可欠な要素です。文は :term:`式 " -"` かキーワードから構成されるもののどちらかです。後者には :" -"keyword:`if`、:keyword:`while`、:keyword:`for` があります。" +"` かキーワードから構成されるもののどちらかです。後者に" +"は :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." +"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." +"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:" -"`text encoding` automatically. Examples of text files are files opened in " -"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'``) で開いたファ" -"イルです。" +"text file actually accesses a byte-oriented datastream and handles " +"the :term:`text encoding` automatically. Examples of text files are files " +"opened in text mode (``'r'`` or " +"``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " +"of :class:`io.StringIO`." +msgstr "" +"(テキストファイル) :class:`str` オブジェクトを読み書きできる :term:`ファイル" +"オブジェクト ` です。\n" +"テキストファイルは、多くの場合、実際にはバイト指向のデータストリームにアクセ" +"スし、:term:`テキストエンコーディング ` を自動的に処理しま" +"す。\n" +"例として、テキストモード(``'r'`` または ``'w'``)で開いたファイ" +"ル、:data:`sys.stdin`、:data:`sys.stdout`、:class:`io.StringIO` のインスタン" +"スがあります。" #: ../../glossary.rst:1327 msgid "" -"See also :term:`binary file` for a file object able to read and write :term:" -"`bytes-like objects `." +"See also :term:`binary file` for a file object able to read and " +"write :term:`bytes-like objects `." msgstr "" ":term:`bytes-like オブジェクト ` を読み書きできるファイル" "オブジェクトについては、 :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 +3217,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." +"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 +3264,29 @@ 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)``." +"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 +3304,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,20 +3344,22 @@ 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 "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "" -"グローバル変数、クラス属性、関数で、ローカル変数でないものの型ヒントは :func:" -"`typing.get_type_hints` で取得できます。" +"グローバル変数、クラス属性、関数で、ローカル変数でないものの型ヒント" +"は :func:`typing.get_type_hints` で取得できます。" #: ../../glossary.rst:1411 msgid "universal newlines" @@ -3087,13 +3370,13 @@ msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " "Windows convention ``'\\r\\n'``, and the old Macintosh convention " -"``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes." -"splitlines` for an additional use." +"``'\\r'``. See :pep:`278` and :pep:`3116`, as well " +"as :func:`bytes.splitlines` for an additional use." msgstr "" "テキストストリームの解釈法の一つで、以下のすべてを行末と認識します: Unix の行" "末規定 ``'\\n'``、Windows の規定 ``'\\r\\n'``、古い Macintosh の規定 " -"``'\\r'``。利用法について詳しくは、 :pep:`278` と :pep:`3116` 、さらに :func:" -"`bytes.splitlines` も参照してください。" +"``'\\r'``。利用法について詳しくは、 :pep:`278` と :pep:`3116` 、さら" +"に :func:`bytes.splitlines` も参照してください。" #: ../../glossary.rst:1418 msgid "variable annotation" @@ -3108,11 +3391,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 +3406,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`." @@ -3138,8 +3421,8 @@ msgid "" "working with annotations." msgstr "" "機能の説明がある :term:`function annotation`, :pep:`484` , :pep:`526` を参照" -"してください。また、アノテーションを利用するベストプラクティスとして :ref:" -"`annotations-howto` も参照してください。" +"してください。また、アノテーションを利用するベストプラクティスとし" +"て :ref:`annotations-howto` も参照してください。" #: ../../glossary.rst:1439 msgid "virtual environment" @@ -3187,17 +3470,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..a2ff452b6 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,55 +57,83 @@ 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 "" "Note that this document is specifically about working with " "``__annotations__``, not uses *for* annotations. If you're looking for " -"information on how to use \"type hints\" in your code, please see the :mod:" -"`typing` module." +"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 " -"function is the best practice for accessing the annotations dict of any " -"object that supports annotations. This function can also \"un-stringize\" " -"stringized annotations for you." +"Python 3.10 adds a new function to the standard " +"library: :func:`inspect.get_annotations`. In Python versions 3.10 through " +"3.13, calling this function is the best practice for accessing the " +"annotations dict of any object that supports annotations. This function can " +"also \"un-stringize\" stringized annotations for you." msgstr "" +"Python 3.10 で標準ライブラリに :func:`inspect.get_annotations` が追加されまし" +"た。\n" +"Python 3.10 から 3.13 では、アノテーションに対応するオブジェクトのアノテー" +"ション辞書を取得するには、この関数を呼び出すのが推奨される方法です。\n" +"この関数では、文字列化されたアノテーションを評価して元の値に戻すこともできま" +"す。" #: ../../howto/annotations.rst:42 msgid "" "In Python 3.14, there is a new :mod:`annotationlib` module with " -"functionality for working with annotations. This includes a :func:" -"`annotationlib.get_annotations` function, which supersedes :func:`inspect." -"get_annotations`." +"functionality for working with annotations. This includes " +"a :func:`annotationlib.get_annotations` function, which " +"supersedes :func:`inspect.get_annotations`." msgstr "" +"Python 3.14 では、アノテーションを扱うためのモジュール :mod:`annotationlib` " +"が追加されました。このモジュールに :func:`annotationlib.get_annotations` があ" +"り、 :func:`inspect.get_annotations` を置き換えるものです。" #: ../../howto/annotations.rst:47 msgid "" "If for some reason :func:`inspect.get_annotations` isn't viable for your use " "case, you may access the ``__annotations__`` data member manually. Best " -"practice for this changed in Python 3.10 as well: as of Python 3.10, ``o." -"__annotations__`` is guaranteed to *always* work on Python functions, " +"practice for this changed in Python 3.10 as well: as of Python 3.10, " +"``o.__annotations__`` is guaranteed to *always* work on Python functions, " "classes, and modules. If you're certain the object you're examining is one " "of these three *specific* objects, you may simply use ``o.__annotations__`` " "to get at the object's annotations dict." msgstr "" +"もし何らかの理由で自分の用途に :func:`inspect.get_annotations` が合わないとい" +"う場合は、手動で ``__annotations__`` にアクセスすることもできます。これについ" +"ても、推奨のアクセス方法が Python 3.10 で変わりました。3.10 で、 " +"``o.__annotations__`` は関数、クラス、モジュールに対しては必ず使えることが保" +"証されるようになりました。オブジェクトが確実にこの3つのいずれかである場合" +"は、単に ``o.__annotations__`` を使えばアノテーション辞書を取得できます。" #: ../../howto/annotations.rst:57 msgid "" -"However, other types of callables--for example, callables created by :func:" -"`functools.partial`--may not have an ``__annotations__`` attribute defined. " -"When accessing the ``__annotations__`` of a possibly unknown object, best " -"practice in Python versions 3.10 and newer is to call :func:`getattr` with " -"three arguments, for example ``getattr(o, '__annotations__', None)``." +"However, other types of callables--for example, callables created " +"by :func:`functools.partial`--may not have an ``__annotations__`` attribute " +"defined. When accessing the ``__annotations__`` of a possibly unknown " +"object, best practice in Python versions 3.10 and newer is to " +"call :func:`getattr` with three arguments, for example ``getattr(o, " +"'__annotations__', None)``." msgstr "" +"しかし、それ以外の callable (例えば、 :func:`functools.partial` で作られたも" +"の) は ``__annotations__`` 属性が定義されていない可能性があります。この属性が" +"あるかどうか不明なオブジェクトの場合は、Python 3.10 以降で" +"は、 :func:`getattr` に3つの引数を渡して呼び出す (例えば ``getattr(o, " +"'__annotations__', None)`` ) のを推奨します。" #: ../../howto/annotations.rst:65 msgid "" @@ -111,10 +142,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 +157,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 +169,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 +182,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 +198,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 +221,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 +234,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,24 +244,34 @@ 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 "" "After running this code, ``ann`` should be either a dictionary or ``None``. " -"You're encouraged to double-check the type of ``ann`` using :func:" -"`isinstance` before further examination." +"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 "" -"Note that some exotic or malformed type objects may not have a :attr:`~type." -"__dict__` attribute, so for extra safety you may also wish to use :func:" -"`getattr` to access :attr:`!__dict__`." +"Note that some exotic or malformed type objects may not have " +"a :attr:`~type.__dict__` attribute, so for extra safety you may also wish to " +"use :func:`getattr` to access :attr:`!__dict__`." msgstr "" +"ただし、一部の特殊な型オブジェクトや不正な形式の型オブジェクト" +"は :attr:`~type.__dict__` 属性がないこともあるため、さらに安全をとるに" +"は :func:`getattr` を使って :attr:`!__dict__` を取得したほうがいいです。" #: ../../howto/annotations.rst:134 msgid "Manually Un-Stringizing Stringized Annotations" -msgstr "" +msgstr "文字列指定のアノテーションを手動で解決する方法" #: ../../howto/annotations.rst:136 msgid "" @@ -207,47 +280,65 @@ 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 "" -"If you're using Python 3.9 or older, or if for some reason you can't use :" -"func:`inspect.get_annotations`, you'll need to duplicate its logic. You're " -"encouraged to examine the implementation of :func:`inspect.get_annotations` " -"in the current Python version and follow a similar approach." +"If you're using Python 3.9 or older, or if for some reason you can't " +"use :func:`inspect.get_annotations`, you'll need to duplicate its logic. " +"You're encouraged to examine the implementation " +"of :func:`inspect.get_annotations` in the current Python version and follow " +"a similar approach." msgstr "" +"Python 3.9 以前を使っているか、もしくは何らかの理由" +"で :func:`inspect.get_annotations` を使えない場合は、自分で実装する必要があり" +"ます。現状の Python バージョンの :func:`inspect.get_annotations` の実装を確認" +"して、同様の処理を実装することを推奨します。" #: ../../howto/annotations.rst: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`." +"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 "" "If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the " -"``globals``, and ``dict(vars(o))`` as the ``locals``, when calling :func:" -"`eval`." +"``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 "" -"If ``o`` is a wrapped callable using :func:`functools.update_wrapper`, :func:" -"`functools.wraps`, or :func:`functools.partial`, iteratively unwrap it by " -"accessing either ``o.__wrapped__`` or ``o.func`` as appropriate, until you " -"have found the root unwrapped function." +"If ``o`` is a wrapped callable " +"using :func:`functools.update_wrapper`, :func:`functools.wraps`, " +"or :func:`functools.partial`, iteratively unwrap it by accessing either " +"``o.__wrapped__`` or ``o.func`` as appropriate, until you have found the " +"root unwrapped function." msgstr "" +"``o`` が :func:`functools.update_wrapper` か :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`." +"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 +348,24 @@ 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` の Union型 (これが追加された Python 3.10 より前の" +"バージョン)" #: ../../howto/annotations.rst:173 msgid "" -"Definitions that aren't needed at runtime, only imported when :const:`typing." -"TYPE_CHECKING` is true." +"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,29 +374,38 @@ 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 "" "You should avoid accessing ``__annotations__`` directly on any object. " -"Instead, use :func:`annotationlib.get_annotations` (Python 3.14+) or :func:" -"`inspect.get_annotations` (Python 3.10+)." +"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 +413,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 +447,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,45 +456,77 @@ 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-" -"metaclasses>` for some examples. You can avoid these quirks by using :func:" -"`annotationlib.get_annotations` on Python 3.14+ or :func:`inspect." -"get_annotations` on Python 3.10+. On earlier versions of Python, you can " -"avoid these bugs by accessing the annotations from the class's :attr:`~type." -"__dict__` (for example, ``cls.__dict__.get('__annotations__', None)``)." -msgstr "" +"metaclasses>` for some examples. You can avoid these quirks by " +"using :func:`annotationlib.get_annotations` on Python 3.14+ " +"or :func:`inspect.get_annotations` on Python 3.10+. On earlier versions of " +"Python, you can 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. " "If you need the annotations of an instance, you can use :func:`type` to " -"access its class (for example, ``annotationlib." -"get_annotations(type(myinstance))`` on Python 3.14+)." -msgstr "" +"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..44e031eaa 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:" @@ -262,21 +313,21 @@ msgid "" "accept. In this case, I've named it ``echo`` so that it's in line with its " "function." msgstr "" -"プログラムが受け付けるコマンドラインオプションを指定するメソッドである :meth:" -"`~ArgumentParser.add_argument` を追加しました。ここでは、その機能にあわせて引" -"数名を ``echo`` としました。" +"プログラムが受け付けるコマンドラインオプションを指定するメソッドであ" +"る :meth:`~ArgumentParser.add_argument` を追加しました。ここでは、その機能に" +"あわせて引数名を ``echo`` としました。" #: ../../howto/argparse.rst:151 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,18 +415,22 @@ 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 "" "That didn't go so well. That's because :mod:`argparse` treats the options we " -"give it as strings, unless we tell it otherwise. So, let's tell :mod:" -"`argparse` to treat that input as an integer::" +"give it as strings, unless we tell it otherwise. So, let's " +"tell :mod:`argparse` to treat that input as an integer::" msgstr "" "上手くいきませんでした。 何も伝えなければ、:mod:`argparse` は与えられたオプ" "ションを文字列として扱います。 :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 "" @@ -445,8 +543,8 @@ msgid "" "To show that the option is actually optional, there is no error when running " "the program without it. Note that by default, if an optional argument isn't " "used, the relevant variable, in this case ``args.verbosity``, is given " -"``None`` as a value, which is the reason it fails the truth test of the :" -"keyword:`if` statement." +"``None`` as a value, which is the reason it fails the truth test of " +"the :keyword:`if` statement." msgstr "" "オプションの指定が実際に任意であることを示すために、プログラムをオプション指" "定なしで実行してもエラーにはなっていません。オプション引数が指定されなかった" @@ -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 "" @@ -513,9 +627,9 @@ msgstr "" "オプションは値を必要とするのではなく、単なるフラグになりました。この考え方に" "沿うようにオプションの名前も変更しています。ここで新しいキーワード " "``action`` を指定し、値として ``\"store_true\"`` を設定していることに注意して" -"ください。これは、オプションが指定された場合に値として ``True`` を ``args." -"verbose`` に設定するということを意味します。オプションの指定がない場合の値は " -"``False`` となることを意味します。" +"ください。これは、オプションが指定された場合に値として ``True`` を " +"``args.verbose`` に設定するということを意味します。オプションの指定がない場合" +"の値は ``False`` となることを意味します。" #: ../../howto/argparse.rst:312 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,29 +1150,44 @@ 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 "" "We've just introduced yet another keyword, ``default``. We've set it to " "``0`` in order to make it comparable to the other int values. Remember that " "by default, if an optional argument isn't specified, it gets the ``None`` " -"value, and that cannot be compared to an int value (hence the :exc:" -"`TypeError` exception)." +"value, and that cannot be compared to an int value (hence " +"the :exc:`TypeError` exception)." msgstr "" "もう一つのキーワード引数である ``default`` を導入しました。整数値と比較できる" "ように、その値に ``0`` を設定しました。デフォルトでは、optional 引数が指定さ" -"れていない場合 ``None`` となること、``None`` が整数値と比較できない(よって :" -"exc:`TypeError` 例外となる)ことを思い出してください。" +"れていない場合 ``None`` となること、``None`` が整数値と比較できない(よっ" +"て :exc:`TypeError` 例外となる)ことを思い出してください。" #: ../../howto/argparse.rst:590 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" @@ -1034,10 +1342,10 @@ msgid "" "that everything after that is a positional argument::" msgstr "" "ある引数の解釈について、位置引数なのか、ある引数に対する追加の引数なのか、あ" -"いまいさがあるときは、 ``--`` を使うことで :meth:`~ArgumentParser." -"parse_args` に対してこれ以降は位置引数であることを伝えることができます::" +"いまいさがあるときは、 ``--`` を使うこと" +"で :meth:`~ArgumentParser.parse_args` に対してこれ以降は位置引数であることを" +"伝えることができます::" -#: ../../howto/argparse.rst:683 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-n', nargs='+')\n" @@ -1058,28 +1366,46 @@ 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:" -"`~ArgumentParser.add_mutually_exclusive_group`. It allows for us to specify " -"options that conflict with each other. Let's also change the rest of the " -"program so that the new functionality makes more sense: we'll introduce the " -"``--quiet`` option, which will be the opposite of the ``--verbose`` one::" +"So far, we have been working with two methods of " +"an :class:`argparse.ArgumentParser` instance. Let's introduce a third " +"one, :meth:`~ArgumentParser.add_mutually_exclusive_group`. It allows for us " +"to specify options that conflict with each other. Let's also change the rest " +"of the 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 +1425,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 +1464,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 +1495,6 @@ msgstr "" "結びの前に、恐らくあなたはプログラムの主な目的をユーザに伝えたいでしょう。万" "が一、彼らがそれを知らないときに備えて::" -#: ../../howto/argparse.rst:757 msgid "" "import argparse\n" "\n" @@ -1163,6 +1515,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 +1543,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 +1558,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" @@ -1220,17 +1602,16 @@ msgstr "" #: ../../howto/argparse.rst:825 msgid "" -"In order to translate these strings, they must first be extracted into a ``." -"po`` file. For example, using `Babel `__, run this " -"command:" +"In order to translate these strings, they must first be extracted into a " +"``.po`` file. For example, using `Babel `__, run " +"this command:" msgstr "" "これらの文字列を訳すには、それらをまず ``.po`` ファイルに抽出する必要がありま" "す。たとえば、 `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 +1631,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 "" @@ -1268,39 +1650,45 @@ msgstr "" #: ../../howto/argparse.rst:847 msgid "" -"To translate your own strings in the :mod:`argparse` output, use :mod:" -"`gettext`." +"To translate your own strings in the :mod:`argparse` output, " +"use :mod:`gettext`." 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 +1702,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..b452ce63f 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 @@ -32,5 +32,5 @@ msgid "" "The Argument Clinic How-TO has been moved to the `Python Developer's Guide " "`__." msgstr "" -"Argument Clinic How-TOは、 `Python Developer's Guide `__ に移動しました。" +"Argument Clinic How-TOは、 `Python Developer's Guide `__ に移動しました。" 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..a921b4294 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,14 @@ 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 +180,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 +188,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,28 +224,25 @@ 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 " "could write your application to expect such sequences and process them " -"accordingly, curses can do it for you, returning a special value such as :" -"const:`curses.KEY_LEFT`. To get curses to do the job, you'll have to enable " -"keypad mode. ::" +"accordingly, curses can do it for you, returning a special value such " +"as :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,27 +252,27 @@ 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 "" -"to reverse the curses-friendly terminal settings. Then call the :func:" -"`~curses.endwin` function to restore the terminal to its original operating " -"mode. ::" +"to reverse the curses-friendly terminal settings. Then call " +"the :func:`~curses.endwin` function to restore the terminal to its original " +"operating mode. ::" 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,21 +280,20 @@ 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 "" "In Python you can avoid these complications and make debugging much easier " "by importing the :func:`curses.wrapper` function and using it like this::" msgstr "" -"Pythonでは、これらの複雑さを避けデバッグをより容易にするために、 :func:" -"`curses.wrapper` 関数をインポートして、このように使います::" +"Pythonでは、これらの複雑さを避けデバッグをより容易にするため" +"に、 :func:`curses.wrapper` 関数をインポートして、このように使います::" -#: ../../howto/curses.rst:137 msgid "" "from curses import wrapper\n" "\n" @@ -291,49 +311,80 @@ 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 " "is present. :func:`!wrapper` then runs your provided callable. Once the " "callable returns, :func:`!wrapper` will restore the original state of the " -"terminal. The callable is called inside a :keyword:`try`...\\ :keyword:" -"`except` that catches exceptions, restores the state of the terminal, and " -"then re-raises the exception. Therefore your terminal won't be left in a " -"funny state on exception and you'll be able to read the exception's message " -"and traceback." -msgstr "" +"terminal. The callable is called inside a :keyword:`try`..." +"\\ :keyword:`except` that catches exceptions, restores the state of the " +"terminal, and then re-raises the exception. Therefore your terminal won't " +"be left in a 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 " "this single window, but you might wish to divide the screen into smaller " -"windows, in order to redraw or clear them separately. The :func:`~curses." -"newwin` function creates a new window of a given size, returning the new " -"window object. ::" +"windows, in order to redraw or clear them separately. " +"The :func:`~curses.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,34 +393,52 @@ 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)``." +"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." +"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 " "redraw the screen was very important. Instead curses accumulates changes to " -"the screen and displays them in the most efficient manner when you call :" -"meth:`!refresh`. For example, if your program displays some text in a " +"the screen and displays them in the most efficient manner when you " +"call :meth:`!refresh`. For example, if your program displays some text in a " "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 +447,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 +461,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 +482,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 +504,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 +534,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,18 +555,26 @@ 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 "" "Fortunately the Python interface hides all these details. ``stdscr`` is a " -"window object like any other, and methods such as :meth:`~curses.window." -"addstr` accept multiple argument forms. Usually there are four different " -"forms." +"window object like any other, and methods such " +"as :meth:`~curses.window.addstr` accept multiple argument forms. Usually " +"there are four different forms." msgstr "" "幸運にも、Python インターフェースはこれらの詳細を全て隠蔽してくれます。 " -"``stdscr`` は他のものと同様のウィンドウオブジェクトであり、 :meth:`~curses." -"window.addstr` のようなメソッドは複数の引数形式を許容してくれます。通常それら" -"は4つの形式です。" +"``stdscr`` は他のものと同様のウィンドウオブジェクトであ" +"り、 :meth:`~curses.window.addstr` のようなメソッドは複数の引数形式を許容して" +"くれます。通常それらは4つの形式です。" #: ../../howto/curses.rst:278 msgid "Form" @@ -537,11 +641,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 +656,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,19 +665,19 @@ 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 "" "If your application doesn't need a blinking cursor at all, you can call " "``curs_set(False)`` to make it invisible. For compatibility with older " -"curses versions, there's a ``leaveok(bool)`` function that's a synonym for :" -"func:`~curses.curs_set`. When *bool* is true, the curses library will " +"curses versions, there's a ``leaveok(bool)`` function that's a synonym " +"for :func:`~curses.curs_set`. When *bool* is true, the curses library will " "attempt to suppress the flashing cursor, and you won't need to worry about " "leaving it in odd locations." msgstr "" @@ -582,13 +686,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 +772,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 +791,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,26 +801,41 @@ 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 " -"attribute value corresponding to a color pair with the :func:`~curses." -"color_pair` function; this can be bitwise-OR'ed with other attributes such " -"as :const:`A_REVERSE`, but again, such combinations are not guaranteed to " -"work on all terminals." -msgstr "" +"attribute value corresponding to a color pair with " +"the :func:`~curses.color_pair` function; this can be bitwise-OR'ed with " +"other attributes such 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,14 +845,20 @@ 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:" -"blue, 5:magenta, 6:cyan, and 7:white. The :mod:`curses` module defines " -"named constants for each of these colors: :const:`curses.COLOR_BLACK`, :" -"const:`curses.COLOR_RED`, and so forth." -msgstr "" +"it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, " +"4:blue, 5:magenta, 6:cyan, and 7:white. The :mod:`curses` module defines " +"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 +868,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 "" @@ -762,22 +889,26 @@ msgid "" "given RGB value. This lets you change color 1, which is usually red, to " "purple or blue or any other color you like. Unfortunately, the Linux " "console doesn't support this, so I'm unable to try it out, and can't provide " -"any examples. You can check if your terminal can do this by calling :func:" -"`~curses.can_change_color`, which returns ``True`` if the capability is " -"there. If you're lucky enough to have such a talented terminal, consult " -"your system's man pages for more information." +"any examples. You can check if your terminal can do this by " +"calling :func:`~curses.can_change_color`, which returns ``True`` if the " +"capability is there. If you're lucky enough to have such a talented " +"terminal, consult your system's man pages for more information." msgstr "" #: ../../howto/curses.rst:427 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.)" +"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:" @@ -801,14 +932,15 @@ msgstr "" #: ../../howto/curses.rst:445 msgid "" -"It's possible to not wait for the user using the :meth:`~curses.window." -"nodelay` window method. After ``nodelay(True)``, :meth:`!getch` and :meth:`!" -"getkey` for the window become non-blocking. To signal that no input is " -"ready, :meth:`!getch` returns ``curses.ERR`` (a value of -1) and :meth:`!" -"getkey` raises an exception. There's also a :func:`~curses.halfdelay` " -"function, which can be used to (in effect) set a timer on each :meth:`!" -"getch`; if no input becomes available within a specified delay (measured in " -"tenths of a second), curses raises an exception." +"It's possible to not wait for the user using " +"the :meth:`~curses.window.nodelay` window method. After " +"``nodelay(True)``, :meth:`!getch` and :meth:`!getkey` for the window become " +"non-blocking. To signal that no input is ready, :meth:`!getch` returns " +"``curses.ERR`` (a value of -1) and :meth:`!getkey` raises an exception. " +"There's also a :func:`~curses.halfdelay` function, which can be used to (in " +"effect) set a timer on each :meth:`!getch`; if no input becomes available " +"within a specified delay (measured in tenths of a second), curses raises an " +"exception." msgstr "" #: ../../howto/curses.rst:455 @@ -816,9 +948,10 @@ msgid "" "The :meth:`!getch` method returns an integer; if it's between 0 and 255, it " "represents the ASCII code of the key pressed. Values greater than 255 are " "special keys such as Page Up, Home, or the cursor keys. You can compare the " -"value returned to constants such as :const:`curses.KEY_PPAGE`, :const:" -"`curses.KEY_HOME`, or :const:`curses.KEY_LEFT`. The main loop of your " -"program may look something like this::" +"value returned to constants such " +"as :const:`curses.KEY_PPAGE`, :const:`curses.KEY_HOME`, " +"or :const:`curses.KEY_LEFT`. The main loop of your program may look " +"something like this::" msgstr "" #: ../../howto/curses.rst:462 @@ -833,7 +966,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,14 +974,19 @@ 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 "" -"There's also a method to retrieve an entire string, :meth:`~curses.window." -"getstr`. It isn't used very often, because its functionality is quite " -"limited; the only editing keys available are the backspace key and the Enter " -"key, which terminates the string. It can optionally be limited to a fixed " -"number of characters. ::" +"There's also a method to retrieve an entire " +"string, :meth:`~curses.window.getstr`. It isn't used very often, because " +"its functionality is quite limited; the only editing keys available are the " +"backspace key and the Enter key, which terminates the string. It can " +"optionally be limited to a fixed number of characters. ::" msgstr "" #: ../../howto/curses.rst:484 @@ -860,15 +997,19 @@ 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::" +"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 +1029,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,39 +1070,51 @@ 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 " "ncurses or a proprietary Unix vendor's. The manual pages will document any " -"quirks, and provide complete lists of all the functions, attributes, and :" -"ref:`ACS_\\* ` characters available to you." +"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, " "but because no one has needed them yet. Also, Python doesn't yet support " "the menu library associated with ncurses. Patches adding support for these " -"would be welcome; see `the Python Developer's Guide `_ to learn more about submitting patches to Python." +"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 +1126,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..a5b7d0ec1 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:" @@ -94,14 +93,15 @@ msgstr "" msgid "" "The last section has pure Python equivalents for built-in descriptors that " "are written in C. Read this if you're curious about how functions turn into " -"bound methods or about the implementation of common tools like :func:" -"`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." +"bound methods or about the implementation of common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :term:`__slots__`." msgstr "" "最後のセクションは、Cで書かれた組み込みのデスクリプタをピュアPythonで実現する" -"方法を紹介します。このセクションがどのように関数が束縛メソッドになるのか、 :" -"func:`classmethod` や :func:`staticmethod`, :func:`property`, :term:" -"`__slots__` といった一般的なツールの実装がどのようになっているのか興味を持っ" -"たら読んでください。" +"方法を紹介します。このセクションがどのように関数が束縛メソッドになるの" +"か、 :func:`classmethod` " +"や :func:`staticmethod`, :func:`property`, :term:`__slots__` といった一般的な" +"ツールの実装がどのようになっているのか興味を持ったら読んでください。" #: ../../howto/descriptor.rst:36 msgid "Primer" @@ -119,18 +119,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 +141,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 +158,6 @@ msgstr "" "インタラクティブセッションを使って、通常の属性ルックアップと、デスクリプタの" "ルックアップの違いを見てみましょう。" -#: ../../howto/descriptor.rst:65 msgid "" ">>> a = A() # Make an instance of class A\n" ">>> a.x # Normal attribute lookup\n" @@ -161,6 +165,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 +216,6 @@ msgid "" msgstr "" "単に定数を返すよりも、なにか処理を実行するデスクリプタの方が面白いでしょう。" -#: ../../howto/descriptor.rst:93 msgid "" "import os\n" "\n" @@ -223,16 +231,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 +266,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,19 +286,31 @@ 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 " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." -"__set__` methods are triggered when the public attribute is accessed." +"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 +322,6 @@ msgstr "" "す。パブリックな属性がアクセスされると、デスクリプタはルックアップや更新のロ" "グ出力をします。" -#: ../../howto/descriptor.rst:143 msgid "" "import logging\n" "\n" @@ -309,6 +349,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 +383,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 +411,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 +460,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 +467,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 +506,65 @@ 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:" +"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 +573,51 @@ 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__`." +"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 "" @@ -515,14 +660,14 @@ msgstr "" #: ../../howto/descriptor.rst:319 msgid "" "Descriptors are used throughout the language. It is how functions turn into " -"bound methods. Common tools like :func:`classmethod`, :func:" -"`staticmethod`, :func:`property`, and :func:`functools.cached_property` are " -"all implemented as descriptors." +"bound methods. Common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :func:`functools.cached_property` are all implemented as descriptors." msgstr "" "デスクリプタは、Pythonのさまざまなところで利用されています。これにより、単な" -"る関数は、インスタンスに束縛されたメソッドになります。 :func:`classmethod`, :" -"func:`staticmethod`, :func:`property`, :func:`functools.cached_property` と" -"いったツールもすべて、デスクリプタとして実装されています。" +"る関数は、インスタンスに束縛されたメソッドになりま" +"す。 :func:`classmethod`, :func:`staticmethod`, :func:`property`, :func:`functools.cached_property` " +"といったツールもすべて、デスクリプタとして実装されています。" #: ../../howto/descriptor.rst:326 msgid "Complete Practical Example" @@ -552,13 +697,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 +723,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 +757,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." +":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 +846,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 +858,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 +898,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 +958,19 @@ 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 "" +"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 "" @@ -779,21 +984,25 @@ msgid "" "methods were defined." msgstr "" "属性アクセスのデフォルトの振る舞いは、オブジェクトの辞書の属性の取得、設定、" -"削除です。例えば ``a.x`` は、まず ``a.__dict__['x']``、それから ``type(a)." -"__dict__['x']``、さらに ``type(a)`` のメソッド探索順序に従ったさらなる探索へ" -"と連鎖します。見つかった値が、デスクリプタメソッドのいずれかを定義しているオ" -"ブジェクトなら、Python はそのデフォルトの振る舞いをオーバーライドし、代わりに" -"デスクリプタメソッドを呼び出します。これがどの連鎖順位で行われるかは、どのデ" -"スクリプタメソッドが定義されているかに依ります。" +"削除です。例えば ``a.x`` は、まず ``a.__dict__['x']``、それから " +"``type(a).__dict__['x']``、さらに ``type(a)`` のメソッド探索順序に従ったさら" +"なる探索へと連鎖します。見つかった値が、デスクリプタメソッドのいずれかを定義" +"しているオブジェクトなら、Python はそのデフォルトの振る舞いをオーバーライド" +"し、代わりにデスクリプタメソッドを呼び出します。これがどの連鎖順位で行われる" +"かは、どのデスクリプタメソッドが定義されているかに依ります。" -#: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " -"mechanism behind properties, methods, static methods, class methods, and :" -"func:`super`. They are used throughout Python itself. Descriptors simplify " -"the underlying C code and offer a flexible set of new tools for everyday " -"Python programs." +"mechanism behind properties, methods, static methods, class methods, " +"and :func:`super`. They are used throughout Python itself. Descriptors " +"simplify 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 +1030,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)." +"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 +1055,18 @@ 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." +"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" @@ -857,8 +1074,8 @@ msgstr "デスクリプタ呼び出しの概要" #: ../../howto/descriptor.rst:557 msgid "" -"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." -"__get__(None, cls)``." +"A descriptor can be called directly with ``desc.__get__(obj)`` or " +"``desc.__get__(None, cls)``." msgstr "" "``desc.__get__(obj)`` や ``desc.__get__(None, cls)`` を使うとデスクリプタを直" "接呼び出すことができます。" @@ -871,13 +1088,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,18 +1110,21 @@ 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 "" -"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." -"__get__(a, type(a))``." +"If a descriptor is found for ``a.x``, then it is invoked with: " +"``desc.__get__(a, type(a))``." msgstr "" "``a.x`` に対するデスクリプタが見つかった場合、 ``desc.__get__(a, type(a))`` " "という形式で呼び出されます。" @@ -944,23 +1166,30 @@ 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." +"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:" +"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,59 +1200,70 @@ 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`." +"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`." +"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`." +"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." +"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 "" -"The full C implementation can be found in :c:func:`!super_getattro` in :" -"source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"The full C implementation can be found in :c:func:`!super_getattro` " +"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " "`Guido's Tutorial `_." msgstr "" @@ -1036,25 +1276,26 @@ 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`." +"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 "" -"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" -"`super`." +"Classes inherit this machinery from :class:`object`, :class:`type`, " +"or :func:`super`." msgstr "" "クラスはこの機構を :class:`object` 、 :class:`type` 、 :func:`super` から継承" "する" @@ -1082,11 +1323,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,21 +1334,31 @@ 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 "" "The implementation details are in :c:func:`!type_new` and :c:func:`!" "set_names` in :source:`Objects/typeobject.c`." msgstr "" -"実装の詳細は :source:`Objects/typeobject.c` の中の :c:func:`!type_new` と :c:" -"func:`!set_names` を参照してください。" +"実装の詳細は :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" @@ -1118,8 +1367,8 @@ msgstr "ORMのサンプル" #: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " -"could be used to implement an `object relational mapping `_." +"could be used to implement an `object relational mapping `_." msgstr "" "以下のコードは、 `オブジェクト関係マッピング `_ を実装するのにデータディスクリプタを使う" @@ -1135,7 +1384,6 @@ msgstr "" "タンスは、データベースのテーブルへのキーのみを保持します。デスクリプタがルッ" "クアップや更新をします。" -#: ../../howto/descriptor.rst:861 msgid "" "class Field:\n" "\n" @@ -1152,15 +1400,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:" +"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 +1443,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 +1481,6 @@ msgstr "" "次のインタラクティブセッションでは、データベースからのデータの取得と、更新方" "法を示しています。" -#: ../../howto/descriptor.rst:934 msgid "" ">>> Movie('Star Wars').director\n" "'George Lucas'\n" @@ -1215,6 +1495,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 +1537,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 +1547,6 @@ msgstr "" "このドキュメントでは、管理された属性 ``x`` を定義する典型的な使用法を示しま" "す:" -#: ../../howto/descriptor.rst:973 msgid "" "class C:\n" " def getx(self): return self.__x\n" @@ -1264,15 +1554,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 +1609,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 +1673,6 @@ msgstr "" "ントコードに影響を与えたくありません。この解決策は、property データデスクリプ" "タ内に値属性へのアクセスをラップすることです:" -#: ../../howto/descriptor.rst:1132 msgid "" "class Cell:\n" " ...\n" @@ -1350,12 +1683,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 +1711,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 +1731,6 @@ msgstr "" "メソッドは、ほぼ次のコードと同等な :class:`types.MethodType` を使えば手動で作" "れます。" -#: ../../howto/descriptor.rst:1161 msgid "" "class MethodType:\n" " \"Emulate PyMethod_Type in Objects/classobject.c\"\n" @@ -1417,16 +1758,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:" +"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 +1806,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 +1830,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 +1844,61 @@ 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::" +"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 +1908,6 @@ msgstr "" "内部では、束縛メソッドはオリジナルの関数と束縛されたインスタンスを保持してい" "ます。" -#: ../../howto/descriptor.rst:1255 msgid "" ">>> d.f.__func__\n" "\n" @@ -1523,6 +1915,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 +1941,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:" @@ -1603,10 +2004,10 @@ msgstr "静的メソッド" #: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " -"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." -"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " -"result, the function becomes identically accessible from either an object or " -"a class." +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " +"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " +"\"f\")``. As a result, the function becomes identically accessible from " +"either an object or a class." msgstr "" "静的メソッドは、下にある関数をそのまま返します。 ``c.f`` や ``C.f`` は、 " "``object.__getattribute__(c, \"f\")`` や ``object.__getattribute__(C, " @@ -1639,31 +2040,36 @@ 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 "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`staticmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`staticmethod` would look like this:" msgstr "" -"非データデスクリプタプロトコルを使うと、pure Python 版の :func:" -"`staticmethod` は以下のようになります:" +"非データデスクリプタプロトコルを使うと、pure Python 版" +"の :func:`staticmethod` は以下のようになります:" -#: ../../howto/descriptor.rst:1331 msgid "" "import functools\n" "\n" @@ -1684,15 +2090,37 @@ 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 " "attributes necessary to make the wrapper look like the wrapped function, " -"including :attr:`~function.__name__`, :attr:`~function.__qualname__`, and :" -"attr:`~function.__doc__`." +"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 +2136,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 "" @@ -1734,10 +2168,10 @@ msgid "" msgstr "" "この振る舞いは、関数がクラス参照のみを必要とし、特定のインスタンスに保存され" "たデータに依存しないときに便利です。クラスメソッドの使い方の一つは、代わりの" -"クラスコンストラクタを作ることです。例えば、クラスメソッド :func:`dict." -"fromkeys` は新しい辞書をキーのリストから生成します。等価な pure Python 版は:" +"クラスコンストラクタを作ることです。例えば、クラスメソッ" +"ド :func:`dict.fromkeys` は新しい辞書をキーのリストから生成します。等価な " +"pure Python 版は:" -#: ../../howto/descriptor.rst:1447 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1748,12 +2182,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,16 +2202,20 @@ 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 "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`classmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`classmethod` would look like this:" msgstr "" "非データデスクリプタプロトコルを使った、 :func:`classmethod` の pure Python " "版はこのようになります:" -#: ../../howto/descriptor.rst:1471 msgid "" "import functools\n" "\n" @@ -1786,21 +2231,33 @@ 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 "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " "carries forward the attributes necessary to make the wrapper look like the " -"wrapped function: :attr:`~function.__name__`, :attr:`~function." -"__qualname__`, :attr:`~function.__doc__`, and :attr:`~function." -"__annotations__`." +"wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" "``ClassMethod`` 内の :func:`functools.update_wrapper` の呼び出しは、根底にあ" "る関数を参照する ``__wrapped__`` 属性を追加します。また、ラッパーがそのラップ" -"された関数のように見えるよう、必要な属性を追加します: :attr:`~function." -"__name__` 、 :attr:`~function.__qualname__` 、 :attr:`~function.__doc__` 、 :" -"attr:`~function.__annotations__` 。" +"された関数のように見えるよう、必要な属性を追加しま" +"す: :attr:`~function.__name__` 、 :attr:`~function.__qualname__` 、 :attr:`~function.__doc__` 、 :attr:`~function.__annotations__` 。" #: ../../howto/descriptor.rst:1542 msgid "Member objects and __slots__" @@ -1812,7 +2269,7 @@ msgid "" "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -"クラスが ``__slots__`` を定義すると、インスタンスの辞書が固定超のスロットの値" +"クラスが ``__slots__`` を定義すると、インスタンスの辞書が固定長のスロットの値" "の配列と置き換えられます。ユーザーの目線からみると、いくつかの変化がありま" "す。" @@ -1829,8 +2286,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 +2296,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 +2310,6 @@ msgstr "" "2. デスクリプタが ``__slots__`` に格納されたプライベートな属性へのアクセスを" "制御するような、イミュータブルオブジェクトが作りやすくなる。" -#: ../../howto/descriptor.rst:1567 msgid "" "class Immutable:\n" "\n" @@ -1866,8 +2328,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 +2357,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 +2398,6 @@ msgstr "" "5. :func:`functools.cached_property` のような、動作にインスタンス辞書が必要な" "ツールが使えなくなる。" -#: ../../howto/descriptor.rst:1610 msgid "" "from functools import cached_property\n" "\n" @@ -1923,16 +2409,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 +2438,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 +2484,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 +2515,6 @@ msgstr "" "スタンスの作成の処理をします。おおざっぱにピュアPythonでのシミュレーションし" "たコードがこちらです。" -#: ../../howto/descriptor.rst:1694 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -2047,14 +2545,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 +2591,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 +2606,6 @@ msgid "" msgstr "" "この時点ではメタクラスは *x* と *y* のメンバーオブジェクトをロードします。" -#: ../../howto/descriptor.rst:1741 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -2083,6 +2616,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 +2633,6 @@ msgstr "" "インスタンスが作成されると、属性が保持される ``slot_values`` のリストをイン" "スタンスが保持します:" -#: ../../howto/descriptor.rst:1763 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -2101,15 +2641,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..ac9360d96 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,44 +320,53 @@ 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." -"FRIDAY,\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" "... }" 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 " +"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,22 +665,26 @@ msgstr "イテレーション" msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "列挙型のメンバーのイテレートは別名をサポートしていません::" -#: ../../howto/enum.rst:314 msgid "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" 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 "" @@ -646,14 +806,15 @@ msgid "" "(again, :class:`IntEnum` was explicitly designed to behave differently, see " "below)::" msgstr "" -"非列挙型の値との比較は常に不等となります (繰り返しになりますが、:class:" -"`IntEnum` はこれと異なる挙動になるよう設計されています)::" +"非列挙型の値との比較は常に不等となります (繰り返しになります" +"が、: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,51 +899,71 @@ 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 " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`~object." -"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " -"descriptors), and variable names listed in :attr:`~Enum._ignore_`." +"enumeration, with the exception of special methods " +"(:meth:`~object.__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." +"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." +"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 +973,6 @@ msgstr "" "列挙型のサブクラスの作成はその列挙型にメンバーが一つも定義されていない場合の" "み行なえます。従って以下は許されません::" -#: ../../howto/enum.rst:457 msgid "" ">>> class MoreColor(Color):\n" "... PINK = 17\n" @@ -787,12 +981,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 +1002,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" @@ -822,13 +1029,12 @@ msgstr "データクラスのサポート" #: ../../howto/enum.rst:486 msgid "" -"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." -"__repr__` omits the inherited class' name. For example::" +"When inheriting from a :class:`~dataclasses.dataclass`, " +"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" msgstr "" ":class:`~dataclasses.dataclass` を継承する場合、 :meth:`~Enum.__repr__` は継" "承するクラス名を省略します。 例えば::" -#: ../../howto/enum.rst:489 msgid "" ">>> from dataclasses import dataclass, field\n" ">>> @dataclass\n" @@ -844,6 +1050,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 +1091,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 +1102,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 +1121,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 +1149,25 @@ 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::" +"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 +1187,6 @@ msgid "" msgstr "" ":class:`Enum` クラスは呼び出し可能で、以下の関数 API を提供しています::" -#: ../../howto/enum.rst:566 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" ">>> Animal\n" @@ -961,16 +1196,22 @@ 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 "" "The semantics of this API resemble :class:`~collections.namedtuple`. The " "first argument of the call to :class:`Enum` is the name of the enumeration." msgstr "" -"この API の動作は :class:`~collections.namedtuple` と似ています。:class:" -"`Enum` 呼び出しの第 1 引数は列挙型の名前です。" +"この 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 +1222,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 +1239,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 +1262,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::" +"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 +1312,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 +1333,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." @@ -1130,17 +1386,16 @@ msgstr "IntEnum" #: ../../howto/enum.rst:667 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass of :" -"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " -"extension, integer enumerations of different types can also be compared to " -"each other::" +"The first variation of :class:`Enum` that is provided is also a subclass " +"of :class:`int`. Members of an :class:`IntEnum` can be compared to " +"integers; by extension, integer enumerations of different types can also be " +"compared to each other::" msgstr "" "提供されている 1 つ目の :class:`Enum` の派生型であり、 :class:`int` のサブク" "ラスでもあります。\n" ":class:`IntEnum` のメンバーは整数と比較できます;\n" "さらに言うと、異なる整数列挙型どうしでも比較できます::" -#: ../../howto/enum.rst:672 msgid "" ">>> from enum import IntEnum\n" ">>> class Shape(IntEnum):\n" @@ -1158,6 +1413,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 +1435,6 @@ msgid "" "enumerations::" msgstr "ただし、これらも標準の :class:`Enum` 列挙型とは比較できません::" -#: ../../howto/enum.rst:690 msgid "" ">>> class Shape(IntEnum):\n" "... CIRCLE = 1\n" @@ -1178,13 +1447,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 +1471,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,21 +1497,20 @@ 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 " "combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" -"`IntFlag` members are also integers and can be used wherever an :class:`int` " -"is used." +"an :class:`IntFlag` member, if possible. " +"Like :class:`IntEnum`, :class:`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 "" @@ -1242,15 +1525,14 @@ msgid "" "Bit-wise operations that result in invalid :class:`IntFlag` values will lose " "the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." msgstr "" -"ビット単位演算の結果が :class:`IntFlag` として不正な値な値の場合、値は :" -"class:`IntFlag` メンバーではなくなります。 詳しくは :class:`FlagBoundary` を" -"参照してください。" +"ビット単位演算の結果が :class:`IntFlag` として不正な値な値の場合、値" +"は :class:`IntFlag` メンバーではなくなります。 詳しく" +"は :class:`FlagBoundary` を参照してください。" #: ../../howto/enum.rst:743 msgid "Sample :class:`IntFlag` class::" msgstr ":class:`IntFlag` クラスの例::" -#: ../../howto/enum.rst:745 msgid "" ">>> from enum import IntFlag\n" ">>> class Perm(IntFlag):\n" @@ -1266,12 +1548,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 +1580,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 "" @@ -1298,20 +1604,23 @@ msgstr "" #: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation is :data:" -"`False`::" +"that if no flags are set (the value is 0), its boolean evaluation " +"is :data:`False`::" msgstr "" ":class:`IntFlag` と :class:`Enum` のもう 1 つの重要な違いは、フラグが設定され" "ていない (値が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 +1631,6 @@ msgstr "" "合わせることができます(ただし、 :class:`IntFlag` 型ではなくなる可能性があり" "ます)::" -#: ../../howto/enum.rst:792 msgid "" ">>> Perm.X | 4\n" "\n" @@ -1330,6 +1638,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 +1651,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" @@ -1361,19 +1676,19 @@ msgstr "Flag" #: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" -"class:`IntFlag`, they cannot be combined with, nor compared against, any " -"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " -"specify the values directly it is recommended to use :class:`auto` as the " +"members can be combined using the bitwise operators (&, \\|, ^, ~). " +"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " +"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " +"to specify the values directly it is recommended to use :class:`auto` as the " "value and let :class:`Flag` select an appropriate value." msgstr "" "最後の派生型は :class:`Flag` です。\n" ":class:`IntFlag` と同様に、 :class:`Flag` メンバーもビット演算子 (&, \\|, ^, " "~) を使って組み合わせられます。\n" -"しかし :class:`IntFlag` とは違い、他のどの :class:`Flag` 列挙型とも :class:" -"`int` とも組み合わせたり、比較したりできません。\n" -"値を直接指定することも可能ですが、値として :class:`auto` を使い、 :class:" -"`Flag` に適切な値を選ばせることが推奨されています。" +"しかし :class:`IntFlag` とは違い、他のどの :class:`Flag` 列挙型と" +"も :class:`int` とも組み合わせたり、比較したりできません。\n" +"値を直接指定することも可能ですが、値として :class:`auto` を使" +"い、 :class:`Flag` に適切な値を選ばせることが推奨されています。" #: ../../howto/enum.rst:826 msgid "" @@ -1384,7 +1699,6 @@ msgstr "" "設定されていない状態になった場合、その真偽値としての評価は :data:`False` とな" "ります::" -#: ../../howto/enum.rst:829 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1397,6 +1711,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 +1730,6 @@ msgstr "" "個別のフラグは 2 のべき乗 (1, 2, 4, 8, ...) の値を持つべきですが、フラグの組" "み合わせはそうはなりません::" -#: ../../howto/enum.rst:843 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1417,16 +1740,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,28 +1778,29 @@ 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 "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " "promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" -"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " -"will not do; for example, when integer constants are replaced with " -"enumerations, or for interoperability with other systems." +"transitivity to other unrelated enumerations). :class:`IntEnum` " +"and :class:`IntFlag` should be used only in cases where :class:`Enum` " +"and :class:`Flag` will not do; for example, when integer constants are " +"replaced with enumerations, or for interoperability with other systems." msgstr "" "ほとんどの新しいコードでは、 :class:`Enum` と :class:`Flag` が強く推奨されま" "す。\n" @@ -1482,38 +1824,40 @@ 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`." +"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 "" -"When subclassing :class:`Enum`, mix-in types must appear before the :class:" -"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " -"example above." +"When subclassing :class:`Enum`, mix-in types must appear before " +"the :class:`Enum` class itself in the sequence of bases, as in " +"the :class:`IntEnum` example above." msgstr "" ":class:`Enum` のサブクラスを作成するとき、複合させるデータ型は、基底クラスの" -"並びで :class:`Enum` クラス自身より先に記述しなければなりません (上記 :class:" -"`IntEnum` の例を参照)。" +"並びで :class:`Enum` クラス自身より先に記述しなければなりません (上" +"記 :class:`IntEnum` の例を参照)。" #: ../../howto/enum.rst:902 msgid "" -"Mix-in types must be subclassable. For example, :class:`bool` and :class:" -"`range` are not subclassable and will throw an error during Enum creation if " -"used as the mix-in type." +"Mix-in types must be subclassable. For example, :class:`bool` " +"and :class:`range` are not subclassable and will throw an error during Enum " +"creation if used as the mix-in type." msgstr "" "複合させる型はサブクラス化可能でなければいけません。例えば、 :class:`bool` " "と :class:`range` はサブクラス化できないため、複合させるとEnum作成時にエラー" @@ -1522,61 +1866,70 @@ msgstr "" #: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, e.g. :class:" -"`int` above. This restriction does not apply to mix-ins which only add " -"methods and don't specify another type." +"additional type, all the members must have values of that type, " +"e.g. :class:`int` above. This restriction does not apply to mix-ins which " +"only add methods and don't specify another type." msgstr "" ":class:`Enum` のメンバーはどんなデータ型でも構いませんが、追加のデータ型 (例" "えば、上の例の :class:`int`) と複合させてしまうと、すべてのメンバーの値はその" "データ型でなければならなくなります。この制限は、メソッドの追加するだけの、他" "のデータ型を指定しない複合には適用されません。" -#: ../../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`" +"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 "" -"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " -"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " -"type." +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " +"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " +"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " +"its mixed-in 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." +":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." +"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." +"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 +1939,6 @@ msgstr "" "例えば、複数の値をコンストラクタに渡すが、その中の1つだけを値として使いたい場" "合は次のようにします:" -#: ../../howto/enum.rst:939 msgid "" ">>> class Coordinate(bytes, Enum):\n" "... \"\"\"\n" @@ -1610,12 +1962,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" @@ -1634,9 +2009,9 @@ msgstr "" #: ../../howto/enum.rst:976 msgid "" ":meth:`~object.__new__`, if specified, must create and return the enum " -"members; it is also a very good idea to set the member's :attr:`~Enum." -"_value_` appropriately. Once all the members are created it is no longer " -"used." +"members; it is also a very good idea to set the " +"member's :attr:`~Enum._value_` appropriately. Once all the members are " +"created it is no longer used." msgstr "" #: ../../howto/enum.rst:982 @@ -1651,31 +2026,30 @@ 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 "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" -":attr:`~Enum._ignore_` -- 名前のリストで、 :class:`list` もしくは :class:" -"`str` です。この名前の要素はメンバーへの変換が行われず、最終的なクラスから削" -"除されます。" +":attr:`~Enum._ignore_` -- 名前のリストで、 :class:`list` もしく" +"は :class:`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 +2118,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 +2141,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 +2149,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 +2175,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" @@ -1809,11 +2187,11 @@ msgstr "``Enum`` クラスとメンバーの真偽値" #: ../../howto/enum.rst:1074 msgid "" -"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" -"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " -"rules; otherwise, all members evaluate as :data:`True`. To make your own " -"enum's boolean evaluation depend on the member's value add the following to " -"your class::" +"Enum classes that are mixed with non-:class:`Enum` types (such " +"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " +"type's rules; otherwise, all members evaluate as :data:`True`. To make your " +"own enum's boolean evaluation depend on the member's value add the following " +"to your class::" msgstr "" "(:class:`int`, :class:`str` などのような) 非 :class:`Enum` 型と複合させた " "enum クラスは、その複合された型の規則に従って評価されます;\n" @@ -1821,11 +2199,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 +2221,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 +2232,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 +2264,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 +2294,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 +2318,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 +2331,6 @@ msgid "" "corresponding positive integer value::" msgstr "" -#: ../../howto/enum.rst:1145 msgid "" ">>> Color.BLUE\n" "\n" @@ -1937,12 +2338,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 +2360,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 +2385,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 +2402,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 +2417,6 @@ msgstr "" "それ以外では、一方のフラグの全ビットが他方のフラグに含まれる場合のみ、Trueが" "返されます::" -#: ../../howto/enum.rst:1184 msgid "" ">>> Color.PURPLE in Color.WHITE\n" "True\n" @@ -2002,12 +2424,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,27 +2451,23 @@ 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 "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " -"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." -"Options`` for an example of when ``KEEP`` is needed)." +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " +"``ssl.Options`` for an example of when ``KEEP`` is needed)." msgstr "" #: ../../howto/enum.rst:1210 @@ -2051,8 +2476,8 @@ msgstr "EnumとFlagはどう違うのか?" #: ../../howto/enum.rst:1212 msgid "" -"Enums have a custom metaclass that affects many aspects of both derived :" -"class:`Enum` classes and their instances (members)." +"Enums have a custom metaclass that affects many aspects of both " +"derived :class:`Enum` classes and their instances (members)." msgstr "" "Enum は :class:`Enum` 派生クラスやそれらのインスタンス (メンバー) 双方の多く" "の側面に影響を及ぼすカスタムメタクラスを持っています。" @@ -2061,43 +2486,59 @@ 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__` " +"The :class:`EnumType` metaclass is responsible for providing " +"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " "and other methods that allow one to do things with an :class:`Enum` class " "that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " "Color``. :class:`EnumType` is responsible for ensuring that various other " -"methods on the final :class:`Enum` class are correct (such as :meth:`~object." -"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" -"`~object.__repr__`)." -msgstr "" +"methods on the final :class:`Enum` class are correct (such " +"as :meth:`~object.__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 " -"addition to the :class:`Enum` definition of alias, a flag with no value (a.k." -"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"addition to the :class:`Enum` definition of alias, a flag with no value " +"(a.k.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 " -"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " -"that no new ones are ever instantiated by returning only the existing member " -"instances." +"The most interesting thing about enum members is that they are " +"singletons. :class:`EnumType` creates them all while it is creating the enum " +"class itself, and then puts a custom :meth:`~object.__new__` in place to " +"ensure 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 +2552,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 +2570,12 @@ msgid "" msgstr "" "フラグのメンバーを反転させると、負の値ではなく、対応する正の値が返されます::" -#: ../../howto/enum.rst:1257 msgid "" ">>> ~Color.RED\n" "" msgstr "" +">>> ~Color.RED\n" +"" #: ../../howto/enum.rst:1260 msgid "" @@ -2142,11 +2585,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" @@ -2154,15 +2598,16 @@ msgstr "Enum クックブック" #: ../../howto/enum.rst:1273 msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" -"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " -"cover them all. Here are recipes for some different types of enumerations " -"that can be used directly, or as examples for creating one's own." +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " +"and :class:`IntFlag` are expected to cover the majority of use-cases, they " +"cannot cover them all. Here are recipes for some different types of " +"enumerations that can be used directly, or as examples for creating one's " +"own." msgstr "" -":class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, :class:" -"`IntFlag` は用途の大部分をカバーすると予想されますが、そのすべてをカバーでき" -"ているわけではありません。ここでは、そのまま、あるいは独自の列挙型を作る例と" -"して使える、様々なタイプの列挙型を紹介します。" +":class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, :class:`IntFlag` " +"は用途の大部分をカバーすると予想されますが、そのすべてをカバーできているわけ" +"ではありません。ここでは、そのまま、あるいは独自の列挙型を作る例として使え" +"る、様々なタイプの列挙型を紹介します。" #: ../../howto/enum.rst:1280 msgid "Omitting values" @@ -2188,11 +2633,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 +2658,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 +2667,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 +2683,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 +2692,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__`::" +"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 +2718,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 +2736,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 +2745,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 +2775,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 +2798,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 +2807,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 +2823,6 @@ msgstr "" "``AutoNumber`` を継承すると、追加の引数を取り扱える独自の ``__init__`` が書け" "ます。" -#: ../../howto/enum.rst:1385 msgid "" ">>> class Swatch(AutoNumber):\n" "... def __init__(self, pantone='unknown'):\n" @@ -2349,23 +2838,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 +2886,6 @@ msgstr "" ":class:`IntEnum` をベースとしないため、通常の :class:`Enum` の不変条件 (他の" "列挙型と比較できないなど) のままで、メンバーを順序付けできる列挙型です::" -#: ../../howto/enum.rst:1420 msgid "" ">>> class OrderedEnum(Enum):\n" "... def __ge__(self, other):\n" @@ -2410,6 +2915,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 +2955,6 @@ msgstr "" "値が重複するメンバーがある場合に、エイリアスを作成するのではなくエラーを発生" "させます::" -#: ../../howto/enum.rst:1455 msgid "" ">>> class DuplicateFreeEnum(Enum):\n" "... def __init__(self, *args):\n" @@ -2446,6 +2977,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 +3008,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 +3032,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 +3084,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 "" @@ -2540,20 +3125,23 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" msgstr "" #: ../../howto/enum.rst:1558 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..4e09ec9f1 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 @@ -50,15 +50,15 @@ msgstr "0.32" msgid "" "In this document, we'll take a tour of Python's features suitable for " "implementing programs in a functional style. After an introduction to the " -"concepts of functional programming, we'll look at language features such as :" -"term:`iterator`\\s and :term:`generator`\\s and relevant library modules " +"concepts of functional programming, we'll look at language features such " +"as :term:`iterator`\\s and :term:`generator`\\s and relevant library modules " "such as :mod:`itertools` and :mod:`functools`." msgstr "" "この文書では、関数型スタイルでプログラムを実装するのにピッタリな Python の機" "能を見てまわることにしましょう。まず関数型プログラミングという概念を紹介した" -"あと、 :term:`iterator` や :term:`generator` のような言語機能、および :mod:" -"`itertools` や :mod:`functools` といった関連するライブラリモジュールを見るこ" -"とにします。" +"あと、 :term:`iterator` や :term:`generator` のような言語機能、およ" +"び :mod:`itertools` や :mod:`functools` といった関連するライブラリモジュール" +"を見ることにします。" #: ../../howto/functional.rst:18 msgid "Introduction" @@ -184,9 +184,10 @@ msgid "" msgstr "" "ある言語では純粋さにとても厳しく ``a=3`` や ``c = a + b`` のような代入文すら" "存在しないほどですが、画面への表示やディスクファイルへの書き込みなど、すべて" -"の副作用を避けるのは難しいです。別の例として、 :func:`print` や :func:`time." -"sleep` 関数の呼び出しもありますが、どちらも有用な値を返しません。画面にテキス" -"トを送ったり、実行を 1 秒間停めたりといった副作用のためだけに呼ばれるのです。" +"の副作用を避けるのは難しいです。別の例として、 :func:`print` " +"や :func:`time.sleep` 関数の呼び出しもありますが、どちらも有用な値を返しませ" +"ん。画面にテキストを送ったり、実行を 1 秒間停めたりといった副作用のためだけに" +"呼ばれるのです。" #: ../../howto/functional.rst:75 msgid "" @@ -276,7 +277,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 +286,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 "" @@ -428,12 +428,12 @@ msgid "" "reasonable to write an iterator that produces an infinite stream of data." msgstr "" "イテレータは連続データを表現するオブジェクトです; このオブジェクトは一度に一" -"つの要素ずつデータを返します。 Python のイテレータは :meth:`~iterator." -"__next__` という、引数を取らず次の要素を返すメソッドを必ずサポートしていま" -"す。データストリームに要素が残っていない場合、 :meth:`~iterator.__next__` は" -"必ず :exc:`StopIteration` 例外を出します。ただし、イテレータの長さは有限であ" -"る必要はありません; 無限のストリームを生成するイテレータを書くというのもまっ" -"たく理に適ったことです。" +"つの要素ずつデータを返します。 Python のイテレータ" +"は :meth:`~iterator.__next__` という、引数を取らず次の要素を返すメソッドを必" +"ずサポートしています。データストリームに要素が残っていない場" +"合、 :meth:`~iterator.__next__` は必ず :exc:`StopIteration` 例外を出します。" +"ただし、イテレータの長さは有限である必要はありません; 無限のストリームを生成" +"するイテレータを書くというのもまったく理に適ったことです。" #: ../../howto/functional.rst:193 msgid "" @@ -466,7 +466,6 @@ msgstr "" "るいは :func:`iter` でイテレータを作れるオブジェクトである必要があります。次" "の二つは同じ意味になります::" -#: ../../howto/functional.rst:224 msgid "" "for i in iter(obj):\n" " print(i)\n" @@ -474,6 +473,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 "" @@ -497,9 +501,10 @@ msgid "" "iterator argument and will return the largest or smallest element. The " "``\"in\"`` and ``\"not in\"`` operators also support iterators: ``X in " "iterator`` is true if X is found in the stream returned by the iterator. " -"You'll run into obvious problems if the iterator is infinite; :func:`max`, :" -"func:`min` will never return, and if the element X never appears in the " -"stream, the ``\"in\"`` and ``\"not in\"`` operators won't return either." +"You'll run into obvious problems if the iterator is " +"infinite; :func:`max`, :func:`min` will never return, and if the element X " +"never appears in the stream, the ``\"in\"`` and ``\"not in\"`` operators " +"won't return either." msgstr "" "ビルトイン関数の :func:`max` や :func:`min` なども、イテレータ一つだけを引数" "に取って最大・最小の要素を返すことができます。 ``\"in\"`` や ``\"not in\"`` " @@ -548,7 +553,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 +571,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 "" @@ -583,8 +603,9 @@ msgstr "" msgid "" "Applying :func:`iter` to a dictionary always loops over the keys, but " "dictionaries have methods that return other iterators. If you want to " -"iterate over values or key/value pairs, you can explicitly call the :meth:" -"`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator." +"iterate over values or key/value pairs, you can explicitly call " +"the :meth:`~dict.values` or :meth:`~dict.items` methods to get an " +"appropriate iterator." msgstr "" "辞書は :func:`iter` を適用するとキーでループを回しますが、辞書には他のイテ" "レータを返すメソッドもあります。明示的に値、あるいはキーと値のペアでイテレー" @@ -609,12 +630,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 +647,6 @@ msgstr "" "セットはイテラブルを受け取れますし、そのセットの要素でイテレートすることもで" "きます::" -#: ../../howto/functional.rst:320 msgid "" ">>> S = {2, 3, 5, 7, 11, 13}\n" ">>> for i in S:\n" @@ -636,12 +658,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 +679,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 +696,6 @@ msgstr "" "(https://www.haskell.org/) にインスパイアされました。文字列のストリームからホ" "ワイトスペースをすべて削るのは次のコードでできます::" -#: ../../howto/functional.rst:346 msgid "" ">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" "\n" @@ -676,17 +705,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 +793,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 +820,6 @@ msgstr "" "別の書き方をすると、リスト内包表記やジェネレータ式は次の Python コードと同じ" "意味になります::" -#: ../../howto/functional.rst:402 msgid "" "for expr1 in sequence1:\n" " if not (condition1):\n" @@ -800,6 +835,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 +870,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 +930,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 +940,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:" @@ -995,16 +1047,16 @@ msgstr "" #: ../../howto/functional.rst:539 msgid "" -"In Python 2.5 there's a simple way to pass values into a generator. :keyword:" -"`yield` became an expression, returning a value that can be assigned to a " -"variable or otherwise operated on::" +"In Python 2.5 there's a simple way to pass values into a " +"generator. :keyword:`yield` became an expression, returning a value that can " +"be assigned to a variable or otherwise operated on::" msgstr "" -"Python 2.5 で、ジェネレータに値を渡す簡単な手段ができました。 :keyword:" -"`yield` が、変数に代入したり演算したりできる値を返す式になったのです::" +"Python 2.5 で、ジェネレータに値を渡す簡単な手段ができまし" +"た。 :keyword:`yield` が、変数に代入したり演算したりできる値を返す式になった" +"のです::" -#: ../../howto/functional.rst:543 msgid "val = (yield i)" -msgstr "" +msgstr "val = (yield i)" #: ../../howto/functional.rst:545 msgid "" @@ -1034,8 +1086,9 @@ msgstr "" msgid "" "Values are sent into a generator by calling its :meth:`send(value) " "` method. This method resumes the generator's code and the " -"``yield`` expression returns the specified value. If the regular :meth:" -"`~generator.__next__` method is called, the ``yield`` returns ``None``." +"``yield`` expression returns the specified value. If the " +"regular :meth:`~generator.__next__` method is called, the ``yield`` returns " +"``None``." msgstr "" "ジェネレータに値を送るには :meth:`send(value) ` メソッドを呼" "びます。 するとジェネレータのコードが実行を再開し、 ``yield`` 式がその値を返" @@ -1050,7 +1103,6 @@ msgstr "" "下にあるのは 1 ずつ増える単純なカウンタですが、内部カウンタの値を変更すること" "ができるようになっています。" -#: ../../howto/functional.rst:564 msgid "" "def counter(maximum):\n" " i = 0\n" @@ -1062,6 +1114,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:" @@ -1100,28 +1161,27 @@ msgstr "" msgid "" ":meth:`~generator.close` raises a :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " -"generator's code must either raise :exc:`GeneratorExit` or :exc:" -"`StopIteration`; catching the exception and doing anything else is illegal " -"and will trigger a :exc:`RuntimeError`. :meth:`~generator.close` will also " -"be called by Python's garbage collector when the generator is garbage-" -"collected." +"generator's code must either raise :exc:`GeneratorExit` " +"or :exc:`StopIteration`; catching the exception and doing anything else is " +"illegal and will trigger a :exc:`RuntimeError`. :meth:`~generator.close` " +"will also be called by Python's garbage collector when the generator is " +"garbage-collected." msgstr "" ":meth:`~generator.close` はジェネレータ内で :exc:`GeneratorExit` 例外を投げ" -"て、 イテレートを終了させます。この例外を受け取ったジェネレータのコードは :" -"exc:`GeneratorExit` か :exc:`StopIteration` を投げなくてはいけません; この例" -"外を捕捉して何かほかのことをしようとするのは規則違反であり、 :exc:" -"`RuntimeError` を引き起こします。 :meth:`~generator.close` はジェネレータが " -"GC されるときにも呼ばれます。" +"て、 イテレートを終了させます。この例外を受け取ったジェネレータのコード" +"は :exc:`GeneratorExit` か :exc:`StopIteration` を投げなくてはいけません; こ" +"の例外を捕捉して何かほかのことをしようとするのは規則違反であ" +"り、 :exc:`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`." +"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 +1267,6 @@ msgstr "" "振っていき、(*start* から数え始めたときの) 番号とそれぞれの要素を含む 2 タプ" "ルを返します。" -#: ../../howto/functional.rst:669 msgid "" ">>> for item in enumerate(['subject', 'verb', 'object']):\n" "... print(item)\n" @@ -1215,22 +1274,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 +1309,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 +1320,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 +1354,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 +1384,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 +1452,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 +1460,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 +1478,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 +1494,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 +1516,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 +1540,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 +1548,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 +1571,6 @@ msgstr "" "たうちの一つが他よりも進んでいってしまうと、大量のメモリを消費することがあり" "ます。 ::" -#: ../../howto/functional.rst:816 msgid "" "itertools.tee( itertools.count() ) =>\n" " iterA, iterB\n" @@ -1491,6 +1581,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" @@ -1499,16 +1597,18 @@ msgstr "要素に対して関数を呼ぶ" #: ../../howto/functional.rst:829 msgid "" "The :mod:`operator` module contains a set of functions corresponding to " -"Python's operators. Some examples are :func:`operator.add(a, b) ` (adds two values), :func:`operator.ne(a, b) ` (same as " -"``a != b``), and :func:`operator.attrgetter('id') ` " -"(returns a callable that fetches the ``.id`` attribute)." +"Python's operators. Some examples are :func:`operator.add(a, b) " +"` (adds two values), :func:`operator.ne(a, b) ` " +"(same as ``a != b``), and :func:`operator.attrgetter('id') " +"` (returns a callable that fetches the ``.id`` " +"attribute)." msgstr "" "いま使った :mod:`operator` モジュールには、Python の演算子に対応する関数が" -"入っています。いくつか例を挙げると、 :func:`operator.add(a, b) ` (二つの値を加算)、 :func:`operator.ne(a, b) ` (``a != b`` " -"と同じ)、 :func:`operator.attrgetter('id') ` (``.id`` 属" -"性を取得するコーラブルを返す) といった関数です。" +"入っています。いくつか例を挙げると、 :func:`operator.add(a, b) " +"` (二つの値を加算)、 :func:`operator.ne(a, b) ` " +"(``a != b`` と同じ)、 :func:`operator.attrgetter('id') " +"` (``.id`` 属性を取得するコーラブルを返す) といった関数" +"です。" #: ../../howto/functional.rst:835 msgid "" @@ -1520,7 +1620,6 @@ msgstr "" "プルのストリームを返すとみなして、 そのタプルを引数に使って *func* を呼びま" "す::" -#: ../../howto/functional.rst:839 msgid "" "itertools.starmap(os.path.join,\n" " [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" @@ -1528,6 +1627,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" @@ -1547,14 +1651,15 @@ msgid "" "the opposite of :func:`filter`, returning all elements for which the " "predicate returns false::" msgstr "" -":func:`itertools.filterfalse(predicate, iter) ` は :" -"func:`filter` とは反対に、 述語が偽を返す要素をすべて返します::" +":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 +1671,6 @@ msgstr "" "を返している間だけ要素を返します。一度でも述語が偽を返すと、イテレータは出力" "終了の合図をします。 ::" -#: ../../howto/functional.rst:863 msgid "" "def less_than_10(x):\n" " return x < 10\n" @@ -1577,6 +1681,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 +1700,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 +1707,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 +1724,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,22 +1756,32 @@ 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 "" "The elements within each tuple remain in the same order as *iterable* " "returned them. For example, the number 1 is always before 2, 3, 4, or 5 in " -"the examples above. A similar function, :func:`itertools." -"permutations(iterable, r=None) `, removes this " -"constraint on the order, returning all possible arrangements of length *r*::" +"the examples above. A similar " +"function, :func:`itertools.permutations(iterable, r=None) " +"`, removes this constraint on the order, returning " +"all possible arrangements of length *r*::" msgstr "" "それぞれのタプル内では、要素は *iterable* がそれを返したのと同じ順序を保ちま" "す。例えば上の例であれば、 1 はいつでも 2, 3, 4, 5 の前に来ます。似たような関" -"数に :func:`itertools.permutations(iterable, r=None) ` があり、こちらはこの順序についての制約がなく、 *r* 個選択する" -"全ての順列を返します。" +"数に :func:`itertools.permutations(iterable, r=None) " +"` があり、こちらはこの順序についての制約がなく、 *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 +1795,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 +1823,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,20 +1840,19 @@ 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: " -"elements can be repeated within a single tuple. Conceptually an element is " -"selected for the first position of each tuple and then is replaced before " -"the second element is selected. ::" +"The :func:`itertools.combinations_with_replacement(iterable, r) " +"` function relaxes a different " +"constraint: elements can be repeated within a single tuple. Conceptually an " +"element is selected for the first position of each tuple and then is " +"replaced before the second element is selected. ::" msgstr "" -":func:`itertools.combinations_with_replacement(iterable, r) ` 関数は別の制約を取り払います: 一回の選択で同" -"じ要素を繰り返し選んでも良い。概念的には、それぞれのタプルの最初のものとして" -"一つ要素が選ばれ、続いて 2つ目の選択のかわりにそれで置き換わります ::" +":func:`itertools.combinations_with_replacement(iterable, r) " +"` は、別の制約を緩めます。\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 +1861,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 +1895,6 @@ msgstr "" "要素を集めて、キー値とそのキーに対応する要素のイテレータの 2-タプルのストリー" "ムを返します。" -#: ../../howto/functional.rst:968 msgid "" "city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" " ('Anchorage', 'AK'), ('Nome', 'AK'),\n" @@ -1776,6 +1918,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 "" @@ -1797,8 +1960,8 @@ msgstr "functools モジュール" msgid "" "The :mod:`functools` module contains some higher-order functions. A **higher-" "order function** takes one or more functions as input and returns a new " -"function. The most useful tool in this module is the :func:`functools." -"partial` function." +"function. The most useful tool in this module is " +"the :func:`functools.partial` function." msgstr "" ":mod:`functools` モジュールには、高階関数がいくつか入っています。 **高階関数" "** とは、入力として関数を受け取って新たな関数を返す関数です。このモジュールで" @@ -1835,7 +1998,6 @@ msgstr "" msgid "Here's a small but realistic example::" msgstr "以下にあるのは、小さいけれども現実的な一つの例です::" -#: ../../howto/functional.rst:1017 msgid "" "import functools\n" "\n" @@ -1847,20 +2009,29 @@ 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 "" ":func:`functools.reduce(func, iter, [initial_value]) ` " "cumulatively performs an operation on all the iterable's elements and, " "therefore, can't be applied to infinite iterables. *func* must be a function " -"that takes two elements and returns a single value. :func:`functools." -"reduce` takes the first two elements A and B returned by the iterator and " -"calculates ``func(A, B)``. It then requests the third element, C, " -"calculates ``func(func(A, B), C)``, combines this result with the fourth " -"element returned, and continues until the iterable is exhausted. If the " -"iterable returns no values at all, a :exc:`TypeError` exception is raised. " -"If the initial value is supplied, it's used as a starting point and " -"``func(initial_value, A)`` is the first calculation. ::" +"that takes two elements and returns a single " +"value. :func:`functools.reduce` takes the first two elements A and B " +"returned by the iterator and calculates ``func(A, B)``. It then requests " +"the third element, C, calculates ``func(func(A, B), C)``, combines this " +"result with the fourth element returned, and continues until the iterable is " +"exhausted. If the iterable returns no values at all, a :exc:`TypeError` " +"exception is raised. If the initial value is supplied, it's used as a " +"starting point and ``func(initial_value, A)`` is the first calculation. ::" msgstr "" ":func:`functools.reduce(func, iter, [initial_value]) ` はイ" "テラブルの要素に対して次々に演算を実行していった最終結果を出すもので、それゆ" @@ -1902,10 +2073,9 @@ msgid "" "For many uses of :func:`functools.reduce`, though, it can be clearer to just " "write the obvious :keyword:`for` loop::" msgstr "" -"とはいえ、多くの場合 :func:`functools.reduce` を使うよりは、単に :keyword:" -"`for` ループを書いたほうがわかりやすくなります::" +"とはいえ、多くの場合 :func:`functools.reduce` を使うよりは、単" +"に :keyword:`for` ループを書いたほうがわかりやすくなります::" -#: ../../howto/functional.rst:1066 msgid "" "import functools\n" "# Instead of:\n" @@ -1916,20 +2086,27 @@ 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::" +"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 +2114,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 +2187,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 +2206,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 +2221,6 @@ msgid "" "the usual way::" msgstr "もう一つの選択肢は、ふつうに ``def`` 文で関数を定義するだけです::" -#: ../../howto/functional.rst:1130 msgid "" "def adder(x, y):\n" " return x + y\n" @@ -2044,6 +2228,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 +2258,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 +2274,6 @@ msgstr "" "わかるにはわかるでしょうが、何がどうなっているのか紐解いていくには時間がかか" "るはずです。短い ``def`` 文で入れ子にすると、少し見通しが良くなりますが::" -#: ../../howto/functional.rst:1153 msgid "" "import functools\n" "def combine(a, b):\n" @@ -2092,25 +2281,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 +2369,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 +2460,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 +2503,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..c721e3c59 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 `_ 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 *`::" +"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/" @@ -468,9 +545,9 @@ msgid "" "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=, 'timer.total_time': }], " +"dialog=, saved_game_model=, sudoku_maker=, 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" @@ -553,9 +691,9 @@ msgid "" "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=, 'timer.total_time': }], " +"dialog=, saved_game_model=, sudoku_maker=)\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" @@ -668,8 +867,8 @@ msgid "" " 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" +"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 " @@ -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,33 @@ 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\") {" +"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 +584,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 +612,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 +635,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 "" @@ -554,8 +710,8 @@ msgid "" " lineno = $arg3;\n" " frameptr = $arg4\n" "}\n" -"probe python.function.return = process(\"python\")." -"mark(\"function__return\")\n" +"probe python.function.return = " +"process(\"python\").mark(\"function__return\")\n" "{\n" " filename = user_string($arg1);\n" " funcname = user_string($arg2);\n" @@ -564,17 +720,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 +746,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 +768,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 +810,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..0c16f432e 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 @@ -116,9 +116,9 @@ msgid "" "value:" msgstr "" "アドレスは多くの場合「ホストアドレス」と呼ばれ、IPアドレッシングを扱う場合の" -"最も基本的な単位です。アドレスを作成する単純な方法は :func:`ipaddress." -"ip_address` ファクトリー関数を使用することで、この方法では渡された値をもとに" -"IPv4かIPv6アドレスのどちらかを自動的に決定します:" +"最も基本的な単位です。アドレスを作成する単純な方法" +"は :func:`ipaddress.ip_address` ファクトリー関数を使用することで、この方法で" +"は渡された値をもとにIPv4かIPv6アドレスのどちらかを自動的に決定します:" #: ../../howto/ipaddress.rst:61 msgid "" @@ -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,15 +156,20 @@ 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 " +"Host addresses are usually grouped together into IP networks, " +"so :mod:`ipaddress` provides a way to create, inspect and manipulate network " "definitions. IP network objects are constructed from strings that define the " "range of host addresses that are part of that network. The simplest form for " "that information is a \"network address/network prefix\" pair, where the " @@ -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" @@ -268,11 +286,11 @@ msgid "" "network, neither the address nor the network classes are sufficient. " "Notation like ``192.0.2.1/24`` is commonly used by network engineers and the " "people who write tools for firewalls and routers as shorthand for \"the host " -"``192.0.2.1`` on the network ``192.0.2.0/24``\", Accordingly, :mod:" -"`ipaddress` provides a set of hybrid classes that associate an address with " -"a particular network. The interface for creation is identical to that for " -"defining network objects, except that the address portion isn't constrained " -"to being a network address." +"``192.0.2.1`` on the network ``192.0.2.0/24``\", " +"Accordingly, :mod:`ipaddress` provides a set of hybrid classes that " +"associate an address with a particular network. The interface for creation " +"is identical to that for defining network objects, except that the address " +"portion isn't constrained to being a network address." msgstr "" "直前に述べたように、特定のネットワーク上のアドレスを示したい場合には、アドレ" "スもネットワーククラスも十分ではありません。 ``192.0.2.1/24`` のような表記は" @@ -291,15 +309,14 @@ msgstr "" "整数入力は(ネットワークと同様に)受け入れられ、適切なコンストラクタを直接呼び" "出すことで特定のIPバージョンの使用を強制できます。" -#: ../../howto/ipaddress.rst:157 msgid "Inspecting Address/Network/Interface Objects" -msgstr "アドレス/ネットワーク/インターフェースオブジェクト" +msgstr "アドレス/ネットワーク/インターフェースオブジェクトの情報を調べる" #: ../../howto/ipaddress.rst:159 msgid "" "You've gone to the trouble of creating an IPv(4|6)(Address|Network|" -"Interface) object, so you probably want to get information about it. :mod:" -"`ipaddress` tries to make doing this easy and intuitive." +"Interface) object, so you probably want to get information about " +"it. :mod:`ipaddress` tries to make doing this easy and intuitive." msgstr "" "さて、IPv(4|6)(アドレス|ネットワーク|インターフェース)オブジェクトをわざわざ" "作成したので、多分それについて情報がほしいことでしょう。 :mod:`ipaddress` は" @@ -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,32 +509,37 @@ 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 "" "A :exc:`TypeError` exception is raised if you try to compare objects of " "different versions or different types." msgstr "" -"異なるバージョンや異なるタイプのオブジェクトを比較しようとすると :exc:" -"`TypeError` 例外が発生します。" +"異なるバージョンや異なるタイプのオブジェクトを比較しようとする" +"と :exc:`TypeError` 例外が発生します。" #: ../../howto/ipaddress.rst:282 msgid "Using IP Addresses with other modules" @@ -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,25 +580,26 @@ 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 "" "To support use cases where it is useful to have access to this additional " -"detail, the individual class constructors actually raise the :exc:" -"`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:" -"`ipaddress.NetmaskValueError` to indicate exactly which part of the " +"detail, the individual class constructors actually raise " +"the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` " +"and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the " "definition failed to parse correctly." msgstr "" "追加の詳細を得ると役立つ場合のユースケースに対応するため、個別のクラスのコン" -"ストラクタは実際に :exc:`ValueError` のサブクラスである :exc:`ipaddress." -"AddressValueError` と :exc:`ipaddress.NetmaskValueError` を発生させて具体的に" -"定義のどの部分のパースに失敗したのかを示します。" +"ストラクタは実際に :exc:`ValueError` のサブクラスであ" +"る :exc:`ipaddress.AddressValueError` と :exc:`ipaddress.NetmaskValueError` " +"を発生させて具体的に定義のどの部分のパースに失敗したのかを示します。" #: ../../howto/ipaddress.rst:311 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..cbbb03006 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`." +"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,39 @@ 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." +"`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 +455,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 +484,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 +513,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 +566,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 +573,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 +593,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." +"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." +"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 +680,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." +"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 +717,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`)." +":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``." +"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 +774,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`." +"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 +826,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." +"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`::" +"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``:" +"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 +981,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::" +"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 +1012,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,32 +1050,40 @@ 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:" -"`~PyTypeObject.tp_new` for initialization—have a very simple API that " -"doesn't allow passing in the defining class, unlike with :c:type:" -"`PyCMethod`. The same goes for getters and setters defined with :c:type:" -"`PyGetSetDef`." +"Slot methods—the fast C equivalents for special methods, such " +"as :c:member:`~PyNumberMethods.nb_add` for :py:attr:`~object.__add__` " +"or :c:member:`~PyTypeObject.tp_new` for initialization—have a very simple " +"API that doesn't allow passing in the defining class, unlike " +"with :c:type:`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::" +"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,49 +1091,65 @@ 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 " -"module. However, you must be careful in reference counting when you " -"reference module state from other places, such as callbacks for external " -"libraries." +"Usually this is not an issue, because types created " +"with :c:func:`PyType_FromModuleAndSpec`, and their instances, hold a " +"reference to the module. However, you must be careful in reference counting " +"when you 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 +1160,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:632 msgid "Per-Class Scope" -msgstr "" +msgstr "クラスごとのスコープ" #: ../../howto/isolating-extensions.rst:634 msgid "" @@ -926,12 +1170,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..df2af78ed 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 @@ -45,8 +45,8 @@ msgid "" "please see :ref:`cookbook-ref-links`." msgstr "" "このページは、過去に有用であるとされていた、logging に関連するいくつものレシ" -"ピを含んでいます。チュートリアルやリファレンス情報へのリンクについては :ref:" -"`cookbook-ref-links` を参照してください。" +"ピを含んでいます。チュートリアルやリファレンス情報へのリンクについて" +"は :ref:`cookbook-ref-links` を参照してください。" #: ../../howto/logging-cookbook.rst:16 msgid "Using logging in multiple modules" @@ -71,7 +71,6 @@ msgstr "" "ない) ことが可能で、すべての子 logger への呼び出しは親にまで渡されます。まず" "はメインのモジュールです::" -#: ../../howto/logging-cookbook.rst:26 msgid "" "import logging\n" "import auxiliary_module\n" @@ -86,8 +85,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\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" @@ -118,8 +146,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = logging.getLogger('spam_application.auxiliary." -"Auxiliary')\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" @@ -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" @@ -183,8 +247,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " -"%(threadName)s %(message)s')\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" @@ -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" @@ -270,8 +375,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\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 "" @@ -339,8 +470,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s " -"%(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s %" +"(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -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 "" @@ -564,17 +759,17 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the ``__main__." -"filter_maker`` in the filter configuration. You will need to change that if " -"you define it in a different module." +"command line, so its module will be ``__main__`` - hence the " +"``__main__.filter_maker`` in the filter configuration. You will need to " +"change that if you define it in a different module." msgstr "" "この関数は引数として与えられた文字列をログレベルの数値に変換し、ログレコード" "内のログレベルが指定されたレベル以下の場合に ``True`` を返す関数を返します。" "この例では ``filter_maker`` をコマンドラインから実行するテストスクリプト " "``main.py`` で関数が定義されているため、フィルター設定上のモジュール名は " -"``__main__`` になります。そのためフィルター設定の中では ``__main__." -"filter_maker`` となります。異なるモジュールで関数を定義した場合、この部分を変" -"更する必要があります。" +"``__main__`` になります。そのためフィルター設定の中では " +"``__main__.filter_maker`` となります。異なるモジュールで関数を定義した場合、" +"この部分を変更する必要があります。" #: ../../howto/logging-cookbook.rst:387 msgid "With the filter added, we can run ``main.py``, which in full is:" @@ -582,7 +777,6 @@ msgstr "" "フィルターを追加した ``main.py`` の全体像は以下のようになり、これで実行できる" "状態になりました:" -#: ../../howto/logging-cookbook.rst:389 msgid "" "import json\n" "import logging\n" @@ -650,20 +844,83 @@ msgid "" "logging.error('An ERROR message')\n" "logging.critical('A CRITICAL message')" msgstr "" +"import json\n" +"import logging\n" +"import logging.config\n" +"\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 "これを以下のように実行します:" -#: ../../howto/logging-cookbook.rst:459 msgid "python main.py 2>stderr.log >stdout.log" -msgstr "" +msgstr "python main.py 2>stderr.log >stdout.log" #: ../../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" @@ -685,6 +942,25 @@ msgid "" "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" @@ -694,7 +970,6 @@ msgstr "設定サーバの例" msgid "Here is an example of a module using the logging configuration server::" msgstr "ログ記録設定サーバを使うモジュールの例です::" -#: ../../howto/logging-cookbook.rst:493 msgid "" "import logging\n" "import logging.config\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" @@ -772,21 +1089,22 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is the :class:" -"`SMTPHandler`: sending emails can take a long time, for a number of reasons " -"outside the developer's control (for example, a poorly performing mail or " -"network infrastructure). But almost any network-based handler can block: " -"Even a :class:`SocketHandler` operation may do a DNS query under the hood " -"which is too slow (and this query can be deep in the socket library code, " -"below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is " +"the :class:`SMTPHandler`: sending emails can take a long time, for a number " +"of reasons outside the developer's control (for example, a poorly performing " +"mail or network infrastructure). But almost any network-based handler can " +"block: Even a :class:`SocketHandler` operation may do a DNS query under the " +"hood which is too slow (and this query can be deep in the socket library " +"code, below the Python layer, and outside your control)." msgstr "" "動作が鈍くなるときの元凶はたいてい、開発者のコントロール外にあるいくつもの理" -"由で (例えば、残念なパフォーマンスのメールやネットワークのインフラ) 、 :" -"class:`SMTPHandler`: が電子メールを送るのに時間がかかることです。しかし、ほと" -"んどのネットワークをまたぐ handler はブロックする可能性があります: :class:" -"`SocketHandler` による処理でさえ、裏で DNS への問い合わせというとても遅い処理" -"を行うことがあります (そしてこの問い合わせ処理は、 Python の層より下のあなた" -"の手の届かない、ソケットライブラリの深いところにある可能性もあります)。" +"由で (例えば、残念なパフォーマンスのメールやネットワークのインフ" +"ラ) 、 :class:`SMTPHandler`: が電子メールを送るのに時間がかかることです。しか" +"し、ほとんどのネットワークをまたぐ handler はブロックする可能性がありま" +"す: :class:`SocketHandler` による処理でさえ、裏で DNS への問い合わせというと" +"ても遅い処理を行うことがあります (そしてこの問い合わせ処理は、 Python の層よ" +"り下のあなたの手の届かない、ソケットライブラリの深いところにある可能性もあり" +"ます)。" #: ../../howto/logging-cookbook.rst:563 msgid "" @@ -813,18 +1131,19 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. A :class:" -"`QueueListener` is very simple: it's passed a queue and some handlers, and " -"it fires up an internal thread which listens to its queue for LogRecords " -"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " -"matter). The ``LogRecords`` are removed from the queue and passed to the " -"handlers for processing." -msgstr "" -"2つ目のパートは :class:`QueueHandler` の対向として作られた :class:" -"`QueueListener` です。 :class:`QueueListener` はとてもシンプルで、キューと " -"handler を渡され、内部で ``QueueHandler`` (もしくは他の ``LogRecord`` の出力" -"元) から送られた LogRecord をキューから受け取るスレッドを起動します。 " -"``LogRecord`` をキューから取り出して、 handler に渡して処理させます。" +"designed as the counterpart to :class:`QueueHandler`. " +"A :class:`QueueListener` is very simple: it's passed a queue and some " +"handlers, and it fires up an internal thread which listens to its queue for " +"LogRecords sent from ``QueueHandlers`` (or any other source of " +"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " +"queue and passed to the handlers for processing." +msgstr "" +"2つ目のパートは :class:`QueueHandler` の対向として作られ" +"た :class:`QueueListener` です。 :class:`QueueListener` はとてもシンプルで、" +"キューと handler を渡され、内部で ``QueueHandler`` (もしくは他の " +"``LogRecord`` の出力元) から送られた LogRecord をキューから受け取るスレッドを" +"起動します。 ``LogRecord`` をキューから取り出して、 handler に渡して処理させ" +"ます。" #: ../../howto/logging-cookbook.rst:582 msgid "" @@ -843,7 +1162,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,35 +1179,47 @@ 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 " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done from :mod:" -"`asyncio` internals. It might be best, if any async code is used in an " -"application, to use the above approach for logging, so that any blocking " -"code runs only in the ``QueueListener`` thread." -msgstr "" -"上述の議論は特に同期コードにについてのものではなく、むしろ遅いロギングハンド" -"ラについてでしたが、非同期コードやネットワーク、あるいはファイルハンドラから" -"のロギングでさえも (イベントループをブロックしてしまう) 問題につながる可能性" -"があることには注意すべきでしょう。これはいくつかのロギングが :mod:`asyncio` " -"内部で行われることが理由です。何らかの非同期コードがアプリケーションの中で使" -"われている場合、ロギングには上記のアプローチを使っていかなるブロッキングコー" -"ドも ``QueueListener`` スレッド内だけで実行されるようにしておくことが最も良い" -"でしょう。" - -#: ../../howto/logging-cookbook.rst:619 +"problems (blocking the event loop) because some logging is done " +"from :mod:`asyncio` internals. It might be best, if any async code is used " +"in an application, to use the above approach for logging, so that any " +"blocking code runs only in the ``QueueListener`` thread." +msgstr "" +"ここまでは特に非同期コードを対象とせず、処理の遅いロギングハンドラについて説" +"明しました。\n" +"ただし、非同期コードからログを出力する場合、ネットワークハンドラだけでなく" +"ファイルハンドラも、イベントループをブロックして問題を起こす可能性がありま" +"す。\n" +":mod:`asyncio` の内部でもログが出力されるためです。\n" +"アプリケーションで非同期コードを使う場合は、ブロックする処理が " +"``QueueListener`` スレッド内だけで実行されるよう、上記の方法を使うのがよいで" +"しょう。" + 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 +1230,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:" +"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 +1254,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" @@ -932,8 +1268,8 @@ msgstr "ネットワーク越しの logging イベントの送受信" #: ../../howto/logging-cookbook.rst:647 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching a :class:" -"`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching " +"a :class:`SocketHandler` instance to the root logger at the sending end::" msgstr "" "ログイベントをネットワーク越しに送信し、受信端でそれを処理したいとしましょ" "う。 :class:`SocketHandler` インスタンスを送信端の root logger にアタッチすれ" @@ -969,13 +1305,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:675 msgid "" -"At the receiving end, you can set up a receiver using the :mod:" -"`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using " +"the :mod:`socketserver` module. Here is a basic working example::" msgstr "" "受信端では :mod:`socketserver` モジュールを使って受信プログラムを作成しておき" "ます。簡単な実用プログラムを以下に示します::" -#: ../../howto/logging-cookbook.rst:678 msgid "" "import pickle\n" "import logging\n" @@ -1056,8 +1391,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " -"%(message)s')\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" @@ -1065,6 +1400,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 +1496,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 +1504,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 +1524,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 +1612,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 "" @@ -1212,8 +1636,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:824 msgid "" -"Download `the Gist `__ as a ZIP archive using the :" -"guilabel:`Download ZIP` button." +"Download `the Gist `__ as a ZIP archive using " +"the :guilabel:`Download ZIP` button." msgstr "" ":guilabel:`Download ZIP` ボタンを押して `Gist `__ を " "ZIP アーカイブとしてダウンロードしてください。" @@ -1230,8 +1654,8 @@ msgid "" "which ``bottle``, ``gunicorn`` and ``supervisor`` are installed." msgstr "" "準備のために、スクラッチディレクトリにおいて ``bash prepare.sh`` を実行してく" -"ださい。これにより Supervisor 関連のファイルおよびログファイルのための :file:" -"`run` サブディレクトリ、および ``bottle``, ``gunicorn`` そして " +"ださい。これにより Supervisor 関連のファイルおよびログファイルのため" +"の :file:`run` サブディレクトリ、および ``bottle``, ``gunicorn`` そして " "``supervisor`` がインストールされる仮想環境を含む :file:`venv` サブディレクト" "リが生成されます。" @@ -1243,13 +1667,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 "" @@ -1268,8 +1692,8 @@ msgid "" "You can shut down the listener and the web application by running ``venv/bin/" "supervisorctl -c supervisor.conf shutdown``." msgstr "" -"リスナーと web アプリケーションは ``venv/bin/supervisorctl -c supervisor." -"conf shutdown`` を実行することでシャットダウンできます。" +"リスナーと web アプリケーションは ``venv/bin/supervisorctl -c " +"supervisor.conf shutdown`` を実行することでシャットダウンできます。" #: ../../howto/logging-cookbook.rst:848 msgid "" @@ -1279,32 +1703,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 " @@ -1316,20 +1744,21 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"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` インスタンス" -"の個数が事実上無制限にならないと、管理が難しくなります。" +"logging an application, it could be hard to manage if the number " +"of :class:`Logger` instances becomes effectively unbounded." +msgstr "" +"ログ呼び出しに渡す引数に加えて、コンテキスト情報もログに含めたい場合がありま" +"す。\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" @@ -1339,29 +1768,29 @@ msgstr "LoggerAdapter を使ったコンテキスト情報の伝達" msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can call :" -"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" -"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " -"signatures as their counterparts in :class:`Logger`, so you can use the two " -"types of instances interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can " +"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " +"and :meth:`log`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" "logging イベントの情報と一緒に出力されるコンテキスト情報を渡す簡単な方法" "は、 :class:`LoggerAdapter` を使うことです。このクラスは :class:`Logger` のよ" -"うに見えるように設計されていて、 :meth:`debug`, :meth:`info`, :meth:" -"`warning`, :meth:`error`, :meth:`exception`, :meth:`critical`, :meth:`log` の" -"各メソッドを呼び出せるようになっています。これらのメソッドは対応する :class:" -"`Logger` のメソッドと同じ引数を取るので、二つの型を取り替えて使うことができま" -"す。" +"うに見えるように設計されてい" +"て、 :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical`, :meth:`log` " +"の各メソッドを呼び出せるようになっています。これらのメソッドは対応す" +"る :class:`Logger` のメソッドと同じ引数を取るので、二つの型を取り替えて使うこ" +"とができます。" #: ../../howto/logging-cookbook.rst:896 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" -"`Logger` instance and a dict-like object which contains your contextual " -"information. When you call one of the logging methods on an instance of :" -"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" -"class:`Logger` passed to its constructor, and arranges to pass the " -"contextual information in the delegated call. Here's a snippet from the code " -"of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it " +"a :class:`Logger` instance and a dict-like object which contains your " +"contextual information. When you call one of the logging methods on an " +"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " +"instance of :class:`Logger` passed to its constructor, and arranges to pass " +"the contextual information in the delegated call. Here's a snippet from the " +"code of :class:`LoggerAdapter`::" msgstr "" ":class:`LoggerAdapter` のインスタンスを生成する際には、 :class:`Logger` イン" "スタンスとコンテキスト情報を収めた辞書風 (dict-like) のオブジェクトを渡しま" @@ -1370,7 +1799,6 @@ msgstr "" "スト情報をその委譲された呼び出しに埋め込みます。 :class:`LoggerAdapter` の" "コードから少し抜き出してみます::" -#: ../../howto/logging-cookbook.rst:904 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -1380,6 +1808,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 "" @@ -1408,19 +1843,19 @@ msgid "" "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" -"`~LoggerAdapter.process` to do what you need. Here is a simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and " +"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " +"simple example::" msgstr "" "\"extra\" を用いる利点は辞書風オブジェクトの中の値が :class:`LogRecord` イン" "スタンスの __dict__ にマージされることで、辞書風オブジェクトのキーを知ってい" "る :class:`Formatter` を用意して文字列をカスタマイズするようにできることで" "す。それ以外のメソッドが必要なとき、たとえばコンテキスト情報をメッセージの前" -"や後ろにつなげたい場合には、 :class:`LoggerAdapter` から :meth:" -"`~LoggerAdapter.process` を望むようにオーバライドしたサブクラスを作ることが必" -"要なだけです。次に挙げるのはこのクラスを使った例で、コンストラクタで使われる" -"「辞書風」オブジェクトにどの振る舞いが必要なのかも示しています::" +"や後ろにつなげたい場合には、 :class:`LoggerAdapter` か" +"ら :meth:`~LoggerAdapter.process` を望むようにオーバライドしたサブクラスを作" +"ることが必要なだけです。次に挙げるのはこのクラスを使った例で、コンストラクタ" +"で使われる「辞書風」オブジェクトにどの振る舞いが必要なのかも示しています::" -#: ../../howto/logging-cookbook.rst:929 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -1430,16 +1865,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 "" @@ -1472,27 +1915,28 @@ msgstr "Filter を使ったコンテキスト情報の伝達" #: ../../howto/logging-cookbook.rst:959 msgid "" -"You can also add contextual information to log output using a user-defined :" -"class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-" +"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a custom :" -"class:`Formatter`." +"can then be output using a suitable format string, or if needed a " +"custom :class:`Formatter`." msgstr "" "ユーザ定義の :class:`Filter` を使ってログ出力にコンテキスト情報を加えることも" "できます。 ``Filter`` インスタンスは、渡された ``LogRecords`` を修正すること" -"ができます。これにより、適切なフォーマット文字列や必要なら :class:" -"`Formatter` を使って、出力となる属性を新しく追加することも出来ます。" +"ができます。これにより、適切なフォーマット文字列や必要な" +"ら :class:`Formatter` を使って、出力となる属性を新しく追加することも出来ま" +"す。" #: ../../howto/logging-cookbook.rst:964 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal (:class:" -"`threading.local`) variable, and then accessed from a ``Filter`` to add, " -"say, information from the request - say, the remote IP address and remote " -"user's username - to the ``LogRecord``, using the attribute names 'ip' and " -"'user' as in the ``LoggerAdapter`` example above. In that case, the same " -"format string can be used to get similar output to that shown above. Here's " -"an example script::" +"the interesting parts of it) can be stored in a threadlocal " +"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " +"add, say, information from the request - say, the remote IP address and " +"remote user's username - to the ``LogRecord``, using the attribute names " +"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " +"same format string can be used to get similar output to that shown above. " +"Here's an example script::" msgstr "" "例えば、web アプリケーションで、処理されるリクエスト (または、少なくともその" "重要な部分) は、スレッドローカル (:class:`threading.local`) な変数に保存し" @@ -1502,7 +1946,6 @@ msgstr "" "といったようにです。その場合、同じフォーマット文字列を使って以下に示すように" "似たような出力を得られます。これはスクリプトの例です::" -#: ../../howto/logging-cookbook.rst:973 msgid "" "import logging\n" "from random import choice\n" @@ -1544,12 +1987,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 +2057,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 +2094,12 @@ 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 +2122,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 +2135,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 "" @@ -1672,8 +2186,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from 192.168.2." -"XXX\n" +"# from this list randomly. Note that all GET requests are from " +"192.168.2.XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1691,8 +2205,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " -"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" +"(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1799,7 +2313,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,15 +2322,15 @@ 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 アプリケーション固" -"有のログはそれぞれのアプリケーションからのログエントリだけを含み、リクエスト" -"情報が矛盾なくログに表示されている (すなわち、各ダミーリクエストの情報は常に" -"ログの行とともに現れる) はずです。このことは以下のシェルコマンドの出力により" -"例示されています:" +"上のコードを実行すると、リクエストのおよそ半分が :file:`app1.log` に、残り" +"が :file:`app2.log` に記録され、すべてのリクエストが :file:`app.log` にも記録" +"されます。\n" +"各 Web アプリケーション専用のログには、そのアプリケーションのログエントリだけ" +"が含まれます。\n" +"また、リクエストの情報は一貫して表示されます。\n" +"つまり、各ダミーリクエストの情報は常に同じログ行にまとまって現れます。\n" +"次のシェル出力で確認できます:" -#: ../../howto/logging-cookbook.rst:1210 msgid "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" @@ -1871,24 +2384,74 @@ msgid "" "~/logging-contextual-webapp$ grep app2 app.log | wc -l\n" "147" msgstr "" - -#: ../../howto/logging-cookbook.rst:1250 -msgid "Imparting contextual information in handlers" -msgstr "ハンドラ内でのコンテキスト情報の付与" - -#: ../../howto/logging-cookbook.rst:1252 -msgid "" -"Each :class:`~Handler` has its own chain of filters. If you want to add " +"~/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" + +#: ../../howto/logging-cookbook.rst:1250 +msgid "Imparting contextual information in handlers" +msgstr "ハンドラ内でのコンテキスト情報の付与" + +#: ../../howto/logging-cookbook.rst:1252 +msgid "" +"Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " "handlers, you can use a filter that returns a new :class:`~LogRecord` " "instead of modifying it in-place, as shown in the following script::" msgstr "" ":class:`~Handler` はそれぞれ一連のフィルタを独自に持っています。コンテキスト" "情報を、他のハンドラに漏らすことなく :class:`LogRecord` に付加したい場合、以" -"下に示すスクリプトのように、直接レコードを編集する代わりに新しい :class:" -"`~LogRecord` を返すフィルタを使うことができます::" +"下に示すスクリプトのように、直接レコードを編集する代わりに新し" +"い :class:`~LogRecord` を返すフィルタを使うことができます::" -#: ../../howto/logging-cookbook.rst:1257 msgid "" "import copy\n" "import logging\n" @@ -1909,12 +2472,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 " @@ -1924,31 +2504,37 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this function.) :ref:" -"`This section ` documents this approach in more detail and " -"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 -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 "" +"thread in one of the existing processes to perform this " +"function.) :ref:`This section ` documents this approach in " +"more detail and includes a working socket receiver which can be used as a " +"starting point for you to adapt in your own applications." +msgstr "" +"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 +2559,6 @@ msgstr "" "listener とアプリケーション内の他のプロセスで完全に異なる設定を使う例になって" "いるので、各自の要求に応じたコードを書く叩き台になるでしょう::" -#: ../../howto/logging-cookbook.rst:1312 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -2006,8 +2591,8 @@ msgid "" "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" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" +"(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -2092,6 +2677,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 +2792,6 @@ msgid "" "separate thread::" msgstr "上のスクリプトの亜種で、logging をメインプロセスの別スレッドで行う例::" -#: ../../howto/logging-cookbook.rst:1420 msgid "" "import logging\n" "import logging.config\n" @@ -2139,8 +2831,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -2195,6 +2887,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 "" @@ -2221,29 +3006,28 @@ msgid "" "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -"もし、ワーカープロセスを起動するために :class:`concurrent.futures." -"ProcessPoolExecutor` を使いたいのであれば、少し違う方法でキューを作る必要があ" -"ります。次のような方法の代わりに" +"もし、ワーカープロセスを起動するため" +"に :class:`concurrent.futures.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 +3038,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 +3053,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" @@ -2283,15 +3077,15 @@ msgid "" "process management tool such as Supervisor - see `Running a logging socket " "listener in production`_ for more details." msgstr "" -"`Gunicorn `_ や `uWSGI `_ (またはそれに類するもの) を使って Web アプリケー" -"ションをデプロイする場合、クライアントのリクエストを処理するために複数のワー" -"カープロセスが作られます。そのような環境では、 web アプリケーションに直接ファ" -"イルベースのハンドラを作ることは避けてください。 代わりに、 :class:" -"`SocketHandler` を使って別のプロセスとして動作するリスナーに web アプリケー" -"ションからログを送信するようにしてください。これは Supervisor のようなプロセ" -"ス管理ツールを使うことで設定できます - 詳しくは `作成中のロギングソケットの" -"リスナーを実行する`_ を参照してください。" +"`Gunicorn `_ や `uWSGI `_ (またはそれに類するもの) を使って Web アプ" +"リケーションをデプロイする場合、クライアントのリクエストを処理するために複数" +"のワーカープロセスが作られます。そのような環境では、 web アプリケーションに直" +"接ファイルベースのハンドラを作ることは避けてください。 代わり" +"に、 :class:`SocketHandler` を使って別のプロセスとして動作するリスナーに web " +"アプリケーションからログを送信するようにしてください。これは Supervisor のよ" +"うなプロセス管理ツールを使うことで設定できます - 詳しくは `作成中のロギング" +"ソケットのリスナーを実行する`_ を参照してください。" #: ../../howto/logging-cookbook.rst:1565 msgid "Using file rotation" @@ -2311,7 +3105,6 @@ msgstr "" "利用パターンのために、 logging パッケージは :class:`RotatingFileHandler` を提" "供しています::" -#: ../../howto/logging-cookbook.rst:1576 msgid "" "import glob\n" "import logging\n" @@ -2339,6 +3132,31 @@ msgid "" "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" +"# 目的の出力レベルを持つロガーを設定する\n" +"my_logger = logging.getLogger('MyLogger')\n" +"my_logger.setLevel(logging.DEBUG)\n" +"\n" +"# ログメッセージのハンドラーをロガーに追加する\n" +"handler = logging.handlers.RotatingFileHandler(\n" +" LOG_FILENAME, maxBytes=20, backupCount=5)\n" +"\n" +"my_logger.addHandler(handler)\n" +"\n" +"# メッセージを記録する\n" +"for i in range(20):\n" +" my_logger.debug('i = %d' % i)\n" +"\n" +"# 作成されたファイルを確認する\n" +"logfiles = glob.glob('%s*' % LOG_FILENAME)\n" +"\n" +"for filename in logfiles:\n" +" print(filename)" #: ../../howto/logging-cookbook.rst:1602 msgid "" @@ -2348,7 +3166,6 @@ msgstr "" "この結果として、アプリケーションのログ履歴の一部である、6 つに別れたファイル" "が得られます:" -#: ../../howto/logging-cookbook.rst:1605 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2357,6 +3174,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 "" @@ -2386,9 +3209,9 @@ msgstr "別の format スタイルを利用する" msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting approaches: :class:" -"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " -"Python 2.6)." +"method. Since then, Python has gained two new formatting " +"approaches: :class:`string.Template` (added in Python 2.4) " +"and :meth:`str.format` (added in Python 2.6)." msgstr "" "logging が Python 標準ライブラリに追加された時、メッセージを動的な内容で" "フォーマットする唯一の方法は % を使ったフォーマットでした。その後、 Python に" @@ -2403,9 +3226,9 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work with :" -"meth:`str.format` or :class:`string.Template`. Here's an example console " -"session to show the possibilities:" +"parameter, you get the ability to specify format strings which work " +"with :meth:`str.format` or :class:`string.Template`. Here's an example " +"console session to show the possibilities:" msgstr "" "logging は (3.2 から) この2つの追加されたフォーマット方法をサポートしていま" "す。 :class:`Formatter` クラスが ``style`` という名前のオプションのキーワード" @@ -2415,7 +3238,6 @@ msgstr "" "で、 :meth:`str.format` か :class:`string.Template` を使った format を指定す" "る事ができます。次の例はこの機能を使ってみています:" -#: ../../howto/logging-cookbook.rst:1645 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2439,6 +3261,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 +3293,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 "" @@ -2465,22 +3310,22 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` or :class:" -"`string.Template` syntax, because internally the logging package uses %-" -"formatting to merge the format string and the variable arguments. There " -"would be no changing this while preserving backward compatibility, since all " -"logging calls which are out there in existing code will be using %-format " -"strings." +"you cannot directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" "logging の呼び出し (``logger.debug()`` や ``logger.info()`` など) は、ログ" "メッセージのために位置引数しか受け取らず、キーワード引数はそれを処理するとき" "のオプションを指定するためだけに使われます。 (例えば、 ``exc_info`` キーワー" "ド引数を使ってログを取るトレースバック情報を指定したり、 ``extra`` キーワード" "引数を使ってログに付与する追加のコンテキスト情報を指定します。) logging パッ" -"ケージは内部で % を使って format 文字列と引数をマージしているので、 :meth:" -"`str.format` や :class:`string.Template` を使って logging を呼び出す事はでき" -"ません。既存の logging 呼び出しは %-format を使っているので、後方互換性のため" -"にこの部分を変更することはできません。" +"ケージは内部で % を使って format 文字列と引数をマージしているの" +"で、 :meth:`str.format` や :class:`string.Template` を使って logging を呼び出" +"す事はできません。既存の logging 呼び出しは %-format を使っているので、後方互" +"換性のためにこの部分を変更することはできません。" #: ../../howto/logging-cookbook.rst:1690 msgid "" @@ -2495,7 +3340,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 +3359,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 +3404,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 +3421,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 +3472,6 @@ msgstr "" "次の例のように、 :class:`LoggerAdapter` を利用して上と似たような効果を実現す" "る方法もあります::" -#: ../../howto/logging-cookbook.rst:1759 msgid "" "import logging\n" "\n" @@ -2625,6 +3499,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,60 +3537,61 @@ 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:" -"`LogRecord` is created, populated with information about the event and then " -"passed to the handlers for that logger (and its ancestors, up to and " -"including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, " +"a :class:`LogRecord` is created, populated with information about the event " +"and then passed to the handlers for that logger (and its ancestors, up to " +"and including the logger where further propagation up the hierarchy is " "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 "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" -"`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via " +"an :class:`~handlers.HTTPHandler`)." msgstr "" ":func:`makeLogRecord`: LogRecord に追加される属性を含む辞書を渡して呼び出され" -"ます。これはネットワーク越しに (pickle 形式で :class:`~handlers." -"SocketHandler` 経由で、あるいは JSON 形式で :class:`~handlers.HTTPHandler` 経" -"由で) 辞書を受け取った場合などに利用されます。" +"ます。これはネットワーク越しに (pickle 形式" +"で :class:`~handlers.SocketHandler` 経由で、あるいは JSON 形式" +"で :class:`~handlers.HTTPHandler` 経由で) 辞書を受け取った場合などに利用され" +"ます。" #: ../../howto/logging-cookbook.rst:1812 msgid "" -"This has usually meant that if you need to do anything special with a :class:" -"`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with " +"a :class:`LogRecord`, you've had to do one of the following." 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." +"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 +3627,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 "" @@ -2750,17 +3649,17 @@ msgstr "" msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" -"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " -"signature as the :class:`~logging.LogRecord` constructor, as :class:" -"`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate " +"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " +"same signature as the :class:`~logging.LogRecord` constructor, " +"as :class:`LogRecord` is the default setting for the factory." msgstr "" "Python 3.2 以降では、 :class:`~logging.LogRecord` の生成は、指定できるファク" -"トリ経由になります。ファクトリは callable で、 :func:`~logging." -"setLogRecordFactory` で登録でき、 :func:`~logging.getLogRecordFactory` で現在" -"のファクトリを取得できます。ファクトリは :class:`~logging.LogRecord` コンスト" -"ラクタと同じシグネチャで呼び出され、 :class:`LogRecord` がデフォルトのファク" -"トリとして設定されています。" +"トリ経由になります。ファクトリは callable " +"で、 :func:`~logging.setLogRecordFactory` で登録で" +"き、 :func:`~logging.getLogRecordFactory` で現在のファクトリを取得できます。" +"ファクトリは :class:`~logging.LogRecord` コンストラクタと同じシグネチャで呼び" +"出され、 :class:`LogRecord` がデフォルトのファクトリとして設定されています。" #: ../../howto/logging-cookbook.rst:1848 msgid "" @@ -2805,16 +3704,15 @@ msgstr "" "このアプローチでは複数の異なるライブラリがファクトリをチェインさせて、お互い" "に同じ属性を上書きしたり、標準で提供されている属性を意図せず上書きしない限り" "はうまくいきます。しかし、チェインのつながり全てが、全ての logging の操作に対" -"しての実行時のオーバーヘッドになることを念頭に置き、このテクニックは :class:" -"`Filter` を利用するだけでは望む結果が得られない場合にのみ使うべきです。" +"しての実行時のオーバーヘッドになることを念頭に置き、このテクニック" +"は :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 +3724,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 +3739,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 +3761,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 +3775,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,18 +3815,22 @@ 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 `_, billed as a spiritual successor to ZeroMQ. The following " -"snippets illustrate -- you can test them in an environment which has " -"``pynng`` installed. Just for variety, we present the listener first." -msgstr "" +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " +"following snippets illustrate -- you can test them in an environment which " +"has ``pynng`` installed. Just for variety, we present the listener first." +msgstr "" +"前の節と同様の方法で、:pypi:`pynng` を使ったリスナーとハンドラを実装できま" +"す。\n" +"これは、ZeroMQ の精神を受け継ぐ後継とされる `NNG `_ の Python バインディングです。\n" +"以下のコードは ``pynng`` をインストールした環境で試せます。\n" +"今回は順序を変えて、リスナーから示します。" #: ../../howto/logging-cookbook.rst:1947 msgid "" @@ -2970,7 +3894,6 @@ msgid "" " listener.stop()" msgstr "" -#: ../../howto/logging-cookbook.rst:2013 msgid "" "# sender.py\n" "import json\n" @@ -3003,8 +3926,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s " -"%(message)s')\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" @@ -3018,15 +3941,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 +4009,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 +4035,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 +4070,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" @@ -3099,16 +4104,65 @@ msgstr "辞書ベースで構成する例" msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_. This dictionary is passed to :" -"func:`~config.dictConfig` to put the configuration into effect::" +"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` に渡して設定を有効にします::" + +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 の構成です。この例は `Django プロジェクトのド" -"キュメント `_ から持ってきました。この辞書を :func:`~config." -"dictConfig` に渡して設定を有効にします::" - -#: ../../howto/logging-cookbook.rst:2127 -msgid "" "LOGGING = {\n" " 'version': 1,\n" " 'disable_existing_loggers': False,\n" @@ -3158,7 +4212,6 @@ msgid "" " }\n" " }\n" "}" -msgstr "" #: ../../howto/logging-cookbook.rst:2176 msgid "" @@ -3182,7 +4235,6 @@ msgstr "" "namer と rotator を定義する方法の例は以下の実行可能なスクリプトに示されていま" "す。ここではログファイルを gzip により圧縮する例を示しています::" -#: ../../howto/logging-cookbook.rst:2188 msgid "" "import gzip\n" "import logging\n" @@ -3213,6 +4265,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 +4301,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 +4310,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" @@ -3418,13 +4504,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " -"%(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" +"(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3541,15 +4627,15 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2478 msgid "" -"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." -"handlers.SysLogHandler` instance, with a format string such as::" +"Attach a :class:`~logging.Formatter` instance to " +"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " +"such as::" 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 "" @@ -3589,9 +4675,9 @@ msgid "" msgstr "" "フォーマットされた message は ``SysLogHandler`` によって UTF-8 でエンコードさ" "れます。上のルールに従えば、RFC 5424 準拠のメッセージを生成できます。上のルー" -"ルに従わない場合、logging は何もエラーを起こしませんが、message は :rfc:" -"`5424` に準拠しない形で送られるので、syslog デーモン側で何かエラーが起こる可" -"能性があります。" +"ルに従わない場合、logging は何もエラーを起こしませんが、message " +"は :rfc:`5424` に準拠しない形で送られるので、syslog デーモン側で何かエラーが" +"起こる可能性があります。" #: ../../howto/logging-cookbook.rst:2502 msgid "Implementing structured logging" @@ -3616,7 +4702,6 @@ msgstr "" "実現する方法は幾つもありますが、次の例は JSON を使ってイベントを、機械でパー" "スできる形にシリアライズする単純な方法です::" -#: ../../howto/logging-cookbook.rst:2512 msgid "" "import json\n" "import logging\n" @@ -3634,16 +4719,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 +4760,6 @@ msgstr "" "より特殊な処理が必要な場合、次の例のように、カスタムの JSON エンコーダを作る" "ことができます::" -#: ../../howto/logging-cookbook.rst:2540 msgid "" "import json\n" "import logging\n" @@ -3691,20 +4791,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 +4840,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,16 +4855,22 @@ 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 "" -"You can then specify, in a logging configuration passed to :func:" -"`dictConfig`, that a logging handler be created by calling this function::" +"You can then specify, in a logging configuration passed " +"to :func:`dictConfig`, that a logging handler be created by calling this " +"function::" msgstr "" "そして、 :func:`dictConfig` に渡される構成設定の中で、この関数を使って " "logging handler を生成するように指定することができます::" -#: ../../howto/logging-cookbook.rst:2604 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3770,6 +4902,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 +4941,6 @@ msgstr "" "この例は説明用のものですが、owner の user と group を ``pulse`` に設定してい" "ます。これを動くスクリプトに ``chowntest.py`` に組み込んでみます::" -#: ../../howto/logging-cookbook.rst:2638 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3825,12 +4985,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,20 +5039,25 @@ 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 " -"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " -"With pre-3.3 versions, you would need to implement the actual ownership " -"change using e.g. :func:`os.chown`." +"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 version that supports :func:`dictConfig` - namely, Python " +"2.7, 3.2 or later. 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 +5067,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 "" @@ -3881,8 +5085,8 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" "``project.util`` は関数がある実際の場所に置き換えてください。上のスクリプトで" -"は ``'ext://__main__.owned_file_handler'`` で動くはずです。 :func:" -"`dictConfig` は ``ext://`` から実際の callable を見つけます。" +"は ``'ext://__main__.owned_file_handler'`` で動くはずで" +"す。 :func:`dictConfig` は ``ext://`` から実際の callable を見つけます。" #: ../../howto/logging-cookbook.rst:2711 msgid "" @@ -3890,8 +5094,9 @@ msgid "" "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -"この例は他のファイルに対する変更を実装する例にもなっています。例えば :func:" -"`os.chmod` を使って、同じ方法で POSIX パーミッションを設定できるでしょう。" +"この例は他のファイルに対する変更を実装する例にもなっています。例え" +"ば :func:`os.chmod` を使って、同じ方法で POSIX パーミッションを設定できるで" +"しょう。" #: ../../howto/logging-cookbook.rst:2715 msgid "" @@ -3918,11 +5123,11 @@ msgid "" msgstr "" "Python 3.2 では、:class:`~logging.Formatter` クラスが ``style`` という名前の" "オプションのキーワード引数を受け取ります。このデフォルト値は後方互換性を維持" -"するために ``%`` となっていますが、 ``{`` か ``$`` を指定することで、:meth:" -"`str.format` か :class:`string.Template` でサポートされているのと同じ書式化の" -"アプローチを採れます。これは最終的に出力されるログメッセージの書式化に影響を" -"与えますが、個々のログメッセージが構築される方法とは完全に直交していることに" -"注意してください。" +"するために ``%`` となっていますが、 ``{`` か ``$`` を指定すること" +"で、:meth:`str.format` か :class:`string.Template` でサポートされているのと同" +"じ書式化のアプローチを採れます。これは最終的に出力されるログメッセージの書式" +"化に影響を与えますが、個々のログメッセージが構築される方法とは完全に直交して" +"いることに注意してください。" #: ../../howto/logging-cookbook.rst:2734 msgid "" @@ -3932,11 +5137,12 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` or :class:`string." -"Template` syntax, because internally the logging package uses %-formatting " -"to merge the format string and the variable arguments. There would be no " -"changing this while preserving backward compatibility, since all logging " -"calls which are out there in existing code will be using %-format strings." +"directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" "ロギングの呼び出し (:meth:`~Logger.debug`, :meth:`~Logger.info` など) はログ" "メッセージのためには位置引数しか取らず、ロギングの呼び出しを処理する方法を決" @@ -3990,24 +5196,24 @@ msgid "" "code. Care should also be taken to call ``str(self.msg)``, just as the base " "implementation does." msgstr "" -"Python 3.2 において、上述した :class:`~logging.Formatter` の変更とともに、 :" -"func:`setLogRecordFactory` 関数を使って :class:`LogRecord` のサブクラスをユー" -"ザに指定することを可能にするロギングパッケージの機能拡張がありました。これに" -"より、 :meth:`~LogRecord.getMessage` をオーバライドして た だ し い こと" -"をする、あなた自身の手による :class:`LogRecord` のサブクラスをセットすること" -"が出来ます。このメソッドの実装は基底クラスでは ``msg % args`` 書式化をし、あ" -"なたの代替の書式化の置換が出来る場所ですが、他のコードとの相互運用性を保障す" -"るために、全ての書式化スタイルをサポートするよう注意深く行うべきであり、ま" -"た、%-書式化をデフォルトで認めるべきです。基底クラスの実装がそうしているよう" -"に、 ``str(self.msg)`` 呼び出しもしてください。" +"Python 3.2 において、上述した :class:`~logging.Formatter` の変更ととも" +"に、 :func:`setLogRecordFactory` 関数を使って :class:`LogRecord` のサブクラス" +"をユーザに指定することを可能にするロギングパッケージの機能拡張がありました。" +"これにより、 :meth:`~LogRecord.getMessage` をオーバライドして た だ し " +"い ことをする、あなた自身の手による :class:`LogRecord` のサブクラスをセット" +"することが出来ます。このメソッドの実装は基底クラスでは ``msg % args`` 書式化" +"をし、あなたの代替の書式化の置換が出来る場所ですが、他のコードとの相互運用性" +"を保障するために、全ての書式化スタイルをサポートするよう注意深く行うべきであ" +"り、また、%-書式化をデフォルトで認めるべきです。基底クラスの実装がそうしてい" +"るように、 ``str(self.msg)`` 呼び出しもしてください。" #: ../../howto/logging-cookbook.rst:2770 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` and :" -"class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` " +"and :class:`LogRecord` for more information." msgstr "" -"さらに詳しい情報は、リファレンスの :func:`setLogRecordFactory`, :class:" -"`LogRecord` を参照してください。" +"さらに詳しい情報は、リファレンス" +"の :func:`setLogRecordFactory`, :class:`LogRecord` を参照してください。" #: ../../howto/logging-cookbook.rst:2775 msgid "Using custom message objects" @@ -4016,18 +5222,18 @@ msgstr "カスタムなメッセージオブジェクトを使う" #: ../../howto/logging-cookbook.rst:2777 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall (from :ref:" -"`arbitrary-object-messages`) that when logging you can use an arbitrary " -"object as a message format string, and that the logging package will call :" -"func:`str` on that object to get the actual format string. Consider the " -"following two classes::" +"to construct your individual log messages. You may recall " +"(from :ref:`arbitrary-object-messages`) that when logging you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call :func:`str` on that object to get the actual format string. " +"Consider the following two classes::" msgstr "" "あなた独自のログメッセージを構築するのに {}- および $- 書式化を使えるようにす" "るための、もうひとつの、おそらくもっと簡単な方法があります。ロギングの際に" -"は、あなたはメッセージ書式文字列として、任意のオブジェクトを使えることを(:" -"ref:`arbitrary-object-messages` より)思い出してみましょう、そしてロギングパッ" -"ケージはそのオブジェクトに対して実際の書式文字列を得るために :func:`str` を呼" -"び出すことも。以下 2 つのクラスを検討してみましょう::" +"は、あなたはメッセージ書式文字列として、任意のオブジェクトを使えることを" +"(:ref:`arbitrary-object-messages` より)思い出してみましょう、そしてロギング" +"パッケージはそのオブジェクトに対して実際の書式文字列を得るために :func:`str` " +"を呼び出すことも。以下 2 つのクラスを検討してみましょう::" #: ../../howto/logging-cookbook.rst:2802 msgid "" @@ -4048,13 +5254,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2810 msgid "" -"Examples of this approach are given below. Firstly, formatting with :meth:" -"`str.format`::" +"Examples of this approach are given below. Firstly, formatting " +"with :meth:`str.format`::" msgstr "" "このアプローチによる例をお見せします。最初は :meth:`str.format` を使って" "フォーマットする例です::" -#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -4068,18 +5273,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,32 +5323,32 @@ 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). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your own :" -"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." -"filter` method. To do this, specify the ``()`` key in the configuration " -"dictionary for the filter, specifying a callable which will be used to " -"create the filter (a class is the most obvious, but you can provide any " -"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 を提供すること" -"でも出来ます)。以下に完全な例を示します::" - -#: ../../howto/logging-cookbook.rst:2858 +"only there as a base class), you will typically need to define your " +"own :class:`~logging.Filter` subclass with an " +"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " +"``()`` key in the configuration dictionary for the filter, specifying a " +"callable which will be used to create the filter (a class is the most " +"obvious, but you can provide any callable which returns " +"a :class:`~logging.Filter` instance). Here is a complete example::" +msgstr "" +":func:`~logging.config.dictConfig` でフィルタを設定 *できます*。\n" +"ただし、一見しただけでは方法が分かりにくいため、このレシピで説明します。\n" +"標準ライブラリに含まれるフィルタクラスは :class:`~logging.Filter` だけで、基" +"底クラスとして用意されているため、多くの要件にはそのまま対応できないでしょ" +"う。\n" +"通常は :class:`~logging.Filter` のサブクラスを定義" +"し、:meth:`~logging.Filter.filter` をオーバーライドします。\n" +"設定辞書のフィルタの項目では ``()`` キーに、フィルタを作成する呼び出し可能オ" +"ブジェクトを指定します。\n" +"クラスを指定するのが分かりやすい方法ですが、:class:`~logging.Filter` インスタ" +"ンスを返すものであれば指定できます。\n" +"完全な例を示します。 ::" + msgid "" "import logging\n" "import logging.config\n" @@ -4173,20 +5392,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." @@ -4206,10 +5464,10 @@ msgid "" "the above example." msgstr "" "設定内で直接その callable を参照出来ない場合(例えばそれが異なるモジュール内に" -"あり、設定辞書のある場所からそれを直接インポート出来ない、など)には、 :ref:" -"`logging-config-dict-externalobj` に記述されている ``ext://...`` 形式を使えま" -"す。例えば、上記例のように ``MyFilter`` と指定する代わりに、 ``'ext://" -"__main__.MyFilter'`` と記述することが出来ます。" +"あり、設定辞書のある場所からそれを直接インポート出来ない、など)に" +"は、 :ref:`logging-config-dict-externalobj` に記述されている ``ext://...`` 形" +"式を使えます。例えば、上記例のように ``MyFilter`` と指定する代わりに、 " +"``'ext://__main__.MyFilter'`` と記述することが出来ます。" #: ../../howto/logging-cookbook.rst:2919 msgid "" @@ -4221,9 +5479,9 @@ msgid "" msgstr "" "フィルタについてとともに、このテクニックは、カスタムハンドラ、カスタムフォー" "マッタに対しても同様に使えます。ロギングが設定において、どのようにユーザ定義" -"のオブジェクトをサポートするのかについてのさらなる詳細については、 :ref:" -"`logging-config-dict-userdef` と、本クックブックの上の方のレシピ :ref:" -"`custom-handlers` を参照してください。" +"のオブジェクトをサポートするのかについてのさらなる詳細について" +"は、 :ref:`logging-config-dict-userdef` と、本クックブックの上の方のレシ" +"ピ :ref:`custom-handlers` を参照してください。" #: ../../howto/logging-cookbook.rst:2928 msgid "Customized exception formatting" @@ -4236,12 +5494,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 +5570,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,36 +5600,34 @@ 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 " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler using :mod:" -"`subprocess`. It's assumed here that TTS command line programs won't expect " -"to interact with users or take a long time to complete, and that the " -"frequency of logged messages will be not so high as to swamp the user with " -"messages, and that it's acceptable to have the messages spoken one at a time " -"rather than concurrently, The example implementation below waits for one " -"message to be spoken before the next is processed, and this might cause " -"other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler " +"using :mod:`subprocess`. It's assumed here that TTS command line programs " +"won't expect to interact with users or take a long time to complete, and " +"that the frequency of logged messages will be not so high as to swamp the " +"user with messages, and that it's acceptable to have the messages spoken one " +"at a time rather than concurrently, The example implementation below waits " +"for one message to be spoken before the next is processed, and this might " +"cause 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 +5658,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 +5707,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 +5715,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 +5743,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 +5750,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 "" @@ -4442,9 +5763,9 @@ msgid "" "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to a :class:`~logging." -"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " -"respectively." +"the buffer (number of records buffered). These default to " +"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " +"``logging.ERROR`` and ``100`` respectively." msgstr "" "スクリプトが行うことは単に、 ``foo`` を必要とされている特定の条件でのロギング" "を行うようにするデコレータで修飾することだけです。このデコレータはパラメータ" @@ -4458,7 +5779,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 +5843,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 +5937,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 +5977,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" @@ -4585,12 +5993,13 @@ msgstr "バッファリングしながらロギングメッセージを email #: ../../howto/logging-cookbook.rst:3181 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can subclass :class:`~logging.handlers." -"BufferingHandler`. In the following example, which you can adapt to suit " -"your specific needs, a simple test harness is provided which allows you to " -"run the script with command line arguments specifying what you typically " -"need to send things via SMTP. (Run the downloaded script with the ``-h`` " -"argument to see the required and optional arguments.)" +"of messages are sent per email, you can " +"subclass :class:`~logging.handlers.BufferingHandler`. In the following " +"example, which you can adapt to suit your specific needs, a simple test " +"harness is provided which allows you to run the script with command line " +"arguments specifying what you typically need to send things via SMTP. (Run " +"the downloaded script with the ``-h`` argument to see the required and " +"optional arguments.)" msgstr "" "ログメッセージをメールで、特に1つのメールにつき複数のログメッセージを、送信す" "る方法を例示するため、 :class:`~logging.handlers.BufferingHandler` を継承しま" @@ -4600,7 +6009,6 @@ msgstr "" "見るためには、ダウンロードしたスクリプトを ``-h`` 引数をつけて実行してくださ" "い)。" -#: ../../howto/logging-cookbook.rst:3189 msgid "" "import logging\n" "import logging.handlers\n" @@ -4620,8 +6028,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " -"%(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" +"(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4667,6 +6075,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 +6166,6 @@ msgstr "" "なフォーマット処理は ``UTCFormatter`` のようなクラスを使って行うことができま" "す::" -#: ../../howto/logging-cookbook.rst:3266 msgid "" "import logging\n" "import time\n" @@ -4702,20 +6173,62 @@ 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 "" -"and you can then use the ``UTCFormatter`` in your code instead of :class:" -"`~logging.Formatter`. If you want to do that via configuration, you can use " -"the :func:`~logging.config.dictConfig` API with an approach illustrated by " -"the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead " +"of :class:`~logging.Formatter`. If you want to do that via configuration, " +"you can use 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 を以下の完全な例で示すようなアプローチで使うことが出来ます::" + +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 "" -"そしてコード中で ``UTCFormatter`` を :class:`~logging.Formatter` の代わりに使" -"えます。これを設定を通して行いたい場合、 :func:`~logging.config.dictConfig` " -"API を以下の完全な例で示すようなアプローチで使うことが出来ます::" - -#: ../../howto/logging-cookbook.rst:3277 -msgid "" "import logging\n" "import logging.config\n" "import time\n" @@ -4753,17 +6266,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 +6290,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 +6298,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 +6331,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 +6381,6 @@ msgstr "" "どのように動作するのかを示すためには、次のコード群を上のコードに付け加えると" "よいです::" -#: ../../howto/logging-cookbook.rst:3373 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4866,6 +6399,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 "" @@ -4885,8 +6434,8 @@ msgstr "" "め、メッセージ #3 が現れます。\n" "そのブロックを抜けた後、ロガーのレベルは ``INFO`` に復元され、メッセージ #4 " "は現れません。\n" -"次の ``with`` ブロック内では、再度レベルを ``DEBUG`` に設定し、 ``sys." -"stdout`` に書き出すハンドラを追加します。\n" +"次の ``with`` ブロック内では、再度レベルを ``DEBUG`` に設定し、 " +"``sys.stdout`` に書き出すハンドラを追加します。\n" "そのおかげでメッセージ #5 が 2 回 (1回は ``stderr`` を通して、もう1回は " "``stdout`` を通して) コンソールに出力されます。\n" "``with`` 文が完了すると、前の状態になるので (メッセージ #1 のように) メッセー" @@ -4896,7 +6445,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 +6453,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 +6468,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 +6481,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 +6488,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 "" @@ -4982,8 +6541,8 @@ msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, ``stop." -"py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, " +"``stop.py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" @@ -4991,10 +6550,9 @@ msgstr "" "ケーションがあるとします。説明のために、アプリケーションのメインスクリプトが " "``app.py`` 、個々のコマンドが ``start.py`` 、 ``stop.py`` 、 ``restart.py`` " "に実装されているものとします。デフォルトは ``logging.INFO`` ですが、コマンド" -"ライン引数を使ってアプリケーションのログの冗長性を制御したいとします。 ``app." -"py`` は次のコードのようになるでしょう::" +"ライン引数を使ってアプリケーションのログの冗長性を制御したいとします。 " +"``app.py`` は次のコードのようになるでしょう::" -#: ../../howto/logging-cookbook.rst:3454 msgid "" "import argparse\n" "import importlib\n" @@ -5029,8 +6587,8 @@ msgid "" " 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" +" print('Unable to find the code for command \\'%s\\'' % " +"options.command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -5040,6 +6598,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 +6649,6 @@ msgstr "" "``start`` 、 ``stop`` 、 ``restart`` コマンドは個別のモジュールとして実装され" "ます。次は起動コマンドのソースです::" -#: ../../howto/logging-cookbook.rst:3498 msgid "" "# start.py\n" "import logging\n" @@ -5061,12 +6660,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 +6694,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 +6737,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 +6764,6 @@ msgstr "" "このアプリケーションをデフォルトのログレベルで実行すると、次のような出力が得" "られます:" -#: ../../howto/logging-cookbook.rst:3552 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -5133,6 +6774,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 +6799,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 +6812,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." +"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 +6875,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 "" @@ -5411,8 +7079,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : self.work_button." -"setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : " +"self.work_button.setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -5489,8 +7157,9 @@ msgid "" "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, the :class:`~logging." -"handlers.SysLogHandler` functionality has not been updated." +"been widespread deployment of it in syslog servers, " +"the :class:`~logging.handlers.SysLogHandler` functionality has not been " +"updated." msgstr "" ":rfc:`5424` は 2009 年から始まっていますが、ほとんどの syslog サーバーはデ" "フォルトで、 2001 年から使われている古い :rfc:`3164` を使って構成されていま" @@ -5530,8 +7199,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = datetime.datetime.fromtimestamp(record.created)." -"isoformat()\n" +" asctime = " +"datetime.datetime.fromtimestamp(record.created).isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -5594,7 +7263,6 @@ msgstr "" "あります。上記のハンドラにより、構造化データは以下のように渡すことができるで" "しょう::" -#: ../../howto/logging-cookbook.rst:3932 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5604,6 +7272,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 +7296,6 @@ msgstr "" "きあります。これは file-like な API でロガーをラップするクラスを使うことで実" "現できます。以下はそのようなクラスを例解する短いスクリプトです:" -#: ../../howto/logging-cookbook.rst:3948 msgid "" "import logging\n" "\n" @@ -5658,46 +7332,83 @@ 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 "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." -"stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " +"``sys.stderr`` by doing something like this:" 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 "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the ``sys." -"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " -"Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the " +"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " +"instance). Then, you'd get this kind of result:" msgstr "" "上記の操作は、必要に応じてロギングを設定した *後に* 行うべきです。上記の例で" "は、 :func:`~logging.basicConfig` の呼び出しが (``LoggerWriter`` インスタンス" "で上書きされる *前の* ``sys.stderr`` を使って) 設定を行います。そして、以下の" "ような結果を得るでしょう:" -#: ../../howto/logging-cookbook.rst:4005 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5705,12 +7416,17 @@ 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 "" -"Of course, the examples above show output according to the format used by :" -"func:`~logging.basicConfig`, but you can use a different formatter when you " -"configure logging." +"Of course, the examples above show output according to the format used " +"by :func:`~logging.basicConfig`, but you can use a different formatter when " +"you configure logging." msgstr "" "言うまでもなく上記の例は :func:`~logging.basicConfig` で使われている書式にも" "とづく出力を示していますが、ロギングの設定で異なるフォーマッタを使うことがで" @@ -5726,17 +7442,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 +7470,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 +7494,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 +7519,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 +7544,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 +7554,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 +7595,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 +7628,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 +7635,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 "" @@ -5924,12 +7681,12 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" "ロガーはシングルトンであるため、一般的には意味がなく、これを行う必要が出てく" -"ることは滅多にありません。コードからは名前を使って ``logging." -"getLogger(name)`` 経由でロガーインスタンスにアクセスできるため、インスタンス" -"を持って回って、インスタンス属性として保持することは意味がありません。Javaや" -"C#といった他の言語ではよく静的クラス属性にしてます。しかし、Pythonにおいては" -"このパターンはクラスではなくモジュールがソフトウェア分解の単位となっているた" -"め、無意味です。" +"ることは滅多にありません。コードからは名前を使って " +"``logging.getLogger(name)`` 経由でロガーインスタンスにアクセスできるため、イ" +"ンスタンスを持って回って、インスタンス属性として保持することは意味がありませ" +"ん。JavaやC#といった他の言語ではよく静的クラス属性にしてます。しかし、Python" +"においてはこのパターンはクラスではなくモジュールがソフトウェア分解の単位と" +"なっているため、無意味です。" #: ../../howto/logging-cookbook.rst:4141 msgid "" @@ -5939,17 +7696,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..961334f63 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 @@ -48,8 +48,8 @@ msgid "" "This page contains tutorial information. For links to reference information " "and a logging cookbook, please see :ref:`tutorial-ref-links`." msgstr "" -"このページはチュートリアルです。レファレンスやロギングクックブックは、 :ref:" -"`tutorial-ref-links` を参照してください。" +"このページはチュートリアルです。レファレンスやロギングクックブック" +"は、 :ref:`tutorial-ref-links` を参照してください。" #: ../../howto/logging.rst:17 msgid "Basic Logging Tutorial" @@ -79,10 +79,10 @@ msgstr "logging を使うとき" #: ../../howto/logging.rst:30 msgid "" "You can access logging functionality by creating a logger via ``logger = " -"getLogger(__name__)``, and then calling the logger's :meth:`~Logger.debug`, :" -"meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error` and :" -"meth:`~Logger.critical` methods. To determine when to use logging, and to " -"see which logger methods to use when, see the table below. It states, for " +"getLogger(__name__)``, and then calling the " +"logger's :meth:`~Logger.debug`, :meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error` " +"and :meth:`~Logger.critical` methods. To determine when to use logging, and " +"to see which logger methods to use when, see the table below. It states, for " "each of a set of common tasks, the best tool to use for that task." msgstr "" @@ -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,29 @@ 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 " +"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 +197,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 +220,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 +251,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,20 +266,24 @@ 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 " -"the level and the description of the event provided in the logging call, i." -"e. 'Watch out!'. The actual output can be formatted quite flexibly if you " +"the level and the description of the event provided in the logging call, " +"i.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 +294,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,17 +317,24 @@ msgstr "" "を見て行きましょう。以下のサンプルを試すときは Python インタプリタを新しく起" "動して、上のセッションの続きにならないようにしてください::" -#: ../../howto/logging.rst:143 msgid "" "import logging\n" "logger = logging.getLogger(__name__)\n" -"logging.basicConfig(filename='example.log', encoding='utf-8', level=logging." -"DEBUG)\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ö')" 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 +356,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 +382,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 +403,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 +412,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 +441,12 @@ msgstr "" "に新たに始めたいなら、上記の例での呼び出しを次のように変え、*filemode* 引数を" "指定する方法がとれます::" -#: ../../howto/logging.rst:204 msgid "" -"logging.basicConfig(filename='example.log', filemode='w', level=logging." -"DEBUG)" +"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 +468,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,26 +510,33 @@ msgstr "" "メッセージを表示するのに使われるフォーマットを変更するには、使いたいフォー" "マットを指定する必要があります::" -#: ../../howto/logging.rst:239 msgid "" "import logging\n" -"logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." -"DEBUG)\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')" 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,51 +565,55 @@ 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 "" -"The default format for date/time display (shown above) is like ISO8601 or :" -"rfc:`3339`. If you need more control over the formatting of the date/time, " -"provide a *datefmt* argument to ``basicConfig``, as in this example::" +"The default format for date/time display (shown above) is like ISO8601 " +"or :rfc:`3339`. If you need more control over the formatting of the date/" +"time, provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" -"デフォルトの日付と時間の表示フォーマット (上記の結果) は、ISO8601 や :rfc:" -"`3339` に似ています。日付と時間のフォーマットをより詳細に制御する必要があるな" -"ら、以下の例の様に、 ``basicConfig`` に *datefmt* 引数を指定してください::" +"デフォルトの日付と時間の表示フォーマット (上記の結果) は、ISO8601 " +"や :rfc:`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 "" -"The format of the *datefmt* argument is the same as supported by :func:`time." -"strftime`." +"The format of the *datefmt* argument is the same as supported " +"by :func:`time.strftime`." msgstr "" "*datefmt* 引数のフォーマットは、 :func:`time.strftime` でサポートされているも" "のと同じです。" @@ -602,10 +644,10 @@ msgid "" "should receive help before too long." msgstr "" "ロギングを簡潔に行いたいなら、上記の例を使って、ロギングをあなたのスクリプト" -"に組み込んでください。問題があったり理解出来ないことがあったら、comp.lang." -"python Usenet group (https://groups.google.com/g/comp.lang.python から利用で" -"きます) に質問を投稿してくだされば、そう遠くないうちに助けが得られるでしょ" -"う。" +"に組み込んでください。問題があったり理解出来ないことがあったら、" +"comp.lang.python Usenet group (https://groups.google.com/g/comp.lang.python " +"から利用できます) に質問を投稿してくだされば、そう遠くないうちに助けが得られ" +"るでしょう。" #: ../../howto/logging.rst:310 msgid "" @@ -684,9 +726,8 @@ msgstr "" "ロガーに名前をつけるときの良い習慣は、ロギングを使う各モジュールに、以下のよ" "うに名付けられた、モジュールレベルロガーを使うことです::" -#: ../../howto/logging.rst:343 msgid "logger = logging.getLogger(__name__)" -msgstr "" +msgstr "logger = logging.getLogger(__name__)" #: ../../howto/logging.rst:345 msgid "" @@ -699,18 +740,18 @@ msgstr "" #: ../../howto/logging.rst:348 msgid "" "The root of the hierarchy of loggers is called the root logger. That's the " -"logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :" -"func:`error` and :func:`critical`, which just call the same-named method of " -"the root logger. The functions and the methods have the same signatures. The " -"root logger's name is printed as 'root' in the logged output." +"logger used by the " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical`, which just call the same-named method of the root " +"logger. The functions and the methods have the same signatures. The root " +"logger's name is printed as 'root' in the logged output." msgstr "" -"ロガーの階層構造の根源は、ルートロガーと呼ばれます。それが、関数 :func:" -"`debug`, :func:`info`, :func:`warning`, :func:`error` および :func:" -"`critical` によって使われるロガーとなります。これらの関数は単に、ルートロガー" -"の同名のメソッドを呼び出します。これらの関数とメソッドは、同じ署名をもってい" -"ます。ルートロガーの名前は、ログ出力では 'root' と表示されます。" +"ロガーの階層構造の根源は、ルートロガーと呼ばれます。それが、関" +"数 :func:`debug`, :func:`info`, :func:`warning`, :func:`error` およ" +"び :func:`critical` によって使われるロガーとなります。これらの関数は単に、" +"ルートロガーの同名のメソッドを呼び出します。これらの関数とメソッドは、同じ署" +"名をもっています。ルートロガーの名前は、ログ出力では '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,31 +761,33 @@ 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 "" "By default, no destination is set for any logging messages. You can specify " "a destination (such as console or file) by using :func:`basicConfig` as in " -"the tutorial examples. If you call the functions :func:`debug`, :func:" -"`info`, :func:`warning`, :func:`error` and :func:`critical`, they will check " -"to see if no destination is set; and if one is not set, they will set a " -"destination of the console (``sys.stderr``) and a default format for the " -"displayed message before delegating to the root logger to do the actual " -"message output." +"the tutorial examples. If you call the " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical`, they will check to see if no destination is set; and " +"if one is not set, they will set a destination of the console " +"(``sys.stderr``) and a default format for the displayed message before " +"delegating to the root logger to do the actual message output." msgstr "" "デフォルトでは、どのロギングメッセージに対しても、送信先は設定されていませ" "ん。チュートリアルの例のように、 :func:`basicConfig` を使って、送信先 (コン" -"ソールやファイルなど) を指定できます。関数 :func:`debug`, :func:`info`, :" -"func:`warning`, :func:`error` および :func:`critical` を呼び出すと、それらは" -"送信先が設定されていないかを調べます。そして設定されていなければ、ルートロ" -"ガーに委譲して実際にメッセージを出力する前に、コンソール (``sys.stderr``) を" -"送信先に、デフォルトのフォーマットを表示されるメッセージに設定します。" +"ソールやファイルなど) を指定できます。関" +"数 :func:`debug`, :func:`info`, :func:`warning`, :func:`error` およ" +"び :func:`critical` を呼び出すと、それらは送信先が設定されていないかを調べま" +"す。そして設定されていなければ、ルートロガーに委譲して実際にメッセージを出力" +"する前に、コンソール (``sys.stderr``) を送信先に、デフォルトのフォーマットを" +"表示されるメッセージに設定します。" #: ../../howto/logging.rst:369 msgid "The default format set by :func:`basicConfig` for messages is:" @@ -752,9 +795,8 @@ msgstr "" ":func:`basicConfig` が設定するデフォルトのメッセージのフォーマットは次のよう" "になります:" -#: ../../howto/logging.rst:371 msgid "severity:logger name:message" -msgstr "" +msgstr "重大度:ロガー名:メッセージ" #: ../../howto/logging.rst:375 msgid "" @@ -766,9 +808,8 @@ msgstr "" "で、これを変更できます。フォーマット文字列を構成するためのすべてのオプション" "は、 :ref:`formatter-objects` を参照してください。" -#: ../../howto/logging.rst:380 msgid "Logging Flow" -msgstr "Logging Flow" +msgstr "ログ処理の流れ" #: ../../howto/logging.rst:382 msgid "" @@ -829,8 +870,8 @@ msgid "" "in :ref:`handler-basic`." msgstr "" ":meth:`Logger.addHandler` と :meth:`Logger.removeHandler` は、ハンドラオブ" -"ジェクトをロガーオブジェクトから追加または削除します。ハンドラについては、 :" -"ref:`handler-basic` で詳しく述べます。" +"ジェクトをロガーオブジェクトから追加または削除します。ハンドラについて" +"は、 :ref:`handler-basic` で詳しく述べます。" #: ../../howto/logging.rst:456 msgid "" @@ -839,8 +880,8 @@ msgid "" "in :ref:`filter`." msgstr "" ":meth:`Logger.addFilter` と :meth:`Logger.removeFilter` はロガーオブジェクト" -"にフィルタオブジェクトを追加または削除します。フィルタについては、 :ref:" -"`filter` で詳しく述べます。" +"にフィルタオブジェクトを追加または削除します。フィルタについて" +"は、 :ref:`filter` で詳しく述べます。" #: ../../howto/logging.rst:460 msgid "" @@ -858,29 +899,30 @@ msgstr "" #: ../../howto/logging.rst:465 msgid "" -":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" -"`Logger.error`, and :meth:`Logger.critical` all create log records with a " -"message and a level that corresponds to their respective method names. The " -"message is actually a format string, which may contain the standard string " -"substitution syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their " -"arguments is a list of objects that correspond with the substitution fields " -"in the message. With regard to ``**kwargs``, the logging methods care only " -"about a keyword of ``exc_info`` and use it to determine whether to log " -"exception information." -msgstr "" -":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" -"`Logger.error`, :meth:`Logger.critical` はすべて、メッセージとメソッド名に対" -"応したレベルでログ記録を作り出します。メッセージは実際にはフォーマット文字列" -"であり、通常の文字列代入に使う ``%s``, ``%d``, ``%f`` などを含むことができま" -"す。残りの引数はメッセージの代入される位置に対応するオブジェクトのリストで" -"す。 ``**kwargs`` については、ログ記録メソッドが気にするキーワードは " -"``exc_info`` だけで、例外の情報をログに記録するかを決定するのに使います。" +":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:`Logger.error`, " +"and :meth:`Logger.critical` all create log records with a message and a " +"level that corresponds to their respective method names. The message is " +"actually a format string, which may contain the standard string substitution " +"syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their arguments is " +"a list of objects that correspond with the substitution fields in the " +"message. With regard to ``**kwargs``, the logging methods care only about a " +"keyword of ``exc_info`` and use it to determine whether to log exception " +"information." +msgstr "" +":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:`Logger.error`, :meth:`Logger.critical` " +"はすべて、メッセージとメソッド名に対応したレベルでログ記録を作り出します。" +"メッセージは実際にはフォーマット文字列であり、通常の文字列代入に使う ``%s``, " +"``%d``, ``%f`` などを含むことができます。残りの引数はメッセージの代入される位" +"置に対応するオブジェクトのリストです。 ``**kwargs`` については、ログ記録メ" +"ソッドが気にするキーワードは ``exc_info`` だけで、例外の情報をログに記録する" +"かを決定するのに使います。" #: ../../howto/logging.rst:475 msgid "" -":meth:`Logger.exception` creates a log message similar to :meth:`Logger." -"error`. The difference is that :meth:`Logger.exception` dumps a stack trace " -"along with it. Call this method only from an exception handler." +":meth:`Logger.exception` creates a log message similar " +"to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` " +"dumps a stack trace along with it. Call this method only from an exception " +"handler." msgstr "" ":meth:`Logger.exception` は :meth:`Logger.error` と似たログメッセージを作成し" "ます。違いは :meth:`Logger.exception` がスタックトレースを一緒にダンプするこ" @@ -912,9 +954,9 @@ msgstr "" "のロガーインスタンスへの参照を返します。ロガーの名前はピリオド区切りの階層構" "造を表します。同じ名前で :func:`getLogger` を複数回呼び出した場合、同一のロ" "ガーオブジェクトへの参照が返されます。階層リストを下ったロガーはリスト上位の" -"ロガーの子です。たとえば、名前が ``foo`` であるロガーがあったとして、 ``foo." -"bar``, ``foo.bar.baz``, ``foo.bam`` といった名前のロガーはすべて ``foo`` の子" -"孫になります。" +"ロガーの子です。たとえば、名前が ``foo`` であるロガーがあったとして、 " +"``foo.bar``, ``foo.bar.baz``, ``foo.bam`` といった名前のロガーはすべて " +"``foo`` の子孫になります。" #: ../../howto/logging.rst:491 msgid "" @@ -978,12 +1020,12 @@ msgstr "" #: ../../howto/logging.rst:522 msgid "" "The standard library includes quite a few handler types (see :ref:`useful-" -"handlers`); the tutorials use mainly :class:`StreamHandler` and :class:" -"`FileHandler` in its examples." +"handlers`); the tutorials use mainly :class:`StreamHandler` " +"and :class:`FileHandler` in its examples." msgstr "" "このライブラリには多くのハンドラが用意されています (:ref:`useful-handlers` を" -"参照してください) が、このチュートリアルでは :class:`StreamHandler` と :" -"class:`FileHandler` だけを例に取り上げます。" +"参照してください) が、このチュートリアルでは :class:`StreamHandler` " +"と :class:`FileHandler` だけを例に取り上げます。" #: ../../howto/logging.rst:526 msgid "" @@ -1006,11 +1048,11 @@ msgid "" "send on." msgstr "" ":meth:`~Handler.setLevel` メソッドは、ロガーオブジェクトの場合と同様に、適切" -"な出力先に振り分けられるべき最も低い深刻度を指定します。なぜ 2 つも :meth:" -"`~Handler.setLevel` メソッドがあるのでしょうか? ロガーで設定されるレベルは、" -"付随するハンドラにどんな深刻度のメッセージを渡すか決めます。それぞれのハンド" -"ラで設定されるレベルは、そのハンドラがどのメッセージを転送するべきか決めま" -"す。" +"な出力先に振り分けられるべき最も低い深刻度を指定します。なぜ 2 つ" +"も :meth:`~Handler.setLevel` メソッドがあるのでしょうか? ロガーで設定されるレ" +"ベルは、付随するハンドラにどんな深刻度のメッセージを渡すか決めます。それぞれ" +"のハンドラで設定されるレベルは、そのハンドラがどのメッセージを転送するべきか" +"決めます。" #: ../../howto/logging.rst:537 msgid "" @@ -1030,10 +1072,10 @@ msgstr "" #: ../../howto/logging.rst:543 msgid "" -"Application code should not directly instantiate and use instances of :class:" -"`Handler`. Instead, the :class:`Handler` class is a base class that defines " -"the interface that all handlers should have and establishes some default " -"behavior that child classes can use (or override)." +"Application code should not directly instantiate and use instances " +"of :class:`Handler`. Instead, the :class:`Handler` class is a base class " +"that defines the interface that all handlers should have and establishes " +"some default behavior that child classes can use (or override)." msgstr "" "アプリケーションのコード中では :class:`Handler` のインスタンスを直接インスタ" "ンス化して使ってはなりません。代わりに、 :class:`Handler` クラスはすべてのハ" @@ -1060,44 +1102,41 @@ 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 "" "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :" -"ref:`logrecord-attributes`. If the style is ``'{'``, the message format " +"key>)s`` styled string substitution; the possible keys are documented " +"in :ref:`logrecord-attributes`. If the style is ``'{'``, the message format " "string is assumed to be compatible with :meth:`str.format` (using keyword " "arguments), while if the style is ``'$'`` then the message format string " "should conform to what is expected by :meth:`string.Template.substitute`." msgstr "" -"``style`` が ``'%'`` の場合、メッセージフォーマット文字列では " -"``%()s`` 形式の置換文字列が使われます; キーに指定できる属性名" +"``style`` が ``'%'`` の場合、メッセージフォーマット文字列では ``%" +"()s`` 形式の置換文字列が使われます; キーに指定できる属性名" "は :ref:`logrecord-attributes` に文書化されています。 style が ``'{'`` の場" "合、メッセージフォーマット文字列は (キーワード引数を使う) :meth:`str.format` " -"と互換となります。 style が ``'$'`` の場合、メッセージフォーマット文字列は :" -"meth:`string.Template.substitute` で期待されているものと一致します。" +"と互換となります。 style が ``'$'`` の場合、メッセージフォーマット文字列" +"は :meth:`string.Template.substitute` で期待されているものと一致します。" #: ../../howto/logging.rst:578 msgid "Added the ``style`` parameter." @@ -1112,11 +1151,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 +1163,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" @@ -1159,8 +1199,8 @@ msgstr "" #: ../../howto/logging.rst:607 msgid "" -"Creating a dictionary of configuration information and passing it to the :" -"func:`dictConfig` function." +"Creating a dictionary of configuration information and passing it to " +"the :func:`dictConfig` function." msgstr "設定情報の辞書を作り、それを :func:`dictConfig` 関数に渡す。" #: ../../howto/logging.rst:610 @@ -1173,7 +1213,6 @@ msgstr "" "下の例では、Python コードを使って、とても簡単なロガー、コンソールハンドラ、そ" "して簡単なフォーマッタを設定しています::" -#: ../../howto/logging.rst:614 msgid "" "import logging\n" "\n" @@ -1186,8 +1225,8 @@ msgid "" "ch.setLevel(logging.DEBUG)\n" "\n" "# create formatter\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "\n" "# add formatter to ch\n" "ch.setFormatter(formatter)\n" @@ -1202,6 +1241,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 +1274,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 +1282,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 +1298,6 @@ msgstr "" "以下の Python モジュールは、ロガー、ハンドラ、フォーマッタをほとんど上述の例" "と同じように生成していますが、オブジェクト名だけが異なります::" -#: ../../howto/logging.rst:655 msgid "" "import logging\n" "import logging.config\n" @@ -1245,12 +1314,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 +1362,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 +1402,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 +1419,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 +1428,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` が呼び出される前に存在した非ルートロガーを無効化してしまうからで" -"す。\n" -"より詳細なことはリファレンスを参照し、望むならこの引数に ``False`` を指定して" -"ください。" +":func:`fileConfig` 関数の ``disable_existing_loggers`` パラメータは、後方互換" +"性のためデフォルトで ``True`` です。\n" +"この設定が望ましいとは限りません。\n" +"そのロガー自身または祖先ロガーの名前が設定に明記されていない限" +"り、:func:`fileConfig` の呼び出し前から存在するルート以外のロガーが無効になる" +"ためです。\n" +"詳しくはリファレンスを参照し、必要に応じてこのパラメータを ``False`` にしてく" +"ださい。" #: ../../howto/logging.rst:725 msgid "" @@ -1343,20 +1455,20 @@ msgstr "" msgid "" "Note that the class names referenced in config files need to be either " "relative to the logging module, or absolute values which can be resolved " -"using normal import mechanisms. Thus, you could use either :class:`~logging." -"handlers.WatchedFileHandler` (relative to the logging module) or ``mypackage." -"mymodule.MyHandler`` (for a class defined in package ``mypackage`` and " -"module ``mymodule``, where ``mypackage`` is available on the Python import " -"path)." +"using normal import mechanisms. Thus, you could use " +"either :class:`~logging.handlers.WatchedFileHandler` (relative to the " +"logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in " +"package ``mypackage`` and module ``mymodule``, where ``mypackage`` is " +"available on the Python import path)." msgstr "" "なお、設定ファイルで参照されるクラス名は、logging モジュールに対して相対であ" "るか、通常のインポート機構を使って解決される絶対である値でなければなりませ" -"ん。従って、(logging モジュールに相対な) :class:`~logging.handlers." -"WatchedFileHandler` または (Python インポートパスとして ``mypackage`` が使え" -"るとき、パッケージ ``mypackage`` のモジュール ``mymodule`` で定義されたクラス" -"に) ``mypackage.mymodule.MyHandler`` のどちらかが使えます。" +"ん。従って、(logging モジュールに相対" +"な) :class:`~logging.handlers.WatchedFileHandler` または (Python インポートパ" +"スとして ``mypackage`` が使えるとき、パッケージ ``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 +1482,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 +1500,6 @@ msgid "" msgstr "" "以下は、上記と同じ設定を辞書ベースの新しい手法で記載した YAML 形式の例です:" -#: ../../howto/logging.rst:758 msgid "" "version: 1\n" "formatters:\n" @@ -1407,6 +1520,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 "" @@ -1431,10 +1562,10 @@ msgstr "" #: ../../howto/logging.rst:789 msgid "" -"The event is output using a 'handler of last resort', stored in :data:" -"`lastResort`. This internal handler is not associated with any logger, and " -"acts like a :class:`~logging.StreamHandler` which writes the event " -"description message to the current value of ``sys.stderr`` (therefore " +"The event is output using a 'handler of last resort', stored " +"in :data:`lastResort`. This internal handler is not associated with any " +"logger, and acts like a :class:`~logging.StreamHandler` which writes the " +"event description message to the current value of ``sys.stderr`` (therefore " "respecting any redirections which may be in effect). No formatting is done " "on the message - just the bare event description message is printed. The " "handler's level is set to ``WARNING``, so all events at this and greater " @@ -1518,13 +1649,13 @@ msgstr "" #: ../../howto/logging.rst:833 msgid "" -"A do-nothing handler is included in the logging package: :class:`~logging." -"NullHandler` (since Python 3.1). An instance of this handler could be added " -"to the top-level logger of the logging namespace used by the library (*if* " -"you want to prevent your library's logged events being output to ``sys." -"stderr`` in the absence of logging configuration). If all logging by a " -"library *foo* is done using loggers with names matching 'foo.x', 'foo.x.y', " -"etc. then the code::" +"A do-nothing handler is included in the logging " +"package: :class:`~logging.NullHandler` (since Python 3.1). An instance of " +"this handler could be added to the top-level logger of the logging namespace " +"used by the library (*if* you want to prevent your library's logged events " +"being output to ``sys.stderr`` in the absence of logging configuration). If " +"all logging by a library *foo* is done using loggers with names matching " +"'foo.x', 'foo.x.y', etc. then the code::" msgstr "" "何もしないハンドラ :class:`~logging.NullHandler` (Python 3.1 以降) は、 " "logging パッケージに含まれます。このハンドラのインスタンスを、 (ロギング設定" @@ -1533,11 +1664,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,22 +1696,24 @@ 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 " -"configuration of handlers is the prerogative of the application developer " -"who uses your library. The application developer knows their target audience " -"and what handlers are most appropriate for their application: if you add " -"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` *以外のハンドラを追" -"加しない* ことを強く推奨します。これは、ハンドラの設定が、あなたのライブラリ" -"を使うアプリケーション開発者にも伝播するからです。アプリケーション開発者は、" -"対象となる聴衆と、そのアプリケーションにどのハンドラが最も適しているかを知っ" -"ています。ハンドラを 'ボンネットの中で' 加えてしまうと、ユニットテストをして" -"必要に応じたログを送達する能力に干渉しかねません。" +"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 configuration of handlers is the prerogative of the application " +"developer who uses your library. The application developer knows their " +"target audience and what handlers are most appropriate for their " +"application: if you add 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` *以外のハンドラを追加" +"しない* ことを強く推奨します。\n" +"ハンドラの設定は、そのライブラリを使うアプリケーション開発者が決めるものだか" +"らです。\n" +"アプリケーション開発者はログの読者や、アプリケーションに最適なハンドラを把握" +"しています。\n" +"ライブラリが内部で勝手にハンドラを追加すると、ユニットテストや、要件に合うロ" +"グの出力を妨げる可能性があります。" #: ../../howto/logging.rst:866 msgid "Logging Levels" @@ -1649,8 +1783,8 @@ msgstr "" #: ../../howto/logging.rst:897 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " -"class. When a logger decides to actually log an event, a :class:`~logging." -"LogRecord` instance is created from the logging message." +"class. When a logger decides to actually log an event, " +"a :class:`~logging.LogRecord` instance is created from the logging message." msgstr "" "ログ記録されるメッセージは :class:`~logging.LogRecord` クラスのインスタンスと" "してエンコードされます。ロガーがあるイベントを実際にログ出力すると決定した場" @@ -1659,19 +1793,19 @@ msgstr "" #: ../../howto/logging.rst:901 msgid "" -"Logging messages are subjected to a dispatch mechanism through the use of :" -"dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " -"class. Handlers are responsible for ensuring that a logged message (in the " -"form of a :class:`LogRecord`) ends up in a particular location (or set of " -"locations) which is useful for the target audience for that message (such as " -"end users, support desk staff, system administrators, developers). Handlers " -"are passed :class:`LogRecord` instances intended for particular " -"destinations. Each logger can have zero, one or more handlers associated " -"with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`). In " -"addition to any handlers directly associated with a logger, *all handlers " -"associated with all ancestors of the logger* are called to dispatch the " -"message (unless the *propagate* flag for a logger is set to a false value, " -"at which point the passing to ancestor handlers stops)." +"Logging messages are subjected to a dispatch mechanism through the use " +"of :dfn:`handlers`, which are instances of subclasses of " +"the :class:`Handler` class. Handlers are responsible for ensuring that a " +"logged message (in the form of a :class:`LogRecord`) ends up in a particular " +"location (or set of locations) which is useful for the target audience for " +"that message (such as end users, support desk staff, system administrators, " +"developers). Handlers are passed :class:`LogRecord` instances intended for " +"particular destinations. Each logger can have zero, one or more handlers " +"associated with it (via the :meth:`~Logger.addHandler` method " +"of :class:`Logger`). In addition to any handlers directly associated with a " +"logger, *all handlers associated with all ancestors of the logger* are " +"called to dispatch the message (unless the *propagate* flag for a logger is " +"set to a false value, at which point the passing to ancestor handlers stops)." msgstr "" "ログ記録されるメッセージは、ハンドラ (:dfn:`handlers`) を通してディスパッチ機" "構にかけられます。ハンドラは :class:`Handler` クラスのサブクラスのインスタン" @@ -1689,10 +1823,10 @@ msgstr "" msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " -"If a handler decides to actually dispatch an event, the :meth:`~Handler." -"emit` method is used to send the message to its destination. Most user-" -"defined subclasses of :class:`Handler` will need to override this :meth:" -"`~Handler.emit`." +"If a handler decides to actually dispatch an event, " +"the :meth:`~Handler.emit` method is used to send the message to its " +"destination. Most user-defined subclasses of :class:`Handler` will need to " +"override this :meth:`~Handler.emit`." msgstr "" "ロガーと同様に、ハンドラは関連付けられたレベルを持つことができます。ハンドラ" "のレベルはロガーのレベルと同じ方法で、フィルタとして働きます。ハンドラがある" @@ -1705,7 +1839,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 +1850,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" @@ -1753,21 +1888,20 @@ msgstr "" msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " -"directly. Instead, use :class:`~handlers.RotatingFileHandler` or :class:" -"`~handlers.TimedRotatingFileHandler`." +"directly. Instead, use :class:`~handlers.RotatingFileHandler` " +"or :class:`~handlers.TimedRotatingFileHandler`." msgstr "" ":class:`~handlers.BaseRotatingHandler` は、ある地点でログファイルを循環させる" "ハンドラの基底クラスです。これを直接インスタンス化することは意図されていませ" -"ん。代わりに、 :class:`~handlers.RotatingFileHandler` や :class:`~handlers." -"TimedRotatingFileHandler` を使用してください。" +"ん。代わりに、 :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 "" @@ -1811,11 +1945,11 @@ msgstr "" #: ../../howto/logging.rst:972 msgid "" -":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " -"NT/2000/XP event log." +":class:`~handlers.NTEventLogHandler` instances send messages to a Windows NT/" +"2000/XP event log." msgstr "" -":class:`~handlers.NTEventLogHandler` インスタンスは、メッセージを Windows " -"NT/2000/XP イベントログに送ります。" +":class:`~handlers.NTEventLogHandler` インスタンスは、メッセージを Windows NT/" +"2000/XP イベントログに送ります。" #: ../../howto/logging.rst:975 msgid "" @@ -1850,9 +1984,9 @@ msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -":class:`~handlers.QueueHandler` インスタンスは、 :mod:`queue` モジュールや :" -"mod:`multiprocessing` モジュールなどで実装されているキューにメッセージを送り" -"ます。" +":class:`~handlers.QueueHandler` インスタンスは、 :mod:`queue` モジュール" +"や :mod:`multiprocessing` モジュールなどで実装されているキューにメッセージを" +"送ります。" #: ../../howto/logging.rst:989 msgid "" @@ -1865,8 +1999,8 @@ msgstr "" ":class:`NullHandler` インスタンスは、エラーメッセージについて何もしません。こ" "のクラスはライブラリ開発者が、 logging は使いたいが、ライブラリのユーザーが " "logging の設定をしなかったときに表示されうる 'No handlers could be found for " -"logger *XXX*' のようなメッセージを回避したいときに使います。詳しくは、 :ref:" -"`library-config` を参照してください。" +"logger *XXX*' のようなメッセージを回避したいときに使います。詳しく" +"は、 :ref:`library-config` を参照してください。" #: ../../howto/logging.rst:995 msgid "The :class:`NullHandler` class." @@ -1890,9 +2024,9 @@ msgstr "" #: ../../howto/logging.rst:1006 msgid "" -"Logged messages are formatted for presentation through instances of the :" -"class:`Formatter` class. They are initialized with a format string suitable " -"for use with the % operator and a dictionary." +"Logged messages are formatted for presentation through instances of " +"the :class:`Formatter` class. They are initialized with a format string " +"suitable for use with the % operator and a dictionary." msgstr "" "ログメッセージは、 :class:`Formatter` クラスのインスタンスを通してフォーマッ" "ト化してから表示されます。このインスタンスは、 % 演算子と辞書で使うのに適切な" @@ -1900,23 +2034,24 @@ msgstr "" #: ../../howto/logging.rst:1010 msgid "" -"For formatting multiple messages in a batch, instances of :class:" -"`BufferingFormatter` can be used. In addition to the format string (which is " -"applied to each message in the batch), there is provision for header and " -"trailer format strings." +"For formatting multiple messages in a batch, instances " +"of :class:`BufferingFormatter` can be used. In addition to the format string " +"(which is applied to each message in the batch), there is provision for " +"header and trailer format strings." msgstr "" -"複数のメッセージを一括してフォーマット化するには、 :class:" -"`BufferingFormatter` が使えます。(一連の文字列のそれぞれに適用される) フォー" -"マット文字列に加え、ヘッダとトレーラフォーマット文字列も提供されています。" +"複数のメッセージを一括してフォーマット化するに" +"は、 :class:`BufferingFormatter` が使えます。(一連の文字列のそれぞれに適用さ" +"れる) フォーマット文字列に加え、ヘッダとトレーラフォーマット文字列も提供され" +"ています。" #: ../../howto/logging.rst:1015 msgid "" "When filtering based on logger level and/or handler level is not enough, " -"instances of :class:`Filter` can be added to both :class:`Logger` and :class:" -"`Handler` instances (through their :meth:`~Handler.addFilter` method). " -"Before deciding to process a message further, both loggers and handlers " -"consult all their filters for permission. If any filter returns a false " -"value, the message is not processed further." +"instances of :class:`Filter` can be added to both :class:`Logger` " +"and :class:`Handler` instances (through their :meth:`~Handler.addFilter` " +"method). Before deciding to process a message further, both loggers and " +"handlers consult all their filters for permission. If any filter returns a " +"false value, the message is not processed further." msgstr "" "ロガーレベルおよび/またはハンドラレベルに基づくフィルタリングで十分でなけれ" "ば、 :class:`Filter` のインスタンスを :class:`Logger` と :class:`Handler` イ" @@ -1955,24 +2090,22 @@ msgstr "" msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " -"method of a :class:`Handler` subclass are passed to its :meth:`~Handler." -"handleError` method." +"method of a :class:`Handler` subclass are passed to " +"its :meth:`~Handler.handleError` method." msgstr "" ":class:`SystemExit` と :class:`KeyboardInterrupt` 例外は決して飲み込まれませ" "ん。 :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`, " -"is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, " -"the exception is swallowed." +"The default implementation of :meth:`~Handler.handleError` " +"in :class:`Handler` checks to see if a module-level " +"variable, :data:`raiseExceptions`, is set. If set, a traceback is printed " +"to :data:`sys.stderr`. If not set, 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 "" @@ -1982,8 +2115,8 @@ msgid "" "production usage." msgstr "" ":data:`raiseExceptions` のデフォルト値は ``True`` です。これは、開発の間に起" -"こるどんな例外についても通常は通知してほしいからです。実運用環境では :data:" -"`raiseExceptions` を ``False`` に設定することをお勧めします。" +"こるどんな例外についても通常は通知してほしいからです。実運用環境で" +"は :data:`raiseExceptions` を ``False`` に設定することをお勧めします。" #: ../../howto/logging.rst:1058 msgid "Using arbitrary objects as messages" @@ -1993,21 +2126,21 @@ msgstr "任意のオブジェクトをメッセージに使用する" msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " -"possibility. You can pass an arbitrary object as a message, and its :meth:" -"`~object.__str__` method will be called when the logging system needs to " -"convert it to a string representation. In fact, if you want to, you can " -"avoid computing a string representation altogether - for example, the :class:" -"`~handlers.SocketHandler` emits an event by pickling it and sending it over " -"the wire." +"possibility. You can pass an arbitrary object as a message, and " +"its :meth:`~object.__str__` method will be called when the logging system " +"needs to convert it to a string representation. In fact, if you want to, you " +"can avoid computing a string representation altogether - for example, " +"the :class:`~handlers.SocketHandler` emits an event by pickling it and " +"sending it over the wire." msgstr "" "前の節とそこで挙げた例では、イベントを記録するときに渡されたメッセージが文字" "列であると仮定していました。しかし、これは唯一の可能性ではありません。メッ" "セージとして任意のオブジェクトを渡すことができます。そして、ロギングシステム" -"がそのオブジェクトを文字列表現に変換する必要があるとき、オブジェクトの :meth:" -"`~object.__str__` メソッドが呼び出されます。実際、そうしたければ、文字列表現" -"を計算することを完全に避けることができます - 例えば、 :class:`~handlers." -"SocketHandler` は、イベントを pickle してネットワーク上で送信することでログ出" -"力します。" +"がそのオブジェクトを文字列表現に変換する必要があるとき、オブジェクト" +"の :meth:`~object.__str__` メソッドが呼び出されます。実際、そうしたければ、文" +"字列表現を計算することを完全に避けることができます - 例え" +"ば、 :class:`~handlers.SocketHandler` は、イベントを pickle してネットワーク" +"上で送信することでログ出力します。" #: ../../howto/logging.rst:1071 msgid "Optimization" @@ -2018,10 +2151,10 @@ msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " "expensive, and you may want to avoid doing it if the logger will just throw " -"away your event. To decide what to do, you can call the :meth:`~Logger." -"isEnabledFor` method which takes a level argument and returns true if the " -"event would be created by the Logger for that level of call. You can write " -"code like this::" +"away your event. To decide what to do, you can call " +"the :meth:`~Logger.isEnabledFor` method which takes a level argument and " +"returns true if the event would be created by the Logger for that level of " +"call. You can write code like this::" msgstr "" "message 引数の整形は、必要になるまで延期されます。しかしながら、ログ記録メ" "ソッドに渡す引数を計算するだけでもコストがかかる場合があります。ロガーが単に" @@ -2030,12 +2163,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 "" @@ -2059,11 +2194,11 @@ msgstr "" "ある種のケースでは、 :meth:`~Logger.isEnabledFor` それ自身があなたが期待する" "よりも高価になる場合があります(たとえば明示的なレベル指定がロガー階層の上位の" "みに設定されていて、ロガーが深くネストされているような場合です)。そのような" -"ケース(あるいはタイトなループ内でメソッド呼び出しを避けたい場合)は、 :meth:" -"`~Logger.isEnabledFor` 結果をローカルにもしくはインスタンス変数としてキャッ" -"シュし、メソッドを毎回呼び出すかわりに使えば良いです。そのようなキャッシュ値" -"は、(まったく一般的ではありませんが)ロギング設定がアプリケーション実行中に動" -"的に変更された場合にのみ再計算が必要でしょう。" +"ケース(あるいはタイトなループ内でメソッド呼び出しを避けたい場合)" +"は、 :meth:`~Logger.isEnabledFor` 結果をローカルにもしくはインスタンス変数と" +"してキャッシュし、メソッドを毎回呼び出すかわりに使えば良いです。そのような" +"キャッシュ値は、(まったく一般的ではありませんが)ロギング設定がアプリケーショ" +"ン実行中に動的に変更された場合にのみ再計算が必要でしょう。" #: ../../howto/logging.rst:1097 msgid "" @@ -2088,15 +2223,16 @@ 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`)." +"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..7f037922b 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 `_." +"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..52bca80b4 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" @@ -152,12 +153,12 @@ msgstr "" #: ../../howto/regex.rst:70 msgid "" -"There are exceptions to this rule; some characters are special :dfn:" -"`metacharacters`, and don't match themselves. Instead, they signal that " -"some out-of-the-ordinary thing should be matched, or they affect other " -"portions of the RE by repeating them or changing their meaning. Much of " -"this document is devoted to discussing various metacharacters and what they " -"do." +"There are exceptions to this rule; some characters are " +"special :dfn:`metacharacters`, and don't match themselves. Instead, they " +"signal that some out-of-the-ordinary thing should be matched, or they affect " +"other portions of the RE by repeating them or changing their meaning. Much " +"of this document is devoted to discussing various metacharacters and what " +"they do." msgstr "" "この規則には例外が存在します; いくつかの文字は特別な :dfn:`特殊文字 " "(metacharacters)` で、それら自身にマッチしません。代わりに通常のマッチするも" @@ -173,9 +174,8 @@ msgstr "" "ここに特殊文字の完全な一覧があります; これらの意味はこの HOWTO の残りの部分で" "説明します。" -#: ../../howto/regex.rst:79 msgid ". ^ $ * + ? { } [ ] \\ | ( )" -msgstr "" +msgstr ". ^ $ * + ? { } [ ] \\ | ( )" #: ../../howto/regex.rst:83 msgid "" @@ -196,33 +196,31 @@ 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 " -"first character of the class. For example, ``[^5]`` will match any character " -"except ``'5'``. If the caret appears elsewhere in a character class, it " -"does not have special meaning. For example: ``[5^]`` will match either a " -"``'5'`` or a ``'^'``." +"You can match the characters not listed within the class " +"by :dfn:`complementing` the set. This is indicated by including a ``'^'`` " +"as the first character of the class. For example, ``[^5]`` will match any " +"character except ``'5'``. If the caret appears elsewhere in a character " +"class, it 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,22 +248,21 @@ 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-" "Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the " -"characters marked as letters in the Unicode database provided by the :mod:" -"`unicodedata` module. You can use the more restricted definition of ``\\w`` " -"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`` を、より制限された定義で使うことが出来ます。" +"characters marked as letters in the Unicode database provided by " +"the :mod:`unicodedata` module. You can use the more restricted definition " +"of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when " +"compiling the regular expression." +msgstr "" +"例えば、``\\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``" @@ -357,9 +355,9 @@ msgstr "" #: ../../howto/regex.rst:156 msgid "" "The final metacharacter in this section is ``.``. It matches anything " -"except a newline character, and there's an alternate mode (:const:`re." -"DOTALL`) where it will match even a newline. ``.`` is often used where you " -"want to match \"any character\"." +"except a newline character, and there's an alternate mode " +"(:const:`re.DOTALL`) where it will match even a newline. ``.`` is often " +"used where you want to match \"any character\"." msgstr "" "この節での最後の特殊文字は ``.`` です。\n" "これは改行文字を除く任意の文字にマッチし、さらに改行文字に対してもマッチさせ" @@ -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 "" @@ -672,8 +672,8 @@ msgid "" "and no special syntax was created for expressing them. (There are " "applications that don't need REs at all, so there's no need to bloat the " "language specification by including them.) Instead, the :mod:`re` module is " -"simply a C extension module included with Python, just like the :mod:" -"`socket` or :mod:`zlib` modules." +"simply a C extension module included with Python, just like " +"the :mod:`socket` or :mod:`zlib` modules." msgstr "" "正規表現は文字列として :func:`re.compile` に渡されます。正規表現は文字列とし" "て扱われますが、それは正規表現が Python 言語のコアシステムに含まれないためで" @@ -791,10 +791,10 @@ msgstr "" #: ../../howto/regex.rst:336 msgid "" "In addition, special escape sequences that are valid in regular expressions, " -"but not valid as Python string literals, now result in a :exc:" -"`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, which " -"means the sequences will be invalid if raw string notation or escaping the " -"backslashes isn't used." +"but not valid as Python string literals, now result in " +"a :exc:`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, " +"which means the sequences will be invalid if raw string notation or escaping " +"the backslashes isn't used." msgstr "" "それに加えて、正規表現では有効であるものの Python の文字列リテラルとしては有" "効でない特殊文字のエスケープシーケンスは、現在では :exc:`DeprecationWarning` " @@ -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*\"``" @@ -886,8 +885,8 @@ msgstr "``finditer()``" #: ../../howto/regex.rst:374 msgid "" -"Find all substrings where the RE matches, and returns them as an :term:" -"`iterator`." +"Find all substrings where the RE matches, and returns them as " +"an :term:`iterator`." msgstr "" "正規表現にマッチする部分文字列を全て探しだし :term:`iterator` として返しま" "す。" @@ -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,22 +1022,28 @@ 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 "" -":meth:`~re.Match.group` returns the substring that was matched by the RE. :" -"meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and " -"ending index of the match. :meth:`~re.Match.span` returns both start and end " -"indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only " -"checks if the RE matches at the start of a string, :meth:`!start` will " +":meth:`~re.Match.group` returns the substring that was matched by the " +"RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting " +"and ending index of the match. :meth:`~re.Match.span` returns both start and " +"end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method " +"only checks if the RE matches at the start of a string, :meth:`!start` will " "always be zero. However, the :meth:`~re.Pattern.search` method of patterns " "scans through the string, so the match may not start at zero in that " "case. ::" msgstr "" -":meth:`~re.Match.group` は正規表現でマッチした部分文字列を返します。 :meth:" -"`~re.Match.start` と :meth:`~re.Match.end` はそれぞれ、マッチの開始インデクス" -"と終了インデクスを返します。 :meth:`~re.Match.span` は開始と終了のインデクス" -"を一つのタプルにして返します。\n" +":meth:`~re.Match.group` は正規表現でマッチした部分文字列を返しま" +"す。 :meth:`~re.Match.start` と :meth:`~re.Match.end` はそれぞれ、マッチの開" +"始インデクスと終了インデクスを返します。 :meth:`~re.Match.span` は開始と終了" +"のインデクスを一つのタプルにして返します。\n" ":meth:`~re.Pattern.match` メソッドは正規表現が文字列の開始位置でマッチするか" "どうかだけをチェックするので、 :meth:`!start` は必ずゼロを返します。\n" "しかし、 :meth:`~re.Pattern.search` メソッドではパターンを文字列全体について" @@ -1077,47 +1083,48 @@ msgstr "" #: ../../howto/regex.rst:466 msgid "" -"Two pattern methods return all of the matches for a pattern. :meth:`~re." -"Pattern.findall` returns a list of matching strings::" +"Two pattern methods return all of the matches for a " +"pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" msgstr "" "あるパターンにマッチするもの全てを返す Pattern インスタンスのメソッドが2つあ" "ります。\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 "" "The ``r`` prefix, making the literal a raw string literal, is needed in this " "example because escape sequences in a normal \"cooked\" string literal that " "are not recognized by Python, as opposed to regular expressions, now result " -"in a :exc:`DeprecationWarning` and will eventually become a :exc:" -"`SyntaxError`. See :ref:`the-backslash-plague`." +"in a :exc:`DeprecationWarning` and will eventually become " +"a :exc:`SyntaxError`. See :ref:`the-backslash-plague`." msgstr "" "この例では、文字列リテラルを raw string リテラルにするプレフィックス ``r`` が" "必要です。これは、正規表現とは異なり、通常の \"調理済み\" 文字列リテラルにお" -"けるエスケープシーケンスは Python では認識されないためであり、現在では :exc:" -"`DeprecationWarning` を引き起こし、最終的には :exc:`SyntaxError` となります。" -"詳しくは :ref:`the-backslash-plague` を参照してください。" +"けるエスケープシーケンスは Python では認識されないためであり、現在で" +"は :exc:`DeprecationWarning` を引き起こし、最終的には :exc:`SyntaxError` とな" +"ります。詳しくは :ref:`the-backslash-plague` を参照してください。" #: ../../howto/regex.rst:479 msgid "" ":meth:`~re.Pattern.findall` has to create the entire list before it can be " "returned as the result. The :meth:`~re.Pattern.finditer` method returns a " -"sequence of :ref:`match object ` instances as an :term:" -"`iterator`::" +"sequence of :ref:`match object ` instances as " +"an :term:`iterator`::" msgstr "" ":meth:`~re.Pattern.findall` は結果を返す前に完全なリストを必ず生成してしまい" "ます。いっぽう :meth:`~re.Pattern.finditer` メソッドは :ref:`マッチオブジェク" "ト ` インスタンスのシーケンスを :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" @@ -1136,19 +1152,19 @@ msgstr "モジュールレベルの関数" #: ../../howto/regex.rst:497 msgid "" -"You don't have to create a pattern object and call its methods; the :mod:" -"`re` module also provides top-level functions called :func:`~re.match`, :" -"func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, and so forth. " -"These functions take the same arguments as the corresponding pattern method " -"with the RE string added as the first argument, and still return either " -"``None`` or a :ref:`match object ` instance. ::" +"You don't have to create a pattern object and call its methods; " +"the :mod:`re` module also provides top-level functions " +"called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, " +"and so forth. These functions take the same arguments as the corresponding " +"pattern method with the RE string added as the first argument, and still " +"return either ``None`` or a :ref:`match object ` instance. ::" msgstr "" "パターンオブジェクトを作ってそのメソッドを呼び出す、とする必要は必ずしもあり" -"ません。 :mod:`re` モジュールはトップレベルの関数として :func:`~re.match`, :" -"func:`~re.search`, :func:`~re.findall`, :func:`~re.sub` などを用意していま" -"す。これら関数は、対応するメソッドの最初の引数に RE が追加されただけで後は同" -"じで、 ``None`` か :ref:`Match オブジェクト ` インスタンスを返" -"すのも同じです::" +"ません。 :mod:`re` モジュールはトップレベルの関数とし" +"て :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub` " +"などを用意しています。これら関数は、対応するメソッドの最初の引数に RE が追加" +"されただけで後は同じで、 ``None`` か :ref:`Match オブジェクト ` インスタンスを返すのも同じです::" #: ../../howto/regex.rst:504 msgid "" @@ -1190,20 +1206,20 @@ msgstr "コンパイルフラグ" msgid "" "Compilation flags let you modify some aspects of how regular expressions " "work. Flags are available in the :mod:`re` module under two names, a long " -"name such as :const:`IGNORECASE` and a short, one-letter form such as :const:" -"`I`. (If you're familiar with Perl's pattern modifiers, the one-letter " -"forms use the same letters; the short form of :const:`re.VERBOSE` is :const:" -"`re.X`, for example.) Multiple flags can be specified by bitwise OR-ing " -"them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, for " -"example." -msgstr "" -"コンパイルフラグは正規表現の動作をいくつかの側面から変更します。フラグは :" -"mod:`re` モジュール下で二つの名前で利用することができます、例えば長い名前は :" -"const:`IGNORECASE` で短い名前は1文字で :const:`I` のようになっています。 (1文" -"字形式は Perl のパターン修飾子と同じ形式を使います; 例えば :const:`re." -"VERBOSE` の短かい形式は :const:`re.X` です。) 複数のフラグが OR ビット演算で" -"指定することができます; 例えば ``re.I | re.M`` は :const:`I` と :const:`M` フ" -"ラグの両方を設定します。" +"name such as :const:`IGNORECASE` and a short, one-letter form such " +"as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-" +"letter forms use the same letters; the short form of :const:`re.VERBOSE` " +"is :const:`re.X`, for example.) Multiple flags can be specified by bitwise " +"OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, " +"for example." +msgstr "" +"コンパイルフラグは正規表現の動作をいくつかの側面から変更します。フラグ" +"は :mod:`re` モジュール下で二つの名前で利用することができます、例えば長い名前" +"は :const:`IGNORECASE` で短い名前は1文字で :const:`I` のようになっています。 " +"(1文字形式は Perl のパターン修飾子と同じ形式を使います; 例え" +"ば :const:`re.VERBOSE` の短かい形式は :const:`re.X` です。) 複数のフラグが " +"OR ビット演算で指定することができます; 例えば ``re.I | re.M`` は :const:`I` " +"と :const:`M` フラグの両方を設定します。" #: ../../howto/regex.rst:534 msgid "" @@ -1277,33 +1293,34 @@ 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 " "letters, too. Full Unicode matching also works unless the :const:`ASCII` " "flag is used to disable non-ASCII matches. When the Unicode patterns ``[a-" "z]`` or ``[A-Z]`` are used in combination with the :const:`IGNORECASE` flag, " -"they will match the 52 ASCII letters and 4 additional non-ASCII letters: " -"'İ' (U+0130, Latin capital letter I with dot above), 'ı' (U+0131, Latin " -"small letter dotless i), 'ſ' (U+017F, Latin small letter long s) and " -"'K' (U+212A, Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, " -"``'spAM'``, or ``'ſpam'`` (the latter is matched only in Unicode mode). This " -"lowercasing doesn't take the current locale into account; it will if you " -"also set the :const:`LOCALE` flag." +"they will match the 52 ASCII letters and 4 additional non-ASCII letters: 'İ' " +"(U+0130, Latin capital letter I with dot above), 'ı' (U+0131, Latin small " +"letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, " +"Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or " +"``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing " +"doesn't take the current locale into account; it will if you 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 "``|``" @@ -1529,9 +1554,9 @@ msgstr "``^``" #: ../../howto/regex.rst:707 msgid "" "Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has " -"been set, this will only match at the beginning of the string. In :const:" -"`MULTILINE` mode, this also matches immediately after each newline within " -"the string." +"been set, this will only match at the beginning of the string. " +"In :const:`MULTILINE` mode, this also matches immediately after each newline " +"within the string." msgstr "" "行の先頭にマッチします。 :const:`MULTILINE` フラグが設定されない場合には、文" "字列の先頭にのみマッチします。 :const:`MULTILINE` モードでは文字列内の各改行" @@ -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 "" @@ -1763,20 +1809,21 @@ msgstr "" msgid "" "Groups indicated with ``'('``, ``')'`` also capture the starting and ending " "index of the text that they match; this can be retrieved by passing an " -"argument to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re." -"Match.end`, and :meth:`~re.Match.span`. Groups are numbered starting with " -"0. Group 0 is always present; it's the whole RE, so :ref:`match object " -"` methods all have group 0 as their default argument. Later " -"we'll see how to express groups that don't capture the span of text that " -"they match. ::" +"argument " +"to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, " +"and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 " +"is always present; it's the whole RE, so :ref:`match object ` " +"methods all have group 0 as their default argument. Later we'll see how to " +"express groups that don't capture the span of text that they match. ::" msgstr "" "``'('``, ``')'`` で指示されたグループは、マッチしたテキスト開始と終了位置も" -"キャプチャします; :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:" -"`~re.Match.end`, :meth:`~re.Match.span` に引数を与えて取り出せます。グループ" -"はゼロ始まりの数値です。グループ 0 は常に使えます; それは RE でマッチした全体" -"で、 :ref:`Match オブジェクト ` メソッドの全てはグループ 0 を" -"デフォルト引数にしています。マッチするテキストの範囲をキャプチャしないグルー" -"プの書き方はのちほど見ることにします。 ::" +"キャプチャしま" +"す; :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, :meth:`~re.Match.span` " +"に引数を与えて取り出せます。グループはゼロ始まりの数値です。グループ 0 は常に" +"使えます; それは RE でマッチした全体で、 :ref:`Match オブジェクト ` メソッドの全てはグループ 0 をデフォルト引数にしています。マッチする" +"テキストの範囲をキャプチャしないグループの書き方はのちほど見ることにしま" +"す。 ::" #: ../../howto/regex.rst:827 msgid "" @@ -1818,11 +1865,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 +1880,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 +1908,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 +1946,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 +1955,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 +2019,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 +2030,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 +2066,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,11 +2074,17 @@ 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 "" -"Additionally, you can retrieve named groups as a dictionary with :meth:`~re." -"Match.groupdict`::" +"Additionally, you can retrieve named groups as a dictionary " +"with :meth:`~re.Match.groupdict`::" msgstr "" "さらに、名前付きのグループを :meth:`~re.Match.groupdict` を使って辞書として取" "り出すこともできます::" @@ -2046,14 +2099,13 @@ msgstr "" #: ../../howto/regex.rst:956 msgid "" "Named groups are handy because they let you use easily remembered names, " -"instead of having to remember numbers. Here's an example RE from the :mod:" -"`imaplib` module::" +"instead of having to remember numbers. Here's an example RE from " +"the :mod:`imaplib` module::" 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 +2114,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 "" @@ -2078,8 +2136,8 @@ msgid "" "name instead of the number. This is another Python extension: ``(?P=name)`` " "indicates that the contents of the group called *name* should again be " "matched at the current point. The regular expression for finding doubled " -"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?" -"P\\w+)\\s+(?P=word)\\b``::" +"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P\\w+)\\s+" +"(?P=word)\\b``::" msgstr "" "後方参照のための構文 ``(...)\\1`` はグループ番号への参照となっています。\n" "グループ番号の代わりに、グループ名を利用する変種があるのは当然でしょう。\n" @@ -2088,12 +2146,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 +2172,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 +2179,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 "``(?!...)``" @@ -2169,8 +2230,8 @@ msgstr "" "``.`` はメタキャラクタですので特別に扱わなければなりませんから、文字クラス内" "に入れて、そのものとだけマッチするようにしていることに注目です。末尾の ``$`` " "にも注目してください; これは残り全ての文字列が拡張子に含まれるべきであること" -"を保障するために追加しています。この正規表現は ``foo.bar``, ``autoexec." -"bat``, ``sendmail.cf``, ``printers.conf`` にマッチします。" +"を保障するために追加しています。この正規表現は ``foo.bar``, " +"``autoexec.bat``, ``sendmail.cf``, ``printers.conf`` にマッチします。" #: ../../howto/regex.rst:1016 msgid "" @@ -2194,22 +2255,22 @@ 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 " "extension isn't ``b``; the second character isn't ``a``; or the third " -"character isn't ``t``. This accepts ``foo.bar`` and rejects ``autoexec." -"bat``, but it requires a three-letter extension and won't accept a filename " -"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`` のような二文字の拡張子を受け付けません。これを修正するのにパターンを再び" -"複雑にすることになります。" +"character isn't ``t``. This accepts ``foo.bar`` and rejects " +"``autoexec.bat``, but it requires a three-letter extension and won't accept " +"a filename 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`` でない、のいずれかを満たすようにすると、正規表現は複雑に" +"なります。\n" +"これなら ``foo.bar`` を受け入れ、``autoexec.bat`` を除外できます。\n" +"しかし拡張子が三文字であることを要求するため、``sendmail.cf`` のような二文字" +"の拡張子は受け入れられません。\n" +"これを修正すると、パターンはさらに複雑になります。" #: ../../howto/regex.rst:1033 msgid "``.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$``" @@ -2316,7 +2377,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 +2385,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 +2403,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 +2410,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 +2422,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 +2439,6 @@ msgstr "" "知りたい場合はよくあります。取りこみ用の括弧を正規表現に使った場合、その値も" "リストの一部として返されます。以下の呼び出しを比較してみましょう::" -#: ../../howto/regex.rst:1118 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p2 = re.compile(r'(\\W+)')\n" @@ -2384,6 +2447,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 +2462,6 @@ msgstr "" "モジュールレベル関数 :func:`re.split` は最初の引数に利用する正規表現を追加し" "ますが、それ以外は同じです。 ::" -#: ../../howto/regex.rst:1128 msgid "" ">>> re.split(r'[\\W]+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -2402,32 +2470,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 +2519,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 +2526,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 +2541,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 +2548,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 +2562,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 +2596,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 +2615,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 +2633,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 +2661,6 @@ msgid "" "hexadecimal::" msgstr "続く例では、置換関数は十進数文字列を十六進数文字列に変換しています::" -#: ../../howto/regex.rst:1219 msgid "" ">>> def hexrepl(match):\n" "... \"Return the hex string for a decimal number\"\n" @@ -2582,6 +2671,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,23 +2714,24 @@ 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:" -"`re` features such as the :const:`~re.IGNORECASE` flag, then the full power " -"of regular expressions may not be required. Strings have several methods for " -"performing operations with fixed strings and they're usually much faster, " -"because the implementation is a single small C loop that's been optimized " -"for the purpose, instead of the large, more generalized regular expression " -"engine." -msgstr "" -"いくつかの場合 :mod:`re` モジュールを利用することは間違いである場合がありま" -"す。固定文字列や単一の文字クラスにマッチさせる場合や、 :const:`~re." -"IGNORECASE` フラグのような :mod:`re` の機能を利用しない場合、正規表現の全ての" -"能力は必要とされていなでしょう。文字列は固定文字列に対する操作を実行するメ" -"ソッドを持っていて、大きな汎用化された正規表現エンジンではなく、目的のために" -"最適化された単一の小さな C loop で実装されているため、大抵の場合高速です." +"fixed string, or a single character class, and you're not using " +"any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the " +"full power of regular expressions may not be required. Strings have several " +"methods for performing operations with fixed strings and they're usually " +"much faster, because the implementation is a single small C loop that's been " +"optimized for the purpose, instead of the large, more generalized regular " +"expression engine." +msgstr "" +":mod:`re` モジュールを使わない方がよい場合もあります。\n" +"固定文字列や単一の文字クラスに一致するか調べるだけ" +"で、:const:`~re.IGNORECASE` フラグなどの :mod:`re` の機能を使わないなら、正規" +"表現の機能は必要ないかもしれません。\n" +"文字列には固定文字列を扱うメソッドがいくつかあり、通常はこちらの方がはるかに" +"高速です。\n" +"大きく汎用的な正規表現エンジンではなく、その目的に最適化された、小さな一つの " +"C のループで実装されているためです。" #: ../../howto/regex.rst:1254 msgid "" @@ -2644,8 +2742,8 @@ msgid "" "turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would " "have done that, too. (To avoid performing the substitution on parts of " "words, the pattern would have to be ``\\bword\\b``, in order to require that " -"``word`` have a word boundary on either side. This takes the job beyond :" -"meth:`!replace`'s abilities.)" +"``word`` have a word boundary on either side. This takes the job " +"beyond :meth:`!replace`'s abilities.)" msgstr "" "一つの例としては、単一の固定文字列を別の固定文字列に置き換える作業があるで" "しょう; 例えば ``word`` を ``deed`` で置換したい場合です。\n" @@ -2657,7 +2755,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 +2762,11 @@ 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,32 +2813,37 @@ 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 "" -"Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``." -"*`` to the front of your RE. Resist this temptation and use :func:`re." -"search` instead. The regular expression compiler does some analysis of REs " -"in order to speed up the process of looking for a match. One such analysis " -"figures out what the first character of a match must be; for example, a " -"pattern starting with ``Crow`` must match starting with a ``'C'``. The " -"analysis lets the engine quickly scan through the string looking for the " -"starting character, only trying the full match if a ``'C'`` is found." +"Sometimes you'll be tempted to keep using :func:`re.match`, and just add " +"``.*`` to the front of your RE. Resist this temptation and " +"use :func:`re.search` instead. The regular expression compiler does some " +"analysis of REs in order to speed up the process of looking for a match. " +"One such analysis figures out what the first character of a match must be; " +"for example, a pattern starting with ``Crow`` must match starting with a " +"``'C'``. The analysis lets the engine quickly scan through the string " +"looking for the starting character, only trying the full match if a ``'C'`` " +"is found." msgstr "" "しばしば、 :func:`re.match` を使い、 ``.*`` を正規表現の最初に付け加える誘惑" -"にからされることがあるでしょう。この誘惑に打ち克って、代わりに :func:`re." -"search` を利用すべきです。正規表現コンパイラはマッチを探す処理の高速化のため" -"にいくつかの解析を行います。そのような解析のうちのひとつはマッチの最初の文字" -"が何であるか評価することです; 例えば、 ``Crow`` で始まるパターンは ``'C'`` か" -"ら始まらなければいけません。解析によってエンジンは速やかに開始文字を探して走" -"査します、 ``'C'`` が発見された場合にはじめて完全なマッチを試みます。" +"にからされることがあるでしょう。この誘惑に打ち克って、代わり" +"に :func:`re.search` を利用すべきです。正規表現コンパイラはマッチを探す処理の" +"高速化のためにいくつかの解析を行います。そのような解析のうちのひとつはマッチ" +"の最初の文字が何であるか評価することです; 例えば、 ``Crow`` で始まるパターン" +"は ``'C'`` から始まらなければいけません。解析によってエンジンは速やかに開始文" +"字を探して走査します、 ``'C'`` が発見された場合にはじめて完全なマッチを試みま" +"す。" #: ../../howto/regex.rst:1304 msgid "" @@ -2819,7 +2922,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 +2930,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" @@ -2856,9 +2958,9 @@ msgid "" "regular expression can be helpful, because it allows you to format the " "regular expression more clearly." msgstr "" -"そのような正規表現に対しては、正規表現をコンパイルする時に :const:`re." -"VERBOSE` フラグを指定することが助けになります。なぜなら、より明確な書式で正規" -"表現を書けるからです。" +"そのような正規表現に対しては、正規表現をコンパイルする時" +"に :const:`re.VERBOSE` フラグを指定することが助けになります。なぜなら、より明" +"確な書式で正規表現を書けるからです。" #: ../../howto/regex.rst:1361 msgid "" @@ -2878,7 +2980,6 @@ msgstr "" "す。三重クォートを利用することで、正規表現をきちんとフォーマットすることがで" "きます::" -#: ../../howto/regex.rst:1369 msgid "" "pat = re.compile(r\"\"\"\n" " \\s* # Skip leading whitespace\n" @@ -2889,14 +2990,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..c56d4b6b3 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,21 +173,27 @@ 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 "" "A couple things to notice: we used ``socket.gethostname()`` so that the " -"socket would be visible to the outside world. If we had used ``s." -"bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would still " -"have a \"server\" socket, but one that was only visible within the same " -"machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any " -"address the machine happens to have." +"socket would be visible to the outside world. If we had used " +"``s.bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would " +"still have a \"server\" socket, but one that was only visible within the " +"same machine. ``s.bind(('', 80))`` specifies that the socket is reachable " +"by any address the machine happens to have." msgstr "" "ここで注意すべき点がいくつかある: 今回はソケットが外界に見えるよう、 " -"``socket.gethostname()`` を使った。 ``s.bind(('localhost', 80))`` や ``s." -"bind(('127.0.0.1', 80))`` でも「サーバ」ソケットにはなるが、それだと同じマシ" -"ン内にしか見えないものになってしまう。 ``s.bind(('', 80))`` はこのマシンが" -"持っている全てのアドレスで接続可能になるようにという指定になる。" +"``socket.gethostname()`` を使った。 ``s.bind(('localhost', 80))`` や " +"``s.bind(('127.0.0.1', 80))`` でも「サーバ」ソケットにはなるが、それだと同じ" +"マシン内にしか見えないものになってしまう。 ``s.bind(('', 80))`` はこのマシン" +"が持っている全てのアドレスで接続可能になるようにという指定になる。" #: ../../howto/sockets.rst:87 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..5412b5dd8 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 @@ -44,9 +44,9 @@ msgid "" "in-place. There is also a :func:`sorted` built-in function that builds a " "new sorted list from an iterable." msgstr "" -"Python のリストにはリストをインプレースに変更する、組み込みメソッド :meth:" -"`list.sort` があります。他にもイテラブルからソートしたリストを作成する組み込" -"み関数 :func:`sorted` があります。" +"Python のリストにはリストをインプレースに変更する、組み込みメソッ" +"ド :meth:`list.sort` があります。他にもイテラブルからソートしたリストを作成す" +"る組み込み関数 :func:`sorted` があります。" #: ../../howto/sorting.rst:13 msgid "" @@ -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,42 @@ 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." +"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`:" +"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 +154,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 +171,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 +186,6 @@ msgstr "" "同じテクニックは名前づけされた属性 (named attributes) を使うことでオブジェク" "トに対しても動作します。例えば:" -#: ../../howto/sorting.rst:84 msgid "" ">>> class Student:\n" "... def __init__(self, name, grade, age):\n" @@ -188,12 +204,28 @@ 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 "" "Objects with named attributes can be made by a regular class as shown above, " -"or they can be instances of :class:`~dataclasses.dataclass` or a :term:" -"`named tuple`." +"or they can be instances of :class:`~dataclasses.dataclass` or " +"a :term:`named tuple`." msgstr "" "名前づけされた属性を持つオブジェクトは上で示したとおり通常のクラスから作れま" "すし、:class:`~dataclasses.dataclass` や :term:`named tuple` のインスタンスで" @@ -207,19 +239,19 @@ msgstr "operator モジュールの関数や partial 関数による評価" msgid "" "The :term:`key function` patterns shown above are very common, so Python " "provides convenience functions to make accessor functions easier and faster. " -"The :mod:`operator` module has :func:`~operator.itemgetter`, :func:" -"`~operator.attrgetter`, and a :func:`~operator.methodcaller` function." +"The :mod:`operator` module " +"has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and " +"a :func:`~operator.methodcaller` function." msgstr "" "上で示した :term:`key function` パターンは非常に一般的なので、Python はアクセ" "サ関数を簡単に速く作れる便利な関数を提供しています。:mod:`operator` モジュー" -"ルに :func:`~operator.itemgetter`、:func:`~operator.attrgetter`、および :" -"func:`~operator.methodcaller` 関数があります。" +"ルに :func:`~operator.itemgetter`、:func:`~operator.attrgetter`、およ" +"び :func:`~operator.methodcaller` 関数があります。" #: ../../howto/sorting.rst:114 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 +261,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 +284,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 "" @@ -255,10 +298,9 @@ msgid "" "it suitable for use as a key-function." msgstr "" ":mod:`functools` モジュールには他にもキー関数を作るための便利なツールがありま" -"す。:func:`~functools.partial` 関数は複数引数の関数の `アリティ `_ を減らし、キー関数に適したものにできます。" +"す。:func:`~functools.partial` 関数は複数引数の関数の `アリティ `_ を減らし、キー関数に適したものにできます。" -#: ../../howto/sorting.rst:142 msgid "" ">>> from functools import partial\n" ">>> from unicodedata import normalize\n" @@ -271,6 +313,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 +338,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 +345,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 +365,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 +382,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 +398,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 +412,6 @@ msgstr "" "この処理は、リストおよびフィールド名とソート順序のタプルを複数受け取れるラッ" "パー関数へ抽象化できます。" -#: ../../howto/sorting.rst:199 msgid "" ">>> def multisort(xs, specs):\n" "... for key, reverse in reversed(specs):\n" @@ -361,6 +421,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 +473,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 +480,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 +511,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." +"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 +576,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::" +"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 +625,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" @@ -620,9 +700,9 @@ msgstr "残りのはしばし" #: ../../howto/sorting.rst:345 msgid "" -"For locale aware sorting, use :func:`locale.strxfrm` for a key function or :" -"func:`locale.strcoll` for a comparison function. This is necessary because " -"\"alphabetical\" sort orderings can vary across cultures even if the " +"For locale aware sorting, use :func:`locale.strxfrm` for a key function " +"or :func:`locale.strcoll` for a comparison function. This is necessary " +"because \"alphabetical\" sort orderings can vary across cultures even if the " "underlying alphabet is the same." msgstr "" "ロケールに対応したソートを行うには、キー関数に :func:`locale.strxfrm` を使う" @@ -638,10 +718,9 @@ msgid "" "function twice:" msgstr "" "*reverse* パラメータはソートの安定性を保ちます (ですから、レコードのキーが等" -"しい場合元々の順序が維持されます)。面白いことにこの影響はパラメータ無しで :" -"func:`reversed` 関数を二回使うことで模倣することができます:" +"しい場合元々の順序が維持されます)。面白いことにこの影響はパラメータ無し" +"で :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,37 +730,47 @@ 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 "" "The sort routines use ``<`` when making comparisons between two objects. So, " -"it is easy to add a standard sort order to a class by defining an :meth:" -"`~object.__lt__` method:" +"it is easy to add a standard sort order to a class by defining " +"an :meth:`~object.__lt__` method:" msgstr "" "ソート関数は、2つのオブジェクトを比較する際 ``<`` を用います。したがって、ク" "ラスに標準のソート順序を追加することは :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 "" -"However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :" -"meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for " +"However, note that ``<`` can fall back to using :meth:`~object.__gt__` " +"if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for " "details on the mechanics). To avoid surprises, :pep:`8` recommends that all " "six comparison methods be implemented. The :func:`~functools.total_ordering` " "decorator is provided to make that task easier." msgstr "" -"ただし、``<`` は :meth:`~object.__lt__` が実装されていなければ :meth:" -"`~object.__gt__` を使って代替することに注意してください (この技法について詳し" -"くは :func:`object.__lt__` を参照してください)。驚きを防ぐため、:pep:`8` は6" -"つの比較メソッドを全て実装することを推奨しています。この作業を簡単にするた" -"め、:func:`~functools.total_ordering` デコレータが提供されています。" +"ただし、``<`` は :meth:`~object.__lt__` が実装されていなけれ" +"ば :meth:`~object.__gt__` を使って代替することに注意してください (この技法に" +"ついて詳しくは :func:`object.__lt__` を参照してください)。驚きを防ぐた" +"め、:pep:`8` は6つの比較メソッドを全て実装することを推奨しています。この作業" +"を簡単にするため、:func:`~functools.total_ordering` デコレータが提供されてい" +"ます。" #: ../../howto/sorting.rst:381 msgid "" @@ -694,13 +783,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..006b8c031 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,15 +102,20 @@ 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 " -"(about 1.1 million values, the `actual number assigned `_ is less than that). In the standard and in " -"this document, a code point is written using the notation ``U+265E`` to mean " -"the character with value ``0x265e`` (9,822 in decimal)." -msgstr "" +"(about 1.1 million values, the `actual number assigned `_ is less than that). In the " +"standard and in 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,14 +392,19 @@ msgstr "" "標準を理解する助けにするために、Jukka Korpela が Unicode 文字表を読むための `" "入門ガイド `_ を書いています。" -#: ../../howto/unicode.rst:173 msgid "" -"Another `good introductory article `_ was " "written by Joel Spolsky. If this introduction didn't make things clear to " "you, you should try reading this alternate article before continuing." msgstr "" +"Joel Spolsky による別の `分かりやすい入門記事 `_ もあります。\n" +"ここまでの説明で理解できなかった場合は、先に進む前にそちらの記事を読んでみて" +"ください。" #: ../../howto/unicode.rst:178 msgid "" @@ -368,8 +413,8 @@ msgid "" "`_, for example." msgstr "" "Wikipedia の記事はしばしば役に立ちます; 例えば、\"`character encoding " -"`_\" や `UTF-8 `_ の記事を読んでみてください。" +"`_\" や `UTF-8 `_ の記事を読んでみてください。" #: ../../howto/unicode.rst:184 msgid "Python's Unicode Support" @@ -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 "" @@ -468,13 +527,12 @@ msgid "" "examples show the differences::" msgstr "" "*errors* 引数は、入力文字列に対しエンコーディングルールに従った変換ができな" -"かったときの対応方法を指定します。この引数に使える値は ``'strict'`` (:exc:" -"`UnicodeDecodeError` を送出する)、 ``'replace'`` (``REPLACEMENT CHARACTER`` " -"である ``U+FFFD`` を使う)、 ``'ignore'`` (結果となる Unicode から単に文字を除" -"く) 、``'backslashreplace'`` (エスケープシーケンス ``\\xNN`` を挿入する) で" -"す。次の例はこれらの違いを示しています::" +"かったときの対応方法を指定します。この引数に使える値は ``'strict'`` " +"(:exc:`UnicodeDecodeError` を送出する)、 ``'replace'`` (``REPLACEMENT " +"CHARACTER`` である ``U+FFFD`` を使う)、 ``'ignore'`` (結果となる Unicode から" +"単に文字を除く) 、``'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" @@ -535,15 +607,14 @@ msgid "" "the requested *encoding*." msgstr "" ":meth:`bytes.decode` とは処理が逆向きのメソッドが :meth:`str.encode` です。こ" -"のメソッドは、 Unicode 文字列を指定された *encoding* でエンコードして、 :" -"class:`bytes` による表現で返します。" +"のメソッドは、 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 " -"``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case inserts a " -"question mark instead of the unencodable character), there is also " +"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 ``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case " +"inserts a question mark instead of the unencodable character), there is also " "``'xmlcharrefreplace'`` (inserts an XML character reference), " "``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and " "``namereplace`` (inserts a ``\\N{...}`` escape sequence)." @@ -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 "" @@ -750,9 +867,9 @@ msgid "" "subcategories. To take the codes from the above output, ``'Ll'`` means " "'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, " "nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category " -"Values section of the Unicode Character Database documentation `_ for a list of category " -"codes." +"Values section of the Unicode Character Database documentation `_ for a list of " +"category codes." msgstr "" "カテゴリーコードは文字の性質を略記で表したものです。カテゴリーコードは " "\"Letter\"、\"Number\"、\"Punctuation\"、\"Symbol\" などのカテゴリーに分類さ" @@ -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,25 +906,32 @@ 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 "" -"A second tool is the :mod:`unicodedata` module's :func:`~unicodedata." -"normalize` function that converts strings to one of several normal forms, " -"where letters followed by a combining character are replaced with single " -"characters. :func:`~unicodedata.normalize` can be used to perform string " -"comparisons that won't falsely report inequality if two strings use " -"combining characters differently:" +"A second tool is the :mod:`unicodedata` " +"module's :func:`~unicodedata.normalize` function that converts strings to " +"one of several normal forms, where letters followed by a combining character " +"are replaced with single characters. :func:`~unicodedata.normalize` can be " +"used to perform string comparisons that won't falsely report inequality if " +"two strings use 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 "" @@ -913,19 +1081,18 @@ msgid "" "you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\\d+`` will " "match the substring \"57\" instead." msgstr "" -"実行すると、 ``\\d+`` はタイ語の数字と一致し、それを出力します。フラグ :" -"const:`re.ASCII` を :func:`~re.compile` に渡した場合、 ``\\d+`` は先程とは" -"違って部分文字列 \"57\" に一致します。" +"実行すると、 ``\\d+`` はタイ語の数字と一致し、それを出力します。フラ" +"グ :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 @@ -934,11 +1101,12 @@ msgstr "Python の Unicode サポートについての参考になる議論は #: ../../howto/unicode.rst:520 msgid "" -"`Processing Text Files in Python 3 `_, by Nick Coghlan." +"`Processing Text Files in Python 3 `_, " +"by Nick Coghlan." msgstr "" -"Nick Coghlan による `Processing Text Files in Python 3 `_" +"Nick Coghlan による `Processing Text Files in Python 3 `_" #: ../../howto/unicode.rst:521 msgid "" @@ -950,8 +1118,8 @@ msgstr "" #: ../../howto/unicode.rst:523 msgid "" -"The :class:`str` type is described in the Python library reference at :ref:" -"`textseq`." +"The :class:`str` type is described in the Python library reference " +"at :ref:`textseq`." msgstr "" ":class:`str` 型については Python ライブラリリファレンスの :ref:`textseq` で解" "説されています。" @@ -992,7 +1160,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 +1167,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 +1181,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 "" @@ -1051,20 +1220,22 @@ msgid "" "object that assumes the file's contents are in a specified encoding and " "accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` " "and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s " -"*encoding* and *errors* parameters which are interpreted just like those in :" -"meth:`str.encode` and :meth:`bytes.decode`." +"*encoding* and *errors* parameters which are interpreted just like those " +"in :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../howto/unicode.rst:574 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 +1243,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 +1275,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 +1282,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 +1320,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 +1337,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 +1348,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 +1368,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 +1397,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 +1431,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 +1438,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 +1468,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 +1494,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 +1528,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 " +"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..10829b224 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 @@ -52,17 +52,16 @@ msgstr "" #: ../../howto/urllib2.rst:18 msgid "" -"`Basic Authentication `_" +"`Basic Authentication `_" msgstr "" -"`Basic Authentication `_" +"`Basic Authentication `_" #: ../../howto/urllib2.rst:20 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,24 +119,25 @@ 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 "" "If you wish to retrieve a resource via URL and store it in a temporary " -"location, you can do so via the :func:`shutil.copyfileobj` and :func:" -"`tempfile.NamedTemporaryFile` functions::" +"location, you can do so via the :func:`shutil.copyfileobj` " +"and :func:`tempfile.NamedTemporaryFile` functions::" msgstr "" -"URL によってリソースを取得し、それを一時的な場所に保存しておきたいときは、 :" -"func:`shutil.copyfileobj` と :func:`tempfile.NamedTemporaryFile` 関数を使って" -"行うことができます::" +"URL によってリソースを取得し、それを一時的な場所に保存しておきたいとき" +"は、 :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 "" @@ -237,10 +252,9 @@ msgstr "" "ことです。全ての POST がフォームから送られるとは限りません: 自身のアプリケー" "ションに対して任意のデータを POST を使って送ることができます。一般的な HTML " "フォームの場合、データは標準的な方法でエンコードされている必要があり、リクエ" -"ストオブジェクトに ``data`` 引数として渡します。エンコーディングは :mod:" -"`urllib.parse` ライブラリの関数を使って行います。 ::" +"ストオブジェクトに ``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)." +"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." +":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,28 +490,39 @@ 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 " "request. The default handlers will handle some of these responses for you " "(for example, if the response is a \"redirection\" that requests the client " "fetch the document from a different URL, urllib will handle that for you). " -"For those it can't handle, urlopen will raise an :exc:`~urllib.error." -"HTTPError`. Typical errors include '404' (page not found), '403' (request " -"forbidden), and '401' (authentication required)." -msgstr "" +"For those it can't handle, urlopen will raise " +"an :exc:`~urllib.error.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" @@ -576,29 +642,43 @@ msgid "" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage 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." +"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 "" @@ -668,8 +765,8 @@ msgstr "" #: ../../howto/urllib2.rst:402 msgid "" "**info** - this returns a dictionary-like object that describes the page " -"fetched, particularly the headers sent by the server. It is currently an :" -"class:`http.client.HTTPMessage` instance." +"fetched, particularly the headers sent by the server. It is currently " +"an :class:`http.client.HTTPMessage` instance." msgstr "" "**info** - これは取得したページ (特にサーバからヘッダ)を表す辞書風オブジェク" "トを返します。これは現在では :class:`http.client.HTTPMessage` インスタンスで" @@ -700,13 +797,14 @@ msgid "" "(http, ftp, etc.), or how to handle an aspect of URL opening, for example " "HTTP redirections or HTTP cookies." msgstr "" -"URL を取得する場合、opener (混乱を招きやすい名前ですが、 :class:`urllib." -"request.OpenerDirector` のインスタンス) を利用します。標準的にはデフォルトの " -"opener を - ``urlopen`` を通して - 利用していますが、カスタムの opener を作成" -"することもできます。 opener は handler を利用します。全ての「一番厄介な仕事」" -"はハンドラによって行なわれます。各 handler は特定の URL スキーム (http, ftp, " -"等) での URL の開き方を知っていたり、 URL を開く局面でどう処理するかを知って" -"います、例えば HTTP リダイレクションや HTTP のクッキーなど。" +"URL を取得する場合、opener (混乱を招きやすい名前です" +"が、 :class:`urllib.request.OpenerDirector` のインスタンス) を利用します。標" +"準的にはデフォルトの opener を - ``urlopen`` を通して - 利用していますが、カ" +"スタムの opener を作成することもできます。 opener は handler を利用します。全" +"ての「一番厄介な仕事」はハンドラによって行なわれます。各 handler は特定の " +"URL スキーム (http, ftp, 等) での URL の開き方を知っていたり、 URL を開く局面" +"でどう処理するかを知っています、例えば HTTP リダイレクションや HTTP のクッ" +"キーなど。" #: ../../howto/urllib2.rst:423 msgid "" @@ -718,26 +816,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." +"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 +842,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 +865,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 +872,10 @@ msgid "" "Authentication Tutorial `__." msgstr "" +"ハンドラーの作成と登録の例として、``HTTPBasicAuthHandler`` を使います。\n" +"Basic 認証の仕組みを含む詳しい説明は、`Basic 認証のチュートリアル `__ を参照してください。" #: ../../howto/urllib2.rst:456 msgid "" @@ -795,23 +892,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 +918,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 +959,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 +987,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,18 +1031,20 @@ 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 "" "Currently ``urllib.request`` *does not* support fetching of ``https`` " -"locations through a proxy. However, this can be enabled by extending urllib." -"request as shown in the recipe [#]_." +"locations through a proxy. However, this can be enabled by extending " +"urllib.request as shown in the recipe [#]_." msgstr "" "現在 ``urllib.request`` はプロキシ経由で ``https`` ロケーションを取得する機能" "をサポートしていません。しかし、urllib.request をこのレシピ [#]_ で拡張するこ" @@ -955,9 +1077,9 @@ msgid "" "As of Python 2.3 you can specify how long a socket should wait for a " "response before timing out. This can be useful in applications which have to " "fetch web pages. By default the socket module has *no timeout* and can hang. " -"Currently, the socket timeout is not exposed at the http.client or urllib." -"request levels. However, you can set the default timeout globally for all " -"sockets using ::" +"Currently, the socket timeout is not exposed at the http.client or " +"urllib.request levels. However, you can set the default timeout globally for " +"all sockets using ::" msgstr "" "Python 2.3 ではレスポンスがタイムアウトするまでのソケットの待ち時間を指定する" "ことができます。これは web ページを取得する場合に便利に使うことができます。" @@ -966,7 +1088,6 @@ msgstr "" "ベルからは隠蔽されていています。しかし、以下を利用することで全てのソケットに" "対してグローバルにデフォルトタイムアウトを設定することができます ::" -#: ../../howto/urllib2.rst:562 msgid "" "import socket\n" "import urllib.request\n" @@ -980,6 +1101,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 +1121,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 +1164,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..dc1b20b42 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 @@ -72,9 +72,9 @@ msgid "" "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html " "independently covers all of the relevant information currently included here." msgstr "" -"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/setuptools." -"html にある ``setuptools`` のドキュメントが現時点でここにある関連情報を全て網" -"羅するまで、単独でここに載せておかれます。" +"このドキュメントは、 https://setuptools.readthedocs.io/en/latest/" +"setuptools.html にある ``setuptools`` のドキュメントが現時点でここにある関連" +"情報を全て網羅するまで、単独でここに載せておかれます。" #: ../../install/index.rst:34 msgid "" @@ -146,33 +146,34 @@ msgid "" "If you download a module source distribution, you can tell pretty quickly if " "it was packaged and distributed in the standard way, i.e. using the " "Distutils. First, the distribution's name and version number will be " -"featured prominently in the name of the downloaded archive, e.g. :file:" -"`foo-1.0.tar.gz` or :file:`widget-0.9.7.zip`. Next, the archive will unpack " -"into a similarly named directory: :file:`foo-1.0` or :file:`widget-0.9.7`. " -"Additionally, the distribution will contain a setup script :file:`setup.py`, " -"and a file named :file:`README.txt` or possibly just :file:`README`, which " -"should explain that building and installing the module distribution is a " -"simple matter of running one command from a terminal::" +"featured prominently in the name of the downloaded archive, " +"e.g. :file:`foo-1.0.tar.gz` or :file:`widget-0.9.7.zip`. Next, the archive " +"will unpack into a similarly named directory: :file:`foo-1.0` " +"or :file:`widget-0.9.7`. Additionally, the distribution will contain a " +"setup script :file:`setup.py`, and a file named :file:`README.txt` or " +"possibly just :file:`README`, which should explain that building and " +"installing the module distribution is a simple matter of running one command " +"from a terminal::" msgstr "" "モジュールのソースコード配布物をダウンロードしたら、配布物が標準のやり方、す" "なわち Distutils のやり方に従ってパッケージされて 配布されているかどうかすぐ" -"に分かります。Distutils の場合、まず配布物の名前とバージョン番号が、例えば :" -"file:`foo-1.0.tar.gz` や :file:`widget-0.9.7.zip` のように、ダウンロードされ" -"たアーカイブファイルの 名前にはっきりと反映されます。次に、アーカイブは同様の" -"名前のディレクトリ、例えば :file:`foo-1.0` や :file:`widget-0.9.7` に展開され" -"ます。さらに、配布物には setup スクリプト :file:`setup.py` が入っています。ま" -"た、 :file:`README.txt` 場合によっては :file:`README` という名前のファイルも" -"入っていて、そこには、モジュール配布物の構築とインストールは簡単で、このよう" -"にするだけだ、とするだけだ、という説明が書かれているはずです ::" +"に分かります。Distutils の場合、まず配布物の名前とバージョン番号が、例え" +"ば :file:`foo-1.0.tar.gz` や :file:`widget-0.9.7.zip` のように、ダウンロード" +"されたアーカイブファイルの 名前にはっきりと反映されます。次に、アーカイブは同" +"様の名前のディレクトリ、例えば :file:`foo-1.0` や :file:`widget-0.9.7` に展開" +"されます。さらに、配布物には setup スクリプト :file:`setup.py` が入っていま" +"す。また、 :file:`README.txt` 場合によっては :file:`README` という名前のファ" +"イルも入っていて、そこには、モジュール配布物の構築とインストールは簡単で、こ" +"のようにするだけだ、とするだけだ、という説明が書かれているはずです ::" #: ../../install/index.rst:81 msgid "" -"For Windows, this command should be run from a command prompt window (:" -"menuselection:`Start --> Accessories`)::" +"For Windows, this command should be run from a command prompt window " +"(:menuselection:`Start --> Accessories`)::" msgstr "" -"Windows ではこのコマンドは、コマンドプロンプトのウィンドウを開いて (:" -"menuselection:`スタート --> アクセサリ`)、このように実行するのに違いありませ" -"ん ::" +"Windows ではこのコマンドは、コマンドプロンプトのウィンドウを開いて " +"(:menuselection:`スタート --> アクセサリ`)、このように実行するのに違いありま" +"せん ::" #: ../../install/index.rst:86 msgid "" @@ -223,16 +224,16 @@ msgid "" "On Windows, you'd probably download :file:`foo-1.0.zip`. If you downloaded " "the archive file to :file:`C:\\\\Temp`, then it would unpack into :file:`C:\\" "\\Temp\\\\foo-1.0`; you can use either an archive manipulator with a " -"graphical user interface (such as WinZip) or a command-line tool (such as :" -"program:`unzip` or :program:`pkunzip`) to unpack the archive. Then, open a " -"command prompt window and run::" +"graphical user interface (such as WinZip) or a command-line tool (such " +"as :program:`unzip` or :program:`pkunzip`) to unpack the archive. Then, " +"open a command prompt window and run::" msgstr "" "Windows では、おそらく :file:`foo-1.0.zip` をダウンロードしているでしょう。" "アーカイブファイルを :file:`C:\\\\Temp` にダウンロードしたのなら、(WinZip の" -"ような) グラフィカルユーザインターフェースつきのアーカイブ操作ソフトや、 (:" -"program:`unzip` や :program:`pkunzip` のような) コマンドラインツールを使って" -"アーカイブを :file:`C:\\\\Temp\\\\foo-1.0` に展開します。次に、コマンドプロン" -"プトウィンドウを開いて、以下を実行します:" +"ような) グラフィカルユーザインターフェースつきのアーカイブ操作ソフトや、 " +"(:program:`unzip` や :program:`pkunzip` のような) コマンドラインツールを使っ" +"てアーカイブを :file:`C:\\\\Temp\\\\foo-1.0` に展開します。次に、コマンドプロ" +"ンプトウィンドウを開いて、以下を実行します:" #: ../../install/index.rst:133 msgid "Splitting the job up" @@ -272,10 +273,11 @@ msgid "" "notices that it has nothing to do, since everything in the :file:`build` " "directory is up-to-date." msgstr "" -"この作業を行ってみれば、 :command:`install` コマンドを実行するとまず :" -"command:`build` コマンドを実行し、さらに --- この場合には --- :file:`build` " -"ディレクトリの中が全て最新の状態になっているので、 :command:`build` は何も行" -"わなくてよいと判断していることがわかるでしょう。" +"この作業を行ってみれば、 :command:`install` コマンドを実行するとま" +"ず :command:`build` コマンドを実行し、さらに --- この場合には " +"--- :file:`build` ディレクトリの中が全て最新の状態になっているの" +"で、 :command:`build` は何も行わなくてよいと判断していることがわかるでしょ" +"う。" #: ../../install/index.rst:154 msgid "" @@ -297,10 +299,11 @@ msgstr "ビルドの仕組み" #: ../../install/index.rst:165 msgid "" "As implied above, the :command:`build` command is responsible for putting " -"the files to install into a *build directory*. By default, this is :file:" -"`build` under the distribution root; if you're excessively concerned with " -"speed, or want to keep the source tree pristine, you can change the build " -"directory with the :option:`!--build-base` option. For example::" +"the files to install into a *build directory*. By default, this " +"is :file:`build` under the distribution root; if you're excessively " +"concerned with speed, or want to keep the source tree pristine, you can " +"change the build directory with the :option:`!--build-base` option. For " +"example::" msgstr "" "上で示唆したように、 :command:`build` コマンドは、インストールすべきファイル" "を *ビルドディレクトリ* に置く働きがあります。デフォルトでは、ビルドディレク" @@ -329,11 +332,11 @@ msgid "" "directory, is used for \"pure module distributions\"---that is, module " "distributions that include only pure Python modules. If a module " "distribution contains any extensions (modules written in C/C++), then the " -"second form, with two ```` directories, is used. In that case, the :" -"file:`temp.{plat}` directory holds temporary files generated by the compile/" -"link process that don't actually get installed. In either case, the :file:" -"`lib` (or :file:`lib.{plat}`) directory contains all Python modules (pure " -"Python and extensions) that will be installed." +"second form, with two ```` directories, is used. In that case, " +"the :file:`temp.{plat}` directory holds temporary files generated by the " +"compile/link process that don't actually get installed. In either case, " +"the :file:`lib` (or :file:`lib.{plat}`) directory contains all Python " +"modules (pure Python and extensions) that will be installed." msgstr "" "```` は、現在の OS/ハードウェアプラットフォームと Python のバージョンを" "記述する短い文字列に展開されます。第一の :file:`lib` ディレクトリだけの形式" @@ -342,9 +345,10 @@ msgstr "" "ジュール (C/C++ で書かれたモジュール) が入っている場合、第二の ```` 付" "きディレクトリが二つある形式が使われます。この場合、 :file:`temp.{plat}` " "ディレクトリには、コンパイル/リンク過程で生成され、実際にはインストールされな" -"い一時ファイルが収められます。どちらの場合にも、 :file:`lib` (または :file:" -"`lib.{plat}`) ディレクトリには、最終的にインストールされることになる全ての " -"Python モジュール (pure Python モジュールおよび拡張モジュール) が入ります。" +"い一時ファイルが収められます。どちらの場合にも、 :file:`lib` (また" +"は :file:`lib.{plat}`) ディレクトリには、最終的にインストールされることにな" +"る全ての Python モジュール (pure Python モジュールおよび拡張モジュール) が入" +"ります。" #: ../../install/index.rst:194 msgid "" @@ -363,16 +367,16 @@ msgstr "インストールの仕組み" #: ../../install/index.rst:204 msgid "" "After the :command:`build` command runs (whether you run it explicitly, or " -"the :command:`install` command does it for you), the work of the :command:" -"`install` command is relatively simple: all it has to do is copy everything " -"under :file:`build/lib` (or :file:`build/lib.{plat}`) to your chosen " -"installation directory." -msgstr "" -":command:`build` コマンドを実行した後 (明示的に実行した場合も、 :command:" -"`install` コマンドが代わりに実行してくれた場合も) は、 :command:`install` コ" -"マンドの仕事は比較的単純なもの: :file:`build/lib` (または :file:`build/lib." -"{plat}`) の下にあるもの全ての指定したインストールディレクトリへのコピー、にな" -"ります。" +"the :command:`install` command does it for you), the work of " +"the :command:`install` command is relatively simple: all it has to do is " +"copy everything under :file:`build/lib` (or :file:`build/lib.{plat}`) to " +"your chosen installation directory." +msgstr "" +":command:`build` コマンドを実行した後 (明示的に実行した場合" +"も、 :command:`install` コマンドが代わりに実行してくれた場合も) " +"は、 :command:`install` コマンドの仕事は比較的単純なもの: :file:`build/lib` " +"(または :file:`build/lib.{plat}`) の下にあるもの全ての指定したインストール" +"ディレクトリへのコピー、になります。" #: ../../install/index.rst:210 msgid "" @@ -463,10 +467,11 @@ msgid "" "local`." msgstr "" "ほとんどの Linux ディストリビューションには、システムの標準インストール物とし" -"て Python が入っているので、 Linux では普通、 :file:`{prefix}` や :file:" -"`{exec-prefix}` はどちらも :file:`/usr` になります。 Linux (または Unixライ" -"クなシステム) 上で自分で Python をビルドした場合、デフォルトの :file:" -"`{prefix}` および :file:`{exec-prefix}` は :file:`/usr/local` になります。" +"て Python が入っているので、 Linux では普通、 :file:`{prefix}` " +"や :file:`{exec-prefix}` はどちらも :file:`/usr` になります。 Linux (または " +"Unixライクなシステム) 上で自分で Python をビルドした場合、デフォルト" +"の :file:`{prefix}` および :file:`{exec-prefix}` は :file:`/usr/local` になり" +"ます。" #: ../../install/index.rst:238 msgid "" @@ -482,14 +487,14 @@ msgid "" ":file:`{prefix}` and :file:`{exec-prefix}` stand for the directories that " "Python is installed to, and where it finds its libraries at run-time. They " "are always the same under Windows, and very often the same under Unix and " -"macOS. You can find out what your Python installation uses for :file:" -"`{prefix}` and :file:`{exec-prefix}` by running Python in interactive mode " -"and typing a few simple commands. Under Unix, just type ``python`` at the " -"shell prompt. Under Windows, choose :menuselection:`Start --> Programs --> " -"Python X.Y --> Python (command line)`. Once the interpreter is started, " -"you type Python code at the prompt. For example, on my Linux system, I type " -"the three Python statements shown below, and get the output as shown, to " -"find out my :file:`{prefix}` and :file:`{exec-prefix}`:" +"macOS. You can find out what your Python installation uses " +"for :file:`{prefix}` and :file:`{exec-prefix}` by running Python in " +"interactive mode and typing a few simple commands. Under Unix, just type " +"``python`` at the shell prompt. Under Windows, choose :menuselection:`Start " +"--> Programs --> Python X.Y --> Python (command line)`. Once the " +"interpreter is started, you type Python code at the prompt. For example, on " +"my Linux system, I type the three Python statements shown below, and get the " +"output as shown, to find out my :file:`{prefix}` and :file:`{exec-prefix}`:" msgstr "" ":file:`{prefix}` および :file:`{exec-prefix}` は、 Python がインストールされ" "ているディレクトリと、実行時にライブラリを探しにいく場所を表します。これらの" @@ -500,8 +505,8 @@ msgstr "" "> Python X.Y --> Python (command line)` を選びます。Unix では、シェルプロン" "プトで単に ``python`` と入力します。インタプリタを起動すると、プロンプトに " "Python コードを入力できます。例えば、著者の使っている Linux システムで、三つ" -"の Python 文を以下のように入力すると、出力から著者のシステムの :file:" -"`{prefix}` と :file:`{exec-prefix}` を得られます:" +"の Python 文を以下のように入力すると、出力から著者のシステム" +"の :file:`{prefix}` と :file:`{exec-prefix}` を得られます:" #: ../../install/index.rst:263 msgid "" @@ -514,12 +519,12 @@ msgid "" "``python3.2`` on UNIX will typically use ``Python32`` on Windows." msgstr "" "このドキュメントではほかにちょっとだけプレースホルダを使います: :file:`{X.Y}" -"` は Python のバージョンを表し、例えば ``3.2`` です; :file:`{abiflags}` は :" -"data:`sys.abiflags` の値に置き換えられるか、プラットフォームが ABI フラグを定" -"義しない場合、空文字列に置き換えられます; :file:`{distname}` はインストールし" -"ようとしているモジュール配布物の名前に置き換えられます。ドットとキャピタライ" -"ズはパス内で重要です; 例えば UNIX では ``python3.2`` が使われる値が、Windows " -"では普通 ``Python32`` を使います。" +"` は Python のバージョンを表し、例えば ``3.2`` です; :file:`{abiflags}` " +"は :data:`sys.abiflags` の値に置き換えられるか、プラットフォームが ABI フラグ" +"を定義しない場合、空文字列に置き換えられます; :file:`{distname}` はインストー" +"ルしようとしているモジュール配布物の名前に置き換えられます。ドットとキャピタ" +"ライズはパス内で重要です; 例えば UNIX では ``python3.2`` が使われる値が、" +"Windows では普通 ``Python32`` を使います。" #: ../../install/index.rst:271 msgid "" @@ -607,8 +612,8 @@ msgstr "" 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`). Here are the values for UNIX, including macOS:" +"modules and extension modules in the same location (also known " +"as :const:`site.USER_SITE`). Here are the values for UNIX, including macOS:" msgstr "" #: ../../install/index.rst:322 ../../install/index.rst:333 @@ -684,8 +689,8 @@ msgid "" "The advantage of using this scheme compared to the other ones described " "below is that the user site-packages directory is under normal conditions " "always included in :data:`sys.path` (see :mod:`site` for more information), " -"which means that there is no additional step to perform after running the :" -"file:`setup.py` script to finalize the installation." +"which means that there is no additional step to perform after running " +"the :file:`setup.py` script to finalize the installation." msgstr "" "このスキームが前述してきたほかのものと比較して有利なのは、ユーザの site-" "packages ディレクトリが常に :data:`sys.path` に含まれる普通の状態にある(詳細" @@ -694,10 +699,10 @@ msgstr "" #: ../../install/index.rst:347 msgid "" -"The :command:`build_ext` command also has a ``--user`` option to add :file:" -"`{userbase}/include` to the compiler search path for header files and :file:" -"`{userbase}/lib` to the compiler search path for libraries as well as to the " -"runtime search path for shared C libraries (rpath)." +"The :command:`build_ext` command also has a ``--user`` option to " +"add :file:`{userbase}/include` to the compiler search path for header files " +"and :file:`{userbase}/lib` to the compiler search path for libraries as well " +"as to the runtime search path for shared C libraries (rpath)." msgstr "" "さらに、コンパイラがヘッダファイルを検索するための :file:`{userbase}/" "include` 、ライブラリを検索するための :file:`{userbase}/lib` 、ランタイムの共" @@ -713,8 +718,8 @@ msgid "" "The idea behind the \"home scheme\" is that you build and maintain a " "personal stash of Python modules. This scheme's name is derived from the " "idea of a \"home\" directory on Unix, since it's not unusual for a Unix user " -"to make their home directory have a layout similar to :file:`/usr/` or :file:" -"`/usr/local/`. This scheme can be used by anyone, regardless of the " +"to make their home directory have a layout similar to :file:`/usr/` " +"or :file:`/usr/local/`. This scheme can be used by anyone, regardless of the " "operating system they are installing for." msgstr "" "\"home スキーム\" の背後にある考え方は、Python モジュールを個人用のモジュール" @@ -731,8 +736,8 @@ msgstr "新たなモジュールのインストールは単純で ::" #: ../../install/index.rst:369 msgid "" "where you can supply any directory you like for the :option:`!--home` " -"option. On Unix, lazy typists can just type a tilde (``~``); the :command:" -"`install` command will expand this to your home directory::" +"option. On Unix, lazy typists can just type a tilde (``~``); " +"the :command:`install` command will expand this to your home directory::" msgstr "" "のようにします。このとき、 :option:`!--home` オプションを使ってディレクトリを" "指定します。\n" @@ -744,8 +749,8 @@ msgstr "" msgid "" "To make Python find the distributions installed with this scheme, you may " "have to :ref:`modify Python's search path ` or edit :mod:`!" -"sitecustomize` (see :mod:`site`) to call :func:`site.addsitedir` or edit :" -"data:`sys.path`." +"sitecustomize` (see :mod:`site`) to call :func:`site.addsitedir` or " +"edit :data:`sys.path`." msgstr "" #: ../../install/index.rst:380 @@ -782,7 +787,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 +796,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 "" @@ -888,9 +892,9 @@ msgstr "" msgid "" "Incidentally, the real reason the prefix scheme is important is simply that " "a standard Unix installation uses the prefix scheme, but with :option:`!--" -"prefix` and :option:`!--exec-prefix` supplied by Python itself as ``sys." -"prefix`` and ``sys.exec_prefix``. Thus, you might think you'll never use " -"the prefix scheme, but every time you run ``python setup.py install`` " +"prefix` and :option:`!--exec-prefix` supplied by Python itself as " +"``sys.prefix`` and ``sys.exec_prefix``. Thus, you might think you'll never " +"use the prefix scheme, but every time you run ``python setup.py install`` " "without any other options, you're using it." msgstr "" "ちなみに、prefix スキームが重要な本当の理由は、単に標準の Unix インストール" @@ -934,9 +938,9 @@ msgstr "別の場所へのインストール (prefix を使う方法): Windows" #: ../../install/index.rst:470 msgid "" "Windows has no concept of a user's home directory, and since the standard " -"Python installation under Windows is simpler than under Unix, the :option:" -"`!--prefix` option has traditionally been used to install additional " -"packages in separate locations on Windows. ::" +"Python installation under Windows is simpler than under Unix, " +"the :option:`!--prefix` option has traditionally been used to install " +"additional packages in separate locations on Windows. ::" msgstr "" "Windows はユーザのホームディレクトリという概念がなく、 Windows 環境下で標準的" "にインストールされた Python は Unixよりも単純な構成をしているので、 Windows " @@ -953,10 +957,10 @@ msgstr "" #: ../../install/index.rst:479 msgid "" -"The installation base is defined by the :option:`!--prefix` option; the :" -"option:`!--exec-prefix` option is not supported under Windows, which means " -"that pure Python modules and extension modules are installed into the same " -"location. Files are installed as follows:" +"The installation base is defined by the :option:`!--prefix` option; " +"the :option:`!--exec-prefix` option is not supported under Windows, which " +"means that pure Python modules and extension modules are installed into the " +"same location. Files are installed as follows:" msgstr "" "インストールベースディレクトリは、 :option:`!--prefix` オプションだけで決まり" "ます; :option:`!--exec-prefix` オプションは、Windows ではサポートされていませ" @@ -977,10 +981,10 @@ msgstr "カスタムのインストール" #: ../../install/index.rst:499 msgid "" -"Sometimes, the alternate installation schemes described in section :ref:" -"`inst-alt-install` just don't do what you want. You might want to tweak " -"just one or two directories while keeping everything under the same base " -"directory, or you might want to completely redefine the installation " +"Sometimes, the alternate installation schemes described in " +"section :ref:`inst-alt-install` just don't do what you want. You might want " +"to tweak just one or two directories while keeping everything under the same " +"base directory, or you might want to completely redefine the installation " "scheme. In either case, you're creating a *custom installation scheme*." msgstr "" "たまに、 :ref:`inst-alt-install` 節で述べたような別の場所へのインストールス" @@ -1079,8 +1083,9 @@ msgstr "" "Unix 環境での例をもう一つ紹介します: インストール済みの Python が、 :file:`/" "usr/local/python` を prefix にしてビルドされ、インストールされていて、標準の" "インストールスクリプトは :file:`/usr/local/python/bin` に入るようになっている" -"とします。 :file:`/usr/local/bin` に入るようにしたければ、絶対パスを :option:" -"`!--install-scripts` オプションに与えて上書きすることになるでしょう::" +"とします。 :file:`/usr/local/bin` に入るようにしたければ、絶対パス" +"を :option:`!--install-scripts` オプションに与えて上書きすることになるでしょ" +"う::" #: ../../install/index.rst:546 msgid "" @@ -1095,19 +1100,19 @@ msgstr "" #: ../../install/index.rst:550 msgid "" "If you maintain Python on Windows, you might want third-party modules to " -"live in a subdirectory of :file:`{prefix}`, rather than right in :file:" -"`{prefix}` itself. This is almost as easy as customizing the script " -"installation directory---you just have to remember that there are two types " -"of modules to worry about, Python and extension modules, which can " +"live in a subdirectory of :file:`{prefix}`, rather than right " +"in :file:`{prefix}` itself. This is almost as easy as customizing the " +"script installation directory---you just have to remember that there are two " +"types of modules to worry about, Python and extension modules, which can " "conveniently be both controlled by one option::" msgstr "" -"Windows 上の Python を管理している場合、サードパーティ製のモジュールは :file:" -"`{prefix}` 直下ではなく、 :file:`{prefix}` 配下のサブディレクトリにインストー" -"ルしたいと考えるかもしれません。これはスクリプトのインストール先ディレクトリ" -"をカスタマイズするのとほとんど同じくらいに簡単です。 --- 覚えておかなければな" -"らないのは、Python には pure モジュールと拡張モジュールの2種類があり、これら" -"のインストール先はただひとつのオプションで簡単にコントロールできる、というこ" -"とだけです。" +"Windows 上の Python を管理している場合、サードパーティ製のモジュール" +"は :file:`{prefix}` 直下ではなく、 :file:`{prefix}` 配下のサブディレクトリに" +"インストールしたいと考えるかもしれません。これはスクリプトのインストール先" +"ディレクトリをカスタマイズするのとほとんど同じくらいに簡単です。 --- 覚えてお" +"かなければならないのは、Python には pure モジュールと拡張モジュールの2種類が" +"あり、これらのインストール先はただひとつのオプションで簡単にコントロールでき" +"る、ということだけです。" #: ../../install/index.rst:559 msgid "" @@ -1134,10 +1139,10 @@ msgid "" msgstr "" "インストールスキーム全体を定義したいのなら、全てのインストールディレクトリオ" "プションを指定しなければなりません。この作業には、相対パスを使った指定を勧め" -"ます; 例えば、全ての Python モジュール関連ファイルをホームディレクトリ下の :" -"file:`python` ディレクトリの下に置き、そのホームディレクトリをマウントしてい" -"る各プラットフォームごとに別のディレクトリを置きたければ、以下のようにインス" -"トールスキームを定義します::" +"ます; 例えば、全ての Python モジュール関連ファイルをホームディレクトリ下" +"の :file:`python` ディレクトリの下に置き、そのホームディレクトリをマウントし" +"ている各プラットフォームごとに別のディレクトリを置きたければ、以下のようにイ" +"ンストールスキームを定義します::" #: ../../install/index.rst:578 msgid "or, equivalently, ::" @@ -1247,19 +1252,19 @@ msgid "" "The expected convention for locally installed packages is to put them in " "the :file:`{...}/site-packages/` directory, but you may want to install " "Python modules into some arbitrary directory. For example, your site may " -"have a convention of keeping all software related to the web server under :" -"file:`/www`. Add-on Python modules might then belong in :file:`/www/python`, " -"and in order to import them, this directory must be added to ``sys.path``. " -"There are several different ways to add the directory." +"have a convention of keeping all software related to the web server " +"under :file:`/www`. Add-on Python modules might then belong in :file:`/www/" +"python`, and in order to import them, this directory must be added to " +"``sys.path``. There are several different ways to add the directory." msgstr "" "ローカルでインストールされるパッケージは、 :file:`{...}/site-packages/` ディ" "レクトリに入るのが決まりですが、ユーザはどこか任意のディレクトリに Python モ" "ジュールをインストールしたいと思うかもしれません。例えば、自分のサイトでは、 " "web サーバに関連する全てのソフトウェアを :file:`/www` に置くという決まりがあ" "るかもしれません。そこで、アドオンの Python モジュールが :file:`/www/python` " -"置かれることになると、モジュールを import するためにはディレクトリを ``sys." -"path`` に追加せねばなりません。ディレクトリを検索パスに追加するには、いくつか" -"の異なる方法が存在します。" +"置かれることになると、モジュールを import するためにはディレクトリを " +"``sys.path`` に追加せねばなりません。ディレクトリを検索パスに追加するには、い" +"くつかの異なる方法が存在します。" #: ../../install/index.rst:676 msgid "" @@ -1274,16 +1279,17 @@ msgstr "" "最も手軽な方法は、パス設定ファイルをすでに Python の検索パスに含まれるディレ" "クトリ、通常は :file:`.../site-packages/` ディレクトリに置くというものです。" "パス設定ファイルは拡張子が :file:`.pth` で、ファイルには ``sys.path`` に追加" -"するパスを一行に一つづつ記述しなければなりません。 (新たなパスは今の ``sys." -"path`` の後ろに追加されるので、追加されたディレクトリ内にあるモジュールが標準" -"のモジュールセットを上書きすることはありません。つまり、このメカニズムを使っ" -"て、標準モジュールに対する修正版のインストールはできないということです。)" +"するパスを一行に一つづつ記述しなければなりません。 (新たなパスは今の " +"``sys.path`` の後ろに追加されるので、追加されたディレクトリ内にあるモジュール" +"が標準のモジュールセットを上書きすることはありません。つまり、このメカニズム" +"を使って、標準モジュールに対する修正版のインストールはできないということで" +"す。)" #: ../../install/index.rst:684 msgid "" "Paths can be absolute or relative, in which case they're relative to the " -"directory containing the :file:`.pth` file. See the documentation of the :" -"mod:`site` module for more information." +"directory containing the :file:`.pth` file. See the documentation of " +"the :mod:`site` module for more information." msgstr "" "パスは絶対パスでも相対パスでもよく、相対パスの場合には :file:`.pth` ファイル" "のあるパスからの相対になります。詳しくは :mod:`site` モジュールを参照してくだ" @@ -1293,15 +1299,15 @@ msgstr "" msgid "" "A slightly less convenient way is to edit the :file:`site.py` file in " "Python's standard library, and modify ``sys.path``. :file:`site.py` is " -"automatically imported when the Python interpreter is executed, unless the :" -"option:`-S` switch is supplied to suppress this behaviour. So you could " -"simply edit :file:`site.py` and add two lines to it:" +"automatically imported when the Python interpreter is executed, unless " +"the :option:`-S` switch is supplied to suppress this behaviour. So you " +"could simply edit :file:`site.py` and add two lines to it:" msgstr "" "やや便利さには欠けますが、Python の標準ライブラリ中にある :file:`site.py` " "ファイルを編集することでも、 ``sys.path`` を変更できます。 :file:`site.py` " "は、 :option:`-S` スイッチを与えて抑制しないかぎり、Python インタープリタが実" -"行される際に自動的に import されます。ただし、設定するには、単に :file:" -"`site.py` を編集して、例えば以下のような二行を加えます:" +"行される際に自動的に import されます。ただし、設定するには、単" +"に :file:`site.py` を編集して、例えば以下のような二行を加えます:" #: ../../install/index.rst:699 msgid "" @@ -1313,32 +1319,32 @@ msgstr "" #: ../../install/index.rst:704 msgid "" -"There are two environment variables that can modify ``sys.path``. :envvar:" -"`PYTHONHOME` sets an alternate value for the prefix of the Python " -"installation. For example, if :envvar:`PYTHONHOME` is set to ``/www/" -"python``, the search path will be set to ``['', '/www/python/lib/pythonX." -"Y/', '/www/python/lib/pythonX.Y/plat-linux2', ...]``." +"There are two environment variables that can modify " +"``sys.path``. :envvar:`PYTHONHOME` sets an alternate value for the prefix of " +"the Python installation. For example, if :envvar:`PYTHONHOME` is set to ``/" +"www/python``, the search path will be set to ``['', '/www/python/lib/" +"pythonX.Y/', '/www/python/lib/pythonX.Y/plat-linux2', ...]``." msgstr "" -"また、 ``sys.path`` を修正できる二つの環境変数があります。 :envvar:" -"`PYTHONHOME` を使うと、インストールされている Python のプレフィクスを別の値に" -"設定できます。例えば、 :envvar:`PYTHONHOME` を ``/www/python`` に設定すると、" -"検索パスは ``['', '/www/python/lib/pythonX.Y/', '/www/python/lib/pythonX.Y/" -"plat-linux2', ...]`` といった具合になります。" +"また、 ``sys.path`` を修正できる二つの環境変数がありま" +"す。 :envvar:`PYTHONHOME` を使うと、インストールされている Python のプレフィ" +"クスを別の値に設定できます。例えば、 :envvar:`PYTHONHOME` を ``/www/python`` " +"に設定すると、検索パスは ``['', '/www/python/lib/pythonX.Y/', '/www/python/" +"lib/pythonX.Y/plat-linux2', ...]`` といった具合になります。" #: ../../install/index.rst:710 msgid "" "The :envvar:`PYTHONPATH` variable can be set to a list of paths that will be " -"added to the beginning of ``sys.path``. For example, if :envvar:" -"`PYTHONPATH` is set to ``/www/python:/opt/py``, the search path will begin " -"with ``['/www/python', '/opt/py']``. (Note that directories must exist in " -"order to be added to ``sys.path``; the :mod:`site` module removes paths that " -"don't exist.)" +"added to the beginning of ``sys.path``. For example, " +"if :envvar:`PYTHONPATH` is set to ``/www/python:/opt/py``, the search path " +"will begin with ``['/www/python', '/opt/py']``. (Note that directories must " +"exist in order to be added to ``sys.path``; the :mod:`site` module removes " +"paths that don't exist.)" msgstr "" ":envvar:`PYTHONPATH` を使うと、 ``sys.path`` の先頭に一連のパスを追加できま" "す。例えば、 :envvar:`PYTHONPATH` を ``/www/python:/opt/py`` に設定すると、検" "索パスは ``['/www/python', '/opt/py']`` から始まります。 (``sys.path`` に" -"ディレクトリを追加するには、そのディレクトリが実在しなければなりません; :mod:" -"`site` は実在しないディレクトリを除去します。)" +"ディレクトリを追加するには、そのディレクトリが実在しなければなりませ" +"ん; :mod:`site` は実在しないディレクトリを除去します。)" #: ../../install/index.rst:717 msgid "" @@ -1450,8 +1456,8 @@ msgstr "" msgid "" "Strictly speaking, the system-wide configuration file lives in the directory " "where the Distutils are installed; under Python 1.6 and later on Unix, this " -"is as shown. For Python 1.5.2, the Distutils will normally be installed to :" -"file:`{prefix}/lib/python1.5/site-packages/distutils`, so the system " +"is as shown. For Python 1.5.2, the Distutils will normally be installed " +"to :file:`{prefix}/lib/python1.5/site-packages/distutils`, so the system " "configuration file should be put there under Python 1.5.2." msgstr "" "厳密に言えば、システム全体向けの設定ファイルは、 Distutils がインストールされ" @@ -1464,8 +1470,8 @@ msgstr "" msgid "" "On Unix, if the :envvar:`HOME` environment variable is not defined, the " "user's home directory will be determined with the :func:`~pwd.getpwuid` " -"function from the standard :mod:`pwd` module. This is done by the :func:`os." -"path.expanduser` function used by Distutils." +"function from the standard :mod:`pwd` module. This is done by " +"the :func:`os.path.expanduser` function used by Distutils." msgstr "" #: ../../install/index.rst:786 @@ -1487,22 +1493,23 @@ msgstr "" "(注記 (1) も参照してください) Python 1.6 およびそれ以降のバージョンでは、 " "Python のデフォルトの \"インストールプレフィクス\" は :file:`C:\\\\Python` な" "ので、システム設定ファイルは通常 :file:`C:\\\\Python\\\\Lib\\\\distutils\\" -"\\distutils.cfg` になります。Python 1.5.2 ではデフォルトのプレフィクスは :" -"file:`C:\\\\Program Files\\\\Python` であり、Distutils は標準ライブラリの一部" -"ではありません --- 従って、システム設定ファイルは、 Windows 用の標準の " +"\\distutils.cfg` になります。Python 1.5.2 ではデフォルトのプレフィクス" +"は :file:`C:\\\\Program Files\\\\Python` であり、Distutils は標準ライブラリの" +"一部ではありません --- 従って、システム設定ファイルは、 Windows 用の標準の " "Python 1.5.2 では :file:`C:\\\\Program Files\\\\Python\\\\distutils\\" "\\distutils.cfg` になります。" #: ../../install/index.rst:798 msgid "" -"On Windows, if the :envvar:`HOME` environment variable is not defined, :" -"envvar:`USERPROFILE` then :envvar:`HOMEDRIVE` and :envvar:`HOMEPATH` will be " -"tried. This is done by the :func:`os.path.expanduser` function used by " -"Distutils." +"On Windows, if the :envvar:`HOME` environment variable is not " +"defined, :envvar:`USERPROFILE` then :envvar:`HOMEDRIVE` " +"and :envvar:`HOMEPATH` will be tried. This is done by " +"the :func:`os.path.expanduser` function used by Distutils." msgstr "" -"Windows では、環境変数 :envvar:`HOME` が設定されていない場合、 :envvar:" -"`USERPROFILE` 、 :envvar:`HOMEDRIVE` 、 :envvar:`HOMEPATH` を順々に試します。" -"このとき同時に Distutils によって :func:`os.path.expanduser` が実行されます。" +"Windows では、環境変数 :envvar:`HOME` が設定されていない場" +"合、 :envvar:`USERPROFILE` 、 :envvar:`HOMEDRIVE` 、 :envvar:`HOMEPATH` を" +"順々に試します。このとき同時に Distutils によって :func:`os.path.expanduser` " +"が実行されます。" #: ../../install/index.rst:807 msgid "Syntax of config files" @@ -1548,8 +1555,8 @@ msgstr "" #: ../../install/index.rst:829 msgid "" -"You could override the default \"build base\" directory and make the :" -"command:`build\\*` commands always forcibly rebuild all files with the " +"You could override the default \"build base\" directory and make " +"the :command:`build\\*` commands always forcibly rebuild all files with the " "following:" msgstr "" "以下のようにして、デフォルトの \"ビルドベース\" ディレクトリをオーバーライド" @@ -1578,19 +1585,19 @@ msgstr "" #: ../../install/index.rst:849 msgid "" -"You can find out the complete list of options for any command using the :" -"option:`!--help` option, e.g.::" +"You can find out the complete list of options for any command using " +"the :option:`!--help` option, e.g.::" msgstr "" -"あるコマンドに対するオプションの完全なリストは、例えば以下のように、 :option:" -"`!--help` を使って調べます::" +"あるコマンドに対するオプションの完全なリストは、例えば以下のよう" +"に、 :option:`!--help` を使って調べます::" #: ../../install/index.rst:854 msgid "" -"and you can find out the complete list of global options by using :option:" -"`!--help` without a command::" +"and you can find out the complete list of global options by " +"using :option:`!--help` without a command::" msgstr "" -"グローバルオプションの完全なリストを得るには、コマンドを指定せずに :option:" -"`!--help` オプションを使います::" +"グローバルオプションの完全なリストを得るには、コマンドを指定せず" +"に :option:`!--help` オプションを使います::" #: ../../install/index.rst:859 msgid "" @@ -1698,8 +1705,8 @@ msgid "" "*cpparg* is an argument for the C preprocessor, and is anything starting " "with :option:`!-I`, :option:`!-D`, :option:`!-U` or :option:`!-C`." msgstr "" -"*cpparg* は C プリプロセッサへの引数で、 :option:`!-I` 、 :option:`!-D` 、 :" -"option:`!-U` または :option:`!-C` のいずれかから始まる文字列です。" +"*cpparg* は C プリプロセッサへの引数で、 :option:`!-I` 、 :option:`!-" +"D` 、 :option:`!-U` または :option:`!-C` のいずれかから始まる文字列です。" #: ../../install/index.rst:914 msgid "" @@ -1724,9 +1731,9 @@ msgid "" "must be linked with the math library :file:`libm.a` on your platform, simply " "add :option:`!-lm` to the line::" msgstr "" -"で定義されたモジュールを、自分のプラットフォーム上の数学ライブラリ :file:" -"`libm.a` とリンクしなければならない場合、 :file:`Setup` 内の行に :option:`!-" -"lm` を追加するだけです::" +"で定義されたモジュールを、自分のプラットフォーム上の数学ライブラ" +"リ :file:`libm.a` とリンクしなければならない場合、 :file:`Setup` 内の行" +"に :option:`!-lm` を追加するだけです::" #: ../../install/index.rst:928 msgid "" @@ -1740,18 +1747,18 @@ msgstr "" msgid "" "The next option after :option:`!-Xcompiler` and :option:`!-Xlinker` will be " "appended to the proper command line, so in the above example the compiler " -"will be passed the :option:`!-o32` option, and the linker will be passed :" -"option:`!-shared`. If a compiler option requires an argument, you'll have " -"to supply multiple :option:`!-Xcompiler` options; for example, to pass ``-x " -"c++`` the :file:`Setup` file would have to contain ``-Xcompiler -x -" -"Xcompiler c++``." +"will be passed the :option:`!-o32` option, and the linker will be " +"passed :option:`!-shared`. If a compiler option requires an argument, " +"you'll have to supply multiple :option:`!-Xcompiler` options; for example, " +"to pass ``-x c++`` the :file:`Setup` file would have to contain ``-Xcompiler " +"-x -Xcompiler c++``." msgstr "" ":option:`!-Xcompiler` および :option:`!-Xlinker` の後にくるオプションは、それ" -"ぞれ適切なコマンドラインに追加されます。従って、上の例では、コンパイラには :" -"option:`!-o32` オプションが渡され、リンカには :option:`!-shared` が渡されま" -"す。コンパイラオプションに引数が必要な場合、複数の :option:`!-Xcompiler` オ" -"プションを与えます; 例えば、 ``-x c++`` を渡すには、 :file:`Setup` ファイルに" -"は ``-Xcompiler -x -Xcompiler c++`` を渡さねばなりません。" +"ぞれ適切なコマンドラインに追加されます。従って、上の例では、コンパイラに" +"は :option:`!-o32` オプションが渡され、リンカには :option:`!-shared` が渡され" +"ます。コンパイラオプションに引数が必要な場合、複数の :option:`!-Xcompiler` " +"オプションを与えます; 例えば、 ``-x c++`` を渡すには、 :file:`Setup` ファイル" +"には ``-Xcompiler -x -Xcompiler c++`` を渡さねばなりません。" #: ../../install/index.rst:940 msgid "" @@ -1759,9 +1766,9 @@ msgid "" "environment variable. If set, the contents of :envvar:`CFLAGS` will be " "added to the compiler flags specified in the :file:`Setup` file." msgstr "" -"コンパイラフラグは、環境変数 :envvar:`CFLAGS` の設定でも与えられます。 :" -"envvar:`CFLAGS` が設定されていれば、 :file:`Setup` ファイル内で指定されている" -"コンパイラフラグに :envvar:`CFLAGS` の内容が追加されます。" +"コンパイラフラグは、環境変数 :envvar:`CFLAGS` の設定でも与えられま" +"す。 :envvar:`CFLAGS` が設定されていれば、 :file:`Setup` ファイル内で指定され" +"ているコンパイラフラグに :envvar:`CFLAGS` の内容が追加されます。" #: ../../install/index.rst:948 msgid "Using non-Microsoft compilers on Windows" @@ -1778,8 +1785,9 @@ msgid "" "object file format (OMF) is different from the format used by the Python " "version you can download from the Python or ActiveState web site. (Python " "is built with Microsoft Visual C++, which uses COFF as the object file " -"format.) For this reason you have to convert Python's library :file:" -"`python25.lib` into the Borland format. You can do this as follows:" +"format.) For this reason you have to convert Python's " +"library :file:`python25.lib` into the Borland format. You can do this as " +"follows:" msgstr "" "この小節では、 Borland C++ コンパイラのバージョン 5.5 で Distutils を使うため" "に必要な手順について述べています。 まず、 Borland のオブジェクトファイル形" @@ -1792,15 +1800,15 @@ msgstr "" #: ../../install/index.rst:972 msgid "" -"The :file:`coff2omf` program comes with the Borland compiler. The file :" -"file:`python25.lib` is in the :file:`Libs` directory of your Python " +"The :file:`coff2omf` program comes with the Borland compiler. The " +"file :file:`python25.lib` is in the :file:`Libs` directory of your Python " "installation. If your extension uses other libraries (zlib, ...) you have " "to convert them too." msgstr "" -":file:`coff2omf` プログラムは、 Borland コンパイラに付属しています。 :file:" -"`python25.lib` は Python インストールディレクトリの :file:`Libs` ディレクト" -"リ内にあります。拡張モジュールで他のライブラリ (zlib, ...) を使っている場合、" -"それらのライブラリも変換しなければなりません。" +":file:`coff2omf` プログラムは、 Borland コンパイラに付属していま" +"す。 :file:`python25.lib` は Python インストールディレクトリの :file:`Libs` " +"ディレクトリ内にあります。拡張モジュールで他のライブラリ (zlib, ...) を使って" +"いる場合、それらのライブラリも変換しなければなりません。" #: ../../install/index.rst:977 msgid "" @@ -1820,10 +1828,10 @@ msgid "" msgstr "" "さて、 Distutils は異なる名前を持つこれらのライブラリをどのように扱うのでしょ" "うか? 拡張モジュールで (例えば :file:`foo` という名の) ライブラリが必要な場" -"合、 Distutils はまず :file:`_bcpp` が後ろに付いたライブラリ (例えば :file:" -"`foo_bcpp.lib`) が見つかるかどうか調べ、あればそのライブラリを使います。該当" -"するライブラリがなければ、デフォルトの名前 (:file:`foo.lib`) を使います。 " -"[#]_" +"合、 Distutils はまず :file:`_bcpp` が後ろに付いたライブラリ (例え" +"ば :file:`foo_bcpp.lib`) が見つかるかどうか調べ、あればそのライブラリを使いま" +"す。該当するライブラリがなければ、デフォルトの名前 (:file:`foo.lib`) を使いま" +"す。 [#]_" #: ../../install/index.rst:986 msgid "" @@ -1840,8 +1848,8 @@ msgid "" "Distutils (see section :ref:`inst-config-files`.)" msgstr "" "Borland C++ コンパイラをデフォルトにしたいなら、自分用、またはシステム全体向" -"けに、 Distutils の設定ファイルを書くことを検討した方がよいでしょう (:ref:" -"`inst-config-files` 節を参照してください)。" +"けに、 Distutils の設定ファイルを書くことを検討した方がよいでしょう " +"(:ref:`inst-config-files` 節を参照してください)。" #: ../../install/index.rst:999 msgid "`C++Builder Compiler `_" @@ -1857,11 +1865,11 @@ msgstr "" #: ../../install/index.rst:1002 msgid "" -"`Creating Python Extensions Using Borland's Free Compiler `_" +"`Creating Python Extensions Using Borland's Free Compiler `_" msgstr "" -"`Creating Python Extensions Using Borland's Free Compiler `_" +"`Creating Python Extensions Using Borland's Free Compiler `_" #: ../../install/index.rst:1002 msgid "" @@ -1969,9 +1977,9 @@ msgstr "" #: ../../install/index.rst:1058 msgid "" -"The resulting library has to be placed in the same directory as :file:" -"`python25.lib`. (Should be the :file:`libs` directory under your Python " -"installation directory.)" +"The resulting library has to be placed in the same directory " +"as :file:`python25.lib`. (Should be the :file:`libs` directory under your " +"Python installation directory.)" msgstr "" "出来上がったライブラリは、 :file:`python25.lib` と同じディレクトリに置かなけ" "ればなりません。 (Python インストールディレクトリの :file:`libs` ディレクトリ" @@ -1989,11 +1997,11 @@ msgstr "" #: ../../install/index.rst:1069 msgid "" -"`Building Python modules on MS Windows platform with MinGW `_" +"`Building Python modules on MS Windows platform with MinGW `_" msgstr "" -"`Building Python modules on MS Windows platform with MinGW `_" +"`Building Python modules on MS Windows platform with MinGW `_" #: ../../install/index.rst:1070 msgid "" @@ -2020,8 +2028,8 @@ msgstr "" #: ../../install/index.rst:1080 msgid "" -"Then you have no POSIX emulation available, but you also don't need :file:" -"`cygwin1.dll`." +"Then you have no POSIX emulation available, but you also don't " +"need :file:`cygwin1.dll`." msgstr "" -"このモードでは POSIX エミュレーションを利用できませんが、 :file:`cygwin1." -"dll` も必要なくなります。" +"このモードでは POSIX エミュレーションを利用できません" +"が、 :file:`cygwin1.dll` も必要なくなります。" diff --git a/installing/index.po b/installing/index.po index 0f65b6b96..fac50621c 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,17 +196,16 @@ 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 "" "For POSIX users (including macOS and Linux users), the examples in this " "guide assume the use of a :term:`virtual environment`." msgstr "" -"POSIX ユーザ(macOS と Linux ユーザを含みます)向けには、このガイド内の例は、 :" -"term:`virtual environment` の利用を前提にしています。" +"POSIX ユーザ(macOS と Linux ユーザを含みます)向けには、このガイド内の例" +"は、 :term:`virtual environment` の利用を前提にしています。" #: ../../installing/index.rst:91 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,15 +427,14 @@ 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 "" -"There are also additional resources for `installing pip. `__" +"There are also additional resources for `installing pip. `__" msgstr "" "他にも `pip のインストール `__ につ" @@ -473,10 +470,10 @@ msgstr "" #: ../../installing/index.rst:234 msgid "" -"Some of the solutions for installing `scientific software `__ that are not yet available as pre-built ``wheel`` " -"files may also help with obtaining other binary extensions without needing " -"to build them locally." +"Some of the solutions for installing `scientific software `__ that are not yet available as pre-built " +"``wheel`` files may also help with obtaining other binary extensions without " +"needing to build them locally." msgstr "" "ビルド済み ``wheel`` ファイルが未だ入手出来ない `scientific software " "`__ インストールにおけるいくつかの解" @@ -485,8 +482,8 @@ msgstr "" #: ../../installing/index.rst:241 msgid "" -"`Python Packaging User Guide: Binary Extensions `__" +"`Python Packaging User Guide: Binary Extensions `__" msgstr "" -"`Python Packaging User Guide: Binary Extensions `__" +"`Python Packaging User Guide: Binary Extensions `__" diff --git a/library/2to3.po b/library/2to3.po index f8f05088e..1d8d0e2cd 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 @@ -107,11 +107,11 @@ msgstr "変換処理を通じて、コメントと、インデントは保存さ #: ../../library/2to3.rst:64 msgid "" -"By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The :" -"option:`!-l` flag lists all available fixers. An explicit set of fixers to " -"run can be given with :option:`!-f`. Likewise the :option:`!-x` explicitly " -"disables a fixer. The following example runs only the ``imports`` and " -"``has_key`` fixers:" +"By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. " +"The :option:`!-l` flag lists all available fixers. An explicit set of " +"fixers to run can be given with :option:`!-f`. Likewise the :option:`!-x` " +"explicitly disables a fixer. The following example runs only the " +"``imports`` and ``has_key`` fixers:" msgstr "" "デフォルトでは、 2to3 は一連の :ref:`事前定義された変換プログラム <2to3-" "fixers>` を実行します。 :option:`!-l` フラグは、利用可能な変換プログラムの一" @@ -175,11 +175,11 @@ msgid "" "Since some print statements can be parsed as function calls or statements, " "2to3 cannot always read files containing the print function. When 2to3 " "detects the presence of the ``from __future__ import print_function`` " -"compiler directive, it modifies its internal grammar to interpret :func:" -"`print` as a function. This change can also be enabled manually with the :" -"option:`!-p` flag. Use :option:`!-p` to run fixers on code that already has " -"had its print statements converted. Also :option:`!-e` can be used to make :" -"func:`exec` a function." +"compiler directive, it modifies its internal grammar to " +"interpret :func:`print` as a function. This change can also be enabled " +"manually with the :option:`!-p` flag. Use :option:`!-p` to run fixers on " +"code that already has had its print statements converted. Also :option:`!-e` " +"can be used to make :func:`exec` a function." msgstr "" "いくつかの print 文は関数呼び出しとしても文としても解析できるので、 2to3 は " "print 関数を含むファイルを常に読めるとは限りません。 2to3 は ``from " @@ -187,15 +187,15 @@ msgstr "" "出すると、内部の文法を変更して :func:`print` を関数として解釈するようになりま" "す。 :option:`!-p` フラグによって手動でこの変更を有効化することもできます。 " "print 文を変換済みのコードに対して変換プログラムを適用するには :option:`!-p` " -"を使用してください。同様に、:func:`exec` を関数として解釈させるには :option:" -"`!-e` を使用してください。" +"を使用してください。同様に、:func:`exec` を関数として解釈させるに" +"は :option:`!-e` を使用してください。" #: ../../library/2to3.rst:110 msgid "" "The :option:`!-o` or :option:`!--output-dir` option allows specification of " -"an alternate directory for processed output files to be written to. The :" -"option:`!-n` flag is required when using this as backup files do not make " -"sense when not overwriting the input files." +"an alternate directory for processed output files to be written to. " +"The :option:`!-n` flag is required when using this as backup files do not " +"make sense when not overwriting the input files." msgstr "" ":option:`!-o` または :option:`!--output-dir` で処理結果の出力先ディレクトリを" "変更出来ます。入力ファイルを上書きしないならバックアップは意味をなさないの" @@ -375,21 +375,23 @@ msgstr "" #: ../../library/2to3.rst:207 msgid "" -"Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to :" -"meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and :meth:" -"`dict.itervalues` to :meth:`dict.values`. Similarly, :meth:`dict." -"viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` are converted " -"respectively to :meth:`dict.items`, :meth:`dict.keys` and :meth:`dict." -"values`. It also wraps existing usages of :meth:`dict.items`, :meth:`dict." -"keys`, and :meth:`dict.values` in a call to :class:`list`." -msgstr "" -"辞書をイテレートするメソッドを修正します。 :meth:`dict.iteritems` は :meth:" -"`dict.items` に、 :meth:`dict.iterkeys` は :meth:`dict.keys` に、 :meth:" -"`dict.itervalues` は :meth:`dict.values` に変換されます。同様に :meth:`dict." -"viewitems`, :meth:`dict.viewkeys` :meth:`dict.viewvalues` はそれぞれ :meth:" -"`dict.items`, :meth:`dict.keys`, :meth:`dict.values` に変換されます。また、 :" -"class:`list` の呼び出しの中で :meth:`dict.items`, :meth:`dict.keys`, :meth:" -"`dict.values` を使用している場合はそれをラップします。" +"Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted " +"to :meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, " +"and :meth:`dict.itervalues` to :meth:`dict.values`. " +"Similarly, :meth:`dict.viewitems`, :meth:`dict.viewkeys` " +"and :meth:`dict.viewvalues` are converted respectively " +"to :meth:`dict.items`, :meth:`dict.keys` and :meth:`dict.values`. It also " +"wraps existing usages of :meth:`dict.items`, :meth:`dict.keys`, " +"and :meth:`dict.values` in a call to :class:`list`." +msgstr "" +"辞書をイテレートするメソッドを修正します。 :meth:`dict.iteritems` " +"は :meth:`dict.items` に、 :meth:`dict.iterkeys` は :meth:`dict.keys` " +"に、 :meth:`dict.itervalues` は :meth:`dict.values` に変換されます。同様" +"に :meth:`dict.viewitems`, :meth:`dict.viewkeys` :meth:`dict.viewvalues` はそ" +"れぞれ :meth:`dict.items`, :meth:`dict.keys`, :meth:`dict.values` に変換され" +"ます。また、 :class:`list` の呼び出しの中" +"で :meth:`dict.items`, :meth:`dict.keys`, :meth:`dict.values` を使用している" +"場合はそれをラップします。" #: ../../library/2to3.rst:217 msgid "Converts ``except X, T`` to ``except X as T``." @@ -404,8 +406,8 @@ msgid "" "Removes usage of :func:`execfile`. The argument to :func:`execfile` is " "wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`." msgstr "" -":func:`execfile` の使用を削除します。 :func:`execfile` への引数は :func:" -"`open`, :func:`compile`, :func:`exec` の呼び出しでラップされます。" +":func:`execfile` の使用を削除します。 :func:`execfile` への引数" +"は :func:`open`, :func:`compile`, :func:`exec` の呼び出しでラップされます。" #: ../../library/2to3.rst:230 msgid "" @@ -445,14 +447,14 @@ msgid "" "This optional fixer performs several transformations that make Python code " "more idiomatic. Type comparisons like ``type(x) is SomeClass`` and " "``type(x) == SomeClass`` are converted to ``isinstance(x, SomeClass)``. " -"``while 1`` becomes ``while True``. This fixer also tries to make use of :" -"func:`sorted` in appropriate places. For example, this block ::" +"``while 1`` becomes ``while True``. This fixer also tries to make use " +"of :func:`sorted` in appropriate places. For example, this block ::" msgstr "" "このオプションの変換プログラムは、 Python コードをより Python らしい書き方に" "するいくつかの変形を行います。 ``type(x) is SomeClass`` や ``type(x) == " "SomeClass`` のような型の比較は ``isinstance(x, SomeClass)`` に変換されます。 " -"``while 1`` は ``while True`` になります。また、適切な場所では :func:" -"`sorted` が使われるようにします。例えば、このブロックは ::" +"``while 1`` は ``while True`` になります。また、適切な場所で" +"は :func:`sorted` が使われるようにします。例えば、このブロックは ::" #: ../../library/2to3.rst:265 msgid "is changed to ::" @@ -473,8 +475,8 @@ msgid "" "Handles other modules renames in the standard library. It is separate from " "the :2to3fixer:`imports` fixer only because of technical limitations." msgstr "" -"標準ライブラリ中の別のモジュール名の変更を扱います。単に技術的な制約のため" -"に :2to3fixer:`imports` とは別になっています。" +"標準ライブラリ中の別のモジュール名の変更を扱います。単に技術的な制約のために " +":2to3fixer:`imports` とは別になっています。" #: ../../library/2to3.rst:284 msgid "Converts ``input(prompt)`` to ``eval(input(prompt))``." @@ -497,23 +499,25 @@ msgstr "" #: ../../library/2to3.rst:299 msgid "" -"Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" -"func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are also " -"changed to :func:`itertools.filterfalse`." +"Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, " +"and :func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are " +"also changed to :func:`itertools.filterfalse`." msgstr "" ":func:`itertools.ifilter`, :func:`itertools.izip`, :func:`itertools.imap` の" -"インポートを削除します。また :func:`itertools.ifilterfalse` のインポートを :" -"func:`itertools.filterfalse` に変換します。" +"インポートを削除します。また :func:`itertools.ifilterfalse` のインポート" +"を :func:`itertools.filterfalse` に変換します。" #: ../../library/2to3.rst:305 msgid "" -"Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" -"func:`itertools.imap` to their built-in equivalents. :func:`itertools." -"ifilterfalse` is changed to :func:`itertools.filterfalse`." +"Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, " +"and :func:`itertools.imap` to their built-in " +"equivalents. :func:`itertools.ifilterfalse` is changed " +"to :func:`itertools.filterfalse`." msgstr "" ":func:`itertools.ifilter`, :func:`itertools.izip`, :func:`itertools.imap` を" -"使っている箇所を同等の組み込み関数で置き換えます。 :func:`itertools." -"ifilterfalse` は :func:`itertools.filterfalse` に変換されます。" +"使っている箇所を同等の組み込み関数で置き換えま" +"す。 :func:`itertools.ifilterfalse` は :func:`itertools.filterfalse` に変換さ" +"れます。" #: ../../library/2to3.rst:311 msgid "Renames :class:`long` to :class:`int`." @@ -542,8 +546,8 @@ msgid "" "Fixes old method attribute names. For example, ``meth.im_func`` is " "converted to ``meth.__func__``." msgstr "" -"古いメソッドの属性名を修正します。例えば ``meth.im_func`` は ``meth." -"__func__`` に変換されます。" +"古いメソッドの属性名を修正します。例えば ``meth.im_func`` は " +"``meth.__func__`` に変換されます。" #: ../../library/2to3.rst:331 msgid "Converts the old not-equal syntax, ``<>``, to ``!=``." @@ -551,9 +555,9 @@ msgstr "古い不等号の構文 ``<>`` を ``!=`` に変換します。" #: ../../library/2to3.rst:335 msgid "" -"Converts the use of iterator's :meth:`~iterator.next` methods to the :func:" -"`next` function. It also renames :meth:`next` methods to :meth:`~iterator." -"__next__`." +"Converts the use of iterator's :meth:`~iterator.next` methods to " +"the :func:`next` function. It also renames :meth:`next` methods " +"to :meth:`~iterator.__next__`." msgstr "" "イテレータの :meth:`~iterator.next` メソッドの使用を :func:`next` 関数に変換" "します。また :meth:`next` メソッドを :meth:`~iterator.__next__` に変更しま" @@ -561,8 +565,8 @@ msgstr "" #: ../../library/2to3.rst:341 msgid "" -"Renames definitions of methods called :meth:`__nonzero__` to :meth:`~object." -"__bool__`." +"Renames definitions of methods called :meth:`__nonzero__` " +"to :meth:`~object.__bool__`." msgstr ":meth:`__nonzero__` を :meth:`~object.__bool__` に変更します。" #: ../../library/2to3.rst:346 @@ -655,9 +659,9 @@ msgid "" "E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be " "incorrect because substituting tuples for exceptions has been removed in 3.0." msgstr "" -"``raise E, V`` を ``raise E(V)`` に、``raise E, V, T`` を ``raise E(V)." -"with_traceback(T)`` に変換します。例外の代わりにタプルを使用することは 3.0 で" -"削除されたので、``E`` がタプルならこの変換は不正確になります。" +"``raise E, V`` を ``raise E(V)`` に、``raise E, V, T`` を ``raise " +"E(V).with_traceback(T)`` に変換します。例外の代わりにタプルを使用することは " +"3.0 で削除されたので、``E`` がタプルならこの変換は不正確になります。" #: ../../library/2to3.rst:384 msgid "Converts :func:`raw_input` to :func:`input`." @@ -694,11 +698,13 @@ msgstr ":exc:`StandardError` を :exc:`Exception` に変更します。" #: ../../library/2to3.rst:413 msgid "" -"Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, :data:" -"`sys.exc_traceback` to use :func:`sys.exc_info`." +"Changes the " +"deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, :data:`sys.exc_traceback` " +"to use :func:`sys.exc_info`." msgstr "" -"廃止された :data:`sys.exc_value`, :data:`sys.exc_type`, :data:`sys." -"exc_traceback` の代わりに :func:`sys.exc_info` を使うように変更します。" +"廃止され" +"た :data:`sys.exc_value`, :data:`sys.exc_type`, :data:`sys.exc_traceback` の" +"代わりに :func:`sys.exc_info` を使うように変更します。" #: ../../library/2to3.rst:418 msgid "Fixes the API change in generator's :meth:`throw` method." @@ -745,8 +751,8 @@ msgid "" "Renames :func:`xrange` to :func:`range` and wraps existing :func:`range` " "calls with :class:`list`." msgstr "" -":func:`xrange` を :func:`range` に変更して、既存の :func:`range` 呼び出しを :" -"class:`list` でラップします。" +":func:`xrange` を :func:`range` に変更して、既存の :func:`range` 呼び出し" +"を :class:`list` でラップします。" #: ../../library/2to3.rst:451 msgid "Changes ``for x in file.xreadlines()`` to ``for x in file``." @@ -773,11 +779,11 @@ msgid "" "Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is using " "a less flexible LL(1) parser. Python 3.10 includes new language syntax that " "is not parsable by lib2to3's LL(1) parser (see :pep:`634`). The ``lib2to3`` " -"module was marked pending for deprecation in Python 3.9 (raising :exc:" -"`PendingDeprecationWarning` on import) and fully deprecated in Python 3.11 " -"(raising :exc:`DeprecationWarning`). It will be removed from the standard " -"library in Python 3.13. Consider third-party alternatives such as `LibCST`_ " -"or `parso`_." +"module was marked pending for deprecation in Python 3.9 " +"(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated in " +"Python 3.11 (raising :exc:`DeprecationWarning`). It will be removed from the " +"standard library in Python 3.13. Consider third-party alternatives such as " +"`LibCST`_ or `parso`_." msgstr "" #: ../../library/2to3.rst:485 diff --git a/library/__future__.po b/library/__future__.po index 8c365b4e4..be018bc97 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 @@ -33,10 +33,11 @@ msgstr "**ソースコード:** :source:`Lib/__future__.py`" #: ../../library/__future__.rst:11 msgid "" -"Imports of the form ``from __future__ import feature`` are called :ref:" -"`future statements `. These are special-cased by the Python compiler " -"to allow the use of new Python features in modules containing the future " -"statement before the release in which the feature becomes standard." +"Imports of the form ``from __future__ import feature`` are " +"called :ref:`future statements `. These are special-cased by the " +"Python compiler to allow the use of new Python features in modules " +"containing the future statement before the release in which the feature " +"becomes standard." msgstr "" "``from __future__ import feature`` の形式でのインポートは :ref:`future 文 " "` の定義と呼ばれています。これらは特殊なケースで、 Python の新機能が" @@ -51,9 +52,9 @@ msgid "" "way any other Python module would be. This design serves three purposes:" msgstr "" "これらの future 文が Python コンパイラーによって追加の特殊な意味を与えられる" -"一方で、それらは依然として他のインポート文のように実行され、 :mod:" -"`__future__` は存在し、他の Python モジュールと同じようにインポートシステムに" -"よって処理されます。この設計は3つの目的にかなっています:" +"一方で、それらは依然として他のインポート文のように実行さ" +"れ、 :mod:`__future__` は存在し、他の Python モジュールと同じようにインポート" +"システムによって処理されます。この設計は3つの目的にかなっています:" #: ../../library/__future__.rst:21 msgid "" @@ -78,9 +79,9 @@ msgstr "" #: ../../library/__future__.rst:29 msgid "" "To ensure that :ref:`future statements ` run under releases prior to " -"Python 2.1 at least yield runtime exceptions (the import of :mod:" -"`__future__` will fail, because there was no module of that name prior to " -"2.1)." +"Python 2.1 at least yield runtime exceptions (the import " +"of :mod:`__future__` will fail, because there was no module of that name " +"prior to 2.1)." msgstr "" "Python 2.1 以前のリリースで :ref:`future 文 ` が実行された場合に、最" "低でもランタイム例外を投げるようにするため (:mod:`__future__` のインポートは" @@ -101,21 +102,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 +231,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 +268,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 "" @@ -311,21 +314,24 @@ msgstr "" msgid "" "*CompilerFlag* is the (bitfield) flag that should be passed in the fourth " "argument to the built-in function :func:`compile` to enable the feature in " -"dynamically compiled code. This flag is stored in the :attr:`_Feature." -"compiler_flag` attribute on :class:`_Feature` instances." +"dynamically compiled code. This flag is stored in " +"the :attr:`_Feature.compiler_flag` attribute on :class:`_Feature` instances." msgstr "" "*CompilerFlag* は、動的にコンパイルされるコードでその機能を有効にするために、" "組み込み関数 :func:`compile` の第4引数に渡す(ビットフィールド)フラグです。こ" "のフラグは :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`." +"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..b281041de 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 @@ -52,8 +52,8 @@ msgstr "Python パッケージにおける ``__main__.py`` ファイル。" msgid "" "Both of these mechanisms are related to Python modules; how users interact " "with them and how they interact with each other. They are explained in " -"detail below. If you're new to Python modules, see the tutorial section :" -"ref:`tut-modules` for an introduction." +"detail below. If you're new to Python modules, see the tutorial " +"section :ref:`tut-modules` for an introduction." msgstr "" "どちらも Python のモジュールに関わる機能です。\n" "1つ目はユーザーがどうモジュールを使うか、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,41 +137,43 @@ 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 "" -"the Python module or package passed to the Python interpreter with the :" -"option:`-m` argument:" +"the Python module or package passed to the Python interpreter with " +"the :option:`-m` argument:" 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,90 +358,113 @@ 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)." +"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 " "message, so your program will have an exit code of ``1``, indicating " -"failure, and the string will be written to :data:`sys.stderr`. The ``echo." -"py`` example from earlier exemplifies using the ``sys.exit(main())`` " +"failure, and the string will be written to :data:`sys.stderr`. The " +"``echo.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 +474,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`` " +"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 +573,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 +596,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 +630,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 +695,25 @@ 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 +728,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`." +"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..475405ce8 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 @@ -41,9 +41,9 @@ msgstr "" "このモジュールはマルチスレッド (別名 :dfn:`軽量プロセス` (:dfn:`light-weight " "processes`)または :dfn:`タスク` (:dfn:`tasks`)) に用いられる低水準プリミティ" "ブを提供します --- グローバルデータ空間を共有するマルチスレッドを制御します。" -"同期のための単純なロック (別名 :dfn:`mutexes` またはバイナリセマフォ (:dfn:" -"`binary semaphores`))が提供されています。 :mod:`threading` モジュールは、この" -"モジュール上で、より使い易く高級なスレッディングの API を提供します。" +"同期のための単純なロック (別名 :dfn:`mutexes` またはバイナリセマフォ " +"(:dfn:`binary semaphores`))が提供されています。 :mod:`threading` モジュール" +"は、このモジュール上で、より使い易く高級なスレッディングの API を提供します。" #: ../../library/_thread.rst:26 msgid "This module used to be optional, it is now always available." @@ -81,59 +81,72 @@ 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 "" +"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." +"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 +177,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 "" @@ -186,9 +200,9 @@ msgid "" "*size* argument specifies the stack size to be used for subsequently created " "threads, and must be 0 (use platform or configured default) or a positive " "integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " -"used. If changing the thread stack size is unsupported, a :exc:" -"`RuntimeError` is raised. If the specified stack size is invalid, a :exc:" -"`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"used. If changing the thread stack size is unsupported, " +"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " +"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " "currently the minimum supported stack size value to guarantee sufficient " "stack space for the interpreter itself. Note that some platforms may have " "particular restrictions on values for the stack size, such as requiring a " @@ -202,27 +216,28 @@ msgstr "" "*size* 引数にはこれ以降に作成するスレッドのスタックサイズを指定し、0 (プラッ" "トフォームのデフォルト値または設定されたデフォルト値) か、 32,768 (32 KiB) 以" "上の正の整数でなければなりません。*size* が指定されない場合 0 が使われます。" -"スレッドのスタックサイズの変更がサポートされていない場合、 :exc:" -"`RuntimeError` を送出します。不正なスタックサイズが指定された場合、 :exc:" -"`ValueError` を送出して、スタックサイズは変更されません。32 KiB は現在のイン" -"タープリタ自身のために十分であると保証された最小のスタックサイズです。いくつ" -"かのプラットフォームではスタックサイズに対して制限があることに注意してくださ" -"い。例えば最小のスタックサイズが 32 KiB より大きかったり、システムのメモリ" -"ページサイズ の整数倍の必要があるなどです。この制限についてはプラットフォーム" -"のドキュメントを参照してください (一般的なページサイズは 4 KiB なので、プラッ" -"トフォームに関する情報がない場合は 4096 の整数倍のスタックサイズを選ぶといい" -"かもしれません)。" - -#: ../../library/_thread.rst:150 +"スレッドのスタックサイズの変更がサポートされていない場" +"合、 :exc:`RuntimeError` を送出します。不正なスタックサイズが指定された場" +"合、 :exc:`ValueError` を送出して、スタックサイズは変更されません。32 KiB は" +"現在のインタープリタ自身のために十分であると保証された最小のスタックサイズで" +"す。いくつかのプラットフォームではスタックサイズに対して制限があることに注意" +"してください。例えば最小のスタックサイズが 32 KiB より大きかったり、システム" +"のメモリページサイズ の整数倍の必要があるなどです。この制限についてはプラット" +"フォームのドキュメントを参照してください (一般的なページサイズは 4 KiB なの" +"で、プラットフォームに関する情報がない場合は 4096 の整数倍のスタックサイズを" +"選ぶといいかもしれません)。" + 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 +255,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 +289,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,23 +300,22 @@ 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 "" -"In addition to these methods, lock objects can also be used via the :keyword:" -"`with` statement, e.g.::" +"In addition to these methods, lock objects can also be used via " +"the :keyword:`with` statement, e.g.::" msgstr "" "これらのメソッドに加えて、ロックオブジェクトは :keyword:`with` 文を通じて以下" "の例のように使うこともできます。 ::" -#: ../../library/_thread.rst:208 msgid "" "import _thread\n" "\n" @@ -309,16 +324,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 "" @@ -331,8 +353,9 @@ msgstr "" #: ../../library/_thread.rst:225 msgid "" "When the main thread exits, it is system defined whether the other threads " -"survive. On most systems, they are killed without executing :keyword:" -"`try` ... :keyword:`finally` clauses or executing object destructors." +"survive. On most systems, they are killed without " +"executing :keyword:`try` ... :keyword:`finally` clauses or executing object " +"destructors." msgstr "" "メインスレッドが終了したとき、他のスレッドが生き残るかどうかは、システムに依" "存します。多くのシステムでは、 :keyword:`try` ... :keyword:`finally` 節や、オ" diff --git a/library/abc.po b/library/abc.po index f1da8dddf..69baef3bc 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 @@ -35,8 +35,9 @@ msgstr "**ソースコード:** :source:`Lib/abc.py`" msgid "" "This module provides the infrastructure for defining :term:`abstract base " "classes ` (ABCs) in Python, as outlined in :pep:`3119`; " -"see the PEP for why this was added to Python. (See also :pep:`3141` and the :" -"mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)" +"see the PEP for why this was added to Python. (See also :pep:`3141` and " +"the :mod:`numbers` module regarding a type hierarchy for numbers based on " +"ABCs.)" msgstr "" "このモジュールは Python に :pep:`3119` で概要が示された :term:`抽象基底クラ" "ス ` (ABC) を定義する基盤を提供します。なぜこれが " @@ -47,11 +48,16 @@ msgstr "" #: ../../library/abc.rst:20 msgid "" "The :mod:`collections` module has some concrete classes that derive from " -"ABCs; these can, of course, be further derived. In addition, the :mod:" -"`collections.abc` submodule has some ABCs that can be used to test whether a " -"class or instance provides a particular interface, for example, if it is :" -"term:`hashable` or if it is a :term:`mapping`." +"ABCs; these can, of course, be further derived. In addition, " +"the :mod:`collections.abc` submodule has some ABCs that can be used to test " +"whether a 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 "" @@ -59,8 +65,8 @@ msgid "" "helper class :class:`ABC` to alternatively define ABCs through inheritance:" msgstr "" "このモジュールは、 抽象基底クラスを定義するためのメタクラス :class:`ABCMeta` " -"と、 継承を利用して抽象基底クラスを代替的に定義するヘルパークラス :class:" -"`ABC` を提供します。" +"と、 継承を利用して抽象基底クラスを代替的に定義するヘルパークラ" +"ス :class:`ABC` を提供します。" #: ../../library/abc.rst:32 msgid "" @@ -68,16 +74,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 +96,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 +136,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 +147,6 @@ msgid "" msgstr "" "*subclass* を \"仮想的サブクラス\" としてこの ABC に登録します。たとえば::" -#: ../../library/abc.rst:75 msgid "" "from abc import ABC\n" "\n" @@ -141,6 +158,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 +174,12 @@ msgstr "" "クラスデコレータとして使うことができるように、登録されたサブクラスを返しま" "す。" -#: ../../library/abc.rst:88 msgid "" -"To detect calls to :meth:`!register`, you can use the :func:" -"`get_cache_token` function." +"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,16 +189,20 @@ 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 " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~type." -"__subclasscheck__` method of the ABC.)" +"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 +210,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,25 +250,58 @@ 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 " -"be called from subclasses. The :meth:`!get_iterator` method is also part of " -"the ``MyIterable`` abstract base class, but it does not have to be " -"overridden in non-abstract derived classes." +"The ABC ``MyIterable`` defines the standard iterable " +"method, :meth:`~object.__iter__`, as an abstract method. The implementation " +"given here can still be called from subclasses. The :meth:`!get_iterator` " +"method is also part of 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." +"(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 +310,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 +351,6 @@ msgid "" "the following usage examples::" msgstr "" -#: ../../library/abc.rst:187 msgid "" "class C(ABC):\n" " @abstractmethod\n" @@ -309,6 +382,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 +421,6 @@ msgid "" "Python's built-in :class:`property` does the equivalent of::" msgstr "" -#: ../../library/abc.rst:223 msgid "" "class Descriptor:\n" " ...\n" @@ -328,6 +429,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 +449,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 +476,6 @@ msgstr "" "この特殊ケースは :func:`classmethod` デコレータが抽象メソッドに適用された場合" "に抽象的だと正しく認識されるようになったため撤廃されます::" -#: ../../library/abc.rst:255 msgid "" "class C(ABC):\n" " @classmethod\n" @@ -378,6 +483,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 +513,6 @@ msgstr "" "この特殊ケースは :func:`staticmethod` デコレータが抽象メソッドに適用された場" "合に抽象的だと正しく認識されるようになったため撤廃されます::" -#: ../../library/abc.rst:276 msgid "" "class C(ABC):\n" " @staticmethod\n" @@ -411,12 +520,18 @@ 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 "" -"It is now possible to use :class:`property`, :meth:`property.getter`, :meth:" -"`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, " -"making this decorator redundant." +"It is now possible to " +"use :class:`property`, :meth:`property.getter`, :meth:`property.setter` " +"and :meth:`property.deleter` with :func:`abstractmethod`, making this " +"decorator redundant." msgstr "" ":class:`property` 、 :meth:`property.getter` 、 :meth:`property.setter` およ" "び :meth:`property.deleter` を :func:`abstractmethod` と一緒に使えるように" @@ -437,7 +552,6 @@ msgstr "" "この特殊ケースは :func:`property` デコレータが抽象メソッドに適用された場合に" "抽象的だと正しく認識されるようになったため撤廃されます::" -#: ../../library/abc.rst:297 msgid "" "class C(ABC):\n" " @property\n" @@ -445,6 +559,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 +575,6 @@ msgstr "" "ドの1つ以上を abstract にすることで、読み書きできる抽象プロパティを定義するこ" "とができます::" -#: ../../library/abc.rst:307 msgid "" "class C(ABC):\n" " @property\n" @@ -468,6 +586,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 +604,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 +633,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..3eae6235f 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -12,25 +12,28 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..63d40473d 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." +"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..d119d050f 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`" @@ -58,30 +60,39 @@ msgstr "チュートリアル" #: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " -"introduction to Python command-line parsing, have a look at the :ref:" -"`argparse tutorial `." +"introduction to Python command-line parsing, have a look at " +"the :ref:`argparse tutorial `." msgstr "" "このページは API のリファレンス情報が記載しています。:ref:`argparse チュート" "リアル ` では、コマンドラインの解析についてより優しく説明" "しています。" -#: ../../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:`!" -"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`!argparse` module also automatically generates help and usage " +"argparse` will figure out how to parse those out of :data:`sys.argv`. " +"The :mod:`!argparse` module also automatically generates help and usage " "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 +101,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 +123,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 +136,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 +165,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 +239,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 +279,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 +290,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 +337,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 +363,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 +407,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,20 +429,23 @@ 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." -"add_subparsers` or the ``prog`` and the ``usage`` arguments to :meth:" -"`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and " -"usage information across subparsers." +"want to consider passing the ``prog`` argument " +"to :meth:`~ArgumentParser.add_subparsers` or the ``prog`` and the ``usage`` " +"arguments to :meth:`~_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 +453,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 +481,6 @@ msgstr "" "します。このテキストは :class:`ArgumentParser` の ``epilog=`` 引数に指定でき" "ます::" -#: ../../library/argparse.rst:240 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -429,6 +495,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 "" @@ -436,8 +514,8 @@ msgid "" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -"description_ 引数と同じく、``epilog=`` テキストもデフォルトで折り返され、:" -"class:`ArgumentParser` の formatter_class_ 引数で動作を調整できます。" +"description_ 引数と同じく、``epilog=`` テキストもデフォルトで折り返さ" +"れ、:class:`ArgumentParser` の formatter_class_ 引数で動作を調整できます。" #: ../../library/argparse.rst:259 msgid "parents" @@ -447,20 +525,19 @@ msgstr "parents" msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " -"shared arguments and passed to ``parents=`` argument to :class:" -"`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" -"class:`ArgumentParser` objects, collects all the positional and optional " -"actions from them, and adds these actions to the :class:`ArgumentParser` " -"object being constructed::" +"shared arguments and passed to ``parents=`` argument " +"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " +"list of :class:`ArgumentParser` objects, collects all the positional and " +"optional actions from them, and adds these actions to " +"the :class:`ArgumentParser` object being constructed::" msgstr "" "ときどき、いくつかのパーサーが共通の引数セットを共有することがあります。それ" -"らの引数を繰り返し定義する代わりに、すべての共通引数を持ったパーサーを :" -"class:`ArgumentParser` の ``parents=`` 引数に渡すことができます。 " +"らの引数を繰り返し定義する代わりに、すべての共通引数を持ったパーサー" +"を :class:`ArgumentParser` の ``parents=`` 引数に渡すことができます。 " "``parents=`` 引数は :class:`ArgumentParser` オブジェクトのリストを受け取り、" "すべての位置アクションとオプションのアクションをそれらから集め、そのアクショ" "ンを構築中の :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 +552,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 "" @@ -512,16 +600,15 @@ msgstr "" #: ../../library/argparse.rst:305 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " -"more control over how textual descriptions are displayed. By default, :class:" -"`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " -"command-line help messages::" +"more control over how textual descriptions are displayed. By " +"default, :class:`ArgumentParser` objects line-wrap the description_ and " +"epilog_ texts in command-line help messages::" msgstr "" ":class:`RawDescriptionHelpFormatter` と :class:`RawTextHelpFormatter` はどの" -"ようにテキストの説明を表示するかを指定できます。デフォルトでは :class:" -"`ArgumentParser` オブジェクトはコマンドラインヘルプの中の description_ と " -"epilog_ を折り返して表示します::" +"ようにテキストの説明を表示するかを指定できます。デフォルトで" +"は :class:`ArgumentParser` オブジェクトはコマンドラインヘルプの中の " +"description_ と epilog_ を折り返して表示します::" -#: ../../library/argparse.rst:310 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -544,6 +631,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 +661,6 @@ msgstr "" "``formatter_class=`` に :class:`RawDescriptionHelpFormatter` を渡した場合、 " "description_ と epilog_ は整形済みとされ改行されません::" -#: ../../library/argparse.rst:334 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -578,14 +684,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 +725,6 @@ msgstr "" ":class:`ArgumentDefaultsHelpFormatter` は各引数のデフォルト値を自動的にヘルプ" "に追加します::" -#: ../../library/argparse.rst:364 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -612,6 +741,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 +765,6 @@ msgstr "" ":class:`MetavarTypeHelpFormatter` は、各引数の値の表示名に type_ 引数の値を使" "用します (通常は dest_ の値が使用されます)::" -#: ../../library/argparse.rst:383 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -639,20 +781,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 +819,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 "" @@ -684,12 +848,11 @@ msgid "" "by the arguments they contain. For example::" msgstr "" "ときどき、非常に長い引数リストを扱う場合に、その引数リストを毎回コマンドライ" -"ンにタイプする代わりにファイルに置いておきたい場合があります。:class:" -"`ArgumentParser` のコンストラクターに ``fromfile_prefix_chars=`` 引数が渡され" -"た場合、指定された文字のいずれかで始まる引数はファイルとして扱われ、そのファ" -"イルに含まれる引数リストに置換されます。例えば::" +"ンにタイプする代わりにファイルに置いておきたい場合がありま" +"す。:class:`ArgumentParser` のコンストラクターに ``fromfile_prefix_chars=`` " +"引数が渡された場合、指定された文字のいずれかで始まる引数はファイルとして扱わ" +"れ、そのファイルに含まれる引数リストに置換されます。例えば::" -#: ../../library/argparse.rst:429 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -699,27 +862,35 @@ 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 "" -"Arguments read from a file must by default be one per line (but see also :" -"meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " -"were in the same place as the original file referencing argument on the " +"Arguments read from a file must by default be one per line (but see " +"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " +"they were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." msgstr "" -"ファイルから読み込まれる引数は、デフォルトでは1行に1つ (ただし、:meth:" -"`~ArgumentParser.convert_arg_line_to_args` も参照してください) で、コマンドラ" -"イン上でファイルを参照する引数があった場所にその引数があったものとして扱われ" -"ます。このため、上の例では、``['-f', 'foo', '@args.txt']`` は ``['-f', " -"'foo', '-f', 'bar']`` と等価になります。" +"ファイルから読み込まれる引数は、デフォルトでは1行に1つ (ただ" +"し、:meth:`~ArgumentParser.convert_arg_line_to_args` も参照してください) で、" +"コマンドライン上でファイルを参照する引数があった場所にその引数があったものと" +"して扱われます。このため、上の例では、``['-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,14 +900,19 @@ 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) ` and ``\"strict\"``) to the :term:`filesystem encoding " -"and error handler`. Arguments file should be encoded in UTF-8 instead of " -"ANSI Codepage on Windows." -msgstr "" +"from default (e.g. :func:`locale.getpreferredencoding(False) " +"` and ``\"strict\"``) to the :term:`filesystem " +"encoding and error handler`. Arguments file should be encoded in UTF-8 " +"instead of ANSI Codepage on Windows." +msgstr "" +":class:`ArgumentParser` が引数ファイルの読み込みに使うエンコーディングとエ" +"ラーハンドラーを、デフォルト値 (:func:`locale.getpreferredencoding(False) " +"` と ``\"strict\"`` など) か" +"ら :term:`filesystem encoding and error handler` に変更しました。\n" +"Windows では、引数ファイルを ANSI コードページではなく UTF-8 でエンコードして" +"ください。" #: ../../library/argparse.rst:457 msgid "argument_default" @@ -744,24 +920,24 @@ msgstr "argument_default" #: ../../library/argparse.rst:459 msgid "" -"Generally, argument defaults are specified either by passing a default to :" -"meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." -"set_defaults` methods with a specific set of name-value pairs. Sometimes " -"however, it may be useful to specify a single parser-wide default for " -"arguments. This can be accomplished by passing the ``argument_default=`` " -"keyword argument to :class:`ArgumentParser`. For example, to globally " -"suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " -"supply ``argument_default=SUPPRESS``::" +"Generally, argument defaults are specified either by passing a default " +"to :meth:`~ArgumentParser.add_argument` or by calling " +"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" +"value pairs. Sometimes however, it may be useful to specify a single parser-" +"wide default for arguments. This can be accomplished by passing the " +"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " +"example, to globally suppress attribute creation " +"on :meth:`~ArgumentParser.parse_args` calls, we supply " +"``argument_default=SUPPRESS``::" msgstr "" "一般的には、引数のデフォルト値は :meth:`~ArgumentParser.add_argument` メソッ" "ドにデフォルト値を渡すか、:meth:`~ArgumentParser.set_defaults` メソッドに名前" "と値のペアを渡すことで指定します。しかしまれに、1つのパーサー全体に適用される" -"デフォルト引数が便利なことがあります。これを行うには、 :class:" -"`ArgumentParser` に ``argument_default=`` キーワード引数を渡します。例えば、" -"全体で :meth:`~ArgumentParser.parse_args` メソッド呼び出しの属性の生成を抑制" -"するには、``argument_default=SUPPRESS`` を指定します::" +"デフォルト引数が便利なことがあります。これを行うに" +"は、 :class:`ArgumentParser` に ``argument_default=`` キーワード引数を渡しま" +"す。例えば、全体で :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 +947,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" @@ -778,9 +961,9 @@ msgstr "allow_abbrev" #: ../../library/argparse.rst:481 msgid "" -"Normally, when you pass an argument list to the :meth:`~ArgumentParser." -"parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " -"abbreviations ` of long options." +"Normally, when you pass an argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it :ref:`recognizes abbreviations ` of long options." msgstr "" "通常、:class:`ArgumentParser` の :meth:`~ArgumentParser.parse_args` に引数の" "リストを渡すとき、長いオプションは :ref:`短縮しても認識されます >> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -800,6 +982,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 +1005,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 +1013,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 "" @@ -835,10 +1028,10 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" "ときどき (例えば parents_ を利用する場合など)、古い引数を同じオプション文字列" -"で上書きするほうが便利な場合があります。この動作をするには、:class:" -"`ArgumentParser` の ``conflict_handler=`` 引数に ``'resolve'`` を渡します::" +"で上書きするほうが便利な場合があります。この動作をするに" +"は、:class:`ArgumentParser` の ``conflict_handler=`` 引数に ``'resolve'`` を" +"渡します::" -#: ../../library/argparse.rst:517 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -852,6 +1045,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,23 +1073,26 @@ 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 "" "Occasionally, it may be useful to disable the addition of this help option. " -"This can be achieved by passing ``False`` as the ``add_help=`` argument to :" -"class:`ArgumentParser`::" +"This can be achieved by passing ``False`` as the ``add_help=`` argument " +"to :class:`ArgumentParser`::" msgstr "" -"必要に応じて、この help オプションを無効にする場合があります。これは :class:" -"`ArgumentParser` の ``add_help=`` 引数に ``False`` を渡すことで可能です::" +"必要に応じて、この 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 +1102,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 +1122,6 @@ msgstr "" "オプションではありません。この場合、``prefix_chars`` の最初の文字がヘルプオプ" "ションの接頭辞として利用されます::" -#: ../../library/argparse.rst:559 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -917,17 +1130,26 @@ 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." +"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 +1159,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 +1172,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 +1281,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 +1303,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 "" @@ -1105,13 +1336,12 @@ msgstr "metavar_ - 使用法メッセージの中で使われる引数の名前 #: ../../library/argparse.rst:681 msgid "" -"dest_ - The name of the attribute to be added to the object returned by :" -"meth:`parse_args`." +"dest_ - The name of the attribute to be added to the object returned " +"by :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" @@ -1121,9 +1351,9 @@ msgstr "name または flags" msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " -"a list of filenames, is expected. The first arguments passed to :meth:" -"`~ArgumentParser.add_argument` must therefore be either a series of flags, " -"or a simple argument name." +"a list of filenames, is expected. The first arguments passed " +"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " +"flags, or a simple argument name." msgstr "" ":meth:`~ArgumentParser.add_argument` メソッドは、指定されている引数が ``-f`` " "や ``--foo`` のようなオプション引数なのか、ファイル名リストなどの位置引数なの" @@ -1135,17 +1365,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 +1384,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 +1396,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 "" @@ -1209,16 +1446,17 @@ msgid "" msgstr "" ":class:`ArgumentParser` オブジェクトはコマンドライン引数にアクションを割り当" "てます。このアクションは、割り当てられたコマンドライン引数に関してどんな処理" -"でもできますが、ほとんどのアクションは単に :meth:`~ArgumentParser." -"parse_args` が返すオブジェクトに属性を追加するだけです。``action`` キーワード" -"引数は、コマンドライン引数がどう処理されるかを指定します。提供されているアク" -"ションは:" +"でもできますが、ほとんどのアクションは単" +"に :meth:`~ArgumentParser.parse_args` が返すオブジェクトに属性を追加するだけ" +"です。``action`` キーワード引数は、コマンドライン引数がどう処理されるかを指定" +"します。提供されているアクションは:" -#: ../../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 +1470,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 +1489,6 @@ msgid "" "``True`` respectively::" msgstr "" -#: ../../library/argparse.rst:772 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1257,6 +1497,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 +1538,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 +1547,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 +1564,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 +1572,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 +1587,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,28 +1604,27 @@ 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 "" -"``'version'`` - This expects a ``version=`` keyword argument in the :meth:" -"`~ArgumentParser.add_argument` call, and prints version information and " -"exits when invoked::" +"``'version'`` - This expects a ``version=`` keyword argument in " +"the :meth:`~ArgumentParser.add_argument` call, and prints version " +"information and exits when invoked::" msgstr "" "``'version'`` - このアクションは :meth:`~ArgumentParser.add_argument` の呼び" "出しに ``version=`` キーワード引数を期待します。指定されたときはバージョン情" "報を表示して終了します::" -#: ../../library/argparse.rst:836 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1374,6 +1633,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 +1654,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 +1661,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 +1674,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 +1703,32 @@ msgid "" ">>> args\n" "Namespace(bar='1', foo='2')" msgstr "" - -#: ../../library/argparse.rst:885 -msgid "For more details, see :class:`Action`." -msgstr "詳細は :class:`Action` を参照してください。" - +">>> 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 +1736,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 +1751,6 @@ msgstr "" "``N`` (整数) -- ``N`` 個の引数がコマンドラインから集められ、リストに格納され" "ます。例えば::" -#: ../../library/argparse.rst:901 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1465,6 +1758,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 +1787,6 @@ msgstr "" "いというケースもありえます。この場合は const_ の値が生成されます。この動作の" "例です::" -#: ../../library/argparse.rst:919 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1501,6 +1798,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 +1815,6 @@ msgid "" msgstr "" "``nargs='?'`` のよくある利用例の1つは、入出力ファイルの指定オプションです::" -#: ../../library/argparse.rst:932 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?')\n" @@ -1521,6 +1826,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 +1847,6 @@ msgstr "" "が ``nargs='*'`` を持つことにあまり意味はありませんが、複数のオプション引数" "が ``nargs='*'`` を持つことはありえます。例えば::" -#: ../../library/argparse.rst:949 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1542,6 +1855,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 +1872,6 @@ msgstr "" "す。加えて、最低でも1つのコマンドライン引数が存在しない場合にエラーメッセージ" "を生成します。例えば::" -#: ../../library/argparse.rst:962 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1563,8 +1881,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 +1896,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" @@ -1592,17 +1922,18 @@ msgstr "" msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " -"the ``const`` value to one of the attributes of the object returned by :meth:" -"`~ArgumentParser.parse_args`. See the action_ description for examples. If " -"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " -"receive a default value of ``None``." +"the ``const`` value to one of the attributes of the object returned " +"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " +"examples. If ``const`` is not provided " +"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " +"``None``." msgstr "" ":meth:`~ArgumentParser.add_argument` が ``action='store_const'`` か " "``action='append_const'`` で呼び出されたとき、これらのアクションは ``const`` " "の値を :meth:`~ArgumentParser.parse_args` が返すオブジェクトの属性に追加しま" -"す。サンプルは action_ の説明を参照してください。``const`` が :meth:" -"`~ArgumentParser.add_argument` に与えられなければ、``None`` のデフォルト値を" -"受け取ります。" +"す。サンプルは action_ の説明を参照してください。``const`` " +"が :meth:`~ArgumentParser.add_argument` に与えられなければ、``None`` のデフォ" +"ルト値を受け取ります。" #: ../../library/argparse.rst:994 msgid "" @@ -1634,11 +1965,11 @@ msgstr "default" #: ../../library/argparse.rst:1010 msgid "" "All optional arguments and some positional arguments may be omitted at the " -"command line. The ``default`` keyword argument of :meth:`~ArgumentParser." -"add_argument`, whose value defaults to ``None``, specifies what value should " -"be used if the command-line argument is not present. For optional arguments, " -"the ``default`` value is used when the option string was not present at the " -"command line::" +"command line. The ``default`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " +"specifies what value should be used if the command-line argument is not " +"present. For optional arguments, the ``default`` value is used when the " +"option string was not present at the command line::" msgstr "" "すべてのオプション引数といくつかの位置引数はコマンドライン上で省略されること" "があります。 :meth:`~ArgumentParser.add_argument` の ``default`` キーワード引" @@ -1646,7 +1977,6 @@ msgstr "" "る値を指定します。オプション引数では、オプション文字列がコマンドライン上に存" "在しなかったときに ``default`` の値が利用されます::" -#: ../../library/argparse.rst:1017 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1655,34 +1985,44 @@ 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 "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " -"conversion argument, if provided, before setting the attribute on the :class:" -"`Namespace` return value. Otherwise, the parser uses the value as is::" +"conversion argument, if provided, before setting the attribute on " +"the :class:`Namespace` return value. Otherwise, the parser uses the value " +"as is::" msgstr "" "``default`` の値が文字列の場合、パーサーは値をコマンドライン引数のように解析" "します。具体的には、パーサーは返り値 :class:`Namespace` の属性を設定する前" "に、type_ 変換引数が与えられていればそれらを適用します。そうでない場合、パー" "サーは値をそのまま使用します::" -#: ../../library/argparse.rst:1037 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1690,6 +2030,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 +2044,6 @@ msgstr "" "nargs_ が ``?`` か ``*`` である位置引数では、コマンドライン引数が指定されな" "かった場合 ``default`` の値が使われます。例えば::" -#: ../../library/argparse.rst:1046 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1708,13 +2052,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 +2076,6 @@ msgstr "" "``default=argparse.SUPPRESS`` を渡すと、コマンドライン引数が存在しないときに" "属性の追加をしなくなります::" -#: ../../library/argparse.rst:1060 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1733,6 +2084,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,24 +2114,28 @@ 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 " -"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" -"`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. Other exception types are not handled." +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " +"or :exc:`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 +2147,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 +2170,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 "" @@ -1828,16 +2204,15 @@ msgstr "" #: ../../library/argparse.rst:1123 msgid "" "For example, JSON or YAML conversions have complex error cases that require " -"better reporting than can be given by the ``type`` keyword. A :exc:`~json." -"JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` " -"exception would not be handled at all." +"better reporting than can be given by the ``type`` keyword. " +"A :exc:`~json.JSONDecodeError` would not be well formatted and " +"a :exc:`FileNotFoundError` exception would not be handled at all." msgstr "" "たとえば、JSON または YAML からの変換は複雑なエラーケースを持つので、" "``type`` がサポートする以上のエラー表示を必要とするでしょう。(JSON デコーダが" "発生しうる) :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 +2221,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 +2254,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 +2264,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 +2314,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,16 +2334,23 @@ 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 "" -"As the example shows, if an option is marked as ``required``, :meth:" -"`~ArgumentParser.parse_args` will report an error if that option is not " -"present at the command line." +"As the example shows, if an option is marked as " +"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " +"that option is not present at the command line." msgstr "" -"上の例のように、引数が ``required`` と指定されると、:meth:`~ArgumentParser." -"parse_args` はそのフラグがコマンドラインに存在しないときにエラーを表示しま" -"す。" +"上の例のように、引数が ``required`` と指定される" +"と、:meth:`~ArgumentParser.parse_args` はそのフラグがコマンドラインに存在しな" +"いときにエラーを表示します。" #: ../../library/argparse.rst:1199 msgid "" @@ -1967,28 +2364,29 @@ 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 "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " -"``%(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" +"(type)s``, etc.::" msgstr "" "``help`` 文字列には、プログラム名や引数の default_ などを繰り返し記述するのを" "避けるためのフォーマット指定子を含めることができます。利用できる指定子には、" -"プログラム名 ``%(prog)s`` と、 ``%(default)s`` や ``%(type)s`` など :meth:" -"`~ArgumentParser.add_argument` のキーワード引数の多くが含まれます::" +"プログラム名 ``%(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 +2400,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 +2420,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 +2436,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 +2458,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 +2485,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 +2520,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 "" @@ -2090,9 +2541,9 @@ msgid "" "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -"``metavar`` は *表示される* 名前だけを変更することに注意してください。:meth:" -"`~ArgumentParser.parse_args` の返すオブジェクトの属性名は dest_ の値のままで" -"す。" +"``metavar`` は *表示される* 名前だけを変更することに注意してくださ" +"い。:meth:`~ArgumentParser.parse_args` の返すオブジェクトの属性名は dest_ の" +"値のままです。" #: ../../library/argparse.rst:1295 msgid "" @@ -2103,7 +2554,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 +2566,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" @@ -2125,24 +2585,28 @@ msgstr "dest" msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " -"attribute is determined by the ``dest`` keyword argument of :meth:" -"`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " -"is normally supplied as the first argument to :meth:`~ArgumentParser." -"add_argument`::" +"attribute is determined by the ``dest`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " +"``dest`` is normally supplied as the first argument " +"to :meth:`~ArgumentParser.add_argument`::" msgstr "" -"ほとんどの :class:`ArgumentParser` のアクションは :meth:`~ArgumentParser." -"parse_args` が返すオブジェクトに対する属性として値を追加します。この属性の名" -"前は :meth:`~ArgumentParser.add_argument` の ``dest`` キーワード引数によって" -"決定されます。位置引数のアクションについては、 ``dest`` は通常 :meth:" -"`~ArgumentParser.add_argument` の第一引数として渡します::" +"ほとんどの :class:`ArgumentParser` のアクション" +"は :meth:`~ArgumentParser.parse_args` が返すオブジェクトに対する属性として値" +"を追加します。この属性の名前は :meth:`~ArgumentParser.add_argument` の " +"``dest`` キーワード引数によって決定されます。位置引数のアクションについて" +"は、 ``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 +2642,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 +2665,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,29 +2684,44 @@ 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`." +"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 " "from the command line. The :class:`!Action` class must accept the two " -"positional arguments plus any keyword arguments passed to :meth:" -"`ArgumentParser.add_argument` except for the ``action`` itself." +"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 +2729,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`." +"*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`." +"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,28 +2806,30 @@ 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 "" -"args_ - List of strings to parse. The default is taken from :data:`sys." -"argv`." +"args_ - List of strings to parse. The default is taken " +"from :data:`sys.argv`." msgstr "" "args_ - 解析する文字列のリスト。デフォルトでは :data:`sys.argv` から取得され" "ます。" #: ../../library/argparse.rst:1448 msgid "" -"namespace_ - An object to take the attributes. The default is a new empty :" -"class:`Namespace` object." +"namespace_ - An object to take the attributes. The default is a new " +"empty :class:`Namespace` object." msgstr "" -"namespace_ - 属性を代入するオブジェクト。デフォルトでは、新しい空の :class:" -"`Namespace` オブジェクトです。" +"namespace_ - 属性を代入するオブジェクト。デフォルトでは、新しい空" +"の :class:`Namespace` オブジェクトです。" #: ../../library/argparse.rst:1453 msgid "Option value syntax" @@ -2339,7 +2845,6 @@ msgstr "" "オプションの値の指定に複数の方法をサポートしています。もっとも単純な場合に" "は、オプションとその値は次のように2つの別々の引数として渡されます::" -#: ../../library/argparse.rst:1459 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2349,6 +2854,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 +2872,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 +2887,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 +2903,6 @@ msgstr "" "い場合、複数の短いオプションは次のように1つの接頭辞 ``-`` だけで連結できま" "す::" -#: ../../library/argparse.rst:1483 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2398,6 +2911,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 +3022,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 +3050,6 @@ msgstr "" "`、長いオプションに曖昧さがない (先頭文字列が一意である) かぎ" "り、先頭文字列に短縮して指定できます::" -#: ../../library/argparse.rst:1580 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2542,6 +3062,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 +3085,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 +3110,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" @@ -2596,11 +3140,10 @@ msgid "" "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -"このクラスはシンプルに設計されており、単に読みやすい文字列表現を持った :" -"class:`object` のサブクラスです。もし属性を辞書のように扱える方が良ければ、標" -"準的な Python のイディオム :func:`vars` を利用できます::" +"このクラスはシンプルに設計されており、単に読みやすい文字列表現を持っ" +"た :class:`object` のサブクラスです。もし属性を辞書のように扱える方が良けれ" +"ば、標準的な Python のイディオム :func:`vars` を利用できます::" -#: ../../library/argparse.rst:1630 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2608,6 +3151,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 +3167,6 @@ msgstr "" "既存のオブジェクトに属性を設定する方が良い場合があります。これは " "``namespace=`` キーワード引数を指定することで可能です::" -#: ../../library/argparse.rst:1640 msgid "" ">>> class C:\n" "... pass\n" @@ -2631,6 +3178,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,37 +3196,52 @@ 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``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " -"functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" -"add_subparsers` method. The :meth:`!add_subparsers` method is normally " -"called with no arguments and returns a special action object. This object " -"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`!ArgumentParser` constructor arguments, and " -"returns an :class:`!ArgumentParser` object that can be modified as usual." -msgstr "" +"functions which require different kinds of command-line " +"arguments. :class:`ArgumentParser` supports the creation of such subcommands " +"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " +"is normally called with no arguments and returns a special action object. " +"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " +"which takes a 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 +3250,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 +3285,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 +3317,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 +3366,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 +3395,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 +3433,6 @@ msgstr "" "もサポートしています。どちらかが存在する場合、サブパーサーのコマンドはヘルプ" "出力でそれぞれのグループの中に表示されます。例えば::" -#: ../../library/argparse.rst:1772 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2835,6 +3451,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 +3476,6 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1794 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2853,6 +3484,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 +3505,6 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1820 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2902,6 +3538,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 +3585,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 +3595,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" @@ -2947,18 +3621,17 @@ msgstr "FileType オブジェクト" #: ../../library/argparse.rst:1881 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " -"argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" -"`FileType` objects as their type will open command-line arguments as files " -"with the requested modes, buffer sizes, encodings and error handling (see " -"the :func:`open` function for more details)::" +"argument of :meth:`ArgumentParser.add_argument`. Arguments that " +"have :class:`FileType` objects as their type will open command-line " +"arguments as files with the requested modes, buffer sizes, encodings and " +"error handling (see the :func:`open` function for more details)::" msgstr "" ":class:`FileType` ファクトリは :meth:`ArgumentParser.add_argument` の type 引" "数に渡すことができるオブジェクトを生成します。 type が :class:`FileType` オブ" "ジェクトである引数はコマンドライン引数を、指定されたモード、バッファーサイ" -"ズ、エンコーディング、エラー処理でファイルとして開きます (詳細は :func:" -"`open` 関数を参照してください。)::" +"ズ、エンコーディング、エラー処理でファイルとして開きます (詳細" +"は :func:`open` 関数を参照してください。)::" -#: ../../library/argparse.rst:1887 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2968,6 +3641,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 "" @@ -2975,19 +3655,21 @@ msgid "" "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -"FileType オブジェクトは擬似引数 ``'-'`` を識別し、読み込み用の :class:" -"`FileType` であれば :data:`sys.stdin` を、書き込み用の :class:`FileType` であ" -"れば :data:`sys.stdout` に変換します::" +"FileType オブジェクトは擬似引数 ``'-'`` を識別し、読み込み用" +"の :class:`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 +3677,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 +3691,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 +3698,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,19 +3715,34 @@ 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 :" -"class:`ArgumentParser`. When an argument is added to the group, the parser " -"treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`!add_argument_group` method " -"accepts *title* and *description* arguments which can be used to customize " -"this display::" -msgstr "" +"has an :meth:`~ArgumentParser.add_argument` method just like a " +"regular :class:`ArgumentParser`. When an argument is added to the group, " +"the parser treats it just like a normal argument, but displays the argument " +"in a separate group for help messages. The :meth:`!add_argument_group` " +"method 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,15 +3762,35 @@ 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 " -"argument group. These parameters have the same meaning as in the :class:" -"`ArgumentParser` constructor, but apply specifically to the argument group " -"rather than the entire parser." +"argument group. These parameters have the same meaning as in " +"the :class:`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 +3800,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 +3841,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 +3862,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 +3871,27 @@ 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::" +"*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 +3910,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" @@ -3175,9 +3946,9 @@ msgstr "パーサーのデフォルト値" #: ../../library/argparse.rst:2051 msgid "" -"Most of the time, the attributes of the object returned by :meth:" -"`parse_args` will be fully determined by inspecting the command-line " -"arguments and the argument actions. :meth:`set_defaults` allows some " +"Most of the time, the attributes of the object returned " +"by :meth:`parse_args` will be fully determined by inspecting the command-" +"line arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" @@ -3186,7 +3957,6 @@ msgstr "" "を使うと与えられたコマンドライン引数の内容によらず追加の属性を決定することが" "可能です::" -#: ../../library/argparse.rst:2057 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3194,6 +3964,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 +3976,6 @@ msgid "" msgstr "" "パーサーレベルのデフォルト値は常に引数レベルのデフォルト値を上書きします::" -#: ../../library/argparse.rst:2065 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3209,6 +3983,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 "" @@ -3222,19 +4001,23 @@ msgstr "" #: ../../library/argparse.rst:2077 msgid "" -"Get the default value for a namespace attribute, as set by either :meth:" -"`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" +"Get the default value for a namespace attribute, as set by " +"either :meth:`~ArgumentParser.add_argument` or " +"by :meth:`~ArgumentParser.set_defaults`::" 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" @@ -3266,8 +4049,8 @@ msgid "" "``None``, :data:`sys.stdout` is assumed." msgstr "" "プログラムの使用法と :class:`ArgumentParser` に登録された引数についての情報を" -"含むヘルプメッセージを表示します。 *file* が ``None`` の時は、 :data:`sys." -"stdout` に出力されます。" +"含むヘルプメッセージを表示します。 *file* が ``None`` の時" +"は、 :data:`sys.stdout` に出力されます。" #: ../../library/argparse.rst:2106 msgid "" @@ -3279,8 +4062,8 @@ msgstr "" #: ../../library/argparse.rst:2111 msgid "" -"Return a string containing a brief description of how the :class:" -"`ArgumentParser` should be invoked on the command line." +"Return a string containing a brief description of how " +"the :class:`ArgumentParser` should be invoked on the command line." msgstr "" ":class:`ArgumentParser` がコマンドラインからどう実行されるべきかの短い説明を" "格納した文字列を返します。" @@ -3308,13 +4091,12 @@ msgid "" "remaining argument strings." msgstr "" "ときどき、スクリプトがコマンドライン引数のいくつかだけを解析し、残りの引数は" -"別のスクリプトやプログラムに渡すことがあります。こういった場合、 :meth:" -"`~ArgumentParser.parse_known_args` メソッドが便利です。これは :meth:" -"`~ArgumentParser.parse_args` と同じように動作しますが、余分な引数が存在しても" -"エラーを生成しません。代わりに、評価された namespace オブジェクトと、残りの引" -"数文字列のリストからなる2要素タプルを返します。" +"別のスクリプトやプログラムに渡すことがあります。こういった場" +"合、 :meth:`~ArgumentParser.parse_known_args` メソッドが便利です。これ" +"は :meth:`~ArgumentParser.parse_args` と同じように動作しますが、余分な引数が" +"存在してもエラーを生成しません。代わりに、評価された namespace オブジェクト" +"と、残りの引数文字列のリストからなる2要素タプルを返します。" -#: ../../library/argparse.rst:2134 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3322,18 +4104,23 @@ 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 "" -":ref:`Prefix matching ` rules apply to :meth:" -"`~ArgumentParser.parse_known_args`. The parser may consume an option even if " -"it's just a prefix of one of its known options, instead of leaving it in the " -"remaining arguments list." +":ref:`Prefix matching ` rules apply " +"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " +"option even if it's just a prefix of one of its known options, instead of " +"leaving it in the remaining arguments list." msgstr "" -":ref:`先頭文字でのマッチング ` ルールは :meth:" -"`~ArgumentParser.parse_known_args` にも適用されます。たとえ既知のオプションの" -"先頭文字に過ぎない場合でも、パーサは引数リストに残さずに、オプションを受け取" -"る場合があります。" +":ref:`先頭文字でのマッチング ` ルール" +"は :meth:`~ArgumentParser.parse_known_args` にも適用されます。たとえ既知のオ" +"プションの先頭文字に過ぎない場合でも、パーサは引数リストに残さずに、オプショ" +"ンを受け取る場合があります。" #: ../../library/argparse.rst:2148 msgid "Customizing file parsing" @@ -3369,25 +4156,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 +4185,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." +"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" @@ -3414,30 +4210,34 @@ msgid "" "parsing style." msgstr "" "多くの Unix コマンドは、オプション引数と位置引数を混在させることを許していま" -"す。 :meth:`~ArgumentParser.parse_intermixed_args` と :meth:`~ArgumentParser." -"parse_known_intermixed_args` メソッドは、このような方法での解析をサポートして" -"います。" +"す。 :meth:`~ArgumentParser.parse_intermixed_args` " +"と :meth:`~ArgumentParser.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 "" -"The following example shows the difference between :meth:`~ArgumentParser." -"parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " -"former returns ``['2', '3']`` as unparsed arguments, while the latter " -"collects all the positionals into ``rest``. ::" +"The following example shows the difference " +"between :meth:`~ArgumentParser.parse_known_args` " +"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " +"``['2', '3']`` as unparsed arguments, while the latter collects all the " +"positionals into ``rest``. ::" msgstr "" -"この例は、:meth:`~ArgumentParser.parse_known_args` と :meth:`~ArgumentParser." -"parse_intermixed_args` の違いを表しています: 前者は ``['2', '3']`` を、解析さ" -"れない引数として返し、後者は全ての位置引数を ``rest`` に入れて返しています::" +"この例は、:meth:`~ArgumentParser.parse_known_args` " +"と :meth:`~ArgumentParser.parse_intermixed_args` の違いを表しています: 前者" +"は ``['2', '3']`` を、解析されない引数として返し、後者は全ての位置引数を " +"``rest`` に入れて返しています::" -#: ../../library/argparse.rst:2212 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3448,6 +4248,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 +4269,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 +4312,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..0a384ea85 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." +"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,18 +336,18 @@ 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 "" "\"Byteswap\" all items of the array. This is only supported for values " -"which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" -"`RuntimeError` is raised. It is useful when reading data from a file " -"written on a machine with a different byte order." +"which are 1, 2, 4, or 8 bytes in size; for other types of " +"values, :exc:`RuntimeError` is raised. It is useful when reading data from " +"a file written on a machine with a different byte order." msgstr "" "アレイのすべての要素に対して「バイトスワップ」 (リトルエンディアンとビッグエ" "ンディアンの変換) を行います。このメソッドは大きさが 1、2、4 および 8 バイト" @@ -355,9 +362,10 @@ msgstr "シーケンス中の *x* の出現回数を返します。" #: ../../library/array.rst:151 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " -"another array, it must have *exactly* the same type code; if not, :exc:" -"`TypeError` will be raised. If *iterable* is not an array, it must be " -"iterable and its elements must be the right type to be appended to the array." +"another array, it must have *exactly* the same type code; if " +"not, :exc:`TypeError` will be raised. If *iterable* is not an array, it " +"must be iterable and its elements must be the right type to be appended to " +"the array." msgstr "" "*iterable* から要素を取り出し、アレイの末尾に要素を追加します。 *iterable* が" "別のアレイ型である場合、二つのアレイは *全く* 同じ型コードでなければなりませ" @@ -365,12 +373,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)." +"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." @@ -381,9 +391,9 @@ msgstr "" #: ../../library/array.rst:169 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " -"append them to the end of the array. If less than *n* items are available, :" -"exc:`EOFError` is raised, but the items that were available are still " -"inserted into the array." +"append them to the end of the array. If less than *n* items are " +"available, :exc:`EOFError` is raised, but the items that were available are " +"still inserted into the array." msgstr "" ":term:`ファイルオブジェクト ` *f* から (マシンのデータ形式そのま" "まで) *n* 個の要素を読み出し、アレイの末尾に要素を追加します。 *n* 個未満の要" @@ -392,31 +402,34 @@ msgstr "" #: ../../library/array.rst:177 msgid "" -"Append items from the list. This is equivalent to ``for x in list: a." -"append(x)`` except that if there is a type error, the array is unchanged." +"Append items from the list. This is equivalent to ``for x in list: " +"a.append(x)`` except that if there is a type error, the array is unchanged." 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 "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " -"specified to search for *x* within a subsection of the array. Raise :exc:" -"`ValueError` if *x* is not found." +"specified to search for *x* within a subsection of the array. " +"Raise :exc:`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 +453,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 +469,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 +482,17 @@ 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." +"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 +507,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..d1b5257f9 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`" @@ -49,23 +48,22 @@ msgstr "" #: ../../library/ast.rst:23 msgid "" -"An abstract syntax tree can be generated by passing :data:`ast." -"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using " -"the :func:`parse` helper provided in this module. The result will be a tree " -"of objects whose classes all inherit from :class:`ast.AST`. An abstract " -"syntax tree can be compiled into a Python code object using the built-in :" -"func:`compile` function." -msgstr "" -"抽象構文木を作成するには、 :data:`ast.PyCF_ONLY_AST` を組み込み関数 :func:" -"`compile` のフラグとして渡すか、あるいはこのモジュールで提供されているヘル" -"パー関数 :func:`parse` を使います。その結果は、 :class:`ast.AST` を継承したク" -"ラスのオブジェクトのツリーとなります。抽象構文木は組み込み関数 :func:" -"`compile` を使って Python コード・オブジェクトにコンパイルすることができま" -"す。" +"An abstract syntax tree can be generated by " +"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " +"function, or using the :func:`parse` helper provided in this module. The " +"result will be a tree of objects whose classes all inherit " +"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " +"Python code object using the built-in :func:`compile` function." +msgstr "" +"抽象構文木を作成するには、 :data:`ast.PyCF_ONLY_AST` を組み込み関" +"数 :func:`compile` のフラグとして渡すか、あるいはこのモジュールで提供されてい" +"るヘルパー関数 :func:`parse` を使います。その結果は、 :class:`ast.AST` を継承" +"したクラスのオブジェクトのツリーとなります。抽象構文木は組み込み関" +"数 :func:`compile` を使って Python コード・オブジェクトにコンパイルすることが" +"できます。" -#: ../../library/ast.rst:33 msgid "Abstract grammar" -msgstr "" +msgstr "抽象文法" #: ../../library/ast.rst:35 msgid "The abstract grammar is currently defined as follows:" @@ -255,14 +253,14 @@ msgstr "Node クラス" #: ../../library/ast.rst:46 msgid "" "This is the base of all AST node classes. The actual node classes are " -"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:" -"`above `. They are defined in the :mod:`!_ast` C module " -"and re-exported in :mod:`ast`." +"derived from the :file:`Parser/Python.asdl` file, which is " +"reproduced :ref:`above `. They are defined in the :mod:`!" +"_ast` C module and re-exported in :mod:`ast`." msgstr "" -"このクラスは全ての AST ノード・クラスの基底です。実際のノード・クラスは :ref:" -"`先に ` 示した :file:`Parser/Python.asdl` ファイルから派生" -"したものです。これらのクラスは :mod:`!_ast` C モジュールで定義され、 :mod:" -"`ast` にもエクスポートし直されています。" +"このクラスは全ての AST ノード・クラスの基底です。実際のノード・クラス" +"は :ref:`先に ` 示した :file:`Parser/Python.asdl` ファイル" +"から派生したものです。これらのクラスは :mod:`!_ast` C モジュールで定義さ" +"れ、 :mod:`ast` にもエクスポートし直されています。" #: ../../library/ast.rst:51 msgid "" @@ -274,11 +272,11 @@ msgid "" "rules with alternatives (aka \"sums\"), the left-hand side class is " "abstract: only instances of specific constructor nodes are ever created." msgstr "" -"抽象文法の左辺のシンボル一つずつにそれぞれ一つのクラスがあります (たとえば :" -"class:`ast.stmt` や :class:`ast.expr`)。それに加えて、右辺のコンストラクタ一" -"つずつにそれぞれ一つのクラスがあり、これらのクラスは左辺のツリーのクラスを継" -"承しています。たとえば、 :class:`ast.BinOp` は :class:`ast.expr` から継承して" -"います。代替を伴った生成規則 (production rules with alternatives) (別名 " +"抽象文法の左辺のシンボル一つずつにそれぞれ一つのクラスがあります (たとえ" +"ば :class:`ast.stmt` や :class:`ast.expr`)。それに加えて、右辺のコンストラク" +"タ一つずつにそれぞれ一つのクラスがあり、これらのクラスは左辺のツリーのクラス" +"を継承しています。たとえば、 :class:`ast.BinOp` は :class:`ast.expr` から継承" +"しています。代替を伴った生成規則 (production rules with alternatives) (別名 " "\"sums\") の場合、左辺は抽象クラスとなり、特定のコンストラクタ・ノードのイン" "スタンスのみが作成されます。" @@ -298,8 +296,8 @@ msgid "" msgstr "" "具象クラスのインスタンスは、各子ノードに対してそれぞれひとつの属性を持ってい" "ます。この属性は、文法で定義された型となります。たとえば :class:`ast.BinOp` " -"のインスタンスは :attr:`left` という属性を持っており、その型は :class:`ast." -"expr` です。" +"のインスタンスは :attr:`left` という属性を持っており、その型" +"は :class:`ast.expr` です。" #: ../../library/ast.rst:71 msgid "" @@ -315,37 +313,40 @@ 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` " -"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " -"last line numbers of source text span (1-indexed so the first line is line " -"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the " -"corresponding UTF-8 byte offsets of the first and last tokens that generated " -"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 オフ" -"セットはパーサが内部で使用するので記録されます。" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " +"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " +"and :attr:`end_col_offset` attributes. The :attr:`lineno` " +"and :attr:`end_lineno` are the first and last line numbers of source text " +"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " +"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " +"first and last tokens that generated 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` " +"属性を持ちます。\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 "" @@ -356,8 +357,8 @@ msgid "" msgstr "" "コンパイラは終了位置を必要としないことに注意してください。このため終了位置は" "省略可能です。終了位置を示すオフセットは最後のシンボルの *後の位置* になりま" -"す。例えば一行で書かれた式のソースコードのセグメントは ``source_line[node." -"col_offset : node.end_col_offset]`` により取得できます。" +"す。例えば一行で書かれた式のソースコードのセグメントは " +"``source_line[node.col_offset : node.end_col_offset]`` により取得できます。" #: ../../library/ast.rst:108 msgid "" @@ -388,19 +389,20 @@ 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 "" "If a field that is optional in the grammar is omitted from the constructor, " "it defaults to ``None``. If a list field is omitted, it defaults to the " "empty list. If a field of type :class:`!ast.expr_context` is omitted, it " -"defaults to :class:`Load() `. If any other field is omitted, a :" -"exc:`DeprecationWarning` is raised and the AST node will not have this " +"defaults to :class:`Load() `. If any other field is omitted, " +"a :exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" @@ -416,26 +418,29 @@ 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 "" -"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" -"class:`!ast.NameConstant` and :class:`!ast.Ellipsis` 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." +"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!" +"ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis` 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 "" -#: ../../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 "" @@ -449,34 +454,37 @@ msgstr "" #: ../../library/ast.rst:165 msgid "" "The descriptions of the specific node classes displayed here were initially " -"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." +"adapted from the fantastic `Green Tree Snakes `__ project and all its " +"contributors." msgstr "" "ここに示されている特定のノードクラスについての記述は、素晴らしい `Green Tree " "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 +494,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 +549,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 "" @@ -639,8 +673,8 @@ msgstr "" #: ../../library/ast.rst:304 msgid "" -"An f-string, comprising a series of :class:`FormattedValue` and :class:" -"`Constant` nodes." +"An f-string, comprising a series of :class:`FormattedValue` " +"and :class:`Constant` nodes." msgstr "" ":class:`FormattedValue` ノードと :class:`Constant` ノードの集まりからなる f-" "string です。" @@ -705,7 +739,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 +748,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 "" @@ -723,17 +763,16 @@ msgid "" "when calling :code:`dictionary.keys()` and :code:`dictionary.values()`)." msgstr "" "辞書をあらわします。 ``keys`` と ``values`` はそれぞれキーと値のノードのリス" -"ト を順序が一致した形で (それぞれ :code:`dictionary.keys()` と :code:" -"`dictionary.values()` を呼び出したときに返される順序で) 保持します。" +"ト を順序が一致した形で (それぞれ :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,15 +833,14 @@ 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 " -"with ``*args``." +"A ``*var`` variable reference. ``value`` holds the variable, typically " +"a :class:`Name` node. This type must be used when building a :class:`Call` " +"node with ``*args``." msgstr "" -"``*var`` 形式の変数の参照をあらわします。 ``value`` は変数、典型的には :" -"class:`Name` ノード、を保持します。この型は ``*args`` を伴う関数呼び出しノー" -"ド :class:`Call` を構築する際に使用します。 " +"``*var`` 形式の変数の参照をあらわします。 ``value`` は変数、典型的に" +"は :class:`Name` ノード、を保持します。この型は ``*args`` を伴う関数呼び出し" +"ノード :class:`Call` を構築する際に使用します。" #: ../../library/ast.rst:441 msgid "" @@ -829,15 +867,15 @@ msgstr "式 (expression)" msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " -"container. ``value`` holds one of the other nodes in this section, a :class:" -"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:" -"`YieldFrom` node." +"container. ``value`` holds one of the other nodes in this section, " +"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " +"or :class:`YieldFrom` node." msgstr "" "関数呼び出しのような式がそれ自身で文となり、戻り値が使われないかまたは保存さ" "れないとき、その式はこのコンテナでラップされます。 ``value`` はこの節で説明す" -"る他のノード、 :class:`Constant` ノード、 :class:`Name` ノード、 :class:" -"`Lambda` ノード :class:`Yield` ノードまたは :class:`YieldFrom` ノードのいずれ" -"かを保持します。" +"る他のノード、 :class:`Constant` ノード、 :class:`Name` ノー" +"ド、 :class:`Lambda` ノード :class:`Yield` ノードまたは :class:`YieldFrom` " +"ノードのいずれかを保持します。" #: ../../library/ast.rst:470 msgid "" @@ -875,13 +913,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 "" @@ -904,10 +941,10 @@ msgid "" "operator, such as ``a or b or c``, are collapsed into one node with several " "values." msgstr "" -"'or' や 'and' のような論理演算をあらわします。 ``op`` は :class:`Or` または :" -"class:`And` です。 ``values`` は必要な値のリストです。 ``a or b or c`` のよう" -"に同じ演算子を使う連続した演算は、複数の値を持った単一のノードとして表現され" -"ます。" +"'or' や 'and' のような論理演算をあらわします。 ``op`` は :class:`Or` また" +"は :class:`And` です。 ``values`` は必要な値のリストです。 ``a or b or c`` の" +"ように同じ演算子を使う連続した演算は、複数の値を持った単一のノードとして表現" +"されます。" #: ../../library/ast.rst:543 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." @@ -957,27 +994,26 @@ msgstr "比較演算の演算子をあらわします。" #: ../../library/ast.rst:598 msgid "" -"A function call. ``func`` is the function, which will often be a :class:" -"`Name` or :class:`Attribute` object. Of the arguments:" +"A function call. ``func`` is the function, which will often be " +"a :class:`Name` or :class:`Attribute` object. Of the arguments:" 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 "" @@ -1027,10 +1063,10 @@ msgstr "" #: ../../library/ast.rst:649 msgid "" -"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" -"`Name`. ``attr`` is a bare string giving the name of the attribute, and " -"``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how " -"the attribute is acted on." +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " +"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " +"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " +"how the attribute is acted on." msgstr "" "たとえば ``d.keys`` のような属性へのアクセスです。 ``value`` はノードで、典型" "的には :class:`Name` です。 ``attr`` は属性名を与える生の文字列で、 ``ctx`` " @@ -1050,16 +1086,15 @@ msgstr "" #: ../../library/ast.rst:666 msgid "" "A named expression. This AST node is produced by the assignment expressions " -"operator (also known as the walrus operator). As opposed to the :class:" -"`Assign` node in which the first argument can be multiple nodes, in this " -"case both ``target`` and ``value`` must be single nodes." +"operator (also known as the walrus operator). As opposed to " +"the :class:`Assign` node in which the first argument can be multiple nodes, " +"in this case both ``target`` and ``value`` must be single nodes." msgstr "" "代入式です。この AST ノードは代入式演算子(ウォルラス演算子、または「セイウチ" "演算子」としても知られています)によって生成されます。第一引数が複数のノード" "であってもよい :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 +1102,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" @@ -1075,15 +1115,16 @@ msgstr "配列要素の参照 (Subscripting)" #: ../../library/ast.rst:686 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " -"sequence or mapping). ``slice`` is an index, slice or key. It can be a :" -"class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:" -"`Store` or :class:`Del` according to the action performed with the subscript." +"sequence or mapping). ``slice`` is an index, slice or key. It can be " +"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " +"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " +"performed with the subscript." msgstr "" "``l[1]`` のような配列要素の参照をあらわします。 ``value`` は参照元のオブジェ" "クトです (通常シーケンス型またはマッピング型)。 ``slice`` はインデックス、ス" "ライス、またはキーです。 :class:`Slice` を含む :class:`Tuple` でもかまいませ" -"ん。 ``ctx`` は要素の参照により実行されるアクションに応じて :class:`Load`、 :" -"class:`Store` または :class:`Del` のいずれかです。" +"ん。 ``ctx`` は要素の参照により実行されるアクションに応じ" +"て :class:`Load`、 :class:`Store` または :class:`Del` のいずれかです。" #: ../../library/ast.rst:692 msgid "" @@ -1108,8 +1149,8 @@ msgid "" "or as an element of :class:`Tuple`." msgstr "" "基本的なスライス操作 (``lower:upper`` や ``lower:upper:step`` の形式) をあら" -"わします。 :class:`Subscript` の *slice* フィールドでの直接指定か、または :" -"class:`Tuple` の要素として指定する場合のみ利用可能です。" +"わします。 :class:`Subscript` の *slice* フィールドでの直接指定か、また" +"は :class:`Tuple` の要素として指定する場合のみ利用可能です。" #: ../../library/ast.rst:714 msgid "" @@ -1319,22 +1360,32 @@ 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." +"``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 :" -"class:`Name` node that does not appear between parentheses; all other " -"targets are considered complex. Only simple targets appear in the :attr:" -"`~object.__annotations__` dictionary of modules and classes." -msgstr "" +"(indicating a \"simple\" target). A \"simple\" target consists solely of " +"a :class:`Name` node that does not appear between parentheses; all other " +"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 "" @@ -1387,20 +1438,19 @@ msgid "" "context), ``op`` is :class:`Add`, and ``value`` is a :class:`Constant` with " "value for 1." msgstr "" -"``a += 1`` のような累積代入をあらわします。下記の例では、 ``target`` は (:" -"class:`Store` コンテキストを伴う) ``x`` のための :class:`Name` ノード、 " -"``op`` は :class:`Add` 演算子、そして ``value`` は定数1をあらわす :class:" -"`Constant` ノードです。" +"``a += 1`` のような累積代入をあらわします。下記の例では、 ``target`` は " +"(:class:`Store` コンテキストを伴う) ``x`` のための :class:`Name` ノード、 " +"``op`` は :class:`Add` 演算子、そして ``value`` は定数1をあらわ" +"す :class:`Constant` ノードです。" #: ../../library/ast.rst:956 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -":class:`Assign` と異なり、 ``target`` 属性は class :class:`Tuple` や :class:" -"`List` であってはいけません。" +":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 +1460,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 "" @@ -1417,10 +1474,10 @@ msgid "" "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -"``raise`` 文をあらわします。 ``exc`` は送出される例外オブジェクトで、通常は :" -"class:`Call` または :class:`Name`、 もしくは単独の ``raise`` では ``None`` を" -"指定します。 ``cause`` はオプションで、 ``raise x from y`` の ``y`` にあたり" -"ます。" +"``raise`` 文をあらわします。 ``exc`` は送出される例外オブジェクトで、通常" +"は :class:`Call` または :class:`Name`、 もしくは単独の ``raise`` では " +"``None`` を指定します。 ``cause`` はオプションで、 ``raise x from y`` の " +"``y`` にあたります。" #: ../../library/ast.rst:976 msgid "" @@ -1452,13 +1509,13 @@ msgstr "" #: ../../library/ast.rst:1003 msgid "" -"Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" -"class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +"Represents a ``del`` statement. ``targets`` is a list of nodes, such " +"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -"``del`` 文をあらわします。 ``targets`` は :class:`Name`, :class:" -"`Attribute`, :class:`Subscript` などのノードのリストです。" +"``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 +1526,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." +"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 "" @@ -1588,8 +1658,8 @@ msgstr "" #: ../../library/ast.rst:1117 msgid "" -"An ``if`` statement. ``test`` holds a single node, such as a :class:" -"`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +"An ``if`` statement. ``test`` holds a single node, such as " +"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" "``if`` 文です。 ``test`` は :class:`Compare` ノードなどの単一のノードを保持し" "ます。 ``body`` と ``orelse`` はそれぞれノードのリストを保持します。" @@ -1631,15 +1701,23 @@ 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 :" -"class:`Subscript` node. ``iter`` holds the item to be looped over, again as " -"a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " +"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " +"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " "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 "" @@ -1850,15 +1928,15 @@ msgstr "" #: ../../library/ast.rst:1362 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " -"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" -"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` " -"if that isn't used." +"context manager, often a :class:`Call` node. ``optional_vars`` is " +"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " +"``None`` if that isn't used." msgstr "" "``with`` ブロックにおける単一のコンテキストマネージャをあらわします。 " "``context_expr`` はコンテキストマネージャで、しばしば :class:`Call` ノードが" -"設定されます。 ``optional_vars`` は ``as foo`` に相当する :class:`Name`, :" -"class:`Tuple` または :class:`List` のいずれかのノードか、または、この部分が不" -"要な場合は ``None`` を設定します。" +"設定されます。 ``optional_vars`` は ``as foo`` に相当す" +"る :class:`Name`, :class:`Tuple` または :class:`List` のいずれかのノードか、" +"または、この部分が不要な場合は ``None`` を設定します。" #: ../../library/ast.rst:1367 msgid "" @@ -1885,36 +1963,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 " +"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 +2035,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 +2067,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 +2096,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 +2132,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 +2176,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 +2183,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 +2197,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 +2234,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 +2243,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 +2314,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 +2364,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 +2371,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 +2401,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,31 +2436,38 @@ 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:" -"`Tuple`, it represents constraints; otherwise it represents the bound. " -"``default_value`` is the default value; if the :class:`!TypeVar` has no " -"default, this attribute will be set to ``None``." -msgstr "" +"``bound`` is the bound or constraints, if any. If ``bound`` is " +"a :class:`Tuple`, it represents constraints; otherwise it represents the " +"bound. ``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 +2488,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 +2527,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,24 +2593,22 @@ 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 "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." msgstr "" -"``lambda`` は式の中で使うことができる最小限の関数定義です。 :class:" -"`FunctionDef` ノードと異なり、 ``body`` は単一のノードとなります。" +"``lambda`` は式の中で使うことができる最小限の関数定義で" +"す。 :class:`FunctionDef` ノードと異なり、 ``body`` は単一のノードとなりま" +"す。" -#: ../../library/ast.rst:1934 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -2487,6 +2621,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 +2669,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 +2727,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 +2734,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 +2772,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 +2791,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 +2821,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`." +"'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 "" @@ -2704,8 +2874,8 @@ msgstr "async と await" #: ../../library/ast.rst:2117 msgid "" -"An ``async def`` function definition. Has the same fields as :class:" -"`FunctionDef`." +"An ``async def`` function definition. Has the same fields " +"as :class:`FunctionDef`." msgstr "" "``async def`` 形式の関数定義です。通常の関数定義 :class:`FunctionDef` と同じ" "フィールドを持ちます。" @@ -2715,8 +2885,8 @@ msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"``await`` 式をあらわします。 ``value`` は待ち受ける値です。 :class:" -"`AsyncFunctionDef` の本体 (body) の中でのみ有効です。" +"``await`` 式をあらわします。 ``value`` は待ち受ける値で" +"す。 :class:`AsyncFunctionDef` の本体 (body) の中でのみ有効です。" #: ../../library/ast.rst:2129 msgid "" @@ -2742,18 +2912,22 @@ msgid "" "fields as :class:`For` and :class:`With`, respectively. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"``async for`` ループと ``async with`` コンテキストマネージャです。それぞれ :" -"class:`For` および :class:`With` と同じフィールドを持ちます。 :class:" -"`AsyncFunctionDef` の本体 (body) の中でのみ有効です。" +"``async for`` ループと ``async with`` コンテキストマネージャです。それぞ" +"れ :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." -"boolop` and :class:`ast.expr_context`) on the returned tree will be " -"singletons. Changes to one will be reflected in all other occurrences of the " -"same value (for example, :class:`ast.Add`)." +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " +"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " +"and :class:`ast.expr_context`) on the returned tree will be 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" @@ -2771,22 +2945,31 @@ msgstr "" msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " -"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." -"PyCF_OPTIMIZED_AST`` otherwise." +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " +"``ast.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 " -"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" -"func:`compile`. This will report syntax errors for misplaced type " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " +"to :func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " "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 +2981,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 +2992,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 +3016,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,35 +3046,37 @@ 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 "" "Unparse an :class:`ast.AST` object and generate a string with code that " -"would produce an equivalent :class:`ast.AST` object if parsed back with :" -"func:`ast.parse`." +"would produce an equivalent :class:`ast.AST` object if parsed back " +"with :func:`ast.parse`." msgstr "" -":class:`ast.AST` オブジェクトを逆に構文解析して、 :func:`ast.parse` が元の :" -"class:`ast.AST` と等価なオブジェクトを生成できるような文字列を生成します。" +":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 "" -"Trying to unparse a highly complex expression would result with :exc:" -"`RecursionError`." +"Trying to unparse a highly complex expression would result " +"with :exc:`RecursionError`." msgstr "" "非常に複雑な式を逆構文解析すると :exc:`RecursionError` となることがあります。" @@ -2891,17 +3092,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 +3112,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 +3132,14 @@ 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." +"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,34 +3149,36 @@ 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 "" -"Return the docstring of the given *node* (which must be a :class:" -"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" -"`Module` node), or ``None`` if it has no docstring. If *clean* is true, " -"clean up the docstring's indentation with :func:`inspect.cleandoc`." +"Return the docstring of the given *node* (which must be " +"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " +"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " +"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -"与えられた *node* (これは :class:`FunctionDef`, :class:`AsyncFunctionDef`, :" -"class:`ClassDef`, :class:`Module` のいずれかのノードでなければなりません) の" -"ドキュメント文字列を返します。もしドキュメント文字列が無ければ ``None`` を返" -"します。 *clean* が真ならば、ドキュメント文字列のインデントを :func:`inspect." -"cleandoc` を用いて一掃します。" +"与えられた *node* (これ" +"は :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, :class:`Module` " +"のいずれかのノードでなければなりません) のドキュメント文字列を返します。もし" +"ドキュメント文字列が無ければ ``None`` を返します。 *clean* が真ならば、ドキュ" +"メント文字列のインデントを :func:`inspect.cleandoc` を用いて一掃します。" #: ../../library/ast.rst:2290 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``." +"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,15 +3188,20 @@ 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 " -"node that supports them. This is rather tedious to fill in for generated " -"nodes, so this helper adds these attributes recursively where not already " -"set, by setting them to the values of the parent node. It works recursively " -"starting at *node*." +"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 node that supports them. This is rather tedious to fill in for " +"generated nodes, so this helper adds these attributes recursively where not " +"already 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 +3212,15 @@ 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*." +"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 "" @@ -3045,9 +3269,9 @@ msgstr "" #: ../../library/ast.rst:2359 msgid "" -"Visit a node. The default implementation calls the method called :samp:" -"`self.visit_{classname}` where *classname* is the name of the node class, " -"or :meth:`generic_visit` if that method doesn't exist." +"Visit a node. The default implementation calls the method " +"called :samp:`self.visit_{classname}` where *classname* is the name of the " +"node class, or :meth:`generic_visit` if that method doesn't exist." msgstr "" "ノードを訪れます。デフォルトの実装では :samp:`self.visit_{classname}` という" "メソッド (ここで *classname* はノードのクラス名です) を呼び出すか、そのメソッ" @@ -3066,26 +3290,25 @@ msgstr "" "ビジターが :meth:`generic_visit` を呼び出すかそれ自身で子ノードを訪れない限り" "訪れられないということです。" -#: ../../library/ast.rst:2373 msgid "Handles all constant nodes." -msgstr "" +msgstr "すべての定数ノードを処理します。" #: ../../library/ast.rst:2375 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " -"during traversal. For this a special visitor exists (:class:" -"`NodeTransformer`) that allows modifications." +"during traversal. For this a special visitor exists " +"(:class:`NodeTransformer`) that allows modifications." msgstr "" "トラバースの途中でノードを変化させたいならば :class:`NodeVisitor` を使っては" -"いけません。そうした目的のために変更を許す特別なビジター (:class:" -"`NodeTransformer`) があります。" +"いけません。そうした目的のために変更を許す特別なビジター " +"(:class:`NodeTransformer`) があります。" #: ../../library/ast.rst:2381 msgid "" -"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" -"`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " -"will not be called in future Python versions. Add the :meth:" -"`visit_Constant` method to handle all constant nodes." +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" +"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are " +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`visit_Constant` method to handle all constant nodes." msgstr "" #: ../../library/ast.rst:2389 @@ -3130,43 +3353,47 @@ 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." +"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::" +"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 +3438,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,17 +3469,16 @@ msgid "" " type_ignores=[])" msgstr "" -#: ../../library/ast.rst:2488 msgid "Compiler flags" -msgstr "" +msgstr "コンパイラのフラグ" #: ../../library/ast.rst:2490 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "" -"以下のフラグはプログラムのコンパイルにおける効果を変更するために :func:" -"`compile` に渡すことができます:" +"以下のフラグはプログラムのコンパイルにおける効果を変更するため" +"に :func:`compile` に渡すことができます:" #: ../../library/ast.rst:2495 msgid "" @@ -3270,11 +3495,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`." +"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 +3510,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 +3520,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 +3539,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:" @@ -3323,8 +3552,8 @@ msgstr "ヘルプメッセージを表示して終了します。" #: ../../library/ast.rst:2559 msgid "" -"Specify what kind of code must be compiled, like the *mode* argument in :" -"func:`parse`." +"Specify what kind of code must be compiled, like the *mode* argument " +"in :func:`parse`." msgstr "" ":func:`parse` 関数の *mode* 引数と同様、コンパイルするコードの種類を指定しま" "す。" @@ -3341,15 +3570,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 +3604,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 +3612,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 +3634,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..c250c867b 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`." +"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..8ba5d99c9 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 "" @@ -80,16 +79,16 @@ msgstr "デバッグモードを有効化することに加え、以下も検討 #: ../../library/asyncio-dev.rst:36 msgid "" -"setting the log level of the :ref:`asyncio logger ` to :py:" -"const:`logging.DEBUG`, for example the following snippet of code can be run " -"at startup of the application::" +"setting the log level of the :ref:`asyncio logger ` " +"to :py:const:`logging.DEBUG`, for example the following snippet of code can " +"be run at startup of the application::" msgstr "" -":ref:`asyncio ロガー ` のログレベルを :py:const:`logging." -"DEBUG` に設定します。例えばアプリケーションの起動時に以下を実行します::" +":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 "" @@ -107,13 +106,13 @@ msgstr "デバッグモードが有効化されたときの動作:" #: ../../library/asyncio-dev.rst:49 msgid "" -"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:" -"`loop.call_at` methods) raise an exception if they are called from a wrong " -"thread." +"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` " +"and :meth:`loop.call_at` methods) raise an exception if they are called from " +"a wrong thread." msgstr "" -"スレッドセーフでない asyncio APIs の多く (:meth:`loop.call_soon` や :meth:" -"`loop.call_at` など) は、誤ったスレッドから呼び出されたときに例外を送出しま" -"す。" +"スレッドセーフでない asyncio APIs の多く (:meth:`loop.call_soon` " +"や :meth:`loop.call_at` など) は、誤ったスレッドから呼び出されたときに例外を" +"送出します。" #: ../../library/asyncio-dev.rst:53 msgid "" @@ -123,15 +122,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\"." +"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" @@ -153,17 +151,15 @@ msgstr "" #: ../../library/asyncio-dev.rst:72 msgid "" -"To schedule a :term:`callback` from another OS thread, the :meth:`loop." -"call_soon_threadsafe` method should be used. Example::" +"To schedule a :term:`callback` from another OS thread, " +"the :meth:`loop.call_soon_threadsafe` method should be used. Example::" 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,24 +170,22 @@ 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 "" -"To schedule a coroutine object from a different OS thread, the :func:" -"`run_coroutine_threadsafe` function should be used. It returns a :class:" -"`concurrent.futures.Future` to access the result::" +"To schedule a coroutine object from a different OS thread, " +"the :func:`run_coroutine_threadsafe` function should be used. It returns " +"a :class:`concurrent.futures.Future` to access the result::" msgstr "" -"別の OS スレッドからコルーチンオブジェクトをスケジュールする場合は、 :func:" -"`run_coroutine_threadsafe` メソッドを使ってください。 :func:" -"`run_coroutine_threadsafe` は結果にアクセスするための :class:`concurrent." -"futures.Future` オブジェクトを返します:" +"別の OS スレッドからコルーチンオブジェクトをスケジュールする場合" +"は、 :func:`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 +196,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,41 +211,45 @@ 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." +"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 "" "There is currently no way to schedule coroutines or callbacks directly from " -"a different process (such as one started with :mod:`multiprocessing`). The :" -"ref:`asyncio-event-loop-methods` section lists APIs that can read from pipes " -"and watch file descriptors without blocking the event loop. In addition, " -"asyncio's :ref:`Subprocess ` APIs provide a way to start " -"a process and communicate with it from the event loop. Lastly, the " -"aforementioned :meth:`loop.run_in_executor` method can also be used with a :" -"class:`concurrent.futures.ProcessPoolExecutor` to execute code in a " +"a different process (such as one started with :mod:`multiprocessing`). " +"The :ref:`asyncio-event-loop-methods` section lists APIs that can read from " +"pipes and watch file descriptors without blocking the event loop. In " +"addition, asyncio's :ref:`Subprocess ` APIs provide a " +"way to start a process and communicate with it from the event loop. Lastly, " +"the aforementioned :meth:`loop.run_in_executor` method can also be used with " +"a :class:`concurrent.futures.ProcessPoolExecutor` to execute code in a " "different process." msgstr "" "現在のところ、 (たとえば :mod:`multiprocessing` で開始したような) 別のプロセ" -"スからコルーチンやコールバックを直接スケジュールすることはできません。 :ref:" -"`asyncio-event-loop-methods` 節では、イベントループをブロックすることなくパイ" -"プからの読み込みやファイルデスクリプタの監視ができる API のリストを掲載してい" -"ます。さらに、 asyncio の :ref:`サブプロセス ` API はイベ" -"ントループからプロセスを開始したりプロセスと通信したりする方法を提供します。 " -"最後に、前述の :meth:`loop.run_in_executor` メソッドは :class:`concurrent." -"futures.ProcessPoolExecutor` とともに使用することで、別のプロセス内でコードを" -"実行することもできます。" +"スからコルーチンやコールバックを直接スケジュールすることはできませ" +"ん。 :ref:`asyncio-event-loop-methods` 節では、イベントループをブロックするこ" +"となくパイプからの読み込みやファイルデスクリプタの監視ができる API のリストを" +"掲載しています。さらに、 asyncio の :ref:`サブプロセス ` " +"API はイベントループからプロセスを開始したりプロセスと通信したりする方法を提" +"供します。 最後に、前述の :meth:`loop.run_in_executor` メソッド" +"は :class:`concurrent.futures.ProcessPoolExecutor` とともに使用することで、別" +"のプロセス内でコードを実行することもできます。" #: ../../library/asyncio-dev.rst:121 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 +257,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,36 +289,32 @@ 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 "" "Network logging can block the event loop. It is recommended to use a " -"separate thread for handling logs or use non-blocking IO. For example, see :" -"ref:`blocking-handlers`." +"separate thread for handling logs or use non-blocking IO. For example, " +"see :ref:`blocking-handlers`." msgstr "" "ネットワークログ記録は、イベントループをブロックし得ます。ログ処理のスレッド" -"を分離するか、ノンブロッキング IO を使用することを推奨します。例えば、 :ref:" -"`blocking-handlers` を見てください。" +"を分離するか、ノンブロッキング IO を使用することを推奨します。例え" +"ば、 :ref:`blocking-handlers` を見てください。" #: ../../library/asyncio-dev.rst:157 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`::" +"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 +326,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,20 +363,31 @@ 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 "" -"The usual fix is to either await the coroutine or call the :meth:`asyncio." -"create_task` function::" +"The usual fix is to either await the coroutine or call " +"the :meth:`asyncio.create_task` function::" msgstr "" -"通常の修正方法はコルーチンを待ち受ける (await) か、 :meth:`asyncio." -"create_task` 関数を呼び出すことです:" +"通常の修正方法はコルーチンを待ち受ける (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 +409,6 @@ msgstr "" msgid "Example of an unhandled exception::" msgstr "処理されない例外の例:" -#: ../../library/asyncio-dev.rst:209 msgid "" "import asyncio\n" "\n" @@ -397,8 +420,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 +440,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 +457,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 +476,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..e1e617ddb 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 "" @@ -111,31 +110,35 @@ msgid "" "is preferred to :func:`get_event_loop` in coroutines and callbacks." msgstr "" "この関数の振る舞いは (特にイベントループポリシーをカスタマイズした場合) 複雑" -"なため、コルーチンやコールバックでは :func:`get_event_loop` よりも :func:" -"`get_running_loop` を使うほうが好ましいと考えられます。" +"なため、コルーチンやコールバックでは :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`." +"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." @@ -147,9 +150,9 @@ msgid "" "and :func:`new_event_loop` functions can be altered by :ref:`setting a " "custom event loop policy `." msgstr "" -":func:`get_event_loop`, :func:`set_event_loop`, および :func:" -"`new_event_loop` 関数の振る舞いは、 :ref:`カスタムイベントループポリシーを設" -"定する ` ことにより変更することができます。" +":func:`get_event_loop`, :func:`set_event_loop`, およ" +"び :func:`new_event_loop` 関数の振る舞いは、 :ref:`カスタムイベントループポリ" +"シーを設定する ` ことにより変更することができます。" #: ../../library/asyncio-eventloop.rst:86 msgid "Contents" @@ -166,15 +169,15 @@ 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 :" -"meth:`loop.call_soon` and :meth:`loop.call_later`;" +"The `Callback Handles`_ section documents the :class:`Handle` " +"and :class:`TimerHandle` instances which are returned from scheduling " +"methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -"`コールバックハンドル`_ 節は :meth:`loop.call_soon` や :meth:`loop." -"call_later` などのスケジューリングメソッドが返す :class:`Handle` や :class:" -"`TimerHandle` インスタンスについて解説しています。 " +"`コールバックハンドル`_ 節は :meth:`loop.call_soon` " +"や :meth:`loop.call_later` などのスケジューリングメソッドが返" +"す :class:`Handle` や :class:`TimerHandle` インスタンスについて解説していま" +"す。" #: ../../library/asyncio-eventloop.rst:96 msgid "" @@ -186,11 +189,11 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:99 msgid "" -"The `Event Loop Implementations`_ section documents the :class:" -"`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" +"The `Event Loop Implementations`_ section documents " +"the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -"`イベントループの実装`_ 節は :class:`SelectorEventLoop` と :class:" -"`ProactorEventLoop` の2つのクラスについて解説しています。" +"`イベントループの実装`_ 節は :class:`SelectorEventLoop` " +"と :class:`ProactorEventLoop` の2つのクラスについて解説しています。" #: ../../library/asyncio-eventloop.rst:102 msgid "" @@ -209,18 +212,16 @@ 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 "" "If the argument is a :ref:`coroutine object ` it is implicitly " "scheduled to run as a :class:`asyncio.Task`." msgstr "" -"引数が :ref:`コルーチンオブジェクト ` の場合、暗黙のうちに :class:" -"`asyncio.Task` として実行されるようにスケジュールされます。" +"引数が :ref:`コルーチンオブジェクト ` の場合、暗黙のうち" +"に :class:`asyncio.Task` として実行されるようにスケジュールされます。" #: ../../library/asyncio-eventloop.rst:129 msgid "Return the Future's result or raise its exception." @@ -237,6 +238,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 +306,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 +325,6 @@ msgstr ":func:`asyncio.run` を使った場合はこの関数を呼び出す必 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/asyncio-eventloop.rst:185 msgid "" "try:\n" " loop.run_forever()\n" @@ -322,38 +332,51 @@ 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`." +"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" @@ -364,14 +387,16 @@ msgid "" "Schedule the *callback* :term:`callback` to be called with *args* arguments " "at the next iteration of the event loop." msgstr "" -"イベントループの次のイテレーションで *callback* に指定したコールバック (:" -"term:`callback`) を *args* 引数で呼び出すようにスケジュールします。" +"イベントループの次のイテレーションで *callback* に指定したコールバック " +"(:term:`callback`) を *args* 引数で呼び出すようにスケジュールします。" #: ../../library/asyncio-eventloop.rst:229 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,40 +406,48 @@ 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." +"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 "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." msgstr "" -"すでにクローズされたイベントループに対してこのメソッドが呼び出された場合 :" -"exc:`RuntimeError` 例外を送出します。これはメインアプリケーションが終了してい" -"るにもかかわらずセカンダリスレッドでメソッドが呼び出されるといった場合に起こ" -"りえます。" +"すでにクローズされたイベントループに対してこのメソッドが呼び出された場" +"合 :exc:`RuntimeError` 例外を送出します。これはメインアプリケーションが終了し" +"ているにもかかわらずセカンダリスレッドでメソッドが呼び出されるといった場合に" +"起こりえます。" #: ../../library/asyncio-eventloop.rst:254 msgid "" @@ -439,15 +472,17 @@ msgid "" "arguments. To do that, use :func:`functools.partial`::" msgstr "" "ほとんどの :mod:`asyncio` モジュールのスケジューリング関数は、キーワード引数" -"をコールバックに渡すことを許していません。キーワード引数を渡すためには :func:" -"`functools.partial` を使ってください:" +"をコールバックに渡すことを許していません。キーワード引数を渡すために" +"は :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 "" @@ -499,18 +534,18 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:299 msgid "" "The optional positional *args* will be passed to the callback when it is " -"called. If you want the callback to be called with keyword arguments use :" -"func:`functools.partial`." +"called. If you want the callback to be called with keyword arguments " +"use :func:`functools.partial`." msgstr "" "オプションの位置引数 *args* はコールバックが呼び出されるときに位置引数として" -"渡されます。キーワード引数を指定してコールバックを呼び出したい場合は :func:" -"`functools.partial` を使用してください。" +"渡されます。キーワード引数を指定してコールバックを呼び出したい場合" +"は :func:`functools.partial` を使用してください。" #: ../../library/asyncio-eventloop.rst:303 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *callback* to run in. The current " -"context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" "オプションのキーワード引数 *context* を使って、コールバック*callback* を実行" "する際のコンテキスト :class:`contextvars.Context` を設定することができます。" @@ -577,7 +612,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,29 +619,34 @@ msgid "" msgstr "" "asyncio でフューチャーオブジェクトを作成するために推奨される方法です。このメ" "ソッドにより、サードパーティ製のイベントループがFutures クラスの(パフォーマン" -"スや計測方法が優れた) 代替実装を提供することを可能にします。 " +"スや計測方法が優れた) 代替実装を提供することを可能にします。" #: ../../library/asyncio-eventloop.rst:366 msgid "" -"Schedule the execution of :ref:`coroutine ` *coro*. Return a :" -"class:`Task` object." +"Schedule the execution of :ref:`coroutine ` *coro*. Return " +"a :class:`Task` object." msgstr "" +":ref:`コルーチン ` *coro* の実行をスケジュールしま" +"す。 :class:`Task` オブジェクトを返します。" #: ../../library/asyncio-eventloop.rst:369 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " -"interoperability. In this case, the result type is a subclass of :class:" -"`Task`." +"interoperability. In this case, the result type is a subclass " +"of :class:`Task`." 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 "" @@ -619,21 +658,25 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:380 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" "省略可能なキーワード引数 *context* によって、*coro* を実行するためのカスタム" "の :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." +"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 +686,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 +721,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." @@ -711,14 +768,17 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:447 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" -"`~socket.AF_INET6` depending on *host* (or the *family* argument, if " -"provided)." +"The socket family can be either :py:const:`~socket.AF_INET` " +"or :py:const:`~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 @@ -752,16 +812,16 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:464 msgid "" -"*protocol_factory* is called without arguments and is expected to return a :" -"ref:`protocol ` instance." +"*protocol_factory* is called without arguments and is expected to return " +"a :ref:`protocol ` instance." msgstr "" "*protocol_factory* が引数なしで呼び出され、ファクトリが :ref:`プロトコル " "` インスタンスを返すよう要求します。" #: ../../library/asyncio-eventloop.rst:467 msgid "" -"The protocol instance is coupled with the transport by calling its :meth:" -"`~BaseProtocol.connection_made` method." +"The protocol instance is coupled with the transport by calling " +"its :meth:`~BaseProtocol.connection_made` method." msgstr "" "プロトコルインスタンスが :meth:`~BaseProtocol.connection_made` メソッドを呼び" "出すことにより、トランスポートと紐付けられます。" @@ -784,15 +844,16 @@ msgstr "その他の引数:" msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " -"object, this context is used to create the transport; if *ssl* is :const:" -"`True`, a default context returned from :func:`ssl.create_default_context` " -"is used." +"object, this context is used to create the transport; if *ssl* " +"is :const:`True`, a default context returned " +"from :func:`ssl.create_default_context` is used." msgstr "" "*ssl*: 偽値以外が与えられた場合、SSL/TLS トランスポートが作成されます (デフォ" -"ルトでは暗号化なしの TCP トランスポートが作成されます)。 *ssl* が :class:" -"`ssl.SSLContext` オブジェクトの場合、このコンテキストがトランスポートを作成す" -"るために使用されます; *ssl* が :const:`True` の場合、 :func:`ssl." -"create_default_context` が返すデフォルトのコンテキストが使われます。" +"ルトでは暗号化なしの TCP トランスポートが作成されます)。 *ssl* " +"が :class:`ssl.SSLContext` オブジェクトの場合、このコンテキストがトランスポー" +"トを作成するために使用されます; *ssl* が :const:`True` の場" +"合、 :func:`ssl.create_default_context` が返すデフォルトのコンテキストが使わ" +"れます。" #: ../../library/asyncio-eventloop.rst:483 msgid ":ref:`SSL/TLS security considerations `" @@ -816,17 +877,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 "" @@ -854,34 +914,34 @@ msgid "" "*happy_eyeballs_delay* is not specified, and ``1`` if it is." msgstr "" "*interleave* はホスト名が複数の IP アドレスに名前解決される場合のアドレスの並" -"べ替えを制御します。 ``0`` または未指定の場合並べ替えは行われず、 :meth:" -"`getaddrinfo` が返す順番にしたがってアドレスへの接続を試行します。正の整数が" -"指定されると、アドレスはアドレスファミリに応じてインターリーブされます。この" -"とき、与えられた整数は :rfc:`8305` で定義される \"最初のアドレスファミリカウ" -"ント (First Address Family Count)\" として解釈されます。デフォルト値は、 " -"*happy_eyeballs_delay* が指定されない場合は ``0`` であり、指定された場合は " -"``1`` です。" +"べ替えを制御します。 ``0`` または未指定の場合並べ替えは行われ" +"ず、 :meth:`getaddrinfo` が返す順番にしたがってアドレスへの接続を試行します。" +"正の整数が指定されると、アドレスはアドレスファミリに応じてインターリーブされ" +"ます。このとき、与えられた整数は :rfc:`8305` で定義される \"最初のアドレス" +"ファミリカウント (First Address Family Count)\" として解釈されます。デフォル" +"ト値は、 *happy_eyeballs_delay* が指定されない場合は ``0`` であり、指定された" +"場合は ``1`` です。" #: ../../library/asyncio-eventloop.rst:515 msgid "" -"*sock*, if given, should be an existing, already connected :class:`socket." -"socket` object to be used by the transport. If *sock* is given, none of " -"*host*, *port*, *family*, *proto*, *flags*, *happy_eyeballs_delay*, " -"*interleave* and *local_addr* should be specified." +"*sock*, if given, should be an existing, already " +"connected :class:`socket.socket` object to be used by the transport. If " +"*sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, " +"*happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." msgstr "" -"*sock* を与える場合、トランスポートに使用される、既存の、かつ接続済の :class:" -"`socket.socket` オブジェクトを指定します。*sock* を指定する場合、*host*、 " -"*port*、 *family*、 *proto*、 *flags*、 *happy_eyeballs_delay*、 " +"*sock* を与える場合、トランスポートに使用される、既存の、かつ接続済" +"の :class:`socket.socket` オブジェクトを指定します。*sock* を指定する場合、" +"*host*、 *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." +"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 +965,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 +982,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 +1000,19 @@ 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 +1022,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 @@ -980,9 +1056,9 @@ msgid "" "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -":func:`open_connection` 関数は高水準の代替 API です。この関数は(:class:" -"`StreamReader`, :class:`StreamWriter`) のペアを返し、 async/await コードから" -"直接使うことができます。" +":func:`open_connection` 関数は高水準の代替 API です。この関数は" +"(:class:`StreamReader`, :class:`StreamWriter`) のペアを返し、 async/await " +"コードから直接使うことができます。" #: ../../library/asyncio-eventloop.rst:595 msgid "Create a datagram connection." @@ -990,14 +1066,19 @@ msgstr "データグラム接続 (UDP) を生成します。" #: ../../library/asyncio-eventloop.rst:597 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" -"`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " -"the *family* argument, if provided)." +"The socket family can be " +"either :py:const:`~socket.AF_INET`, :py:const:`~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 @@ -1017,34 +1098,32 @@ msgstr "成功すると ``(transport, protocol)`` タプルが返されます。 #: ../../library/asyncio-eventloop.rst:610 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " -"the socket locally. The *local_host* and *local_port* are looked up using :" -"meth:`getaddrinfo`." +"the socket locally. The *local_host* and *local_port* are looked up " +"using :meth:`getaddrinfo`." msgstr "" "*local_addr* が指定される場合、ソケットをローカルにバインドするための " "``(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 +1133,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 "" @@ -1067,18 +1152,19 @@ msgstr "" msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " -"specified, *local_addr* and *remote_addr* should be omitted (must be :const:" -"`None`)." +"specified, *local_addr* and *remote_addr* should be omitted (must " +"be :const:`None`)." msgstr "" -"オプションの *sock* を指定することで、既存の、すでに接続されている :class:" -"`socket.socket` をトランスポートで使用することができます。このオプションを使" -"用する場合、*local_addr* と *remote_addr* は省略してください (:const:`None` " -"でなければなりません)。" +"オプションの *sock* を指定することで、既存の、すでに接続されてい" +"る :class:`socket.socket` をトランスポートで使用することができます。このオプ" +"ションを使用する場合、*local_addr* と *remote_addr* は省略してください " +"(:const:`None` でなければなりません)。" #: ../../library/asyncio-eventloop.rst:643 msgid "" -"See :ref:`UDP echo client protocol ` and :" -"ref:`UDP echo server protocol ` examples." +"See :ref:`UDP echo client protocol ` " +"and :ref:`UDP echo server protocol ` " +"examples." msgstr "" ":ref:`UDP echo クライアントプロトコル ` お" "よび :ref:`UDP echo サーバープロトコル ` の" @@ -1089,6 +1175,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." @@ -1096,10 +1184,15 @@ msgstr "Windows サポートが追加されました。" #: ../../library/asyncio-eventloop.rst:653 msgid "" -"The *reuse_address* parameter is no longer supported, as using :ref:`socket." -"SO_REUSEADDR ` poses a significant security concern " -"for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." +"The *reuse_address* parameter is no longer supported, as " +"using :ref:`socket.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 +1211,18 @@ 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." @@ -1131,19 +1230,22 @@ msgstr "Unix 接続を生成します。" #: ../../library/asyncio-eventloop.rst:682 msgid "" -"The socket family will be :py:const:`~socket.AF_UNIX`; socket type will be :" -"py:const:`~socket.SOCK_STREAM`." +"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 "" "*path* is the name of a Unix domain socket and is required, unless a *sock* " -"parameter is specified. Abstract Unix sockets, :class:`str`, :class:" -"`bytes`, and :class:`~pathlib.Path` paths are supported." +"parameter is specified. Abstract Unix " +"sockets, :class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths are " +"supported." msgstr "" "*path* は Unix ドメインソケット名で、 *sock* パラメータが指定されない場合は必" -"須です。 抽象 Unix ソケット、 :class:`str`、 :class:`bytes`、 and :class:" -"`~pathlib.Path` 形式でのパスがサポートされています。" +"須です。 抽象 Unix ソケット、 :class:`str`、 :class:`bytes`、 " +"and :class:`~pathlib.Path` 形式でのパスがサポートされています。" #: ../../library/asyncio-eventloop.rst:692 msgid "" @@ -1153,29 +1255,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 +1317,28 @@ 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`)." +"*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,16 +1353,18 @@ 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 "" -"*backlog* is the maximum number of queued connections passed to :meth:" -"`~socket.socket.listen` (defaults to 100)." +"*backlog* is the maximum number of queued connections passed " +"to :meth:`~socket.socket.listen` (defaults to 100)." msgstr "" "*backlog* は :meth:`~socket.socket.listen` に渡される、キューに入るコネクショ" "ンの最大数になります (デフォルトは 100)。" @@ -1265,8 +1374,8 @@ msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " "the accepted connections." msgstr "" -"確立した接続の上で TLS を有効化するために、 *ssl* に :class:`~ssl." -"SSLContext` のインスタンスを指定することができます。" +"確立した接続の上で TLS を有効化するために、 *ssl* " +"に :class:`~ssl.SSLContext` のインスタンスを指定することができます。" #: ../../library/asyncio-eventloop.rst:773 msgid "" @@ -1291,15 +1400,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 +1436,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 "" @@ -1340,15 +1451,16 @@ msgid "" "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -":func:`start_server` 関数は高水準の代替 API です。この関数は :class:" -"`StreamReader` と :class:`StreamWriter` のペアを返し、async/await コードから" -"使うことができます。" +":func:`start_server` 関数は高水準の代替 API です。この関数" +"は :class:`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." +"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 "" @@ -1357,15 +1469,17 @@ msgid "" "and :class:`~pathlib.Path` paths are supported." msgstr "" "*path* は Unix ドメインソケット名で、 *sock* パラメータが指定されない場合は必" -"須です。 抽象 Unix ソケット、 :class:`str`、 :class:`bytes`、 and :class:" -"`~pathlib.Path` 形式でのパスがサポートされています。" +"須です。 抽象 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 +1489,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." @@ -1467,8 +1582,8 @@ msgstr "" "*offset* はファイルの読み込み開始位置を指定します。 *count* が指定された場" "合、ファイルの EOF までファイルを送信する代わりに、 *count* で指定された総バ" "イト数の分だけ送信します。ファイルオブジェクトが指し示す位置は、メソッドがエ" -"ラーを送出した場合でも更新されます。この場合実際に送信されたバイト数は :meth:" -"`file.tell() ` メソッドで取得することができます。" +"ラーを送出した場合でも更新されます。この場合実際に送信されたバイト数" +"は :meth:`file.tell() ` メソッドで取得することができます。" #: ../../library/asyncio-eventloop.rst:936 msgid "" @@ -1497,34 +1612,43 @@ 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 "" -"*transport* and *protocol* instances that methods like :meth:`~loop." -"create_server` and :meth:`~loop.create_connection` return." +"*transport* and *protocol* instances that methods " +"like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." msgstr "" -"*transport* と *protocol* には、 :meth:`~loop.create_server` や :meth:`~loop." -"create_connection` が返すものと同等のインスタンスを指定します。" +"*transport* と *protocol* には、 :meth:`~loop.create_server` " +"や :meth:`~loop.create_connection` が返すものと同等のインスタンスを指定しま" +"す。" #: ../../library/asyncio-eventloop.rst:975 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." @@ -1558,18 +1682,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 +1713,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 "" @@ -1608,22 +1734,22 @@ msgstr "ソケットオブジェクトと直接やりとりする" #: ../../library/asyncio-eventloop.rst:1040 msgid "" -"In general, protocol implementations that use transport-based APIs such as :" -"meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " -"implementations that work with sockets directly. However, there are some use " -"cases when performance is not critical, and working with :class:`~socket." -"socket` objects directly is more convenient." +"In general, protocol implementations that use transport-based APIs such " +"as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster " +"than implementations that work with sockets directly. However, there are " +"some use cases when performance is not critical, and working " +"with :class:`~socket.socket` objects directly is more convenient." msgstr "" "一般に、 :meth:`loop.create_connection` や :meth:`loop.create_server` のよう" "なトランスポートベースの API を使ったプロトコルの実装はソケットと直接やり取り" -"する実装に比べて高速です。しかしながら、パフォーマンスが重要でなく、直接 :" -"class:`~socket.socket` オブジェクトとやりとりした方が便利なユースケースがいく" -"つかあります。" +"する実装に比べて高速です。しかしながら、パフォーマンスが重要でなく、直" +"接 :class:`~socket.socket` オブジェクトとやりとりした方が便利なユースケースが" +"いくつかあります。" #: ../../library/asyncio-eventloop.rst:1050 msgid "" -"Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." -"recv() `." +"Receive up to *nbytes* from *sock*. Asynchronous version " +"of :meth:`socket.recv() `." msgstr "" "*nbytes* で指定したバイト数までのデータをソケット *sock* から受信します。 こ" "のメソッドは :meth:`socket.recv() ` の非同期版です。" @@ -1644,20 +1770,20 @@ 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 "" -"Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" -"meth:`socket.recv_into() ` method." +"Receive data from *sock* into the *buf* buffer. Modeled after the " +"blocking :meth:`socket.recv_into() ` method." msgstr "" "ソケット *sock* からデータを受信してバッファ *buf* に格納します。ブロッキング" "コードの :meth:`socket.recv_into() ` メソッドをモデ" @@ -1667,30 +1793,30 @@ 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() `." +"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 "" -"Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." -"sendall() `." +"Send *data* to the *sock* socket. Asynchronous version " +"of :meth:`socket.sendall() `." msgstr "" "データ *data* をソケット *sock* に送信します。 :meth:`socket.sendall() " "` メソッドの非同期版です。" @@ -1708,26 +1834,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() `." +"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*." @@ -1741,14 +1866,14 @@ msgstr ":meth:`socket.connect() ` の非同期版です #: ../../library/asyncio-eventloop.rst:1140 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " -"check if the *address* is already resolved by calling :func:`socket." -"inet_pton`. If not, :meth:`loop.getaddrinfo` will be used to resolve the " -"*address*." +"check if the *address* is already resolved by " +"calling :func:`socket.inet_pton`. If not, :meth:`loop.getaddrinfo` will be " +"used to resolve the *address*." msgstr "" -"``address`` を名前解決する必要はなくなりました。 ``sock_connect`` は :func:" -"`socket.inet_pton` を呼び出して *address* が解決済みかどうかを確認します。未" -"解決の場合、 *address* の名前解決には :meth:`loop.getaddrinfo` メソッドが使わ" -"れます。" +"``address`` を名前解決する必要はなくなりました。 ``sock_connect`` " +"は :func:`socket.inet_pton` を呼び出して *address* が解決済みかどうかを確認し" +"ます。未解決の場合、 *address* の名前解決には :meth:`loop.getaddrinfo` メソッ" +"ドが使われます。" #: ../../library/asyncio-eventloop.rst:1149 msgid "" @@ -1763,8 +1888,8 @@ msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." msgstr "" -"接続を受け付けます。ブロッキングコールの :meth:`socket.accept() ` メソッドをモデルとしています。" +"接続を受け付けます。ブロッキングコールの :meth:`socket.accept() " +"` メソッドをモデルとしています。" #: ../../library/asyncio-eventloop.rst:1159 msgid "" @@ -1798,11 +1923,11 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1185 msgid "" -"*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." -"socket`." +"*sock* must be a non-" +"blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." msgstr "" -"*sock* は :const:`socket.SOCK_STREAM` タイプのノンブロッキングな :class:" -"`~socket.socket` でなければなりません。" +"*sock* は :const:`socket.SOCK_STREAM` タイプのノンブロッキング" +"な :class:`~socket.socket` でなければなりません。" #: ../../library/asyncio-eventloop.rst:1188 msgid "*file* must be a regular file object open in binary mode." @@ -1841,7 +1966,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,26 +1974,30 @@ 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 :" -"class:`asyncio.Future` objects. Starting with Python 3.7 both methods are " -"coroutines." +"return a coroutine, but prior to Python 3.7 they were, in fact, " +"returning :class:`asyncio.Future` objects. Starting with Python 3.7 both " +"methods are 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 `." @@ -1878,22 +2006,20 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1251 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports the :class:" -"`ReadTransport` interface and *protocol* is an object instantiated by the " -"*protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports " +"the :class:`ReadTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -"``(transport, protocol)`` のペアを返します。ここで *transport* は :class:" -"`ReadTransport` のインターフェースをサポートし、 *protocol* は " +"``(transport, protocol)`` のペアを返します。ここで *transport* " +"は :class:`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." @@ -1905,13 +2031,13 @@ msgstr "*pipe* は :term:`file-like オブジェクト ` です。" #: ../../library/asyncio-eventloop.rst:1268 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports :class:" -"`WriteTransport` interface and *protocol* is an object instantiated by the " -"*protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* " +"supports :class:`WriteTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -"``(transport, protocol)`` のペアを返します。ここで *transport* は :class:" -"`WriteTransport` のインスタンスであり、 *protocol* は *protocol_factory* ファ" -"クトリでインスタンス化されたオブジェクトです。" +"``(transport, protocol)`` のペアを返します。ここで *transport* " +"は :class:`WriteTransport` のインスタンスであり、 *protocol* は " +"*protocol_factory* ファクトリでインスタンス化されたオブジェクトです。" #: ../../library/asyncio-eventloop.rst:1277 msgid "" @@ -1936,17 +2062,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 +2112,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 +2119,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 +2173,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." @@ -2062,8 +2239,8 @@ msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." msgstr "" -"関数 *func* に :ref:`キーワード引数を渡す ` 場合は :" -"func:`functools.partial` を使ってください。" +"関数 *func* に :ref:`キーワード引数を渡す ` 場合" +"は :func:`functools.partial` を使ってください。" #: ../../library/asyncio-eventloop.rst:1394 msgid "" @@ -2073,23 +2250,28 @@ msgid "" "default." msgstr "" ":meth:`loop.run_in_executor` は内部で生成するスレッドプールエグゼキュータの " -"``max_workers`` を設定せず、代わりにスレッドプールエグゼキュータ (:class:" -"`~concurrent.futures.ThreadPoolExecutor`) にデフォルト値を設定させるようにな" -"りました。" +"``max_workers`` を設定せず、代わりにスレッドプールエグゼキュータ " +"(:class:`~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`." +"*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`." +"*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" @@ -2115,21 +2297,24 @@ msgstr "" "なければ、 *handler* は ``(loop, context)`` に一致する関数シグネチャを持った" "呼び出し可能オブジェクトでなければなりません。ここで ``loop`` はアクティブな" "イベントループへの参照であり、 ``context`` は例外の詳細な記述からなる " -"``dict`` オブジェクトです (*context* についての詳細は :meth:" -"`call_exception_handler` メソッドのドキュメントを参照してください)。" +"``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." +"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 "" @@ -2155,8 +2340,8 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1454 msgid "" -"*context* parameter has the same meaning as in :meth:" -"`call_exception_handler`." +"*context* parameter has the same meaning as " +"in :meth:`call_exception_handler`." msgstr "引数 *context* の意味は :meth:`call_exception_handler` と同じです。" #: ../../library/asyncio-eventloop.rst:1459 @@ -2183,9 +2368,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 +2384,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 +2401,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" @@ -2236,8 +2420,9 @@ msgstr "イベントループのデバッグモード (:class:`bool`) を取得 #: ../../library/asyncio-eventloop.rst:1490 msgid "" -"The default value is ``True`` if the environment variable :envvar:" -"`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." +"The default value is ``True`` if the environment " +"variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, " +"``False`` otherwise." msgstr "" "環境変数 :envvar:`PYTHONASYNCIODEBUG` に空でない文字列が設定されている場合の" "デフォルト値は ``True``、そうでない場合は ``False`` になります。" @@ -2254,16 +2439,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 `." @@ -2280,15 +2466,20 @@ msgid "" "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" "この節で解説しているのは低水準のメソッドです。通常の async/await コードでは、" -"高水準の関数である :func:`asyncio.create_subprocess_shell` や :func:`asyncio." -"create_subprocess_exec` を代わりに使うことを検討してください。" +"高水準の関数である :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." +"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 "" @@ -2337,8 +2528,8 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1557 msgid "" -"The *protocol_factory* must be a callable returning a subclass of the :class:" -"`asyncio.SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`asyncio.SubprocessProtocol` class." msgstr "" "*protocol_factory* は :class:`asyncio.SubprocessProtocol` クラスの派生クラス" "を返す呼び出し可能オブジェクトでなければなりません。" @@ -2351,17 +2542,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 @@ -2387,11 +2576,11 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1580 #: ../../library/asyncio-eventloop.rst:1590 msgid "" -"the :const:`subprocess.DEVNULL` constant which indicates that the special :" -"data:`os.devnull` file will be used" +"the :const:`subprocess.DEVNULL` constant which indicates that the " +"special :data:`os.devnull` file will be used" msgstr "" -":const:`subprocess.DEVNULL` 定数を設定すると、特別なファイル :data:`os." -"devnull` を使います。" +":const:`subprocess.DEVNULL` 定数を設定すると、特別なファイ" +"ル :data:`os.devnull` を使います。" #: ../../library/asyncio-eventloop.rst:1573 msgid "*stdout* can be any of these:" @@ -2415,9 +2604,10 @@ msgid "" "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " "*encoding* and *errors*, which should not be specified at all." msgstr "" -"その他のすべてのキーワード引数は解釈されずにそのまま :class:`subprocess." -"Popen` に渡されます。ただし、 *bufsize*、 *universal_newlines*、 *shell*、 " -"*text*、 *encoding* および *errors* は指定してはいけません。" +"その他のすべてのキーワード引数は解釈されずにそのま" +"ま :class:`subprocess.Popen` に渡されます。ただし、 *bufsize*、 " +"*universal_newlines*、 *shell*、 *text*、 *encoding* および *errors* は指定し" +"てはいけません。" #: ../../library/asyncio-eventloop.rst:1600 msgid "" @@ -2429,13 +2619,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." +"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 "" @@ -2451,20 +2644,20 @@ msgid "" "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -"``(transport, protocol)`` のペアを返します。ここで *transport* は :class:" -"`asyncio.SubprocessTransport` 基底クラスに適合するオブジェクトで、 " +"``(transport, protocol)`` のペアを返します。ここで *transport* " +"は :class:`asyncio.SubprocessTransport` 基底クラスに適合するオブジェクトで、 " "*protocol* は *protocol_factory* によりインスタンス化されたオブジェクトです。" #: ../../library/asyncio-eventloop.rst:1621 msgid "" -"Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" -"`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" "コマンド *cmd* からプラットフォームの \"シェル\" シンタックスを使ってサブプロ" "セスを生成します。 *cmd* は :class:`str` 文字列もしくは :ref:`ファイルシステ" -"ムのエンコーディング ` でエンコードされた :class:" -"`bytes` 文字列です。" +"ムのエンコーディング ` でエンコードされ" +"た :class:`bytes` 文字列です。" #: ../../library/asyncio-eventloop.rst:1626 msgid "" @@ -2476,8 +2669,8 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1629 msgid "" -"The *protocol_factory* must be a callable returning a subclass of the :class:" -"`SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`SubprocessProtocol` class." msgstr "" "*protocol_factory* は :class:`SubprocessProtocol` の派生クラスを返す呼び出し" "可能オブジェクトでなければなりません。" @@ -2496,9 +2689,9 @@ msgid "" "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -"``(transport, protocol)`` のペアを返します。ここで *transport* は :class:" -"`SubprocessTransport` 基底クラスに適合するオブジェクトで、 *protocol* は " -"*protocol_factory* によりインスタンス化されたオブジェクトです。" +"``(transport, protocol)`` のペアを返します。ここで *transport* " +"は :class:`SubprocessTransport` 基底クラスに適合するオブジェクトで、 " +"*protocol* は *protocol_factory* によりインスタンス化されたオブジェクトです。" #: ../../library/asyncio-eventloop.rst:1640 msgid "" @@ -2521,16 +2714,17 @@ msgstr "コールバックのハンドル" #: ../../library/asyncio-eventloop.rst:1653 msgid "" -"A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." -"call_soon_threadsafe`." +"A callback wrapper object returned " +"by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." 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 "" @@ -2546,8 +2740,8 @@ msgstr "コールバックがキャンセルされた場合 ``True`` を返し #: ../../library/asyncio-eventloop.rst:1676 msgid "" -"A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" -"`loop.call_at`." +"A callback wrapper object returned by :meth:`loop.call_later`, " +"and :meth:`loop.call_at`." msgstr "" " :meth:`loop.call_later` や :meth:`loop.call_at` が返すコールバックのラッパー" "オブジェクトです。" @@ -2562,8 +2756,8 @@ msgstr "コールバックのスケジュール時刻を秒単位の :class:`flo #: ../../library/asyncio-eventloop.rst:1685 msgid "" -"The time is an absolute timestamp, using the same time reference as :meth:" -"`loop.time`." +"The time is an absolute timestamp, using the same time reference " +"as :meth:`loop.time`." msgstr "" "戻り値の時刻は絶対値で、 :meth:`loop.time` と同じ参照時刻を使って定義されてい" "ます。" @@ -2574,17 +2768,16 @@ msgstr "Serverオブジェクト" #: ../../library/asyncio-eventloop.rst:1694 msgid "" -"Server objects are created by :meth:`loop.create_server`, :meth:`loop." -"create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " -"functions." +"Server objects are created " +"by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, " +"and :func:`start_unix_server` functions." msgstr "" -"Server オブジェクトは :meth:`loop.create_server`、 :meth:`loop." -"create_unix_server`、 :func:`start_server` および :func:`start_unix_server` " -"関数により生成されます。" +"Server オブジェクト" +"は :meth:`loop.create_server`、 :meth:`loop.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 +2789,6 @@ msgstr "" "の中で使われた場合、 ``async with`` 文が完了した時に Server オブジェクトがク" "ローズされること、およびそれ以降に接続を受け付けないことが保証されます。" -#: ../../library/asyncio-eventloop.rst:1707 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2605,6 +2797,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 +2810,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 +2831,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 +2883,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 "" @@ -2692,19 +2898,18 @@ msgid "" "or :meth:`Server.serve_forever` can be used to make the Server start " "accepting connections." msgstr "" -"キーワード専用のパラメータ *start_serving* を :meth:`loop.create_server` や :" -"meth:`asyncio.start_server` メソッドに対して使用することにより、初期に接続を" -"受け付けない Server オブジェクトを生成することができます。この場合 ``Server." -"start_serving()`` または :meth:`Server.serve_forever` メソッドを使ってオブ" -"ジェクトが接続の受け付けを開始するようにすることができます。" +"キーワード専用のパラメータ *start_serving* を :meth:`loop.create_server` " +"や :meth:`asyncio.start_server` メソッドに対して使用することにより、初期に接" +"続を受け付けない Server オブジェクトを生成することができます。この場合 " +"``Server.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 +2920,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 +2933,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 +2975,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`." +"asyncio ships with two different event loop " +"implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -"asyncio は2つの異なるイベントループの実装、 :class:`SelectorEventLoop` と :" -"class:`ProactorEventLoop`、 を提供します: " +"asyncio は2つの異なるイベントループの実装、 :class:`SelectorEventLoop` " +"と :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 +3002,6 @@ msgstr "" "プラットフォーム上で利用可能な最も効率の良い *selector* を使います。特定のセ" "レクタ実装を使うように手動で構成することも可能です::" -#: ../../library/asyncio-eventloop.rst:1852 msgid "" "import asyncio\n" "import selectors\n" @@ -2794,44 +3009,58 @@ msgid "" "async def main():\n" " ...\n" "\n" -"loop_factory = lambda: asyncio.SelectorEventLoop(selectors." -"SelectSelector())\n" +"loop_factory = lambda: " +"asyncio.SelectorEventLoop(selectors.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." +"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." +"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" @@ -2840,14 +3069,16 @@ msgstr "使用例" #: ../../library/asyncio-eventloop.rst:1897 msgid "" "Note that all examples in this section **purposefully** show how to use the " -"low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." -"call_soon`. Modern asyncio applications rarely need to be written this way; " -"consider using the high-level functions like :func:`asyncio.run`." -msgstr "" -"この節の全ての使用例は **意図的に** :meth:`loop.run_forever` や :meth:`loop." -"call_soon` のような 低水準のイベントループ API の使用法を示しています。一方で" -"現代的な asyncio アプリケーションはここに示すような方法をほとんど必要としませ" -"ん。 :func:`asyncio.run` のような高水準の関数の使用を検討してください。" +"low-level event loop APIs, such as :meth:`loop.run_forever` " +"and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be " +"written this way; consider using the high-level functions " +"like :func:`asyncio.run`." +msgstr "" +"この節の全ての使用例は **意図的に** :meth:`loop.run_forever` " +"や :meth:`loop.call_soon` のような 低水準のイベントループ API の使用法を示し" +"ています。一方で現代的な asyncio アプリケーションはここに示すような方法をほと" +"んど必要としません。 :func:`asyncio.run` のような高水準の関数の使用を検討して" +"ください。" #: ../../library/asyncio-eventloop.rst:1907 msgid "Hello World with call_soon()" @@ -2861,7 +3092,6 @@ msgstr "" ":meth:`loop.call_soon` メソッドを使ってコールバックをスケジュールする例です。" "コールバックは ``\"Hello World\"`` を出力しイベントループを停止します::" -#: ../../library/asyncio-eventloop.rst:1913 msgid "" "import asyncio\n" "\n" @@ -2881,6 +3111,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 "" @@ -2900,9 +3148,9 @@ msgid "" "callback uses the :meth:`loop.call_later` method to reschedule itself after " "5 seconds, and then stops the event loop::" msgstr "" -"毎秒現在時刻を表示するコールバックの例です。コールバックは :meth:`loop." -"call_later` メソッドを使って自身を5秒後に実行するよう再スケジュールし、イベン" -"トループを停止します::" +"毎秒現在時刻を表示するコールバックの例です。コールバック" +"は :meth:`loop.call_later` メソッドを使って自身を5秒後に実行するよう再スケ" +"ジュールし、イベントループを停止します::" #: ../../library/asyncio-eventloop.rst:1946 msgid "" @@ -2943,13 +3191,12 @@ msgstr "読み込みイベント用ファイル記述子の監視" #: ../../library/asyncio-eventloop.rst:1979 msgid "" -"Wait until a file descriptor received some data using the :meth:`loop." -"add_reader` method and then close the event loop::" +"Wait until a file descriptor received some data using " +"the :meth:`loop.add_reader` method and then close the event loop::" msgstr "" "ファイル記述子が :meth:`loop.add_reader` メソッドを使って何らかのデータを受信" "するまで待機し、その後イベントループをクローズします::" -#: ../../library/asyncio-eventloop.rst:1982 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2984,14 +3231,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 +3287,13 @@ 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::" +"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..f56d70b96 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -12,145 +12,153 @@ 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." +"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`:" +"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`)." +"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." +"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..2c3c24832 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 @@ -79,9 +79,9 @@ msgstr "" #: ../../library/asyncio-future.rst:42 msgid "" -"a :class:`Task` object wrapping *obj*, if *obj* is a coroutine (:func:" -"`iscoroutine` is used for the test); in this case the coroutine will be " -"scheduled by ``ensure_future()``." +"a :class:`Task` object wrapping *obj*, if *obj* is a coroutine " +"(:func:`iscoroutine` is used for the test); in this case the coroutine will " +"be scheduled by ``ensure_future()``." msgstr "" "引数 *obj* がコルーチンである (:func:`iscoroutine` 関数を使って検査します) 場" "合には *obj* をラップした :class:`Task` オブジェクト; この場合コルーチンは " @@ -89,8 +89,8 @@ msgstr "" #: ../../library/asyncio-future.rst:47 msgid "" -"a :class:`Task` object that would await on *obj*, if *obj* is an awaitable (:" -"func:`inspect.isawaitable` is used for the test.)" +"a :class:`Task` object that would await on *obj*, if *obj* is an awaitable " +"(:func:`inspect.isawaitable` is used for the test.)" msgstr "" "引数 *obj* が awaitable である (:func:`inspect.isawaitable` 関数を使って検査" "します) 場合には *obj* を await する :class:`Task` オブジェクト" @@ -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,25 +123,27 @@ 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 "" -"Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio." -"Future` object." +"Wrap a :class:`concurrent.futures.Future` object in " +"a :class:`asyncio.Future` object." 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 "" @@ -172,9 +180,10 @@ msgstr "" #: ../../library/asyncio-future.rst:97 msgid "" "The rule of thumb is to never expose Future objects in user-facing APIs, and " -"the recommended way to create a Future object is to call :meth:`loop." -"create_future`. This way alternative event loop implementations can inject " -"their own optimized implementations of a Future object." +"the recommended way to create a Future object is to " +"call :meth:`loop.create_future`. This way alternative event loop " +"implementations can inject their own optimized implementations of a Future " +"object." msgstr "" "経験則は Future オブジェクトをユーザー向けの API であらわに利用しないことで" "す。推奨される Future オブジェクトの生成方法は :meth:`loop.create_future` を" @@ -185,11 +194,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." @@ -205,34 +215,35 @@ msgstr "" #: ../../library/asyncio-future.rst:117 msgid "" -"If the Future is *done* and has an exception set by the :meth:" -"`set_exception` method, this method raises the exception." +"If the Future is *done* and has an exception set by " +"the :meth:`set_exception` method, this method raises the exception." msgstr "" "Future が *完了* していて、 :meth:`set_exception` メソッドにより設定された例" "外を持っている場合はその例外を送出します。" #: ../../library/asyncio-future.rst:120 ../../library/asyncio-future.rst:208 msgid "" -"If the Future has been *cancelled*, this method raises a :exc:" -"`CancelledError` exception." +"If the Future has been *cancelled*, this method raises " +"a :exc:`CancelledError` exception." 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." +"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." @@ -247,9 +258,9 @@ msgid "" "A Future is *done* if it was *cancelled* or if it has a result or an " "exception set with :meth:`set_result` or :meth:`set_exception` calls." msgstr "" -"Future は *キャンセルされた* か、または :meth:`set_result` メソッドや :meth:" -"`set_exception` メソッドの呼び出しにより結果や例外が設定された場合に *完了* " -"とみなされます。" +"Future は *キャンセルされた* か、または :meth:`set_result` メソッド" +"や :meth:`set_exception` メソッドの呼び出しにより結果や例外が設定された場合" +"に *完了* とみなされます。" #: ../../library/asyncio-future.rst:150 msgid "Return ``True`` if the Future was *cancelled*." @@ -263,11 +274,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*." @@ -287,9 +299,9 @@ msgstr "" #: ../../library/asyncio-future.rst:168 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *callback* to run in. The current " -"context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" "オプションのキーワード引数 *context* を使って、コールバック*callback* を実行" "する際のコンテキスト :class:`contextvars.Context` を設定することができます。" @@ -297,18 +309,20 @@ msgstr "" #: ../../library/asyncio-future.rst:172 msgid "" -":func:`functools.partial` can be used to pass parameters to the callback, e." -"g.::" +":func:`functools.partial` can be used to pass parameters to the callback, " +"e.g.::" 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 +358,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." @@ -362,8 +375,8 @@ msgstr "" #: ../../library/asyncio-future.rst:211 msgid "" -"If the Future isn't *done* yet, this method raises an :exc:" -"`InvalidStateError` exception." +"If the Future isn't *done* yet, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" "Future が *未完了* の場合、このメソッドは :exc:`InvalidStateError` 例外を送出" "します。" @@ -380,7 +393,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 +422,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 "" @@ -437,8 +476,8 @@ msgstr "" #: ../../library/asyncio-future.rst:267 msgid "" -":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :" -"exc:`InvalidStateError` exception when the Future is not *done*." +":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise " +"an :exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" ":meth:`asyncio.Future.result` と :meth:`asyncio.Future.exception` は Future " "が *未完了* の場合に :exc:`InvalidStateError` 例外を送出します。" @@ -457,11 +496,12 @@ msgid "" "asyncio Future is not compatible with the :func:`concurrent.futures.wait` " "and :func:`concurrent.futures.as_completed` functions." msgstr "" -"asyncio の Future は :func:`concurrent.futures.wait` および :func:" -"`concurrent.futures.as_completed` との互換性がありません。" +"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." +":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..04ffdf3c2 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`" @@ -218,8 +214,8 @@ msgid "" "Run a CPU-bound or other blocking function in a :mod:`concurrent.futures` " "executor." msgstr "" -"CPUバウンドなブロッキング関数、またはその他のブロッキング関数を :mod:" -"`concurrent.futures` 実行オブジェクト (executor) 上で実行します。" +"CPUバウンドなブロッキング関数、またはその他のブロッキング関数" +"を :mod:`concurrent.futures` 実行オブジェクト (executor) 上で実行します。" #: ../../library/asyncio-llapi-index.rst:108 msgid ":meth:`loop.set_default_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() `." @@ -659,12 +651,14 @@ msgstr "現在のプロトコルを返します。" #: ../../library/asyncio-llapi-index.rst:314 msgid "" "Transports that can receive data (TCP and Unix connections, pipes, etc). " -"Returned from methods like :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_read_pipe`, etc:" +"Returned from methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_read_pipe`, " +"etc:" msgstr "" "データを受信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメソッ" -"ドです。該当するトランスポートは :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_read_pipe` などの戻り値です:" +"ドです。該当するトランスポート" +"は :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_read_pipe` " +"などの戻り値です:" #: ../../library/asyncio-llapi-index.rst:319 msgid "Read Transports" @@ -697,16 +691,17 @@ msgstr "データの受信を再開します。" #: ../../library/asyncio-llapi-index.rst:334 msgid "" "Transports that can Send data (TCP and Unix connections, pipes, etc). " -"Returned from methods like :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_write_pipe`, etc:" +"Returned from methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_write_pipe`, " +"etc:" msgstr "" "データを送信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメソッ" -"ドです。該当するトランスポートは :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_write_pipe` などの戻り値です:" +"ドです。該当するトランスポート" +"は :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() `" @@ -755,21 +750,21 @@ msgstr "トランスポートを即座にクローズします。" #: ../../library/asyncio-llapi-index.rst:359 msgid "" -":meth:`transport.get_write_buffer_size() `" +":meth:`transport.get_write_buffer_size() " +"`" msgstr "" -":meth:`transport.get_write_buffer_size() `" +":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() `" +":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." @@ -777,11 +772,11 @@ msgstr "書き込みフロー制御の高水位点と低水位点を取得しま #: ../../library/asyncio-llapi-index.rst:367 msgid "" -":meth:`transport.set_write_buffer_limits() `" +":meth:`transport.set_write_buffer_limits() " +"`" msgstr "" -":meth:`transport.set_write_buffer_limits() `" +":meth:`transport.set_write_buffer_limits() " +"`" #: ../../library/asyncio-llapi-index.rst:369 msgid "Set new high and low water marks for write flow control." @@ -809,15 +804,15 @@ msgstr ":meth:`transport.abort() `" #: ../../library/asyncio-llapi-index.rst:386 msgid "" -"Low-level transport abstraction over subprocesses. Returned by :meth:`loop." -"subprocess_exec` and :meth:`loop.subprocess_shell`:" +"Low-level transport abstraction over subprocesses. Returned " +"by :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell`:" msgstr "" -"サブプロセスに対するトランスポートの低レベルな抽象化です。 :meth:`loop." -"subprocess_exec` や :meth:`loop.subprocess_shell` の戻り値です:" +"サブプロセスに対するトランスポートの低レベルな抽象化で" +"す。 :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() `" @@ -829,11 +824,11 @@ msgstr "サブプロセスのプロセス ID を返します。" #: ../../library/asyncio-llapi-index.rst:398 msgid "" -":meth:`transport.get_pipe_transport() `" +":meth:`transport.get_pipe_transport() " +"`" msgstr "" -":meth:`transport.get_pipe_transport() `" +":meth:`transport.get_pipe_transport() " +"`" #: ../../library/asyncio-llapi-index.rst:400 msgid "" @@ -1004,9 +999,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 +1009,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 +1024,15 @@ 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." +"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" @@ -1044,9 +1040,9 @@ msgstr "イベントループのポリシー" #: ../../library/asyncio-llapi-index.rst:505 msgid "" -"Policies is a low-level mechanism to alter the behavior of functions like :" -"func:`asyncio.get_event_loop`. See also the main :ref:`policies section " -"` for more details." +"Policies is a low-level mechanism to alter the behavior of functions " +"like :func:`asyncio.get_event_loop`. See also the main :ref:`policies " +"section ` for more details." msgstr "" "ポリシーは :func:`asyncio.get_event_loop` などの関数の振る舞いを変更する低レ" "ベルなメカニズムです。詳細は :ref:`ポリシーについてのセクション ` are not supported, i.e. :meth:`loop." -"subprocess_exec` and :meth:`loop.subprocess_shell` methods are not " -"implemented." +":ref:`Subprocesses ` are not supported, " +"i.e. :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods " +"are not implemented." msgstr "" -":ref:`Subprocesses ` はサポートされていません。すなわち :" -"meth:`loop.subprocess_exec` と :meth:`loop.subprocess_shell` の2つのメソッド" -"は未実装です。" +":ref:`Subprocesses ` はサポートされていません。すなわ" +"ち :meth:`loop.subprocess_exec` と :meth:`loop.subprocess_shell` の2つのメ" +"ソッドは未実装です。" #: ../../library/asyncio-platforms.rst:60 msgid ":class:`ProactorEventLoop` has the following limitations:" @@ -177,20 +177,21 @@ msgstr "10.8 以前の macOS" #: ../../library/asyncio-platforms.rst:88 msgid "" -"On macOS 10.6, 10.7 and 10.8, the default event loop uses :class:`selectors." -"KqueueSelector`, which does not support character devices on these " -"versions. The :class:`SelectorEventLoop` can be manually configured to use :" -"class:`~selectors.SelectSelector` or :class:`~selectors.PollSelector` to " -"support character devices on these older versions of macOS. Example::" -msgstr "" -"macOS 10.6, 10.7 および 10.8 では、デフォルトイベントループは :class:" -"`selectors.KqueueSelector` をしていますが、このクラスはこれらの macOS バー" -"ジョンのキャラクターデバイスをサポートしていません。これらの macOS バージョン" -"でキャラクターデバイスをサポートするためには :class:`SelectorEventLoop` で :" -"class:`~selectors.SelectSelector` または :class:`~selectors.PollSelector` を" -"使うように手動で設定します。以下はその例です::" - -#: ../../library/asyncio-platforms.rst:95 +"On macOS 10.6, 10.7 and 10.8, the default event loop " +"uses :class:`selectors.KqueueSelector`, which does not support character " +"devices on these versions. The :class:`SelectorEventLoop` can be manually " +"configured to use :class:`~selectors.SelectSelector` " +"or :class:`~selectors.PollSelector` to support character devices on these " +"older versions of macOS. Example::" +msgstr "" +"macOS 10.6, 10.7 および 10.8 では、デフォルトイベントループ" +"は :class:`selectors.KqueueSelector` をしていますが、このクラスはこれらの " +"macOS バージョンのキャラクターデバイスをサポートしていません。これらの macOS " +"バージョンでキャラクターデバイスをサポートするために" +"は :class:`SelectorEventLoop` で :class:`~selectors.SelectSelector` また" +"は :class:`~selectors.PollSelector` を使うように手動で設定します。以下はその" +"例です::" + msgid "" "import asyncio\n" "import selectors\n" @@ -199,3 +200,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..ba815a567 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -17,50 +17,66 @@ 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." +"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 " -"default policy can be :ref:`replaced ` with :ref:" -"`built-in alternatives ` to use different event loop " -"implementations, or substituted by a :ref:`custom policy ` that can override these behaviors." +"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 default policy can be :ref:`replaced ` " +"with :ref:`built-in alternatives ` to use different " +"event loop 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`." +"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 "" -"Policy objects should implement the APIs defined in the :class:" -"`AbstractEventLoopPolicy` abstract base class." +"Policy objects should implement the APIs defined in " +"the :class:`AbstractEventLoopPolicy` abstract base class." msgstr "" "ポリシーオブジェクトは :class:`AbstractEventLoopPolicy` 抽象基底クラスで定義" "された API を実装しなければなりません。" @@ -80,11 +96,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 +111,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 +153,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:" @@ -149,19 +166,18 @@ msgstr "asyncio は以下の組み込みポリシーを提供します:" #: ../../library/asyncio-policy.rst:110 msgid "" -"The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix and :" -"class:`ProactorEventLoop` on Windows." +"The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix " +"and :class:`ProactorEventLoop` on Windows." 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 +185,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 +207,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 +225,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" @@ -219,13 +238,13 @@ msgstr "ポリシーのカスタマイズ" #: ../../library/asyncio-policy.rst:158 msgid "" -"To implement a new event loop policy, it is recommended to subclass :class:" -"`DefaultEventLoopPolicy` and override the methods for which custom behavior " -"is wanted, e.g.::" +"To implement a new event loop policy, it is recommended to " +"subclass :class:`DefaultEventLoopPolicy` and override the methods for which " +"custom behavior is wanted, e.g.::" msgstr "" -"新しいイベントループのポリシーを実装するためには、以下に示すように :class:" -"`DefaultEventLoopPolicy` を継承して振る舞いを変更したいメソッドをオーバーライ" -"ドすることが推奨されます。::" +"新しいイベントループのポリシーを実装するためには、以下に示すよう" +"に :class:`DefaultEventLoopPolicy` を継承して振る舞いを変更したいメソッドを" +"オーバーライドすることが推奨されます。::" #: ../../library/asyncio-policy.rst:162 msgid "" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 0430a2b20..f74629eb5 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 @@ -103,11 +103,11 @@ msgstr "" #: ../../library/asyncio-protocol.rst:44 msgid "" -"Most of connection oriented event loop methods (such as :meth:`loop." -"create_connection`) usually accept a *protocol_factory* argument used to " -"create a *Protocol* object for an accepted connection, represented by a " -"*Transport* object. Such methods usually return a tuple of ``(transport, " -"protocol)``." +"Most of connection oriented event loop methods (such " +"as :meth:`loop.create_connection`) usually accept a *protocol_factory* " +"argument used to create a *Protocol* object for an accepted connection, " +"represented by a *Transport* object. Such methods usually return a tuple of " +"``(transport, protocol)``." msgstr "" "ほとんどの接続に基づくイベントループメソッド (:meth:`loop.create_connection` " "など) は通常 *protocol_factory* 引数を受け取り、 *Transport* オブジェクトで表" @@ -124,24 +124,23 @@ msgstr "このページは以下の節から構成されます:" #: ../../library/asyncio-protocol.rst:54 msgid "" -"The `Transports`_ section documents asyncio :class:`BaseTransport`, :class:" -"`ReadTransport`, :class:`WriteTransport`, :class:`Transport`, :class:" -"`DatagramTransport`, and :class:`SubprocessTransport` classes." +"The `Transports`_ section documents " +"asyncio :class:`BaseTransport`, :class:`ReadTransport`, :class:`WriteTransport`, :class:`Transport`, :class:`DatagramTransport`, " +"and :class:`SubprocessTransport` classes." msgstr "" -"`Transports`_ 節は asyncio の :class:`BaseTransport`, :class:" -"`ReadTransport`, :class:`WriteTransport`, :class:`Transport`, :class:" -"`DatagramTransport`, および :class:`SubprocessTransport` クラスについて記述し" -"ています。" +"`Transports`_ 節は asyncio " +"の :class:`BaseTransport`, :class:`ReadTransport`, :class:`WriteTransport`, :class:`Transport`, :class:`DatagramTransport`, " +"および :class:`SubprocessTransport` クラスについて記述しています。" #: ../../library/asyncio-protocol.rst:59 msgid "" -"The `Protocols`_ section documents asyncio :class:`BaseProtocol`, :class:" -"`Protocol`, :class:`BufferedProtocol`, :class:`DatagramProtocol`, and :class:" -"`SubprocessProtocol` classes." +"The `Protocols`_ section documents " +"asyncio :class:`BaseProtocol`, :class:`Protocol`, :class:`BufferedProtocol`, :class:`DatagramProtocol`, " +"and :class:`SubprocessProtocol` classes." msgstr "" -"`Protocols`_ 節は asyncio の :class:`BaseProtocol`, :class:`Protocol`, :" -"class:`BufferedProtocol`, :class:`DatagramProtocol`, および :class:" -"`SubprocessProtocol` クラスについて記述しています。" +"`Protocols`_ 節は asyncio " +"の :class:`BaseProtocol`, :class:`Protocol`, :class:`BufferedProtocol`, :class:`DatagramProtocol`, " +"および :class:`SubprocessProtocol` クラスについて記述しています。" #: ../../library/asyncio-protocol.rst:63 msgid "" @@ -209,9 +208,9 @@ msgstr "書き込み専用の接続に対する基底トランスポートクラ #: ../../library/asyncio-protocol.rst:100 msgid "" -"Instances of the *WriteTransport* class are returned from the :meth:`loop." -"connect_write_pipe` event loop method and are also used by subprocess-" -"related methods like :meth:`loop.subprocess_exec`." +"Instances of the *WriteTransport* class are returned from " +"the :meth:`loop.connect_write_pipe` event loop method and are also used by " +"subprocess-related methods like :meth:`loop.subprocess_exec`." msgstr "" "*WriteTransport* クラスのインスタンスは :meth:`loop.connect_write_pipe` イベ" "ントループメソッドから返され、 :meth:`loop.subprocess_exec` のようなサブプロ" @@ -223,9 +222,9 @@ msgstr "読み込み専用の接続に対する基底トランスポートクラ #: ../../library/asyncio-protocol.rst:109 msgid "" -"Instances of the *ReadTransport* class are returned from the :meth:`loop." -"connect_read_pipe` event loop method and are also used by subprocess-related " -"methods like :meth:`loop.subprocess_exec`." +"Instances of the *ReadTransport* class are returned from " +"the :meth:`loop.connect_read_pipe` event loop method and are also used by " +"subprocess-related methods like :meth:`loop.subprocess_exec`." msgstr "" " *ReadTransport* クラスのインスタンスは :meth:`loop.connect_read_pipe` イベン" "トループメソッドから返され、 :meth:`loop.subprocess_exec` のようなサブプロセ" @@ -251,14 +250,14 @@ msgstr "" #: ../../library/asyncio-protocol.rst:123 msgid "" "Instances of the *Transport* class are returned from or used by event loop " -"methods like :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.create_server`, :meth:`loop.sendfile`, " +"methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.create_server`, :meth:`loop.sendfile`, " "etc." msgstr "" -"*Transport* クラスのインスタンスは、:meth:`loop.create_connection`, :meth:" -"`loop.create_unix_connection`, :meth:`loop.create_server`, :meth:`loop." -"sendfile` などのイベントループメソッドから返されたり、これらのメソッドから利" -"用されたりします。" +"*Transport* クラスのインスタンス" +"は、:meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.create_server`, :meth:`loop.sendfile` " +"などのイベントループメソッドから返されたり、これらのメソッドから利用されたり" +"します。" #: ../../library/asyncio-protocol.rst:131 msgid "A transport for datagram (UDP) connections." @@ -266,11 +265,12 @@ msgstr "データグラム (UDP) 接続のためのトランスポートです #: ../../library/asyncio-protocol.rst:133 msgid "" -"Instances of the *DatagramTransport* class are returned from the :meth:`loop." -"create_datagram_endpoint` event loop method." +"Instances of the *DatagramTransport* class are returned from " +"the :meth:`loop.create_datagram_endpoint` event loop method." msgstr "" -"*DatagramTransport* クラスのインスタンスは :meth:`loop." -"create_datagram_endpoint` イベントループメソッドから返されます。" +"*DatagramTransport* クラスのインスタンス" +"は :meth:`loop.create_datagram_endpoint` イベントループメソッドから返されま" +"す。" #: ../../library/asyncio-protocol.rst:139 msgid "" @@ -304,10 +304,10 @@ msgid "" msgstr "" "トランスポートが発信データのバッファーを持っていた場合、バッファーされたデー" "タは非同期にフラッシュされます。それ以降データは受信されません。バッファーさ" -"れていたデータがすべてフラッシュされた後、そのプロトコルの :meth:`protocol." -"connection_lost() ` メソッドが引数 :const:" -"`None` で呼び出されます。一度閉じたトランスポートは、使用されるべきではありま" -"せん。" +"れていたデータがすべてフラッシュされた後、そのプロトコル" +"の :meth:`protocol.connection_lost() ` メソッド" +"が引数 :const:`None` で呼び出されます。一度閉じたトランスポートは、使用される" +"べきではありません。" #: ../../library/asyncio-protocol.rst:164 msgid "Return ``True`` if the transport is closing or is closed." @@ -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:" @@ -361,8 +363,9 @@ msgid "" "``'peername'``: the remote address to which the socket is connected, result " "of :meth:`socket.socket.getpeername` (``None`` on error)" msgstr "" -"``'peername'``: ソケットが接続されているリモートアドレスで、:meth:`socket." -"socket.getpeername` の結果になります (エラーのときは ``None``)" +"``'peername'``: ソケットが接続されているリモートアドレス" +"で、:meth:`socket.socket.getpeername` の結果になります (エラーのときは " +"``None``)" #: ../../library/asyncio-protocol.rst:194 msgid "``'socket'``: :class:`socket.socket` instance" @@ -370,8 +373,8 @@ msgstr "``'socket'``: :class:`socket.socket` のインスタンスになりま #: ../../library/asyncio-protocol.rst:196 msgid "" -"``'sockname'``: the socket's own address, result of :meth:`socket.socket." -"getsockname`" +"``'sockname'``: the socket's own address, result " +"of :meth:`socket.socket.getsockname`" msgstr "" "``'sockname'``: ソケット自身のアドレスで、:meth:`socket.socket.getsockname` " "の結果になります" @@ -383,8 +386,8 @@ msgstr "SSL ソケット:" #: ../../library/asyncio-protocol.rst:201 msgid "" "``'compression'``: the compression algorithm being used as a string, or " -"``None`` if the connection isn't compressed; result of :meth:`ssl.SSLSocket." -"compression`" +"``None`` if the connection isn't compressed; result " +"of :meth:`ssl.SSLSocket.compression`" msgstr "" "``'compression'``: 圧縮アルゴリズムで、:meth:`ssl.SSLSocket.compression` の結" "果になります。圧縮されていないときは ``None`` になります" @@ -464,8 +467,8 @@ msgid "" "until :meth:`resume_reading` is called." msgstr "" "トランスポートの受信側を一時停止します。 :meth:`resume_reading` メソッドが呼" -"び出されるまでプロトコルの :meth:`protocol.data_received() ` メソッドにデータは渡されません。" +"び出されるまでプロトコルの :meth:`protocol.data_received() " +"` メソッドにデータは渡されません。" #: ../../library/asyncio-protocol.rst:253 msgid "" @@ -481,9 +484,9 @@ msgid "" "` method will be called once again if some data is " "available for reading." msgstr "" -"受信を再開します。データが読み込み可能になるとプロトコルの :meth:`protocol." -"data_received() ` メソッドが再び呼び出されるようにな" -"ります。" +"受信を再開します。データが読み込み可能になるとプロトコル" +"の :meth:`protocol.data_received() ` メソッドが再び呼" +"び出されるようになります。" #: ../../library/asyncio-protocol.rst:263 msgid "" @@ -512,8 +515,8 @@ msgstr "" #: ../../library/asyncio-protocol.rst:281 msgid "" -"Return :const:`True` if the transport supports :meth:`~WriteTransport." -"write_eof`, :const:`False` if not." +"Return :const:`True` if the transport " +"supports :meth:`~WriteTransport.write_eof`, :const:`False` if not." msgstr "" "トランスポートが :meth:`~WriteTransport.write_eof` メソッドをサポートしている" "場合 :const:`True` を返し、そうでない場合は :const:`False` を返します。" @@ -541,49 +544,51 @@ msgstr "書き込みフロー制御の *最高* および *最低* 水位点を #: ../../library/asyncio-protocol.rst:302 msgid "" -"These two values (measured in number of bytes) control when the protocol's :" -"meth:`protocol.pause_writing() ` and :meth:" -"`protocol.resume_writing() ` methods are " -"called. If specified, the low watermark must be less than or equal to the " -"high watermark. Neither *high* nor *low* can be negative." +"These two values (measured in number of bytes) control when the " +"protocol's :meth:`protocol.pause_writing() ` " +"and :meth:`protocol.resume_writing() ` methods " +"are called. If specified, the low watermark must be less than or equal to " +"the high watermark. Neither *high* nor *low* can be negative." msgstr "" -"(バイト数をあらわす) これら2つの値はプロトコルの :meth:`protocol." -"pause_writing() ` と :meth:`protocol." -"resume_writing() ` の2つのメソッドがいつ呼ばれる" -"かを制御します。指定する場合、 *low* は *high* と等しいかまたは *high* より小" -"さくなければなりません。また、 *high* も *low* も負の値を指定することはできま" -"せん。" +"(バイト数をあらわす) これら2つの値はプロトコル" +"の :meth:`protocol.pause_writing() ` " +"と :meth:`protocol.resume_writing() ` の2つのメ" +"ソッドがいつ呼ばれるかを制御します。指定する場合、 *low* は *high* と等しいか" +"または *high* より小さくなければなりません。また、 *high* も *low* も負の値を" +"指定することはできません。" #: ../../library/asyncio-protocol.rst:310 msgid "" ":meth:`~BaseProtocol.pause_writing` is called when the buffer size becomes " -"greater than or equal to the *high* value. If writing has been paused, :meth:" -"`~BaseProtocol.resume_writing` is called when the buffer size becomes less " -"than or equal to the *low* value." +"greater than or equal to the *high* value. If writing has been " +"paused, :meth:`~BaseProtocol.resume_writing` is called when the buffer size " +"becomes less than or equal to the *low* value." msgstr "" ":meth:`~BaseProtocol.pause_writing` はバッファーサイズが *high* の値以上に" "なった場合に呼び出されます。書き込みが一時停止している場合、バッファーサイズ" "が *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 " "than or equal to the high watermark. Setting *high* to zero forces *low* to " "zero as well, and causes :meth:`~BaseProtocol.pause_writing` to be called " -"whenever the buffer becomes non-empty. Setting *low* to zero causes :meth:" -"`~BaseProtocol.resume_writing` to be called only once the buffer is empty. " -"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 と計算を並行に" -"実行する機会を減少させるため、一般に最適ではありません。" +"whenever the buffer becomes non-empty. Setting *low* to zero " +"causes :meth:`~BaseProtocol.resume_writing` to be called only once the " +"buffer is empty. Use of zero for either limit is generally sub-optimal as it " +"reduces opportunities for doing I/O and computation concurrently." +msgstr "" +"デフォルト値は実装固有になります。\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 +672,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." @@ -684,24 +688,24 @@ msgstr "" #: ../../library/asyncio-protocol.rst:393 msgid "" -"``0``: readable streaming transport of the standard input (*stdin*), or :" -"const:`None` if the subprocess was not created with ``stdin=PIPE``" +"``0``: readable streaming transport of the standard input (*stdin*), " +"or :const:`None` if the subprocess was not created with ``stdin=PIPE``" msgstr "" "``0``: 標準入力 (*stdin*) の読み込み可能ストリーミングトランスポート。サブプ" "ロセスが ``stdin=PIPE`` で作成されていない場合は :const:`None`" #: ../../library/asyncio-protocol.rst:395 msgid "" -"``1``: writable streaming transport of the standard output (*stdout*), or :" -"const:`None` if the subprocess was not created with ``stdout=PIPE``" +"``1``: writable streaming transport of the standard output (*stdout*), " +"or :const:`None` if the subprocess was not created with ``stdout=PIPE``" msgstr "" "``1``: 標準出力 (*stdout*) の書き込み可能ストリーミングトランスポート。サブプ" "ロセスが ``stdout=PIPE`` で作成されていない場合は :const:`None`" #: ../../library/asyncio-protocol.rst:397 msgid "" -"``2``: writable streaming transport of the standard error (*stderr*), or :" -"const:`None` if the subprocess was not created with ``stderr=PIPE``" +"``2``: writable streaming transport of the standard error (*stderr*), " +"or :const:`None` if the subprocess was not created with ``stderr=PIPE``" msgstr "" "``2``: 標準エラー出力 (*stderr*) の書き込み可能ストリーミングトランスポート。" "サブプロセスが ``stderr=PIPE`` で作成されていない場合は :const:`None`" @@ -738,11 +742,11 @@ msgstr ":meth:`subprocess.Popen.kill` も参照してください。" #: ../../library/asyncio-protocol.rst:418 msgid "" -"Send the *signal* number to the subprocess, as in :meth:`subprocess.Popen." -"send_signal`." +"Send the *signal* number to the subprocess, as " +"in :meth:`subprocess.Popen.send_signal`." msgstr "" -"サブプロセスにシグナル *signal* を送信します。:meth:`subprocess.Popen." -"send_signal` と同じです。" +"サブプロセスにシグナル *signal* を送信しま" +"す。:meth:`subprocess.Popen.send_signal` と同じです。" #: ../../library/asyncio-protocol.rst:423 msgid "Stop the subprocess." @@ -855,15 +859,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 +891,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" @@ -925,23 +929,23 @@ msgstr "" #: ../../library/asyncio-protocol.rst:529 msgid "" -"If the buffer size equals the high watermark, :meth:`~BaseProtocol." -"pause_writing` is not called: the buffer size must go strictly over." +"If the buffer size equals the high " +"watermark, :meth:`~BaseProtocol.pause_writing` is not called: the buffer " +"size must go strictly over." msgstr "" -"バッファーサイズが最高水位点と等しい場合、 :meth:`~BaseProtocol." -"pause_writing` は呼び出されません: バッファーサイズは必ず制限値を超えなければ" -"なりません。" +"バッファーサイズが最高水位点と等しい場" +"合、 :meth:`~BaseProtocol.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" @@ -949,17 +953,14 @@ msgstr "ストリーミングプロトコル" #: ../../library/asyncio-protocol.rst:542 msgid "" -"Event methods, such as :meth:`loop.create_server`, :meth:`loop." -"create_unix_server`, :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_accepted_socket`, :meth:`loop." -"connect_read_pipe`, and :meth:`loop.connect_write_pipe` accept factories " -"that return streaming protocols." +"Event methods, such " +"as :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_accepted_socket`, :meth:`loop.connect_read_pipe`, " +"and :meth:`loop.connect_write_pipe` accept factories that return streaming " +"protocols." msgstr "" -":meth:`loop.create_server`, :meth:`loop.create_unix_server`, :meth:`loop." -"create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop." -"connect_accepted_socket`, :meth:`loop.connect_read_pipe`, そして :meth:`loop." -"connect_write_pipe` などのイベントメソッドはストリーミングプロトコルを返す" -"ファクトリを受け付けます。" +":meth:`loop.create_server`, :meth:`loop.create_unix_server`, :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_accepted_socket`, :meth:`loop.connect_read_pipe`, " +"そして :meth:`loop.connect_write_pipe` などのイベントメソッドはストリーミング" +"プロトコルを返すファクトリを受け付けます。" #: ../../library/asyncio-protocol.rst:550 msgid "" @@ -1036,13 +1037,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" @@ -1112,8 +1116,8 @@ msgstr "*nbytes* はバッファに書き込まれた総バイト数です。" #: ../../library/asyncio-protocol.rst:631 msgid "" -"See the documentation of the :meth:`protocol.eof_received() ` method." +"See the documentation of the :meth:`protocol.eof_received() " +"` method." msgstr "" ":meth:`protocol.eof_received() ` メソッドのドキュメン" "トを参照してください。" @@ -1122,17 +1126,16 @@ msgstr "" msgid "" ":meth:`~BufferedProtocol.get_buffer` can be called an arbitrary number of " "times during a connection. However, :meth:`protocol.eof_received() " -"` is called at most once and, if called, :meth:" -"`~BufferedProtocol.get_buffer` and :meth:`~BufferedProtocol.buffer_updated` " -"won't be called after it." +"` is called at most once and, if " +"called, :meth:`~BufferedProtocol.get_buffer` " +"and :meth:`~BufferedProtocol.buffer_updated` won't be called after it." msgstr "" "コネクションの間、 :meth:`~BufferedProtocol.get_buffer` は何度でも呼び出すこ" "とができます。しかし :meth:`protocol.eof_received() ` " -"が呼び出されるのは最大でも1回で、もし呼び出されると、それ以降 :meth:" -"`~BufferedProtocol.get_buffer` と :meth:`~BufferedProtocol.buffer_updated` が" -"呼び出されることはありません。" +"が呼び出されるのは最大でも1回で、もし呼び出されると、それ以" +"降 :meth:`~BufferedProtocol.get_buffer` " +"と :meth:`~BufferedProtocol.buffer_updated` が呼び出されることはありません。" -#: ../../library/asyncio-protocol.rst:643 msgid "" "start -> connection_made\n" " [-> get_buffer\n" @@ -1141,6 +1144,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" @@ -1166,8 +1175,8 @@ msgstr "" #: ../../library/asyncio-protocol.rst:667 msgid "" -"Called when a previous send or receive operation raises an :class:" -"`OSError`. *exc* is the :class:`OSError` instance." +"Called when a previous send or receive operation raises " +"an :class:`OSError`. *exc* is the :class:`OSError` instance." msgstr "" "直前の送信あるいは受信が :class:`OSError` を送出したときに呼び出されます。" "*exc* は :class:`OSError` のインスタンスになります。" @@ -1183,28 +1192,28 @@ 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 "" -"The socket always appears 'ready' and excess packets are dropped. An :class:" -"`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may not be " -"raised; if it is raised, it will be reported to :meth:`DatagramProtocol." -"error_received` but otherwise ignored." +"The socket always appears 'ready' and excess packets are dropped. " +"An :class:`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may " +"not be raised; if it is raised, it will be reported " +"to :meth:`DatagramProtocol.error_received` but otherwise ignored." msgstr "" "ソケットは常に '準備ができた状態' のように振る舞いますが、超過したパケットは" -"破棄されます。この場合 ``errno`` を :const:`errno.ENOBUFS` に設定した :class:" -"`OSError` 例外が送出されることがあります。もし例外が送出された場合は :meth:" -"`DatagramProtocol.error_received` に通知されますが、送出されない場合は単に無" -"視されます。" +"破棄されます。この場合 ``errno`` を :const:`errno.ENOBUFS` に設定し" +"た :class:`OSError` 例外が送出されることがあります。もし例外が送出された場合" +"は :meth:`DatagramProtocol.error_received` に通知されますが、送出されない場合" +"は単に無視されます。" #: ../../library/asyncio-protocol.rst:690 msgid "Subprocess Protocols" @@ -1216,9 +1225,9 @@ msgid "" "passed to the :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` " "methods." msgstr "" -"サブプロセスプロトコルのインスタンスは :meth:`loop.subprocess_exec` と :" -"meth:`loop.subprocess_shell` メソッドに渡されたプロトコルファクトリにより生成" -"されるべきです。" +"サブプロセスプロトコルのインスタンスは :meth:`loop.subprocess_exec` " +"と :meth:`loop.subprocess_shell` メソッドに渡されたプロトコルファクトリにより" +"生成されるべきです。" #: ../../library/asyncio-protocol.rst:698 msgid "" @@ -1249,14 +1258,13 @@ 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." +"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,12 +1717,59 @@ 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 "" "The :ref:`watch a file descriptor for read events " -"` example uses the low-level :meth:`loop." -"add_reader` method to register an FD." +"` example uses the low-" +"level :meth:`loop.add_reader` method to register an FD." msgstr "" ":ref:`ファイル記述子の読み込みイベントを監視する ` " "例では低レベルの :meth:`loop.add_reader` メソッドを使ってファイル記述子 (FD) " @@ -1580,8 +1782,8 @@ msgid "" "created by the :func:`open_connection` function in a coroutine." msgstr "" ":ref:`ストリームを使ってデータを待ち受けるオープンなソケットを登録する " -"` 例ではコルーチン内で :func:" -"`open_connection` 関数によって生成されたストリームを使っています。" +"` 例ではコルーチン内" +"で :func:`open_connection` 関数によって生成されたストリームを使っています。" #: ../../library/asyncio-protocol.rst:1000 msgid "loop.subprocess_exec() and SubprocessProtocol" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index a9161d8d9..9350c6eda 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 @@ -44,8 +44,8 @@ msgstr "" #: ../../library/asyncio-queue.rst:17 msgid "" -"Note that methods of asyncio queues don't have a *timeout* parameter; use :" -"func:`asyncio.wait_for` function to do queue operations with a timeout." +"Note that methods of asyncio queues don't have a *timeout* parameter; " +"use :func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" "asyncio キューのメソッドは *timeout* パラメータを持たないことに注意してくださ" "い; タイムアウトを伴うキューを使った処理を行うには :func:`asyncio.wait_for` " @@ -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``." +"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." @@ -137,10 +138,10 @@ msgstr "キューにある全ての要素が取得され、処理されるまで #: ../../library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer coroutine calls :meth:" -"`task_done` to indicate that the item was retrieved and all work on it is " -"complete. When the count of unfinished tasks drops to zero, :meth:`join` " -"unblocks." +"queue. The count goes down whenever a consumer coroutine " +"calls :meth:`task_done` to indicate that the item was retrieved and all work " +"on it is complete. When the count of unfinished tasks drops to " +"zero, :meth:`join` unblocks." msgstr "" "未完了のタスクのカウント値は、キューにアイテムが追加されるときは常に加算さ" "れ、キューの要素を消費するコルーチンが要素を取り出し、処理を完了したことを通" @@ -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." @@ -173,8 +173,8 @@ msgstr "キュー内の要素数を返します。" #: ../../library/asyncio-queue.rst:105 msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" -"exc:`QueueShutDown`." +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " +"raise :exc:`QueueShutDown`." msgstr "" #: ../../library/asyncio-queue.rst:108 @@ -188,20 +188,21 @@ msgstr "" msgid "" "All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " "unblocked. If *immediate* is true, a task will be marked as done for each " -"remaining item in the queue, which may unblock callers of :meth:`~Queue." -"join`." +"remaining item in the queue, which may unblock callers " +"of :meth:`~Queue.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 "" @@ -209,9 +210,9 @@ msgid "" "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`~Queue.put` into the queue)." msgstr "" -":meth:`join` が現在ブロック中だった場合、全アイテムが処理されたとき (:meth:" -"`~Queue.put` でキューに追加された全アイテムの :meth:`task_done` の呼び出しを" -"受信したとき) に再開します。" +":meth:`join` が現在ブロック中だった場合、全アイテムが処理されたとき " +"(:meth:`~Queue.put` でキューに追加された全アイテムの :meth:`task_done` の呼び" +"出しを受信したとき) に再開します。" #: ../../library/asyncio-queue.rst:132 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..d6c4f9936 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 "" @@ -77,35 +75,45 @@ msgstr "" #: ../../library/asyncio-runner.rst:38 ../../library/asyncio-runner.rst:97 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " -"disables debug mode explicitly. ``None`` is used to respect the global :ref:" -"`asyncio-debug-mode` settings." +"disables debug mode explicitly. ``None`` is used to respect the " +"global :ref:`asyncio-debug-mode` settings." msgstr "" "*debug* が ``True`` の場合、イベントループはデバッグモードで実行されます。" -"``False`` は明示的にデバッグモードを無効化します。 グローバルな :ref:" -"`asyncio-debug-mode` 設定を尊重するために ``None`` が使用されます。" +"``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 " "end. This function should be used as a main entry point for asyncio " "programs, and should ideally only be called once. It is recommended to use " -"*loop_factory* to configure the event loop instead of policies. Passing :" -"class:`asyncio.EventLoop` allows running asyncio without the policy system." -msgstr "" +"*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 +121,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 +141,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 +166,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`." +"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,97 +199,120 @@ 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``." +"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." +"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 " "raises :exc:`asyncio.CancelledError` inside the main task. This causes the " "Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be " -"used for resource cleanup. After the main task is cancelled, :meth:`asyncio." -"Runner.run` raises :exc:`KeyboardInterrupt`." -msgstr "" +"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 "" +"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..08e3d54ea 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." @@ -96,36 +113,40 @@ msgstr "" #: ../../library/asyncio-stream.rst:62 msgid "" -"The returned *reader* and *writer* objects are instances of :class:" -"`StreamReader` and :class:`StreamWriter` classes." +"The returned *reader* and *writer* objects are instances " +"of :class:`StreamReader` and :class:`StreamWriter` classes." msgstr "" -"戻り値の *reader* と *writer* はそれぞれ :class:`StreamReader` と :class:" -"`StreamWriter` クラスのインスタンスです。" +"戻り値の *reader* と *writer* はそれぞれ :class:`StreamReader` " +"と :class:`StreamWriter` クラスのインスタンスです。" #: ../../library/asyncio-stream.rst:65 ../../library/asyncio-stream.rst:112 msgid "" -"*limit* determines the buffer size limit used by the returned :class:" -"`StreamReader` instance. By default the *limit* is set to 64 KiB." +"*limit* determines the buffer size limit used by the " +"returned :class:`StreamReader` instance. By default the *limit* is set to " +"64 KiB." msgstr "" "*limit* は戻り値の :class:`StreamReader` インスタンスが利用するバッファのサイ" "ズの上限値を設定します。デフォルトでは *limit* は 64 KiB に設定されます。" #: ../../library/asyncio-stream.rst:69 msgid "" -"The rest of the arguments are passed directly to :meth:`loop." -"create_connection`." +"The rest of the arguments are passed directly " +"to :meth:`loop.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." +"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." @@ -154,9 +175,9 @@ msgid "" "classes." msgstr "" "*client_connected_cb* コールバックは新しいクライアントコネクションが確立され" -"るたびに呼び出されます。このコールバックは :class:`StreamReader` と :class:" -"`StreamWriter` クラスのインスタンスのペア ``(reader, writer)`` を2つの引数と" -"して受け取ります。" +"るたびに呼び出されます。このコールバックは :class:`StreamReader` " +"と :class:`StreamWriter` クラスのインスタンスのペア ``(reader, writer)`` を2" +"つの引数として受け取ります。" #: ../../library/asyncio-stream.rst:108 msgid "" @@ -173,20 +194,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 +231,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,34 +253,36 @@ 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." +"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 "" -"It is not recommended to instantiate *StreamReader* objects directly; use :" -"func:`open_connection` and :func:`start_server` instead." +"It is not recommended to instantiate *StreamReader* objects directly; " +"use :func:`open_connection` and :func:`start_server` instead." 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." @@ -321,8 +345,8 @@ msgid "" "partially read data." msgstr "" "*n* バイトを読み出す前に EOF に達した場合 :exc:`IncompleteReadError` を送出し" -"ます。部分的に読み出したデータを取得するには :attr:`IncompleteReadError." -"partial` 属性を使ってください。" +"ます。部分的に読み出したデータを取得するに" +"は :attr:`IncompleteReadError.partial` 属性を使ってください。" #: ../../library/asyncio-stream.rst:260 msgid "Read data from the stream until *separator* is found." @@ -338,36 +362,42 @@ msgstr "" #: ../../library/asyncio-stream.rst:266 msgid "" -"If the amount of data read exceeds the configured stream limit, a :exc:" -"`LimitOverrunError` exception is raised, and the data is left in the " +"If the amount of data read exceeds the configured stream limit, " +"a :exc:`LimitOverrunError` exception is raised, and the data is left in the " "internal buffer and can be read again." msgstr "" -"読み出したデータの量が設定したストリームの上限を超えると :exc:" -"`LimitOverrunError` 例外が送出されます。このときデータは内部バッファーに残さ" -"れ、再度読み出すことができます。" +"読み出したデータの量が設定したストリームの上限を超える" +"と :exc:`LimitOverrunError` 例外が送出されます。このときデータは内部バッ" +"ファーに残され、再度読み出すことができます。" #: ../../library/asyncio-stream.rst:270 msgid "" -"If EOF is reached before the complete separator is found, an :exc:" -"`IncompleteReadError` exception is raised, and the internal buffer is " -"reset. The :attr:`IncompleteReadError.partial` attribute may contain a " +"If EOF is reached before the complete separator is found, " +"an :exc:`IncompleteReadError` exception is raised, and the internal buffer " +"is reset. The :attr:`IncompleteReadError.partial` attribute may contain a " "portion of the separator." msgstr "" "完全な区切り文字が見つかる前に EOF に達すると :exc:`IncompleteReadError` 例" -"外が送出され、内部バッファーがリセットされます。このとき :attr:" -"`IncompleteReadError.partial` 属性は区切り文字の一部を含むかもしれません。" +"外が送出され、内部バッファーがリセットされます。このと" +"き :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." @@ -387,8 +417,8 @@ msgstr "" #: ../../library/asyncio-stream.rst:302 msgid "" -"It is not recommended to instantiate *StreamWriter* objects directly; use :" -"func:`open_connection` and :func:`start_server` instead." +"It is not recommended to instantiate *StreamWriter* objects directly; " +"use :func:`open_connection` and :func:`start_server` instead." msgstr "" "*StreamWriter* オブジェクトを直接インスタンス化することは推奨されません; 代わ" "りに :func:`open_connection` や :func:`start_server` を使ってください。" @@ -407,11 +437,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 +454,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 "" @@ -466,39 +500,38 @@ msgstr "背後にある asyncio トランスポートを返します。" #: ../../library/asyncio-stream.rst:355 msgid "" -"Access optional transport information; see :meth:`BaseTransport." -"get_extra_info` for details." +"Access optional transport information; " +"see :meth:`BaseTransport.get_extra_info` for details." msgstr "" -"オプションのトランスポート情報にアクセスします。詳細は :meth:`BaseTransport." -"get_extra_info` を参照してください。" +"オプションのトランスポート情報にアクセスします。詳細" +"は :meth:`BaseTransport.get_extra_info` を参照してください。" #: ../../library/asyncio-stream.rst:361 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()* " "blocks until the size of the buffer is drained down to the low watermark and " -"writing can be resumed. When there is nothing to wait for, the :meth:" -"`drain` returns immediately." +"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 +549,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 +578,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" @@ -564,12 +603,12 @@ msgstr "" #: ../../library/asyncio-stream.rst:452 msgid "" "The :ref:`TCP echo client protocol " -"` example uses the low-level :meth:" -"`loop.create_connection` method." +"` example uses the low-" +"level :meth:`loop.create_connection` method." msgstr "" ":ref:`TCP エコークライアントプロトコル " -"` の例は低水準の :meth:`loop." -"create_connection` メソッドを使っています。" +"` の例は低水準" +"の :meth:`loop.create_connection` メソッドを使っています。" #: ../../library/asyncio-stream.rst:459 msgid "TCP echo server using streams" @@ -579,7 +618,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,16 +648,44 @@ 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 "" "The :ref:`TCP echo server protocol " -"` example uses the :meth:`loop." -"create_server` method." +"` example uses " +"the :meth:`loop.create_server` method." msgstr "" ":ref:`TCP エコーサーバープロトコル " -"` の例は :meth:`loop." -"create_server` メソッドを使っています。" +"` の例" +"は :meth:`loop.create_server` メソッドを使っています。" #: ../../library/asyncio-stream.rst:500 msgid "Get HTTP headers" @@ -631,7 +697,6 @@ msgid "" msgstr "" "コマンドラインから渡された URL の HTTP ヘッダーを問い合わせる簡単な例です::" -#: ../../library/asyncio-stream.rst:504 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -669,22 +734,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" @@ -692,13 +790,12 @@ msgstr "ストリームを使ってデータを待つオープンソケットの #: ../../library/asyncio-stream.rst:555 msgid "" -"Coroutine waiting until a socket receives data using the :func:" -"`open_connection` function::" +"Coroutine waiting until a socket receives data using " +"the :func:`open_connection` function::" msgstr "" ":func:`open_connection` 関数を使ってソケットがデータを受信するまで待つコルー" "チンです::" -#: ../../library/asyncio-stream.rst:558 msgid "" "import asyncio\n" "import socket\n" @@ -730,6 +827,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 "" @@ -738,14 +863,14 @@ msgid "" "the :meth:`loop.create_connection` method." msgstr "" ":ref:`プロトコルを使ってオープンしたソケットをデータ待ち受けのために登録する " -"` 例では、低水準のプロトコルと :meth:" -"`loop.create_connection` メソッドを使っています。" +"` 例では、低水準のプロトコル" +"と :meth:`loop.create_connection` メソッドを使っています。" #: ../../library/asyncio-stream.rst:594 msgid "" "The :ref:`watch a file descriptor for read events " -"` example uses the low-level :meth:`loop." -"add_reader` method to watch a file descriptor." +"` example uses the low-" +"level :meth:`loop.add_reader` method to watch a file descriptor." msgstr "" ":ref:`ファイル記述子の読み出しイベントを監視する ` " "例では、低水準の :meth:`loop.add_reader` メソッドを使ってファイル記述子を監視" diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index 9ad55b607..0d00a9777 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)." +"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 @@ -182,17 +206,16 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:118 msgid "" -"asyncio also has the following *low-level* APIs to work with subprocesses: :" -"meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop." -"connect_read_pipe`, :meth:`loop.connect_write_pipe`, as well as the :ref:" -"`Subprocess Transports ` and :ref:`Subprocess " -"Protocols `." +"asyncio also has the following *low-level* APIs to work with " +"subprocesses: :meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop.connect_read_pipe`, :meth:`loop.connect_write_pipe`, " +"as well as the :ref:`Subprocess Transports ` " +"and :ref:`Subprocess Protocols `." msgstr "" "asyncio は以下に挙げるサブプロセスと協調するための *低水準の* API も持ってい" -"ます: :meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:" -"`loop.connect_read_pipe`, :meth:`loop.connect_write_pipe` および :ref:" -"`Subprocess Transports ` と :ref:`Subprocess " -"Protocols `。" +"ま" +"す: :meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop.connect_read_pipe`, :meth:`loop.connect_write_pipe` " +"および :ref:`Subprocess Transports ` " +"と :ref:`Subprocess Protocols `。" #: ../../library/asyncio-subprocess.rst:126 msgid "Constants" @@ -202,20 +225,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." +"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." +"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 "" @@ -228,12 +256,12 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:151 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " -"to process creation functions. It indicates that the special file :data:`os." -"devnull` will be used for the corresponding subprocess stream." +"to process creation functions. It indicates that the special " +"file :data:`os.devnull` will be used for the corresponding subprocess stream." msgstr "" "プロセスを生成する関数の *stdin*, *stdout* または *stderr* 引数に利用できる特" -"殊な値です。対応するサブプロセスのストリームに特殊なファイル :data:`os." -"devnull` が使われることを意味します。" +"殊な値です。対応するサブプロセスのストリームに特殊なファイ" +"ル :data:`os.devnull` が使われることを意味します。" #: ../../library/asyncio-subprocess.rst:157 msgid "Interacting with Subprocesses" @@ -251,35 +279,40 @@ 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." +"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 "" -"This class is designed to have a similar API to the :class:`subprocess." -"Popen` class, but there are some notable differences:" +"This class is designed to have a similar API to " +"the :class:`subprocess.Popen` class, but there are some notable differences:" msgstr "" "このクラスは :class:`subprocess.Popen` クラスと同様の API を持つように設計さ" "れていますが、いくつかの注意すべき違いがあります:" #: ../../library/asyncio-subprocess.rst:175 msgid "" -"unlike Popen, Process instances do not have an equivalent to the :meth:" -"`~subprocess.Popen.poll` method;" +"unlike Popen, Process instances do not have an equivalent to " +"the :meth:`~subprocess.Popen.poll` method;" 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;" +"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." +"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..03ef47cb8 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 @@ -206,8 +217,8 @@ msgstr "" #: ../../library/asyncio-sync.rst:108 msgid "" -"An Event object manages an internal flag that can be set to *true* with the :" -"meth:`~Event.set` method and reset to *false* with the :meth:`clear` " +"An Event object manages an internal flag that can be set to *true* with " +"the :meth:`~Event.set` method and reset to *false* with the :meth:`clear` " "method. The :meth:`~Event.wait` method blocks until the flag is set to " "*true*. The flag is set to *false* initially." msgstr "" @@ -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." @@ -272,8 +302,8 @@ msgstr "イベントをクリア (アンセット) します" #: ../../library/asyncio-sync.rst:160 msgid "" -"Tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event." -"set` method is called again." +"Tasks awaiting on :meth:`~Event.wait` will now block until " +"the :meth:`~Event.set` method is called again." msgstr "" ":meth:`~Event.wait` メソッドで待ち受けを行うタスクは :meth:`~Event.set` メ" "ソッドが再度呼び出されるまで処理をブロックします。" @@ -301,11 +331,11 @@ msgstr "" #: ../../library/asyncio-sync.rst:179 msgid "" -"In essence, a Condition object combines the functionality of an :class:" -"`Event` and a :class:`Lock`. It is possible to have multiple Condition " -"objects share one Lock, which allows coordinating exclusive access to a " -"shared resource between different tasks interested in particular states of " -"that shared resource." +"In essence, a Condition object combines the functionality of " +"an :class:`Event` and a :class:`Lock`. It is possible to have multiple " +"Condition objects share one Lock, which allows coordinating exclusive access " +"to a shared resource between different tasks interested in particular states " +"of that shared resource." msgstr "" "本質的に、 Condition オブジェクトは :class:`Event` と a :class:`Lock` の2つの" "クラスの機能を組み合わせたものです。複数の Condition オブジェクトが単一の " @@ -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 "" @@ -407,8 +449,8 @@ msgstr "通知を受けるまで待機します。" #: ../../library/asyncio-sync.rst:256 msgid "" -"If the calling task has not acquired the lock when this method is called, a :" -"exc:`RuntimeError` is raised." +"If the calling task has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" "このメソッドが呼び出された時点で呼び出し元のタスクがロックを獲得していない場" "合、 :exc:`RuntimeError` 例外が送出されます。" @@ -419,29 +461,35 @@ msgid "" "awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " "Condition re-acquires its lock and this method returns ``True``." msgstr "" -"このメソッドは下層のロックを解除し、その後 :meth:`notify` または :meth:" -"`notify_all` の呼び出しによって起動されるまで処理をブロックします。いったん起" -"動されると、 Condition は再びロックを獲得し、メソッドは ``True`` を返しま" -"す。" +"このメソッドは下層のロックを解除し、その後 :meth:`notify` また" +"は :meth:`notify_all` の呼び出しによって起動されるまで処理をブロックします。" +"いったん起動されると、 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 "" +"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" @@ -453,10 +501,10 @@ msgstr "セマフォオブジェクトです。スレッドセーフではあり #: ../../library/asyncio-sync.rst:287 msgid "" -"A semaphore manages an internal counter which is decremented by each :meth:" -"`acquire` call and incremented by each :meth:`release` call. The counter can " -"never go below zero; when :meth:`acquire` finds that it is zero, it blocks, " -"waiting until some task calls :meth:`release`." +"A semaphore manages an internal counter which is decremented by " +"each :meth:`acquire` call and incremented by each :meth:`release` call. The " +"counter can never go below zero; when :meth:`acquire` finds that it is zero, " +"it blocks, waiting until some task calls :meth:`release`." msgstr "" "セマフォは内部のカウンターを管理しています。カウンターは :meth:`acquire` メ" "ソッドの呼び出しによって減算され、 :meth:`release` メソッドの呼び出しによって" @@ -467,8 +515,8 @@ msgstr "" #: ../../library/asyncio-sync.rst:293 msgid "" "The optional *value* argument gives the initial value for the internal " -"counter (``1`` by default). If the given value is less than ``0`` a :exc:" -"`ValueError` is raised." +"counter (``1`` by default). If the given value is less than ``0`` " +"a :exc:`ValueError` is raised." msgstr "" "オプション引数 *value* は内部カウンターの初期値を与えます (デフォルトは " "``1`` です)。 指定された値が ``0`` より小さい場合、 :exc:`ValueError` 例外が" @@ -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,44 +603,46 @@ 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*." +"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:" -"`~Barrier.wait` method and would be blocked until the specified number of " -"tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the " -"waiting tasks would unblock simultaneously." +"*parties* number of tasks are waiting on it. Tasks can wait on " +"the :meth:`~Barrier.wait` method and would be blocked until the specified " +"number of 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`." +":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." +"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." @@ -687,17 +787,17 @@ msgstr "バリアが broken な状態である場合に ``True`` となるブー #: ../../library/asyncio-sync.rst:465 msgid "" -"This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" -"`Barrier` object is reset or broken." +"This exception, a subclass of :exc:`RuntimeError`, is raised when " +"the :class:`Barrier` object is reset or broken." msgstr "" -":class:`Barrier` オブジェクトがリセットされるか broken な場合に、この例外 (:" -"exc:`RuntimeError` のサブクラス) が送出されます。" +":class:`Barrier` オブジェクトがリセットされるか broken な場合に、この例外 " +"(:exc:`RuntimeError` のサブクラス) が送出されます。" #: ../../library/asyncio-sync.rst:473 msgid "" -"Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" -"`with` statement (``with await lock``, ``with (yield from lock)``) was " -"removed. Use ``async with lock`` instead." +"Acquiring a lock using ``await lock`` or ``yield from lock`` and/" +"or :keyword:`with` statement (``with await lock``, ``with (yield from " +"lock)``) was removed. Use ``async with lock`` instead." msgstr "" "``await lock`` や ``yield from lock`` およびそれらと :keyword:`with` 文との組" "み合わせ (すなわち ``with await lock`` や ``with (yield from lock)``) による" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 3a43ded5e..2cb1ee7c3 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:" @@ -97,8 +105,8 @@ msgid "" "The :func:`asyncio.run` function to run the top-level entry point \"main()\" " "function (see the above example.)" msgstr "" -"最上位のエントリーポイントである \"main()\" 関数を実行する :func:`asyncio." -"run` 関数 (上の例を参照してください。)" +"最上位のエントリーポイントである \"main()\" 関数を実行す" +"る :func:`asyncio.run` 関数 (上の例を参照してください。)" #: ../../library/asyncio-task.rst:52 msgid "" @@ -109,7 +117,6 @@ msgstr "" "コルーチンを await すること。次のコード片は 1 秒間待機した後に \"hello\" と出" "力し、 *更に* 2 秒間待機してから \"world\" と出力します::" -#: ../../library/asyncio-task.rst:56 msgid "" "import asyncio\n" "import time\n" @@ -128,26 +135,45 @@ 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 "" "The :func:`asyncio.create_task` function to run coroutines concurrently as " "asyncio :class:`Tasks `." msgstr "" -"asyncio の :class:`Tasks ` としてコルーチンを並行して走らせる :func:" -"`asyncio.create_task` 関数。" +"asyncio の :class:`Tasks ` としてコルーチンを並行して走らせ" +"る :func:`asyncio.create_task` 関数。" #: ../../library/asyncio-task.rst:83 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::" +"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`." @@ -229,8 +284,8 @@ msgstr "Awaitable" #: ../../library/asyncio-task.rst:139 msgid "" -"We say that an object is an **awaitable** object if it can be used in an :" -"keyword:`await` expression. Many asyncio APIs are designed to accept " +"We say that an object is an **awaitable** object if it can be used in " +"an :keyword:`await` expression. Many asyncio APIs are designed to accept " "awaitables." msgstr "" "あるオブジェクトを :keyword:`await` 式の中で使うことができる場合、そのオブ" @@ -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 "" @@ -301,13 +370,13 @@ msgstr "*Task* は、コルーチンを *並行に* スケジュールするの #: ../../library/asyncio-task.rst:183 msgid "" -"When a coroutine is wrapped into a *Task* with functions like :func:`asyncio." -"create_task` the coroutine is automatically scheduled to run soon::" +"When a coroutine is wrapped into a *Task* with functions " +"like :func:`asyncio.create_task` the coroutine is automatically scheduled to " +"run soon::" msgstr "" ":func:`asyncio.create_task` のような関数で、コルーチンが *Task* にラップされ" "ているとき、自動的にコルーチンは即時実行されるようにスケジュールされます::" -#: ../../library/asyncio-task.rst:187 msgid "" "import asyncio\n" "\n" @@ -325,6 +394,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 +453,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,11 +463,19 @@ 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 "" -"A good example of a low-level function that returns a Future object is :meth:" -"`loop.run_in_executor`." +"A good example of a low-level function that returns a Future object " +"is :meth:`loop.run_in_executor`." msgstr "" "Future オブジェクトを返す低レベル関数の良い例は :meth:`loop.run_in_executor` " "です。" @@ -407,46 +497,56 @@ 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 "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" "省略可能なキーワード引数 *context* によって、*coro* を実行するためのカスタム" "の :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." +"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 "" -"The task is executed in the loop returned by :func:`get_running_loop`, :exc:" -"`RuntimeError` is raised if there is no running loop in current thread." +"The task is executed in the loop returned " +"by :func:`get_running_loop`, :exc:`RuntimeError` is raised if there is no " +"running loop in current thread." msgstr "" "その Task オブジェクトは :func:`get_running_loop` から返されたループの中で実" "行されます。現在のスレッドに実行中のループが無い場合は、 :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 +561,6 @@ msgstr "" "なくてもガーベジコレクションされる可能性があります。信頼性のある \"fire-and-" "forget\" バックグラウンドタスクが必要な場合、コレクションを使ってください。" -#: ../../library/asyncio-task.rst:278 msgid "" "background_tasks = set()\n" "\n" @@ -476,6 +575,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 +595,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" @@ -495,64 +606,83 @@ msgstr "タスクのキャンセル" #: ../../library/asyncio-task.rst:306 msgid "" -"Tasks can easily and safely be cancelled. When a task is cancelled, :exc:" -"`asyncio.CancelledError` will be raised in the task at the next opportunity." +"Tasks can easily and safely be cancelled. When a task is " +"cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the " +"next opportunity." 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 " -"caught, it should generally be propagated when clean-up is complete. :exc:" -"`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most " -"code will not need to be aware of it." -msgstr "" - -#: ../../library/asyncio-task.rst:316 -msgid "" -"The asyncio components that enable structured concurrency, like :class:" -"`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " -"cancellation internally and might misbehave if a coroutine swallows :exc:" -"`asyncio.CancelledError`. Similarly, user code should not generally call :" -"meth:`uncancel `. However, in cases when suppressing :" -"exc:`asyncio.CancelledError` is truly desired, it is necessary to also call " -"``uncancel()`` to completely remove the cancellation state." -msgstr "" +"caught, it should generally be propagated when clean-up is " +"complete. :exc:`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` の直接のサブクラスなの" +"で、ほとんどのコードでは特別に意識する必要はありません。" + +msgid "" +"The asyncio components that enable structured concurrency, " +"like :class:`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented " +"using cancellation internally and might misbehave if a coroutine " +"swallows :exc:`asyncio.CancelledError`. Similarly, user code should not " +"generally call :meth:`uncancel `. However, in cases " +"when suppressing :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 "" -"Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " -"already finished, or in the process of shutting down), we will close the " -"given ``coro``." +"Create a task in this task group. The signature matches that " +"of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet " +"entered, already finished, or in the process of shutting down), we will " +"close the 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,15 +690,20 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/asyncio-task.rst:360 msgid "" "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()}\")" +" 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,48 +714,62 @@ 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 " "the group are cancelled. No further tasks can then be added to the group. At " -"this point, if the body of the ``async with`` statement is still active (i." -"e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " -"containing the ``async with`` statement is also cancelled. The resulting :" -"exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not " -"bubble out of the containing ``async with`` statement." -msgstr "" +"this point, if the body of the ``async with`` statement is still active " +"(i.e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " +"containing the ``async with`` statement is also cancelled. The " +"resulting :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 " -"remaining tasks and waits for them, but then the initial :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:" -"`ExceptionGroup` or :exc:`BaseExceptionGroup`." +"Two base exceptions are treated specially: If any task fails " +"with :exc:`KeyboardInterrupt` or :exc:`SystemExit`, the task group still " +"cancels the remaining tasks and waits for them, but then the " +"initial :exc:`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 "" -"If the body of the ``async with`` statement exits with an exception (so :" -"meth:`~object.__aexit__` is called with an exception set), this is treated " -"the same as if one of the tasks failed: the remaining tasks are cancelled " -"and then waited for, and non-cancellation exceptions are grouped into an " -"exception group and raised. The exception passed into :meth:`~object." -"__aexit__`, unless it is :exc:`asyncio.CancelledError`, is also included in " -"the exception group. The same special case is made for :exc:" -"`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." +"If the body of the ``async with`` statement exits with an exception " +"(so :meth:`~object.__aexit__` is called with an exception set), this is " +"treated the same as if one of the tasks failed: the remaining tasks are " +"cancelled and then waited for, and non-cancellation exceptions are grouped " +"into an exception group and raised. The exception passed " +"into :meth:`~object.__aexit__`, unless it is :exc:`asyncio.CancelledError`, " +"is also included in the exception group. The same special case is made " +"for :exc:`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 +779,39 @@ 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." +"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`." +"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 +891,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 +929,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" @@ -835,9 +998,9 @@ msgid "" "cancelled in this case. This is to prevent the cancellation of one " "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -"*aws* シーケンスにある Task あるいは Future が *キャンセル* された場合、 :" -"exc:`CancelledError` を送出したかのうように扱われます。つまり、この場合 " -"``gather()`` 呼び出しはキャンセル *されません*。\n" +"*aws* シーケンスにある Task あるいは Future が *キャンセル* された場" +"合、 :exc:`CancelledError` を送出したかのうように扱われます。つまり、この場" +"合 ``gather()`` 呼び出しはキャンセル *されません*。\n" "これは、起動された 1 つの Task あるいは Future のキャンセルが、他の Task ある" "いは Future のキャンセルを引き起こすのを避けるためです。" @@ -851,7 +1014,6 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:566 msgid "" "import asyncio\n" "\n" @@ -889,8 +1051,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 +1094,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,38 +1109,45 @@ 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 " -"synchronously during :class:`Task` construction. Tasks are only scheduled on " -"the event loop if they block. This can be a performance improvement as the " -"overhead of loop scheduling is avoided for coroutines that complete " -"synchronously." +"When using this factory " +"(via :meth:`loop.set_task_factory(asyncio.eager_task_factory) " +"`), coroutines begin execution synchronously " +"during :class:`Task` construction. Tasks are only scheduled on the event " +"loop if they block. This can be a performance improvement as the 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 +1155,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." +"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) `)." +"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" @@ -974,8 +1198,8 @@ msgstr "キャンセルからの保護" #: ../../library/asyncio-task.rst:672 msgid "" -"Protect an :ref:`awaitable object ` from being :meth:" -"`cancelled `." +"Protect an :ref:`awaitable object ` from " +"being :meth:`cancelled `." msgstr "" ":meth:`キャンセル ` から :ref:`awaitable オブジェクト ` を保護します。" @@ -989,33 +1213,32 @@ 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 " "``something()``, the cancellation did not happen. Although its caller is " -"still cancelled, so the \"await\" expression still raises a :exc:" -"`CancelledError`." +"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 +1257,6 @@ msgstr "" "完全にキャンセルを無視したい場合 (推奨はしません) は、 ``shield()`` 関数は次" "のように try/except 節と組み合わせることになるでしょう::" -#: ../../library/asyncio-task.rst:699 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -1042,71 +1264,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`." +"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." +"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." +"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 +1360,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 +1428,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 +1465,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 "" @@ -1225,8 +1500,8 @@ msgstr "" #: ../../library/asyncio-task.rst:851 msgid "" -"To avoid the task :meth:`cancellation `, wrap it in :func:" -"`shield`." +"To avoid the task :meth:`cancellation `, wrap it " +"in :func:`shield`." msgstr "" "Task の :meth:`キャンセル ` を避けるためには、 :func:`shield` の" "中にラップしてください。" @@ -1245,7 +1520,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 +1539,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 +1595,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 +1606,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 +1635,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`." +"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,31 +1655,36 @@ 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 " -"iteration is used, the originally-supplied awaitables are yielded if they " -"are tasks or futures. This makes it easy to correlate previously-scheduled " -"tasks with their results. Example::" +"The object returned by ``as_completed()`` can be iterated as " +"an :term:`asynchronous iterator` or a plain :term:`iterator`. When " +"asynchronous iteration is used, the originally-supplied awaitables are " +"yielded if they 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 +1700,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 +1743,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 +1802,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 +1838,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 +1910,6 @@ msgstr "" "び出すためのものです。\n" "例えば次のように使います::" -#: ../../library/asyncio-task.rst:1087 msgid "" "def in_thread(loop: asyncio.AbstractEventLoop) -> None:\n" " # Run some blocking IO\n" @@ -1569,12 +1932,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 +1992,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 +2033,6 @@ msgstr "" "コルーチンから例外が送出された場合、返された Future に通知されます。\n" "これはイベントループの Task をキャンセルするのにも使えます::" -#: ../../library/asyncio-task.rst:1145 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1630,6 +2044,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 +2103,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 +2142,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 +2150,7 @@ msgstr "" "Task を作成するには高レベルの :func:`asyncio.create_task` 関数、あるいは低レ" "ベルの :meth:`loop.create_task` 関数や :func:`ensure_future` 関数を使用してく" "ださい。\n" -"手作業での Task の実装は推奨されません。" +"Task を直接インスタンス化することは推奨されません。" #: ../../library/asyncio-task.rst:1221 msgid "" @@ -1739,38 +2160,40 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" "実行中のタスクをキャンセルするためには、:meth:`cancel` メソッドを使用します。" -"このメソッドを呼ぶと、タスクはそれを内包するコルーチンに対して :exc:" -"`CancelledError` 例外を送出します。キャンセルの際にコルーチンが Future オブ" -"ジェクトを待っていた場合、その Future オブジェクトはキャンセルされます。" +"このメソッドを呼ぶと、タスクはそれを内包するコルーチンに対し" +"て :exc:`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." +"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 "" -":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" -"meth:`Future.set_result` and :meth:`Future.set_exception`." +":class:`asyncio.Task` inherits from :class:`Future` all of its APIs " +"except :meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -":class:`asyncio.Task` は、:meth:`Future.set_result` と :meth:`Future." -"set_exception` を除いて、:class:`Future` の API をすべて継承しています。" +":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." +"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 +2202,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 +2255,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." +"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 +2334,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 +2341,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 +2364,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,59 +2414,63 @@ 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." +"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 " -"CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:" -"`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will " -"be cancelled, although suppressing cancellation completely is not common and " -"is actively discouraged. Should the coroutine nevertheless decide to " -"suppress the cancellation, it needs to call :meth:`Task.uncancel` in " -"addition to catching the exception." -msgstr "" +"CancelledError`` ... :keyword:`finally` block. Therefore, " +"unlike :meth:`Future.cancel`, :meth:`Task.cancel` does not guarantee that " +"the Task will be cancelled, although suppressing cancellation completely is " +"not common and is actively discouraged. Should the coroutine nevertheless " +"decide to 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 +2506,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*." @@ -2076,38 +2546,41 @@ msgstr "Task が *キャンセルされた* 場合に ``True`` を返します #: ../../library/asyncio-task.rst:1462 msgid "" -"The Task is *cancelled* when the cancellation was requested with :meth:" -"`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " -"exception thrown into it." +"The Task is *cancelled* when the cancellation was requested " +"with :meth:`cancel` and the wrapped coroutine propagated " +"the :exc:`CancelledError` exception thrown into it." msgstr "" ":meth:`cancel` メソッドによりキャンセルがリクエストされ、かつ Task がラップし" "ているコルーチンが内部で送出された :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." +"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 " -"allows for elements of structured concurrency like :ref:`taskgroups` and :" -"func:`asyncio.timeout` to continue running, isolating cancellation to the " -"respective structured block. For example::" +"allows for elements of structured concurrency like :ref:`taskgroups` " +"and :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,43 +2593,65 @@ 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 " -"running even in case of the timeout. This is implemented with :meth:" -"`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a " -"similar fashion." -msgstr "" +"running even in case of the timeout. This is implemented " +"with :meth:`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 " +"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:" -"`CancelledError` to be thrown into the task. If it hasn't been thrown yet, " -"that arrangement will be rescinded (by resetting the internal " +"checks if a previous :meth:`cancel` call had arranged " +"for :exc:`CancelledError` to be thrown into the task. If it hasn't been " +"thrown yet, 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 +2659,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..23331d062 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 "" @@ -120,9 +126,9 @@ msgstr "" #: ../../library/asyncio.rst:48 msgid "" "create and manage :ref:`event loops `, which provide " -"asynchronous APIs for :ref:`networking `, running :ref:" -"`subprocesses `, handling :ref:`OS signals " -"`, etc;" +"asynchronous APIs for :ref:`networking `, " +"running :ref:`subprocesses `, handling :ref:`OS " +"signals `, etc;" msgstr "" ":ref:`ネットワーク通信 ` 、 :ref:`サブプロセス " "` の実行、 :ref:`OS シグナル " @@ -145,27 +151,26 @@ msgstr "" "コールバックを用いたライブラリと async/await 構文を使ったコードの :ref:`橋渡" "し `" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../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 "" +"You can experiment with an ``asyncio`` concurrent context in " +"the :term:`REPL`:" +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..229e43921 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`." +"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..c260666d6 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 @@ -72,13 +72,13 @@ msgstr "" #: ../../library/atexit.rst:32 msgid "" "Register *func* as a function to be executed at termination. Any optional " -"arguments that are to be passed to *func* must be passed as arguments to :" -"func:`register`. It is possible to register the same function and arguments " -"more than once." +"arguments that are to be passed to *func* must be passed as arguments " +"to :func:`register`. It is possible to register the same function and " +"arguments more than once." msgstr "" -"*func* を終了時に実行する関数として登録します。*func* に渡す引数は :func:" -"`register` の引数として指定しなければなりません。同じ関数を同じ引数で複数回登" -"録できます。" +"*func* を終了時に実行する関数として登録します。*func* に渡す引数" +"は :func:`register` の引数として指定しなければなりません。同じ関数を同じ引数" +"で複数回登録できます。" #: ../../library/atexit.rst:37 msgid "" @@ -134,12 +134,13 @@ msgstr "" #: ../../library/atexit.rst:64 msgid "" -"Remove *func* from the list of functions to be run at interpreter shutdown. :" -"func:`unregister` silently does nothing if *func* was not previously " -"registered. If *func* has been registered more than once, every occurrence " -"of that function in the :mod:`atexit` call stack will be removed. Equality " -"comparisons (``==``) are used internally during unregistration, so function " -"references do not need to have matching identities." +"Remove *func* from the list of functions to be run at interpreter " +"shutdown. :func:`unregister` silently does nothing if *func* was not " +"previously registered. If *func* has been registered more than once, every " +"occurrence of that function in the :mod:`atexit` call stack will be " +"removed. Equality comparisons (``==``) are used internally during " +"unregistration, so function references do not need to have matching " +"identities." msgstr "" "関数 *func* をインタプリタ終了時に実行する関数のリストから削除します。*func* " "が登録されていなければ、:func:`unregister` は何もしません。*func* が2回以上登" @@ -163,18 +164,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 +194,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 +220,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 +230,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 +250,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..c289962f3 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -12,25 +12,28 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..e1e1ffca2 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 @@ -30,9 +30,9 @@ msgstr "監査イベント表" #: ../../library/audit_events.rst:8 msgid "" -"This table contains all events raised by :func:`sys.audit` or :c:func:" -"`PySys_Audit` calls throughout the CPython runtime and the standard " -"library. These calls were added in 3.8 or later (see :pep:`578`)." +"This table contains all events raised by :func:`sys.audit` " +"or :c:func:`PySys_Audit` calls throughout the CPython runtime and the " +"standard library. These calls were added in 3.8 or later (see :pep:`578`)." msgstr "" "この表は、 CPython ランタイムと標準ライブラリ全体で :func:`sys.audit` また" "は :c:func:`PySys_Audit` の呼び出しによって送出されるすべてのイベントを含んで" @@ -43,8 +43,8 @@ msgid "" "See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for " "information on handling these events." msgstr "" -"これらのイベントの処理についての情報は :func:`sys.addaudithook` と :c:func:" -"`PySys_AddAuditHook` を参照してください。" +"これらのイベントの処理についての情報は :func:`sys.addaudithook` " +"と :c:func:`PySys_AddAuditHook` を参照してください。" #: ../../library/audit_events.rst:17 msgid "" @@ -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..57fcd0e13 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,14 +42,19 @@ 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 "" "There are two interfaces provided by this module. The modern interface " -"supports encoding :term:`bytes-like objects ` to ASCII :" -"class:`bytes`, and decoding :term:`bytes-like objects ` " -"or strings containing ASCII to :class:`bytes`. Both base-64 alphabets " -"defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are supported." +"supports encoding :term:`bytes-like objects ` to " +"ASCII :class:`bytes`, and decoding :term:`bytes-like objects ` or strings containing ASCII to :class:`bytes`. Both base-64 " +"alphabets defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are " +"supported." msgstr "" "このモジュールは、2つのインターフェースを提供します。このモダンなインター" "フェースは、:term:`bytes-like object` を ASCII :class:`bytes` にエンコード" @@ -62,10 +67,16 @@ msgid "" "The :ref:`legacy interface ` does not support decoding from " "strings, but it does provide functions for encoding and decoding to and " "from :term:`file objects `. It only supports the Base64 " -"standard alphabet, and it adds newlines every 76 characters as per :rfc:" -"`2045`. Note that if you are looking for :rfc:`2045` support you probably " -"want to be looking at the :mod:`email` package instead." +"standard alphabet, and it adds newlines every 76 characters as " +"per :rfc:`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 +98,7 @@ msgstr "" #: ../../library/base64.rst:48 msgid "RFC 4648 Encodings" -msgstr "" +msgstr "RFC 4648 エンコーディング" #: ../../library/base64.rst:50 msgid "" @@ -95,6 +106,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 "" @@ -162,13 +176,13 @@ msgid "" msgstr "" "*validate* が ``False`` (デフォルト) の場合、標準の base64 アルファベットでも" "代替文字でもない文字はパディングチェックの前に無視されます。 *validate* が " -"``True`` の場合、入力に base64 アルファベット以外の文字があると :exc:" -"`binascii.Error` を発生させます。" +"``True`` の場合、入力に base64 アルファベット以外の文字がある" +"と :exc:`binascii.Error` を発生させます。" #: ../../library/base64.rst:86 msgid "" -"For more information about the strict base64 check, see :func:`binascii." -"a2b_base64`" +"For more information about the strict base64 check, " +"see :func:`binascii.a2b_base64`" msgstr "" "厳密な base64 チェックのについての詳細は :func:`binascii.a2b_base64` を参照し" "てください" @@ -177,6 +191,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 "" @@ -210,8 +226,8 @@ msgstr "" msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the URL- and " "filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` " -"instead of ``/`` in the standard Base64 alphabet, and return the decoded :" -"class:`bytes`." +"instead of ``/`` in the standard Base64 alphabet, and return the " +"decoded :class:`bytes`." msgstr "" ":term:`bytes-like object` または ASCII 文字列 *s* を URLとファイルシステム" "セーフなアルファベットを利用してデコードし、デコードされた :class:`bytes` を" @@ -274,20 +290,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 +330,7 @@ msgstr "" #: ../../library/base64.rst:190 msgid "Base85 Encodings" -msgstr "" +msgstr "Base85 エンコーディング" #: ../../library/base64.rst:192 msgid "" @@ -344,18 +367,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 +411,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 "" @@ -423,9 +443,10 @@ msgid "" "whitespace characters, and by default contains all whitespace characters in " "ASCII." msgstr "" -"*ignorechars* には、入力に含まれていれば無視する文字で構成された :term:" -"`bytes-like object` または ASCII 文字列を指定してください。これは空白文字だけ" -"で構成されているべきです。デフォルトは ASCII における空白文字全てです。" +"*ignorechars* には、入力に含まれていれば無視する文字で構成され" +"た :term:`bytes-like object` または ASCII 文字列を指定してください。これは空" +"白文字だけで構成されているべきです。デフォルトは ASCII における空白文字全てで" +"す。" #: ../../library/base64.rst:252 msgid "" @@ -433,8 +454,8 @@ msgid "" "style binary diffs) and return the encoded :class:`bytes`." msgstr "" "base85 (これは例えば git スタイルのバイナリ diff で用いられています) を使っ" -"て :term:`bytes-like object` の *b* をエンコードし、エンコードされた :class:" -"`bytes` を返します。" +"て :term:`bytes-like object` の *b* をエンコードし、エンコードされ" +"た :class:`bytes` を返します。" #: ../../library/base64.rst:255 msgid "" @@ -457,20 +478,20 @@ msgstr "" #: ../../library/base64.rst:272 msgid "" "Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " -"return the encoded :class:`bytes`. See `Z85 specification `_ for more information." +"return the encoded :class:`bytes`. See `Z85 specification `_ for more information." msgstr "" #: ../../library/base64.rst:281 msgid "" "Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " -"return the decoded :class:`bytes`. See `Z85 specification `_ for more information." +"return the decoded :class:`bytes`. See `Z85 specification `_ for more information." msgstr "" #: ../../library/base64.rst:291 msgid "Legacy Interface" -msgstr "" +msgstr "レガシーインターフェース" #: ../../library/base64.rst:295 msgid "" @@ -496,11 +517,12 @@ msgstr "" #: ../../library/base64.rst:311 msgid "" "Encode the contents of the binary *input* file and write the resulting " -"base64 encoded data to the *output* file. *input* and *output* must be :term:" -"`file objects `. *input* will be read until ``input.read()`` " -"returns an empty bytes object. :func:`encode` inserts a newline character " -"(``b'\\n'``) after every 76 bytes of the output, as well as ensuring that " -"the output always ends with a newline, as per :rfc:`2045` (MIME)." +"base64 encoded data to the *output* file. *input* and *output* must " +"be :term:`file objects `. *input* will be read until " +"``input.read()`` returns an empty bytes object. :func:`encode` inserts a " +"newline character (``b'\\n'``) after every 76 bytes of the output, as well " +"as ensuring that the output always ends with a newline, as per :rfc:`2045` " +"(MIME)." msgstr "" "バイナリの *input* ファイルの中身を base64 形式でエンコードした結果を " "*output* ファイルに出力します。 *input* 、 *output* ともに :term:`file " @@ -529,12 +551,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..9a23953bd 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,26 +61,25 @@ 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 "" "When creating a breakpoint, its associated :attr:`file name ` should " -"be in canonical form. If a :attr:`funcname` is defined, a breakpoint :attr:" -"`hit ` will be counted when the first line of that function is " -"executed. A :attr:`conditional ` breakpoint always counts a :attr:" -"`hit `." +"be in canonical form. If a :attr:`funcname` is defined, a " +"breakpoint :attr:`hit ` will be counted when the first line of that " +"function is executed. A :attr:`conditional ` breakpoint always counts " +"a :attr:`hit `." msgstr "" "ブレークポイントを作るとき、関連付けられる :attr:`ファイル名 ` は正規化" "されていなければなりません。:attr:`funcname` が定義されると、ブレークポイント" @@ -116,67 +115,59 @@ 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 "" "Print the output of :meth:`bpformat` to the file *out*, or if it is " "``None``, to standard output." msgstr "" -"ファイル *out* に、またはそれが ``None`` の場合は標準出力に、 :meth:" -"`bpformat` の出力を表示する。" +"ファイル *out* に、またはそれが ``None`` の場合は標準出力" +"に、 :meth:`bpformat` の出力を表示する。" #: ../../library/bdb.rst:77 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`." @@ -184,17 +175,15 @@ msgstr "" #: ../../library/bdb.rst:110 msgid "" -"Dictionary of :class:`Breakpoint` instances indexed by (:attr:`file`, :attr:" -"`line`) tuples." +"Dictionary of :class:`Breakpoint` instances indexed by " +"(:attr:`file`, :attr:`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." @@ -204,12 +193,12 @@ msgstr "" #: ../../library/bdb.rst:125 msgid "" "This class takes care of the details of the trace facility; a derived class " -"should implement user interaction. The standard debugger class (:class:`pdb." -"Pdb`) is an example." +"should implement user interaction. The standard debugger class " +"(:class:`pdb.Pdb`) is an example." msgstr "" "このクラスはトレース機能の詳細を扱います。ユーザーとのインタラクションは、派" -"生クラスが実装するべきです。標準ライブラリのデバッガクラス (:class:`pdb." -"Pdb`) がその利用例です。" +"生クラスが実装するべきです。標準ライブラリのデバッガクラス " +"(:class:`pdb.Pdb`) がその利用例です。" #: ../../library/bdb.rst:129 msgid "" @@ -225,25 +214,34 @@ 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." -"settrace` which has the best backward compatibility. The ``'monitoring'`` " -"backend uses the new :mod:`sys.monitoring` that was introduced in Python " -"3.12, which can be much more efficient because it can disable unused events. " -"We are trying to keep the exact interfaces for both backends, but there are " -"some differences. The debugger developers are encouraged to use the " -"``'monitoring'`` backend to achieve better performance." -msgstr "" +"be either ``'settrace'`` or ``'monitoring'``. ``'settrace'`` " +"uses :func:`sys.settrace` which has the best backward compatibility. The " +"``'monitoring'`` backend uses the new :mod:`sys.monitoring` that was " +"introduced in Python 3.12, which can be much more efficient because it can " +"disable unused events. We are trying to keep the exact interfaces for both " +"backends, but there are 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." +"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)``" +"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 " +"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 "" @@ -345,48 +349,69 @@ msgstr "*arg* 引数は以前のイベントに依存します。" #: ../../library/bdb.rst:204 msgid "" "See the documentation for :func:`sys.settrace` for more information on the " -"trace function. For more information on code and frame objects, refer to :" -"ref:`types`." +"trace function. For more information on code and frame objects, refer " +"to :ref:`types`." msgstr "" "トレース関数についてのより詳しい情報は、 :func:`sys.settrace` のドキュメント" "を参照してください。コードとフレームオブジェクトについてのより詳しい情報" "は、 :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:" -"`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_line`). Return a reference to the :meth:" -"`trace_dispatch` method for further tracing in that scope." -msgstr "" - -#: ../../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:" -"`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_call`). Return a reference to the :meth:" -"`trace_dispatch` method for further tracing in that scope." -msgstr "" - -#: ../../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 :" -"exc:`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_return`). Return a reference to the :" -"meth:`trace_dispatch` method for further tracing in that scope." -msgstr "" - -#: ../../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 :" -"exc:`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_exception`). Return a reference to the :" -"meth:`trace_dispatch` method for further tracing in that scope." -msgstr "" +"If the debugger should stop on the current line, invoke " +"the :meth:`user_line` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (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` メソッドへの参" +"照を返します。" + +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:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (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` メソッドへの参" +"照を返します。" + +msgid "" +"If the debugger should stop on this function return, invoke " +"the :meth:`user_return` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (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` メソッドへの参" +"照を返します。" + +msgid "" +"If the debugger should stop at this exception, invokes " +"the :meth:`user_exception` method (which should be overridden in " +"subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting " +"` flag is set (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 +421,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,25 +454,27 @@ 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 "" -"Called from :meth:`dispatch_line` when either :meth:`stop_here` or :meth:" -"`break_here` returns ``True``." +"Called from :meth:`dispatch_line` when either :meth:`stop_here` " +"or :meth:`break_here` returns ``True``." msgstr "" -":meth:`stop_here` か :meth:`break_here` が ``True`` を返したときに、 :meth:" -"`dispatch_line` から呼び出されます。" +":meth:`stop_here` か :meth:`break_here` が ``True`` を返したとき" +"に、 :meth:`dispatch_line` から呼び出されます。" #: ../../library/bdb.rst:280 msgid "" @@ -508,11 +538,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 +553,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 "" @@ -558,9 +591,9 @@ msgstr "" #: ../../library/bdb.rst:353 msgid "" -"Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint." -"bpbynumber`. If *arg* is not numeric or out of range, return an error " -"message." +"Delete the breakpoint which has the index *arg* in " +"the :attr:`Breakpoint.bpbynumber`. If *arg* is not numeric or out of range, " +"return an error message." msgstr "" ":attr:`Breakpoint.bpbynumber` の中で *arg* のインデックスを持つブレークポイン" "トを削除します。 *arg* が数値でないか範囲外の場合、エラーメッセージを返しま" @@ -592,9 +625,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 +647,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 +696,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 +731,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 +747,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,43 +760,58 @@ 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." +"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 :" -"attr:`function name `, we have to check we are in " -"the right *frame* (the right function) and if we are on its first executable " -"line." +"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 :attr:`function name `, we have to " +"check we are in 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 `) (which must exist) that is :attr:`enabled `, for which :func:`checkfuncname` is true, and that has neither a " +"The *active breakpoint* is the first entry in :attr:`bplist " +"` for the (:attr:`file " +"`, :attr:`line `) (which must " +"exist) that is :attr:`enabled `, for " +"which :func:`checkfuncname` is true, and that has neither a " "false :attr:`condition ` nor positive :attr:`ignore " "` count. The *flag*, meaning that a temporary " -"breakpoint should be deleted, is ``False`` only when the :attr:`cond ` cannot be evaluated (in which case, :attr:`ignore ` count is ignored)." -msgstr "" +"breakpoint should be deleted, is ``False`` only when the :attr:`cond " +"` 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 +819,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..c0d9c4243 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 @@ -41,9 +41,9 @@ msgid "" msgstr "" ":mod:`binascii` モジュールにはバイナリと ASCII コード化されたバイナリ表現との" "間の変換を行うための多数のメソッドが含まれています。通常はこれらの関数を直接" -"使わずに :mod:`base64` といったラッパーモジュールを使います。:mod:" -"`binascii` モジュールは C で書かれた高速な低水準関数を提供していて、それらは" -"上記の高水準なモジュールで利用されます。" +"使わずに :mod:`base64` といったラッパーモジュールを使いま" +"す。:mod:`binascii` モジュールは C で書かれた高速な低水準関数を提供していて、" +"それらは上記の高水準なモジュールで利用されます。" #: ../../library/binascii.rst:22 msgid "" @@ -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 "" @@ -184,8 +186,8 @@ msgid "" msgstr "" "*value* を CRC の初期値として *data* の 16 ビット CRC 値を計算し、その結果を" "返します。\n" -"この関数は、よく 0x1021 と表現される CRC-CCITT 多項式 *x*:sup:`16` + *x*:sup:" -"`12` + *x*:sup:`5` + 1 を使います。\n" +"この関数は、よく 0x1021 と表現される CRC-CCITT 多項式 *x*:sup:`16` + " +"*x*:sup:`12` + *x*:sup:`5` + 1 を使います。\n" "この CRC は binhex4 形式で使われています。" #: ../../library/binascii.rst:110 @@ -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." @@ -250,16 +260,16 @@ msgid "" "number of hexadecimal digits (which can be upper or lower case), otherwise " "an :exc:`Error` exception is raised." msgstr "" -"16進数表記の文字列 *hexstr* の表すバイナリデータを返します。この関数は :func:" -"`b2a_hex` の逆です。 *hexstr* は 16進数字 (大文字でも小文字でも構いません) を" -"偶数個含んでいなければなりません。そうでない場合、例外 :exc:`Error` が送出さ" -"れます。" +"16進数表記の文字列 *hexstr* の表すバイナリデータを返します。この関数" +"は :func:`b2a_hex` の逆です。 *hexstr* は 16進数字 (大文字でも小文字でも構い" +"ません) を偶数個含んでいなければなりません。そうでない場合、例" +"外 :exc:`Error` が送出されます。" #: ../../library/binascii.rst:161 msgid "" "Similar functionality (accepting only text string arguments, but more " -"liberal towards whitespace) is also accessible using the :meth:`bytes." -"fromhex` class method." +"liberal towards whitespace) is also accessible using " +"the :meth:`bytes.fromhex` class method." msgstr "" #: ../../library/binascii.rst:167 diff --git a/library/binhex.po b/library/binhex.po index 31a9b6d2e..9df902df3 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 @@ -51,9 +51,9 @@ msgid "" "object supporting a :meth:`write` and :meth:`close` method)." msgstr "" "ファイル名 *input* のバイナリファイルをファイル名 *output* の binhex 形式ファ" -"イルに変換します。 *output* パラメタはファイル名でも (:meth:`write` および :" -"meth:`close` メソッドをサポートするような) ファイル様オブジェクトでもかまいま" -"せん。" +"イルに変換します。 *output* パラメタはファイル名でも (:meth:`write` およ" +"び :meth:`close` メソッドをサポートするような) ファイル様オブジェクトでもかま" +"いません。" #: ../../library/binhex.rst:28 msgid "" @@ -62,11 +62,11 @@ msgid "" "is written to a file named *output*, unless the argument is ``None`` in " "which case the output filename is read from the binhex file." msgstr "" -"binhex 形式のファイル *input* をデコードします。 *input* はファイル名でも、 :" -"meth:`read` および :meth:`close` メソッドをサポートするようなファイル様オブ" -"ジェクトでもかまいません。変換結果のファイルはファイル名 *output* になりま" -"す。この引数が ``None`` なら、出力ファイルは binhex ファイルの中から復元され" -"ます。" +"binhex 形式のファイル *input* をデコードします。 *input* はファイル名で" +"も、 :meth:`read` および :meth:`close` メソッドをサポートするようなファイル様" +"オブジェクトでもかまいません。変換結果のファイルはファイル名 *output* になり" +"ます。この引数が ``None`` なら、出力ファイルは binhex ファイルの中から復元さ" +"れます。" #: ../../library/binhex.rst:33 msgid "The following exception is also defined:" diff --git a/library/bisect.po b/library/bisect.po index 1697b6cf7..2522357bb 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,17 +39,27 @@ msgid "" "expensive comparison operations, this can be an improvement over linear " "searches or frequent resorting." msgstr "" +"このモジュールは、挿入のたびにリストをソートすることなく、ソートされた順序で" +"リストを維持するためのサポートを提供します。 コストのかかる比較演算を伴う長い" +"リストの場合、これは線形検索や頻繁な並べ替えよりも改善される可能性がありま" +"す。" #: ../../library/bisect.rst:19 msgid "" "The module is called :mod:`bisect` because it uses a basic bisection " "algorithm to do its work. Unlike other bisection tools that search for a " "specific value, the functions in this module are designed to locate an " -"insertion point. Accordingly, the functions never call an :meth:`~object." -"__eq__` method to determine whether a value has been found. Instead, the " -"functions only call the :meth:`~object.__lt__` method and will return an " -"insertion point between values in an array." +"insertion point. Accordingly, the functions never call " +"an :meth:`~object.__eq__` method to determine whether a value has been " +"found. Instead, the 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:" @@ -67,30 +77,33 @@ msgstr "" "ソートされた順序を保ったまま *x* を *a* に挿入できる点を探し当てます。リスト" "の中から検索する部分集合を指定するには、パラメータの *lo* と *hi* を使いま" "す。デフォルトでは、リスト全体が使われます。*x* がすでに *a* に含まれている場" -"合、挿入点は既存のどのエントリーよりも前(左)になります。戻り値は、``list." -"insert()`` の第一引数として使うのに適しています。*a* はすでにソートされている" -"ものとします。" +"合、挿入点は既存のどのエントリーよりも前(左)になります。戻り値は、" +"``list.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,36 +177,43 @@ 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 "" "The search functions are stateless and discard key function results after " "they are used. Consequently, if the search functions are used in a loop, " "the key function may be called again and again on the same array elements. " -"If the key function isn't fast, consider wrapping it with :py:func:" -"`functools.cache` to avoid duplicate computations. Alternatively, consider " -"searching an array of precomputed keys to locate the insertion point (as " -"shown in the examples section below)." +"If the key function isn't fast, consider wrapping it " +"with :py:func:`functools.cache` to avoid duplicate computations. " +"Alternatively, consider searching an array of precomputed keys to locate the " +"insertion point (as 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 "" @@ -196,9 +224,9 @@ msgid "" "searches." msgstr "" "bisect を利用して、直接の探索ができ、キー関数をサポートする、完全な機能を持つ" -"コレクションクラスを組み立てる `SortedCollection recipe `_\\ 。キーは、探索中に不必" -"要な呼び出しをさせないために、予め計算しておきます。" +"コレクションクラスを組み立てる `SortedCollection recipe `_\\ 。キーは、探索中に" +"不必要な呼び出しをさせないために、予め計算しておきます。" #: ../../library/bisect.rst:143 msgid "Searching Sorted Lists" @@ -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..f8e20a874 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`." +"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,14 +68,30 @@ 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 "" "As an implementation detail, most modules have the name ``__builtins__`` " "made available as part of their globals. The value of ``__builtins__`` is " -"normally either this module or the value of this module's :attr:`~object." -"__dict__` attribute. Since this is an implementation detail, it may not be " -"used by alternate implementations of Python." +"normally either this module or the value of this " +"module's :attr:`~object.__dict__` attribute. Since this is an implementation " +"detail, it may not be used by alternate implementations of Python." msgstr "" "ほとんどのモジュールではグローバル変数の一部として ``__builtins__`` が利用で" "きるようになっています。 ``__builtins__`` の内容は通常このモジュールそのもの" @@ -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..80d09f16d 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 @@ -77,8 +77,8 @@ msgid "" "Open a bzip2-compressed file in binary or text mode, returning a :term:`file " "object`." msgstr "" -"bzip2 圧縮されたファイルを、バイナリモードかテキストモードでオープンし、:" -"term:`ファイルオブジェクト ` を返します。" +"bzip2 圧縮されたファイルを、バイナリモードかテキストモードでオープン" +"し、:term:`ファイルオブジェクト ` を返します。" #: ../../library/bz2.rst:37 msgid "" @@ -103,8 +103,8 @@ msgstr "" #: ../../library/bz2.rst:45 msgid "" -"The *compresslevel* argument is an integer from 1 to 9, as for the :class:" -"`BZ2File` constructor." +"The *compresslevel* argument is an integer from 1 to 9, as for " +"the :class:`BZ2File` constructor." msgstr "" "引数 *compresslevel* には :class:`BZ2File` コンストラクタと同様に 1 から 9 の" "整数を指定します。" @@ -122,13 +122,13 @@ msgstr "" #: ../../library/bz2.rst:53 msgid "" -"For text mode, a :class:`BZ2File` object is created, and wrapped in an :" -"class:`io.TextIOWrapper` instance with the specified encoding, error " +"For text mode, a :class:`BZ2File` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" "テキストモードでは、:class:`BZ2File` オブジェクトが作成され、指定されたエン" -"コーディング、エラーハンドラの挙動、および改行文字で :class:`io." -"TextIOWrapper` にラップされます。" +"コーディング、エラーハンドラの挙動、および改行文字" +"で :class:`io.TextIOWrapper` にラップされます。" #: ../../library/bz2.rst:59 ../../library/bz2.rst:175 msgid "The ``'x'`` (exclusive creation) mode was added." @@ -182,28 +182,27 @@ 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 "" -":class:`BZ2File` provides all of the members specified by the :class:`io." -"BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io." -"IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." +":class:`BZ2File` provides all of the members specified by " +"the :class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` " +"and :meth:`~io.IOBase.truncate`. Iteration and the :keyword:`with` statement " +"are supported." msgstr "" ":class:`BZ2File` には、 :class:`io.BufferedIOBase` で規定されているメソッドや" -"属性のうち、 :meth:`~io.BufferedIOBase.detach` と :meth:`~io.IOBase." -"truncate` を除くすべてが備わっています。イテレーションと :keyword:`with` 文を" -"サポートしています。" +"属性のうち、 :meth:`~io.BufferedIOBase.detach` " +"と :meth:`~io.IOBase.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 "" @@ -217,59 +216,56 @@ msgstr "" #: ../../library/bz2.rst:102 msgid "" -"While calling :meth:`peek` does not change the file position of the :class:" -"`BZ2File`, it may change the position of the underlying file object (e.g. if " -"the :class:`BZ2File` was constructed by passing a file object for " -"*filename*)." +"While calling :meth:`peek` does not change the file position of " +"the :class:`BZ2File`, it may change the position of the underlying file " +"object (e.g. if the :class:`BZ2File` was constructed by passing a file " +"object for *filename*)." msgstr "" ":meth:`peek` の呼び出しでは :class:`BZ2File` のファイル位置は変わりませんが、" "下層のファイルオブジェクトの位置が変わる惧れがあります(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." @@ -318,8 +314,8 @@ msgid "" "writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` " "have always been." msgstr "" -"このクラスは、複数の同時読み出しや書き込みにおいては、既存の :mod:`gzip` や :" -"mod:`lzma` などの同等のクラスのように、スレッド安全ではありません。" +"このクラスは、複数の同時読み出しや書き込みにおいては、既存の :mod:`gzip` " +"や :mod:`lzma` などの同等のクラスのように、スレッド安全ではありません。" #: ../../library/bz2.rst:199 msgid "Incremental (de)compression" @@ -354,8 +350,8 @@ msgstr "" #: ../../library/bz2.rst:215 msgid "" -"When you have finished providing data to the compressor, call the :meth:" -"`flush` method to finish the compression process." +"When you have finished providing data to the compressor, call " +"the :meth:`flush` method to finish the compression process." msgstr "" "コンプレッサオブジェクトにデータをすべて渡し終えたら、:meth:`flush` メソッド" "を呼び出し、圧縮プロセスを完了させてください。" @@ -384,18 +380,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,26 +419,25 @@ 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`` になります。" #: ../../library/bz2.rst:259 msgid "" -"Attempting to decompress data after the end of stream is reached raises an :" -"exc:`EOFError`. Any data found after the end of the stream is ignored and " -"saved in the :attr:`~.unused_data` attribute." +"Attempting to decompress data after the end of stream is reached raises " +"an :exc:`EOFError`. Any data found after the end of the stream is ignored " +"and saved in the :attr:`~.unused_data` attribute." msgstr "" "ストリームの終端に到達した後にデータを展開しようとすると :exc:`EOFError` が送" "出されます。\n" -"ストリームの終端の後ろの全てのデータは無視され、その部分は :attr:" -"`unused_data` 属性に保存されます。" +"ストリームの終端の後ろの全てのデータは無視され、その部分" +"は :attr:`unused_data` 属性に保存されます。" #: ../../library/bz2.rst:263 msgid "Added the *max_length* parameter." diff --git a/library/calendar.po b/library/calendar.po index 3051381e8..cf440f183 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 @@ -73,12 +73,12 @@ msgstr "" #: ../../library/calendar.rst:33 msgid "" "Creates a :class:`Calendar` object. *firstweekday* is an integer specifying " -"the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:" -"`SUNDAY` is ``6``." +"the first day of the week. :const:`MONDAY` is ``0`` (the " +"default), :const:`SUNDAY` is ``6``." msgstr "" ":class:`Calendar` オブジェクトを作ります。 *firstweekday* は整数で週の始まり" -"の曜日を指定するものです。:const:`MONDAY` が ``0`` (デフォルト)、:const:" -"`SUNDAY` なら ``6`` です。" +"の曜日を指定するものです。:const:`MONDAY` が ``0`` (デフォル" +"ト)、:const:`SUNDAY` なら ``6`` です。" #: ../../library/calendar.rst:36 msgid "" @@ -90,42 +90,39 @@ 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." +"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 "" "Return an iterator for the week day numbers that will be used for one week. " -"The first value from the iterator will be the same as the value of the :attr:" -"`~Calendar.firstweekday` property." +"The first value from the iterator will be the same as the value of " +"the :attr:`~Calendar.firstweekday` property." msgstr "" #: ../../library/calendar.rst:72 @@ -140,45 +137,52 @@ 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``." +"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 "" -"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 day of the month number and a " -"week day number." +"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 day of the month number " +"and a 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." +"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." +"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 "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven :class:`datetime.date` objects." msgstr "" -"*year* 年 *month* 月の週のリストを返します。週は全て七つの :class:`datetime." -"date` オブジェクトからなるリストです。" +"*year* 年 *month* 月の週のリストを返します。週は全て七つ" +"の :class:`datetime.date` オブジェクトからなるリストです。" #: ../../library/calendar.rst:122 msgid "" @@ -210,8 +214,8 @@ msgstr "" #: ../../library/calendar.rst:143 msgid "" -"Return the data for the specified year ready for formatting (similar to :" -"meth:`yeardatescalendar`). Entries in the week lists are tuples of day " +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are tuples of day " "numbers and weekday numbers. Day numbers outside this month are zero." msgstr "" "指定された年のデータを整形に向く形で返します (:meth:`yeardatescalendar` と同" @@ -220,9 +224,9 @@ msgstr "" #: ../../library/calendar.rst:150 msgid "" -"Return the data for the specified year ready for formatting (similar to :" -"meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day " -"numbers outside this month are zero." +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are day numbers. " +"Day numbers outside this month are zero." msgstr "" "指定された年のデータを整形に向く形で返します (:meth:`yeardatescalendar` と同" "様です)。週のリストの中が日付の数字になります。月の範囲外の日付はゼロです。" @@ -246,8 +250,8 @@ msgstr "" msgid "" "Return a single week in a string with no newline. If *w* is provided, it " "specifies the width of the date columns, which are centered. Depends on the " -"first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method." +"first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." msgstr "" #: ../../library/calendar.rst:179 @@ -257,52 +261,56 @@ 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 "" "Return a month's calendar in a multi-line string. If *w* is provided, it " "specifies the width of the date columns, which are centered. If *l* is " "given, it specifies the number of lines that each week will use. Depends on " -"the first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method." +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." msgstr "" "ひと月分のカレンダーを複数行の文字列で返します。 *w* により日の列幅を変えるこ" "とができ、それらは中央揃えされます。 *l* により各週の表示される行数を変えるこ" "とができます。 :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 " "week, and number of spaces between month columns, respectively. Depends on " -"the first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method. The earliest year for which a calendar can be " -"generated is platform-dependent." +"the first weekday as specified in the constructor or set by " +"the :meth:`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 +356,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\"``." +"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\"``." +"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 +457,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." @@ -472,20 +501,21 @@ msgstr "" #: ../../library/calendar.rst:367 msgid "" "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " -"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:" -"`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are " -"provided for convenience. For example, to set the first weekday to Sunday::" +"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, " +"and :const:`SUNDAY` are provided for convenience. For example, to set the " +"first weekday to Sunday::" msgstr "" -"週の最初の曜日(``0`` は月曜日, ``6`` は日曜日)を設定します。定数 :const:" -"`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:" -"`FRIDAY`, :const:`SATURDAY` 及び :const:`SUNDAY` は便宜上提供されています。例" -"えば、日曜日を週の開始日に設定するときは::" +"週の最初の曜日(``0`` は月曜日, ``6`` は日曜日)を設定します。定" +"数 :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`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 +528,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 +575,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." +"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 +612,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`." +"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 +686,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 +729,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 +780,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 +826,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." +"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 +862,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..ea3d595a0 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -12,22 +12,25 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..be267ed17 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -12,22 +12,24 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..6fd4ca4e2 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -12,25 +12,28 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..898e98282 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``." +"*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`." +"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" @@ -636,10 +621,10 @@ msgid "" "in module :mod:`math`. The reason for having two modules is that some users " "aren't interested in complex numbers, and perhaps don't even know what they " "are. They would rather have ``math.sqrt(-1)`` raise an exception than " -"return a complex number. Also note that the functions defined in :mod:" -"`cmath` always return a complex number, even if the answer can be expressed " -"as a real number (in which case the complex number has an imaginary part of " -"zero)." +"return a complex number. Also note that the functions defined " +"in :mod:`cmath` always return a complex number, even if the answer can be " +"expressed as a real number (in which case the complex number has an " +"imaginary part of zero)." msgstr "" ":mod:`math` と同じような関数が選ばれていますが、全く同じではないので注意して" "ください。機能を二つのモジュールに分けているのは、複素数に興味がなかったり、" @@ -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..a1e56e97a 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 @@ -62,46 +62,52 @@ msgstr "" #: ../../library/cmd.rst:25 msgid "" "The optional argument *completekey* is the :mod:`readline` name of a " -"completion key; it defaults to :kbd:`Tab`. If *completekey* is not :const:" -"`None` and :mod:`readline` is available, command completion is done " -"automatically." +"completion key; it defaults to :kbd:`Tab`. If *completekey* is " +"not :const:`None` and :mod:`readline` is available, command completion is " +"done automatically." msgstr "" "オプション引数 *completekey* は、補完キーの :mod:`readline` 名です。デフォル" -"トは :kbd:`Tab` です。 *completekey* が :const:`None` でなく、 :mod:" -"`readline` が利用できるならば、コマンド補完は自動的に行われます。" +"トは :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:" -"`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` instead of " -"``'tab'``. Note that other values are not treated this way, and might only " -"work with a specific backend." +"The default, ``'tab'``, is treated specially, so that it refers to " +"the :kbd:`Tab` key on every :data:`readline.backend`. Specifically, " +"if :data:`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` " +"instead of ``'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 "" "The optional arguments *stdin* and *stdout* specify the input and output " "file objects that the Cmd instance or subclass instance will use for input " -"and output. If not specified, they will default to :data:`sys.stdin` and :" -"data:`sys.stdout`." +"and output. If not specified, they will default to :data:`sys.stdin` " +"and :data:`sys.stdout`." msgstr "" "オプション引数の *stdin* と *stdout* には、Cmd またはそのサブクラスのインスタ" -"ンスが入出力に使用するファイルオブジェクトを指定します。省略時には :data:" -"`sys.stdin` と :data:`sys.stdout` が使用されます。" +"ンスが入出力に使用するファイルオブジェクトを指定します。省略時に" +"は :data:`sys.stdin` と :data:`sys.stdout` が使用されます。" #: ../../library/cmd.rst:41 msgid "" -"If you want a given *stdin* to be used, make sure to set the instance's :" -"attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be " -"ignored." +"If you want a given *stdin* to be used, make sure to set the " +"instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* " +"will be ignored." 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" @@ -131,23 +137,23 @@ msgstr "" #: ../../library/cmd.rst:66 msgid "" -"If the :mod:`readline` module is loaded, input will automatically inherit :" -"program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` scrolls " -"back to the last command, :kbd:`Control-N` forward to the next one, :kbd:" -"`Control-F` moves the cursor to the right non-destructively, :kbd:`Control-" -"B` moves the cursor to the left non-destructively, etc.)." +"If the :mod:`readline` module is loaded, input will automatically " +"inherit :program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` " +"scrolls back to the last command, :kbd:`Control-N` forward to the next " +"one, :kbd:`Control-F` moves the cursor to the right non-" +"destructively, :kbd:`Control-B` moves the cursor to the left non-" +"destructively, etc.)." msgstr "" -":mod:`readline` モジュールがロードされているなら、入力は自動的に :program:" -"`bash` のような履歴リスト編集機能を受け継ぎます(例えば、 :kbd:`Control-P` は" -"直前のコマンドへのスクロールバック、 :kbd:`Control-N` は次のものへ進む、 :" -"kbd:`Control-F` はカーソルを右へ非破壊的に進める、 :kbd:`Control-B` はカーソ" -"ルを非破壊的に左へ移動させる等)。" +":mod:`readline` モジュールがロードされているなら、入力は自動的" +"に :program:`bash` のような履歴リスト編集機能を受け継ぎます(例え" +"ば、 :kbd:`Control-P` は直前のコマンドへのスクロールバック、 :kbd:`Control-" +"N` は次のものへ進む、 :kbd:`Control-F` はカーソルを右へ非破壊的に進め" +"る、 :kbd:`Control-B` はカーソルを非破壊的に左へ移動させる等)。" #: ../../library/cmd.rst:72 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 +161,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,25 +186,43 @@ 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 :" -"meth:`!help_bar`, and if that is not present, prints the docstring of :meth:" -"`!do_bar`, if available. With no argument, :meth:`!do_help` lists all " -"available help topics (that is, all commands with corresponding :meth:`!" +"method, called with an argument ``'bar'``, invokes the corresponding " +"method :meth:`!help_bar`, and if that is not present, prints the docstring " +"of :meth:`!do_bar`, if available. With no argument, :meth:`!do_help` lists " +"all available help topics (that is, all commands with corresponding :meth:`!" "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 "" "Interpret the argument as though it had been typed in response to the " -"prompt. This may be overridden, but should not normally need to be; see the :" -"meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. The " -"return value is a flag indicating whether interpretation of commands by the " -"interpreter should stop. If there is a :meth:`!do_\\*` method for the " +"prompt. This may be overridden, but should not normally need to be; see " +"the :meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. " +"The return value is a flag indicating whether interpretation of commands by " +"the interpreter should stop. If there is a :meth:`!do_\\*` method for the " "command *str*, the return value of that method is returned, otherwise the " "return value from the :meth:`default` method is returned." msgstr "" @@ -214,34 +244,39 @@ 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 "" "Hook method executed just before the command line *line* is interpreted, but " -"after the input prompt is generated and issued. This method is a stub in :" -"class:`Cmd`; it exists to be overridden by subclasses. The return value is " -"used as the command which will be executed by the :meth:`onecmd` method; " +"after the input prompt is generated and issued. This method is a stub " +"in :class:`Cmd`; it exists to be overridden by subclasses. The return value " +"is used as the command which will be executed by the :meth:`onecmd` method; " "the :meth:`precmd` implementation may re-write the command or simply return " "*line* unchanged." msgstr "" "コマンド行 *line* が解釈実行される直前、しかし入力プロンプトが作られ表示され" "た後に実行されるフックメソッド。このメソッドは :class:`Cmd` 内のスタブであっ" -"て、サブクラスでオーバーライドされるために存在します。戻り値は :meth:" -"`onecmd` メソッドが実行するコマンドとして使われます。 :meth:`precmd` の実装で" -"は、コマンドを書き換えるかもしれないし、あるいは単に変更していない *line* を" -"返すかもしれません。" +"て、サブクラスでオーバーライドされるために存在します。戻り値" +"は :meth:`onecmd` メソッドが実行するコマンドとして使われま" +"す。 :meth:`precmd` の実装では、コマンドを書き換えるかもしれないし、あるいは" +"単に変更していない *line* を返すかもしれません。" #: ../../library/cmd.rst:156 msgid "" @@ -299,21 +334,20 @@ msgstr "最後の空でないコマンド接頭辞。" #: ../../library/cmd.rst:196 msgid "" -"A list of queued input lines. The cmdqueue list is checked in :meth:" -"`cmdloop` when new input is needed; if it is nonempty, its elements will be " -"processed in order, as if entered at the prompt." +"A list of queued input lines. The cmdqueue list is checked " +"in :meth:`cmdloop` when new input is needed; if it is nonempty, its elements " +"will be processed in order, as if entered at the prompt." msgstr "" -"キューに入れられた入力行のリスト。cmdqueue リストは新たな入力が必要な際に :" -"meth:`cmdloop` 内でチェックされます; これが空でない場合、その要素は、あたかも" -"プロンプトから入力されたかのように順に処理されます。" +"キューに入れられた入力行のリスト。cmdqueue リストは新たな入力が必要な際" +"に :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." +"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,18 +355,21 @@ 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)." +"topics (that is, there are :meth:`!help_\\*` methods without " +"corresponding :meth:`!do_\\*` methods)." msgstr "" +"ヘルプ出力にその他のヘルプトピックのセクションがある場合に表示する見出しで" +"す。\n" +"これは、対応する :meth:`!do_\\*` メソッドのない :meth:`!help_\\*` メソッドが" +"ある場合です。" #: ../../library/cmd.rst:221 msgid "" "The header to issue if the help output has a section for undocumented " -"commands (that is, there are :meth:`!do_\\*` methods without corresponding :" -"meth:`!help_\\*` methods)." +"commands (that is, there are :meth:`!do_\\*` methods without " +"corresponding :meth:`!help_\\*` methods)." msgstr "" #: ../../library/cmd.rst:228 @@ -346,11 +383,12 @@ msgstr "" #: ../../library/cmd.rst:234 msgid "" "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " -"display a prompt and read the next command; if false, :data:`sys.stdout." -"write() ` and :data:`sys.stdin.readline() ` are used. " -"(This means that by importing :mod:`readline`, on systems that support it, " -"the interpreter will automatically support :program:`Emacs`\\ -like line " -"editing and command-history keystrokes.)" +"display a prompt and read the next command; if " +"false, :data:`sys.stdout.write() ` " +"and :data:`sys.stdin.readline() ` are used. (This means that by " +"importing :mod:`readline`, on systems that support it, the interpreter will " +"automatically support :program:`Emacs`\\ -like line editing and command-" +"history keystrokes.)" msgstr "" #: ../../library/cmd.rst:244 @@ -373,22 +411,29 @@ 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." +"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 " "input to lowercase and writing the commands to a file. The :meth:`!" -"do_playback` method reads the file and adds the recorded commands to the :" -"attr:`~Cmd.cmdqueue` for immediate playback::" +"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 +524,6 @@ msgstr "" "以下は、turtle シェルでの機能のヘルプ表示、空行によるコマンドの繰り返し、単純" "な記録と再実行のセッション例です:" -#: ../../library/cmd.rst:343 msgid "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" @@ -539,14 +583,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..bb3339d01 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,27 +58,30 @@ 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 "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " "familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " -"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" -"`SystemExit`, but instead return to the calling code." +"is true, ``exit()`` and ``quit()`` in the console will not " +"raise :exc:`SystemExit`, but instead return to the calling code." msgstr "" "Python の対話型インタープリターの振る舞いを忠実にエミュレートします。このクラ" -"スは :class:`InteractiveInterpreter` を継承しており、よく知られた ``sys." -"ps1`` と ``sys.ps2`` を使用してプロンプトと入力バッファリングを追加します。 " -"*local_exit* が真の場合、コンソールでの ``exit()`` と ``quit()`` は :exc:" -"`SystemExit` を送出せず、代わりに呼び出し元のコードに戻ります。" +"スは :class:`InteractiveInterpreter` を継承しており、よく知られた " +"``sys.ps1`` と ``sys.ps2`` を使用してプロンプトと入力バッファリングを追加しま" +"す。 *local_exit* が真の場合、コンソールでの ``exit()`` と ``quit()`` " +"は :exc:`SystemExit` を送出せず、代わりに呼び出し元のコードに戻ります。" #: ../../library/code.rst:40 ../../library/code.rst:58 msgid "Added *local_exit* parameter." @@ -91,21 +94,21 @@ msgid "" "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " "use as the default namespace for the interpreter loop. If *local_exit* is " -"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" -"meth:`~InteractiveConsole.interact` method of the instance is then run with " -"*banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided, it is passed to the :class:`InteractiveConsole` constructor. " +"The :meth:`~InteractiveConsole.interact` method of the instance is then run " +"with *banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" -"read-eval-print ループを実行するための便利な関数。これは :class:" -"`InteractiveConsole` の新しいインスタンスを作り、 *readfunc* が与えられた場合" -"は :meth:`InteractiveConsole.raw_input` メソッドとして使われるように設定しま" -"す。 *local* が与えられた場合は、インタープリターループのデフォルト名前空間と" -"して使うために :class:`InteractiveConsole` コンストラクタへ渡されます。 " -"*local_exit* が与えられた場合は、 :class:`InteractiveConsole` コンストラクタ" -"へ渡されます。そして、インスタンスの :meth:`~InteractiveConsole.interact` メ" -"ソッドは、もし提供されていれば、見出しと終了メッセージして使うために " -"*banner* と *exitmsg* を受け取り実行されます。コンソールオブジェクトは使われ" -"た後捨てられます。" +"read-eval-print ループを実行するための便利な関数。これ" +"は :class:`InteractiveConsole` の新しいインスタンスを作り、 *readfunc* が与え" +"られた場合は :meth:`InteractiveConsole.raw_input` メソッドとして使われるよう" +"に設定します。 *local* が与えられた場合は、インタープリターループのデフォルト" +"名前空間として使うために :class:`InteractiveConsole` コンストラクタへ渡されま" +"す。 *local_exit* が与えられた場合は、 :class:`InteractiveConsole` コンストラ" +"クタへ渡されます。そして、インスタンス" +"の :meth:`~InteractiveConsole.interact` メソッドは、もし提供されていれば、見" +"出しと終了メッセージして使うために *banner* と *exitmsg* を受け取り実行されま" +"す。コンソールオブジェクトは使われた後捨てられます。" #: ../../library/code.rst:55 msgid "Added *exitmsg* parameter." @@ -162,21 +165,21 @@ msgid "" "for :func:`compile_command`; the default for *filename* is ``''``, " "and for *symbol* is ``'single'``. One of several things can happen:" msgstr "" -"インタプリタ内のあるソースをコンパイルし実行します。引数は :func:" -"`compile_command` のものと同じです。 *filename* のデフォルトは ``''`` " -"で、 *symbol* は ``'single'`` です。あるいくつかのことが起きる可能性がありま" -"す:" +"インタプリタ内のあるソースをコンパイルし実行します。引数" +"は :func:`compile_command` のものと同じです。 *filename* のデフォルトは " +"``''`` で、 *symbol* は ``'single'`` です。あるいくつかのことが起きる" +"可能性があります:" #: ../../library/code.rst:94 msgid "" -"The input is incorrect; :func:`compile_command` raised an exception (:exc:" -"`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " -"by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns " -"``False``." +"The input is incorrect; :func:`compile_command` raised an exception " +"(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be " +"printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` " +"returns ``False``." msgstr "" -"入力が不正。 :func:`compile_command` が例外(:exc:`SyntaxError` か :exc:" -"`OverflowError`)を起こした場合。 :meth:`showsyntaxerror` メソッドの呼び出に" -"よって、構文トレースバックが表示されるでしょう。 :meth:`runsource` は " +"入力が不正。 :func:`compile_command` が例外(:exc:`SyntaxError` " +"か :exc:`OverflowError`)を起こした場合。 :meth:`showsyntaxerror` メソッドの呼" +"び出によって、構文トレースバックが表示されるでしょう。 :meth:`runsource` は " "``False`` を返します。" #: ../../library/code.rst:99 @@ -194,14 +197,14 @@ msgid "" "exceptions, except for :exc:`SystemExit`). :meth:`runsource` returns " "``False``." msgstr "" -"入力が完全。 :func:`compile_command` がコードオブジェクトを返した場合。 (:" -"exc:`SystemExit` を除く実行時例外も処理する) :meth:`runcode` を呼び出すことに" -"よって、コードは実行されます。 :meth:`runsource` は ``False`` を返します。" +"入力が完全。 :func:`compile_command` がコードオブジェクトを返した場合。 " +"(:exc:`SystemExit` を除く実行時例外も処理する) :meth:`runcode` を呼び出すこと" +"によって、コードは実行されます。 :meth:`runsource` は ``False`` を返します。" #: ../../library/code.rst:106 msgid "" -"The return value can be used to decide whether to use ``sys.ps1`` or ``sys." -"ps2`` to prompt the next line." +"The return value can be used to decide whether to use ``sys.ps1`` or " +"``sys.ps2`` to prompt the next line." msgstr "" "戻り値は、次の行のプロンプトに ``sys.ps1`` か ``sys.ps2`` のどちらを使うのか" "判断するために使えます。" @@ -209,12 +212,12 @@ msgstr "" #: ../../library/code.rst:112 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " -"called to display a traceback. All exceptions are caught except :exc:" -"`SystemExit`, which is allowed to propagate." +"called to display a traceback. All exceptions are caught " +"except :exc:`SystemExit`, which is allowed to propagate." msgstr "" "コードオブジェクトを実行します。例外が生じたときは、トレースバックを表示する" -"ために :meth:`showtraceback` が呼び出されます。伝搬することが許されている :" -"exc:`SystemExit` を除くすべての例外が捉えられます。" +"ために :meth:`showtraceback` が呼び出されます。伝搬することが許されてい" +"る :exc:`SystemExit` を除くすべての例外が捉えられます。" #: ../../library/code.rst:116 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 "" @@ -247,8 +251,8 @@ msgid "" "written by the :meth:`write` method." msgstr "" "起きたばかりの例外を表示します。スタックの最初の項目を取り除きます。なぜな" -"ら、それはインタプリタオブジェクトの実装の内部にあるからです。出力は :meth:" -"`write` メソッドによって書き込まれます。" +"ら、それはインタプリタオブジェクトの実装の内部にあるからです。出力" +"は :meth:`write` メソッドによって書き込まれます。" #: ../../library/code.rst:136 msgid "" @@ -272,9 +276,9 @@ msgstr "対話的なコンソールオブジェクト" #: ../../library/code.rst:151 msgid "" -"The :class:`InteractiveConsole` class is a subclass of :class:" -"`InteractiveInterpreter`, and so offers all the methods of the interpreter " -"objects as well as the following additions." +"The :class:`InteractiveConsole` class is a subclass " +"of :class:`InteractiveInterpreter`, and so offers all the methods of the " +"interpreter objects as well as the following additions." msgstr "" ":class:`InteractiveConsole` クラスは :class:`InteractiveInterpreter` のサブク" "ラスです。以下の追加メソッドだけでなく、インタプリタオブジェクトのすべてのメ" @@ -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." @@ -341,9 +348,9 @@ msgstr "入力バッファから処理されていないソーステキストを #: ../../library/code.rst:194 msgid "" "Write a prompt and read a line. The returned line does not include the " -"trailing newline. When the user enters the EOF key sequence, :exc:" -"`EOFError` is raised. The base implementation reads from ``sys.stdin``; a " -"subclass may replace this with a different implementation." +"trailing newline. When the user enters the EOF key " +"sequence, :exc:`EOFError` is raised. The base implementation reads from " +"``sys.stdin``; a subclass may replace this with a different implementation." msgstr "" "プロンプトを書き込み、一行を読み込みます。返る行は末尾に改行を含みません。" "ユーザがEOFキーシーケンスを入力したときは、 :exc:`EOFError` を発生させます。" diff --git a/library/codecs.po b/library/codecs.po index 969b37acc..b3b9f719d 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 @@ -75,9 +75,9 @@ msgstr "*encoding* に記載された codec を使用して *obj* をエンコ #: ../../library/codecs.rst:40 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that encoding errors raise :exc:" -"`ValueError` (or a more codec specific subclass, such as :exc:" -"`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that encoding errors " +"raise :exc:`ValueError` (or a more codec specific subclass, such " +"as :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" "希望のエラー処理スキームを *errors* に設定することができます。デフォルトのエ" @@ -93,16 +93,16 @@ msgstr "*encoding* に記載された codec を使用して *obj* をデコー #: ../../library/codecs.rst:50 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that decoding errors raise :exc:" -"`ValueError` (or a more codec specific subclass, such as :exc:" -"`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that decoding errors " +"raise :exc:`ValueError` (or a more codec specific subclass, such " +"as :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" "希望のエラー処理スキームを *errors* に設定することができます。デフォルトのエ" "ラーハンドラは ``'strict'`` です。これはデコードエラーは :exc:`ValueError` " "(もしくは :exc:`UnicodeDecodeError` のような、より codec に固有のサブクラス) " -"を送出することを意味します。codec エラー処理についてのより詳しい情報は :ref:" -"`codec-base-classes` を参照してください。" +"を送出することを意味します。codec エラー処理についてのより詳しい情報" +"は :ref:`codec-base-classes` を参照してください。" #: ../../library/codecs.rst:56 msgid "The full details for each codec can also be looked up directly:" @@ -110,18 +110,19 @@ msgstr "各 codec についての詳細も、次のようにして直接調べ #: ../../library/codecs.rst:60 msgid "" -"Looks up the codec info in the Python codec registry and returns a :class:" -"`CodecInfo` object as defined below." +"Looks up the codec info in the Python codec registry and returns " +"a :class:`CodecInfo` object as defined below." msgstr "" -"Python codec レジストリから codec 情報を探し、以下で定義するような :class:" -"`CodecInfo` オブジェクトを返します。" +"Python codec レジストリから codec 情報を探し、以下で定義するよう" +"な :class:`CodecInfo` オブジェクトを返します。" #: ../../library/codecs.rst:63 msgid "" "Encodings are first looked up in the registry's cache. If not found, the " "list of registered search functions is scanned. If no :class:`CodecInfo` " -"object is found, a :exc:`LookupError` is raised. Otherwise, the :class:" -"`CodecInfo` object is stored in the cache and returned to the caller." +"object is found, a :exc:`LookupError` is raised. Otherwise, " +"the :class:`CodecInfo` object is stored in the cache and returned to the " +"caller." msgstr "" "エンコーディングの検索は、まずレジストリのキャッシュから行います。見つからな" "ければ、登録されている検索関数のリストから探します。 :class:`CodecInfo` オブ" @@ -144,10 +145,10 @@ msgstr "エンコーディングの名前です。" #: ../../library/codecs.rst:82 msgid "" "The stateless encoding and decoding functions. These must be functions or " -"methods which have the same interface as the :meth:`~Codec.encode` and :meth:" -"`~Codec.decode` methods of Codec instances (see :ref:`Codec Interface `). The functions or methods are expected to work in a stateless " -"mode." +"methods which have the same interface as the :meth:`~Codec.encode` " +"and :meth:`~Codec.decode` methods of Codec instances (see :ref:`Codec " +"Interface `). The functions or methods are expected to work " +"in a stateless mode." msgstr "" "ステートレスなエンコーディングとデコーディングの関数です。これらは、Codec イ" "ンスタンスの :meth:`~Codec.encode` メソッドと :meth:`~Codec.decode` メソッド" @@ -158,21 +159,21 @@ msgstr "" #: ../../library/codecs.rst:92 msgid "" "Incremental encoder and decoder classes or factory functions. These have to " -"provide the interface defined by the base classes :class:" -"`IncrementalEncoder` and :class:`IncrementalDecoder`, respectively. " -"Incremental codecs can maintain state." +"provide the interface defined by the base " +"classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`, " +"respectively. Incremental codecs can maintain state." msgstr "" "インクリメンタル・エンコーダとデコーダのクラスまたはファクトリ関数です。これ" -"らは、基底クラスの :class:`IncrementalEncoder` と :class:" -"`IncrementalDecoder` が定義するインターフェースをそれぞれ提供する必要がありま" -"す。インクリメンタルな codec は、ステート (内部状態) を保持することができま" -"す。" +"らは、基底クラスの :class:`IncrementalEncoder` " +"と :class:`IncrementalDecoder` が定義するインターフェースをそれぞれ提供する必" +"要があります。インクリメンタルな codec は、ステート (内部状態) を保持すること" +"ができます。" #: ../../library/codecs.rst:101 msgid "" "Stream writer and reader classes or factory functions. These have to provide " -"the interface defined by the base classes :class:`StreamWriter` and :class:" -"`StreamReader`, respectively. Stream codecs can maintain state." +"the interface defined by the base classes :class:`StreamWriter` " +"and :class:`StreamReader`, respectively. Stream codecs can maintain state." msgstr "" "ストリームライターとリーダーのクラスまたはファクトリ関数です。これらは、基底" "クラスの :class:`StreamWriter` と :class:`StreamReader` が定義するインター" @@ -239,16 +240,16 @@ msgstr "" #: ../../library/codecs.rst:143 msgid "" -"Look up the codec for the given encoding and return its :class:" -"`StreamReader` class or factory function." +"Look up the codec for the given encoding and return " +"its :class:`StreamReader` class or factory function." msgstr "" "与えられたエンコーディングに対する codec を検索し、:class:`StreamReader` クラ" "スまたはファクトリ関数を返します。" #: ../../library/codecs.rst:151 msgid "" -"Look up the codec for the given encoding and return its :class:" -"`StreamWriter` class or factory function." +"Look up the codec for the given encoding and return " +"its :class:`StreamWriter` class or factory function." msgstr "" "与えられたエンコーディングに対する codec を検索し、:class:`StreamWriter` クラ" "スまたはファクトリ関数を返します。" @@ -274,11 +275,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 "" @@ -294,9 +296,9 @@ msgstr "" #: ../../library/codecs.rst:186 msgid "" -"Open an encoded file using the given *mode* and return an instance of :class:" -"`StreamReaderWriter`, providing transparent encoding/decoding. The default " -"file mode is ``'r'``, meaning to open the file in read mode." +"Open an encoded file using the given *mode* and return an instance " +"of :class:`StreamReaderWriter`, providing transparent encoding/decoding. The " +"default file mode is ``'r'``, meaning to open the file in read mode." msgstr "" "エンコードされたファイルを *mode* を使って開き、透過的なエンコード/デコードを" "提供する :class:`StreamReaderWriter` のインスタンスを返します。デフォルトの" @@ -335,19 +337,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 "" @@ -355,9 +357,9 @@ msgid "" "provides transparent transcoding. The original file is closed when the " "wrapped version is closed." msgstr "" -"透過的なエンコード変換を行うファイルのラップされたバージョンである、:class:" -"`StreamRecoder` インスタンスを返します。元のファイルは、ラップされたバージョ" -"ンが閉じられる時に、閉じられます。" +"透過的なエンコード変換を行うファイルのラップされたバージョンであ" +"る、:class:`StreamRecoder` インスタンスを返します。元のファイルは、ラップされ" +"たバージョンが閉じられる時に、閉じられます。" #: ../../library/codecs.rst:222 msgid "" @@ -421,17 +423,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`." +"``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 "" @@ -446,21 +448,21 @@ msgid "" "These constants define various byte sequences, being Unicode byte order " "marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " "streams to indicate the byte order used, and in UTF-8 as a Unicode " -"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` or :const:" -"`BOM_UTF16_LE` depending on the platform's native byte order, :const:`BOM` " -"is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` for :const:" -"`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The others " -"represent the BOM in UTF-8 and UTF-32 encodings." +"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` " +"or :const:`BOM_UTF16_LE` depending on the platform's native byte " +"order, :const:`BOM` is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` " +"for :const:`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The " +"others represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" "これらの定数は、いくつかのエンコーディングの Unicode のバイトオーダマーク " "(BOM) で、様々なバイトシーケンスを定義します。これらは、UTF-16 と UTF-32 の" "データストリームで使用するバイトオーダを指定したり、 UTF-8 で Unicode シグネ" "チャとして使われます。 :const:`BOM_UTF16` は、プラットフォームのネイティブバ" "イトオーダによって :const:`BOM_UTF16_BE` または :const:`BOM_UTF16_LE` で" -"す。 :const:`BOM` は :const:`BOM_UTF16` のエイリアスです。同様に、 :const:" -"`BOM_LE` は :const:`BOM_UTF16_LE` の、 :const:`BOM_BE` は :const:" -"`BOM_UTF16_BE` のエイリアスです。その他の定数は UTF-8 と UTF-32 エンコーディ" -"ングの BOM を表します。" +"す。 :const:`BOM` は :const:`BOM_UTF16` のエイリアスです。同様" +"に、 :const:`BOM_LE` は :const:`BOM_UTF16_LE` の、 :const:`BOM_BE` " +"は :const:`BOM_UTF16_BE` のエイリアスです。その他の定数は UTF-8 と UTF-32 エ" +"ンコーディングの BOM を表します。" #: ../../library/codecs.rst:289 msgid "Codec Base Classes" @@ -502,11 +504,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 @@ -540,31 +543,39 @@ msgid "" "Ignore the malformed data and continue without further notice. Implemented " "in :func:`ignore_errors`." msgstr "" -"不正な形式のデータを無視し、何も通知することなく処理を継続します。:func:" -"`ignore_errors` で実装されています。" +"不正な形式のデータを無視し、何も通知することなく処理を継続しま" +"す。:func:`ignore_errors` で実装されています。" #: ../../library/codecs.rst:344 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`." +"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'``" @@ -579,36 +590,41 @@ msgid "" msgstr "" "デコード時には、バイト列を ``U+DC80`` から ``U+DCFF`` の範囲の個々のサロゲー" "トコードで置き換えます。データのエンコード時に ``'surrogateescape'`` エラーハ" -"ンドラが使用されると、このコードは同じバイト列に戻されます。 (詳しくは :pep:" -"`383` を参照。)" +"ンドラが使用されると、このコードは同じバイト列に戻されます。 (詳しく" +"は :pep:`383` を参照。)" -#: ../../library/codecs.rst:373 msgid "" -"The following error handlers are only applicable to encoding (within :term:" -"`text encodings `):" +"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`." +"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`." +"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 +643,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 "" @@ -674,17 +694,18 @@ msgstr "" #: ../../library/codecs.rst:429 msgid "" -"For encoding, *error_handler* will be called with a :exc:" -"`UnicodeEncodeError` instance, which contains information about the location " -"of the error. The error handler must either raise this or a different " -"exception, or return a tuple with a replacement for the unencodable part of " -"the input and a position where encoding should continue. The replacement may " -"be either :class:`str` or :class:`bytes`. If the replacement is bytes, the " -"encoder will simply copy them into the output buffer. If the replacement is " -"a string, the encoder will encode the replacement. Encoding continues on " -"original input at the specified position. Negative position values will be " -"treated as being relative to the end of the input string. If the resulting " -"position is out of bound an :exc:`IndexError` will be raised." +"For encoding, *error_handler* will be called with " +"a :exc:`UnicodeEncodeError` instance, which contains information about the " +"location of the error. The error handler must either raise this or a " +"different exception, or return a tuple with a replacement for the " +"unencodable part of the input and a position where encoding should continue. " +"The replacement may be either :class:`str` or :class:`bytes`. If the " +"replacement is bytes, the encoder will simply copy them into the output " +"buffer. If the replacement is a string, the encoder will encode the " +"replacement. Encoding continues on original input at the specified position. " +"Negative position values will be treated as being relative to the end of the " +"input string. If the resulting position is out of bound an :exc:`IndexError` " +"will be raised." msgstr "" "*error_handler* はエラーの場所に関する情報の入った :exc:`UnicodeEncodeError` " "インスタンスとともに呼び出されます。エラー処理関数はこの例外を送出するか、別" @@ -694,18 +715,18 @@ msgstr "" "ある場合、エンコーダは単に出力バッファにそれをコピーします。代替文字列が文字" "列である場合、エンコーダは代替文字列をエンコードします。元の入力中の指定位置" "からエンコードが再開されます。位置を負の値にすると、入力文字列の末端からの相" -"対位置として扱われます。境界の外側にある位置を返した場合には :exc:" -"`IndexError` が送出されます。" +"対位置として扱われます。境界の外側にある位置を返した場合に" +"は :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 +750,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)." +"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)." +"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" @@ -834,13 +863,13 @@ msgstr "" #: ../../library/codecs.rst:539 msgid "" -"The method may not store state in the :class:`Codec` instance. Use :class:" -"`StreamWriter` for codecs which have to keep state in order to make encoding " -"efficient." +"The method may not store state in the :class:`Codec` instance. " +"Use :class:`StreamWriter` for codecs which have to keep state in order to " +"make encoding efficient." msgstr "" "このメソッドは :class:`Codec` に内部状態を保存してはなりません。効率よくエン" -"コードするために状態を保持しなければならないような codecs には :class:" -"`StreamWriter` を使ってください。" +"コードするために状態を保持しなければならないような codecs に" +"は :class:`StreamWriter` を使ってください。" #: ../../library/codecs.rst:543 msgid "" @@ -875,9 +904,9 @@ msgstr "" #: ../../library/codecs.rst:561 msgid "" -"The method may not store state in the :class:`Codec` instance. Use :class:" -"`StreamReader` for codecs which have to keep state in order to make decoding " -"efficient." +"The method may not store state in the :class:`Codec` instance. " +"Use :class:`StreamReader` for codecs which have to keep state in order to " +"make decoding efficient." msgstr "" "このメソッドは、 :class:`Codec` インスタンスに内部状態を保存してはなりませ" "ん。効率よくエンコード/デコードするために状態を保持しなければならないような " @@ -900,26 +929,26 @@ msgid "" "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " "provide the basic interface for incremental encoding and decoding. Encoding/" "decoding the input isn't done with one call to the stateless encoder/decoder " -"function, but with multiple calls to the :meth:`~IncrementalEncoder.encode`/:" -"meth:`~IncrementalDecoder.decode` method of the incremental encoder/decoder. " -"The incremental encoder/decoder keeps track of the encoding/decoding process " -"during method calls." +"function, but with multiple calls to " +"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " +"method of the incremental encoder/decoder. The incremental encoder/decoder " +"keeps track of the encoding/decoding process during method calls." msgstr "" ":class:`IncrementalEncoder` クラスおよび :class:`IncrementalDecoder` クラスは" "それぞれインクリメンタル・エンコードおよびデコードのための基本的なインター" "フェースを提供します。エンコード/デコードは内部状態を持たないエンコーダ/デ" "コーダを一度呼び出すことで行なわれるのではなく、インクリメンタル・エンコーダ" -"/デコーダの :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder." -"decode` メソッドを複数回呼び出すことで行なわれます。インクリメンタル・エン" -"コーダ/デコーダはメソッド呼び出しの間エンコード/デコード処理の進行を管理し" -"ます。" +"/デコーダ" +"の :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` メ" +"ソッドを複数回呼び出すことで行なわれます。インクリメンタル・エンコーダ/デ" +"コーダはメソッド呼び出しの間エンコード/デコード処理の進行を管理します。" #: ../../library/codecs.rst:580 msgid "" -"The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:" -"`~IncrementalDecoder.decode` method is the same as if all the single inputs " -"were joined into one, and this input was encoded/decoded with the stateless " -"encoder/decoder." +"The joined output of calls to " +"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " +"method is the same as if all the single inputs were joined into one, and " +"this input was encoded/decoded with the stateless encoder/decoder." msgstr "" ":meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` メソッ" "ド呼び出しの出力結果をまとめたものは、入力をひとまとめにして内部状態を持たな" @@ -961,25 +990,25 @@ msgid "" "handlers` for possible values." msgstr "" ":class:`IncrementalEncoder` は、 *errors* キーワード引数を提供することで、" -"様々なエラー取扱方法を実装することができます。取り得る値については :ref:" -"`error-handlers` を参照してください。" +"様々なエラー取扱方法を実装することができます。取り得る値について" +"は :ref:`error-handlers` を参照してください。" #: ../../library/codecs.rst:608 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of the :class:" -"`IncrementalEncoder` object." +"error handling strategies during the lifetime of " +"the :class:`IncrementalEncoder` object." msgstr "" -"*errors* 引数は、同名の属性に代入されます。この属性を変更すると、 :class:" -"`IncrementalEncoder` オブジェクトが生きている間に、異なるエラー処理方法に切り" -"替えることができるようになります。" +"*errors* 引数は、同名の属性に代入されます。この属性を変更する" +"と、 :class:`IncrementalEncoder` オブジェクトが生きている間に、異なるエラー処" +"理方法に切り替えることができるようになります。" #: ../../library/codecs.rst:616 msgid "" "Encodes *object* (taking the current state of the encoder into account) and " -"returns the resulting encoded object. If this is the last call to :meth:" -"`encode` *final* must be true (the default is false)." +"returns the resulting encoded object. If this is the last call " +"to :meth:`encode` *final* must be true (the default is false)." msgstr "" "*object* を(エンコーダの現在の状態を考慮に入れて)エンコードし、得られたエン" "コードされたオブジェクトを返します。 :meth:`encode` 呼び出しがこれで最後とい" @@ -987,8 +1016,8 @@ msgstr "" #: ../../library/codecs.rst:623 msgid "" -"Reset the encoder to the initial state. The output is discarded: call ``." -"encode(object, final=True)``, passing an empty byte or text string if " +"Reset the encoder to the initial state. The output is discarded: call " +"``.encode(object, final=True)``, passing an empty byte or text string if " "necessary, to reset the encoder and to get the output." msgstr "" "エンコーダを初期状態にリセットします。出力は破棄されます。``.encode(object, " @@ -1052,29 +1081,29 @@ msgid "" "handlers` for possible values." msgstr "" ":class:`IncrementalDecoder` は、 *errors* キーワード引数を提供することで、" -"様々なエラー取扱方法を実装することができます。取り得る値については :ref:" -"`error-handlers` を参照してください。" +"様々なエラー取扱方法を実装することができます。取り得る値について" +"は :ref:`error-handlers` を参照してください。" #: ../../library/codecs.rst:665 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of the :class:" -"`IncrementalDecoder` object." +"error handling strategies during the lifetime of " +"the :class:`IncrementalDecoder` object." msgstr "" -"*errors* 引数は、同名の属性に代入されます。この属性を変更すると、 :class:" -"`IncrementalDecoder` オブジェクトが生きている間に、異なるエラー処理方法に切り" -"替えることができるようになります。" +"*errors* 引数は、同名の属性に代入されます。この属性を変更する" +"と、 :class:`IncrementalDecoder` オブジェクトが生きている間に、異なるエラー処" +"理方法に切り替えることができるようになります。" #: ../../library/codecs.rst:673 msgid "" "Decodes *object* (taking the current state of the decoder into account) and " -"returns the resulting decoded object. If this is the last call to :meth:" -"`decode` *final* must be true (the default is false). If *final* is true the " -"decoder must decode the input completely and must flush all buffers. If this " -"isn't possible (e.g. because of incomplete byte sequences at the end of the " -"input) it must initiate error handling just like in the stateless case " -"(which might raise an exception)." +"returns the resulting decoded object. If this is the last call " +"to :meth:`decode` *final* must be true (the default is false). If *final* is " +"true the decoder must decode the input completely and must flush all " +"buffers. If this isn't possible (e.g. because of incomplete byte sequences " +"at the end of the input) it must initiate error handling just like in the " +"stateless case (which might raise an exception)." msgstr "" "*object* を(デコーダの現在の状態を考慮に入れて)デコードし、得られたデコードさ" "れたオブジェクトを返します。 :meth:`decode` 呼び出しがこれで最後という時には " @@ -1125,12 +1154,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" @@ -1185,19 +1217,23 @@ msgid "" "error handling strategies during the lifetime of the :class:`StreamWriter` " "object." msgstr "" -"*errors* 引数は、同名の属性に代入されます。この属性を変更すると、 :class:" -"`StreamWriter` オブジェクトが生きている間に、異なるエラー処理に変更できます。" +"*errors* 引数は、同名の属性に代入されます。この属性を変更する" +"と、 :class:`StreamWriter` オブジェクトが生きている間に、異なるエラー処理に変" +"更できます。" #: ../../library/codecs.rst:748 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." @@ -1274,13 +1310,14 @@ msgid "" "error handling strategies during the lifetime of the :class:`StreamReader` " "object." msgstr "" -"*errors* 引数は、同名の属性に代入されます。この属性を変更すると、 :class:" -"`StreamReader` オブジェクトが生きている間に、異なるエラー処理に変更できます。" +"*errors* 引数は、同名の属性に代入されます。この属性を変更する" +"と、 :class:`StreamReader` オブジェクトが生きている間に、異なるエラー処理に変" +"更できます。" #: ../../library/codecs.rst:801 msgid "" -"The set of allowed values for the *errors* argument can be extended with :" -"func:`register_error`." +"The set of allowed values for the *errors* argument can be extended " +"with :func:`register_error`." msgstr "" "*errors* 引数に許される値の集合は :func:`register_error` で拡張できます。" @@ -1289,18 +1326,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 +1343,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 "" @@ -1366,8 +1403,8 @@ msgstr "" #: ../../library/codecs.rst:850 msgid "" -"*sizehint*, if given, is passed as the *size* argument to the stream's :meth:" -"`read` method." +"*sizehint*, if given, is passed as the *size* argument to the " +"stream's :meth:`read` method." msgstr "" "*sizehint* が与えられた場合、ストリームの :meth:`read` メソッドに *size* 引数" "として渡されます。" @@ -1402,8 +1439,8 @@ msgstr "" #: ../../library/codecs.rst:873 ../../library/codecs.rst:897 msgid "" -"The design is such that one can use the factory functions returned by the :" -"func:`lookup` function to construct the instance." +"The design is such that one can use the factory functions returned by " +"the :func:`lookup` function to construct the instance." msgstr "" ":func:`lookup` 関数が返すファクトリ関数を使って、インスタンスを生成するという" "設計です。" @@ -1417,20 +1454,20 @@ msgid "" "writers." msgstr "" ":class:`StreamReaderWriter` インスタンスを生成します。 *stream* はファイル類" -"似のオブジェクトです。 *Reader* と *Writer* は、それぞれ :class:" -"`StreamReader` と :class:`StreamWriter` インターフェースを提供するファクトリ" -"関数かファクトリクラスでなければなりません。エラー処理は、ストリームリーダと" -"ライタで定義したものと同じように行われます。" +"似のオブジェクトです。 *Reader* と *Writer* は、それぞ" +"れ :class:`StreamReader` と :class:`StreamWriter` インターフェースを提供する" +"ファクトリ関数かファクトリクラスでなければなりません。エラー処理は、ストリー" +"ムリーダとライタで定義したものと同じように行われます。" #: ../../library/codecs.rst:884 msgid "" -":class:`StreamReaderWriter` instances define the combined interfaces of :" -"class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +":class:`StreamReaderWriter` instances define the combined interfaces " +"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " "other methods and attributes from the underlying stream." msgstr "" -":class:`StreamReaderWriter` インスタンスは、 :class:`StreamReader` クラスと :" -"class:`StreamWriter` クラスを合わせたインターフェースを継承します。元になるス" -"トリームからは、他のメソッドや属性を継承します。" +":class:`StreamReaderWriter` インスタンスは、 :class:`StreamReader` クラス" +"と :class:`StreamWriter` クラスを合わせたインターフェースを継承します。元にな" +"るストリームからは、他のメソッドや属性を継承します。" #: ../../library/codecs.rst:892 msgid "StreamRecoder Objects" @@ -1444,13 +1481,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 "" @@ -1472,9 +1513,9 @@ msgid "" "interface respectively." msgstr "" "*encode* 引数と *decode* 引数は :class:`Codec` のインターフェースに忠実でなく" -"てはなりません。*Reader* と *Writer* は、それぞれ :class:`StreamReader` と :" -"class:`StreamWriter` のインターフェースを提供するオブジェクトのファクトリ関数" -"かクラスでなくてはなりません。" +"てはなりません。*Reader* と *Writer* は、それぞれ :class:`StreamReader` " +"と :class:`StreamWriter` のインターフェースを提供するオブジェクトのファクトリ" +"関数かクラスでなくてはなりません。" #: ../../library/codecs.rst:919 msgid "" @@ -1486,13 +1527,13 @@ msgstr "" #: ../../library/codecs.rst:923 msgid "" -":class:`StreamRecoder` instances define the combined interfaces of :class:" -"`StreamReader` and :class:`StreamWriter` classes. They inherit all other " -"methods and attributes from the underlying stream." +":class:`StreamRecoder` instances define the combined interfaces " +"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +"other methods and attributes from the underlying stream." msgstr "" -":class:`StreamRecoder` インスタンスは、 :class:`StreamReader` と :class:" -"`StreamWriter` クラスを合わせたインターフェースを定義します。また、元のスト" -"リームのメソッドと属性も継承します。" +":class:`StreamRecoder` インスタンスは、 :class:`StreamReader` " +"と :class:`StreamWriter` クラスを合わせたインターフェースを定義します。また、" +"元のストリームのメソッドと属性も継承します。" #: ../../library/codecs.rst:931 msgid "Encodings and Unicode" @@ -1519,10 +1560,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 +1575,13 @@ msgstr "" "最も単純なテキストエンコーディング (``'latin-1'`` または ``'iso-8859-1'``) で" "は、0--255 の範囲にあるコードポイントを ``0x0``--``0xff`` のバイトにマップし" "ます。\n" -"つまり、この codec では ``U+00FF`` 以上のコードポイントを含む文字列オブジェク" -"トをエンコードすることはできません。\n" -"このようなエンコード処理をしようとすると、次のように :exc:" -"`UnicodeEncodeError` が送出されます (エラーメッセージの細かところは異なる場合" -"があります。): ``UnicodeEncodeError: 'latin-1' codec can't encode character " -"'\\u1234' in position 3: ordinal not in range(256)`` 。" +"つまり、この codec では ``U+00FF`` より大きいのコードポイントを含む文字列オブ" +"ジェクトをエンコードすることはできません。\n" +"このようなエンコード処理をしようとすると、次のよう" +"に :exc:`UnicodeEncodeError` が送出されます (エラーメッセージの細かいところは" +"異なる場合があります。\n" +"): ``UnicodeEncodeError: 'latin-1' codec can't encode character '\\u1234' in " +"position 3: ordinal not in range(256)`` 。" #: ../../library/codecs.rst:951 msgid "" @@ -1554,8 +1595,9 @@ msgstr "" "他のエンコーディングの一群 (charmap エンコーディングと呼ばれます) があり、 " "Unicode コードポイントの別の部分集合と、それらから ``0x0``--``0xff`` のバイト" "への対応付けを選択したものです。\n" -"これがどのように行なわれるかを知るには、単にたとえば :file:`encodings/cp1252." -"py` (主に Windows で使われるエンコーディングです) を開いてみてください。\n" +"これがどのように行なわれるかを知るには、単にたとえば :file:`encodings/" +"cp1252.py` (主に Windows で使われるエンコーディングです) を開いてみてくださ" +"い。\n" "256 文字のひとつの文字列定数があり、どの文字がどのバイト値へ対応付けられるか" "が示されています。" @@ -1725,7 +1767,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 +1777,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 +1818,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 +1832,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 +2002,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 +2034,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 +2123,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 +2162,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 +2199,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 +2302,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 +2465,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 +2596,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 +2611,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 +2642,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 +2761,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 +2778,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" @@ -2783,13 +2813,13 @@ msgstr "テキストエンコーディング" #: ../../library/codecs.rst:1335 msgid "" -"The following codecs provide :class:`str` to :class:`bytes` encoding and :" -"term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " -"text encodings." +"The following codecs provide :class:`str` to :class:`bytes` encoding " +"and :term:`bytes-like object` to :class:`str` decoding, similar to the " +"Unicode text encodings." msgstr "" -"次の codec では、 Unicode におけるテキストエンコーディングと同様に、 :class:" -"`str` から :class:`bytes` へのエンコードと、 :term:`bytes-like object` から :" -"class:`str` へのデコードを提供します。" +"次の codec では、 Unicode におけるテキストエンコーディングと同様" +"に、 :class:`str` から :class:`bytes` へのエンコードと、 :term:`bytes-like " +"object` から :class:`str` へのデコードを提供します。" #: ../../library/codecs.rst:1344 msgid "idna" @@ -2849,12 +2879,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 +2916,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" @@ -3038,13 +3070,13 @@ msgstr "テキスト変換 (Text Transforms)" #: ../../library/codecs.rst:1458 msgid "" -"The following codec provides a text transform: a :class:`str` to :class:" -"`str` mapping. It is not supported by :meth:`str.encode` (which only " -"produces :class:`bytes` output)." +"The following codec provides a text transform: a :class:`str` " +"to :class:`str` mapping. It is not supported by :meth:`str.encode` (which " +"only produces :class:`bytes` output)." msgstr "" "以下の codec は、:class:`str` から :class:`str` マッピングへのテキスト変換を" -"提供します。:meth:`str.encode` はこの変換をサポートしておらず、 :class:" -"`bytes` を出力するだけです。" +"提供します。:meth:`str.encode` はこの変換をサポートしておら" +"ず、 :class:`bytes` を出力するだけです。" #: ../../library/codecs.rst:1467 msgid "rot_13" @@ -3086,38 +3118,39 @@ msgstr "" "このモジュールでは :rfc:`3490` (アプリケーションにおける国際化ドメイン名、 " "IDNA: Internationalized Domain Names in Applications) および :rfc:`3492` " "(Nameprep: 国際化ドメイン名 (IDN) のための stringprep プロファイル) を実装し" -"ています。このモジュールは ``punycode`` エンコーディングおよび :mod:" -"`stringprep` の上に構築されています。" +"ています。このモジュールは ``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 "" "These RFCs together define a protocol to support non-ASCII characters in " -"domain names. A domain name containing non-ASCII characters (such as ``www." -"Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding (ACE, " -"such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the domain " -"name is then used in all places where arbitrary characters are not allowed " -"by the protocol, such as DNS queries, HTTP :mailheader:`Host` fields, and so " -"on. This conversion is carried out in the application; if possible invisible " -"to the user: The application should transparently convert Unicode domain " -"labels to IDNA on the wire, and convert back ACE labels to Unicode before " -"presenting them to the user." +"domain names. A domain name containing non-ASCII characters (such as " +"``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding " +"(ACE, such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the " +"domain name is then used in all places where arbitrary characters are not " +"allowed by the protocol, such as DNS queries, HTTP :mailheader:`Host` " +"fields, and so on. This conversion is carried out in the application; if " +"possible invisible to the user: The application should transparently convert " +"Unicode domain labels to IDNA on the wire, and convert back ACE labels to " +"Unicode before presenting them to the user." msgstr "" "これらの RFC はともに、非 ASCII 文字の入ったドメイン名をサポートするためのプ" "ロトコルを定義しています。 (``www.Alliancefrançaise.nu`` のような) 非 ASCII " -"文字を含むドメイン名は、 ASCII と互換性のあるエンコーディング (ACE、 ``www." -"xn--alliancefranaise-npb.nu`` のような形式) に変換されます。ドメイン名の ACE " -"形式は、 DNS クエリ、 HTTP :mailheader:`Host` フィールドなどといった、プロト" -"コル中で任意の文字を使えないような全ての局面で用いられます。この変換はアプリ" -"ケーション内で行われます; 可能ならユーザからは不可視となります: アプリケー" -"ションは Unicode ドメインラベルをネットワークに載せる際に IDNA に、 ACE ドメ" -"インラベルをユーザに提供する前に Unicode に、それぞれ透過的に変換しなければな" -"りません。" +"文字を含むドメイン名は、 ASCII と互換性のあるエンコーディング (ACE、 " +"``www.xn--alliancefranaise-npb.nu`` のような形式) に変換されます。ドメイン名" +"の ACE 形式は、 DNS クエリ、 HTTP :mailheader:`Host` フィールドなどといった、" +"プロトコル中で任意の文字を使えないような全ての局面で用いられます。この変換は" +"アプリケーション内で行われます; 可能ならユーザからは不可視となります: アプリ" +"ケーションは Unicode ドメインラベルをネットワークに載せる際に IDNA に、 ACE " +"ドメインラベルをユーザに提供する前に Unicode に、それぞれ透過的に変換しなけれ" +"ばなりません。" #: ../../library/codecs.rst:1505 msgid "" @@ -3130,8 +3163,8 @@ msgid "" "the :mod:`socket` module transparently converts Unicode host names to ACE, " "so that applications need not be concerned about converting host names " "themselves when they pass them to the socket module. On top of that, modules " -"that have host names as function parameters, such as :mod:`http.client` and :" -"mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " +"that have host names as function parameters, such as :mod:`http.client` " +"and :mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " "transparently sends an IDNA hostname in the :mailheader:`Host` field if it " "sends that field at all)." msgstr "" @@ -3139,13 +3172,13 @@ msgstr "" "Unicode と ACE 間の変換を行い、入力文字列を :rfc:`RFC 3490 の section 3.1 " "<3490#section-3.1>` で定義されている区切り文字に基づいてラベルに分解し、各ラ" "ベルを要求通りに ACE に変換します。逆に、入力のバイト文字列を ``.`` 区切り文" -"字でラベルに分解し、 ACE ラベルを Unicode に変換します。さらに、 :mod:" -"`socket` モジュールは Unicode ホスト名を ACE に透過的に変換するため、アプリ" -"ケーションはホスト名を :mod:`socket` モジュールに渡す際にホスト名の変換に煩わ" -"されることがありません。その上で、ホスト名を関数パラメタとして持つ、 :mod:" -"`http.client` や :mod:`ftplib` のようなモジュールでは Unicode ホスト名を受理" -"します (:mod:`http.client` でもまた、 :mailheader:`Host` フィールドにある " -"IDNA ホスト名を、フィールド全体を送信する場合に透過的に送信します)。" +"字でラベルに分解し、 ACE ラベルを Unicode に変換します。さら" +"に、 :mod:`socket` モジュールは Unicode ホスト名を ACE に透過的に変換するた" +"め、アプリケーションはホスト名を ``socket`` モジュールに渡す際にホスト名の変" +"換に煩わされることがありません。その上で、ホスト名を関数パラメタとして持" +"つ、 :mod:`http.client` や :mod:`ftplib` のようなモジュールでは Unicode ホス" +"ト名を受理します (:mod:`http.client` でもまた、 :mailheader:`Host` フィールド" +"にある IDNA ホスト名を、フィールド全体を送信する場合に透過的に送信します)。" #: ../../library/codecs.rst:1518 msgid "" @@ -3193,21 +3226,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 +3281,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 +3326,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..f8631baeb 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 "" @@ -93,25 +92,25 @@ msgstr "" #: ../../library/codeop.rst:41 msgid "" -"If there is a problem with *source*, an exception will be raised. :exc:" -"`SyntaxError` is raised if there is invalid Python syntax, and :exc:" -"`OverflowError` or :exc:`ValueError` if there is an invalid literal." +"If there is a problem with *source*, an exception will be " +"raised. :exc:`SyntaxError` is raised if there is invalid Python syntax, " +"and :exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal." msgstr "" "*source* に問題がある場合は、例外を発生させます。無効なPython構文がある場合" -"は、 :exc:`SyntaxError` を発生させます。また、無効なリテラルがある場合は、 :" -"exc:`OverflowError` または :exc:`ValueError` を発生させます。" +"は、 :exc:`SyntaxError` を発生させます。また、無効なリテラルがある場合" +"は、 :exc:`OverflowError` または :exc:`ValueError` を発生させます。" #: ../../library/codeop.rst:45 msgid "" "The *symbol* argument determines whether *source* is compiled as a statement " "(``'single'``, the default), as a sequence of :term:`statement` (``'exec'``) " -"or as an :term:`expression` (``'eval'``). Any other value will cause :exc:" -"`ValueError` to be raised." +"or as an :term:`expression` (``'eval'``). Any other value will " +"cause :exc:`ValueError` to be raised." msgstr "" "*symbol* 引数は *source* が文としてコンパイルされるか(``'single'`` 、デフォル" -"ト) 、:term:`文 ` のシーケンスとしてか (``'exec'``) 、または :" -"term:`式 ` としてコンパイルされるかを決定します(``'eval'``)。他の" -"どんな値も :exc:`ValueError` を送出させます。" +"ト) 、:term:`文 ` のシーケンスとしてか (``'exec'``) 、また" +"は :term:`式 ` としてコンパイルされるかを決定します(``'eval'``)。" +"他のどんな値も :exc:`ValueError` を送出させます。" #: ../../library/codeop.rst:52 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..e65780fe3 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 @@ -42,8 +42,8 @@ msgstr "**ソースコード:** :source:`Lib/_collections_abc.py`" msgid "" "This module provides :term:`abstract base classes ` " "that can be used to test whether a class provides a particular interface; " -"for example, whether it is :term:`hashable` or whether it is a :term:" -"`mapping`." +"for example, whether it is :term:`hashable` or whether it is " +"a :term:`mapping`." msgstr "" "このモジュールは、 :term:`抽象基底クラス ` を提供しま" "す。抽象基底クラスは、クラスが特定のインターフェースを提供しているか、例え" @@ -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 "" @@ -142,21 +151,23 @@ msgstr "" msgid "" "In this example, class :class:`!D` does not need to define ``__contains__``, " "``__iter__``, and ``__reversed__`` because the :ref:`in-operator " -"`, the :term:`iteration ` logic, and the :func:" -"`reversed` function automatically fall back to using ``__getitem__`` and " -"``__len__``." +"`, the :term:`iteration ` logic, and " +"the :func:`reversed` function automatically fall back to using " +"``__getitem__`` and ``__len__``." msgstr "" "この例では、クラス :class:`!D` は ``__contains__``, ``__iter__``, " "``__reversed__`` を定義する必要がありません。なぜなら :ref:`in 演算子 " -"`, the :term:`反復 ` ロジック, および :func:" -"`reversed` 関数は自動的に ``__getitem__`` と ``__len__`` を使うようにフォール" -"バックするからです。" +"`, the :term:`反復 ` ロジック, およ" +"び :func:`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`" @@ -543,8 +555,8 @@ msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object is :term:" -"`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" "``isinstance(obj, Iterable)`` によるチェックは :class:`Iterable` として登録さ" "れたクラスや :meth:`~container.__iter__` メソッドを持つクラスを検出します" @@ -589,8 +601,8 @@ msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object is :term:" -"`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" "``isinstance(obj, Iterable)`` によるチェックは :class:`Iterable` として登録さ" "れたクラスや :meth:`~container.__iter__` メソッドを持つクラスを検出します" @@ -604,8 +616,9 @@ msgstr "サイズ付きのイテラブルなコンテナクラスの ABC です #: ../../library/collections.abc.rst:238 msgid "" -"ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" -"`~iterator.__next__` methods. See also the definition of :term:`iterator`." +"ABC for classes that provide the :meth:`~iterator.__iter__` " +"and :meth:`~iterator.__next__` methods. See also the definition " +"of :term:`iterator`." msgstr "" ":meth:`~iterator.__iter__` メソッドと :meth:`~iterator.__next__` メソッドを提" "供するクラスの ABC です。 :term:`iterator` の定義も参照してください。" @@ -619,20 +632,20 @@ msgstr "" #: ../../library/collections.abc.rst:251 msgid "" -"ABC for :term:`generator` classes that implement the protocol defined in :" -"pep:`342` that extends :term:`iterators ` with the :meth:" -"`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " -"methods." +"ABC for :term:`generator` classes that implement the protocol defined " +"in :pep:`342` that extends :term:`iterators ` with " +"the :meth:`~generator.send`, :meth:`~generator.throw` " +"and :meth:`~generator.close` methods." msgstr "" -":pep:`342` で定義された、:term:`イテレータ ` を :meth:`~generator." -"send`, :meth:`~generator.throw`, :meth:`~generator.close` の各メソッドに拡張" -"するプロトコルを実装する、:term:`ジェネレータ ` クラスの ABC で" -"す。" +":pep:`342` で定義された、:term:`イテレータ ` " +"を :meth:`~generator.send`, :meth:`~generator.throw`, :meth:`~generator.close` " +"の各メソッドに拡張するプロトコルを実装する、:term:`ジェネレータ ` " +"クラスの ABC です。" #: ../../library/collections.abc.rst:256 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!Generator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Generator` in type annotations." msgstr "" ":class:`!Generator` を型アノテーションで使う方法の詳細は、 :ref:`annotating-" "generators-and-coroutines` を参照してください。" @@ -640,40 +653,42 @@ 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 "" -"Implementation note: Some of the mixin methods, such as :meth:`~container." -"__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make repeated " -"calls to the underlying :meth:`~object.__getitem__` method. Consequently, " +"Implementation note: Some of the mixin methods, such " +"as :meth:`~container.__iter__`, :meth:`~object.__reversed__` " +"and :meth:`index`, make repeated calls to the " +"underlying :meth:`~object.__getitem__` method. Consequently, " "if :meth:`~object.__getitem__` is implemented with constant access speed, " "the mixin methods will have linear performance; however, if the underlying " "method is linear (as it would be with a linked list), the mixins will have " "quadratic performance and will likely need to be overridden." msgstr "" -"実装における注意: :meth:`~container.__iter__`, :meth:`~object." -"__reversed__`, :meth:`index` など、一部の mixin メソッドは、下層の :meth:" -"`~object.__getitem__` メソッドを繰り返し呼び出します。その結果、:meth:" -"`~object.__getitem__` が定数のアクセス速度で実装されている場合、mixin メソッ" -"ドは線形のパフォーマンスとなります。下層のメソッドが線形 (リンクされたリスト" -"の場合など) の場合、mixin は 2 乗のパフォーマンスとなるため、多くの場合上書き" -"する必要があるでしょう。" +"実装における注" +"意: :meth:`~container.__iter__`, :meth:`~object.__reversed__`, :meth:`index` " +"など、一部の mixin メソッドは、下層の :meth:`~object.__getitem__` メソッドを" +"繰り返し呼び出します。その結果、:meth:`~object.__getitem__` が定数のアクセス" +"速度で実装されている場合、mixin メソッドは線形のパフォーマンスとなります。下" +"層のメソッドが線形 (リンクされたリストの場合など) の場合、mixin は 2 乗のパ" +"フォーマンスとなるため、多くの場合上書きする必要があるでしょう。" #: ../../library/collections.abc.rst:275 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 "" @@ -684,74 +699,74 @@ msgstr "" #: ../../library/collections.abc.rst:298 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " -"expressions. Custom implementations must provide the :meth:`~object." -"__await__` method." +"expressions. Custom implementations must provide " +"the :meth:`~object.__await__` method." 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." +":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 "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Awaitable)`` for them will return ``False``. " +"Use :func:`inspect.isawaitable` to detect them." msgstr "" -"CPython では、ジェネレータベースのコルーチン (:func:`@types.coroutine ` で修飾された :term:`ジェネレータ `) は、 :meth:" -"`~object.__await__` メソッドを持たないにもかかわらず*待機可能* " +"CPython では、ジェネレータベースのコルーチン (:func:`@types.coroutine " +"` で修飾された :term:`ジェネレータ `) " +"は、 :meth:`~object.__await__` メソッドを持たないにもかかわらず*待機可能* " "(*awaitables*) です。 ``isinstance(gencoro, Awaitable)`` はそのようなコルーチ" -"ンに対して ``False`` を返します。そのようなコルーチンを検出するためには :" -"func:`inspect.isawaitable` を使ってください。" +"ンに対して ``False`` を返します。そのようなコルーチンを検出するために" +"は :func:`inspect.isawaitable` を使ってください。" #: ../../library/collections.abc.rst:316 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " -"methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" -"`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations " -"must also implement :meth:`~object.__await__`. All :class:`Coroutine` " -"instances are also instances of :class:`Awaitable`." -msgstr "" -":term:`コルーチン ` と互換性のあるクラスの ABC です。これらは、:" -"ref:`coroutine-objects` で定義された :meth:`~coroutine.send`, :meth:" -"`~coroutine.throw`, :meth:`~coroutine.close` のメソッドを実装します。カスタム" -"の実装は、:meth:`~object.__await__` も実装しなければなりません。:class:" -"`Coroutine` のすべてのインスタンスは、 :class:`Awaitable` のインスタンスでも" -"あります。" +"methods, defined in :ref:`coroutine-" +"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " +"and :meth:`~coroutine.close`. Custom implementations must also " +"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " +"also instances of :class:`Awaitable`." +msgstr "" +":term:`コルーチン ` と互換性のあるクラスの ABC です。これら" +"は、:ref:`coroutine-objects` で定義され" +"た :meth:`~coroutine.send`, :meth:`~coroutine.throw`, :meth:`~coroutine.close` " +"のメソッドを実装します。カスタムの実装は、:meth:`~object.__await__` も実装し" +"なければなりません。:class:`Coroutine` のすべてのインスタンス" +"は、 :class:`Awaitable` のインスタンスでもあります。" #: ../../library/collections.abc.rst:324 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Coroutine)`` for them will return ``False``. " +"Use :func:`inspect.isawaitable` to detect them." msgstr "" -"CPython では、ジェネレータベースのコルーチン (:func:`@types.coroutine ` で修飾された :term:`ジェネレータ `) は、 :meth:" -"`~object.__await__` メソッドを持たないにもかかわらず*待機可能* " +"CPython では、ジェネレータベースのコルーチン (:func:`@types.coroutine " +"` で修飾された :term:`ジェネレータ `) " +"は、 :meth:`~object.__await__` メソッドを持たないにもかかわらず*待機可能* " "(*awaitables*) です。 ``isinstance(gencoro, Coroutine)`` はそのようなコルーチ" -"ンに対して ``False`` を返します。そのようなコルーチンを検出するためには :" -"func:`inspect.isawaitable` を使ってください。" +"ンに対して ``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`." +"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 "" @@ -766,8 +781,8 @@ msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -"``__aiter__`` および ``__anext__`` メソッドを提供するクラスの ABC です。:" -"term:`asynchronous iterator` の定義も参照してください。" +"``__aiter__`` および ``__anext__`` メソッドを提供するクラスの ABC で" +"す。:term:`asynchronous iterator` の定義も参照してください。" #: ../../library/collections.abc.rst:353 msgid "" @@ -779,11 +794,11 @@ msgstr "" #: ../../library/collections.abc.rst:356 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!AsyncGenerator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!AsyncGenerator` in type annotations." msgstr "" -":class:`!AsyncGenerator` を型アノテーションで使う方法の詳細は、 :ref:" -"`annotating-generators-and-coroutines` を参照してください。" +":class:`!AsyncGenerator` を型アノテーションで使う方法の詳細" +"は、 :ref:`annotating-generators-and-coroutines` を参照してください。" #: ../../library/collections.abc.rst:363 msgid "" @@ -820,15 +835,17 @@ msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " "the full :class:`Set` API, it is only necessary to supply the three " -"underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container." -"__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " -"methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +"underlying abstract " +"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " +"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " +"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" "幾つかの ABC はコンテナ型 API を提供するクラスを開発するのを助ける mixin 型と" "しても使えます。例えば、 :class:`Set` API を提供するクラスを作る場合、3つの基" -"本になる抽象メソッド :meth:`~object.__contains__`, :meth:`~container." -"__iter__`, :meth:`~object.__len__` だけが必要です。ABC が残りの :meth:`!" -"__and__` や :meth:`~frozenset.isdisjoint` といったメソッドを提供します::" +"本になる抽象メソッ" +"ド :meth:`~object.__contains__`, :meth:`~container.__iter__`, :meth:`~object.__len__` " +"だけが必要です。ABC が残りの :meth:`!__and__` " +"や :meth:`~frozenset.isdisjoint` といったメソッドを提供します::" #: ../../library/collections.abc.rst:385 msgid "" @@ -888,19 +905,19 @@ msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " "is assumed to have a signature in the form ``ClassName(iterable)``. That " -"assumption is factored-out to an internal :class:`classmethod` called :meth:" -"`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If " -"the :class:`Set` mixin is being used in a class with a different constructor " -"signature, you will need to override :meth:`!_from_iterable` with a " -"classmethod or regular method that can construct new instances from an " -"iterable argument." -msgstr "" -"幾つかの set の操作は新しい set を作るので、デフォルトの mixin メソッドは :" -"term:`イテラブル ` から新しいインスタンスを作成する方法を必要としま" -"す。クラスのコンストラクタは ``ClassName(iterable)`` の形のシグネチャを持つと" -"仮定されます。内部の :meth:`!_from_iterable` という :class:`classmethod` が " -"``cls(iterable)`` を呼び出して新しい set を作る部分でこの仮定が使われていま" -"す。コンストラクタのシグネチャが異なるクラスで :class:`Set` を使う場合は、 " +"assumption is factored-out to an internal :class:`classmethod` " +"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " +"new set. If the :class:`Set` mixin is being used in a class with a different " +"constructor signature, you will need to override :meth:`!_from_iterable` " +"with a classmethod or regular method that can construct new instances from " +"an iterable argument." +msgstr "" +"幾つかの set の操作は新しい set を作るので、デフォルトの mixin メソッド" +"は :term:`イテラブル ` から新しいインスタンスを作成する方法を必要と" +"します。クラスのコンストラクタは ``ClassName(iterable)`` の形のシグネチャを持" +"つと仮定されます。内部の :meth:`!_from_iterable` という :class:`classmethod` " +"が ``cls(iterable)`` を呼び出して新しい set を作る部分でこの仮定が使われてい" +"ます。コンストラクタのシグネチャが異なるクラスで :class:`Set` を使う場合は、 " "iterable 引数から新しいインスタンスを生成できるクラスメソッドあるいは仕様に" "沿ったメソッドで :meth:`!_from_iterable` をオーバーライドする必要があります。" @@ -910,9 +927,9 @@ msgid "" "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -"(たぶん意味はそのままに速度を向上する目的で)比較をオーバーライドする場合、 :" -"meth:`~object.__le__` と :meth:`~object.__ge__` だけを再定義すれば、その他の" -"演算は自動的に追随します。" +"(たぶん意味はそのままに速度を向上する目的で)比較をオーバーライドする場" +"合、 :meth:`~object.__le__` と :meth:`~object.__ge__` だけを再定義すれば、そ" +"の他の演算は自動的に追随します。" #: ../../library/collections.abc.rst:427 msgid "" @@ -933,8 +950,8 @@ msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -":class:`MutableSet` を使った例として `OrderedSet recipe `_。" +":class:`MutableSet` を使った例として `OrderedSet recipe `_。" #: ../../library/collections.abc.rst:438 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." diff --git a/library/collections.po b/library/collections.po index 1d304e881..0722a3b22 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 @@ -39,12 +39,12 @@ msgstr "**ソースコード:** :source:`Lib/collections/__init__.py`" #: ../../library/collections.rst:20 msgid "" "This module implements specialized container datatypes providing " -"alternatives to Python's general purpose built-in containers, :class:" -"`dict`, :class:`list`, :class:`set`, and :class:`tuple`." +"alternatives to Python's general purpose built-in " +"containers, :class:`dict`, :class:`list`, :class:`set`, and :class:`tuple`." msgstr "" -"このモジュールは、汎用の Python 組み込みコンテナ :class:`dict`, :class:" -"`list`, :class:`set`, および :class:`tuple` に代わる、特殊なコンテナデータ型" -"を実装しています。" +"このモジュールは、汎用の Python 組み込みコンテ" +"ナ :class:`dict`, :class:`list`, :class:`set`, および :class:`tuple` に代わ" +"る、特殊なコンテナデータ型を実装しています。" #: ../../library/collections.rst:25 msgid ":func:`namedtuple`" @@ -131,8 +131,8 @@ msgid "" "calls." msgstr "" ":class:`ChainMap` クラスは、複数のマッピングを素早く連結し、一つの単位として" -"扱うために提供されています。これはたいてい、新しい辞書を作成して :meth:" -"`~dict.update` を繰り返すよりも早いです。" +"扱うために提供されています。これはたいてい、新しい辞書を作成し" +"て :meth:`~dict.update` を繰り返すよりも早いです。" #: ../../library/collections.rst:46 msgid "" @@ -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 "" @@ -231,17 +232,18 @@ msgstr "キーワード引数のサポートが追加されました。" msgid "" "Property returning a new :class:`ChainMap` containing all of the maps in the " "current instance except the first one. This is useful for skipping the " -"first map in the search. Use cases are similar to those for the :keyword:" -"`nonlocal` keyword used in :term:`nested scopes `. The use " -"cases also parallel those for the built-in :func:`super` function. A " -"reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``." -msgstr "" -"現在のインスタンスの最初のマッピング以外のすべてのマッピングを含む新しい :" -"class:`ChainMap` を返すプロパティです。これは最初のマッピングを検索から飛ばす" -"のに便利です。使用例は :keyword:`nonlocal` キーワードを :term:`ネストされたス" -"コープ ` に使う例と似ています。この使用例はまた、組み込み :" -"func:`super` 関数にも似ています。 ``d.parents`` への参照は ``ChainMap(*d." -"maps[1:])`` と等価です。" +"first map in the search. Use cases are similar to those for " +"the :keyword:`nonlocal` keyword used in :term:`nested scopes `. The use cases also parallel those for the built-in :func:`super` " +"function. A reference to ``d.parents`` is equivalent to: " +"``ChainMap(*d.maps[1:])``." +msgstr "" +"現在のインスタンスの最初のマッピング以外のすべてのマッピングを含む新し" +"い :class:`ChainMap` を返すプロパティです。これは最初のマッピングを検索から飛" +"ばすのに便利です。使用例は :keyword:`nonlocal` キーワードを :term:`ネストされ" +"たスコープ ` に使う例と似ています。この使用例はまた、組み込" +"み :func:`super` 関数にも似ています。 ``d.parents`` への参照は " +"``ChainMap(*d.maps[1:])`` と等価です。" #: ../../library/collections.rst:102 msgid "" @@ -258,6 +260,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 +280,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`." @@ -297,15 +307,15 @@ msgstr "" msgid "" "Django's `Context class `_ for templating is a read-only chain of mappings. It " -"also features pushing and popping of contexts similar to the :meth:" -"`~collections.ChainMap.new_child` method and the :attr:`~collections." -"ChainMap.parents` property." +"also features pushing and popping of contexts similar to " +"the :meth:`~collections.ChainMap.new_child` method and " +"the :attr:`~collections.ChainMap.parents` property." msgstr "" "Django のテンプレート用の `Context class `_ は、読み出し専用のマッピングのチェー" -"ンです。 :meth:`~collections.ChainMap.new_child` メソッドや :attr:" -"`~collections.ChainMap.parents` プロパティに似た push や pop の機能もありま" -"す。" +"ンです。 :meth:`~collections.ChainMap.new_child` メソッド" +"や :attr:`~collections.ChainMap.parents` プロパティに似た push や pop の機能" +"もあります。" #: ../../library/collections.rst:136 msgid "" @@ -321,11 +331,11 @@ msgstr "" #: ../../library/collections.rst:141 msgid "" -"A `greatly simplified read-only version of Chainmap `_." +"A `greatly simplified read-only version of Chainmap `_." msgstr "" -"`非常に単純化した読み出し専用バージョンの Chainmap `_。" +"`非常に単純化した読み出し専用バージョンの Chainmap `_。" #: ../../library/collections.rst:146 msgid ":class:`ChainMap` Examples and Recipes" @@ -344,6 +354,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 +365,6 @@ msgid "" msgstr "" "ユーザ指定のコマンドライン引数、環境変数、デフォルト値、の順に優先させる例::" -#: ../../library/collections.rst:159 msgid "" "import os, argparse\n" "\n" @@ -370,6 +381,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 +436,6 @@ msgstr "" "除を望むなら、チェーンの深いところで見つかったキーを更新するサブクラスを簡単" "に作れます::" -#: ../../library/collections.rst:197 msgid "" "class DeepChainMap(ChainMap):\n" " 'Variant of ChainMap that allows direct updates to inner scopes'\n" @@ -438,6 +462,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 +498,6 @@ msgid "" msgstr "" "便利で迅速な検数をサポートするカウンタツールが提供されています。例えば::" -#: ../../library/collections.rst:228 msgid "" ">>> # Tally occurrences of words in a list\n" ">>> cnt = Counter()\n" @@ -467,6 +514,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 "" @@ -534,19 +595,20 @@ msgid "" "is less than one, :meth:`elements` will ignore it." msgstr "" "それぞれの要素を、そのカウント分の回数だけ繰り返すイテレータを返します。要素" -"は挿入した順番で返されます。ある要素のカウントが 1 未満なら、 :meth:" -"`elements` はそれを無視します。" +"は挿入した順番で返されます。ある要素のカウントが 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 "" @@ -554,9 +616,9 @@ msgid "" "counter). Like :meth:`dict.update` but subtracts counts instead of " "replacing them. Both inputs and outputs may be zero or negative." msgstr "" -"要素から *iterable* の要素または *mapping* の要素が引かれます。 :meth:`dict." -"update` に似ていますが、カウントを置き換えるのではなく引きます。入力も出力" -"も、 0 や負になりえます。" +"要素から *iterable* の要素または *mapping* の要素が引かれま" +"す。 :meth:`dict.update` に似ていますが、カウントを置き換えるのではなく引きま" +"す。入力も出力も、 0 や負になりえます。" #: ../../library/collections.rst:319 msgid "Compute the sum of the counts." @@ -617,7 +679,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 +690,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 "" @@ -714,14 +784,15 @@ msgstr "" msgid "" "For in-place operations such as ``c[key] += 1``, the value type need only " "support addition and subtraction. So fractions, floats, and decimals would " -"work and negative values are supported. The same is also true for :meth:" -"`~Counter.update` and :meth:`~Counter.subtract` which allow negative and " -"zero values for both inputs and outputs." +"work and negative values are supported. The same is also true " +"for :meth:`~Counter.update` and :meth:`~Counter.subtract` which allow " +"negative and zero values for both inputs and outputs." msgstr "" "``c[key] += 1`` のようなインプレース演算では、値の型に必要なのは 足し算と引き" "算ができることだけです。よって分数、浮動小数点数、 小数も使え、負の値がサポー" -"トされています。これと同じことが、 負や 0 の値を入力と出力に許す :meth:" -"`~Counter.update` と :meth:`~Counter.subtract` メソッド にも言えます。" +"トされています。これと同じことが、 負や 0 の値を入力と出力に許" +"す :meth:`~Counter.update` と :meth:`~Counter.subtract` メソッド にも言えま" +"す。" #: ../../library/collections.rst:422 msgid "" @@ -744,8 +815,8 @@ msgstr "" #: ../../library/collections.rst:432 msgid "" -"`Bag class `_ in Smalltalk." +"`Bag class `_ in Smalltalk." msgstr "" "Smalltalk の `Bag class `_ 。" @@ -783,10 +854,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" @@ -798,9 +869,9 @@ msgid "" "with data from *iterable*. If *iterable* is not specified, the new deque is " "empty." msgstr "" -"*iterable* で与えられるデータから、新しい deque オブジェクトを (:meth:" -"`append` をつかって) 左から右に初期化して返します。 *iterable* が指定されない" -"場合、新しい deque オブジェクトは空になります。" +"*iterable* で与えられるデータから、新しい deque オブジェクトを " +"(:meth:`append` をつかって) 左から右に初期化して返します。 *iterable* が指定" +"されない場合、新しい deque オブジェクトは空になります。" #: ../../library/collections.rst:458 msgid "" @@ -893,8 +964,8 @@ msgid "" "if not found." msgstr "" "deque 内の *x* の位置を返します (インデックス *start* からインデックス " -"*stop* の両端を含む範囲で)。最初のマッチを返すか、見つからない場合には :exc:" -"`ValueError` を発生させます。" +"*stop* の両端を含む範囲で)。最初のマッチを返すか、見つからない場合に" +"は :exc:`ValueError` を発生させます。" #: ../../library/collections.rst:533 msgid "Insert *x* into the deque at position *i*." @@ -902,11 +973,11 @@ msgstr "*x* を deque の位置 *i* に挿入します。" #: ../../library/collections.rst:535 msgid "" -"If the insertion would cause a bounded deque to grow beyond *maxlen*, an :" -"exc:`IndexError` is raised." +"If the insertion would cause a bounded deque to grow beyond *maxlen*, " +"an :exc:`IndexError` is raised." msgstr "" -"挿入によって、長さに制限のある deque の長さが *maxlen* を超える場合、:exc:" -"`IndexError` が発生します。" +"挿入によって、長さに制限のある deque の長さが *maxlen* を超える場" +"合、:exc:`IndexError` が発生します。" #: ../../library/collections.rst:543 msgid "" @@ -926,11 +997,11 @@ msgstr "" #: ../../library/collections.rst:555 msgid "" -"Remove the first occurrence of *value*. If not found, raises a :exc:" -"`ValueError`." +"Remove the first occurrence of *value*. If not found, raises " +"a :exc:`ValueError`." msgstr "" -"*value* の最初に現れるものを削除します。要素が見付からないない場合は :exc:" -"`ValueError` を送出します。" +"*value* の最初に現れるものを削除します。要素が見付からないない場合" +"は :exc:`ValueError` を送出します。" #: ../../library/collections.rst:561 msgid "Reverse the elements of the deque in-place and then return ``None``." @@ -950,9 +1021,9 @@ msgid "" "``d.appendleft(d.pop())``, and rotating one step to the left is equivalent " "to ``d.append(d.popleft())``." msgstr "" -"deque が空でないときは、 deque をひとつ右にローテートすることは ``d." -"appendleft(d.pop())`` と同じで、 deque をひとつ左にローテートすることは ``d." -"append(d.popleft())`` と同じです。" +"deque が空でないときは、 deque をひとつ右にローテートすることは " +"``d.appendleft(d.pop())`` と同じで、 deque をひとつ左にローテートすることは " +"``d.append(d.popleft())`` と同じです。" #: ../../library/collections.rst:576 msgid "Deque objects also provide one read-only attribute:" @@ -989,7 +1060,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 +1114,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 +1181,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 +1200,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,15 +1213,26 @@ 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 "" "A `round-robin scheduler `_ can be implemented with input iterators stored in a :" -"class:`deque`. Values are yielded from the active iterator in position " -"zero. If that iterator is exhausted, it can be removed with :meth:`~deque." -"popleft`; otherwise, it can be cycled back to the end with the :meth:`~deque." -"rotate` method::" +"robin_scheduling>`_ can be implemented with input iterators stored in " +"a :class:`deque`. Values are yielded from the active iterator in position " +"zero. If that iterator is exhausted, it can be removed " +"with :meth:`~deque.popleft`; otherwise, it can be cycled back to the end " +"with the :meth:`~deque.rotate` method::" msgstr "" "`ラウンドロビンスケジューラ `_ は、入力されたイテレータを :class:`deque` に格納すること" @@ -1108,7 +1241,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,41 +1254,56 @@ 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 "" -"To implement :class:`deque` slicing, use a similar approach applying :meth:" -"`~deque.rotate` to bring a target element to the left side of the deque. " -"Remove old entries with :meth:`~deque.popleft`, add new entries with :meth:" -"`~deque.extend`, and then reverse the rotation. With minor variations on " -"that approach, it is easy to implement Forth style stack manipulations such " -"as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ``rot``, and ``roll``." +"To implement :class:`deque` slicing, use a similar approach " +"applying :meth:`~deque.rotate` to bring a target element to the left side of " +"the deque. Remove old entries with :meth:`~deque.popleft`, add new entries " +"with :meth:`~deque.extend`, and then reverse the rotation. With minor " +"variations on that approach, it is easy to implement Forth style stack " +"manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, " +"``rot``, and ``roll``." msgstr "" ":class:`deque` のスライスの実装でも、同様のアプローチを使います。まず対象とな" -"る要素を :meth:`~deque.rotate` によって deque の左端まで移動させてから、 :" -"meth:`~deque.popleft` で古い要素を削除します。そして、 :meth:`~deque.extend` " -"で新しい要素を追加したのち、循環を逆にします。このアプローチをやや変えたもの" -"として、Forth スタイルのスタック操作、つまり ``dup``, ``drop``, ``swap``, " -"``over``, ``pick``, ``rot``, および ``roll`` を実装するのも簡単です。" +"る要素を :meth:`~deque.rotate` によって deque の左端まで移動させてか" +"ら、 :meth:`~deque.popleft` で古い要素を削除します。そし" +"て、 :meth:`~deque.extend` で新しい要素を追加したのち、循環を逆にします。この" +"アプローチをやや変えたものとして、Forth スタイルのスタック操作、つまり " +"``dup``, ``drop``, ``swap``, ``over``, ``pick``, ``rot``, および ``roll`` を" +"実装するのも簡単です。" #: ../../library/collections.rst:716 msgid ":class:`defaultdict` objects" @@ -1169,17 +1316,17 @@ msgid "" "writable instance variable. The remaining functionality is the same as for " "the :class:`dict` class and is not documented here." msgstr "" -"新しい辞書に似たオブジェクトを返します。 :class:`defaultdict` は組み込みの :" -"class:`dict` クラスのサブクラスです。これはメソッドをひとつオーバーライドし、" -"書き込み可能なインスタンス変数をひとつ追加しています。それ以外の機能は :" -"class:`dict` クラスと同じですので、ここでは説明しません。" +"新しい辞書に似たオブジェクトを返します。 :class:`defaultdict` は組み込み" +"の :class:`dict` クラスのサブクラスです。これはメソッドをひとつオーバーライド" +"し、書き込み可能なインスタンス変数をひとつ追加しています。それ以外の機能" +"は :class:`dict` クラスと同じですので、ここでは説明しません。" #: ../../library/collections.rst:725 msgid "" -"The first argument provides the initial value for the :attr:" -"`default_factory` attribute; it defaults to ``None``. All remaining " -"arguments are treated the same as if they were passed to the :class:`dict` " -"constructor, including keyword arguments." +"The first argument provides the initial value for " +"the :attr:`default_factory` attribute; it defaults to ``None``. All " +"remaining arguments are treated the same as if they were passed to " +"the :class:`dict` constructor, including keyword arguments." msgstr "" "1つ目の引数は :attr:`default_factory` 属性の初期値です。デフォルトは " "``None`` です。残りの引数はキーワード引数も含め、 :class:`dict` のコンストラ" @@ -1195,21 +1342,20 @@ msgstr "" #: ../../library/collections.rst:736 msgid "" -"If the :attr:`default_factory` attribute is ``None``, this raises a :exc:" -"`KeyError` exception with the *key* as argument." +"If the :attr:`default_factory` attribute is ``None``, this raises " +"a :exc:`KeyError` exception with the *key* as argument." msgstr "" -"もし :attr:`default_factory` 属性が ``None`` であれば、このメソッドは :exc:" -"`KeyError` 例外を、 *key* を引数として発生させます。" +"もし :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 "" @@ -1221,9 +1367,9 @@ msgstr "" #: ../../library/collections.rst:746 msgid "" -"This method is called by the :meth:`~object.__getitem__` method of the :" -"class:`dict` class when the requested key is not found; whatever it returns " -"or raises is then returned or raised by :meth:`~object.__getitem__`." +"This method is called by the :meth:`~object.__getitem__` method of " +"the :class:`dict` class when the requested key is not found; whatever it " +"returns or raises is then returned or raised by :meth:`~object.__getitem__`." msgstr "" "このメソッドは :class:`dict` クラスの :meth:`~object.__getitem__` メソッド" "で、キーが存在しなかった場合によびだされます。値を返すか例外を発生させるのど" @@ -1232,11 +1378,15 @@ msgstr "" #: ../../library/collections.rst:750 msgid "" -"Note that :meth:`__missing__` is *not* called for any operations besides :" -"meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, like " -"normal dictionaries, return ``None`` as a default rather than using :attr:" -"`default_factory`." +"Note that :meth:`__missing__` is *not* called for any operations " +"besides :meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, " +"like 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:" @@ -1275,53 +1425,54 @@ msgstr "" #: ../../library/collections.rst:784 msgid "" "When each key is encountered for the first time, it is not already in the " -"mapping; so an entry is automatically created using the :attr:`~defaultdict." -"default_factory` function which returns an empty :class:`list`. The :meth:`!" -"list.append` operation then attaches the value to the new list. When keys " -"are encountered again, the look-up proceeds normally (returning the list for " -"that key) and the :meth:`!list.append` operation adds another value to the " -"list. This technique is simpler and faster than an equivalent technique " +"mapping; so an entry is automatically created using " +"the :attr:`~defaultdict.default_factory` function which returns an " +"empty :class:`list`. The :meth:`!list.append` operation then attaches the " +"value to the new list. When keys are encountered again, the look-up " +"proceeds normally (returning the list for that key) and the :meth:`!" +"list.append` operation adds another value to the list. This technique is " +"simpler and faster than an equivalent technique " "using :meth:`dict.setdefault`:" msgstr "" #: ../../library/collections.rst:799 msgid "" -"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes the :" -"class:`defaultdict` useful for counting (like a bag or multiset in other " -"languages):" +"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes " +"the :class:`defaultdict` useful for counting (like a bag or multiset in " +"other languages):" msgstr "" -":attr:`~defaultdict.default_factory` を :class:`int` にすると、 :class:" -"`defaultdict` を(他の言語の bag や multisetのように)要素の数え上げに便利に使" -"うことができます:" +":attr:`~defaultdict.default_factory` を :class:`int` にする" +"と、 :class:`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." +"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 "" -"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes the :" -"class:`defaultdict` useful for building a dictionary of sets:" +"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes " +"the :class:`defaultdict` useful for building a dictionary of sets:" msgstr "" -":attr:`~defaultdict.default_factory` を :class:`set` に設定することで、 :" -"class:`defaultdict` をセットの辞書を作るために利用することができます:" +":attr:`~defaultdict.default_factory` を :class:`set` に設定すること" +"で、 :class:`defaultdict` をセットの辞書を作るために利用することができます:" #: ../../library/collections.rst:841 msgid ":func:`namedtuple` Factory Function for Tuples with Named Fields" @@ -1339,15 +1490,20 @@ 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 " "well as being indexable and iterable. Instances of the subclass also have a " -"helpful docstring (with *typename* and *field_names*) and a helpful :meth:" -"`~object.__repr__` method which lists the tuple contents in a ``name=value`` " -"format." +"helpful docstring (with *typename* and *field_names*) and a " +"helpful :meth:`~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 "" @@ -1364,8 +1520,9 @@ msgstr "" msgid "" "Any valid Python identifier may be used for a fieldname except for names " "starting with an underscore. Valid identifiers consist of letters, digits, " -"and underscores but do not start with a digit or underscore and cannot be a :" -"mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or *raise*." +"and underscores but do not start with a digit or underscore and cannot be " +"a :mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or " +"*raise*." msgstr "" "アンダースコア (_) で始まる名前を除いて、 Python の正しい識別子 (identifier) " "ならなんでも属性名として使うことができます。正しい識別子とはアルファベット" @@ -1407,6 +1564,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 +1601,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." +"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 +1626,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 +1684,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 +1700,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`." @@ -1544,9 +1722,9 @@ msgid "" "to cast the result to the desired type: ``OrderedDict(nt._asdict())``." msgstr "" ":class:`collections.OrderedDict` ではなく :class:`dict` を返すようになりまし" -"た。Python 3.7以降は、通常の辞書で順番が保証されています。 :class:" -"`OrderedDict` 特有の機能を使いたい場合は、結果を ``OrderedDict(nt." -"_asdict())`` 型にキャストして使用することを推奨します。" +"た。Python 3.7以降は、通常の辞書で順番が保証されていま" +"す。 :class:`OrderedDict` 特有の機能を使いたい場合は、結果を " +"``OrderedDict(nt._asdict())`` 型にキャストして使用することを推奨します。" #: ../../library/collections.rst:973 msgid "" @@ -1556,7 +1734,6 @@ msgstr "" "指定されたフィールドを新しい値で置き換えた、新しい名前付きタプルを作って返し" "ます::" -#: ../../library/collections.rst:976 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._replace(x=33)\n" @@ -1566,6 +1743,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 +1773,6 @@ msgstr "" "フィールド名をリストにしたタプルです。内省 (introspection) したり、既存の名前" "付きタプルをもとに新しい名前つきタプルを作成する時に便利です。" -#: ../../library/collections.rst:994 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1599,12 +1782,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,22 +1801,27 @@ 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 "" -"To retrieve a field whose name is stored in a string, use the :func:" -"`getattr` function:" +"To retrieve a field whose name is stored in a string, use " +"the :func:`getattr` function:" msgstr "" -"文字列に格納された名前を使って名前つきタプルから値を取得するには :func:" -"`getattr` 関数を使います:" +"文字列に格納された名前を使って名前つきタプルから値を取得するに" +"は :func:`getattr` 関数を使います:" #: ../../library/collections.rst:1022 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" msgstr "" -"辞書を名前付きタプルに変換するには、 ``**`` 演算子 (double-star-operator, :" -"ref:`tut-unpacking-arguments` で説明しています) を使います。:" +"辞書を名前付きタプルに変換するには、 ``**`` 演算子 (double-star-" +"operator, :ref:`tut-unpacking-arguments` で説明しています) を使います。:" #: ../../library/collections.rst:1029 msgid "" @@ -1639,7 +1833,6 @@ msgstr "" "のは容易です。次の例では計算済みフィールドと固定幅の print format を追加して" "います:" -#: ../../library/collections.rst:1033 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1655,6 +1848,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 "" @@ -1693,25 +1899,28 @@ msgid "" "tuples. It also provides an elegant notation using the :keyword:`class` " "keyword::" msgstr "" -"名前付きタプルに型ヒントを追加する方法については、 :class:`typing." -"NamedTuple` を参照してください。\n" +"名前付きタプルに型ヒントを追加する方法について" +"は、 :class:`typing.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 "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." msgstr "" -"タプルではなく、辞書をもとにした変更可能な名前空間を作成するには :meth:" -"`types.SimpleNamespace` を参照してください。" +"タプルではなく、辞書をもとにした変更可能な名前空間を作成するに" +"は :meth:`types.SimpleNamespace` を参照してください。" #: ../../library/collections.rst:1082 msgid "" @@ -1789,6 +1998,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 "" @@ -1796,8 +2008,8 @@ msgid "" "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." msgstr "" "組み込みの :class:`dict` の場合、 OrderedDict の ``od.popitem(last=True)`` と" -"同じ機能は、最も右側の (最後の) 要素を取り出すことが保証されている ``d." -"popitem()`` が果たします。" +"同じ機能は、最も右側の (最後の) 要素を取り出すことが保証されている " +"``d.popitem()`` が果たします。" #: ../../library/collections.rst:1119 msgid "" @@ -1809,11 +2021,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 +2038,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 +2045,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 +2083,6 @@ msgstr "" "場合には先頭に移動します。指定した *key* が存在しない場合は :exc:`KeyError` " "を送出します。" -#: ../../library/collections.rst:1158 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1880,6 +2092,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,27 +2108,31 @@ 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." +"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 "" -"The items, keys, and values :term:`views ` of :class:" -"`OrderedDict` now support reverse iteration using :func:`reversed`." +"The items, keys, and values :term:`views ` " +"of :class:`OrderedDict` now support reverse iteration using :func:`reversed`." msgstr "" -":class:`OrderedDict` の項目、キー、値の :term:`ビュー ` が :" -"func:`reversed` による逆順の反復をサポートするようになりました。" +":class:`OrderedDict` の項目、キー、値の :term:`ビュー ` " +"が :func:`reversed` による逆順の反復をサポートするようになりました。" #: ../../library/collections.rst:1187 msgid "" @@ -1917,6 +2140,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" @@ -1945,8 +2170,8 @@ msgstr "" #: ../../library/collections.rst:1211 msgid "" -"An :class:`OrderedDict` would also be useful for implementing variants of :" -"func:`functools.lru_cache`:" +"An :class:`OrderedDict` would also be useful for implementing variants " +"of :func:`functools.lru_cache`:" msgstr "" ":class:`OrderedDict` は :func:`functools.lru_cache` の変種を実装するのにも役" "に立ちます:" @@ -1978,7 +2203,6 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1241 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2015,6 +2239,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" @@ -2035,10 +2294,10 @@ msgstr "" #: ../../library/collections.rst:1320 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " -"regular dictionary, which is accessible via the :attr:`data` attribute of :" -"class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is " -"initialized with its contents; note that a reference to *initialdata* will " -"not be kept, allowing it to be used for other purposes." +"regular dictionary, which is accessible via the :attr:`data` attribute " +"of :class:`UserDict` instances. If *initialdata* is provided, :attr:`data` " +"is initialized with its contents; note that a reference to *initialdata* " +"will not be kept, allowing it to be used for other purposes." msgstr "" "辞書をシミュレートするクラスです。インスタンスの内容は通常の辞書に保存さ" "れ、 :class:`UserDict` インスタンスの :attr:`data` 属性を通してアクセスできま" @@ -2048,8 +2307,8 @@ msgstr "" #: ../../library/collections.rst:1326 msgid "" -"In addition to supporting the methods and operations of mappings, :class:" -"`UserDict` instances provide the following attribute:" +"In addition to supporting the methods and operations of " +"mappings, :class:`UserDict` instances provide the following attribute:" msgstr "" "マッピングのメソッドと演算をサポートするのに加え、 :class:`UserDict` インスタ" "ンスは以下の属性を提供します:" @@ -2087,10 +2346,10 @@ msgstr "" #: ../../library/collections.rst:1350 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " -"list, which is accessible via the :attr:`data` attribute of :class:" -"`UserList` instances. The instance's contents are initially set to a copy " -"of *list*, defaulting to the empty list ``[]``. *list* can be any iterable, " -"for example a real Python list or a :class:`UserList` object." +"list, which is accessible via the :attr:`data` attribute " +"of :class:`UserList` instances. The instance's contents are initially set " +"to a copy of *list*, defaulting to the empty list ``[]``. *list* can be any " +"iterable, for example a real Python list or a :class:`UserList` object." msgstr "" "リストをシミュレートするクラスです。インスタンスの内容は通常のリストに保存さ" "れ、 :class:`UserList` インスタンスの :attr:`data` 属性を通してアクセスできま" @@ -2100,16 +2359,16 @@ msgstr "" #: ../../library/collections.rst:1356 msgid "" -"In addition to supporting the methods and operations of mutable sequences, :" -"class:`UserList` instances provide the following attribute:" +"In addition to supporting the methods and operations of mutable " +"sequences, :class:`UserList` instances provide the following attribute:" msgstr "" -"ミュータブルシーケンスのメソッドと演算をサポートするのに加え、 :class:" -"`UserList` インスタンスは以下の属性を提供します:" +"ミュータブルシーケンスのメソッドと演算をサポートするのに加" +"え、 :class:`UserList` インスタンスは以下の属性を提供します:" #: ../../library/collections.rst:1361 msgid "" -"A real :class:`list` object used to store the contents of the :class:" -"`UserList` class." +"A real :class:`list` object used to store the contents of " +"the :class:`UserList` class." msgstr "" ":class:`UserList` クラスの内容を保存するために使われる実際の :class:`list` オ" "ブジェクトです。" @@ -2173,16 +2432,16 @@ msgstr "" #: ../../library/collections.rst:1394 msgid "" -"In addition to supporting the methods and operations of strings, :class:" -"`UserString` instances provide the following attribute:" +"In addition to supporting the methods and operations of " +"strings, :class:`UserString` instances provide the following attribute:" msgstr "" "文字列のメソッドと演算をサポートするのに加え、 :class:`UserString` インスタン" "スは次の属性を提供します:" #: ../../library/collections.rst:1399 msgid "" -"A real :class:`str` object used to store the contents of the :class:" -"`UserString` class." +"A real :class:`str` object used to store the contents of " +"the :class:`UserString` class." msgstr "" ":class:`UserString` クラスの内容を保存するために使われる実際の :class:`str` " "オブジェクトです。" diff --git a/library/colorsys.po b/library/colorsys.po index b23ce6dcd..df98275f3 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 @@ -46,8 +46,8 @@ msgstr "" #: ../../library/colorsys.rst:23 msgid "" "More information about color spaces can be found at https://poynton.ca/" -"ColorFAQ.html and https://www.cambridgeincolour.com/tutorials/color-spaces." -"htm." +"ColorFAQ.html and https://www.cambridgeincolour.com/tutorials/color-" +"spaces.htm." msgstr "" "色空間に関するより詳細な情報は https://poynton.ca/ColorFAQ.html と https://" "www.cambridgeincolour.com/tutorials/color-spaces.htm にあります。" @@ -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..7f745454b 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,17 +47,16 @@ msgstr "" "をライブラリのインストール時に生成することで、ライブラリディレクトリに書き込" "み権限をもたないユーザでも、これらを利用できるようになります。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/compileall.rst:22 msgid "Command-line use" @@ -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 " @@ -177,62 +177,69 @@ msgid "" "values cause hash-based pycs to be generated. Hash-based pycs embed a hash " "of the source file contents rather than a timestamp. See :ref:`pyc-" "invalidation` for more information on how Python validates bytecode cache " -"files at runtime. The default is ``timestamp`` if the :envvar:" -"`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`` になりま" -"す。" +"files at runtime. The default is ``timestamp`` if " +"the :envvar:`SOURCE_DATE_EPOCH` environment variable is not set, and " +"``checked-hash`` if the ``SOURCE_DATE_EPOCH`` environment variable is set." +msgstr "" +"生成したバイトコードファイルを実行時に無効化する方法を制御します。\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 "" @@ -241,16 +248,20 @@ msgid "" "provides the option: :program:`python -O -m compileall`." msgstr "" ":func:`compile` 関数で利用される最適化レベルを制御するコマンドラインオプショ" -"ンはありません。 Python インタプリタ自体のオプションを使ってください: :" -"program:`python -O -m compileall`." +"ンはありません。 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." +"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" @@ -258,21 +269,21 @@ msgstr "パブリックな関数" #: ../../library/compileall.rst:156 msgid "" -"Recursively descend the directory tree named by *dir*, compiling all :file:`." -"py` files along the way. Return a true value if all the files compiled " -"successfully, and a false value otherwise." +"Recursively descend the directory tree named by *dir*, compiling " +"all :file:`.py` files along the way. Return a true value if all the files " +"compiled successfully, and a false value otherwise." msgstr "" -"*dir* という名前のディレクトリーツリーをたどり、途中で見つけた全ての :file:`." -"py` をコンパイルします。全ファイルのコンパイルが成功した場合は真を、それ以外" -"の場合は偽を返します。" +"*dir* という名前のディレクトリーツリーをたどり、途中で見つけた全て" +"の :file:`.py` をコンパイルします。全ファイルのコンパイルが成功した場合は真" +"を、それ以外の場合は偽を返します。" #: ../../library/compileall.rst:160 msgid "" "The *maxlevels* parameter is used to limit the depth of the recursion; it " "defaults to ``sys.getrecursionlimit()``." msgstr "" -"*maxlevels* パラメータで最大再帰深度を制限します。デフォルトは ``sys." -"getrecursionlimit()`` です。" +"*maxlevels* パラメータで最大再帰深度を制限します。デフォルトは " +"``sys.getrecursionlimit()`` です。" #: ../../library/compileall.rst:163 msgid "" @@ -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,46 +343,57 @@ 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 " "can't use multiple workers and *workers* argument is given, then sequential " "compilation will be used as a fallback. If *workers* is 0, the number of " -"cores in the system is used. If *workers* is lower than ``0``, a :exc:" -"`ValueError` will be raised." +"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 "" -"*invalidation_mode* should be a member of the :class:`py_compile." -"PycInvalidationMode` enum and controls how the generated pycs are " -"invalidated at runtime." +"*invalidation_mode* should be a member of " +"the :class:`py_compile.PycInvalidationMode` enum and controls how the " +"generated pycs are invalidated at runtime." 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()``" +"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 "" @@ -469,9 +502,9 @@ msgstr "" #: ../../library/compileall.rst:302 msgid "" "If *skip_curdir* is true (the default), the current directory is not " -"included in the search. All other parameters are passed to the :func:" -"`compile_dir` function. Note that unlike the other compile functions, " -"``maxlevels`` defaults to ``0``." +"included in the search. All other parameters are passed to " +"the :func:`compile_dir` function. Note that unlike the other compile " +"functions, ``maxlevels`` defaults to ``0``." msgstr "" "*skip_curdir* が真(デフォルト)のとき、カレントディレクトリは走査から除外され" "ます。\n" @@ -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..29d5df2b9 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,25 +50,28 @@ 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." +"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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/concurrent.futures.rst:27 msgid "Executor Objects" @@ -89,80 +95,94 @@ 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 " -"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " -"float. If *timeout* is not specified or ``None``, there is no limit to the " -"wait time." +"The returned iterator raises a :exc:`TimeoutError` " +"if :meth:`~iterator.__next__` is called and the result isn't available after " +"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " +"can be an int or a float. If *timeout* is not specified or ``None``, there " +"is no limit to the wait time." msgstr "" -"もし :meth:`~iterator.__next__` が呼ばれその結果が元々の :meth:`Executor." -"map` の呼び出しから *timeout* 秒経った後も利用できない場合、返されるイテレー" -"タは :exc:`TimeoutError` を送出します。*timeout* は整数または浮動小数点数で" -"す。もし *timeout* が指定されないか の場合、待ち時間に制限はありません。" +"もし :meth:`~iterator.__next__` が呼ばれその結果が元々" +"の :meth:`Executor.map` の呼び出しから *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 " "(approximate) size of these chunks can be specified by setting *chunksize* " "to a positive integer. For very long iterables, using a large value for " "*chunksize* can significantly improve performance compared to the default " -"size of 1. With :class:`ThreadPoolExecutor` and :class:" -"`InterpreterPoolExecutor`, *chunksize* has no effect." -msgstr "" +"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 "" "Signal the executor that it should free any resources that it is using when " -"the currently pending futures are done executing. Calls to :meth:`Executor." -"submit` and :meth:`Executor.map` made after shutdown will raise :exc:" -"`RuntimeError`." +"the currently pending futures are done executing. Calls " +"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " +"raise :exc:`RuntimeError`." msgstr "" "executor に対して、現在保留中のフューチャーが実行された後で、使用中のすべての" -"資源を解放するように伝えます。シャットダウンにより後に :meth:`Executor." -"submit` と :meth:`Executor.map` を呼び出すと :exc:`RuntimeError` が送出されま" -"す。" +"資源を解放するように伝えます。シャットダウンにより後" +"に :meth:`Executor.submit` と :meth:`Executor.map` を呼び出す" +"と :exc:`RuntimeError` が送出されます。" #: ../../library/concurrent.futures.rst:87 msgid "" @@ -181,32 +201,37 @@ 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 "" -"You can avoid having to call this method explicitly if you use the :keyword:" -"`with` statement, which will shutdown the :class:`Executor` (waiting as if :" -"meth:`Executor.shutdown` were called with *wait* set to ``True``)::" +"You can avoid having to call this method explicitly if you use " +"the :keyword:`with` statement, which will shutdown the :class:`Executor` " +"(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " +"``True``)::" msgstr "" ":keyword:`with` 文を使用することで、このメソッドを明示的に呼ばないようにでき" "ます。 :keyword:`with` 文は :class:`Executor` をシャットダウンします " "(*wait* を ``True`` にセットして :meth:`Executor.shutdown` が呼ばれたかのよう" "に待ちます)。" -#: ../../library/concurrent.futures.rst:109 msgid "" "import shutil\n" "with ThreadPoolExecutor(max_workers=4) as e:\n" @@ -215,6 +240,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*." @@ -237,10 +268,9 @@ msgid "" "Deadlocks can occur when the callable associated with a :class:`Future` " "waits on the results of another :class:`Future`. For example::" msgstr "" -":class:`Future` に関連づけられた呼び出し可能オブジェクトが、別の :class:" -"`Future` の結果を待つ時にデッドロックすることがあります。例::" +":class:`Future` に関連づけられた呼び出し可能オブジェクトが、別" +"の :class:`Future` の結果を待つ時にデッドロックすることがあります。例::" -#: ../../library/concurrent.futures.rst:129 msgid "" "import time\n" "def wait_on_b():\n" @@ -258,6 +288,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 +328,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 +336,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,58 +352,73 @@ 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 "" "If *max_workers* is ``None`` or not given, it will default to the number of " -"processors on the machine, multiplied by ``5``, assuming that :class:" -"`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and " -"the number of workers should be higher than the number of workers for :class:" -"`ProcessPoolExecutor`." +"processors on the machine, multiplied by ``5``, assuming " +"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " +"work and the number of workers should be higher than the number of workers " +"for :class:`ProcessPoolExecutor`." msgstr "" "*max_workers* が ``None`` か指定されない場合のデフォルト値はマシンのプロセッ" "サの数に 5 を掛けたものになります。これは、 :class:`ThreadPoolExecutor` は " -"CPU の処理ではなく I/O をオーバーラップするのによく使用されるため、 :class:" -"`ProcessPoolExecutor` のワーカーの数よりもこのワーカーの数を増やすべきである" -"という想定に基づいています。" +"CPU の処理ではなく I/O をオーバーラップするのによく使用されるた" +"め、 :class:`ProcessPoolExecutor` のワーカーの数よりもこのワーカーの数を増や" +"すべきであるという想定に基づいています。" #: ../../library/concurrent.futures.rst:183 msgid "" -"Added the *thread_name_prefix* parameter to allow users to control the :" -"class:`threading.Thread` names for worker threads created by the pool for " -"easier debugging." +"Added the *thread_name_prefix* parameter to allow users to control " +"the :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)``." +"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 +448,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 +487,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 +501,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 +519,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 +544,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 +552,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 +582,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 +598,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 @@ -479,8 +614,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:312 msgid "" -"The executor may replace uncaught exceptions from *initializer* with :class:" -"`~concurrent.futures.interpreter.ExecutionFailed`." +"The executor may replace uncaught exceptions from *initializer* " +"with :class:`~concurrent.futures.interpreter.ExecutionFailed`." msgstr "" #: ../../library/concurrent.futures.rst:315 @@ -492,27 +627,32 @@ 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 "" "When a worker's current task raises an uncaught exception, the worker always " "tries to preserve the exception as-is. If that is successful then it also " -"sets the ``__cause__`` to a corresponding :class:`~concurrent.futures." -"interpreter.ExecutionFailed` instance, which contains a summary of the " -"original exception. In the uncommon case that the worker is not able to " -"preserve the original as-is then it directly preserves the corresponding :" -"class:`~concurrent.futures.interpreter.ExecutionFailed` instance instead." +"sets the ``__cause__`` to a " +"corresponding :class:`~concurrent.futures.interpreter.ExecutionFailed` " +"instance, which contains a summary of the original exception. In the " +"uncommon case that the worker is not able to preserve the original as-is " +"then it directly preserves the " +"corresponding :class:`~concurrent.futures.interpreter.ExecutionFailed` " +"instance instead." msgstr "" #: ../../library/concurrent.futures.rst:345 @@ -522,17 +662,17 @@ msgstr "ProcessPoolExecutor" #: ../../library/concurrent.futures.rst:347 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " -"uses a pool of processes to execute calls asynchronously. :class:" -"`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows " -"it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and " -"returned." +"uses a pool of processes to execute calls " +"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " +"module, which allows it to side-step the :term:`Global Interpreter Lock " +"` but also means that only picklable objects can be " +"executed and returned." msgstr "" ":class:`ProcessPoolExecutor` はプロセスプールを使って非同期呼び出しを実施す" -"る :class:`Executor` のサブクラスです。:class:`ProcessPoolExecutor` は :mod:" -"`multiprocessing` モジュールを利用します。このため :term:`Global Interpreter " -"Lock ` を回避することができますが、pickle 化できるオ" -"ブジェクトしか実行したり返したりすることができません。" +"る :class:`Executor` のサブクラスです。:class:`ProcessPoolExecutor` " +"は :mod:`multiprocessing` モジュールを利用します。このため :term:`Global " +"Interpreter Lock ` を回避することができますが、" +"pickle 化できるオブジェクトしか実行したり返したりすることができません。" #: ../../library/concurrent.futures.rst:354 msgid "" @@ -550,10 +690,10 @@ msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." msgstr "" -":class:`ProcessPoolExecutor` に渡された呼び出し可能オブジェクトから :class:" -"`Executor` や :class:`Future` メソッドを呼ぶとデッドロックに陥ります。" +":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 " @@ -564,11 +704,24 @@ msgid "" "the default chosen will be at most ``61``, even if more processors are " "available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " "It will be used to launch the workers. If *mp_context* is ``None`` or not " -"given, the default :mod:`multiprocessing` context is used. See :ref:" -"`multiprocessing-start-methods`." -msgstr "" +"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 +729,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,78 +745,109 @@ 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 "" -"When one of the worker processes terminates abruptly, a :exc:`~concurrent." -"futures.process.BrokenProcessPool` error is now raised. Previously, " -"behaviour was undefined but operations on the executor or its futures would " -"often freeze or deadlock." +"When one of the worker processes terminates abruptly, " +"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " +"Previously, 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." -"fork` function called internally to spawn workers may raise a :exc:" -"`DeprecationWarning`. Pass a *mp_context* configured to use a different " -"start method. See the :func:`os.fork` documentation for further explanation." +"On POSIX systems, if your application has multiple threads and " +"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " +"The :func:`os.fork` function called internally to spawn workers may raise " +"a :exc:`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`." +"*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\")``." +"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." +"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." +"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 +882,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 +938,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 +987,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 "" @@ -820,51 +1043,49 @@ msgstr "" #: ../../library/concurrent.futures.rst:565 msgid "" -"The following :class:`Future` methods are meant for use in unit tests and :" -"class:`Executor` implementations." +"The following :class:`Future` methods are meant for use in unit tests " +"and :class:`Executor` implementations." msgstr "" -"以下の :class:`Future` メソッドは、ユニットテストでの使用と :class:" -"`Executor` を実装することを意図しています。" +"以下の :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 "" -"If the method returns ``False`` then the :class:`Future` was cancelled, i." -"e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"If the method returns ``False`` then the :class:`Future` was cancelled, " +"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " "waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " "or :func:`wait`) will be woken up." msgstr "" "このメソッドが ``False`` を返す場合、 :class:`Future` はキャンセルされていま" -"す。つまり、 :meth:`Future.cancel` が呼び出されて ``True`` が返っています。:" -"class:`Future` の完了を (:func:`as_completed` または :func:`wait` により) " -"待機するすべてのスレッドが起動します。" +"す。つまり、 :meth:`Future.cancel` が呼び出されて ``True`` が返っていま" +"す。: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." +"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,17 +1101,17 @@ 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." +"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 "" -"Sets the result of the work associated with the :class:`Future` to the :" -"class:`Exception` *exception*." +"Sets the result of the work associated with the :class:`Future` to " +"the :class:`Exception` *exception*." msgstr "" ":class:`Future` に関連付けられたワークの結果を :class:`Exception` " "*exception* に設定します。" @@ -899,16 +1120,23 @@ 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 " -"*fs* are removed and will be returned only once. Returns a named 2-tuple of " -"sets. The first set, named ``done``, contains the futures that completed " -"(finished or cancelled futures) before the wait completed. The second set, " -"named ``not_done``, contains the futures that did not complete (pending or " -"running futures)." +"Wait for the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* to complete. Duplicate " +"futures given to *fs* are removed and will be returned only once. Returns a " +"named 2-tuple of sets. The first set, named ``done``, contains the futures " +"that completed (finished or cancelled futures) before the wait completed. " +"The second set, 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 +1168,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`." +"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 +1191,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 +1221,51 @@ 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." +"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." +"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 +1274,14 @@ 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)." +"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..c385af72c 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,23 +267,28 @@ 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 " -"priority. Any conflicting keys are taken from the more recent configuration " -"while the previously existing keys are retained. The example below reads in " -"an ``override.ini`` file, which will override any conflicting keys from the " -"``example.ini`` file." +"It is possible to read several configurations into a " +"single :class:`ConfigParser`, where the most recently added configuration " +"has the highest priority. Any conflicting keys are taken from the more " +"recent configuration while the previously existing keys are retained. The " +"example below reads in 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 "" @@ -304,22 +383,22 @@ msgid "" "methods. You can register your own converters and customize the provided " "ones. [1]_" msgstr "" -"config parser では、 :meth:`~ConfigParser.getboolean` 以外に :meth:" -"`~ConfigParser.getint` と :meth:`~ConfigParser.getfloat` メソッドも提供されて" -"います。独自のコンバーターの登録、提供されたメソッドのカスタマイズもできま" -"す。 [1]_" +"config parser では、 :meth:`~ConfigParser.getboolean` 以外" +"に :meth:`~ConfigParser.getint` と :meth:`~ConfigParser.getfloat` メソッドも" +"提供されています。独自のコンバーターの登録、提供されたメソッドのカスタマイズ" +"もできます。 [1]_" #: ../../library/configparser.rst:215 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,38 +429,44 @@ 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:" +"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 "" -"The same ``fallback`` argument can be used with the :meth:`~ConfigParser." -"getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " -"methods, for example:" +"The same ``fallback`` argument can be used with " +"the :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` " +"and :meth:`~ConfigParser.getboolean` methods, for example:" msgstr "" -"同様の ``fallback`` 引数を、:meth:`~ConfigParser.getint` 、 :meth:" -"`~ConfigParser.getfloat` と :meth:`~ConfigParser.getboolean` メソッドでも使え" -"ます。例えば:" +"同様の ``fallback`` 引数" +"を、:meth:`~ConfigParser.getint` 、 :meth:`~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 "" @@ -546,36 +717,36 @@ msgid "" "keys used in the chain of references do not have to be specified in any " "specific order in the configuration file." msgstr "" -"上の例では、 *interpolation* に ``BasicInterpolation()`` を設定した :class:" -"`ConfigParser` が ``%(home_dir)s`` を ``home_dir`` の値(このケースでは ``/" -"Users`` )として解決しています、その結果 ``%(my_dir)s`` は ``/Users/" +"上の例では、 *interpolation* に ``BasicInterpolation()`` を設定し" +"た :class:`ConfigParser` が ``%(home_dir)s`` を ``home_dir`` の値(このケース" +"では ``/Users`` )として解決しています、その結果 ``%(my_dir)s`` は ``/Users/" "lumberjack`` になります。全ての補間は必要に応じて実行されるため、設定ファイル" "中で参照の連鎖をもつキーを特定の順序で記述する必要はありません。" #: ../../library/configparser.rst:396 msgid "" -"With ``interpolation`` set to ``None``, the parser would simply return " -"``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" +"With ``interpolation`` set to ``None``, the parser would simply return ``%" +"(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" "``interpolation`` に ``None`` を設定すれば、パーサーは単に ``my_pictures`` の" -"値として ``%(my_dir)s/Pictures`` を返し、``my_dir`` の値として " -"``%(home_dir)s/lumberjack`` を返します。" +"値として ``%(my_dir)s/Pictures`` を返し、``my_dir`` の値として ``%" +"(home_dir)s/lumberjack`` を返します。" #: ../../library/configparser.rst:404 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " "using ``${section:option}`` to denote a value from a foreign section. " -"Interpolation can span multiple levels. For convenience, if the ``section:" -"`` part is omitted, interpolation defaults to the current section (and " -"possibly the default values from the special section)." +"Interpolation can span multiple levels. For convenience, if the " +"``section:`` part is omitted, interpolation defaults to the current section " +"(and possibly the default values from the special section)." msgstr "" "``zc.buildout`` で使用されるような、より高度な文法を実装した補間ハンドラの別" -"の選択肢です。拡張された補間は、他のセクション中の値を示すのに ``${section:" -"option}`` と書けます。補間は複数のレベルに及べます、利便性のために、もし " -"``section:`` の部分が省略されると、現在のセクションがデフォルト値となります" -"(スペシャルセクション中のデフォルト値を使用することもできます)。" +"の選択肢です。拡張された補間は、他のセクション中の値を示すのに ``$" +"{section:option}`` と書けます。補間は複数のレベルに及べます、利便性のために、" +"もし ``section:`` の部分が省略されると、現在のセクションがデフォルト値となり" +"ます(スペシャルセクション中のデフォルト値を使用することもできます)。" #: ../../library/configparser.rst:411 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" @@ -629,8 +822,8 @@ msgstr "マップ型プロトコルアクセス" #: ../../library/configparser.rst:451 msgid "" "Mapping protocol access is a generic name for functionality that enables " -"using custom objects as if they were dictionaries. In case of :mod:" -"`configparser`, the mapping interface implementation is using the " +"using custom objects as if they were dictionaries. In case " +"of :mod:`configparser`, the mapping interface implementation is using the " "``parser['section']['option']`` notation." msgstr "" "マップ型プロトコルアクセスは、カスタムオブジェクトを辞書であるかのように使う" @@ -653,9 +846,9 @@ msgstr "" #: ../../library/configparser.rst:462 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " -"possible. The mapping interface is complete and adheres to the :class:" -"`~collections.abc.MutableMapping` ABC. However, there are a few differences " -"that should be taken into account:" +"possible. The mapping interface is complete and adheres to " +"the :class:`~collections.abc.MutableMapping` ABC. However, there are a few " +"differences that should be taken into account:" msgstr "" ":mod:`configparser` は可能な限り実際の辞書と近い振る舞いをします。マップ型イ" "ンターフェースは :class:`~collections.abc.MutableMapping` を矛盾なく完成しま" @@ -675,26 +868,27 @@ 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 "" -"All sections include ``DEFAULTSECT`` values as well which means that ``." -"clear()`` on a section may not leave the section visibly empty. This is " +"All sections include ``DEFAULTSECT`` values as well which means that " +"``.clear()`` on a section may not leave the section visibly empty. This is " "because default values cannot be deleted from the section (because " "technically they are not there). If they are overridden in the section, " "deleting causes the default value to be visible again. Trying to delete a " "default value causes a :exc:`KeyError`." msgstr "" -"全てのセクションは ``DEFAULTSECT`` 値を持ち、すなわちセクションで ``." -"clear()`` してもセクションは見た目上空になりません。これは、デフォルト値は " -"(技術的にはそこにないので) セクションから削除できないためです。デフォルト値が" -"上書きされた場合、それが削除されるとデフォルト値が再び見えるようになります。" -"デフォルト値を削除しようとすると :exc:`KeyError` が発生します。" +"全てのセクションは ``DEFAULTSECT`` 値を持ち、すなわちセクションで " +"``.clear()`` してもセクションは見た目上空になりません。これは、デフォルト値" +"は (技術的にはそこにないので) セクションから削除できないためです。デフォルト" +"値が上書きされた場合、それが削除されるとデフォルト値が再び見えるようになりま" +"す。デフォルト値を削除しようとすると :exc:`KeyError` が発生します。" #: ../../library/configparser.rst:482 msgid "``DEFAULTSECT`` cannot be removed from the parser:" @@ -726,10 +920,10 @@ msgstr "" msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " -"However, this method can also be invoked with arguments: ``parser." -"items(section, raw, vars)``. The latter call returns a list of *option*, " -"*value* pairs for a specified ``section``, with all interpolations expanded " -"(unless ``raw=True`` is provided)." +"However, this method can also be invoked with arguments: " +"``parser.items(section, raw, vars)``. The latter call returns a list of " +"*option*, *value* pairs for a specified ``section``, with all interpolations " +"expanded (unless ``raw=True`` is provided)." msgstr "" "``parser.items()`` はマップ型プロトコルと互換です (DEFAULTSECT を含む " "*section_name*, *section_proxy* 対のリストを返します)。ただし、このメソッド" @@ -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." +"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``" @@ -851,11 +1062,10 @@ msgid "" "*allow_no_value* parameter to the constructor can be used to indicate that " "such values should be accepted:" msgstr "" -"一部の設定ファイルには値のない設定項目がありますが、それ以外は :mod:" -"`ConfigParser` がサポートする文法に従います。コンストラクタの " +"一部の設定ファイルには値のない設定項目がありますが、それ以外" +"は :mod:`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: ``('=', ':')``" @@ -902,8 +1139,8 @@ msgstr "" #: ../../library/configparser.rst:603 msgid "" -"See also the *space_around_delimiters* argument to :meth:`ConfigParser." -"write`." +"See also the *space_around_delimiters* argument " +"to :meth:`ConfigParser.write`." msgstr "" ":meth:`ConfigParser.write` の *space_around_delimiters* 引数も参照してくださ" "い。" @@ -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." +"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 "" @@ -1076,9 +1358,9 @@ msgid "" "other valid section name. Some typical values include: ``\"general\"`` or " "``\"common\"``. The name provided is used for recognizing default sections " "when reading from any source and is used when writing configuration back to " -"a file. Its current value can be retrieved using the ``parser_instance." -"default_section`` attribute and may be modified at runtime (i.e. to convert " -"files from one format to another)." +"a file. Its current value can be retrieved using the " +"``parser_instance.default_section`` attribute and may be modified at runtime " +"(i.e. to convert files from one format to another)." msgstr "" "他のセクションのデフォルト値や補間目的での特別なセクションを認める慣行はこの" "ライブラリの明確なコンセプトの一つで、ユーザーは複雑で宣言的な設定を作成でき" @@ -1100,8 +1382,8 @@ msgid "" "through the *interpolation* argument. ``None`` can be used to turn off " "interpolation completely, ``ExtendedInterpolation()`` provides a more " "advanced variant inspired by ``zc.buildout``. More on the subject in the " -"`dedicated documentation section <#interpolation-of-values>`_. :class:" -"`RawConfigParser` has a default value of ``None``." +"`dedicated documentation section <#interpolation-of-" +"values>`_. :class:`RawConfigParser` has a default value of ``None``." msgstr "" "補間の振る舞いは、 *interpolation* 引数を通してカスタムハンドラを与えることで" "カスタマイズできます。 ``None`` 引数を使うと補間を完全に無効にできます。 " @@ -1114,19 +1396,31 @@ 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`, " "and :meth:`~ConfigParser.getboolean` are implemented. Should other getters " "be desirable, users may define them in a subclass or pass a dictionary where " "each key is a name of the converter and each value is a callable " -"implementing said conversion. For instance, passing ``{'decimal': decimal." -"Decimal}`` would add :meth:`!getdecimal` on both the parser object and all " -"section proxies. In other words, it will be possible to write both " +"implementing said conversion. For instance, passing ``{'decimal': " +"decimal.Decimal}`` would add :meth:`!getdecimal` on both the parser object " +"and all section proxies. In other words, it will be possible to write both " "``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 +1458,6 @@ msgstr "" "``'false'``, ``'off'`` 。文字列と対応するブール値のカスタム辞書を指定すること" "でこれを上書きできます。たとえば:" -#: ../../library/configparser.rst:754 msgid "" ">>> custom = configparser.ConfigParser()\n" ">>> custom['section1'] = {'funky': 'nope'}\n" @@ -1176,6 +1469,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 +1499,6 @@ msgstr "" "すべてのキーは小文字になります。それがふさわしくなければ、このメソッドを上書" "きしてください。例えば:" -#: ../../library/configparser.rst:778 msgid "" ">>> config = \"\"\"\n" "... [Section1]\n" @@ -1220,15 +1521,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 +1558,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 +1584,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 +1634,6 @@ msgstr "" msgid "An example of writing to a configuration file::" msgstr "設定ファイルを書き出す例::" -#: ../../library/configparser.rst:853 msgid "" "import configparser\n" "\n" @@ -1318,12 +1656,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 +1698,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 +1751,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 +1792,6 @@ msgstr "" "どちらの型の ConfigParsers でもデフォルト値が利用できます。使われているオプ" "ションがどこにも定義されていなければ、そのデフォルト値が補間に使われます。 ::" -#: ../../library/configparser.rst:928 msgid "" "import configparser\n" "\n" @@ -1402,6 +1804,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,27 +1845,29 @@ 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, " -"string or dictionary), raising :exc:`DuplicateSectionError` or :exc:" -"`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` (default: " -"``True``), each empty line marks the end of an option. Otherwise, internal " -"empty lines of a multiline option are kept as part of the value. When " -"*allow_no_value* is ``True`` (default: ``False``), options without values " -"are accepted; the value held for these is ``None`` and they are serialized " -"without the trailing delimiter." +"string or dictionary), raising :exc:`DuplicateSectionError` " +"or :exc:`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` " +"(default: ``True``), each empty line marks the end of an option. Otherwise, " +"internal empty lines of a multiline option are kept as part of the value. " +"When *allow_no_value* is ``True`` (default: ``False``), options without " +"values are accepted; the value held for these is ``None`` and they are " +"serialized without the trailing delimiter." msgstr "" "*strict* が ``True`` (デフォルト) であれば、パーサーは単一のソース (ファイ" -"ル、文字列、辞書) 中にセクションやオプションの重複を認めず、 :exc:" -"`DuplicateSectionError` や :exc:`DuplicateOptionError` を送出します。 " +"ル、文字列、辞書) 中にセクションやオプションの重複を認め" +"ず、 :exc:`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 +1876,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 "" @@ -1478,18 +1899,17 @@ msgstr "" #: ../../library/configparser.rst:987 msgid "" -"All option names used in interpolation will be passed through the :meth:" -"`optionxform` method just like any other option name reference. For " -"example, using the default implementation of :meth:`optionxform` (which " -"converts option names to lower case), the values ``foo %(bar)s`` and ``foo " -"%(BAR)s`` are equivalent." +"All option names used in interpolation will be passed through " +"the :meth:`optionxform` method just like any other option name reference. " +"For example, using the default implementation of :meth:`optionxform` (which " +"converts option names to lower case), the values ``foo %(bar)s`` and ``foo %" +"(BAR)s`` are equivalent." msgstr "" -"補間に使われるすべてのオプション名は、他のオプション名参照と同様に、 :meth:" -"`optionxform` メソッドを通して渡されます。例えば、 :meth:`optionxform` のデ" -"フォルトの実装を使うと、値 ``foo %(bar)s`` と ``foo %(BAR)s`` は等しくなりま" -"す。" +"補間に使われるすべてのオプション名は、他のオプション名参照と同様" +"に、 :meth:`optionxform` メソッドを通して渡されます。例え" +"ば、 :meth:`optionxform` のデフォルトの実装を使うと、値 ``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 +1917,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 +1949,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." @@ -1588,13 +2018,14 @@ msgstr "指定された *section* 中で利用できるオプションのリス #: ../../library/configparser.rst:1090 msgid "" -"If the given *section* exists, and contains the given *option*, return :" -"const:`True`; otherwise return :const:`False`. If the specified *section* " -"is :const:`None` or an empty string, DEFAULT is assumed." +"If the given *section* exists, and contains the given *option*, " +"return :const:`True`; otherwise return :const:`False`. If the specified " +"*section* is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -"与えられた *section* が存在し、与えられた *option* を含む場合、 :const:" -"`True` を返します。それ以外の場合には、 :const:`False` を返します。指定され" -"た *section* が :const:`None` または空文字列の場合、 DEFAULT が仮定されます。" +"与えられた *section* が存在し、与えられた *option* を含む場" +"合、 :const:`True` を返します。それ以外の場合には、 :const:`False` を返しま" +"す。指定された *section* が :const:`None` または空文字列の場合、 DEFAULT が仮" +"定されます。" #: ../../library/configparser.rst:1097 msgid "" @@ -1604,7 +2035,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,14 +2049,14 @@ msgstr "" "けないファイルがある場合、そのファイルは無視されます。この挙動は、設定ファイ" "ルが置かれる可能性のある場所(例えば、 カレントディレクトリ、ホームディレクト" "リ、システム全体の設定を行うディレクトリ)のイテラブルを指定して、イテラブルの" -"中で存在する全ての設定ファイルを読むことを想定して設計されています。 " +"中で存在する全ての設定ファイルを読むことを想定して設計されています。" #: ../../library/configparser.rst:1109 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " -"be loaded from a file should load the required file or files using :meth:" -"`read_file` before calling :meth:`read` for any optional files::" +"be loaded from a file should load the required file or files " +"using :meth:`read_file` before calling :meth:`read` for any optional files::" msgstr "" "どの設定ファイルも存在しなかった場合、 :class:`ConfigParser` のインスタンス" "は 空のデータセットを持ちます。初期値の設定ファイルを先に読み込んでおく必要が" @@ -1634,7 +2064,6 @@ msgstr "" "を呼ぶ前に 、まず :meth:`read_file` を用いて必要なファイルを読み込んでくださ" "い::" -#: ../../library/configparser.rst:1115 msgid "" "import configparser, os\n" "\n" @@ -1643,12 +2072,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 +2105,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 +2158,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 +2165,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,30 +2200,31 @@ 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 " "``'1'``, ``'yes'``, ``'true'``, and ``'on'``, which cause this method to " "return ``True``, and ``'0'``, ``'no'``, ``'false'``, and ``'off'``, which " "cause it to return ``False``. These string values are checked in a case-" -"insensitive manner. Any other value will cause it to raise :exc:" -"`ValueError`. See :meth:`get` for explanation of *raw*, *vars* and " -"*fallback*." +"insensitive manner. Any other value will cause it to " +"raise :exc:`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 "" @@ -1795,8 +2237,8 @@ msgstr "" #: ../../library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " -"given *section*. Optional arguments have the same meaning as for the :meth:" -"`get` method." +"given *section*. Optional arguments have the same meaning as for " +"the :meth:`get` method." msgstr "" "与えられれば、与えられた *section* 中のオプションの *name*, *value* の対のリ" "ストを返します。オプションの引数は :meth:`get` メソッドに与えるものと同じ意味" @@ -1835,11 +2277,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,44 +2334,51 @@ 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 "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -"なお、設定ファイルを読み込むとき、オプション名の周りの空白は :meth:" -"`optionxform` が呼び出される前に取り除かれます。" +"なお、設定ファイルを読み込むとき、オプション名の周りの空白" +"は :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." +"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 +2390,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." +"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,25 +2417,24 @@ msgstr "" "ることができます。この振る舞いはサポートされておらず、内部エラーを起こす可能" "性があります。" -#: ../../library/configparser.rst:1357 msgid "Added support for :const:`UNNAMED_SECTION`." -msgstr "" +msgstr ":const:`UNNAMED_SECTION` のサポートが追加されました。" #: ../../library/configparser.rst:1363 msgid "" "If the given section exists, set the given option to the specified value; " -"otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" -"`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters set to " -"true) for *internal* storage of non-string values, full functionality " +"otherwise raise :exc:`NoSectionError`. While it is possible to " +"use :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters " +"set to true) for *internal* storage of non-string values, full functionality " "(including interpolation and output to files) can only be achieved using " "string values." msgstr "" "与えられたセクションが存在していれば、オプションを指定された値に設定します。" -"セクションが存在しなければ :exc:`NoSectionError` を発生させます。 :class:" -"`RawConfigParser` (あるいは *raw* パラメータをセットした :class:" -"`ConfigParser`) を文字列型でない値の *内部的な* 格納場所として使うことは可能" -"ですが、すべての機能 (置換やファイルへの出力を含む) がサポートされるのは文字" -"列を値として使った場合だけです。" +"セクションが存在しなければ :exc:`NoSectionError` を発生させま" +"す。 :class:`RawConfigParser` (あるいは *raw* パラメータをセットし" +"た :class:`ConfigParser`) を文字列型でない値の *内部的な* 格納場所として使う" +"ことは可能ですが、すべての機能 (置換やファイルへの出力を含む) がサポートされ" +"るのは文字列を値として使った場合だけです。" #: ../../library/configparser.rst:1370 msgid "" @@ -2006,18 +2460,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__`." +"Added the optional *source* and *lineno* attributes and parameters " +"to :meth:`!__init__`." msgstr "" +":meth:`!__init__` に省略可能な *source*、*lineno* 属性と引数が追加されまし" +"た。" #: ../../library/configparser.rst:1402 msgid "" @@ -2048,8 +2505,8 @@ msgstr "文字列の補間中に問題が起きた時に発生する例外の基 #: ../../library/configparser.rst:1422 msgid "" "Exception raised when string interpolation cannot be completed because the " -"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" -"exc:`InterpolationError`." +"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass " +"of :exc:`InterpolationError`." msgstr "" "繰り返しの回数が :const:`MAX_INTERPOLATION_DEPTH` を超えたために文字列補間が" "完了しなかったときに送出される例外です。 :exc:`InterpolationError` の派生クラ" @@ -2082,36 +2539,42 @@ 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 +2614,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..ffc308dc4 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 @@ -61,24 +61,24 @@ msgstr "" #: ../../library/constants.rst:30 msgid "" -"A special value which should be returned by the binary special methods (e." -"g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :" -"meth:`~object.__rsub__`, etc.) to indicate that the operation is not " -"implemented with respect to the other type; may be returned by the in-place " -"binary special methods (e.g. :meth:`~object.__imul__`, :meth:`~object." -"__iand__`, etc.) for the same purpose. It should not be evaluated in a " -"boolean context. :data:`!NotImplemented` is the sole instance of the :data:" -"`types.NotImplementedType` type." -msgstr "" -"特殊な二項演算のメソッド (e.g. :meth:`~object.__eq__`, :meth:`~object." -"__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, etc.) が、他の型" -"に対して演算が実装されていないことを示すために返す特殊値です。インプレースの" -"特殊な二項演算のメソッド (e.g. :meth:`~object.__imul__`, :meth:`~object." -"__iand__`, etc.) も同じ理由でこの値を返すことがあります。この処理では真偽値コ" -"ンテキストでの評価はしてはいけません。:data:`!NotImplemented` が :data:" -"`types.NotImplementedType` 型の唯一のインスタンスです。" - -#: ../../library/constants.rst:40 +"A special value which should be returned by the binary special methods " +"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " +"etc.) to indicate that the operation is not implemented with respect to the " +"other type; may be returned by the in-place binary special methods " +"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same " +"purpose. It should not be evaluated in a boolean context. :data:`!" +"NotImplemented` is the sole instance of the :data:`types.NotImplementedType` " +"type." +msgstr "" +"特殊な二項演算のメソッド " +"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " +"etc.) が、他の型に対して演算が実装されていないことを示すために返す特殊値で" +"す。インプレースの特殊な二項演算のメソッド " +"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) も同じ理由で" +"この値を返すことがあります。この処理では真偽値コンテキストでの評価はしてはい" +"けません。:data:`!NotImplemented` が :data:`types.NotImplementedType` 型の唯" +"一のインスタンスです。" + 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 +88,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." +"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." +"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 "" @@ -141,13 +149,13 @@ msgstr "" #: ../../library/constants.rst:81 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " -"cannot be reassigned (assignments to them, even as an attribute name, raise :" -"exc:`SyntaxError`), so they can be considered \"true\" constants." +"cannot be reassigned (assignments to them, even as an attribute name, " +"raise :exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" "名前 :data:`None` 、 :data:`False` 、 :data:`True` 、 :data:`__debug__` は再" -"代入できない (これらに対する代入は、たとえ属性名としてであっても :exc:" -"`SyntaxError` が送出されます) ので、これらは「真の」定数であると考えられま" -"す。" +"代入できない (これらに対する代入は、たとえ属性名としてであって" +"も :exc:`SyntaxError` が送出されます) ので、これらは「真の」定数であると考え" +"られます。" #: ../../library/constants.rst:89 msgid "Constants added by the :mod:`site` module" @@ -172,8 +180,8 @@ msgid "" "exit code." msgstr "" "表示されたときに \"Use quit() or Ctrl-D (i.e. EOF) to exit\" のようなメッセー" -"ジを表示し、呼び出されたときには指定された終了コードを伴って :exc:" -"`SystemExit` を送出するオブジェクトです。" +"ジを表示し、呼び出されたときには指定された終了コードを伴っ" +"て :exc:`SystemExit` を送出するオブジェクトです。" #: ../../library/constants.rst:106 msgid "" diff --git a/library/contextlib.po b/library/contextlib.po index ec46a3f12..c8e49be17 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 @@ -37,9 +37,9 @@ msgstr "**ソースコード:** :source:`Lib/contextlib.py`" #: ../../library/contextlib.rst:11 msgid "" -"This module provides utilities for common tasks involving the :keyword:" -"`with` statement. For more information see also :ref:`typecontextmanager` " -"and :ref:`context-managers`." +"This module provides utilities for common tasks involving " +"the :keyword:`with` statement. For more information see " +"also :ref:`typecontextmanager` and :ref:`context-managers`." msgstr "" "このモジュールは :keyword:`with` 文に関わる一般的なタスクのためのユーティリ" "ティを提供します。詳しい情報は、 :ref:`typecontextmanager` と :ref:`context-" @@ -55,51 +55,55 @@ msgstr "以下の関数とクラスを提供しています:" #: ../../library/contextlib.rst:23 msgid "" -"An :term:`abstract base class` for classes that implement :meth:`object." -"__enter__` and :meth:`object.__exit__`. A default implementation for :meth:" -"`object.__enter__` is provided which returns ``self`` while :meth:`object." -"__exit__` is an abstract method which by default returns ``None``. See also " -"the definition of :ref:`typecontextmanager`." +"An :term:`abstract base class` for classes that " +"implement :meth:`object.__enter__` and :meth:`object.__exit__`. A default " +"implementation for :meth:`object.__enter__` is provided which returns " +"``self`` while :meth:`object.__exit__` is an abstract method which by " +"default returns ``None``. See also the definition " +"of :ref:`typecontextmanager`." msgstr "" ":meth:`object.__enter__` と :meth:`object.__exit__` の2つのメソッドを実装した" "抽象基底クラス (:term:`abstract base class`) です。 :meth:`object.__enter__` " -"は ``self`` を返すデフォルトの実装が提供されるいっぽう、 :meth:`object." -"__exit__` はデフォルトで ``None`` を返す抽象メソッドです。 :ref:" -"`typecontextmanager` の定義も参照してください。" +"は ``self`` を返すデフォルトの実装が提供されるいっぽ" +"う、 :meth:`object.__exit__` はデフォルトで ``None`` を返す抽象メソッドで" +"す。 :ref:`typecontextmanager` の定義も参照してください。" #: ../../library/contextlib.rst:34 msgid "" -"An :term:`abstract base class` for classes that implement :meth:`object." -"__aenter__` and :meth:`object.__aexit__`. A default implementation for :meth:" -"`object.__aenter__` is provided which returns ``self`` while :meth:`object." -"__aexit__` is an abstract method which by default returns ``None``. See also " -"the definition of :ref:`async-context-managers`." +"An :term:`abstract base class` for classes that " +"implement :meth:`object.__aenter__` and :meth:`object.__aexit__`. A default " +"implementation for :meth:`object.__aenter__` is provided which returns " +"``self`` while :meth:`object.__aexit__` is an abstract method which by " +"default returns ``None``. See also the definition of :ref:`async-context-" +"managers`." msgstr "" ":meth:`object.__aenter__` と :meth:`object.__aexit__` の2つのメソッドを実装す" -"るクラスのための抽象基底クラス (:term:`abstract base class`) です。 :meth:" -"`object.__aenter__` は ``self`` を返すデフォルト実装が提供されるいっぽう、 :" -"meth:`object.__aexit__` はデフォルトで ``None`` を返す抽象メソッドです。 :" -"ref:`async-context-managers` の定義も参照してください。" +"るクラスのための抽象基底クラス (:term:`abstract base class`) で" +"す。 :meth:`object.__aenter__` は ``self`` を返すデフォルト実装が提供される" +"いっぽう、 :meth:`object.__aexit__` はデフォルトで ``None`` を返す抽象メソッ" +"ドです。 :ref:`async-context-managers` の定義も参照してください。" #: ../../library/contextlib.rst:46 msgid "" "This function is a :term:`decorator` that can be used to define a factory " "function for :keyword:`with` statement context managers, without needing to " -"create a class or separate :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods." +"create a class or separate :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" "この関数は :keyword:`with` 文コンテキストマネージャのファクトリ関数を定義する" -"ために利用できる :term:`デコレータ ` です。新しいクラスや :meth:" -"`~object.__enter__` と :meth:`~object.__exit__` メソッドを別々に定義しなくて" -"も、ファクトリ関数を定義することができます。" +"ために利用できる :term:`デコレータ ` です。新しいクラス" +"や :meth:`~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``." +"and doesn't implement a ``close()`` method for use with " +"``contextlib.closing``." msgstr "" +"多くのオブジェクトは with 文での使用をサポートしていますが、コンテキストマ" +"ネージャではなく、``contextlib.closing`` で使うための ``close()`` メソッドも" +"実装していないリソースを管理する必要が生じることもあります。" #: ../../library/contextlib.rst:54 msgid "" @@ -108,7 +112,6 @@ msgid "" msgstr "" "リソースを正しく管理するよう保証する抽象的な例は以下のようなものでしょう::" -#: ../../library/contextlib.rst:57 msgid "" "from contextlib import contextmanager\n" "\n" @@ -122,17 +125,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 "" @@ -147,18 +163,18 @@ msgstr "" #: ../../library/contextlib.rst:79 msgid "" -"At the point where the generator yields, the block nested in the :keyword:" -"`with` statement is executed. The generator is then resumed after the block " -"is exited. If an unhandled exception occurs in the block, it is reraised " -"inside the generator at the point where the yield occurred. Thus, you can " -"use a :keyword:`try`...\\ :keyword:`except`...\\ :keyword:`finally` " -"statement to trap the error (if any), or ensure that some cleanup takes " -"place. If an exception is trapped merely in order to log it or to perform " -"some action (rather than to suppress it entirely), the generator must " -"reraise that exception. Otherwise the generator context manager will " -"indicate to the :keyword:`!with` statement that the exception has been " -"handled, and execution will resume with the statement immediately following " -"the :keyword:`!with` statement." +"At the point where the generator yields, the block nested in " +"the :keyword:`with` statement is executed. The generator is then resumed " +"after the block is exited. If an unhandled exception occurs in the block, it " +"is reraised inside the generator at the point where the yield occurred. " +"Thus, you can use a :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` statement to trap the error (if any), or ensure that " +"some cleanup takes place. If an exception is trapped merely in order to log " +"it or to perform some action (rather than to suppress it entirely), the " +"generator must reraise that exception. Otherwise the generator context " +"manager will indicate to the :keyword:`!with` statement that the exception " +"has been handled, and execution will resume with the statement immediately " +"following the :keyword:`!with` statement." msgstr "" "ジェネレータが yield を実行した箇所で :keyword:`with` 文のネストされたブロッ" "クが実行されます。ブロックから抜けた後でジェネレータは再開されます。ブロック" @@ -182,14 +198,14 @@ msgid "" "that context managers support multiple invocations in order to be used as " "decorators)." msgstr "" -":func:`contextmanager` は :class:`ContextDecorator` を使っているので、 :func:" -"`contextmanager` で作ったコンテキストマネージャは :keyword:`with` 文だけでな" -"くデコレータとしても利用できます。デコレーターとして利用された場合、新しい " -"generator インスタンスが関数呼び出しのたびに暗黙に生成されます (このことに" -"よって、 :func:`contextmanager` によって作られたなにがしか「単発」コンテキス" -"トマネージャを、コンテキストマネージャがデコレータとして使われるためには多重" -"に呼び出されることをサポートする必要がある、という要件に合致させることが出来" -"ます。)" +":func:`contextmanager` は :class:`ContextDecorator` を使っているの" +"で、 :func:`contextmanager` で作ったコンテキストマネージャは :keyword:`with` " +"文だけでなくデコレータとしても利用できます。デコレーターとして利用された場" +"合、新しい generator インスタンスが関数呼び出しのたびに暗黙に生成されます (こ" +"のことによって、 :func:`contextmanager` によって作られたなにがしか「単発」コ" +"ンテキストマネージャを、コンテキストマネージャがデコレータとして使われるため" +"には多重に呼び出されることをサポートする必要がある、という要件に合致させるこ" +"とが出来ます。)" #: ../../library/contextlib.rst:98 msgid "Use of :class:`ContextDecorator`." @@ -197,8 +213,8 @@ msgstr ":class:`ContextDecorator` の使用。" #: ../../library/contextlib.rst:104 msgid "" -"Similar to :func:`~contextlib.contextmanager`, but creates an :ref:" -"`asynchronous context manager `." +"Similar to :func:`~contextlib.contextmanager`, but creates " +"an :ref:`asynchronous context manager `." msgstr "" ":func:`~contextlib.contextmanager` と似ていますが、 :ref:`非同期コンテキスト" "マネージャ (asynchronous context manager) ` を生成し" @@ -209,20 +225,19 @@ msgid "" "This function is a :term:`decorator` that can be used to define a factory " "function for :keyword:`async with` statement asynchronous context managers, " "without needing to create a class or separate :meth:`~object.__aenter__` " -"and :meth:`~object.__aexit__` methods. It must be applied to an :term:" -"`asynchronous generator` function." +"and :meth:`~object.__aexit__` methods. It must be applied to " +"an :term:`asynchronous generator` function." msgstr "" "この関数は :keyword:`async with` 文のための非同期コンテキストマネージャのファ" "クトリ関数を定義するために利用できるデコレータ (:term:`decorator`) です。新し" "いクラスや :meth:`~object.__aenter__` と :meth:`~object.__aexit__` メソッド" -"を個別に定義する必要はありません。このデコレータは非同期ジェネレータ (:term:" -"`asynchronous generator`) 関数に適用しなければなりません。" +"を個別に定義する必要はありません。このデコレータは非同期ジェネレータ " +"(:term:`asynchronous generator`) 関数に適用しなければなりません。" #: ../../library/contextlib.rst:113 msgid "A simple example::" msgstr "簡単な例::" -#: ../../library/contextlib.rst:115 msgid "" "from contextlib import asynccontextmanager\n" "\n" @@ -238,6 +253,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 +276,6 @@ msgstr "" "レータとして使うことも :keyword:`async with` 文と組み合わせて使うこともできま" "す::" -#: ../../library/contextlib.rst:134 msgid "" "import time\n" "from contextlib import asynccontextmanager\n" @@ -265,6 +292,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 +336,6 @@ msgstr "" "ブロックの完了時に *thing* を close するコンテキストマネージャを返します。こ" "れは基本的に以下と等価です::" -#: ../../library/contextlib.rst:164 msgid "" "from contextlib import contextmanager\n" "\n" @@ -306,6 +346,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 +361,6 @@ msgstr "" "そして、明示的に ``page`` を close する必要なしに、次のように書くことができま" "す::" -#: ../../library/contextlib.rst:175 msgid "" "from contextlib import closing\n" "from urllib.request import urlopen\n" @@ -322,23 +369,35 @@ 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 "" "without needing to explicitly close ``page``. Even if an error occurs, " "``page.close()`` will be called when the :keyword:`with` block is exited." msgstr "" -"``page`` を明示的に close する必要は無く、エラーが発生した場合でも、 :" -"keyword:`with` ブロックを出るときに ``page.close()`` が呼ばれます。" +"``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, :" -"func:`!closing` is most useful for third party types that don't support " -"context managers. This example is purely for illustration purposes, as :func:" -"`~urllib.request.urlopen` would normally be used in a context manager." -msgstr "" +"which closes *thing* on leaving the :keyword:`with` statement. As " +"such, :func:`!closing` is most useful for third party types that don't " +"support 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 +407,6 @@ msgstr "" "ブロックの完了時に *thing* の ``aclose()`` メソッドを呼び出すような非同期コン" "テキストマネージャを返します。これは基本的に以下と等価です::" -#: ../../library/contextlib.rst:199 msgid "" "from contextlib import asynccontextmanager\n" "\n" @@ -359,6 +417,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 +436,6 @@ msgstr "" "ロックが終了した場合に、 ``aclosing()`` は非同期ジェネレータの決定論的なク" "リーンアップをサポートすることです::" -#: ../../library/contextlib.rst:212 msgid "" "from contextlib import aclosing\n" "\n" @@ -379,6 +444,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 +474,6 @@ msgstr "" "テキストマネージャに対する、選択可能な代役として使われることが意図されていま" "す::" -#: ../../library/contextlib.rst:235 msgid "" "def myfunction(arg, ignore_exceptions=False):\n" " if ignore_exceptions:\n" @@ -415,12 +485,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 +511,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 +530,6 @@ msgstr "" ":ref:`非同期コンテキストマネージャ ` の代役として使う" "こともできます::" -#: ../../library/contextlib.rst:261 msgid "" "async def send_http(session=None):\n" " if not session:\n" @@ -455,6 +542,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 +584,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/contextlib.rst:293 msgid "" "from contextlib import suppress\n" "\n" @@ -497,12 +593,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 +616,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,20 +633,25 @@ 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 " -"exceptions of the group which are not suppressed are re-raised in a new " -"group which is created using the original group's :meth:`~BaseExceptionGroup." -"derive` method." +"If the code within the :keyword:`!with` block raises " +"a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the " +"group. Any exceptions of the group which are not suppressed are re-raised " +"in a new 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`." +"``suppress`` now supports suppressing exceptions raised as part of " +"a :exc:`BaseExceptionGroup`." msgstr "" +"``suppress`` は、:exc:`BaseExceptionGroup` の一部として送出された例外の抑制を" +"サポートするようになりました。" #: ../../library/contextlib.rst:329 msgid "" @@ -556,22 +672,24 @@ msgstr "" #: ../../library/contextlib.rst:335 msgid "" "For example, the output of :func:`help` normally is sent to *sys.stdout*. " -"You can capture that output in a string by redirecting the output to an :" -"class:`io.StringIO` object. The replacement stream is returned from the " -"``__enter__`` method and so is available as the target of the :keyword:" -"`with` statement::" +"You can capture that output in a string by redirecting the output to " +"an :class:`io.StringIO` object. The replacement stream is returned from the " +"``__enter__`` method and so is available as the target of " +"the :keyword:`with` statement::" msgstr "" "たとえば、 :func:`help` の出力は通常標準出力 (*sys.stdout*) に送られます。出" "力される文字列を :class:`io.StringIO` オブジェクトにリダイレクトすることに" "よって捕捉することができます。代替の出力ストリームは ``__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 +699,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 +714,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 "" @@ -615,11 +736,12 @@ msgstr "" #: ../../library/contextlib.rst:369 msgid "" -"Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys." -"stderr` to another file or file-like object." +"Similar to :func:`~contextlib.redirect_stdout` but " +"redirecting :data:`sys.stderr` to another file or file-like object." msgstr "" -":func:`~contextlib.redirect_stdout` と同じですが、標準エラー出力 (:data:`sys." -"stderr`) を別のファイルや file-like オブジェクトにリダイレクトします。" +":func:`~contextlib.redirect_stdout` と同じですが、標準エラー出力 " +"(:data:`sys.stderr`) を別のファイルや file-like オブジェクトにリダイレクトし" +"ます。" #: ../../library/contextlib.rst:379 msgid "" @@ -675,7 +797,6 @@ msgstr "" msgid "Example of ``ContextDecorator``::" msgstr "``ContextDecorator`` の例::" -#: ../../library/contextlib.rst:407 msgid "" "from contextlib import ContextDecorator\n" "\n" @@ -688,12 +809,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 +841,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 +900,6 @@ msgstr "" "すでに基底クラスを持っているコンテキストマネージャーも、``ContextDecorator`` " "を mixin クラスとして利用することで拡張できます::" -#: ../../library/contextlib.rst:454 msgid "" "from contextlib import ContextDecorator\n" "\n" @@ -762,6 +910,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 +939,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 +952,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 +983,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 +1016,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 +1023,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 "" @@ -879,10 +1066,10 @@ msgid "" "exception, then outer callbacks will be passed arguments based on that " "updated state." msgstr "" -"登録されたコールバックが登録の逆順で実行されるので、複数のネストされた :" -"keyword:`with` 文を利用するのと同じ振る舞いをします。これは例外処理にも適用さ" -"れます。内側のコールバックが例外を抑制したり置き換えたりした場合、外側のコー" -"ルバックには更新された状態に応じた引数が渡されます。" +"登録されたコールバックが登録の逆順で実行されるので、複数のネストされ" +"た :keyword:`with` 文を利用するのと同じ振る舞いをします。これは例外処理にも適" +"用されます。内側のコールバックが例外を抑制したり置き換えたりした場合、外側の" +"コールバックには更新された状態に応じた引数が渡されます。" #: ../../library/contextlib.rst:547 msgid "" @@ -895,12 +1082,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 +1108,39 @@ 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." +"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." +"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 +1191,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 +1201,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 "" @@ -1017,25 +1223,28 @@ msgstr "" #: ../../library/contextlib.rst:624 msgid "" -"An :ref:`asynchronous context manager `, similar to :" -"class:`ExitStack`, that supports combining both synchronous and asynchronous " -"context managers, as well as having coroutines for cleanup logic." +"An :ref:`asynchronous context manager `, similar " +"to :class:`ExitStack`, that supports combining both synchronous and " +"asynchronous context managers, as well as having coroutines for cleanup " +"logic." msgstr "" ":class:`ExitStack` に似た :ref:`非同期コンテキストマネージャ ` です。スタック上で同期と非同期の両方のコンテキストマネージャの組み" "合わせをサポートします。また、後処理のためのコルーチンも持っています。" -#: ../../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 +1254,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 +1282,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 +1321,6 @@ msgstr "" "場合や、いくつかのコンテキストマネージャーがオプションとなる場合に、可変数個" "のコンテキストマネージャーが必要になります::" -#: ../../library/contextlib.rst:684 msgid "" "with ExitStack() as stack:\n" " for resource in resources:\n" @@ -1115,6 +1330,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 "" @@ -1133,17 +1355,16 @@ msgstr "``__enter__`` メソッドからの例外をキャッチする" #: ../../library/contextlib.rst:700 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " -"method implementation, *without* inadvertently catching exceptions from the :" -"keyword:`with` statement body or the context manager's ``__exit__`` method. " -"By using :class:`ExitStack` the steps in the context management protocol can " -"be separated slightly in order to allow this::" +"method implementation, *without* inadvertently catching exceptions from " +"the :keyword:`with` statement body or the context manager's ``__exit__`` " +"method. By using :class:`ExitStack` the steps in the context management " +"protocol can be separated slightly in order to allow this::" msgstr "" "稀に、 ``__enter__`` メソッドからの例外を、 :keyword:`with` 文の body やコン" "テキストマネージャーの ``__exit__`` メソッドからの例外は間違えて捕まえないよ" "うに、 catch したい場合があります。 :class:`ExitStack` を使って、コンテキスト" "マネージャープロトコル内のステップを分離することができます::" -#: ../../library/contextlib.rst:706 msgid "" "stack = ExitStack()\n" "try:\n" @@ -1154,35 +1375,45 @@ 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 "" "Actually needing to do this is likely to indicate that the underlying API " -"should be providing a direct resource management interface for use with :" -"keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not all " -"APIs are well designed in that regard. When a context manager is the only " -"resource management API provided, then :class:`ExitStack` can make it easier " -"to handle various situations that can't be handled directly in a :keyword:" -"`with` statement." -msgstr "" -"実際のところ、このようなコードが必要になるのならば、利用している API 側で :" -"keyword:`try`/:keyword:`except`/:keyword:`finally` 文を使った直接的なリソース" -"管理インターフェースを提供するべきです。しかし、すべての API がそのようによく" -"設計されているとは限りません。もしコンテキストマネージャーが提供されている唯" -"一のリソース管理APIであるなら、 :class:`ExitStack` を使って :keyword:`with` " -"文を使って処理することができない様々なシチュエーションの処理をすることができ" -"ます。" +"should be providing a direct resource management interface for use " +"with :keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not " +"all APIs are well designed in that regard. When a context manager is the " +"only resource management API provided, then :class:`ExitStack` can make it " +"easier to handle various situations that can't be handled directly in " +"a :keyword:`with` statement." +msgstr "" +"実際のところ、このようなコードが必要になるのならば、利用している API 側" +"で :keyword:`try`/:keyword:`except`/:keyword:`finally` 文を使った直接的なリ" +"ソース管理インターフェースを提供するべきです。しかし、すべての API がそのよう" +"によく設計されているとは限りません。もしコンテキストマネージャーが提供されて" +"いる唯一のリソース管理APIであるなら、 :class:`ExitStack` を使っ" +"て :keyword:`with` 文を使って処理することができない様々なシチュエーションの処" +"理をすることができます。" #: ../../library/contextlib.rst:725 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." +"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 +1425,6 @@ msgstr "" "数を受け取るコンテキストマネージャーで、この方法を使ってコンテキストマネー" "ジャープロトコルを提供しています::" -#: ../../library/contextlib.rst:735 msgid "" "from contextlib import contextmanager, AbstractContextManager, ExitStack\n" "\n" @@ -1231,6 +1461,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 +1512,6 @@ msgstr "" "に ``except`` 句を使うだけでは処理できない) ケースでは次のようなコードになり" "ます::" -#: ../../library/contextlib.rst:778 msgid "" "cleanup_needed = True\n" "try:\n" @@ -1259,6 +1522,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 +1549,6 @@ msgstr "" ":class:`ExitStack` を使えば、代わりに ``with`` 文の終わりに実行されるコール" "バックを登録し、後でそのコールバックをスキップするかどうかを決定できます::" -#: ../../library/contextlib.rst:795 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1288,12 +1558,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 +1581,6 @@ msgstr "" "もしあるアプリケーションがこのパターンを多用するのであれば、小さいヘルパーク" "ラスを導入してよりシンプルにすることができます::" -#: ../../library/contextlib.rst:809 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1320,18 +1597,31 @@ 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 "" "If the resource cleanup isn't already neatly bundled into a standalone " -"function, then it is still possible to use the decorator form of :meth:" -"`ExitStack.callback` to declare the resource cleanup in advance::" +"function, then it is still possible to use the decorator form " +"of :meth:`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -"もしリソースのクリーンアップが単体の関数にまとまってない場合でも、 :meth:" -"`ExitStack.callback` のデコレーター形式を利用してリソース開放処理を宣言するこ" -"とができます::" +"もしリソースのクリーンアップが単体の関数にまとまってない場合で" +"も、 :meth:`ExitStack.callback` のデコレーター形式を利用してリソース開放処理" +"を宣言することができます::" -#: ../../library/contextlib.rst:829 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1343,6 +1633,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 +1678,6 @@ msgstr "" "ネージャーを別々に書く代わりに、 :class:`ContextDecorator` を継承すると1つの" "定義で両方の機能を提供できます::" -#: ../../library/contextlib.rst:856 msgid "" "from contextlib import ContextDecorator\n" "import logging\n" @@ -1396,37 +1694,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." +"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 +1853,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 +1869,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 "" @@ -1564,8 +1897,8 @@ msgstr "" msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " -"as it makes a global modification to the system state by binding :data:`sys." -"stdout` to a different stream." +"as it makes a global modification to the system state by " +"binding :data:`sys.stdout` to a different stream." msgstr "" "リエントラントであることはスレッドセーフであることと同じ *ではない* ことには" "注意が必要です。たとえば :func:`redirect_stdout` は、 :data:`sys.stdout` を異" @@ -1576,7 +1909,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,32 +1920,34 @@ msgstr "" "単回使用のコンテキストマネージャとリエントラントなコンテキストマネージャのい" "ずれとも異なるタイプに \"再利用可能\" なコンテキストマネージャがあります (あ" "るいは、より明確には、\"再利用可能だがリエントラントでない\" コンテキストマ" -"ネージャです。リエントラントなコンテキストマネージャもまた再利用可能だからで" -"す)。再利用可能なコンテキストマネージャは複数回利用をサポートしますが、同じコ" -"ンテキストマネージャのインスタンスがすでに with 文で使われている場合には失敗" -"します (もしくは正しく動作しません)。" +"ネージャです。\n" +"リエントラントなコンテキストマネージャもまた再利用可能だからです)。\n" +"再利用可能なコンテキストマネージャは複数回利用をサポートしますが、同じコンテ" +"キストマネージャのインスタンスが外側の with 文ですでに使用中の場合には失敗し" +"ます (もしくは正しく動作しません)。" #: ../../library/contextlib.rst:990 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " -"context manager (for a reentrant lock, it is necessary to use :class:" -"`threading.RLock` instead)." +"context manager (for a reentrant lock, it is necessary to " +"use :class:`threading.RLock` instead)." msgstr "" ":class:`threading.Lock` は再利用可能だがリエントラントでないコンテキストマ" "ネージャの例です (リエントラントなロックのためには :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::" +"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 +1975,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 +2020,6 @@ msgstr "" "ひとつの :class:`ExitStack` インスタンスを再利用する代わりに複数のインスタン" "スを使うことにより、この問題は回避することができます::" -#: ../../library/contextlib.rst:1033 msgid "" ">>> from contextlib import ExitStack\n" ">>> with ExitStack() as outer_stack:\n" @@ -1676,3 +2034,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..fe7631728 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 @@ -41,16 +41,18 @@ msgstr "" "めの API を提供します。\n" ":class:`~contextvars.ContextVar` クラスは *コンテキスト変数* を宣言し、取り扱" "うために使われます。\n" -"非同期フレームワークで現時点のコンテキストを管理するのには、 :func:" -"`~contextvars.copy_context` 関数と :class:`~contextvars.Context` クラスを使う" -"べきです。" +"非同期フレームワークで現時点のコンテキストを管理するのに" +"は、 :func:`~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." +"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 "" @@ -77,9 +78,9 @@ msgstr "必須のパラメータの *name* は内観やデバッグの目的で #: ../../library/contextvars.rst:38 msgid "" -"The optional keyword-only *default* parameter is returned by :meth:" -"`ContextVar.get` when no value for the variable is found in the current " -"context." +"The optional keyword-only *default* parameter is returned " +"by :meth:`ContextVar.get` when no value for the variable is found in the " +"current context." msgstr "" "オプションのキーワード専用引数 *default* は、現在のコンテキストにその変数の値" "が見付からなかったときに :meth:`ContextVar.get` から返されます。" @@ -144,13 +145,14 @@ msgid "" "Returns a :class:`~contextvars.Token` object that can be used to restore the " "variable to its previous value via the :meth:`ContextVar.reset` method." msgstr "" -":class:`~contextvars.Token` オブジェクトを返します。このオブジェクトを :meth:" -"`ContextVar.reset` メソッドに渡すことで、以前の値に戻すことができます。" +":class:`~contextvars.Token` オブジェクトを返します。このオブジェクト" +"を :meth:`ContextVar.reset` メソッドに渡すことで、以前の値に戻すことができま" +"す。" #: ../../library/contextvars.rst:82 msgid "" -"Reset the context variable to the value it had before the :meth:`ContextVar." -"set` that created the *token* was used." +"Reset the context variable to the value it had before " +"the :meth:`ContextVar.set` that created the *token* was used." msgstr "" "コンテキスト変数の値を、 *token* を生成した :meth:`ContextVar.set` が呼び出さ" "れる前の値にリセットします。" @@ -159,7 +161,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/contextvars.rst:87 msgid "" "var = ContextVar('var')\n" "\n" @@ -170,6 +171,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 "" @@ -184,11 +194,10 @@ msgstr "" #: ../../library/contextvars.rst:104 msgid "" "The token supports :ref:`context manager protocol ` to " -"restore the corresponding context variable value at the exit from :keyword:" -"`with` block::" +"restore the corresponding context variable value at the exit " +"from :keyword:`with` block::" msgstr "" -#: ../../library/contextvars.rst:108 msgid "" "var = ContextVar('var', default='default value')\n" "\n" @@ -197,10 +206,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 "" @@ -212,9 +226,9 @@ msgstr "" #: ../../library/contextvars.rst:126 msgid "" -"A read-only property. Set to the value the variable had before the :meth:" -"`ContextVar.set` method call that created the token. It points to :attr:" -"`Token.MISSING` if the variable was not set before the call." +"A read-only property. Set to the value the variable had before " +"the :meth:`ContextVar.set` method call that created the token. It points " +"to :attr:`Token.MISSING` if the variable was not set before the call." msgstr "" "読み出し専用のプロパティです。このトークンを作成した :meth:`ContextVar.set` " "メソッドの呼び出しの前に持っていた値に設定されています。もし呼び出しの前に値" @@ -240,11 +254,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 +270,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 +281,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 " +"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 +342,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 +400,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 +488,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..6e9e6ce4d 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 "" @@ -149,8 +148,8 @@ msgid "" "This module does not copy types like module, method, stack trace, stack " "frame, file, socket, window, or any similar types. It does \"copy\" " "functions and classes (shallow and deeply), by returning the original object " -"unchanged; this is compatible with the way these are treated by the :mod:" -"`pickle` module." +"unchanged; this is compatible with the way these are treated by " +"the :mod:`pickle` module." msgstr "" "このモジュールでは、モジュール、メソッド、スタックトレース、スタックフレー" "ム、ファイル、ソケット、ウィンドウ、その他これらに類似の型をコピーしません。" @@ -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__`." +"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..d763c555d 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 @@ -61,13 +61,14 @@ msgstr "" msgid "" "Declares that *function* should be used as a \"reduction\" function for " "objects of type *type*. *function* must return either a string or a tuple " -"containing between two and six elements. See the :attr:`~pickle.Pickler." -"dispatch_table` for more details on the interface of *function*." +"containing between two and six elements. See " +"the :attr:`~pickle.Pickler.dispatch_table` for more details on the interface " +"of *function*." msgstr "" "*function* が型 *type* のオブジェクトに対する\"リダクション\"関数として使われ" "るように宣言します。 *function* は文字列か、2要素から6要素を含んだタプルを返" -"さなければなりません。 *function* のインターフェースについての詳細は :attr:" -"`~pickle.Pickler.dispatch_table` を参照してください。" +"さなければなりません。 *function* のインターフェースについての詳細" +"は :attr:`~pickle.Pickler.dispatch_table` を参照してください。" #: ../../library/copyreg.rst:35 msgid "" @@ -83,9 +84,9 @@ msgid "" "object or subclass of :class:`pickle.Pickler` can also be used for declaring " "reduction functions." msgstr "" -"pickler オブジェクトまたは :class:`pickle.Pickler` のサブクラスの :attr:" -"`~pickle.Pickler.dispatch_table` 属性を、リダクション関数の宣言のために使うこ" -"ともできるということは覚えておいてください。" +"pickler オブジェクトまたは :class:`pickle.Pickler` のサブクラス" +"の :attr:`~pickle.Pickler.dispatch_table` 属性を、リダクション関数の宣言のた" +"めに使うこともできるということは覚えておいてください。" #: ../../library/copyreg.rst:43 msgid "Example" diff --git a/library/crypt.po b/library/crypt.po index 0a7fdb541..672b20e9e 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -12,33 +12,37 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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 "" "Applications can use the :mod:`hashlib` module from the standard library. " -"Other possible replacements are third-party libraries from PyPI: :pypi:" -"`legacycrypt`, :pypi:`bcrypt`, :pypi:`argon2-cffi`, or :pypi:`passlib`. " -"These are not supported or maintained by the Python core team." +"Other possible replacements are third-party libraries from " +"PyPI: :pypi:`legacycrypt`, :pypi:`bcrypt`, :pypi:`argon2-cffi`, " +"or :pypi:`passlib`. 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..d1cd3e96a 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 @@ -84,9 +84,9 @@ msgid "" "form using the :class:`DictReader` and :class:`DictWriter` classes." msgstr "" ":mod:`csv` モジュールの :class:`reader` および :class:`writer` オブジェクトは" -"シーケンス型を読み書きします。プログラマは :class:`DictReader` や :class:" -"`DictWriter` クラスを使うことで、データを辞書形式で読み書きすることもできま" -"す。" +"シーケンス型を読み書きします。プログラマは :class:`DictReader` " +"や :class:`DictWriter` クラスを使うことで、データを辞書形式で読み書きすること" +"もできます。" #: ../../library/csv.rst:41 msgid ":pep:`305` - CSV File API" @@ -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 "" @@ -156,12 +176,12 @@ msgid "" "object with a :meth:`~io.TextIOBase.write` method. If *csvfile* is a file " "object, it should be opened with ``newline=''`` [1]_. An optional *dialect* " "parameter can be given which is used to define a set of parameters specific " -"to a particular CSV dialect. It may be an instance of a subclass of the :" -"class:`Dialect` class or one of the strings returned by the :func:" -"`list_dialects` function. The other optional *fmtparams* keyword arguments " -"can be given to override individual formatting parameters in the current " -"dialect. For full details about dialects and formatting parameters, see " -"the :ref:`csv-fmt-params` section. To make it as easy as possible to " +"to a particular CSV dialect. It may be an instance of a subclass of " +"the :class:`Dialect` class or one of the strings returned by " +"the :func:`list_dialects` function. The other optional *fmtparams* keyword " +"arguments can be given to override individual formatting parameters in the " +"current dialect. For full details about dialects and formatting parameters, " +"see the :ref:`csv-fmt-params` section. To make it as easy as possible to " "interface with modules which implement the DB API, the value :const:`None` " "is written as the empty string. While this isn't a reversible " "transformation, it makes it easier to dump SQL NULL data values to CSV files " @@ -169,23 +189,22 @@ msgid "" "other non-string data are stringified with :func:`str` before being written." msgstr "" "ユーザが与えたデータをデリミタで区切られた文字列に変換し、与えられたファイル" -"オブジェクトに書き込むための writer オブジェクトを返します。 *csvfile* は :" -"meth:`~io.TextIOBase.write` メソッドを持つ任意のオブジェクトです。 *csvfile* " -"がファイルオブジェクトの場合、 ``newline=''`` として開くべきです [1]_ 。オプ" -"ションとして *dialect* 引数を与えることができ、利用するCSV表現形式(dialect)を" -"指定することができます。 *dialect* パラメータは :class:`Dialect` クラスのサブ" -"クラスのインスタンスか、 :func:`list_dialects` 関数が返す文字列の1つにするこ" -"とができます。別のオプション引数である *fmtparams* キーワード引数は、現在の表" -"現形式における個々の書式パラメータを上書きするために与えることができます。" -"dialect と書式パラメータについての詳細は、 :ref:`csv-fmt-params` 節を参照して" -"ください。 DB API を実装するモジュールとのインターフェースを可能な限り容易に" -"するために、 :const:`None` は空文字列として書き込まれます。この処理は可逆な変" -"換ではありませんが、SQL で NULL データ値を CSV にダンプする処理を、 ``cursor." -"fetch*`` 呼び出しによって返されたデータを前処理することなく簡単に行うことがで" -"きます。他の非文字列データは、書き出される前に :func:`str` を使って文字列に変" -"換されます。" - -#: ../../library/csv.rst:108 +"オブジェクトに書き込むための writer オブジェクトを返します。 *csvfile* " +"は :meth:`~io.TextIOBase.write` メソッドを持つ任意のオブジェクトです。 " +"*csvfile* がファイルオブジェクトの場合、 ``newline=''`` として開くべきです " +"[1]_ 。オプションとして *dialect* 引数を与えることができ、利用するCSV表現形式" +"(dialect)を指定することができます。 *dialect* パラメータは :class:`Dialect` " +"クラスのサブクラスのインスタンスか、 :func:`list_dialects` 関数が返す文字列の" +"1つにすることができます。別のオプション引数である *fmtparams* キーワード引数" +"は、現在の表現形式における個々の書式パラメータを上書きするために与えることが" +"できます。dialect と書式パラメータについての詳細は、 :ref:`csv-fmt-params` 節" +"を参照してください。 DB API を実装するモジュールとのインターフェースを可能な" +"限り容易にするために、 :const:`None` は空文字列として書き込まれます。この処理" +"は可逆な変換ではありませんが、SQL で NULL データ値を CSV にダンプする処理" +"を、 ``cursor.fetch*`` 呼び出しによって返されたデータを前処理することなく簡単" +"に行うことができます。他の非文字列データは、書き出される前に :func:`str` を" +"使って文字列に変換されます。" + 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 "" @@ -211,8 +236,8 @@ msgstr "" #: ../../library/csv.rst:127 msgid "" -"Delete the dialect associated with *name* from the dialect registry. An :" -"exc:`Error` is raised if *name* is not a registered dialect name." +"Delete the dialect associated with *name* from the dialect registry. " +"An :exc:`Error` is raised if *name* is not a registered dialect name." msgstr "" "*name* に関連づけられた表現形式を表現形式レジストリから削除します。 *name* が" "表現形式名でない場合には :exc:`Error` を送出します。" @@ -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 "" @@ -278,11 +308,11 @@ msgstr "" #: ../../library/csv.rst:170 msgid "" -"All other optional or keyword arguments are passed to the underlying :class:" -"`reader` instance." +"All other optional or keyword arguments are passed to the " +"underlying :class:`reader` instance." msgstr "" -"その他の省略可能またはキーワード形式のパラメータは、ベースになっている :" -"class:`reader` インスタンスに渡されます。" +"その他の省略可能またはキーワード形式のパラメータは、ベースになってい" +"る :class:`reader` インスタンスに渡されます。" #: ../../library/csv.rst:173 ../../library/csv.rst:217 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 " @@ -325,21 +364,26 @@ msgid "" "written if the dictionary is missing a key in *fieldnames*. If the " "dictionary passed to the :meth:`~csvwriter.writerow` method contains a key " "not found in *fieldnames*, the optional *extrasaction* parameter indicates " -"what action to take. If it is set to ``'raise'``, the default value, a :exc:" -"`ValueError` is raised. If it is set to ``'ignore'``, extra values in the " -"dictionary are ignored. Any other optional or keyword arguments are passed " -"to the underlying :class:`writer` instance." +"what action to take. If it is set to ``'raise'``, the default value, " +"a :exc:`ValueError` is raised. If it is set to ``'ignore'``, extra values in " +"the dictionary are ignored. Any other optional or keyword arguments are " +"passed 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,35 +405,51 @@ 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 "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " "to the lack of a strict CSV specification, different applications produce " -"subtly different CSV data. :class:`Dialect` instances define how :class:" -"`reader` and :class:`writer` instances behave." +"subtly different CSV data. :class:`Dialect` instances define " +"how :class:`reader` and :class:`writer` instances behave." msgstr "" ":class:`Dialect` クラスはコンテナクラスです。その属性に、ダブルクォート、空白" "文字、デリミタなどの扱い方に関する情報を含みます。CSV には厳密な規格がないた" "め、アプリケーションによって生成される CSV データはそれぞれ僅かに異なりま" -"す。 :class:`Dialect` クラスのインスタンスは :class:`reader` と :class:" -"`writer` のインスタンスの挙動を定義します。" +"す。 :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 "" @@ -437,17 +496,21 @@ msgid "" "the parameters found. If the optional *delimiters* parameter is given, it " "is interpreted as a string containing possible valid delimiter characters." msgstr "" -"与えられた *sample* を解析し、発見されたパラメータを反映した :class:" -"`Dialect` サブクラスを返します。オプションの *delimiters* パラメータを与えた" -"場合、有効なデリミタ文字を含んでいるはずの文字列として解釈されます。" +"与えられた *sample* を解析し、発見されたパラメータを反映し" +"た :class:`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:" +"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 +542,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 +549,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 +609,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,18 +656,28 @@ 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 " "dialect is a subclass of the :class:`Dialect` class containing various " -"attributes describing the format of the CSV file. When creating :class:" -"`reader` or :class:`writer` objects, the programmer can specify a string or " -"a subclass of the :class:`Dialect` class as the dialect parameter. In " -"addition to, or instead of, the *dialect* parameter, the programmer can also " -"specify individual formatting parameters, which have the same names as the " -"attributes defined below for the :class:`Dialect` class." -msgstr "" +"attributes describing the format of the CSV file. When " +"creating :class:`reader` or :class:`writer` objects, the programmer can " +"specify a string or a subclass of the :class:`Dialect` class as the dialect " +"parameter. In addition to, or instead of, the *dialect* parameter, the " +"programmer can also 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:" @@ -607,20 +693,20 @@ msgstr "" #: ../../library/csv.rst:400 msgid "" "Controls how instances of *quotechar* appearing inside a field should " -"themselves be quoted. When :const:`True`, the character is doubled. When :" -"const:`False`, the *escapechar* is used as a prefix to the *quotechar*. It " -"defaults to :const:`True`." +"themselves be quoted. When :const:`True`, the character is doubled. " +"When :const:`False`, the *escapechar* is used as a prefix to the " +"*quotechar*. It defaults to :const:`True`." msgstr "" "フィールド内に現れた *quotechar* のインスタンスで、クオートではないその文字自" -"身でなければならない文字をどのようにクオートするかを制御します。 :const:" -"`True` の場合、この文字は二重化されます。 :const:`False` の場合、 " -"*escapechar* は *quotechar* の前に置かれます。デフォルトでは :const:`True` で" -"す。" +"身でなければならない文字をどのようにクオートするかを制御しま" +"す。 :const:`True` の場合、この文字は二重化されます。 :const:`False` の場" +"合、 *escapechar* は *quotechar* の前に置かれます。デフォルトで" +"は :const:`True` です。" #: ../../library/csv.rst:405 msgid "" -"On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" -"exc:`Error` is raised if a *quotechar* is found in a field." +"On output, if *doublequote* is :const:`False` and no *escapechar* is " +"set, :exc:`Error` is raised if a *quotechar* is found in a field." msgstr "" "出力においては、 *doublequote* が :const:`False` で *escapechar* がセットされ" "ていない場合、フィールド内に *quotechar* が現れると :exc:`Error` が送出されま" @@ -708,8 +794,8 @@ msgstr "reader オブジェクト" #: ../../library/csv.rst:463 msgid "" -"Reader objects (:class:`DictReader` instances and objects returned by the :" -"func:`reader` function) have the following public methods:" +"Reader objects (:class:`DictReader` instances and objects returned by " +"the :func:`reader` function) have the following public methods:" msgstr "" "reader オブジェクト(:class:`DictReader` インスタンス、および :func:`reader` " "関数によって返されたオブジェクト) は、以下の public なメソッドを持っています:" @@ -769,14 +855,14 @@ msgid "" "problems for other programs which read CSV files (assuming they support " "complex numbers at all)." msgstr "" -":class:`writer` オブジェクト(:class:`DictWriter` インスタンス、および :func:" -"`writer` 関数によって返されたオブジェクト) は、以下の public なメソッドを持っ" -"ています: *row* には、 :class:`writer` オブジェクトの場合には文字列か数値のイ" -"テラブルを指定し、 :class:`DictWriter` オブジェクトの場合はフィールド名をキー" -"として対応する文字列か数値を格納した辞書オブジェクトを指定します(数値は :" -"func:`str` で変換されます)。複素数を出力する場合、値をかっこで囲んで出力しま" -"す。このため、CSV ファイルを読み込むアプリケーションで(そのアプリケーション" -"が複素数をサポートしていたとしても)問題が発生する場合があります。" +":class:`writer` オブジェクト(:class:`DictWriter` インスタンス、およ" +"び :func:`writer` 関数によって返されたオブジェクト) は、以下の public なメ" +"ソッドを持っています: *row* には、 :class:`writer` オブジェクトの場合には文字" +"列か数値のイテラブルを指定し、 :class:`DictWriter` オブジェクトの場合はフィー" +"ルド名をキーとして対応する文字列か数値を格納した辞書オブジェクトを指定します" +"(数値は :func:`str` で変換されます)。複素数を出力する場合、値をかっこで囲んで" +"出力します。このため、CSV ファイルを読み込むアプリケーションで(そのアプリ" +"ケーションが複素数をサポートしていたとしても)問題が発生する場合があります。" #: ../../library/csv.rst:511 msgid "" @@ -813,17 +899,19 @@ 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 "" -":meth:`writeheader` now also returns the value returned by the :meth:" -"`csvwriter.writerow` method it uses internally." +":meth:`writeheader` now also returns the value returned by " +"the :meth:`csvwriter.writerow` method it uses internally." msgstr "" ":meth:`writeheader` は内部的に利用している :meth:`csvwriter.writerow` メソッ" "ドの返り値を返すようになりました。" @@ -836,7 +924,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 +931,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,30 +948,38 @@ 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 "" "Since :func:`open` is used to open a CSV file for reading, the file will by " -"default be decoded into unicode using the system default encoding (see :func:" -"`locale.getencoding`). To decode a file using a different encoding, use the " -"``encoding`` argument of open::" +"default be decoded into unicode using the system default encoding " +"(see :func:`locale.getencoding`). To decode a file using a different " +"encoding, use the ``encoding`` argument of open::" msgstr "" ":func:`open` が CSV ファイルの読み込みに使われるため、ファイルはデフォルトで" -"はシステムのデフォルトエンコーディングでユニコード文字列にデコードされます (:" -"func:`locale.getencoding` を参照)。他のエンコーディングを用いてデコードするに" -"は、open の引数 ``encoding`` を設定して、以下のようにします::" +"はシステムのデフォルトエンコーディングでユニコード文字列にデコードされます " +"(:func:`locale.getencoding` を参照)。他のエンコーディングを用いてデコードする" +"には、open の引数 ``encoding`` を設定して、以下のようにします::" #: ../../library/csv.rst:580 msgid "" @@ -903,13 +1002,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 +1040,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" @@ -954,8 +1058,8 @@ msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " "will not be interpreted correctly, and on platforms that use ``\\r\\n`` " "linendings on write an extra ``\\r`` will be added. It should always be " -"safe to specify ``newline=''``, since the csv module does its own (:term:" -"`universal `) newline handling." +"safe to specify ``newline=''``, since the csv module does its own " +"(:term:`universal `) newline handling." msgstr "" "``newline=''`` が指定されない場合、クォートされたフィールド内の改行は適切に解" "釈されず、書き込み時に ``\\r\\n`` を行末に用いる処理系では余分な ``\\r`` が追" diff --git a/library/ctypes.po b/library/ctypes.po index 5d58f5114..a24e38dc5 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 @@ -62,9 +62,10 @@ msgstr "" #: ../../library/ctypes.rst:27 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " -"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" -"`c_long`. So, you should not be confused if :class:`c_long` is printed if " -"you would expect :class:`c_int` --- they are actually the same type." +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " +"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " +"printed if you would expect :class:`c_int` --- they are actually the same " +"type." msgstr "" "注意: いくつかのコードサンプルで ctypes の :class:`c_int` 型を参照していま" "す。 ``sizeof(long) == sizeof(int)`` であるようなプラットフォームでは、この型" @@ -98,20 +99,21 @@ msgstr "" #: ../../library/ctypes.rst:48 msgid "" -"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" -"exc:`OSError`." +"Windows errors used to raise :exc:`WindowsError`, which is now an alias " +"of :exc:`OSError`." 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 +123,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 +156,6 @@ msgid "" "CDLL by calling the constructor::" msgstr "" -#: ../../library/ctypes.rst:79 msgid "" ">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" @@ -156,6 +164,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 +179,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 +192,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 +213,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 "" @@ -213,19 +247,21 @@ msgstr "" #: ../../library/ctypes.rst:125 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " -"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" -"`getattr` to retrieve the function::" +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " +"use :func:`getattr` to retrieve the function::" msgstr "" "時には、 dll が関数を ``\"??2@YAPAXI@Z\"`` のような Python 識別子として有効で" "ない名前でエクスポートすることがあります。このような場合に関数を取り出すに" "は、 :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 +273,6 @@ msgstr "" "こうした関数には序数を使って dll オブジェクトにインデックス指定することでアク" "セスします::" -#: ../../library/ctypes.rst:136 msgid "" ">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" @@ -249,45 +284,61 @@ 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 "" ":exc:`ValueError` is raised when you call an ``stdcall`` function with the " "``cdecl`` calling convention, or vice versa::" msgstr "" -"``cdecl`` 呼び出し規約を使って ``stdcall`` 関数を呼び出したときには、 :exc:" -"`ValueError` が送出されます。逆の場合も同様です::" +"``cdecl`` 呼び出し規約を使って ``stdcall`` 関数を呼び出したときに" +"は、 :exc:`ValueError` が送出されます。逆の場合も同様です::" #: ../../library/ctypes.rst:168 msgid "" @@ -323,7 +374,6 @@ msgstr "" "Windows では、関数が無効な引数とともに呼び出された場合の一般保護例外によるク" "ラッシュを防ぐために、 :mod:`ctypes` は win32 構造化例外処理を使います::" -#: ../../library/ctypes.rst:187 msgid "" ">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" @@ -331,6 +381,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,16 +399,22 @@ 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 " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " -"are passed as pointer to the memory block that contains their data (:c:expr:" -"`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platform's default C :c:expr:`int` type, their value is masked to fit into " -"the C type." -msgstr "" +"are passed as pointer to the memory block that contains their data " +"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " +"the 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 +451,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 +583,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 +658,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 +697,6 @@ msgstr "" "これら全ての型はその型を呼び出すことによって作成でき、オプションとして型と値" "が合っている初期化子を指定することができます::" -#: ../../library/ctypes.rst:286 msgid "" ">>> c_int()\n" "c_long(0)\n" @@ -653,13 +706,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 +730,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)::" +"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 "" @@ -701,11 +772,11 @@ msgstr "" #: ../../library/ctypes.rst:326 msgid "" "You should be careful, however, not to pass them to functions expecting " -"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" -"func:`create_string_buffer` function which creates these in various ways. " -"The current memory block contents can be accessed (or changed) with the " -"``raw`` property; if you want to access it as NUL terminated string, use the " -"``value`` property::" +"pointers to mutable memory. If you need mutable memory blocks, ctypes has " +"a :func:`create_string_buffer` function which creates these in various " +"ways. The current memory block contents can be accessed (or changed) with " +"the ``raw`` property; if you want to access it as NUL terminated string, use " +"the ``value`` property::" msgstr "" "しかし、変更可能なメモリを指すポインタであることを想定している関数へそれらを" "渡さないように注意すべきです。もし変更可能なメモリブロックが必要なら、 " @@ -714,7 +785,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 +805,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" @@ -750,15 +842,14 @@ msgstr "続・関数を呼び出す" #: ../../library/ctypes.rst:361 msgid "" -"Note that printf prints to the real standard output channel, *not* to :data:" -"`sys.stdout`, so these examples will only work at the console prompt, not " -"from within *IDLE* or *PythonWin*::" +"Note that printf prints to the real standard output channel, *not* " +"to :data:`sys.stdout`, so these examples will only work at the console " +"prompt, not from within *IDLE* or *PythonWin*::" msgstr "" "printf は :data:`sys.stdout` では *なく* 、本物の標準出力チャンネルへプリント" "することに注意してください。したがって、これらの例はコンソールプロンプトでの" "み動作し、 *IDLE* や *PythonWin* では動作しません。::" -#: ../../library/ctypes.rst:365 msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -777,6 +868,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 "" @@ -785,22 +892,23 @@ msgid "" "so that they can be converted to the required C data type::" msgstr "" "前に述べたように、必要な C のデータ型へ変換できるようにするためには、整数、文" -"字列およびバイト列オブジェクトを除くすべての Python 型を対応する :mod:" -"`ctypes` 型でラップしなければなりません::" +"字列およびバイト列オブジェクトを除くすべての 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 +916,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 +951,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 +962,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 +983,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 +997,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 +1008,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 +1023,6 @@ msgstr "" "(C の関数のプロトタイプのように) 書式を指定すると互換性のない引数型になるのを" "防ぎ、引数を有効な型へ変換しようとします。::" -#: ../../library/ctypes.rst:459 msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -907,18 +1034,27 @@ 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 "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" -"`~_CData.from_param` class method receives the Python object passed to the " -"function call, it should do a typecheck or whatever is needed to make sure " -"this object is acceptable, and then return the object itself, its :attr:`!" -"_as_parameter_` attribute, or whatever you want to pass as the C function " -"argument in this case. Again, the result should be an integer, string, " -"bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " +"The :meth:`~_CData.from_param` class method receives the Python object " +"passed to the function call, it should do a typecheck or whatever is needed " +"to make sure this object is acceptable, and then return the object itself, " +"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " +"function argument in this case. Again, the result should be an integer, " +"string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" "_as_parameter_` attribute." msgstr "" @@ -926,51 +1062,55 @@ 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::" +"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 +1122,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 +1157,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 +1179,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 +1203,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 +1232,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)" @@ -1075,10 +1260,10 @@ msgstr "" #: ../../library/ctypes.rst:585 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " -"parameters by reference. The same effect can be achieved with the :func:" -"`pointer` function, although :func:`pointer` does a lot more work since it " -"constructs a real pointer object, so it is faster to use :func:`byref` if " -"you don't need the pointer object in Python itself::" +"parameters by reference. The same effect can be achieved with " +"the :func:`pointer` function, although :func:`pointer` does a lot more work " +"since it constructs a real pointer object, so it is faster to " +"use :func:`byref` if you don't need the pointer object in Python itself::" msgstr "" ":mod:`ctypes` は :func:`byref` 関数をエクスポートしており、パラメータを参照渡" "しするために使用します。 :func:`pointer` 関数を使っても同じ効果が得られます。" @@ -1086,7 +1271,6 @@ msgstr "" "処理を行うことから、 Python 側でポインタオブジェクト自体を必要としないなら" "ば :func:`byref` を使う方がより高速です。::" -#: ../../library/ctypes.rst:591 msgid "" ">>> i = c_int()\n" ">>> f = c_float()\n" @@ -1100,6 +1284,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" @@ -1107,11 +1302,11 @@ msgstr "構造体と共用体" #: ../../library/ctypes.rst:609 msgid "" -"Structures and unions must derive from the :class:`Structure` and :class:" -"`Union` base classes which are defined in the :mod:`ctypes` module. Each " -"subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!" -"_fields_` must be a list of *2-tuples*, containing a *field name* and a " -"*field type*." +"Structures and unions must derive from the :class:`Structure` " +"and :class:`Union` base classes which are defined in the :mod:`ctypes` " +"module. Each subclass must define a :attr:`~Structure._fields_` " +"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " +"*field name* and a *field type*." msgstr "" #: ../../library/ctypes.rst:614 @@ -1131,7 +1326,6 @@ msgstr "" "以下は、 *x* と *y* という名前の二つの整数からなる簡単な POINT 構造体の例で" "す。コンストラクタで構造体を初期化する方法も説明しています::" -#: ../../library/ctypes.rst:620 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1150,6 +1344,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 +1377,6 @@ msgstr "" "*upperleft* と *lowerright* という名前の二つの POINT を持つ RECT 構造体で" "す。::" -#: ../../library/ctypes.rst:643 msgid "" ">>> class RECT(Structure):\n" "... _fields_ = [(\"upperleft\", POINT),\n" @@ -1180,6 +1389,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 +1408,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`::" +"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 +1431,11 @@ msgid "" "\n" ">>>" msgstr "" +">>> POINT.x\n" +"\n" +">>> POINT.y\n" +"\n" +">>>" #: ../../library/ctypes.rst:674 msgid "" @@ -1222,17 +1448,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 "" @@ -1252,27 +1481,29 @@ msgstr "" #: ../../library/ctypes.rst:696 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " -"build structures with non-native byte order, you can use one of the :class:" -"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" -"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " -"classes cannot contain pointer fields." +"build structures with non-native byte order, you can use one of " +"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " +"and :class:`LittleEndianUnion` base classes. These classes cannot contain " +"pointer fields." msgstr "" ":mod:`ctypes` は Structure と Union に対してネイティブのバイトオーダーを使い" -"ます。ネイティブではないバイトオーダーの構造体を作成するには、 :class:" -"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" -"`BigEndianUnion` および :class:`LittleEndianUnion` ベースクラスの中の一つを使" -"います。これらのクラスにポインタフィールドを持たせることはできません。" +"ます。ネイティブではないバイトオーダーの構造体を作成するに" +"は、 :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion` " +"および :class:`LittleEndianUnion` ベースクラスの中の一つを使います。これらの" +"クラスにポインタフィールドを持たせることはできません。" #: ../../library/ctypes.rst:706 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 +1535,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 +1546,6 @@ msgstr "" "ややわざとらしいデータ型の例になりますが、他のものに混ざって 4 個の POINT が" "ある構造体です::" -#: ../../library/ctypes.rst:738 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1331,17 +1560,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 +1598,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 +1609,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" @@ -1374,19 +1625,22 @@ msgstr "ポインタ" #: ../../library/ctypes.rst:778 msgid "" -"Pointer instances are created by calling the :func:`pointer` function on a :" -"mod:`ctypes` type::" +"Pointer instances are created by calling the :func:`pointer` function on " +"a :mod:`ctypes` type::" 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 +1650,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 +1668,6 @@ msgstr "" "はないことに注意してください。属性を取り出す度に、新しい同等のオブジェクトを" "作成しているのです。::" -#: ../../library/ctypes.rst:796 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1420,6 +1675,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 +1690,6 @@ msgstr "" "別の :class:`c_int` インスタンスがポインタの contents 属性に代入されると、こ" "れが記憶されているメモリ位置を指すポインタに変化します。::" -#: ../../library/ctypes.rst:805 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1438,23 +1697,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 +1728,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 +1761,6 @@ msgstr "" "は任意の :mod:`ctypes` 型を受け取る :func:`POINTER` 関数を使って行われ、新し" "い型を返します::" -#: ../../library/ctypes.rst:840 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1503,6 +1773,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 +1792,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 +1812,6 @@ msgstr "" "(しかし、 ``NULL`` でない不正なポインタの指す値の取り出す行為は Python をク" "ラッシュさせるでしょう)。::" -#: ../../library/ctypes.rst:862 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1543,10 +1825,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,21 +1847,28 @@ 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 " "to across multiple threads, but only if ``pointer_b`` is not also attempting " -"to do the same. If this is an issue, consider using a :class:`threading." -"Lock` to synchronize access to memory:" +"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 +1886,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 +1895,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 +1920,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 +1941,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 +1952,12 @@ msgstr "" "POINTER型フィールドを ``NULL`` に設定するために、 ``None`` を代入してもかまい" "ません。::" -#: ../../library/ctypes.rst:938 msgid "" ">>> bar.values = None\n" ">>>" msgstr "" +">>> bar.values = None\n" +">>>" #: ../../library/ctypes.rst:943 msgid "" @@ -1645,12 +1968,11 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" "時には、非互換な型のインスタンスであることもあります。 C では、ある型を他の型" -"へキャストすることができます。 :mod:`ctypes` は同じやり方で使える :func:" -"`cast` 関数を提供しています。上で定義した ``Bar`` 構造体は " +"へキャストすることができます。 :mod:`ctypes` は同じやり方で使え" +"る :func:`cast` 関数を提供しています。上で定義した ``Bar`` 構造体は " "``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 +1981,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 +2006,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 +2025,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 +2032,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 +2051,6 @@ msgstr "" "*不完全型* はメンバーがまだ指定されていない構造体、共用体もしくは配列です。 " "C では、前方宣言により指定され、後で定義されます。::" -#: ../../library/ctypes.rst:987 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1725,6 +2059,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 +2073,6 @@ msgid "" msgstr "" "ctypes コードへの直接的な変換ではこうなるでしょう。しかし、動作しません::" -#: ../../library/ctypes.rst:997 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -1745,16 +2084,32 @@ 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 "" "because the new ``class cell`` is not available in the class statement " -"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" -"`~Structure._fields_` attribute later, after the class statement::" +"itself. In :mod:`ctypes`, we can define the ``cell`` class and set " +"the :attr:`~Structure._fields_` attribute later, after the class statement::" +msgstr "" + +msgid "" +">>> from ctypes import *\n" +">>> class cell(Structure):\n" +"... pass\n" +"...\n" +">>> cell._fields_ = [(\"name\", c_char_p),\n" +"... (\"next\", POINTER(cell))]\n" +">>>" msgstr "" - -#: ../../library/ctypes.rst:1011 -msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" "... pass\n" @@ -1762,7 +2117,6 @@ msgid "" ">>> cell._fields_ = [(\"name\", c_char_p),\n" "... (\"next\", POINTER(cell))]\n" ">>>" -msgstr "" #: ../../library/ctypes.rst:1019 msgid "" @@ -1832,14 +2186,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 +2202,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 +2216,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 +2231,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 +2245,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 +2253,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 +2273,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 +2299,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 +2335,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 +2349,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 +2393,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,20 +2409,22 @@ 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 "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -"ポインタの使い方を説明する拡張例では、 Python がエクスポートする :c:data:" -"`PyImport_FrozenModules` ポインタにアクセスします。" +"ポインタの使い方を説明する拡張例では、 Python がエクスポートす" +"る :c:data:`PyImport_FrozenModules` ポインタにアクセスします。" #: ../../library/ctypes.rst:1171 msgid "Quoting the docs for that value:" @@ -2129,7 +2535,6 @@ msgstr "" msgid "Consider the following example::" msgstr "次に示す例について考えてみてください。::" -#: ../../library/ctypes.rst:1230 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2149,6 +2554,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 +2581,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 +2599,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 +2622,6 @@ msgid "" "this::" msgstr "期待とは違う振る舞いをする別の例はこれです::" -#: ../../library/ctypes.rst:1268 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2207,6 +2631,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 "" @@ -2250,10 +2681,9 @@ msgstr "" ":func:`resize` 関数は既存の ctypes オブジェクトのメモリバッファのサイズを変更" "したい場合に使えます。この関数は第一引数にオブジェクト、第二引数に要求された" "サイズをバイト単位で指定します。メモリブロックはオブジェクト型で指定される通" -"常のメモリブロックより小さくすることはできません。これをやろうとすると、 :" -"exc:`ValueError` が送出されます。::" +"常のメモリブロックより小さくすることはできません。これをやろうとする" +"と、 :exc:`ValueError` が送出されます。::" -#: ../../library/ctypes.rst:1301 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2269,6 +2699,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 +2723,6 @@ msgstr "" "するのでしょうか? この型は要素の数が 4 個であるとまだ認識しているので、他の要" "素にアクセスするとエラーになります。::" -#: ../../library/ctypes.rst:1319 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2290,6 +2732,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 +2818,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 +2828,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 +2844,6 @@ msgid "" "pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1390 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2401,6 +2856,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 +2883,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,22 +2948,30 @@ 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:" -"`OSError` error is raised with the message *\"[WinError 126] The specified " -"module could not be found\".* This error message does not contain the name " -"of the missing DLL because the Windows API does not return this information " -"making this error hard to diagnose. To resolve this error and determine " -"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 "" +"exists. When a dependent DLL of the loaded DLL is not found, " +"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " +"specified module could not be found\".* This error message does not contain " +"the name of the missing DLL because the Windows API does not return this " +"information making this error hard to diagnose. To resolve this error and " +"determine 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 +2989,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`." +":exc:`WindowsError` used to be raised, which is now an alias " +"of :exc:`OSError`." msgstr "" +"以前は :exc:`WindowsError` を送出していましたが、現在は :exc:`OSError` の別名" +"になっています。" #: ../../library/ctypes.rst:1489 msgid "" @@ -2538,8 +3011,8 @@ msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -"これらのライブラリがエクスポートするどの関数でも呼び出す前に Python :term:" -"`global interpreter lock` は解放され、後でまた獲得されます。" +"これらのライブラリがエクスポートするどの関数でも呼び出す前に " +"Python :term:`global interpreter lock` は解放され、後でまた獲得されます。" #: ../../library/ctypes.rst:1506 msgid "" @@ -2549,9 +3022,9 @@ msgid "" "set, a Python exception is raised." msgstr "" "Python GIL が関数呼び出しの間解放 *されず* 、関数実行の後に Python エラーフラ" -"グがチェックされるということを除けば、このクラスのインスタンスは :class:" -"`CDLL` インスタンスのように振る舞います。エラーフラグがセットされた場合、 " -"Python 例外が送出されます。" +"グがチェックされるということを除けば、このクラスのインスタンス" +"は :class:`CDLL` インスタンスのように振る舞います。エラーフラグがセットされた" +"場合、 Python 例外が送出されます。" #: ../../library/ctypes.rst:1511 msgid "Thus, this is only useful to call Python C api functions directly." @@ -2568,14 +3041,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" @@ -2584,11 +3056,12 @@ msgstr "" #: ../../library/ctypes.rst:1529 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " -"allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the system's :data:`errno` " -"variable; if you call foreign functions created with ``use_errno=True`` then " -"the :data:`errno` value before the function call is swapped with the ctypes " -"private copy, the same happens immediately after the function call." +"allows accessing the system :data:`errno` error number in a safe " +"way. :mod:`ctypes` maintains a thread-local copy of the " +"system's :data:`errno` variable; if you call foreign functions created with " +"``use_errno=True`` then the :data:`errno` value before the function call is " +"swapped with the ctypes private copy, the same happens immediately after the " +"function call." msgstr "" #: ../../library/ctypes.rst:1536 @@ -2601,14 +3074,20 @@ 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 :" -"func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` " -"and :func:`ctypes.set_last_error` are used to request and change the ctypes " -"private copy of the windows error code." -msgstr "" +"for the Windows error code which is managed by the :func:`GetLastError` " +"and :func:`!SetLastError` Windows API " +"functions; :func:`ctypes.get_last_error` 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 +3142,6 @@ msgstr "" "れると毎回同じオブジェクトを返すことに注意してください。\n" "それとは反対に、添字を通したアクセスは毎回新しいオブジェクトを返します::" -#: ../../library/ctypes.rst:1583 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2672,6 +3150,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,29 +3173,37 @@ 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 "" -"Class which loads shared libraries. *dlltype* should be one of the :class:" -"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +"Class which loads shared libraries. *dlltype* should be one of " +"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -"共有ライブラリをロードするクラス。 *dlltype* は :class:`CDLL` 、 :class:" -"`PyDLL` 、 :class:`WinDLL` もしくは :class:`OleDLL` 型の一つであるべきです。" +"共有ライブラリをロードするクラス。 *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 +3221,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 +3239,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 "" +"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)." +"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 +3289,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 +3311,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 +3346,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 +3354,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 "" @@ -2859,21 +3376,25 @@ msgstr "" #: ../../library/ctypes.rst:1735 msgid "" -"When a foreign function is called, each actual argument is passed to the :" -"meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " -"tuple, this method allows adapting the actual argument to an object that the " -"foreign function accepts. For example, a :class:`c_char_p` item in the :" -"attr:`argtypes` tuple will convert a string passed as argument into a bytes " -"object using ctypes conversion rules." +"When a foreign function is called, each actual argument is passed to " +"the :meth:`~_CData.from_param` class method of the items in " +"the :attr:`argtypes` tuple, this method allows adapting the actual argument " +"to an object that the foreign function accepts. For example, " +"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " +"passed as argument into a bytes 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 +3404,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,21 +3438,26 @@ 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 " -"a suitable Python exception. Further, an auditing event ``ctypes." -"set_exception`` with argument ``code`` will be raised, allowing an audit " -"hook to replace the exception with its own." +"a suitable Python exception. Further, an auditing event " +"``ctypes.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" @@ -2959,22 +3485,26 @@ msgstr "" msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " -"*use_errno* is set to true, the ctypes private copy of the system :data:" -"`errno` variable is exchanged with the real :data:`errno` value before and " -"after the call; *use_last_error* does the same for the Windows error code." +"*use_errno* is set to true, the ctypes private copy of the " +"system :data:`errno` variable is exchanged with the real :data:`errno` value " +"before and after the call; *use_last_error* does the same for the Windows " +"error code." msgstr "" "返された関数プロトタイプは標準 C 呼び出し規約をつかう関数を作成します。関数は" "呼び出されている間 GIL を解放します。 *use_errno* が真に設定されれば、呼び出" -"しの前後で System 変数 :data:`errno` の ctypesプライベートコピーは本当の :" -"data:`errno` の値と交換されます。 *use_last_error* も Windows エラーコードに" -"対するのと同様です。" +"しの前後で System 変数 :data:`errno` の ctypesプライベートコピーは本当" +"の :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 +3559,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 +3585,12 @@ msgstr "" "オプションの *paramflags* パラメータは上述した機能より多機能な外部関数ラッ" "パーを作成します。" -#: ../../library/ctypes.rst:1875 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." -"argtypes`." +"*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 +3642,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 +3659,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 +3678,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 +3691,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 +3711,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 +3731,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 +3751,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 +3758,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 +3772,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 +3789,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 +3799,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 +3820,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 +3849,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 +3860,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." +"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 "" @@ -3324,8 +3900,8 @@ msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -"この関数は変更可能な文字バッファを作成します。返されるオブジェクトは :class:" -"`c_char` の ctypes 配列です。" +"この関数は変更可能な文字バッファを作成します。返されるオブジェクト" +"は :class:`c_char` の ctypes 配列です。" #: ../../library/ctypes.rst:2039 msgid "" @@ -3348,13 +3924,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`` を送出します。 " +"引数 ``init``, ``size`` を指定して :ref:`監査イベント ` " +"``ctypes.create_string_buffer`` を送出します。" #: ../../library/ctypes.rst:2052 msgid "" @@ -3385,27 +3960,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`` を送出します。 " +"引数 ``init``, ``size`` を指定して :ref:`監査イベント ` " +"``ctypes.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 "" @@ -3414,9 +3992,9 @@ msgid "" "number (this is the form used for the posix linker option :option:`!-l`). " "If no library can be found, returns ``None``." msgstr "" -"ライブラリを検索し、パス名を返します。 *name* は ``lib`` のような接頭辞、 ``." -"so`` や ``.dylib`` のような接尾辞、そして、バージョンナンバーを除くライブラリ" -"名です (これは posix のリンカーオプション :option:`!-l` で使われる書式で" +"ライブラリを検索し、パス名を返します。 *name* は ``lib`` のような接頭辞、 " +"``.so`` や ``.dylib`` のような接尾辞、そして、バージョンナンバーを除くライブ" +"ラリ名です (これは posix のリンカーオプション :option:`!-l` で使われる書式で" "す) 。もしライブラリが見つからなければ、 ``None`` を返します。" #: ../../library/ctypes.rst:2099 @@ -3436,63 +4014,72 @@ 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`." +"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 "" -"Returns the current value of the ctypes-private copy of the system :data:" -"`errno` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the " +"system :data:`errno` variable in the calling thread." 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 +4101,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 +4118,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 +4161,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`` を送出します。 " +"引数 ``errno`` を指定して :ref:`監査イベント ` " +"``ctypes.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`` を送出します。 " +"引数 ``error`` を指定して :ref:`監査イベント ` " +"``ctypes.set_last_error`` を送出します。" #: ../../library/ctypes.rst:2228 msgid "" @@ -3595,73 +4191,94 @@ 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." +"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 " -"more efficient) alternative to ``memoryview((c_byte * size)." -"from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " -"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or a :func:" -"`~ctypes.byref` object.)" -msgstr "" +"more efficient) alternative to ``memoryview((c_byte * " +"size).from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " +"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" @@ -3671,9 +4288,9 @@ msgstr "データ型" msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " -"hold C compatible data; the address of the memory block is returned by the :" -"func:`addressof` helper function. Another instance variable is exposed as :" -"attr:`_objects`; this contains other Python objects that need to be kept " +"hold C compatible data; the address of the memory block is returned by " +"the :func:`addressof` helper function. Another instance variable is exposed " +"as :attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" "この非公開クラスはすべての ctypes データ型の共通のベースクラスです。他のこと" @@ -3683,21 +4300,21 @@ 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 "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " "The optional *offset* parameter specifies an offset into the source buffer " -"in bytes; the default is zero. If the source buffer is not large enough a :" -"exc:`ValueError` is raised." +"in bytes; the default is zero. If the source buffer is not large enough " +"a :exc:`ValueError` is raised." msgstr "" "このメソッドは *source* オブジェクトのバッファを共有する ctypes のインスタン" "スを返します。 *source* オブジェクトは書き込み可能バッファインターフェースを" @@ -3705,13 +4322,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 +4350,24 @@ 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``." +"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 +4389,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:" @@ -3786,9 +4408,9 @@ msgstr "ctypes データ型共通のインスタンス変数:" #: ../../library/ctypes.rst:2367 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " -"instead they share part of the memory block of a base object. The :attr:" -"`_b_base_` read-only member is the root ctypes object that owns the memory " -"block." +"instead they share part of the memory block of a base object. " +"The :attr:`_b_base_` read-only member is the root ctypes object that owns " +"the memory block." msgstr "" "ctypes 型データのインスタンスは、それ自身のメモリブロックを持たず、基底オブ" "ジェクトのメモリブロックの一部を共有することがあります。 :attr:`_b_base_` 読" @@ -3815,34 +4437,34 @@ 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 " -"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :" -"class:`_CData`, so it inherits their methods and attributes. ctypes data " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " +"of :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 +4488,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 +4561,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 "" @@ -3966,35 +4594,35 @@ msgstr "" #: ../../library/ctypes.rst:2501 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" -"class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_byte`." msgstr "" -"C 8-bit :c:expr:`signed int` データ型を表します。たいていは、 :class:" -"`c_byte` の別名です。" +"C 8-bit :c:expr:`signed int` データ型を表します。たいてい" +"は、 :class:`c_byte` の別名です。" #: ../../library/ctypes.rst:2507 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -"C 16-bit :c:expr:`signed int` データ型を表します。たいていは、 :class:" -"`c_short` の別名です。" +"C 16-bit :c:expr:`signed int` データ型を表します。たいてい" +"は、 :class:`c_short` の別名です。" #: ../../library/ctypes.rst:2513 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -"C 32-bit :c:expr:`signed int` データ型を表します。たいていは、 :class:" -"`c_int` の別名です。" +"C 32-bit :c:expr:`signed int` データ型を表します。たいてい" +"は、 :class:`c_int` の別名です。" #: ../../library/ctypes.rst:2519 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -"C 64-bit :c:expr:`signed int` データ型を表します。たいていは、 :class:" -"`c_longlong` の別名です。" +"C 64-bit :c:expr:`signed int` データ型を表します。たいてい" +"は、 :class:`c_longlong` の別名です。" #: ../../library/ctypes.rst:2525 msgid "" @@ -4058,32 +4686,32 @@ msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -"C 8-bit :c:expr:`unsigned int` データ型を表します。たいていは、 :class:" -"`c_ubyte` の別名です。" +"C 8-bit :c:expr:`unsigned int` データ型を表します。たいてい" +"は、 :class:`c_ubyte` の別名です。" #: ../../library/ctypes.rst:2582 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -"C 16-bit :c:expr:`unsigned int` データ型を表します。たいていは、 :class:" -"`c_ushort` の別名です。" +"C 16-bit :c:expr:`unsigned int` データ型を表します。たいてい" +"は、 :class:`c_ushort` の別名です。" #: ../../library/ctypes.rst:2588 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -"C 32-bit :c:expr:`unsigned int` データ型を表します。たいていは、 :class:" -"`c_uint` の別名です。" +"C 32-bit :c:expr:`unsigned int` データ型を表します。たいてい" +"は、 :class:`c_uint` の別名です。" #: ../../library/ctypes.rst:2594 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -"C 64-bit :c:expr:`unsigned int` データ型を表します。たいていは、 :class:" -"`c_ulonglong` の別名です。" +"C 64-bit :c:expr:`unsigned int` データ型を表します。たいてい" +"は、 :class:`c_ulonglong` の別名です。" #: ../../library/ctypes.rst:2600 msgid "" @@ -4146,11 +4774,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,16 +4789,15 @@ 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 "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " -"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" -"type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` " -"are also defined." +"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, " +"or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!" +"RECT` are also defined." msgstr "" #: ../../library/ctypes.rst:2667 @@ -4180,11 +4808,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." +"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." @@ -4222,9 +4851,9 @@ msgstr "*ネイティブ* のバイトオーダーでの構造体のための抽 #: ../../library/ctypes.rst:2706 msgid "" "Concrete structure and union types must be created by subclassing one of " -"these types, and at least define a :attr:`_fields_` class variable. :mod:" -"`ctypes` will create :term:`descriptor`\\s which allow reading and writing " -"the fields by direct attribute accesses. These are the" +"these types, and at least define a :attr:`_fields_` class " +"variable. :mod:`ctypes` will create :term:`descriptor`\\s which allow " +"reading and writing the fields by direct attribute accesses. These are the" msgstr "" "具象構造体型と具象共用体型はこれらの型の一つをサブクラス化することで作らなけ" "ればなりません。少なくとも、 :attr:`_fields_` クラス変数を定義する必要があり" @@ -4269,7 +4898,6 @@ msgstr "" "数を定義することができます。これにより、次のように自身を直接または間接的に参" "照するデータ型を作成できるようになります::" -#: ../../library/ctypes.rst:2729 msgid "" "class List(Structure):\n" " pass\n" @@ -4277,48 +4905,60 @@ 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 "" "Additionally, the :attr:`!_fields_` class variable must be defined before " "the structure or union type is first used: an instance or subclass is " -"created, :func:`sizeof` is called on it, and so on. Later assignments to :" -"attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!_fields_` " -"has not been set before such use, the structure or union will have no own " -"fields, as if :attr:`!_fields_` was empty." +"created, :func:`sizeof` is called on it, and so on. Later assignments " +"to :attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!" +"_fields_` has not been set before such use, the structure or union will have " +"no own 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 "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined when :attr:" -"`_fields_` is assigned, otherwise it will have no effect. Setting this " -"attribute to 0 is the same as not setting it at all." +"fields in the instance. :attr:`_pack_` must already be defined " +"when :attr:`_fields_` is assigned, otherwise it will have no effect. Setting " +"this attribute to 0 is the same as not setting it at all." msgstr "" #: ../../library/ctypes.rst:2757 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,68 +4967,80 @@ 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." +"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 "" -"An optional sequence that lists the names of unnamed (anonymous) fields. :" -"attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +"An optional sequence that lists the names of unnamed (anonymous) " +"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -"無名 (匿名) フィールドの名前が並べあげられたオプションのシーケンス。 :attr:" -"`_fields_` が代入されたとき、 :attr:`_anonymous_` がすでに定義されていなけれ" -"ばなりません。そうでなければ、何ら影響はありません。" +"無名 (匿名) フィールドの名前が並べあげられたオプションのシーケン" +"ス。 :attr:`_fields_` が代入されたとき、 :attr:`_anonymous_` がすでに定義され" +"ていなければなりません。そうでなければ、何ら影響はありません。" #: ../../library/ctypes.rst:2810 msgid "" -"The fields listed in this variable must be structure or union type fields. :" -"mod:`ctypes` will create descriptors in the structure type that allows " -"accessing the nested fields directly, without the need to create the " +"The fields listed in this variable must be structure or union type " +"fields. :mod:`ctypes` will create descriptors in the structure type that " +"allows accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" "この変数に並べあげられたフィールドは構造体型もしくは共用体型フィールドである" @@ -4400,7 +5052,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 +5063,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 +5082,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 "" @@ -4440,9 +5099,9 @@ msgstr "" #: ../../library/ctypes.rst:2840 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " -"fields of the base class. If the subclass definition has a separate :attr:" -"`_fields_` variable, the fields specified in this are appended to the fields " -"of the base class." +"fields of the base class. If the subclass definition has a " +"separate :attr:`_fields_` variable, the fields specified in this are " +"appended to the fields of the base class." msgstr "" "構造体のサブクラスのサブクラスを定義することができ、基底クラスのフィールドを" "継承します。\n" @@ -4461,16 +5120,16 @@ msgstr "" "構造体と共用体のコンストラクタは位置引数とキーワード引数の両方を受け取りま" "す。位置引数は :attr:`_fields_` の中に現れたのと同じ順番でメンバーフィールド" "を初期化するために使われます。コンストラクタのキーワード引数は属性代入として" -"解釈され、そのため、同じ名前をもつ :attr:`_fields_` を初期化するか、 :attr:" -"`_fields_` に存在しない名前に対しては新しい属性を作ります。" +"解釈され、そのため、同じ名前をもつ :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 +5151,96 @@ 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`." +"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 +5249,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 "" @@ -4588,28 +5272,28 @@ msgstr "配列のための抽象基底クラスです。" #: ../../library/ctypes.rst:2954 msgid "" -"The recommended way to create concrete array types is by multiplying any :" -"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " -"subclass this type and define :attr:`_length_` and :attr:`_type_` class " +"The recommended way to create concrete array types is by multiplying " +"any :mod:`ctypes` data type with a non-negative integer. Alternatively, you " +"can subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." msgstr "" "具象配列型を作成するための推奨される方法は、任意の :mod:`ctypes` データ型に非" -"負の整数を乗算することです。代わりに、この型のサブクラスを作成し、 :attr:" -"`_length_` と :attr:`_type_` のクラス変数を定義することもできます。配列の要素" -"は、標準の添え字とスライスによるアクセスを使用して読み書きを行うことができま" -"す。スライスの読み込みでは、結果のオブジェクト自体は :class:`Array` ではあり" -"ません。" +"負の整数を乗算することです。代わりに、この型のサブクラスを作成" +"し、 :attr:`_length_` と :attr:`_type_` のクラス変数を定義することもできま" +"す。配列の要素は、標準の添え字とスライスによるアクセスを使用して読み書きを行" +"うことができます。スライスの読み込みでは、結果のオブジェクト自体" +"は :class:`Array` ではありません。" #: ../../library/ctypes.rst:2964 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" -"range subscripts result in an :exc:`IndexError`. Will be returned by :func:" -"`len`." +"range subscripts result in an :exc:`IndexError`. Will be returned " +"by :func:`len`." msgstr "" -"配列の要素数を指定する正の整数。範囲外の添え字を指定すると、 :exc:" -"`IndexError` が送出されます。:func:`len` がこの整数を返します。" +"配列の要素数を指定する正の整数。範囲外の添え字を指定する" +"と、 :exc:`IndexError` が送出されます。:func:`len` がこの整数を返します。" #: ../../library/ctypes.rst:2971 msgid "Specifies the type of each element in the array." @@ -4625,8 +5309,8 @@ msgstr "" #: ../../library/ctypes.rst:2979 msgid "" -"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" -"`ctypes` data type and *length* an integer." +"Create an array. Equivalent to ``type * length``, where *type* is " +"a :mod:`ctypes` data type and *length* an integer." msgstr "" #: ../../library/ctypes.rst:2983 @@ -4650,10 +5334,10 @@ msgstr "" #: ../../library/ctypes.rst:2995 msgid "" "If a pointer points to an array, its elements can be read and written using " -"standard subscript and slice accesses. Pointer objects have no size, so :" -"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from " -"the memory *before* the pointer (as in C), and out-of-range subscripts will " -"probably crash with an access violation (if you're lucky)." +"standard subscript and slice accesses. Pointer objects have no size, " +"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " +"from the memory *before* the pointer (as in C), and out-of-range subscripts " +"will probably crash with an access violation (if you're lucky)." msgstr "" "ポインタが配列を指す場合、その配列の要素は、標準の添え字とスライスによるアク" "セスを使用して読み書きが行えます。ポインタオブジェクトには、サイズがないた" @@ -4685,23 +5369,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 +5389,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..2daf9ec40 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" @@ -277,8 +276,8 @@ msgstr "ASCII 大文字かどうかを調べます。" #: ../../library/curses.ascii.rst:168 msgid "" -"Checks for an ASCII hexadecimal digit. This is equivalent to ``c in string." -"hexdigits``." +"Checks for an ASCII hexadecimal digit. This is equivalent to ``c in " +"string.hexdigits``." msgstr "" "ASCII 16 進数字かどうかを調べます。``c in string.hexdigits`` と等価です。" @@ -293,8 +292,8 @@ msgstr "非 ASCII 文字 (0x80 またはそれ以上の値) かどうかを調 #: ../../library/curses.ascii.rst:181 msgid "" "These functions accept either integers or single-character strings; when the " -"argument is a string, it is first converted using the built-in function :" -"func:`ord`." +"argument is a string, it is first converted using the built-in " +"function :func:`ord`." msgstr "" "これらの関数は数字も 1 文字の文字列も使えます; 引数を文字列にした場合、組み込" "み関数 :func:`ord` を使って変換されます。" diff --git a/library/curses.panel.po b/library/curses.panel.po index 2e5fae3c9..d42a6932d 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 @@ -71,8 +71,9 @@ msgid "" "Updates the virtual screen after changes in the panel stack. This does not " "call :func:`curses.doupdate`, so you'll have to do this yourself." msgstr "" -"仮想スクリーンをパネルスタック変更後の状態に更新します。この関数では :func:" -"`curses.doupdate` を呼ばないので、ユーザは自分で呼び出す必要があります。" +"仮想スクリーンをパネルスタック変更後の状態に更新します。この関数で" +"は :func:`curses.doupdate` を呼ばないので、ユーザは自分で呼び出す必要がありま" +"す。" #: ../../library/curses.panel.rst:50 msgid "Panel Objects" diff --git a/library/curses.po b/library/curses.po index 58ccc804e..36dd0513d 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,17 @@ 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 +72,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 +147,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 "" @@ -198,10 +204,10 @@ msgid "" msgstr "" "cbreak モードに入ります。cbreak モード (\"rare\" モードと呼ばれることもありま" "す) では、通常の tty 行バッファリングはオフにされ、文字を一文字一文字読むこと" -"ができます。ただし、raw モードとは異なり、特殊文字 (割り込み:interrupt、終了:" -"quit、一時停止:suspend、およびフロー制御) については、tty ドライバおよび呼び" -"出し側のプログラムに対する通常の効果をもっています。まず :func:`raw` を呼び出" -"し、次いで :func:`cbreak` を呼び出すと、端末を cbreak モードにします。" +"ができます。ただし、raw モードとは異なり、特殊文字 (割り込み:interrupt、終" +"了:quit、一時停止:suspend、およびフロー制御) については、tty ドライバおよび呼" +"び出し側のプログラムに対する通常の効果をもっています。まず :func:`raw` を呼び" +"出し、次いで :func:`cbreak` を呼び出すと、端末を cbreak モードにします。" #: ../../library/curses.rst:116 msgid "" @@ -216,16 +222,19 @@ 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 " -"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the other :const:" -"`!A_\\*` attributes. :func:`pair_number` is the counterpart to this " -"function." +"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the " +"other :const:`!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,18 +242,18 @@ 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 msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " -"for when the program is not in curses.) Subsequent calls to :func:" -"`reset_prog_mode` will restore this mode." +"for when the program is not in curses.) Subsequent calls " +"to :func:`reset_prog_mode` will restore this mode." msgstr "" "現在の端末属性を、稼動中のプログラムが curses を使う際のモードである \"プログ" "ラム\" モードとして保存します。(このモードの反対は、プログラムが curses を使" @@ -255,13 +264,13 @@ msgstr "" msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " -"mode, when the program is using curses capabilities.) Subsequent calls to :" -"func:`reset_shell_mode` will restore this mode." +"mode, when the program is using curses capabilities.) Subsequent calls " +"to :func:`reset_shell_mode` will restore this mode." msgstr "" "現在の端末属性を、稼動中のプログラムが curses を使っていないときのモードであ" "る \"シェル\" モードとして保存します。(このモードの反対は、プログラムが " -"curses 機能を利用している \"プログラム\" モードです。) その後 :func:" -"`reset_shell_mode` を呼ぶとこのモードを復旧します。" +"curses 機能を利用している \"プログラム\" モードです。) その" +"後 :func:`reset_shell_mode` を呼ぶとこのモードを復旧します。" #: ../../library/curses.rst:158 msgid "Insert an *ms* millisecond pause in output." @@ -286,16 +295,16 @@ msgid "" "a window. The normal :meth:`~window.refresh` call is simply :meth:`!" "noutrefresh` followed by :func:`!doupdate`; if you have to update multiple " "windows, you can speed performance and perhaps reduce screen flicker by " -"issuing :meth:`!noutrefresh` calls on all windows, followed by a single :" -"func:`!doupdate`." +"issuing :meth:`!noutrefresh` calls on all windows, followed by a " +"single :func:`!doupdate`." 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 "" @@ -365,10 +374,8 @@ msgid "" "coordinates. (*z* is currently unused.) *bstate* is an integer value whose " "bits will be set to indicate the type of event, and will be the bitwise OR " "of one or more of the following constants, where *n* is the button number " -"from 1 to 5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:" -"`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:" -"`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :" -"const:`BUTTON_ALT`." +"from 1 to " +"5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`." msgstr "" ":meth:`~window.getch` が :const:`KEY_MOUSE` を返してマウスイベントを通知した" "後、この関数を呼んで待ち行列上に置かれているマウスイベントを取得しなければな" @@ -377,16 +384,15 @@ msgstr "" "トの座標値です。(現在 *z* は使われていません) *bstate* は整数値で、その各ビッ" "トはイベントのタイプを示す値に設定されています。この値は以下に示す定数のうち" "一つまたはそれ以上のビット単位 OR になっています。以下の定数の *n* は 1 か" -"ら 5 のボタン番号を示します: :const:`BUTTONn_PRESSED`, :const:" -"`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:" -"`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:" -"`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`。" +"ら 5 のボタン番号を示しま" +"す: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`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 "" @@ -394,14 +400,15 @@ msgid "" "x)``. If :meth:`leaveok ` is currently ``True``, then " "return ``(-1, -1)``." msgstr "" -"仮想スクリーンにおける現在のカーソル位置をタプル ``(y, x)`` で返します。 :" -"meth:`leaveok` が ``True`` に設定されていれば、 ``(-1, -1)`` が返されます。" +"仮想スクリーンにおける現在のカーソル位置をタプル ``(y, x)`` で返しま" +"す。 :meth:`leaveok` が ``True`` に設定されていれば、 ``(-1, -1)`` が返されま" +"す。" #: ../../library/curses.rst:243 msgid "" -"Read window related data stored in the file by an earlier :func:`window." -"putwin` call. The routine then creates and initializes a new window using " -"that data, returning the new window object." +"Read window related data stored in the file by an " +"earlier :func:`window.putwin` call. The routine then creates and initializes " +"a new window using that data, returning the new window object." msgstr "" #: ../../library/curses.rst:250 @@ -419,9 +426,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 "" @@ -463,8 +469,8 @@ msgstr "" "半遅延モード、すなわち cbreak モードに似た、ユーザが打鍵した文字がすぐにプロ" "グラムで利用できるようになるモードで使われます。しかしながら、何も入力されな" "かった場合、十分の *tenths* 秒後に例外が送出されます。*tenths* の値は ``1`` " -"から ``255`` の間でなければなりません。半遅延モードから抜けるには :func:" -"`nocbreak` を使います。" +"から ``255`` の間でなければなりません。半遅延モードから抜けるに" +"は :func:`nocbreak` を使います。" #: ../../library/curses.rst:294 msgid "" @@ -485,19 +491,29 @@ 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 " "background color number. The value of *pair_number* must be between ``1`` " -"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed by :func:" -"`use_default_colors` and :func:`assume_default_colors`). The value of *fg* " -"and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, after " -"calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " +"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed " +"by :func:`use_default_colors` and :func:`assume_default_colors`). The value " +"of *fg* and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, " +"after calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " "``-1``. If the color-pair was previously initialized, the screen is " "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 +531,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 +546,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 +555,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 "" @@ -616,33 +632,33 @@ msgid "" "and is not necessarily associated with a particular part of the screen. " "Pads can be used when a large window is needed, and only a part of the " "window will be on the screen at one time. Automatic refreshes of pads (such " -"as from scrolling or echoing of input) do not occur. The :meth:`~window." -"refresh` and :meth:`~window.noutrefresh` methods of a pad require 6 " -"arguments to specify the part of the pad to be displayed and the location on " -"the screen to be used for the display. The arguments are *pminrow*, " -"*pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* arguments " -"refer to the upper left corner of the pad region to be displayed and the *s* " -"arguments define a clipping box on the screen within which the pad region is " -"to be displayed." +"as from scrolling or echoing of input) do not occur. " +"The :meth:`~window.refresh` and :meth:`~window.noutrefresh` methods of a pad " +"require 6 arguments to specify the part of the pad to be displayed and the " +"location on the screen to be used for the display. The arguments are " +"*pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* " +"arguments refer to the upper left corner of the pad region to be displayed " +"and the *s* arguments define a clipping box on the screen within which the " +"pad region is to be displayed." msgstr "" "パッドはウィンドウと同じようなものですが、スクリーンのサイズによる制限をうけ" "ず、スクリーンの特定の部分に関連付けられていなくてもかまいません。大きなウィ" "ンドウが必要であり、スクリーンにはそのウィンドウの一部しか一度に表示しない場" "合に使えます。(スクロールや入力エコーなどによる) パッドに対する再描画は起こり" -"ません。パッドに対する :meth:`~window.refresh` および :meth:`~window." -"noutrefresh` メソッドは、パッド中の表示する部分と表示するために利用するスク" -"リーン上の位置を指定する 6 つの引数が必要です。これらの引数は *pminrow*、" -"*pmincol*、*sminrow*、*smincol*、*smaxrow*、*smaxcol* です; *p* で始まる引数" -"はパッド中の表示領域の左上位置で、*s* で始まる引数はパッド領域を表示するスク" -"リーン上のクリップ矩形を指定します。" +"ません。パッドに対する :meth:`~window.refresh` およ" +"び :meth:`~window.noutrefresh` メソッドは、パッド中の表示する部分と表示するた" +"めに利用するスクリーン上の位置を指定する 6 つの引数が必要です。これらの引数" +"は *pminrow*、*pmincol*、*sminrow*、*smincol*、*smaxrow*、*smaxcol* です; " +"*p* で始まる引数はパッド中の表示領域の左上位置で、*s* で始まる引数はパッド領" +"域を表示するスクリーン上のクリップ矩形を指定します。" #: ../../library/curses.rst:413 msgid "" "Return a new :ref:`window `, whose left-upper corner " "is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -"左上の角が ``(begin_y, begin_x)`` で、高さ/幅が *nlines* / *ncols* の新規 :" -"ref:`ウィンドウ ` を返します。" +"左上の角が ``(begin_y, begin_x)`` で、高さ/幅が *nlines* / *ncols* の新" +"規 :ref:`ウィンドウ ` を返します。" #: ../../library/curses.rst:416 msgid "" @@ -673,7 +689,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 +697,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 "" @@ -719,8 +734,8 @@ msgstr "" #: ../../library/curses.rst:468 msgid "" -"Return the number of the color-pair set by the attribute value *attr*. :func:" -"`color_pair` is the counterpart to this function." +"Return the number of the color-pair set by the attribute value " +"*attr*. :func:`color_pair` is the counterpart to this function." msgstr "" "*attr* に対する色ペアセットの番号を返します。:func:`color_pair` はこの関数の" "逆に相当します。" @@ -728,8 +743,8 @@ msgstr "" #: ../../library/curses.rst:474 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " -"terminfo capability for the current terminal. Note that the output of :func:" -"`putp` always goes to standard output." +"terminfo capability for the current terminal. Note that the output " +"of :func:`putp` always goes to standard output." msgstr "" "``tputs(str, 1, putchar)`` と等価です; 現在の端末における、指定された " "terminfo 機能の値を出力します。:func:`putp` の出力は常に標準出力に送られるの" @@ -757,24 +772,24 @@ msgstr "" #: ../../library/curses.rst:495 msgid "" -"Restore the terminal to \"program\" mode, as previously saved by :func:" -"`def_prog_mode`." +"Restore the terminal to \"program\" mode, as previously saved " +"by :func:`def_prog_mode`." msgstr "" "端末を \"program\" モードに復旧し、あらかじめ :func:`def_prog_mode` で保存し" "た内容に戻します。" #: ../../library/curses.rst:501 msgid "" -"Restore the terminal to \"shell\" mode, as previously saved by :func:" -"`def_shell_mode`." +"Restore the terminal to \"shell\" mode, as previously saved " +"by :func:`def_shell_mode`." msgstr "" "端末を \"shell\" モードに復旧し、あらかじめ :func:`def_shell_mode` で保存した" "内容に戻します。" #: ../../library/curses.rst:507 msgid "" -"Restore the state of the terminal modes to what it was at the last call to :" -"func:`savetty`." +"Restore the state of the terminal modes to what it was at the last call " +"to :func:`savetty`." msgstr "" "端末モードの状態を最後に :func:`savetty` を呼び出した時の状態に戻します。" @@ -805,40 +820,40 @@ msgstr "" #: ../../library/curses.rst:530 msgid "" -"Save the current state of the terminal modes in a buffer, usable by :func:" -"`resetty`." +"Save the current state of the terminal modes in a buffer, usable " +"by :func:`resetty`." 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 "" @@ -866,17 +881,17 @@ msgstr "" #: ../../library/curses.rst:581 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " -"yellow, blue, magenta, cyan, and white), and two global variables in the :" -"mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, containing " -"the maximum number of colors and color-pairs the terminal can support. It " -"also restores the colors on the terminal to the values they had when the " -"terminal was just turned on." +"yellow, blue, magenta, cyan, and white), and two global variables in " +"the :mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, " +"containing the maximum number of colors and color-pairs the terminal can " +"support. It also restores the colors on the terminal to the values they had " +"when the terminal was just turned on." msgstr "" ":func:`start_color` は 8 つの基本色 (黒、赤、緑、黄、青、マゼンタ、シアン、お" -"よび白) と、色数の最大値と端末がサポートする色ペアの最大数が入っている、:mod:" -"`curses` モジュールにおける二つのグローバル変数、:const:`COLORS` および :" -"const:`COLOR_PAIRS` を初期化します。この関数はまた、色設定を端末のスイッチが" -"入れられたときの状態に戻します。" +"よび白) と、色数の最大値と端末がサポートする色ペアの最大数が入ってい" +"る、:mod:`curses` モジュールにおける二つのグローバル変数、:const:`COLORS` お" +"よび :const:`COLOR_PAIRS` を初期化します。この関数はまた、色設定を端末のス" +"イッチが入れられたときの状態に戻します。" #: ../../library/curses.rst:590 msgid "" @@ -918,13 +933,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 +997,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." @@ -1013,15 +1032,14 @@ msgid "" "to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" "この関数を使う場合、:func:`initscr` または newterm を呼ぶ前に呼び出さなくては" -"なりません。*flag* が ``False`` の場合、環境変数 :envvar:`LINES` および :" -"envvar:`COLUMNS` の値 (デフォルトで使用されます) の値が設定されていたり、" -"curses がウィンドウ内で動作して (この場合 :envvar:`LINES` や :envvar:" -"`COLUMNS` が設定されていないとウィンドウのサイズを使います) いても、" -"terminfo データベースに指定された lines および columns の値を使います。" +"なりません。*flag* が ``False`` の場合、環境変数 :envvar:`LINES` およ" +"び :envvar:`COLUMNS` の値 (デフォルトで使用されます) の値が設定されていたり、" +"curses がウィンドウ内で動作して (この場合 :envvar:`LINES` " +"や :envvar:`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 +1126,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 +1315,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 +1323,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 +1346,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." @@ -1362,18 +1384,17 @@ msgid "" "the origin of the window, rather than relative to the entire screen. Return " "a window object for the derived window." msgstr "" -"\"derive window (ウィンドウを派生する)\" の短縮形です。:meth:`derwin` は :" -"meth:`subwin` と同じですが、*begin_y* および *begin_x* はスクリーン全体の原点" -"ではなく、ウィンドウの原点からの相対位置です。派生したウィンドウオブジェクト" -"が返されます。" +"\"derive window (ウィンドウを派生する)\" の短縮形です。:meth:`derwin` " +"は :meth:`subwin` と同じですが、*begin_y* および *begin_x* はスクリーン全体の" +"原点ではなく、ウィンドウの原点からの相対位置です。派生したウィンドウオブジェ" +"クトが返されます。" -#: ../../library/curses.rst:908 msgid "" -"Add character *ch* with attribute *attr*, and immediately call :meth:" -"`refresh` on the window." +"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 +1407,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 +1428,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 +1487,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 +1554,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 +1561,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 "" @@ -1591,8 +1612,8 @@ msgstr "" #: ../../library/curses.rst:1094 msgid "" -"Return ``True`` if the specified line was modified since the last call to :" -"meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " +"Return ``True`` if the specified line was modified since the last call " +"to :meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" "指定した行が、最後に :meth:`refresh` を呼んだ時から変更されている場合に " @@ -1601,8 +1622,8 @@ msgstr "" #: ../../library/curses.rst:1101 msgid "" -"Return ``True`` if the specified window was modified since the last call to :" -"meth:`refresh`; otherwise return ``False``." +"Return ``True`` if the specified window was modified since the last call " +"to :meth:`refresh`; otherwise return ``False``." msgstr "" "指定したウィンドウが、最後に :meth:`refresh` を呼んだ時から変更されている場合" "に ``True`` を返します; そうでない場合には ``False`` を返します。" @@ -1694,8 +1715,8 @@ msgstr "" #: ../../library/curses.rst:1165 msgid "" -"To get fine-grained control over the copied region, the second form of :meth:" -"`overlay` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form " +"of :meth:`overlay` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, and the other variables mark a rectangle " "in the destination window." msgstr "" @@ -1716,8 +1737,8 @@ msgstr "" #: ../../library/curses.rst:1178 msgid "" -"To get fine-grained control over the copied region, the second form of :meth:" -"`overwrite` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form " +"of :meth:`overwrite` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, the other variables mark a rectangle in " "the destination window." msgstr "" @@ -1739,13 +1760,14 @@ msgid "" "Indicate that the *num* screen lines, starting at line *beg*, are corrupted " "and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -"*beg* 行から始まる *num* スクリーン行の表示内容が壊れており、次の :meth:" -"`refresh` 呼び出しで完全に再描画されなければならないことを通知します。" +"*beg* 行から始まる *num* スクリーン行の表示内容が壊れており、次" +"の :meth:`refresh` 呼び出しで完全に再描画されなければならないことを通知しま" +"す。" #: ../../library/curses.rst:1198 msgid "" -"Touch the entire window, causing it to be completely redrawn on the next :" -"meth:`refresh` call." +"Touch the entire window, causing it to be completely redrawn on the " +"next :meth:`refresh` call." msgstr "" "ウィンドウ全体を更新 (touch) し、次の :meth:`refresh` 呼び出しで完全に再描画" "されるようにします。" @@ -1790,8 +1812,8 @@ msgid "" "rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" "curses ウィンドウの記憶域を、指定値のサイズに調整するため再割当てします。サイ" -"ズが現在の値より大きい場合、ウィンドウのデータは現在の背景設定 (:meth:" -"`bkgdset` で設定) で埋められマージされます。" +"ズが現在の値より大きい場合、ウィンドウのデータは現在の背景設定 " +"(:meth:`bkgdset` で設定) で埋められマージされます。" #: ../../library/curses.rst:1229 msgid "Scroll the screen or scrolling region upward by *lines* lines." @@ -1880,9 +1902,9 @@ msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " "If *delay* is zero, then non-blocking read is used, and :meth:`getch` will " -"return ``-1`` if no input is waiting. If *delay* is positive, then :meth:" -"`getch` will block for *delay* milliseconds, and return ``-1`` if there is " -"still no input at the end of that time." +"return ``-1`` if no input is waiting. If *delay* is positive, " +"then :meth:`getch` will block for *delay* milliseconds, and return ``-1`` if " +"there is still no input at the end of that time." msgstr "" "ウィンドウのブロックまたは非ブロック読み込み動作を設定します。*delay* が負の" "場合、ブロック読み出しが使われ、入力を無期限で待ち受けます。*delay* がゼロの" @@ -1890,38 +1912,36 @@ 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 "" -"Mark all lines in the window as unchanged since the last call to :meth:" -"`refresh`." +"Mark all lines in the window as unchanged since the last call " +"to :meth:`refresh`." 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" @@ -1933,8 +1953,8 @@ msgstr ":mod:`curses` モジュールでは以下のデータメンバを定義 #: ../../library/curses.rst:1339 msgid "" -"Some curses routines that return an integer, such as :meth:`~window." -"getch`, return :const:`ERR` upon failure." +"Some curses routines that return an integer, such " +"as :meth:`~window.getch`, return :const:`ERR` upon failure." msgstr "" ":meth:`~window.getch` のような整数を返す curses ルーチンのいくつかは、失敗し" "た際に :const:`ERR` を返します。" @@ -1944,56 +1964,61 @@ msgid "" "Some curses routines that return an integer, such as :func:`napms`, " "return :const:`OK` upon success." msgstr "" -":func:`napms` のような整数を返す curses ルーチンのいくつかは、成功した際に :" -"const:`OK` を返します。" +":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 "" "The width of the screen, i.e., the number of columns. It is defined only " -"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" -"func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated " +"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." msgstr "" #: ../../library/curses.rst:1385 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " -"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" -"func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated " +"by :func:`update_lines_cols`, :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 +2045,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 +2056,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 +2070,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,17 +2503,27 @@ 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:" -"`KEY_F2 `, :const:`KEY_F3 `, :const:`KEY_F4 `) " -"available, and the arrow keys mapped to :const:`KEY_UP`, :const:`KEY_DOWN`, :" -"const:`KEY_LEFT` and :const:`KEY_RIGHT` in the obvious way. If your machine " -"has a PC keyboard, it is safe to expect arrow keys and twelve function keys " -"(older PC keyboards may have only ten function keys); also, the following " -"keypad mappings are standard:" -msgstr "" +"are normally at least four function keys (:const:`KEY_F1 " +"`, :const:`KEY_F2 `, :const:`KEY_F3 " +"`, :const:`KEY_F4 `) available, and the arrow keys mapped " +"to :const:`KEY_UP`, :const:`KEY_DOWN`, :const:`KEY_LEFT` " +"and :const:`KEY_RIGHT` in the obvious way. If your machine has a PC " +"keyboard, it is safe to expect arrow keys and twelve function keys (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 +2774,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:" @@ -2844,9 +2858,9 @@ msgid "" msgstr "" ":mod:`curses.textpad` モジュールでは、curses ウィンドウ内での基本的なテキスト" "編集を処理し、Emacs に似た (すなわち Netscape Navigator, BBedit 6.x, " -"FrameMaker, その他諸々のプログラムとも似た) キーバインドをサポートしている :" -"class:`Textbox` クラスを提供します。このモジュールではまた、テキストボックス" -"を枠で囲むなどの目的のために有用な、矩形描画関数を提供しています。" +"FrameMaker, その他諸々のプログラムとも似た) キーバインドをサポートしてい" +"る :class:`Textbox` クラスを提供します。このモジュールではまた、テキストボッ" +"クスを枠で囲むなどの目的のために有用な、矩形描画関数を提供しています。" #: ../../library/curses.rst:1839 msgid "The module :mod:`curses.textpad` defines the following function:" @@ -2883,11 +2897,11 @@ msgstr "" #: ../../library/curses.rst:1864 msgid "" -"Return a textbox widget object. The *win* argument should be a curses :ref:" -"`window ` object in which the textbox is to be " -"contained. The edit cursor of the textbox is initially located at the upper " -"left hand corner of the containing window, with coordinates ``(0, 0)``. The " -"instance's :attr:`stripspaces` flag is initially on." +"Return a textbox widget object. The *win* argument should be a " +"curses :ref:`window ` object in which the textbox is " +"to be contained. The edit cursor of the textbox is initially located at the " +"upper left hand corner of the containing window, with coordinates ``(0, " +"0)``. The instance's :attr:`stripspaces` flag is initially on." msgstr "" "テキストボックスウィジェットオブジェクトを返します。*win* 引数は、テキスト" "ボックスを入れるための :ref:`ウィンドウ ` オブジェクト" @@ -2906,8 +2920,8 @@ msgid "" "*validator* is supplied, it must be a function. It will be called for each " "keystroke entered with the keystroke as a parameter; command dispatch is " "done on the result. This method returns the window contents as a string; " -"whether blanks in the window are included is affected by the :attr:" -"`stripspaces` attribute." +"whether blanks in the window are included is affected by " +"the :attr:`stripspaces` attribute." msgstr "" "普段使うことになるエントリポイントです。終了キーストロークの一つが入力される" "まで編集キーストロークを受け付けます。*validator* を与える場合、関数でなけれ" @@ -3049,25 +3063,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..4cb564731 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 @@ -37,24 +37,23 @@ msgstr "**ソースコード:** :source:`Lib/dataclasses.py`" #: ../../library/dataclasses.rst:14 msgid "" "This module provides a decorator and functions for automatically adding " -"generated :term:`special methods ` such as :meth:`~object." -"__init__` and :meth:`~object.__repr__` to user-defined classes. It was " -"originally described in :pep:`557`." +"generated :term:`special methods ` such " +"as :meth:`~object.__init__` and :meth:`~object.__repr__` to user-defined " +"classes. It was originally described in :pep:`557`." msgstr "" "このモジュールは、:meth:`~object.__init__` や :meth:`~object.__repr__` のよう" "な :term:`特殊メソッド ` を生成し、ユーザー定義のクラスに自動" -"的に追加するデコレーターや関数を提供します。このモジュールは元々、 :pep:" -"`557` で説明されていました。" +"的に追加するデコレーターや関数を提供します。このモジュールは" +"元々、 :pep:`557` で説明されていました。" #: ../../library/dataclasses.rst:19 msgid "" -"The member variables to use in these generated methods are defined using :" -"pep:`526` type annotations. For example, this code::" +"The member variables to use in these generated methods are defined " +"using :pep:`526` type annotations. For example, this code::" 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 "" @@ -97,8 +111,9 @@ msgstr "モジュールの内容" #: ../../library/dataclasses.rst:51 msgid "" -"This function is a :term:`decorator` that is used to add generated :term:" -"`special methods ` to classes, as described below." +"This function is a :term:`decorator` that is used to add " +"generated :term:`special methods ` to classes, as described " +"below." msgstr "" "この関数は、後述する :term:`特殊メソッド ` を生成し、クラスに" "追加する :term:`decorator` です。" @@ -137,14 +152,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 +176,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 +214,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,25 +236,35 @@ 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 " -"will be generated. These compare the class as if it were a tuple of its " -"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." +"*order*: If true (the default is " +"``False``), :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` methods will be generated. These compare the " +"class as if it were a tuple of its 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." +"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 +272,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,17 +280,28 @@ 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 " -"an existing explicitly defined :meth:`!__hash__` method. Setting the class " -"attribute ``__hash__ = None`` has a specific meaning to Python, as described " -"in the :meth:`!__hash__` documentation." +"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 an existing explicitly defined :meth:`!__hash__` method. " +"Setting the class 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,45 +310,67 @@ 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`." +"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, :" -"meth:`!__hash__` will be set to ``None``, marking it unhashable (which it " -"is, since it is mutable). If *eq* is false, :meth:`!__hash__` will be left " -"untouched meaning the :meth:`!__hash__` method of the superclass will be " -"used (if the superclass is :class:`object`, this means it will fall back to " -"id-based hashing)." -msgstr "" +"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is " +"false, :meth:`!__hash__` will be set to ``None``, marking it unhashable " +"(which it is, since it is mutable). If *eq* is false, :meth:`!__hash__` " +"will be left untouched meaning the :meth:`!__hash__` method of the " +"superclass will be 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 "" "*frozen*: If true (the default is ``False``), assigning to fields will " -"generate an exception. This emulates read-only frozen instances. If :meth:" -"`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the " -"class, then :exc:`TypeError` is raised. See the discussion below." +"generate an exception. This emulates read-only frozen instances. " +"If :meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in " +"the 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 " -"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" -"__init__` is not generated, see above). If false, or if :attr:`!" -"__match_args__` is already defined in the class, then :attr:`!" +"*match_args*: If true (the default is ``True``), " +"the :attr:`~object.__match_args__` tuple will be created from the list of " +"non keyword-only parameters to the generated :meth:`~object.__init__` method " +"(even if :meth:`!__init__` is not generated, see above). If false, or " +"if :attr:`!__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,44 +379,68 @@ 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." +"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 " "prevent :ref:`overriding them `. Therefore, do not " -"use :attr:`!__slots__` to retrieve the field names of a dataclass. Use :func:" -"`fields` instead. To be able to determine inherited slots, base class :attr:" -"`!__slots__` may be any iterable, but *not* an iterator." +"use :attr:`!__slots__` to retrieve the field names of a dataclass. " +"Use :func:`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 +449,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 +480,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 +487,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 +502,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 +517,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 +536,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 +566,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 +589,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.)." +"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 +606,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 +640,6 @@ msgid "" "specified. For example, after::" msgstr "" -#: ../../library/dataclasses.rst:320 msgid "" "@dataclass\n" "class C:\n" @@ -508,36 +648,49 @@ 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." +":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,14 +700,20 @@ msgstr "" "他の属性があることもありますが、それらはプライベートであり、調べたり、依存し" "たりしてはなりません。" -#: ../../library/dataclasses.rst:349 msgid "" "``InitVar[T]`` type annotations describe variables that are :ref:`init-only " "`. Fields annotated with :class:`!InitVar` " -"are considered pseudo-fields, and thus are neither returned by the :func:" -"`fields` function nor used in any way except adding them as parameters to :" -"meth:`~object.__init__` and an optional :meth:`__post_init__`." -msgstr "" +"are considered pseudo-fields, and thus are neither returned by " +"the :func:`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 "" @@ -566,8 +725,8 @@ msgstr "" "このデータクラスのフィールドを定義する :class:`Field` オブジェクトをタプルで" "返します。\n" "データクラスあるいはデータクラスのインスタンスを受け付けます。\n" -"データクラスやデータクラスのインスタンスが渡されなかった場合は、 :exc:" -"`TypeError` を送出します。\n" +"データクラスやデータクラスのインスタンスが渡されなかった場合" +"は、 :exc:`TypeError` を送出します。\n" "``ClassVar`` や ``InitVar`` といった疑似フィールドは返しません。" #: ../../library/dataclasses.rst:365 @@ -578,11 +737,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 +756,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 +795,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 "" @@ -649,33 +820,34 @@ msgid "" "``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is " "supplied, :data:`typing.Any` is used for ``type``. The values of *init*, " "*repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, " -"*slots*, and *weakref_slot* have the same meaning as they do in :func:" -"`@dataclass `." +"*slots*, and *weakref_slot* have the same meaning as they do " +"in :func:`@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 "" "The *decorator* parameter is a callable that will be used to create the " "dataclass. It should take the class object as a first argument and the same " -"keyword arguments as :func:`@dataclass `. By default, the :func:" -"`@dataclass ` function is used." +"keyword arguments as :func:`@dataclass `. By default, " +"the :func:`@dataclass ` function is used." msgstr "" #: ../../library/dataclasses.rst:436 msgid "" "This function is not strictly required, because any Python mechanism for " -"creating a new class with :attr:`!__annotations__` can then apply the :func:" -"`@dataclass ` function to convert that class to a dataclass. " -"This function is provided as a convenience. For example::" +"creating a new class with :attr:`!__annotations__` can then apply " +"the :func:`@dataclass ` function to convert that class to a " +"dataclass. 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 +855,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 +875,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`." +"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 +937,12 @@ msgid "" "instance copying." msgstr "" -#: ../../library/dataclasses.rst:490 msgid "" -"Dataclass instances are also supported by generic function :func:`copy." -"replace`." +"Dataclass instances are also supported by generic " +"function :func:`copy.replace`." msgstr "" +"データクラスのインスタンスは、汎用関数 :func:`copy.replace` でもサポートされ" +"ています。" #: ../../library/dataclasses.rst:494 msgid "" @@ -765,11 +960,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." @@ -782,9 +978,9 @@ msgid "" "with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note " "that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely " "ignored. This includes the name of such a field. By convention, a name of " -"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields signify :" -"meth:`~object.__init__` parameters that must be specified as keywords when " -"the class is instantiated." +"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields " +"signify :meth:`~object.__init__` parameters that must be specified as " +"keywords when the class is instantiated." msgstr "" #: ../../library/dataclasses.rst:519 @@ -793,7 +989,6 @@ msgid "" "fields::" msgstr "このサンプルでは ``y`` と ``z`` がキーワード専用フィールドとなります::" -#: ../../library/dataclasses.rst:521 msgid "" "@dataclass\n" "class Point:\n" @@ -804,47 +999,59 @@ 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 "" -"Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" -"`~object.__delattr__` is called on a dataclass which was defined with " -"``frozen=True``. It is a subclass of :exc:`AttributeError`." +"Raised when an implicitly defined :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` is called on a dataclass which was defined " +"with ``frozen=True``. It is a subclass of :exc:`AttributeError`." msgstr "" -"``frozen=True`` 付きで定義されたデータクラスで、暗黙的に定義された :meth:" -"`~object.__setattr__` または :meth:`~object.__delattr__` が呼び出されたときに" -"送出されます。これは :exc:`AttributeError` のサブクラスです。" +"``frozen=True`` 付きで定義されたデータクラスで、暗黙的に定義され" +"た :meth:`~object.__setattr__` または :meth:`~object.__delattr__` が呼び出さ" +"れたときに送出されます。これは :exc:`AttributeError` のサブクラスです。" #: ../../library/dataclasses.rst:544 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 " -"``InitVar`` fields are defined, they will also be passed to :meth:`!" -"__post_init__` in the order they were defined in the class. If no :meth:`!" -"__init__` method is generated, then :meth:`!__post_init__` will not " -"automatically be called." +"When defined on the class, it will be called by the " +"generated :meth:`~object.__init__`, normally as :meth:`!self.__post_init__`. " +"However, if any ``InitVar`` fields are defined, they will also be passed " +"to :meth:`!__post_init__` in the order they were defined in the class. If " +"no :meth:`!__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 +1062,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 +1079,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,18 +1092,31 @@ 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 "" -"See the section below on init-only variables for ways to pass parameters to :" -"meth:`!__post_init__`. Also see the warning about how :func:`replace` " +"See the section below on init-only variables for ways to pass parameters " +"to :meth:`!__post_init__`. Also see the warning about how :func:`replace` " "handles ``init=False`` fields." msgstr "" "下にある初期化限定変数についての節で、 :meth:`!__post_init__` にパラメータを" @@ -908,8 +1135,8 @@ msgid "" "defined in :pep:`526`. It does this by checking if the type of the field " "is :data:`typing.ClassVar`. If a field is a ``ClassVar``, it is excluded " "from consideration as a field and is ignored by the dataclass mechanisms. " -"Such ``ClassVar`` pseudo-fields are not returned by the module-level :func:" -"`fields` function." +"Such ``ClassVar`` pseudo-fields are not returned by the module-" +"level :func:`fields` function." msgstr "" #: ../../library/dataclasses.rst:608 @@ -929,15 +1156,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 +1176,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" @@ -966,17 +1203,20 @@ msgstr "凍結されたインスタンス" msgid "" "It is not possible to create truly immutable Python objects. However, by " "passing ``frozen=True`` to the :func:`@dataclass ` decorator you " -"can emulate immutability. In that case, dataclasses will add :meth:`~object." -"__setattr__` and :meth:`~object.__delattr__` methods to the class. These " -"methods will raise a :exc:`FrozenInstanceError` when invoked." +"can emulate immutability. In that case, dataclasses will " +"add :meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to " +"the class. These 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__`." +"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 +1234,6 @@ msgid "" "order, derived classes override base classes. An example::" msgstr "" -#: ../../library/dataclasses.rst:670 msgid "" "@dataclass\n" "class Base:\n" @@ -1006,27 +1245,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 +1290,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 +1311,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 +1374,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 +1391,6 @@ msgstr "" "Python はメンバ変数のデフォルト値をクラス属性に保持します。\n" "データクラスを使っていない、この例を考えてみましょう::" -#: ../../library/dataclasses.rst:744 msgid "" "class C:\n" " x = []\n" @@ -1138,18 +1404,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 +1434,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,18 +1454,26 @@ 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 "" "This has the same issue as the original example using class :class:`!C`. " -"That is, two instances of class :class:`!D` that do not specify a value for :" -"attr:`!x` when creating a class instance will share the same copy of :attr:`!" -"x`. Because dataclasses just use normal Python class creation they also " -"share this behavior. There is no general way for Data Classes to detect " -"this condition. Instead, the :func:`@dataclass ` decorator will " -"raise a :exc:`ValueError` if it detects an unhashable default parameter. " -"The assumption is that if a value is unhashable, it is mutable. This is a " -"partial solution, but it does protect against many common errors." +"That is, two instances of class :class:`!D` that do not specify a value " +"for :attr:`!x` when creating a class instance will share the same copy " +"of :attr:`!x`. Because dataclasses just use normal Python class creation " +"they also share this behavior. There is no general way for Data Classes to " +"detect this condition. Instead, the :func:`@dataclass ` " +"decorator will raise a :exc:`ValueError` if it detects an unhashable default " +"parameter. The assumption is that if a value is unhashable, it is mutable. " +"This is a partial solution, but it does protect against many common errors." msgstr "" #: ../../library/dataclasses.rst:789 @@ -1195,7 +1484,6 @@ msgstr "" "デフォルトファクトリ関数を使うのが、フィールドのデフォルト値として可変な型の" "新しいインスタンスを作成する手段です::" -#: ../../library/dataclasses.rst:792 msgid "" "@dataclass\n" "class D:\n" @@ -1203,37 +1491,50 @@ 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." +"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." +"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 +1546,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 +1573,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..829b39883 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 @@ -37,16 +37,17 @@ msgstr "" #: ../../library/datatypes.rst:11 msgid "" -"Python also provides some built-in data types, in particular, :class:" -"`dict`, :class:`list`, :class:`set` and :class:`frozenset`, and :class:" -"`tuple`. The :class:`str` class is used to hold Unicode strings, and the :" -"class:`bytes` and :class:`bytearray` classes are used to hold binary data." +"Python also provides some built-in data types, in " +"particular, :class:`dict`, :class:`list`, :class:`set` " +"and :class:`frozenset`, and :class:`tuple`. The :class:`str` class is used " +"to hold Unicode strings, and the :class:`bytes` and :class:`bytearray` " +"classes are used to hold binary data." msgstr "" -"Python にはその他にもいくつかの組み込みデータ型があります。特に、 :class:" -"`dict` 、 :class:`list` 、 :class:`set` 、 :class:`frozenset` 、そして :" -"class:`tuple` があります。 :class:`str` クラスは Unicode データを扱うことがで" -"き、 :class:`bytes` と :class:`bytearray` クラスはバイナリデータを扱うことが" -"できます。" +"Python にはその他にもいくつかの組み込みデータ型があります。特" +"に、 :class:`dict` 、 :class:`list` 、 :class:`set` 、 :class:`frozenset` 、" +"そして :class:`tuple` があります。 :class:`str` クラスは Unicode データを扱う" +"ことができ、 :class:`bytes` と :class:`bytearray` クラスはバイナリデータを扱" +"うことができます。" #: ../../library/datatypes.rst:17 msgid "The following modules are documented in this chapter:" diff --git a/library/datetime.po b/library/datetime.po index 583bc711f..a54be26b5 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 @@ -93,9 +93,9 @@ msgstr ":pypi:`DateType` パッケージ" #: ../../library/datetime.rst:41 msgid "" -"Third-party library that introduces distinct static types to e.g. allow :" -"term:`static type checkers ` to differentiate between " -"naive and aware datetimes." +"Third-party library that introduces distinct static types to e.g. " +"allow :term:`static type checkers ` to differentiate " +"between naive and aware datetimes." msgstr "" #: ../../library/datetime.rst:48 @@ -143,12 +143,12 @@ msgstr "" #: ../../library/datetime.rst:66 msgid "" -"For applications requiring aware objects, :class:`.datetime` and :class:`." -"time` objects have an optional time zone information attribute, :attr:`!" -"tzinfo`, that can be set to an instance of a subclass of the abstract :class:" -"`tzinfo` class. These :class:`tzinfo` objects capture information about the " -"offset from UTC time, the time zone name, and whether daylight saving time " -"is in effect." +"For applications requiring aware objects, :class:`.datetime` " +"and :class:`.time` objects have an optional time zone information " +"attribute, :attr:`!tzinfo`, that can be set to an instance of a subclass of " +"the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture " +"information about the offset from UTC time, the time zone name, and whether " +"daylight saving time is in effect." msgstr "" "aware オブジェクトを必要とするアプリケーションのために、 :class:`.datetime` " "と :class:`.time` オブジェクトは追加のタイムゾーン情報の属性 :attr:`!tzinfo` " @@ -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" @@ -212,8 +211,8 @@ msgstr "利用可能なデータ型" #: ../../library/datetime.rst:108 msgid "" "An idealized naive date, assuming the current Gregorian calendar always was, " -"and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, and :" -"attr:`day`." +"and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, " +"and :attr:`day`." msgstr "" "理想的な naive な日付で、これまでもこれからも現在のグレゴリオ暦 (Gregorian " "calender) が有効であることを仮定しています。\n" @@ -223,8 +222,9 @@ msgstr "" msgid "" "An idealized time, independent of any particular day, assuming that every " "day has exactly 24\\*60\\*60 seconds. (There is no notion of \"leap " -"seconds\" here.) Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, :" -"attr:`microsecond`, and :attr:`.tzinfo`." +"seconds\" here.) " +"Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"and :attr:`.tzinfo`." msgstr "" "理想的な時刻で、特定の日から独立しており、毎日が厳密に 24\\*60\\*60 秒である" "と仮定しています。(\"うるう秒: leap seconds\" の概念はありません。)\n" @@ -233,18 +233,19 @@ msgstr "" #: ../../library/datetime.rst:125 msgid "" -"A combination of a date and a time. Attributes: :attr:`year`, :attr:" -"`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:" -"`microsecond`, and :attr:`.tzinfo`." +"A combination of a date and a time. " +"Attributes: :attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"and :attr:`.tzinfo`." msgstr "" "日付と時刻を組み合わせたものです。\n" -"属性は :attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, :attr:" -"`minute`, :attr:`second`, :attr:`microsecond`, および :attr:`tzinfo` です。" +"属性" +"は :attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"および :attr:`tzinfo` です。" #: ../../library/datetime.rst:133 msgid "" -"A duration expressing the difference between two :class:`.datetime` or :" -"class:`date` instances to microsecond resolution." +"A duration expressing the difference between two :class:`.datetime` " +"or :class:`date` instances to microsecond resolution." msgstr "" ":class:`.datetime` あるいは :class:`date` クラスの二つのインスタンス間の時間" "差をマイクロ秒精度で表す経過時間値です。" @@ -296,8 +297,8 @@ msgid "" "The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone` " "types share these common features:" msgstr "" -":class:`date` 型、:class:`.datetime` 型、:class:`.time` 型、:class:" -"`timezone` 型には共通する特徴があります:" +":class:`date` 型、:class:`.datetime` 型、:class:`.time` " +"型、:class:`timezone` 型には共通する特徴があります:" #: ../../library/datetime.rst:172 msgid "" @@ -334,6 +335,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 +348,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 +366,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 +466,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,18 +473,19 @@ 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 "" -"If the normalized value of days lies outside the indicated range, :exc:" -"`OverflowError` is raised." +"If the normalized value of days lies outside the indicated " +"range, :exc:`OverflowError` is raised." msgstr "" -"日の値を正規化した結果、指定された範囲の外側になった場合には、 :exc:" -"`OverflowError` が送出されます。" +"日の値を正規化した結果、指定された範囲の外側になった場合に" +"は、 :exc:`OverflowError` が送出されます。" #: ../../library/datetime.rst:256 msgid "" @@ -496,13 +501,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 +520,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 @@ -548,8 +563,8 @@ msgstr "" #: ../../library/datetime.rst:299 msgid "" "Note that, because of normalization, ``timedelta.max`` is greater than ``-" -"timedelta.min``. ``-timedelta.max`` is not representable as a :class:" -"`timedelta` object." +"timedelta.min``. ``-timedelta.max`` is not representable as " +"a :class:`timedelta` object." msgstr "" "正規化のために、 ``timedelta.max`` は ``-timedelta.min`` より大きいことに注意" "してください。 ``-timedelta.max`` は :class:`timedelta` オブジェクトとして表" @@ -562,18 +577,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 +603,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 @@ -653,8 +669,8 @@ msgid "" "Delta multiplied by a float. The result is rounded to the nearest multiple " "of timedelta.resolution using round-half-to-even." msgstr "" -"時間差と浮動小数点の積。結果は最近接偶数への丸めを利用して最も近い timedelta." -"resolution の倍数に丸められます。" +"時間差と浮動小数点の積。結果は最近接偶数への丸めを利用して最も近い " +"timedelta.resolution の倍数に丸められます。" #: ../../library/datetime.rst:360 msgid "``f = t2 / t3``" @@ -662,8 +678,8 @@ msgstr "``f = t2 / t3``" #: ../../library/datetime.rst:360 msgid "" -"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :" -"class:`float` object." +"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns " +"a :class:`float` object." msgstr "" "``t2`` を ``t3`` で除算 (3) したもの。:class:`float` オブジェクトを返します。" @@ -708,6 +724,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 +744,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 +815,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 "" @@ -816,8 +839,8 @@ msgstr "" #: ../../library/datetime.rst:429 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " -"support certain additions and subtractions with :class:`date` and :class:`." -"datetime` objects (see below)." +"support certain additions and subtractions with :class:`date` " +"and :class:`.datetime` objects (see below)." msgstr "" "上に列挙した操作に加え :class:`timedelta` オブジェクトは :class:`date` およ" "び :class:`.datetime` オブジェクトとの間で加減算をサポートしています (下を参" @@ -825,10 +848,10 @@ msgstr "" #: ../../library/datetime.rst:433 msgid "" -"Floor division and true division of a :class:`timedelta` object by another :" -"class:`timedelta` object are now supported, as are remainder operations and " -"the :func:`divmod` function. True division and multiplication of a :class:" -"`timedelta` object by a :class:`float` object are now supported." +"Floor division and true division of a :class:`timedelta` object by " +"another :class:`timedelta` object are now supported, as are remainder " +"operations and the :func:`divmod` function. True division and multiplication " +"of a :class:`timedelta` object by a :class:`float` object are now supported." msgstr "" ":class:`timedelta` オブジェクトの別の :class:`timedelta` オブジェクトによる、" "切り捨て除算と真の除算、および剰余演算と :func:`divmod` 関数がサポートされる" @@ -959,9 +982,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." @@ -982,30 +1004,30 @@ msgstr "" #: ../../library/datetime.rst:525 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " -"values supported by the platform C :c:func:`localtime` function, and :exc:" -"`OSError` on :c:func:`localtime` failure. It's common for this to be " -"restricted to years from 1970 through 2038. Note that on non-POSIX systems " -"that include leap seconds in their notion of a timestamp, leap seconds are " -"ignored by :meth:`fromtimestamp`." +"values supported by the platform C :c:func:`localtime` function, " +"and :exc:`OSError` on :c:func:`localtime` failure. It's common for this to " +"be restricted to years from 1970 through 2038. Note that on non-POSIX " +"systems that include leap seconds in their notion of a timestamp, leap " +"seconds are ignored by :meth:`fromtimestamp`." msgstr "" "timestamp がプラットフォームの C 関数 :c:func:`localtime` がサポートする値の" "範囲から外れていた場合、 :exc:`OverflowError` を送出するかもしれません。ま" "た :c:func:`localtime` 呼び出しが失敗した場合には :exc:`OSError` を送出するか" "もしれません。この範囲は通常は 1970 年から 2038 年までに制限されています。タ" -"イムスタンプの表記にうるう秒を含める非 POSIX なシステムでは、うるう秒は :" -"meth:`fromtimestamp` では無視されます。" +"イムスタンプの表記にうるう秒を含める非 POSIX なシステムでは、うるう秒" +"は :meth:`fromtimestamp` では無視されます。" #: ../../library/datetime.rst:532 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " -"function. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:" -"`localtime` failure." +"function. Raise :exc:`OSError` instead of :exc:`ValueError` " +"on :c:func:`localtime` failure." msgstr "" "timestamp がプラットフォームの C 関数 :c:func:`localtime` のサポートする値の" "範囲から外れていた場合、 :exc:`ValueError` ではなく :exc:`OverflowError` を送" -"出するようになりました。 :c:func:`localtime` の呼び出し失敗で :exc:" -"`ValueError` ではなく :exc:`OSError` を送出するようになりました。" +"出するようになりました。 :c:func:`localtime` の呼び出し失敗" +"で :exc:`ValueError` ではなく :exc:`OSError` を送出するようになりました。" #: ../../library/datetime.rst:541 msgid "" @@ -1020,6 +1042,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 "" @@ -1068,21 +1094,23 @@ msgstr "" #: ../../library/datetime.rst:576 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " -"year, week and day. This is the inverse of the function :meth:`date." -"isocalendar`." +"year, week and day. This is the inverse of the " +"function :meth:`date.isocalendar`." 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,16 +1118,20 @@ 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 "" -"If *format* specifies a day of month without a year a :exc:" -"`DeprecationWarning` is emitted. This is to avoid a quadrennial leap year " -"bug in code seeking to parse only a month and day as the default year used " -"in absence of one in the format is not a leap year. Such *format* values may " -"raise an error as of Python 3.15. The workaround is to always include a " -"year in your *format*. If parsing *date_string* values that do not have a " -"year, explicitly add a year that is a leap year before parsing:" +"If *format* specifies a day of month without a year " +"a :exc:`DeprecationWarning` is emitted. This is to avoid a quadrennial leap " +"year bug in code seeking to parse only a month and day as the default year " +"used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" #: ../../library/datetime.rst:604 @@ -1195,19 +1227,18 @@ 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``. " -"``timedelta.seconds`` and ``timedelta.microseconds`` are ignored. :exc:" -"`OverflowError` is raised if ``date2.year`` would be smaller than :const:" -"`MINYEAR` or larger than :const:`MAXYEAR`." +"``timedelta.seconds`` and ``timedelta.microseconds`` are " +"ignored. :exc:`OverflowError` is raised if ``date2.year`` would be smaller " +"than :const:`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" "*date2* は、 ``timedelta.days > 0`` の場合は進む方向に、 ``timedelta.days < " "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 @@ -1216,8 +1247,8 @@ msgstr "``timedelta.seconds`` と ``timedelta.microseconds`` は無視されま #: ../../library/datetime.rst:685 msgid "" -"This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta." -"microseconds`` are 0, and ``date2 + timedelta == date1`` after." +"This is exact, and cannot overflow. ``timedelta.seconds`` and " +"``timedelta.microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" "この演算は厳密で、オーバフローしません。``timedelta.seconds`` および " "``timedelta.microseconds`` は 0 で、演算後には ``date2 + timedelta == " @@ -1237,40 +1268,43 @@ 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 "" -"Order comparison between a :class:`!date` object that is not also a :class:`." -"datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." +"Order comparison between a :class:`!date` object that is not also " +"a :class:`.datetime` instance and a :class:`!datetime` object " +"raises :exc:`TypeError`." msgstr "" #: ../../library/datetime.rst:704 ../../library/datetime.rst:1330 msgid "" -"Comparison between :class:`.datetime` object and an instance of the :class:" -"`date` subclass that is not a :class:`!datetime` subclass no longer converts " -"the latter to :class:`!date`, ignoring the time part and the time zone. The " -"default behavior can be changed by overriding the special comparison methods " -"in subclasses." +"Comparison between :class:`.datetime` object and an instance of " +"the :class:`date` subclass that is not a :class:`!datetime` subclass no " +"longer converts the latter to :class:`!date`, ignoring the time part and the " +"time zone. The default behavior can be changed by overriding the special " +"comparison methods 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,16 +1318,17 @@ 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 "" -"Return a :class:`time.struct_time` such as returned by :func:`time." -"localtime`." +"Return a :class:`time.struct_time` such as returned " +"by :func:`time.localtime`." msgstr "" ":func:`time.localtime` が返すような :class:`time.struct_time` を返します。" @@ -1305,10 +1340,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 "" @@ -1321,15 +1356,18 @@ msgstr "" #: ../../library/datetime.rst:748 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " -"1 has ordinal 1. For any :class:`date` object ``d``, ``date.fromordinal(d." -"toordinal()) == d``." +"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 "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " -"For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" -"meth:`isoweekday`." +"For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See " +"also :meth:`isoweekday`." msgstr "" "月曜日を 0、日曜日を 6 として、曜日を整数で返します。例えば、 ``date(2002, " "12, 4).weekday() == 2`` であり、水曜日を示します。 :meth:`isoweekday` も参照" @@ -1338,12 +1376,12 @@ msgstr "" #: ../../library/datetime.rst:762 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " -"For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" -"meth:`weekday`, :meth:`isocalendar`." +"For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See " +"also :meth:`weekday`, :meth:`isocalendar`." msgstr "" "月曜日を 1,日曜日を 7 として、曜日を整数で返します。例えば、 ``date(2002, " -"12, 4).isoweekday() == 3`` であり、水曜日を示します。 :meth:`weekday`, :meth:" -"`isocalendar` も参照してください。" +"12, 4).isoweekday() == 3`` であり、水曜日を示しま" +"す。 :meth:`weekday`, :meth:`isocalendar` も参照してください。" #: ../../library/datetime.rst:769 msgid "" @@ -1407,6 +1445,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,15 +1463,14 @@ 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 "" -"on platforms where the native C :c:func:`ctime` function (which :func:`time." -"ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " -"the C standard." +"on platforms where the native C :c:func:`ctime` function " +"(which :func:`time.ctime` invokes, but which :meth:`date.ctime` does not " +"invoke) conforms to the C standard." msgstr "" "これが等価になるのは、 (:func:`time.ctime` に呼び出され、 :meth:`date.ctime` " "に呼び出されない) ネイティブの C 関数 :c:func:`ctime` が C 標準に準拠している" @@ -1441,8 +1480,8 @@ msgstr "" msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " -"values. See also :ref:`strftime-strptime-behavior` and :meth:`date." -"isoformat`." +"values. See also :ref:`strftime-strptime-behavior` " +"and :meth:`date.isoformat`." msgstr "" "明示的な書式文字列で制御された、日付を表現する文字列を返します。\n" "時間、分、秒を表す書式コードは値 0 になります。\n" @@ -1457,9 +1496,9 @@ msgid "" "strptime-behavior` and :meth:`date.isoformat`." msgstr "" ":meth:`date.strftime` と等価です。\n" -"これにより、 :ref:`フォーマット済み文字列リテラル ` の中や :meth:" -"`str.format` を使っているときに :class:`.date` オブジェクトの書式文字列を指定" -"できます。\n" +"これにより、 :ref:`フォーマット済み文字列リテラル ` の中" +"や :meth:`str.format` を使っているときに :class:`.date` オブジェクトの書式文" +"字列を指定できます。\n" ":ref:`strftime-strptime-behavior` および :meth:`date.isoformat` も参照してく" "ださい。" @@ -1548,8 +1587,9 @@ msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -":class:`.datetime` オブジェクトは :class:`date` オブジェクトおよび :class:`." -"time` オブジェクトの全ての情報が入っている単一のオブジェクトです。" +":class:`.datetime` オブジェクトは :class:`date` オブジェクトおよ" +"び :class:`.time` オブジェクトの全ての情報が入っている単一のオブジェクトで" +"す。" #: ../../library/datetime.rst:911 msgid "" @@ -1622,9 +1662,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 +1680,19 @@ 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)." +"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 +1708,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``." @@ -1701,12 +1742,12 @@ msgstr "" "naive な ``datetime`` オブジェクトは多くの ``datetime`` メソッドでローカルな" "時間として扱われるため、 aware な datetime を使って UTC の時刻を表すのが好ま" "しいです。\n" -"そのため、 UTC での現在の時刻を表すオブジェクトの作成では ``datetime." -"now(timezone.utc)`` を呼び出す方法が推奨されます。" +"そのため、 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 "" @@ -1732,22 +1773,22 @@ msgstr "" msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :" -"c:func:`gmtime` failure. It's common for this to be restricted to years in " -"1970 through 2038. Note that on non-POSIX systems that include leap seconds " -"in their notion of a timestamp, leap seconds are ignored by :meth:" -"`fromtimestamp`, and then it's possible to have two timestamps differing by " -"a second that yield identical :class:`.datetime` objects. This method is " -"preferred over :meth:`utcfromtimestamp`." -msgstr "" -"タイムスタンプがプラットフォームの C 関数 :c:func:`localtime` や :c:func:" -"`gmtime` でサポートされている範囲を超えた場合、 :meth:`fromtimestamp` は :" -"exc:`OverflowError` を送出することがあります。この範囲はよく 1970 年から " -"2038 年に制限されています。\n" +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " +"or :c:func:`gmtime` failure. It's common for this to be restricted to years " +"in 1970 through 2038. Note that on non-POSIX systems that include leap " +"seconds in their notion of a timestamp, leap seconds are ignored " +"by :meth:`fromtimestamp`, and then it's possible to have two timestamps " +"differing by a second that yield identical :class:`.datetime` objects. This " +"method is preferred over :meth:`utcfromtimestamp`." +msgstr "" +"タイムスタンプがプラットフォームの C 関数 :c:func:`localtime` " +"や :c:func:`gmtime` でサポートされている範囲を超えた場" +"合、 :meth:`fromtimestamp` は :exc:`OverflowError` を送出することがあります。" +"この範囲はよく 1970 年から 2038 年に制限されています。\n" "また :c:func:`localtime` や :c:func:`gmtime` が失敗した際は :exc:`OSError` を" "送出します。\n" -"うるう秒がタイムスタンプの概念に含まれている非 POSIX システムでは、 :meth:" -"`fromtimestamp` はうるう秒を無視します。\n" +"うるう秒がタイムスタンプの概念に含まれている非 POSIX システムで" +"は、 :meth:`fromtimestamp` はうるう秒を無視します。\n" "このため、秒の異なる二つのタイムスタンプが同一の :class:`.datetime` オブジェ" "クトとなることが起こり得ます。\n" ":meth:`utcfromtimestamp` よりも、このメソッドの方が好ましいです。" @@ -1756,38 +1797,37 @@ msgstr "" msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions. Raise :exc:`OSError` instead of :exc:" -"`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." +"or :c:func:`gmtime` functions. Raise :exc:`OSError` instead " +"of :exc:`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -"timestamp がプラットフォームの C 関数 :c:func:`localtime` もしくは :c:func:" -"`gmtime` のサポートする値の範囲から外れていた場合、 :exc:`ValueError` ではな" -"く :exc:`OverflowError` を送出するようになりました。 :c:func:`localtime` もし" -"くは :c:func:`gmtime` の呼び出し失敗で :exc:`ValueError` ではなく :exc:" -"`OSError` を送出するようになりました。" +"timestamp がプラットフォームの C 関数 :c:func:`localtime` もしく" +"は :c:func:`gmtime` のサポートする値の範囲から外れていた場" +"合、 :exc:`ValueError` ではなく :exc:`OverflowError` を送出するようになりまし" +"た。 :c:func:`localtime` もしくは :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 "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -"POSIX タイムスタンプに対応する、:attr:`tzinfo` が ``None`` の UTC での :" -"class:`.datetime` を返します。(返されるオブジェクトは naive です。)" +"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." +"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 +1836,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 +1845,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." +"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 "" @@ -1838,17 +1876,18 @@ msgstr "" msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " -"function. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:" -"`gmtime` failure." +"function. Raise :exc:`OSError` instead of :exc:`ValueError` " +"on :c:func:`gmtime` failure." msgstr "" "timestamp がプラットフォームの C 関数 :c:func:`gmtime` のサポートする値の範囲" "から外れていた場合、 :exc:`ValueError` ではなく :exc:`OverflowError` を送出す" "るようになりました。 :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 "" @@ -1858,12 +1897,12 @@ msgid "" "minute, second and microsecond of the result are all 0, and :attr:`.tzinfo` " "is ``None``." msgstr "" -"1 年 1 月 1 日を序数 1 とする早期グレゴリオ暦序数に対応する :class:`." -"datetime` オブジェクトを返します。\n" +"1 年 1 月 1 日を序数 1 とする早期グレゴリオ暦序数に対応す" +"る :class:`.datetime` オブジェクトを返します。\n" "``1 <= ordinal <= datetime.max.toordinal()`` でなければ :exc:`ValueError` が" "送出されます。\n" -"返されるオブジェクトの時間、分、秒、およびマイクロ秒はすべて 0 で、 :attr:" -"`tzinfo` は ``None`` となっています。" +"返されるオブジェクトの時間、分、秒、およびマイクロ秒はすべて 0 " +"で、 :attr:`tzinfo` は ``None`` となっています。" #: ../../library/datetime.rst:1074 msgid "" @@ -1872,8 +1911,8 @@ msgid "" "given :class:`.time` object's. If the *tzinfo* argument is provided, its " "value is used to set the :attr:`.tzinfo` attribute of the result, otherwise " "the :attr:`~.time.tzinfo` attribute of the *time* argument is used. If the " -"*date* argument is a :class:`.datetime` object, its time components and :" -"attr:`.tzinfo` attributes are ignored." +"*date* argument is a :class:`.datetime` object, its time components " +"and :attr:`.tzinfo` attributes are ignored." msgstr "" "日付部分と与えられた :class:`date` オブジェクトとが等しく、時刻部分と与えられ" "た :class:`.time` オブジェクトとが等しい、新しい :class:`.datetime` オブジェ" @@ -1883,11 +1922,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)``." +"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." @@ -1931,25 +1971,26 @@ msgid "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)\n" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" -"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, " +"tzinfo=datetime.timezone.utc)\n" ">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " 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`." +"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 "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " -"with their normal default values. This is the inverse of the function :meth:" -"`datetime.isocalendar`." +"with their normal default values. This is the inverse of the " +"function :meth:`datetime.isocalendar`." msgstr "" "年月日で指定された ISO 暦の日付に対応する :class:`.datetime` を返します。\n" "datetime の日付でない部分は、標準のデフォルト値で埋められます。\n" @@ -1970,28 +2011,27 @@ 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 "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " -"See also :ref:`strftime-strptime-behavior` and :meth:`datetime." -"fromisoformat`." +"See also :ref:`strftime-strptime-behavior` " +"and :meth:`datetime.fromisoformat`." msgstr "" "date_string と format が :func:`time.strptime` で構文解析できない場合や、この" -"関数が時刻タプルを返してこない場合には :exc:`ValueError` を送出します。:ref:" -"`strftime-strptime-behavior` および :meth:`datetime.fromisoformat` も参照して" -"ください。" +"関数が時刻タプルを返してこない場合には :exc:`ValueError` を送出しま" +"す。:ref:`strftime-strptime-behavior` および :meth:`datetime.fromisoformat` " +"も参照してください。" #: ../../library/datetime.rst:1157 msgid "" -"If *format* specifies a day of month without a year a :exc:" -"`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " -"year bug in code seeking to parse only a month and day as the default year " -"used in absence of one in the format is not a leap year. Such *format* " +"If *format* specifies a day of month without a year " +"a :exc:`DeprecationWarning` is now emitted. This is to avoid a quadrennial " +"leap year bug in code seeking to parse only a month and day as the default " +"year used in absence of one in the format is not a leap year. Such *format* " "values may raise an error as of Python 3.15. The workaround is to always " "include a year in your *format*. If parsing *date_string* values that do " "not have a year, explicitly add a year that is a leap year before parsing:" @@ -2118,12 +2158,12 @@ msgstr "``datetime1 >= datetime2``" #: ../../library/datetime.rst:1269 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " -"moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." -"days < 0``. The result has the same :attr:`~.datetime.tzinfo` attribute as " -"the input datetime, and ``datetime2 - datetime1 == timedelta`` after. :exc:" -"`OverflowError` is raised if ``datetime2.year`` would be smaller than :const:" -"`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time zone " -"adjustments are done even if the input is an aware object." +"moving forward in time if ``timedelta.days > 0``, or backward if " +"``timedelta.days < 0``. The result has the same :attr:`~.datetime.tzinfo` " +"attribute as the input datetime, and ``datetime2 - datetime1 == timedelta`` " +"after. :exc:`OverflowError` is raised if ``datetime2.year`` would be smaller " +"than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time " +"zone adjustments are done even if the input is an aware object." msgstr "" "``datetime2`` は ``datetime1`` から時間 ``timedelta`` 移動したもので、" "``timedelta.days > 0`` の場合未来へ、``timedelta.days < 0`` の場合過去へ移動" @@ -2156,22 +2196,30 @@ 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." +"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 " -"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b." -"replace(tzinfo=None) - b.utcoffset())`` except that the implementation never " -"overflows." -msgstr "" +"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - " +"(b.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 +2252,13 @@ msgstr "" "タイムゾーンを考慮して、*datetime1* が時刻として *datetime2* よりも前を表す場" "合に、*datetime1* は *datetime2* よりも小さいと見なされます。" -#: ../../library/datetime.rst:1316 msgid "" -"Order comparison between naive and aware :class:`.datetime` objects raises :" -"exc:`TypeError`." +"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 +2267,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." @@ -2250,21 +2303,25 @@ msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -"同じhour、minute、second、microsecond、fold および tzinfo 属性を持つ :class:" -"`.time` オブジェクトを返します。 :meth:`time` メソッドも参照してください。" +"同じ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 "" -":class:`.datetime` objects are also supported by generic function :func:" -"`copy.replace`." +":class:`.datetime` objects are also supported by generic " +"function :func:`copy.replace`." msgstr "" ":class:`.datetime` オブジェクトは汎用的な関数 :func:`copy.replace` にもサポー" "トされています。" @@ -2280,7 +2337,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 +2344,9 @@ msgid "" msgstr "" "もし与えられた場合、 *tz* は :class:`tzinfo` のサブクラスのインスタンスでなけ" "ればならず、 インスタンスの :meth:`utcoffset` および :meth:`dst` メソッドは " -"``None`` を返してはなりません。もし *self* が naive ならば、おそらくシステム" -"のタイムゾーンで時間を表現します。" +"``None`` を返してはなりません。\n" +"*self* が naive の場合は、システムのタイムゾーンの時刻を表すものとして扱われ" +"ます。" #: ../../library/datetime.rst:1389 msgid "" @@ -2321,29 +2378,28 @@ msgstr "" #: ../../library/datetime.rst:1400 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " -"*dt* without adjustment of date and time data, use ``dt." -"replace(tzinfo=tz)``. If you merely want to remove the :class:`!timezone` " -"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* without adjustment of date and time data, use " +"``dt.replace(tzinfo=tz)``. If you merely want to remove the :class:`!" +"timezone` object from an aware datetime *dt* without conversion of date and " +"time data, use ``dt.replace(tzinfo=None)``." +msgstr "" +"単に :class:`timezone` オブジェクト *tz* を ``datetime`` オブジェクト *dt* に" +"追加したいだけで、日付や時刻データへの調整を行わないのなら、" +"``dt.replace(tzinfo=tz)`` を使ってください。単に aware な ``datetime`` オブ" "ジェクト *dt* から :class:`!timezone` オブジェクトを除去したいだけで、日付や" "時刻データの変換を行わないのなら、``dt.replace(tzinfo=None)`` を使ってくださ" "い。" #: ../../library/datetime.rst:1405 msgid "" -"Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" -"class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " -"Ignoring error cases, :meth:`astimezone` acts like::" +"Note that the default :meth:`tzinfo.fromutc` method can be overridden in " +"a :class:`tzinfo` subclass to affect the result returned " +"by :meth:`astimezone`. Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" "デフォルトの :meth:`tzinfo.fromutc` メソッドを :class:`tzinfo` のサブクラスで" "上書きして, :meth:`astimezone` が返す結果に影響を及ぼすことができます。エラー" "の場合を無視すると、 :meth:`astimezone` は以下のように動作します::" -#: ../../library/datetime.rst:1409 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -2353,6 +2409,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,15 +2430,15 @@ 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 " -"``None`` or a :class:`timedelta` object with magnitude less than one day." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.utcoffset(self)``, and raises an exception if the latter " +"doesn't return ``None`` or a :class:`timedelta` object with magnitude less " +"than one day." 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 @@ -2386,9 +2449,10 @@ msgstr "UTC オフセットが分単位でなければならない制限が無 #: ../../library/datetime.rst:1437 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"dst(self)``, and raises an exception if the latter doesn't return ``None`` " -"or a :class:`timedelta` object with magnitude less than one day." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.dst(self)``, and raises an exception if the latter doesn't " +"return ``None`` or a :class:`timedelta` object with magnitude less than one " +"day." msgstr "" ":attr:`.tzinfo` が ``None`` の場合 ``None`` を返し、そうでない場合には " "``self.tzinfo.dst(self)`` を返します。\n" @@ -2402,31 +2466,33 @@ msgstr "DST オフセットが分単位でなければならない制限が無 #: ../../library/datetime.rst:1447 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"tzname(self)``, raises an exception if the latter doesn't return ``None`` or " -"a string object," +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.tzname(self)``, raises an exception if the latter doesn't " +"return ``None`` or a string object," msgstr "" ":attr:`.tzinfo` が ``None`` の場合 ``None`` を返し、そうでない場合には " "``self.tzinfo.tzname(self)`` を返します。\n" "後者の式が ``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 "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " -"day number within the current year starting with 1 for January 1st. The :" -"attr:`~time.struct_time.tm_isdst` flag of the result is set according to " -"the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` returns " -"``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` returns a " -"non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!tm_isdst` is set " -"to 0." +"day number within the current year starting with 1 for January 1st. " +"The :attr:`~time.struct_time.tm_isdst` flag of the result is set according " +"to the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` " +"returns ``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` " +"returns a non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!" +"tm_isdst` is set to 0." msgstr "" "ここで ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` はその年" "の1月1日を 1 としたときのその日の位置です。\n" @@ -2436,65 +2502,71 @@ 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." +"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 " -"returned. :attr:`!tm_isdst` is forced to 0. Note that an :exc:" -"`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or ``MAXYEAR`` " -"and UTC adjustment spills over a year boundary." +"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 returned. :attr:`!tm_isdst` is forced to 0. Note that " +"an :exc:`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 " "UTC; as a result, using :meth:`datetime.utctimetuple` may give misleading " -"results. If you have a naive ``datetime`` representing UTC, use ``datetime." -"replace(tzinfo=timezone.utc)`` to make it aware, at which point you can use :" -"meth:`.datetime.timetuple`." +"results. If you have a naive ``datetime`` representing UTC, use " +"``datetime.replace(tzinfo=timezone.utc)`` to make it aware, at which point " +"you can use :meth:`.datetime.timetuple`." 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 "" -"Return the proleptic Gregorian ordinal of the date. The same as ``self." -"date().toordinal()``." +"Return the proleptic Gregorian ordinal of the date. The same as " +"``self.date().toordinal()``." 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`." +"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 "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " "the conversion. Since :class:`.datetime` supports wider range of values " -"than :c:func:`mktime` on many platforms, this method may raise :exc:" -"`OverflowError` or :exc:`OSError` for times far in the past or far in the " -"future." +"than :c:func:`mktime` on many platforms, this method may " +"raise :exc:`OverflowError` or :exc:`OSError` for times far in the past or " +"far in the future." msgstr "" "このメソッドでは naive な :class:`.datetime` インスタンスはローカル時刻とし、" "プラットフォームの C 関数 :c:func:`mktime` に頼って変換を行います。\n" @@ -2509,9 +2581,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 "" @@ -2523,10 +2594,10 @@ msgstr "" #: ../../library/datetime.rst:1524 msgid "" -"There is no method to obtain the POSIX timestamp directly from a naive :" -"class:`.datetime` instance representing UTC time. If your application uses " -"this convention and your system time zone is not set to UTC, you can obtain " -"the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" +"There is no method to obtain the POSIX timestamp directly from a " +"naive :class:`.datetime` instance representing UTC time. If your application " +"uses this convention and your system time zone is not set to UTC, you can " +"obtain the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" "UTC 時刻を表す naive な :class:`.datetime` インスタンスから直接 POSIX タイム" "スタンプを取得するメソッドはありません。\n" @@ -2534,35 +2605,34 @@ 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 "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -"月曜日を 0、日曜日を 6 として、曜日を整数で返します。 ``self.date()." -"weekday()`` と同じです。 :meth:`isoweekday` も参照してください。" +"月曜日を 0、日曜日を 6 として、曜日を整数で返します。 " +"``self.date().weekday()`` と同じです。 :meth:`isoweekday` も参照してくださ" +"い。" #: ../../library/datetime.rst:1544 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " -"The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" -"`isocalendar`." +"The same as ``self.date().isoweekday()``. See " +"also :meth:`weekday`, :meth:`isocalendar`." msgstr "" -"月曜日を 1、日曜日を 7 として、曜日を整数で返します。 ``self.date()." -"isoweekday()`` と等価です。 :meth:`weekday` 、 :meth:`isocalendar` も参照して" -"ください。" +"月曜日を 1、日曜日を 7 として、曜日を整数で返します。 " +"``self.date().isoweekday()`` と等価で" +"す。 :meth:`weekday` 、 :meth:`isocalendar` も参照してください。" #: ../../library/datetime.rst:1551 msgid "" @@ -2597,8 +2667,8 @@ msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" msgstr "" -":attr:`microsecond` が 0 でない場合は ``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:" -"SS[.ffffff]]``" +":attr:`microsecond` が 0 でない場合は ``YYYY-MM-" +"DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``" #: ../../library/datetime.rst:1567 msgid "" @@ -2670,22 +2740,20 @@ msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -"``'seconds'``: :attr:`hour` 、 :attr:`minute` 、 :attr:`second` を ``HH:MM:" -"SS`` の書式で含めます。" +"``'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 +2777,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(' ')``." +"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::" @@ -2736,35 +2805,35 @@ msgstr "" #: ../../library/datetime.rst:1644 msgid "" -"on platforms where the native C :c:func:`ctime` function (which :func:`time." -"ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " -"to the C standard." +"on platforms where the native C :c:func:`ctime` function " +"(which :func:`time.ctime` invokes, but which :meth:`datetime.ctime` does not " +"invoke) conforms to the C standard." msgstr "" -"これが等価になるのは、 (:func:`time.ctime` に呼び出され、 :meth:`datetime." -"ctime` に呼び出されない) ネイティブの C 関数 :c:func:`ctime` が C 標準に準拠" -"しているプラットフォーム上でです。" +"これが等価になるのは、 (:func:`time.ctime` に呼び出さ" +"れ、 :meth:`datetime.ctime` に呼び出されない) ネイティブの C 関" +"数 :c:func:`ctime` が C 標準に準拠しているプラットフォーム上でです。" #: ../../library/datetime.rst:1651 msgid "" "Return a string representing the date and time, controlled by an explicit " -"format string. See also :ref:`strftime-strptime-behavior` and :meth:" -"`datetime.isoformat`." +"format string. See also :ref:`strftime-strptime-behavior` " +"and :meth:`datetime.isoformat`." msgstr "" -"明示的な書式文字列で制御された、日付および時刻を表現する文字列を返します。:" -"ref:`strftime-strptime-behavior` および :meth:`datetime.isoformat` も参照して" -"ください。" +"明示的な書式文字列で制御された、日付および時刻を表現する文字列を返しま" +"す。:ref:`strftime-strptime-behavior` および :meth:`datetime.isoformat` も参" +"照してください。" #: ../../library/datetime.rst:1658 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " -"literals ` and when using :meth:`str.format`. See also :ref:" -"`strftime-strptime-behavior` and :meth:`datetime.isoformat`." +"literals ` and when using :meth:`str.format`. See " +"also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" ":meth:`.datetime.strftime` と等価です。\n" -"これにより、 :ref:`フォーマット済み文字列リテラル ` の中や :meth:" -"`str.format` を使っているときに :class:`.datetime` オブジェクトの書式文字列を" -"指定できます。\n" +"これにより、 :ref:`フォーマット済み文字列リテラル ` の中" +"や :meth:`str.format` を使っているときに :class:`.datetime` オブジェクトの書" +"式文字列を指定できます。\n" ":ref:`strftime-strptime-behavior` および :meth:`datetime.isoformat` も参照し" "てください。" @@ -2790,8 +2859,8 @@ msgid "" ">>> datetime.now()\n" "datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> # Using datetime.strptime()\n" ">>> dt = datetime.strptime(\"21/11/06 16:30\", \"%d/%m/%y %H:%M\")\n" @@ -2825,8 +2894,8 @@ msgid "" ">>> # Formatting a datetime\n" ">>> dt.strftime(\"%A, %d. %B %Y %I:%M%p\")\n" "'Tuesday, 21. November 2006 04:30PM'\n" -">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.'." -"format(dt, \"day\", \"month\", \"time\")\n" +">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:" +"%M%p}.'.format(dt, \"day\", \"month\", \"time\")\n" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" @@ -2930,8 +2999,8 @@ msgstr "" #: ../../library/datetime.rst:1800 msgid "" -"All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" -"class:`tzinfo` subclass. The remaining arguments must be integers in the " +"All arguments are optional. *tzinfo* may be ``None``, or an instance of " +"a :class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" "全ての引数はオプションです。 *tzinfo* は ``None`` または :class:`tzinfo` クラ" @@ -2958,8 +3027,8 @@ msgstr "" #: ../../library/datetime.rst:1828 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " -"``timedelta(microseconds=1)``, although note that arithmetic on :class:`." -"time` objects is not supported." +"``timedelta(microseconds=1)``, although note that arithmetic " +"on :class:`.time` objects is not supported." msgstr "" "等しくない :class:`.time` オブジェクト間の最小の差で、 " "``timedelta(microseconds=1)`` ですが, :class:`.time` オブジェクト間の四則演算" @@ -2973,17 +3042,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 "" @@ -3004,8 +3078,8 @@ msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -"aware な インスタンスと naive な :class:`.time` インスタンスの等価比較では :" -"exc:`TypeError` は送出されません。" +"aware な インスタンスと naive な :class:`.time` インスタンスの等価比較で" +"は :exc:`TypeError` は送出されません。" #: ../../library/datetime.rst:1888 msgid "" @@ -3026,9 +3100,8 @@ msgstr "" "た。\n" "全詳細については :issue:`13936` を参照してください。" -#: ../../library/datetime.rst:1897 msgid "Other constructors:" -msgstr "" +msgstr "その他のコンストラクタ:" #: ../../library/datetime.rst:1901 msgid "" @@ -3038,17 +3111,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:" @@ -3068,25 +3141,27 @@ msgid "" ">>> time.fromisoformat('04:23:01,000384')\n" "datetime.time(4, 23, 1, 384)\n" ">>> time.fromisoformat('04:23:01+04:00')\n" -"datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime." -"timedelta(seconds=14400)))\n" +"datetime.time(4, 23, 1, " +"tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n" ">>> time.fromisoformat('04:23:01Z')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n" ">>> time.fromisoformat('04:23:01+00:00')\n" "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`." +"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 +3170,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`." +"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 "" @@ -3117,8 +3194,8 @@ msgstr "" #: ../../library/datetime.rst:1966 msgid "" -":class:`.time` objects are also supported by generic function :func:`copy." -"replace`." +":class:`.time` objects are also supported by generic " +"function :func:`copy.replace`." msgstr "" ":class:`.time` オブジェクトは汎用的な関数 :func:`copy.replace` にもサポートさ" "れています。" @@ -3140,13 +3217,13 @@ msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -":meth:`utcoffset` が ``None`` を返さない場合、 ``HH:MM:SS.ffffff+HH:MM[:SS[." -"ffffff]]``" +":meth:`utcoffset` が ``None`` を返さない場合、 " +"``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``" #: ../../library/datetime.rst:1980 msgid "" -"``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" -"`utcoffset` does not return ``None``" +"``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 " +"and :meth:`utcoffset` does not return ``None``" msgstr "" ":attr:`microsecond` が 0 で :meth:`utcoffset` が ``None`` を返さない場合、 " "``HH:MM:SS+HH:MM[:SS[.ffffff]]``" @@ -3158,8 +3235,8 @@ msgstr "不正な *timespec* 引数には :exc:`ValueError` があげられま #: ../../library/datetime.rst:2004 msgid "" ">>> from datetime import time\n" -">>> time(hour=12, minute=34, second=56, microsecond=123456)." -"isoformat(timespec='minutes')\n" +">>> time(hour=12, minute=34, second=56, " +"microsecond=123456).isoformat(timespec='minutes')\n" "'12:34'\n" ">>> dt = time(hour=12, minute=34, second=56, microsecond=0)\n" ">>> dt.isoformat(timespec='microseconds')\n" @@ -3168,19 +3245,18 @@ 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 "" "Return a string representing the time, controlled by an explicit format " -"string. See also :ref:`strftime-strptime-behavior` and :meth:`time." -"isoformat`." +"string. See also :ref:`strftime-strptime-behavior` " +"and :meth:`time.isoformat`." msgstr "" -"明示的な書式文字列で制御された、時刻を表現する文字列を返します。:ref:" -"`strftime-strptime-behavior` および :meth:`time.isoformat` も参照してくださ" -"い。" +"明示的な書式文字列で制御された、時刻を表現する文字列を返しま" +"す。:ref:`strftime-strptime-behavior` および :meth:`time.isoformat` も参照し" +"てください。" #: ../../library/datetime.rst:2030 msgid "" @@ -3190,28 +3266,29 @@ msgid "" "strptime-behavior` and :meth:`time.isoformat`." msgstr "" ":meth:`.time.strftime` と等価です。\n" -"これにより、 :ref:`フォーマット済み文字列リテラル ` の中や :meth:" -"`str.format` を使っているときに :class:`.time` オブジェクトの書式文字列を指定" -"できます。\n" +"これにより、 :ref:`フォーマット済み文字列リテラル ` の中" +"や :meth:`str.format` を使っているときに :class:`.time` オブジェクトの書式文" +"字列を指定できます。\n" ":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 " -"``None`` or a :class:`timedelta` object with magnitude less than one day." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.utcoffset(None)``, and raises an exception if the latter " +"doesn't return ``None`` or a :class:`timedelta` object with magnitude less " +"than one day." msgstr "" ":attr:`.tzinfo` が ``None`` の場合、 ``None`` を返し、そうでない場合には " "``self.tzinfo.utcoffset(None)`` を返します。\n" -"後者の式が ``None`` あるいは 1 日以下の大きさを持つ :class:`timedelta` オブ" +"後者の式が ``None`` あるいは 1 日未満の大きさを持つ :class:`timedelta` オブ" "ジェクトのいずれかを返さない場合には例外を送出します。" #: ../../library/datetime.rst:2048 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"dst(None)``, and raises an exception if the latter doesn't return ``None``, " -"or a :class:`timedelta` object with magnitude less than one day." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.dst(None)``, and raises an exception if the latter doesn't " +"return ``None``, or a :class:`timedelta` object with magnitude less than one " +"day." msgstr "" ":attr:`.tzinfo` が ``None`` の場合 ``None`` を返し、そうでない場合には " "``self.tzinfo.dst(None)`` を返します。\n" @@ -3220,9 +3297,9 @@ msgstr "" #: ../../library/datetime.rst:2057 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"tzname(None)``, or raises an exception if the latter doesn't return ``None`` " -"or a string object." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.tzname(None)``, or raises an exception if the latter doesn't " +"return ``None`` or a string object." msgstr "" ":attr:`.tzinfo` が ``None`` の場合 ``None`` を返し、そうでない場合には " "``self.tzinfo.tzname(None)`` を返します。\n" @@ -3284,38 +3361,38 @@ msgstr "" msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " -"objects view their attributes as being in local time, and the :class:" -"`tzinfo` object supports methods revealing offset of local time from UTC, " -"the name of the time zone, and DST offset, all relative to a date or time " -"object passed to them." +"objects view their attributes as being in local time, and " +"the :class:`tzinfo` object supports methods revealing offset of local time " +"from UTC, the name of the time zone, and DST offset, all relative to a date " +"or time object passed to them." msgstr "" ":class:`tzinfo` (の具体的なサブクラス) のインスタンスは :class:`.datetime` お" "よび :class:`.time` オブジェクトのコンストラクタに渡すことができます。後者の" -"オブジェクトでは、データ属性をローカル時刻におけるものとして見ており、 :" -"class:`tzinfo` オブジェクトはローカル時刻の UTC からのオフセット、タイムゾー" -"ンの名前、 DST オフセットを、渡された日付および時刻オブジェクトからの相対で示" -"すためのメソッドを提供します。" +"オブジェクトでは、データ属性をローカル時刻におけるものとして見てお" +"り、 :class:`tzinfo` オブジェクトはローカル時刻の UTC からのオフセット、タイ" +"ムゾーンの名前、 DST オフセットを、渡された日付および時刻オブジェクトからの相" +"対で示すためのメソッドを提供します。" #: ../../library/datetime.rst:2109 msgid "" "You need to derive a concrete subclass, and (at least) supply " -"implementations of the standard :class:`tzinfo` methods needed by the :class:" -"`.datetime` methods you use. The :mod:`!datetime` module provides :class:" -"`timezone`, a simple concrete subclass of :class:`tzinfo` which can " -"represent time zones with fixed offset from UTC such as UTC itself or North " -"American EST and EDT." +"implementations of the standard :class:`tzinfo` methods needed by " +"the :class:`.datetime` methods you use. The :mod:`!datetime` module " +"provides :class:`timezone`, a simple concrete subclass of :class:`tzinfo` " +"which can represent time zones with fixed offset from UTC such as UTC itself " +"or North American EST and EDT." msgstr "" "具象サブクラスを作成し、(少なくとも) 使いたい :class:`.datetime` のメソッドが" "必要とする :class:`tzinfo` のメソッドを実装する必要があります。\n" -":mod:`!datetime` モジュールは :class:`tzinfo` のシンプルな具象サブクラス :" -"class:`timezone` を提供します。\n" +":mod:`!datetime` モジュールは :class:`tzinfo` のシンプルな具象サブクラ" +"ス :class:`timezone` を提供します。\n" "これは UTC そのものか北アメリカの EST と EDT のような UTC からの固定されたオ" "フセットを持つタイムゾーンを表せます。" #: ../../library/datetime.rst:2116 msgid "" -"Special requirement for pickling: A :class:`tzinfo` subclass must have an :" -"meth:`~object.__init__` method that can be called with no arguments, " +"Special requirement for pickling: A :class:`tzinfo` subclass must have " +"an :meth:`~object.__init__` method that can be called with no arguments, " "otherwise it can be pickled but possibly not unpickled again. This is a " "technical requirement that may be relaxed in the future." msgstr "" @@ -3328,8 +3405,8 @@ msgstr "" #: ../../library/datetime.rst:2122 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " -"methods. Exactly which methods are needed depends on the uses made of aware :" -"mod:`!datetime` objects. If in doubt, simply implement all of them." +"methods. Exactly which methods are needed depends on the uses made of " +"aware :mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" ":class:`tzinfo` の具体的なサブクラスでは、以下のメソッドを実装する必要があり" "ます。厳密にどのメソッドが必要なのかは、 aware な :mod:`!datetime` オブジェク" @@ -3341,23 +3418,24 @@ msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -"ローカル時間の UTC からのオフセットを、 UTC から東向きを正とした :class:" -"`timedelta` オブジェクトで返します。ローカル時間が UTC の西側にある場合、この" -"値は負になります。" +"ローカル時間の UTC からのオフセットを、 UTC から東向きを正とし" +"た :class:`timedelta` オブジェクトで返します。ローカル時間が UTC の西側にある" +"場合、この値は負になります。" #: ../../library/datetime.rst:2132 msgid "" -"This represents the *total* offset from UTC; for example, if a :class:" -"`tzinfo` object represents both time zone and DST adjustments, :meth:" -"`utcoffset` should return their sum. If the UTC offset isn't known, return " -"``None``. Else the value returned must be a :class:`timedelta` object " -"strictly between ``-timedelta(hours=24)`` and ``timedelta(hours=24)`` (the " -"magnitude of the offset must be less than one day). Most implementations of :" -"meth:`utcoffset` will probably look like one of these two::" -msgstr "" -"このメソッドは UTC からのオフセットの *総計* を表しています。例えば、 :class:" -"`tzinfo` オブジェクトがタイムゾーンと DST 修正の両方を表現する場合、 :meth:" -"`utcoffset` はそれらの合計を返さなければなりません。\n" +"This represents the *total* offset from UTC; for example, if " +"a :class:`tzinfo` object represents both time zone and DST " +"adjustments, :meth:`utcoffset` should return their sum. If the UTC offset " +"isn't known, return ``None``. Else the value returned must be " +"a :class:`timedelta` object strictly between ``-timedelta(hours=24)`` and " +"``timedelta(hours=24)`` (the magnitude of the offset must be less than one " +"day). Most implementations of :meth:`utcoffset` will probably look like one " +"of these two::" +msgstr "" +"このメソッドは UTC からのオフセットの *総計* を表しています。例え" +"ば、 :class:`tzinfo` オブジェクトがタイムゾーンと DST 修正の両方を表現する場" +"合、 :meth:`utcoffset` はそれらの合計を返さなければなりません。\n" "UTC オフセットが未知である場合、 ``None`` を返します。\n" "そうでない場合には、返される値は ``-timedelta(hours=24)`` から " "``timedelta(hours=24)`` までの :class:`timedelta` 境界を含まないオブジェクト" @@ -3366,11 +3444,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 "" @@ -3382,8 +3461,8 @@ msgstr "" #: ../../library/datetime.rst:2146 msgid "" -"The default implementation of :meth:`utcoffset` raises :exc:" -"`NotImplementedError`." +"The default implementation of :meth:`utcoffset` " +"raises :exc:`NotImplementedError`." msgstr "" ":meth:`utcoffset` のデフォルトの実装は :exc:`NotImplementedError` を送出しま" "す。" @@ -3396,28 +3475,29 @@ 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 " "details). Note that DST offset, if applicable, has already been added to the " -"UTC offset returned by :meth:`utcoffset`, so there's no need to consult :" -"meth:`dst` unless you're interested in obtaining DST info separately. For " -"example, :meth:`datetime.timetuple` calls its :attr:`~.datetime.tzinfo` " -"attribute's :meth:`dst` method to determine how the :attr:`~time.struct_time." -"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 による変更があるかどうかを調べます。" +"UTC offset returned by :meth:`utcoffset`, so there's no need to " +"consult :meth:`dst` unless you're interested in obtaining DST info " +"separately. For example, :meth:`datetime.timetuple` calls " +"its :attr:`~.datetime.tzinfo` attribute's :meth:`dst` method to determine " +"how the :attr:`~time.struct_time.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" +"適用される場合は、調整量を :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 "" @@ -3433,25 +3513,26 @@ msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" #: ../../library/datetime.rst:2174 msgid "" -"must return the same result for every :class:`.datetime` *dt* with ``dt." -"tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " -"the time zone's \"standard offset\", which should not depend on the date or " -"the time, but only on geographic location. The implementation of :meth:" -"`datetime.astimezone` relies on this, but cannot detect violations; it's the " -"programmer's responsibility to ensure it. If a :class:`tzinfo` subclass " -"cannot guarantee this, it may be able to override the default implementation " -"of :meth:`tzinfo.fromutc` to work correctly with :meth:`~.datetime." -"astimezone` regardless." +"must return the same result for every :class:`.datetime` *dt* with " +"``dt.tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression " +"yields the time zone's \"standard offset\", which should not depend on the " +"date or the time, but only on geographic location. The implementation " +"of :meth:`datetime.astimezone` relies on this, but cannot detect violations; " +"it's the programmer's responsibility to ensure it. If a :class:`tzinfo` " +"subclass cannot guarantee this, it may be able to override the default " +"implementation of :meth:`tzinfo.fromutc` to work correctly " +"with :meth:`~.datetime.astimezone` regardless." msgstr "" "が、 ``dt.tzinfo == tz`` 全ての :class:`.datetime` オブジェクト *dt* について" "常に同じ結果を返さなければならないという点で、一貫性を持っていなければなりま" "せん。正常に実装された :class:`tzinfo` のサブクラスでは、この式はタイムゾーン" "における \"標準オフセット (standard offset)\" を表し、特定の日や時刻の事情で" -"はなく地理的な位置にのみ依存していなくてはなりません。 :meth:`datetime." -"astimezone` の実装はこの事実に依存していますが、違反を検出することができませ" -"ん; 正しく実装するのはプログラマの責任です。 :class:`tzinfo` のサブクラスでこ" -"れを保証することができない場合、 :meth:`tzinfo.fromutc` の実装をオーバライド" -"して、 :meth:`astimezone` に関わらず正しく動作するようにしてもかまいません。" +"はなく地理的な位置にのみ依存していなくてはなりませ" +"ん。 :meth:`datetime.astimezone` の実装はこの事実に依存していますが、違反を検" +"出することができません; 正しく実装するのはプログラマの責任で" +"す。 :class:`tzinfo` のサブクラスでこれを保証することができない場" +"合、 :meth:`tzinfo.fromutc` の実装をオーバライドして、 :meth:`astimezone` に" +"関わらず正しく動作するようにしてもかまいません。" #: ../../library/datetime.rst:2183 msgid "" @@ -3499,25 +3580,25 @@ msgid "" "particular. For example, ``\"GMT\"``, ``\"UTC\"``, ``\"-500\"``, " "``\"-5:00\"``, ``\"EDT\"``, ``\"US/Eastern\"``, ``\"America/New York\"`` are " "all valid replies. Return ``None`` if a string name isn't known. Note that " -"this is a method rather than a fixed string primarily because some :class:" -"`tzinfo` subclasses will wish to return different names depending on the " -"specific value of *dt* passed, especially if the :class:`tzinfo` class is " -"accounting for daylight time." +"this is a method rather than a fixed string primarily because " +"some :class:`tzinfo` subclasses will wish to return different names " +"depending on the specific value of *dt* passed, especially if " +"the :class:`tzinfo` class is accounting for daylight time." msgstr "" ":class:`.datetime` オブジェクト *dt* に対応するタイムゾーン名を文字列で返しま" "す。 :mod:`!datetime` モジュールでは文字列名について何も定義しておらず、特に" "何かを意味するといった要求仕様もまったくありません。例えば、``\"GMT\"``, " "``\"UTC\"``, ``\"-500\"``, ``\"-5:00\"``, ``\"EDT\"``, ``\"US/Eastern\"``, " "``\"America/New York\"`` は全て有効な応答となります。文字列名が未知の場合に" -"は ``None`` を返してください。 :class:`tzinfo` のサブクラスでは、特に, :" -"class:`tzinfo` クラスが夏時間について記述している場合のように、渡された *dt* " -"の特定の値によって異なった名前を返したい場合があるため、文字列値ではなくメ" -"ソッドとなっていることに注意してください。" +"は ``None`` を返してください。 :class:`tzinfo` のサブクラスでは、特" +"に, :class:`tzinfo` クラスが夏時間について記述している場合のように、渡された " +"*dt* の特定の値によって異なった名前を返したい場合があるため、文字列値ではなく" +"メソッドとなっていることに注意してください。" #: ../../library/datetime.rst:2219 msgid "" -"The default implementation of :meth:`tzname` raises :exc:" -"`NotImplementedError`." +"The default implementation of :meth:`tzname` " +"raises :exc:`NotImplementedError`." msgstr "" "デフォルトの :meth:`tzname` 実装は :exc:`NotImplementedError` を送出します。" @@ -3527,8 +3608,8 @@ msgid "" "in response to their methods of the same names. A :class:`.datetime` object " "passes itself as the argument, and a :class:`.time` object passes ``None`` " "as the argument. A :class:`tzinfo` subclass's methods should therefore be " -"prepared to accept a *dt* argument of ``None``, or of class :class:`." -"datetime`." +"prepared to accept a *dt* argument of ``None``, or of " +"class :class:`.datetime`." msgstr "" "以下のメソッドは :class:`.datetime` や :class:`.time` オブジェクトにおいて、" "同名のメソッドが呼び出された際に応じて呼び出されます。 :class:`.datetime` オ" @@ -3537,7 +3618,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,27 +3625,27 @@ 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 "" -"When a :class:`.datetime` object is passed in response to a :class:`." -"datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" -"`tzinfo` methods can rely on this, unless user code calls :class:`tzinfo` " -"methods directly. The intent is that the :class:`tzinfo` methods interpret " -"*dt* as being in local time, and not need worry about objects in other time " -"zones." +"When a :class:`.datetime` object is passed in response to " +"a :class:`.datetime` method, ``dt.tzinfo`` is the same object as " +"*self*. :class:`tzinfo` methods can rely on this, unless user code " +"calls :class:`tzinfo` methods directly. The intent is that " +"the :class:`tzinfo` methods interpret *dt* as being in local time, and not " +"need worry about objects in other time zones." msgstr "" ":class:`.datetime` オブジェクトが :meth:`.datetime` メソッドの応答として返さ" "れた場合、 ``dt.tzinfo`` は *self* と同じオブジェクトになります。ユーザが直" "接 :class:`tzinfo` メソッドを呼び出さないかぎり、 :class:`tzinfo` メソッドは " -"``dt.tzinfo`` と *self* が同じであることに依存します。その結果 :class:" -"`tzinfo` メソッドは *dt* がローカル時間であると解釈するので、他のタイムゾーン" -"でのオブジェクトの振る舞いについて心配する必要がありません。" +"``dt.tzinfo`` と *self* が同じであることに依存します。その結" +"果 :class:`tzinfo` メソッドは *dt* がローカル時間であると解釈するので、他のタ" +"イムゾーンでのオブジェクトの振る舞いについて心配する必要がありません。" #: ../../library/datetime.rst:2240 msgid "" @@ -3575,44 +3655,43 @@ 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 " -"data are to be viewed as expressing a UTC time. The purpose of :meth:" -"`fromutc` is to adjust the date and time data, returning an equivalent " -"datetime in *self*'s local time." +"data are to be viewed as expressing a UTC time. The purpose " +"of :meth:`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 "" -"Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" -"`fromutc` implementation without problems. It's strong enough to handle " -"fixed-offset time zones, and time zones accounting for both standard and " -"daylight time, and the latter even if the DST transition times differ in " -"different years. An example of a time zone the default :meth:`fromutc` " -"implementation may not handle correctly in all cases is one where the " -"standard offset (from UTC) depends on the specific date and time passed, " -"which can happen for political reasons. The default implementations of :meth:" -"`~.datetime.astimezone` and :meth:`fromutc` may not produce the result you " -"want if the result is one of the hours straddling the moment the standard " -"offset changes." +"Most :class:`tzinfo` subclasses should be able to inherit the " +"default :meth:`fromutc` implementation without problems. It's strong enough " +"to handle fixed-offset time zones, and time zones accounting for both " +"standard and daylight time, and the latter even if the DST transition times " +"differ in different years. An example of a time zone the " +"default :meth:`fromutc` implementation may not handle correctly in all cases " +"is one where the standard offset (from UTC) depends on the specific date and " +"time passed, which can happen for political reasons. The default " +"implementations of :meth:`~.datetime.astimezone` and :meth:`fromutc` may not " +"produce the result you want if the result is one of the hours straddling the " +"moment the standard offset changes." msgstr "" "ほとんどの :class:`tzinfo` サブクラスではデフォルトの :meth:`fromutc` 実装を" "問題なく継承できます。デフォルトの実装は、固定オフセットのタイムゾーンや、標" "準時と夏時間の両方について記述しているタイムゾーン、そして DST 移行時刻が年に" -"よって異なる場合でさえ、扱えるくらい強力なものです。デフォルトの :meth:" -"`fromutc` 実装が全ての場合に対して正しく扱うことができないような例は、標準時" -"の (UTCからの) オフセットが引数として渡された特定の日や時刻に依存するもので、" -"これは政治的な理由によって起きることがあります。デフォルトの :meth:`~." -"datetime.astimezone` や :meth:`fromutc` の実装は、結果が標準時オフセットの変" -"化にまたがる何時間かの中にある場合、期待通りの結果を生成しないかもしれませ" -"ん。" +"よって異なる場合でさえ、扱えるくらい強力なものです。デフォルト" +"の :meth:`fromutc` 実装が全ての場合に対して正しく扱うことができないような例" +"は、標準時の (UTCからの) オフセットが引数として渡された特定の日や時刻に依存す" +"るもので、これは政治的な理由によって起きることがあります。デフォルト" +"の :meth:`~.datetime.astimezone` や :meth:`fromutc` の実装は、結果が標準時オ" +"フセットの変化にまたがる何時間かの中にある場合、期待通りの結果を生成しないか" +"もしれません。" #: ../../library/datetime.rst:2262 msgid "" @@ -3642,8 +3721,8 @@ msgstr "" #: ../../library/datetime.rst:2280 msgid "" -"In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." -"py>` file there are some examples of :class:`tzinfo` classes:" +"In the following :download:`tzinfo_examples.py <../includes/" +"tzinfo_examples.py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" "次の :download:`tzinfo_examples.py <../includes/tzinfo_examples.py>` ファイル" "には、 :class:`tzinfo` クラスの例がいくつか載っています:" @@ -3828,21 +3907,19 @@ 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 " -"transition points. For concreteness, consider US Eastern (UTC -0500), where " -"EDT begins the minute after 1:59 (EST) on the second Sunday in March, and " -"ends the minute after 1:59 (EDT) on the first Sunday in November::" +"Note that there are unavoidable subtleties twice per year in " +"a :class:`tzinfo` subclass accounting for both standard and daylight time, " +"at the DST transition points. For concreteness, consider US Eastern (UTC " +"-0500), where EDT begins the minute after 1:59 (EST) on the second Sunday in " +"March, and ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" "標準時および夏時間の両方を記述している :class:`tzinfo` のサブクラスでは、夏時" "間の移行のときに、回避不能の難解な問題が年に 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 +3929,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 "" @@ -3908,11 +3992,10 @@ msgstr "" "そして :meth:`~.datetime.astimezone` は 2 つの隣り合う UTC 時間を同じローカル" "の時間に対応付けて、ローカルの時計の振る舞いを真似ます。\n" "東部の例では、 5:MM および 6:MM という形式の UTC 時刻は両方とも東部時刻に変換" -"された際に 1:MM に対応付けられますが、それ以前の時間は :attr:`~.datetime." -"fold` 属性を 0 にし、以降の時間では 1 にします。例えば、 2016 年での秋方向の" -"移行では、次のような結果になります::" +"された際に 1:MM に対応付けられますが、それ以前の時間" +"は :attr:`~.datetime.fold` 属性を 0 にし、以降の時間では 1 にします。例え" +"ば、 2016 年での秋方向の移行では、次のような結果になります::" -#: ../../library/datetime.rst:2330 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3925,6 +4008,16 @@ msgid "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" msgstr "" +">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" +">>> for i in range(4):\n" +"... u = u0 + i*HOUR\n" +"... t = u.astimezone(Eastern)\n" +"... print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)\n" +"...\n" +"04:00:00 UTC = 00:00:00 EDT 0\n" +"05:00:00 UTC = 01:00:00 EDT 0\n" +"06:00:00 UTC = 01:00:00 EST 1\n" +"07:00:00 UTC = 02:00:00 EST 0" #: ../../library/datetime.rst:2341 msgid "" @@ -3937,17 +4030,17 @@ msgstr "" #: ../../library/datetime.rst:2344 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " -"the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" -"class:`tzinfo` subclasses; there are no ambiguities when using :class:" -"`timezone`, or any other fixed-offset :class:`tzinfo` subclass (such as a " -"class representing only EST (fixed offset -5 hours), or only EDT (fixed " -"offset -4 hours))." -msgstr "" -"壁時間に関する曖昧さは、明示的に :attr:`~.datetime.fold` 属性を検証するか、 :" -"class:`timezone` が使用されたハイブリッドな :class:`tzinfo` サブクラスか、そ" -"のほかの絶対時間差を示す :class:`tzinfo` サブクラス(EST (-5 時間の絶対時間" -"差) のみを表すクラスや、 EDT (-4 時間の絶対時間差) のみを表すクラス)を使用す" -"ると回避できます。\n" +"the value of the :attr:`~.datetime.fold` attribute or avoid using " +"hybrid :class:`tzinfo` subclasses; there are no ambiguities when " +"using :class:`timezone`, or any other fixed-offset :class:`tzinfo` subclass " +"(such as a class representing only EST (fixed offset -5 hours), or only EDT " +"(fixed offset -4 hours))." +msgstr "" +"壁時間に関する曖昧さは、明示的に :attr:`~.datetime.fold` 属性を検証する" +"か、 :class:`timezone` が使用されたハイブリッドな :class:`tzinfo` サブクラス" +"か、そのほかの絶対時間差を示す :class:`tzinfo` サブクラス(EST (-5 時間の絶対" +"時間差) のみを表すクラスや、 EDT (-4 時間の絶対時間差) のみを表すクラス)を使" +"用すると回避できます。\n" "このような曖昧さを許容できないアプリケーションは、このような手法によって回避" "すべきです。" @@ -4030,8 +4123,9 @@ msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -"*name* 引数は必須ではありません。もし指定された場合、その値は :meth:" -"`datetime.tzname` メソッドの返り値として使われる文字列でなければなりません。" +"*name* 引数は必須ではありません。もし指定された場合、その値" +"は :meth:`datetime.tzname` メソッドの返り値として使われる文字列でなければなり" +"ません。" #: ../../library/datetime.rst:2400 ../../library/datetime.rst:2411 msgid "" @@ -4049,7 +4143,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 +4153,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 "" @@ -4078,8 +4171,8 @@ msgstr "常に ``None`` を返します。" #: ../../library/datetime.rst:2431 msgid "" -"Return ``dt + offset``. The *dt* argument must be an aware :class:`." -"datetime` instance, with ``tzinfo`` set to ``self``." +"Return ``dt + offset``. The *dt* argument must be an " +"aware :class:`.datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" "``dt + offset`` を返します。 *dt* 引数は ``tzinfo`` が ``self`` になっている " "aware な :class:`.datetime` インスタンスでなければなりません。" @@ -4102,17 +4195,19 @@ 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." +"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 "" -"The table below provides a high-level comparison of :meth:`~.datetime." -"strftime` versus :meth:`~.datetime.strptime`:" +"The table below provides a high-level comparison " +"of :meth:`~.datetime.strftime` versus :meth:`~.datetime.strptime`:" msgstr "" "下の表は :meth:`~.datetime.strftime` と :meth:`~.datetime.strptime` との高レ" "ベルの対比を表しています。" @@ -4133,9 +4228,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 +4261,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 "" @@ -4633,11 +4728,11 @@ msgstr "(空文字列), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" #: ../../library/datetime.rst:2613 msgid "" -"These may not be available on all platforms when used with the :meth:`~." -"datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " -"are not interchangeable with the year and week number directives above. " -"Calling :meth:`~.datetime.strptime` with incomplete or ambiguous ISO 8601 " -"directives will raise a :exc:`ValueError`." +"These may not be available on all platforms when used with " +"the :meth:`~.datetime.strftime` method. The ISO 8601 year and ISO 8601 week " +"directives are not interchangeable with the year and week number directives " +"above. Calling :meth:`~.datetime.strptime` with incomplete or ambiguous ISO " +"8601 directives will raise a :exc:`ValueError`." msgstr "" "これらが :meth:`~.datetime.strftime` メソッドと一緒に使用された場合、すべての" "プラットフォームで利用できるわけではありません。 ISO 8601 year 指定子および" @@ -4657,8 +4752,8 @@ msgstr "" "Python はプラットフォームの C ライブラリの :c:func:`strftime` 関数を呼び出し" "ていて、プラットフォームごとにその実装が異なるのはよくあることなので、サポー" "トされる書式コード全体はプラットフォームごとに様々です。\n" -"手元のプラットフォームでサポートされているフォーマット記号全体を見るには、 :" -"manpage:`strftime(3)` のドキュメントを参照してください。\n" +"手元のプラットフォームでサポートされているフォーマット記号全体を見るに" +"は、 :manpage:`strftime(3)` のドキュメントを参照してください。\n" "サポートされていないフォーマット指定子の扱いもプラットフォーム間で差異があり" "ます。" @@ -4677,12 +4772,13 @@ msgstr "技術詳細" #: ../../library/datetime.rst:2633 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " -"``time.strftime(fmt, d.timetuple())`` although not all objects support a :" -"meth:`~date.timetuple` method." +"``time.strftime(fmt, d.timetuple())`` although not all objects support " +"a :meth:`~date.timetuple` method." msgstr "" -"大雑把にいうと、 ``d.strftime(fmt)`` は :mod:`time` モジュールの ``time." -"strftime(fmt, d.timetuple())`` のように動作します。ただし全てのオブジェクト" -"が :meth:`~date.timetuple` メソッドをサポートしているわけではありません。" +"大雑把にいうと、 ``d.strftime(fmt)`` は :mod:`time` モジュールの " +"``time.strftime(fmt, d.timetuple())`` のように動作します。ただし全てのオブ" +"ジェクトが :meth:`~date.timetuple` メソッドをサポートしているわけではありませ" +"ん。" #: ../../library/datetime.rst:2637 msgid "" @@ -4698,25 +4794,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,17 +4820,17 @@ 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 "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " "also platform-dependent. On some platforms such code points are preserved " -"intact in the output, while on others ``strftime`` may raise :exc:" -"`UnicodeError` or return an empty string instead." +"intact in the output, while on others ``strftime`` may " +"raise :exc:`UnicodeError` or return an empty string instead." msgstr "" "同じ理由で、現在のロケールの文字集合で表現できない Unicode コードポイントを含" "む書式文字列の対処もプラットフォーム依存です。\n" @@ -4742,13 +4838,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 +4874,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 "" @@ -4826,9 +4923,9 @@ msgid "" "seconds and ``ffffff`` is a 6-digit string giving the number of UTC offset " "microseconds. The ``ffffff`` part is omitted when the offset is a whole " "number of seconds and both the ``ffffff`` and the ``SS`` part is omitted " -"when the offset is a whole number of minutes. For example, if :meth:`~." -"datetime.utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, ``%z`` is " -"replaced with the string ``'-0330'``." +"when the offset is a whole number of minutes. For example, " +"if :meth:`~.datetime.utcoffset` returns ``timedelta(hours=-3, " +"minutes=-30)``, ``%z`` is replaced with the string ``'-0330'``." msgstr "" ":meth:`~.datetime.utcoffset` は ``±HHMM[SS[.ffffff]]`` 形式の文字列に変換され" "ます。ここで、 ``HH`` は UTC オフセットの時間を表す 2 桁の文字列、 ``MM`` は " @@ -4861,9 +4958,9 @@ msgstr "" #: ../../library/datetime.rst:2731 msgid "" -"In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" -"meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " -"the returned value, which must be a string." +"In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string " +"if :meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced " +"by the returned value, which must be a string." msgstr "" " :meth:`~.datetime.strftime` では、 :meth:`~.datetime.tzname` が ``None`` を" "返した場合、 ``%Z`` は空文字列に置き換わります。そうでない場合、 ``%Z`` は返" @@ -4898,8 +4995,8 @@ msgid "" "of the result will be set to a :class:`timezone` instance." msgstr "" "``%z`` 指定子が :meth:`~.datetime.strptime` メソッドに与えられた場合、 aware " -"な :class:`.datetime` オブジェクトが作成されます。返り値の ``tzinfo`` は :" -"class:`timezone` インスタンスになっています。" +"な :class:`.datetime` オブジェクトが作成されます。返り値の ``tzinfo`` " +"は :class:`timezone` インスタンスになっています。" #: ../../library/datetime.rst:2750 msgid "" @@ -4913,12 +5010,13 @@ msgstr "" #: ../../library/datetime.rst:2755 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " -"day of the week and the ISO year (``%G``) are specified in a :meth:`~." -"datetime.strptime` format string. Also note that ``%G`` and ``%Y`` are not " -"interchangeable." +"day of the week and the ISO year (``%G``) are specified in " +"a :meth:`~.datetime.strptime` format string. Also note that ``%G`` and " +"``%Y`` are not interchangeable." msgstr "" -"``%U`` および ``%W`` と同様に、 ``%V`` は曜日と ISO 年 (``%G``) が :meth:`~." -"datetime.strptime` の書式文字列の中で指定された場合に計算でのみ使われます。\n" +"``%U`` および ``%W`` と同様に、 ``%V`` は曜日と ISO 年 (``%G``) " +"が :meth:`~.datetime.strptime` の書式文字列の中で指定された場合に計算でのみ使" +"われます。\n" "``%G`` と ``%Y`` は互いに完全な互換性を持たないことにも注意してください。" #: ../../library/datetime.rst:2761 @@ -4987,8 +5085,9 @@ msgid "" "~gent0113/calendar/isocalendar.htm>`_ for a good explanation." msgstr "" "優れた説明は R. H. van Gent の `guide to the mathematics of the ISO 8601 " -"calendar `_ を参照してください。" +"calendar `_ を参照してくださ" +"い。" #: ../../library/datetime.rst:2798 msgid "" @@ -5002,6 +5101,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..ff20fd762 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 "" @@ -62,108 +59,101 @@ msgid "" "the first item --- the latter is used when :exc:`dbm.error` is raised." msgstr "" "サポートされているモジュールそれぞれによって送出される可能性のある例外を含む" -"タプル。これにはユニークな例外があり、最初の要素として同じく :exc:`dbm." -"error` という名前の例外が含まれます --- :exc:`dbm.error` が送出される場合、後" -"者(訳注:タプルの ``dbm.error`` ではなく例外 :exc:`dbm.error`)が使用されます。" +"タプル。これにはユニークな例外があり、最初の要素として同じ" +"く :exc:`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." +"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." +"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 "" "The object returned by :func:`~dbm.open` supports the same basic " "functionality as a :class:`dict`; keys and their corresponding values can be " -"stored, retrieved, and deleted, and the :keyword:`in` operator and the :meth:" -"`!keys` method are available, as well as :meth:`!get` and :meth:`!" +"stored, retrieved, and deleted, and the :keyword:`in` operator and " +"the :meth:`!keys` method are available, as well as :meth:`!get` and :meth:`!" "setdefault` methods." msgstr "" @@ -184,21 +174,23 @@ msgstr "" #: ../../library/dbm.rst:99 msgid "" -":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" -"`dbm` backends." +":meth:`!get` and :meth:`!setdefault` methods are now available for " +"all :mod:`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,29 +243,27 @@ 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 "" "This module uses the standard library :mod:`sqlite3` module to provide an " -"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." -"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " -"including the SQLite CLI." +"SQLite backend for the :mod:`dbm` module. The files created " +"by :mod:`dbm.sqlite3` can thus be opened by :mod:`sqlite3`, or any other " +"SQLite browser, 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/dbm.rst:169 msgid "" @@ -282,15 +272,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,22 +308,23 @@ msgid "" "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"このモジュールは :ref:`モバイルプラットフォーム ` " +"と :ref:`WebAssemblyプラットフォーム ` をサポートしませ" +"ん。" #: ../../library/dbm.rst:214 msgid "" -"Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" -"`KeyError` is raised for general mapping errors like specifying an incorrect " -"key." +"Raised on :mod:`dbm.gnu`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like specifying " +"an incorrect key." msgstr "" "I/O エラーのような :mod:`dbm.gnu` 特有のエラーで送出されます。誤ったキーの指" "定のように、一般的なマップ型のエラーに対しては :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,63 +335,80 @@ 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 "" -":class:`!gdbm` objects behave similar to :term:`mappings `, but :" -"meth:`!items` and :meth:`!values` methods are not supported. The following " -"methods are also provided:" +":class:`!gdbm` objects behave similar to :term:`mappings `, " +"but :meth:`!items` and :meth:`!values` methods are not supported. The " +"following 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,22 +420,30 @@ 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. :" -"class:`!gdbm` objects will not shorten the length of a database file except " -"by using this reorganization; otherwise, deleted file space will be kept and " -"reused as new (key, value) pairs are added." -msgstr "" +"space used by the GDBM file, this routine will reorganize the " +"database. :class:`!gdbm` objects will not shorten the length of a database " +"file except 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 +453,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,52 +475,55 @@ 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 "" -"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" -"`KeyError` is raised for general mapping errors like specifying an incorrect " -"key." +"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like specifying " +"an incorrect key." msgstr "" "I/O エラーのような :mod:`dbm.ndbm` 特有のエラーで送出されます。誤ったキーの指" "定のように、一般的なマップ型のエラーに対しては :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 "" -":class:`!ndbm` objects behave similar to :term:`mappings `, but :" -"meth:`!items` and :meth:`!values` methods are not supported. The following " -"methods are also provided:" +":class:`!ndbm` objects behave similar to :term:`mappings `, " +"but :meth:`!items` and :meth:`!values` methods are not supported. The " +"following 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." @@ -521,10 +539,10 @@ msgstr "**ソースコード:** :source:`Lib/dbm/dumb.py`" #: ../../library/dbm.rst:392 msgid "" -"The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" -"mod:`dbm` module when a more robust module is not available. The :mod:`dbm." -"dumb` module is not written for speed and is not nearly as heavily used as " -"the other database modules." +"The :mod:`dbm.dumb` module is intended as a last resort fallback for " +"the :mod:`dbm` module when a more robust module is not available. " +"The :mod:`dbm.dumb` module is not written for speed and is not nearly as " +"heavily used as the other database modules." msgstr "" ":mod:`dbm.dumb` モジュールは、 :mod:`dbm` が頑健なモジュールを他に見つけるこ" "とができなかった際の最後の手段とされています。 :mod:`dbm.dumb` モジュールは速" @@ -538,15 +556,14 @@ 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 "" -"Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" -"`KeyError` is raised for general mapping errors like specifying an incorrect " -"key." +"Raised on :mod:`dbm.dumb`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like " +"specifying an incorrect key." msgstr "" "I/O エラーのような :mod:`dbm.dumb` 特有のエラーの際に送出されます。不正なキー" "を指定したときのような、一般的な対応付けエラーの際には :exc:`KeyError` が送出" @@ -559,40 +576,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`" +"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,32 +623,36 @@ 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 "" -"In addition to the methods provided by the :class:`collections.abc." -"MutableMapping` class, the following methods are provided:" +"In addition to the methods provided by " +"the :class:`collections.abc.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..f17e7b6c2 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 @@ -36,8 +36,8 @@ msgstr "**ソースコード:** :source:`Lib/decimal.py`" #: ../../library/decimal.rst:33 msgid "" "The :mod:`decimal` module provides support for fast correctly rounded " -"decimal floating-point arithmetic. It offers several advantages over the :" -"class:`float` datatype:" +"decimal floating-point arithmetic. It offers several advantages over " +"the :class:`float` datatype:" msgstr "" ":mod:`decimal` モジュールは、高速で正確に丸められた10進浮動小数点演算のサポー" "トを提供します。これには、 :class:`float` データ型よりも優れたいくつかの利点" @@ -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,42 +153,39 @@ msgid "" "``+0``." msgstr "" "十進数型は変更不能です。これは符号、係数部、そして指数を持ちます。有効桁数を" -"残すために、仮数部の末尾にあるゼロは切り詰められません。 :mod:`decimal` で" -"は、 ``Infinity``, ``-Infinity``, および ``NaN`` といった特殊な値も定義されて" -"います。標準仕様では ``-0`` と ``+0`` も区別します。" +"残すために、仮数部の末尾にあるゼロは切り詰められません。 ``decimal`` では、 " +"``Infinity``, ``-Infinity``, および ``NaN`` といった特殊な値も定義されていま" +"す。標準仕様では ``-0`` と ``+0`` も区別します。" #: ../../library/decimal.rst:94 msgid "" "The context for arithmetic is an environment specifying precision, rounding " "rules, limits on exponents, flags indicating the results of operations, and " "trap enablers which determine whether signals are treated as exceptions. " -"Rounding options include :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:" -"`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:" -"`ROUND_HALF_UP`, :const:`ROUND_UP`, and :const:`ROUND_05UP`." +"Rounding options " +"include :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:`ROUND_HALF_UP`, :const:`ROUND_UP`, " +"and :const:`ROUND_05UP`." msgstr "" "算術コンテキストとは、精度や値丸めの規則、指数部の制限を決めている環境です。" "この環境では、演算結果を表すためのフラグや、演算上発生した特定のシグナルを例" "外として扱うかどうかを決めるトラップイネーブラも定義しています。丸め規則に" -"は :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:`ROUND_FLOOR`, :const:" -"`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:`ROUND_HALF_UP`, :const:" -"`ROUND_UP`, および :const:`ROUND_05UP` があります。" +"は :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:`ROUND_HALF_UP`, :const:`ROUND_UP`, " +"および :const:`ROUND_05UP` があります。" #: ../../library/decimal.rst:101 msgid "" "Signals are groups of exceptional conditions arising during the course of " "computation. Depending on the needs of the application, signals may be " "ignored, considered as informational, or treated as exceptions. The signals " -"in the decimal module are: :const:`Clamped`, :const:`InvalidOperation`, :" -"const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:" -"`Subnormal`, :const:`Overflow`, :const:`Underflow` and :const:" -"`FloatOperation`." +"in the decimal module " +"are: :const:`Clamped`, :const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow` " +"and :const:`FloatOperation`." msgstr "" "シグナルとは、演算の過程で生じる例外的条件です。個々のシグナルは、アプリケー" "ションそれぞれの要求に従って、無視されたり、単なる情報とみなされたり、例外と" -"して扱われたりします。 :mod:`decimal` モジュールには、 :const:`Clamped`, :" -"const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:" -"`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow`, およ" -"び :const:`FloatOperation` といったシグナルがあります。" +"して扱われたりします。 ``decimal`` モジュールに" +"は、 :const:`Clamped`, :const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow`, " +"および :const:`FloatOperation` といったシグナルがあります。" #: ../../library/decimal.rst:108 msgid "" @@ -212,9 +208,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 +217,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 +230,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 +246,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 +270,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 +297,6 @@ msgstr "" ":exc:`FloatOperation` シグナルがトラップされる場合、コンストラクタや順序比較" "において誤って decimal と float が混ざると、例外が送出されます::" -#: ../../library/decimal.rst:167 msgid "" ">>> c = getcontext()\n" ">>> c.traps[FloatOperation] = True\n" @@ -295,6 +311,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 +330,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,30 +345,43 @@ 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 "" "If the internal limits of the C version are exceeded, constructing a decimal " "raises :class:`InvalidOperation`::" msgstr "" -"C バージョンの内部制限を超えた場合、decimal の構成は :class:" -"`InvalidOperation` を送出します::" +"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 +409,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:" @@ -396,8 +461,8 @@ msgstr "" #: ../../library/decimal.rst:266 msgid "" "For more advanced work, it may be useful to create alternate contexts using " -"the Context() constructor. To make an alternate active, use the :func:" -"`setcontext` function." +"the Context() constructor. To make an alternate active, use " +"the :func:`setcontext` function." msgstr "" "より高度な作業を行う場合、 :func:`Context` コンストラクタを使って別の演算コン" "テキストを作っておくと便利なことがあります。別の演算コンテキストをアクティブ" @@ -406,16 +471,15 @@ msgstr "" #: ../../library/decimal.rst:270 msgid "" "In accordance with the standard, the :mod:`decimal` module provides two " -"ready to use standard contexts, :const:`BasicContext` and :const:" -"`ExtendedContext`. The former is especially useful for debugging because " -"many of the traps are enabled:" +"ready to use standard contexts, :const:`BasicContext` " +"and :const:`ExtendedContext`. The former is especially useful for debugging " +"because many of the traps are enabled:" msgstr "" ":mod:`decimal` モジュールでは、標準仕様に従って、すぐ利用できる二つの標準コン" "テキスト、 :const:`BasicContext` および :const:`ExtendedContext` を提供してい" "ます。前者はほとんどのトラップが有効になっており、とりわけデバッグの際に便利" "です:" -#: ../../library/decimal.rst:275 msgid "" ">>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)\n" ">>> setcontext(myothercontext)\n" @@ -438,6 +502,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 "" @@ -448,10 +532,10 @@ msgid "" msgstr "" "演算コンテキストには、演算中に遭遇した例外的状況をモニタするためのシグナルフ" "ラグがあります。フラグが一度セットされると、明示的にクリアするまで残り続けま" -"す。そのため、フラグのモニタを行いたいような演算の前には :meth:`~Context." -"clear_flags` メソッドでフラグをクリアしておくのがベストです。 ::" +"す。そのため、フラグのモニタを行いたいような演算の前に" +"は :meth:`~Context.clear_flags` メソッドでフラグをクリアしておくのがベストで" +"す。 ::" -#: ../../library/decimal.rst:304 msgid "" ">>> setcontext(ExtendedContext)\n" ">>> getcontext().clear_flags()\n" @@ -461,6 +545,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 +571,6 @@ msgstr "" "コンテキストの :attr:`~Context.traps` 属性に入っている辞書を使うと、個々のト" "ラップをセットできます:" -#: ../../library/decimal.rst:319 msgid "" ">>> setcontext(ExtendedContext)\n" ">>> Decimal(1) / Decimal(0)\n" @@ -492,6 +582,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 +602,9 @@ msgid "" msgstr "" "ほとんどのプログラムでは、開始時に一度だけ現在の演算コンテキストを修正しま" "す。また、多くのアプリケーションでは、データから :class:`Decimal` への変換は" -"ループ内で一度だけキャストして行います。コンテキストを設定し、 :class:" -"`Decimal` オブジェクトを生成できたら、ほとんどのプログラムは他の Python 数値" -"型と全く変わらないかのように :class:`Decimal` を操作できます。" +"ループ内で一度だけキャストして行います。コンテキストを設定し、 ``Decimal`` オ" +"ブジェクトを生成できたら、ほとんどのプログラムは他の Python 数値型と全く変わ" +"らないかのように ``Decimal`` を操作できます。" #: ../../library/decimal.rst:343 msgid "Decimal objects" @@ -517,18 +616,17 @@ msgstr "*value* に基づいて新たな :class:`Decimal` オブジェクトを #: ../../library/decimal.rst:350 msgid "" -"*value* can be an integer, string, tuple, :class:`float`, or another :class:" -"`Decimal` object. If no *value* is given, returns ``Decimal('0')``. If " -"*value* is a string, it should conform to the decimal numeric string syntax " -"after leading and trailing whitespace characters, as well as underscores " -"throughout, are removed::" +"*value* can be an integer, string, tuple, :class:`float`, or " +"another :class:`Decimal` object. If no *value* is given, returns " +"``Decimal('0')``. If *value* is a string, it should conform to the decimal " +"numeric string syntax after leading and trailing whitespace characters, as " +"well as underscores throughout, are removed::" msgstr "" "*value* は整数、文字列、タプル、 :class:`float` および他の :class:`Decimal` " "オブジェクトにできます。 *value* を指定しない場合、 ``Decimal('0')`` を返しま" "す。 *value* が文字列の場合、先頭と末尾の空白および全てのアンダースコアを取り" "除いた後には以下の 10進数文字列の文法に従わなければなりません::" -#: ../../library/decimal.rst:355 msgid "" "sign ::= '+' | '-'\n" "digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | " @@ -542,8 +640,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 +660,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 +678,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 +685,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 +714,7 @@ msgstr "" "*context* 引数の目的は、 *value* が正しくない形式の文字列であった場合に行う処" "理を決めることにあります; 演算コンテキストが :const:`InvalidOperation` をト" "ラップするようになっていれば、例外を送出します。それ以外の場合には、コンスト" -"ラクタは値が ``NaN`` の :class:`Decimal` を返します。" +"ラクタは値が ``NaN`` の ``Decimal`` を返します。" #: ../../library/decimal.rst:394 msgid "Once constructed, :class:`Decimal` objects are immutable." @@ -628,15 +746,19 @@ 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 " "math operations and special methods apply. Likewise, decimal objects can be " "copied, pickled, printed, used as dictionary keys, used as set elements, " -"compared, sorted, and coerced to another type (such as :class:`float` or :" -"class:`int`)." +"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 +771,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 +792,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 "" @@ -685,20 +813,20 @@ msgstr "" #: ../../library/decimal.rst:438 msgid "" -"Decimal objects cannot generally be combined with floats or instances of :" -"class:`fractions.Fraction` in arithmetic operations: an attempt to add a :" -"class:`Decimal` to a :class:`float`, for example, will raise a :exc:" -"`TypeError`. However, it is possible to use Python's comparison operators " -"to compare a :class:`Decimal` instance ``x`` with another number ``y``. " -"This avoids confusing results when doing equality comparisons between " -"numbers of different types." -msgstr "" -"Decimal オブジェクトは一般に、算術演算で浮動小数点数や :class:`fractions." -"Fraction` オブジェクトと組み合わせることができません。例えば、 :class:" -"`Decimal` に :class:`float` を足そうとすると、 :exc:`TypeError` が送出されま" -"す。ただし、Python の比較演算子を使って :class:`Decimal` インスタンス ``x`` " -"と別の数 ``y`` を比較することができます。これにより、異なる型の数間の等価比較" -"の際に、紛らわしい結果を避けます。" +"Decimal objects cannot generally be combined with floats or instances " +"of :class:`fractions.Fraction` in arithmetic operations: an attempt to add " +"a :class:`Decimal` to a :class:`float`, for example, will raise " +"a :exc:`TypeError`. However, it is possible to use Python's comparison " +"operators to compare a :class:`Decimal` instance ``x`` with another number " +"``y``. This avoids confusing results when doing equality comparisons " +"between numbers of different types." +msgstr "" +"Decimal オブジェクトは一般に、算術演算で浮動小数点数" +"や :class:`fractions.Fraction` オブジェクトと組み合わせることができません。例" +"えば、 :class:`Decimal` に :class:`float` を足そうとする" +"と、 :exc:`TypeError` が送出されます。ただし、Python の比較演算子を使っ" +"て :class:`Decimal` インスタンス ``x`` と別の数 ``y`` を比較することができま" +"す。これにより、異なる型の数間の等価比較の際に、紛らわしい結果を避けます。" #: ../../library/decimal.rst:446 msgid "" @@ -708,11 +836,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 "" @@ -727,18 +856,19 @@ msgstr "" #: ../../library/decimal.rst:463 msgid "" -"Return a pair ``(n, d)`` of integers that represent the given :class:" -"`Decimal` instance as a fraction, in lowest terms and with a positive " -"denominator::" +"Return a pair ``(n, d)`` of integers that represent the " +"given :class:`Decimal` instance as a fraction, in lowest terms and with a " +"positive denominator::" 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 +878,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 "" @@ -762,9 +891,9 @@ msgid "" "a :class:`Decimal` instance is always canonical, so this operation returns " "its argument unchanged." msgstr "" -"引数の標準的(canonical)エンコーディングを返します。現在のところ、 :class:" -"`Decimal` インスタンスのエンコーディングは常に標準的なので、この操作は引数に" -"手を加えずに返します。" +"引数の標準的(canonical)エンコーディングを返します。現在のとこ" +"ろ、 :class:`Decimal` インスタンスのエンコーディングは常に標準的なので、この" +"操作は引数に手を加えずに返します。" #: ../../library/decimal.rst:489 msgid "" @@ -774,13 +903,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 "" @@ -835,12 +967,12 @@ msgstr "" msgid "" "Compare two operands using their abstract representation rather than their " "value as in :meth:`compare_total`, but ignoring the sign of each operand. " -"``x.compare_total_mag(y)`` is equivalent to ``x.copy_abs().compare_total(y." -"copy_abs())``." +"``x.compare_total_mag(y)`` is equivalent to " +"``x.copy_abs().compare_total(y.copy_abs())``." msgstr "" "二つの対象を :meth:`compare_total` のように数値によらず抽象表現によって比較し" -"ますが、両者の符号を無視します。 ``x.compare_total_mag(y)`` は ``x." -"copy_abs().compare_total(y.copy_abs())`` と等価です。" +"ますが、両者の符号を無視します。 ``x.compare_total_mag(y)`` は " +"``x.copy_abs().compare_total(y.copy_abs())`` と等価です。" #: ../../library/decimal.rst:539 msgid "" @@ -877,16 +1009,16 @@ msgid "" "number. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` " "rounding mode." msgstr "" -"与えられた数での(自然)指数関数 ``e**x`` の値を返します。結果は :const:" -"`ROUND_HALF_EVEN` 丸めモードで正しく丸められます。" +"与えられた数での(自然)指数関数 ``e**x`` の値を返します。結果" +"は :const:`ROUND_HALF_EVEN` 丸めモードで正しく丸められます。" -#: ../../library/decimal.rst:578 msgid "" -"Alternative constructor that only accepts instances of :class:`float` or :" -"class:`int`." +"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 +1027,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 +1041,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 +1051,23 @@ 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." +"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 +1076,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 "" @@ -949,9 +1097,9 @@ msgid "" "otherwise. Currently, a :class:`Decimal` instance is always canonical, so " "this operation always returns :const:`True`." msgstr "" -"引数が標準的(canonical)ならば :const:`True` を返し、そうでなければ :const:" -"`False` を返します。現在のところ、 :class:`Decimal` のインスタンスは常に標準" -"的なのでこのメソッドの結果はいつでも :const:`True` です。" +"引数が標準的(canonical)ならば :const:`True` を返し、そうでなけれ" +"ば :const:`False` を返します。現在のところ、 :class:`Decimal` のインスタンス" +"は常に標準的なのでこのメソッドの結果はいつでも :const:`True` です。" #: ../../library/decimal.rst:636 msgid "" @@ -966,21 +1114,21 @@ msgid "" "Return :const:`True` if the argument is either positive or negative infinity " "and :const:`False` otherwise." msgstr "" -"引数が正または負の無限大ならば :const:`True` を、そうでなければ :const:" -"`False` を返します。" +"引数が正または負の無限大ならば :const:`True` を、そうでなけれ" +"ば :const:`False` を返します。" #: ../../library/decimal.rst:646 msgid "" -"Return :const:`True` if the argument is a (quiet or signaling) NaN and :" -"const:`False` otherwise." +"Return :const:`True` if the argument is a (quiet or signaling) NaN " +"and :const:`False` otherwise." msgstr "" -"引数が (無言か発信かは問わず) NaN であれば :const:`True` を、そうでなければ :" -"const:`False` を返します。" +"引数が (無言か発信かは問わず) NaN であれば :const:`True` を、そうでなけれ" +"ば :const:`False` を返します。" #: ../../library/decimal.rst:651 msgid "" -"Return :const:`True` if the argument is a *normal* finite number. Return :" -"const:`False` if the argument is zero, subnormal, infinite or a NaN." +"Return :const:`True` if the argument is a *normal* finite number. " +"Return :const:`False` if the argument is zero, subnormal, infinite or a NaN." msgstr "" "引数が *正規(normal)* の有限数値ならば :const:`True` を返します。引数がゼロ、" "非正規(subnormal)、無限大または NaN であれば :const:`False` を返します。" @@ -1014,16 +1162,16 @@ msgid "" "Return :const:`True` if the argument is subnormal, and :const:`False` " "otherwise." msgstr "" -"引数が非正規数(subnormal)であれば :const:`True` を、そうでなければ :const:" -"`False` を返します。" +"引数が非正規数(subnormal)であれば :const:`True` を、そうでなけれ" +"ば :const:`False` を返します。" #: ../../library/decimal.rst:676 msgid "" -"Return :const:`True` if the argument is a (positive or negative) zero and :" -"const:`False` otherwise." +"Return :const:`True` if the argument is a (positive or negative) zero " +"and :const:`False` otherwise." msgstr "" -"引数が(正または負の)ゼロであれば :const:`True` を、そうでなければ :const:" -"`False` を返します。" +"引数が(正または負の)ゼロであれば :const:`True` を、そうでなけれ" +"ば :const:`False` を返します。" #: ../../library/decimal.rst:681 msgid "" @@ -1041,17 +1189,17 @@ 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('-" +"For a nonzero number, return the adjusted exponent of its operand as " +"a :class:`Decimal` instance. If the operand is a zero then ``Decimal('-" "Infinity')`` is returned and the :const:`DivisionByZero` flag is raised. If " "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 +1296,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 +1311,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 "" @@ -1275,11 +1428,11 @@ msgstr "" #: ../../library/decimal.rst:822 msgid "" -"An error is returned whenever the resulting exponent is greater than :attr:" -"`~Context.Emax` or less than :meth:`~Context.Etiny`." +"An error is returned whenever the resulting exponent is greater " +"than :attr:`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -"処理結果の指数が :attr:`~Context.Emax` よりも大きい場合や :meth:`~Context." -"Etiny` よりも小さい場合にエラーが返されます。" +"処理結果の指数が :attr:`~Context.Emax` よりも大きい場合" +"や :meth:`~Context.Etiny` よりも小さい場合にエラーが返されます。" #: ../../library/decimal.rst:827 msgid "" @@ -1307,7 +1460,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 +1470,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 +1498,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 +1507,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 +1525,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 "" @@ -1399,33 +1555,37 @@ msgid "" "``rounding`` parameter if given, else by the given ``context``. If neither " "parameter is given then the rounding mode of the current context is used." msgstr "" -"最近傍の整数に値を丸め、丸めが起こった場合には :const:`Inexact` または :" -"const:`Rounded` のシグナルを適切に出します。丸めモードは以下のように決められ" -"ます。 ``rounding`` 引数が与えられていればそれが使われます。そうでなければ " -"``context`` 引数で決まります。どちらの引数も渡されなければ現在のスレッドのコ" -"ンテキストの丸めモードが使われます。" +"最近傍の整数に値を丸め、丸めが起こった場合には :const:`Inexact` また" +"は :const:`Rounded` のシグナルを適切に出します。丸めモードは以下のように決め" +"られます。 ``rounding`` 引数が与えられていればそれが使われます。そうでなけれ" +"ば ``context`` 引数で決まります。どちらの引数も渡されなければ現在のスレッドの" +"コンテキストの丸めモードが使われます。" #: ../../library/decimal.rst:915 msgid "" -"Round to the nearest integer without signaling :const:`Inexact` or :const:" -"`Rounded`. If given, applies *rounding*; otherwise, uses the rounding " -"method in either the supplied *context* or the current context." +"Round to the nearest integer without signaling :const:`Inexact` " +"or :const:`Rounded`. If given, applies *rounding*; otherwise, uses the " +"rounding method in either the supplied *context* or the current context." msgstr "" ":const:`Inexact` や :const:`Rounded` といったシグナルを出さずに最近傍の整数に" "値を丸めます。 *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 " +"*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 "" @@ -1433,33 +1593,33 @@ msgid "" "and a :class:`Decimal` representing *number* rounded to the nearest multiple " "of ``Decimal('1E-ndigits')`` is returned; in this case, ``round(number, " "ndigits)`` is equivalent to ``self.quantize(Decimal('1E-ndigits'))``. " -"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. Raises :class:" -"`InvalidOperation` if *number* is an infinity, a signaling NaN, or if the " -"length of the coefficient after the quantize operation would be greater than " -"the current context's precision. In other words, for the non-corner cases:" +"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. " +"Raises :class:`InvalidOperation` if *number* is an infinity, a signaling " +"NaN, or if the length of the coefficient after the quantize operation would " +"be greater than 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" @@ -1481,17 +1653,16 @@ msgstr "論理引数" #: ../../library/decimal.rst:967 msgid "" -"The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" -"`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " -"arguments to be *logical operands*. A *logical operand* is a :class:" -"`Decimal` instance whose exponent and sign are both zero, and whose digits " -"are all either ``0`` or ``1``." +"The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:`~Decimal.logical_or`, " +"and :meth:`~Decimal.logical_xor` methods expect their arguments to be " +"*logical operands*. A *logical operand* is a :class:`Decimal` instance " +"whose exponent and sign are both zero, and whose digits are all either ``0`` " +"or ``1``." msgstr "" -":meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" -"`~Decimal.logical_or`, および :meth:`~Decimal.logical_xor` メソッドはその引数" -"が *論理引数* であると想定しています。 *論理引数* とは :class:`Decimal` イン" -"スタンスで指数と符号は共にゼロであり、各桁の数字が ``0`` か ``1`` であるもの" -"です。" +":meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:`~Decimal.logical_or`, " +"および :meth:`~Decimal.logical_xor` メソッドはその引数が *論理引数* であると" +"想定しています。 *論理引数* とは :class:`Decimal` インスタンスで指数と符号は" +"共にゼロであり、各桁の数字が ``0`` か ``1`` であるものです。" #: ../../library/decimal.rst:979 msgid "Context objects" @@ -1512,9 +1683,9 @@ msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -"多重スレッドで処理を行う場合には各スレッドごとに現在のコンテキストがあり、 :" -"func:`getcontext` や :func:`setcontext` といった関数でアクセスしたり設定変更" -"できます:" +"多重スレッドで処理を行う場合には各スレッドごとに現在のコンテキストがあ" +"り、 :func:`getcontext` や :func:`setcontext` といった関数でアクセスしたり設" +"定変更できます:" #: ../../library/decimal.rst:991 msgid "Return the current context for the active thread." @@ -1554,7 +1725,6 @@ msgstr "" "たとえば、以下のコードでは精度を42桁に設定し、計算を実行し、そして元のコンテ" "キストに復帰します::" -#: ../../library/decimal.rst:1012 msgid "" "from decimal import localcontext\n" "\n" @@ -1563,12 +1733,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,49 +1750,59 @@ 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." +"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`." +"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 "" "This is a standard context defined by the General Decimal Arithmetic " -"Specification. Precision is set to nine. Rounding is set to :const:" -"`ROUND_HALF_UP`. All flags are cleared. All traps are enabled (treated as " -"exceptions) except :const:`Inexact`, :const:`Rounded`, and :const:" -"`Subnormal`." +"Specification. Precision is set to nine. Rounding is set " +"to :const:`ROUND_HALF_UP`. All flags are cleared. All traps are enabled " +"(treated as exceptions) except :const:`Inexact`, :const:`Rounded`, " +"and :const:`Subnormal`." msgstr "" "汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は 9 桁に設定" "されています。丸め規則は :const:`ROUND_HALF_UP` です。すべての演算結果フラグ" -"はクリアされています。 :const:`Inexact`, :const:`Rounded`, :const:" -"`Subnormal` を除く全ての演算エラートラップが有効 (例外として扱う) になってい" -"ます。" +"はクリアされていま" +"す。 :const:`Inexact`, :const:`Rounded`, :const:`Subnormal` を除く全ての演算" +"エラートラップが有効 (例外として扱う) になっています。" #: ../../library/decimal.rst:1054 msgid "" @@ -1629,9 +1813,9 @@ msgstr "" #: ../../library/decimal.rst:1059 msgid "" "This is a standard context defined by the General Decimal Arithmetic " -"Specification. Precision is set to nine. Rounding is set to :const:" -"`ROUND_HALF_EVEN`. All flags are cleared. No traps are enabled (so that " -"exceptions are not raised during computations)." +"Specification. Precision is set to nine. Rounding is set " +"to :const:`ROUND_HALF_EVEN`. All flags are cleared. No traps are enabled " +"(so that exceptions are not raised during computations)." msgstr "" "汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は 9 桁に設定" "されています。丸め規則は :const:`ROUND_HALF_EVEN` です。すべての演算結果フラ" @@ -1684,14 +1868,15 @@ msgstr "" #: ../../library/decimal.rst:1084 msgid "" -"The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." -"rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" -"`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." +"The default values are :attr:`Context.prec`\\ =\\ " +"``28``, :attr:`Context.rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled " +"traps for :class:`Overflow`, :class:`InvalidOperation`, " +"and :class:`DivisionByZero`." msgstr "" -"デフォルトの値は、 :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." -"rounding`\\ =\\ :const:`ROUND_HALF_EVEN` で、トラップ :class:`Overflow`, :" -"class:`InvalidOperation`, および :class:`DivisionByZero` が有効になっていま" -"す。" +"デフォルトの値は、 :attr:`Context.prec`\\ =\\ " +"``28``, :attr:`Context.rounding`\\ =\\ :const:`ROUND_HALF_EVEN` で、トラッ" +"プ :class:`Overflow`, :class:`InvalidOperation`, およ" +"び :class:`DivisionByZero` が有効になっています。" #: ../../library/decimal.rst:1089 msgid "" @@ -1701,65 +1886,83 @@ 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`]." +"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 " "limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* " -"is ``0`` then a weaker condition holds: the adjusted exponent of the :class:" -"`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is ``1``, " -"a large normal number will, where possible, have its exponent reduced and a " -"corresponding number of zeros added to its coefficient, in order to fit the " -"exponent constraints; this preserves the value of the number but loses " -"information about significant trailing zeros. For example::" -msgstr "" +"is ``0`` then a weaker condition holds: the adjusted exponent of " +"the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When " +"*clamp* is ``1``, a large normal number will, where possible, have its " +"exponent reduced and a corresponding number of zeros added to its " +"coefficient, in order to fit the 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,27 +1972,28 @@ 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 " "context. In addition, for each of the :class:`Decimal` methods described " -"above (with the exception of the :meth:`~Decimal.adjusted` and :meth:" -"`~Decimal.as_tuple` methods) there is a corresponding :class:`Context` " -"method. For example, for a :class:`Context` instance ``C`` and :class:" -"`Decimal` instance ``x``, ``C.exp(x)`` is equivalent to ``x." -"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` のインスタンス) " -"を受け付けます。" +"above (with the exception of the :meth:`~Decimal.adjusted` " +"and :meth:`~Decimal.as_tuple` methods) there is a " +"corresponding :class:`Context` method. For example, for a :class:`Context` " +"instance ``C`` and :class:`Decimal` instance ``x``, ``C.exp(x)`` is " +"equivalent to ``x.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` クラスでは、いくつかの汎用のメソッドの他、指定されたコンテキ" +"ストで算術演算を直接行うためのメソッドを数多く定義しています。\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 +2036,6 @@ msgstr "" "もあります。以下の例は、丸められていない入力を使うということは和にゼロを加え" "ると結果が変わり得るという見本です:" -#: ../../library/decimal.rst:1187 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -1840,6 +2043,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 +2071,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 +2081,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`." +"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 +2115,8 @@ msgstr "" "を生成して、算術演算を適用するというアプローチをとります。演算はアクティブな" "スレッドにおける現在のコンテキストの下で行われます。もう一つのアプローチは、" "コンテキストのメソッドを使った特定のコンテキスト下での計算です。コンテキスト" -"のメソッドは :class:`Decimal` クラスのメソッドに似ているので、ここでは簡単な" -"説明にとどめます。" +"のメソッドは ``Decimal`` クラスのメソッドに似ているので、ここでは簡単な説明に" +"とどめます。" #: ../../library/decimal.rst:1239 msgid "Returns the absolute value of *x*." @@ -2114,21 +2328,22 @@ 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 "" -"The C module computes :meth:`power` in terms of the correctly rounded :meth:" -"`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " -"always correctly rounded\"." +"The C module computes :meth:`power` in terms of the correctly " +"rounded :meth:`exp` and :meth:`ln` functions. The result is well-defined but " +"only \"almost always correctly rounded\"." msgstr "" -"C モジュールは :meth:`power` を適切に丸められた :meth:`exp` および :meth:" -"`ln` 関数によって計算します。結果は well-defined ですが、「ほとんどの場合には" -"適切に丸められる」だけです。" +"C モジュールは :meth:`power` を適切に丸められた :meth:`exp` およ" +"び :meth:`ln` 関数によって計算します。結果は well-defined ですが、「ほとんど" +"の場合には適切に丸められる」だけです。" #: ../../library/decimal.rst:1477 msgid "" @@ -2209,17 +2424,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 +2482,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 +2495,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 +2502,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" @@ -2360,14 +2575,14 @@ msgstr "" #: ../../library/decimal.rst:1655 msgid "" "If the context's trap enabler is set for the signal, then the condition " -"causes a Python exception to be raised. For example, if the :class:" -"`DivisionByZero` trap is set, then a :exc:`DivisionByZero` exception is " -"raised upon encountering the condition." +"causes a Python exception to be raised. For example, if " +"the :class:`DivisionByZero` trap is set, then a :exc:`DivisionByZero` " +"exception is raised upon encountering the condition." msgstr "" "あるコンテキストのトラップイネーブラがあるシグナルに対してセットされている場" -"合、該当するエラー条件が生じると Python の例外を送出します。例えば、 :class:" -"`DivisionByZero` が設定されていると、エラー条件が生じた際に :exc:" -"`DivisionByZero` 例外を送出します。" +"合、該当するエラー条件が生じると Python の例外を送出します。例え" +"ば、 :class:`DivisionByZero` が設定されていると、エラー条件が生じた際" +"に :exc:`DivisionByZero` 例外を送出します。" #: ../../library/decimal.rst:1663 msgid "Altered an exponent to fit representation constraints." @@ -2375,13 +2590,13 @@ msgstr "値の表現上の制限に沿わせるために指数部が変更され #: ../../library/decimal.rst:1665 msgid "" -"Typically, clamping occurs when an exponent falls outside the context's :" -"attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " -"exponent is reduced to fit by adding zeros to the coefficient." +"Typically, clamping occurs when an exponent falls outside the " +"context's :attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If " +"possible, the exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -"通常、クランプ (clamp) は、指数部がコンテキストにおける指数桁の制限値 :attr:" -"`~Context.Emin` および :attr:`~Context.Emax` を越えた場合に発生します。可能な" -"場合には、係数部にゼロを加えた表現に合わせて指数部を減らします。" +"通常、クランプ (clamp) は、指数部がコンテキストにおける指数桁の制限" +"値 :attr:`~Context.Emin` および :attr:`~Context.Emax` を越えた場合に発生しま" +"す。可能な場合には、係数部にゼロを加えた表現に合わせて指数部を減らします。" #: ../../library/decimal.rst:1672 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." @@ -2450,8 +2665,8 @@ msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " "either pulling inward to the largest representable finite number or rounding " -"outward to ``Infinity``. In either case, :class:`Inexact` and :class:" -"`Rounded` are also signaled." +"outward to ``Infinity``. In either case, :class:`Inexact` " +"and :class:`Rounded` are also signaled." msgstr "" "このシグナルは、値丸めを行った後の指数部が :attr:`Context.Emax` より大きいこ" "とを示します。シグナルをトラップしない場合、演算結果は値丸めのモードにより、" @@ -2494,11 +2709,11 @@ msgstr "演算結果が値丸めによってゼロになった場合に生じる #: ../../library/decimal.rst:1744 msgid "" -"Occurs when a subnormal result is pushed to zero by rounding. :class:" -"`Inexact` and :class:`Subnormal` are also signaled." +"Occurs when a subnormal result is pushed to zero by " +"rounding. :class:`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -"演算結果が微小なため、値丸めによってゼロになった場合に発生します。 :class:" -"`Inexact` および :class:`Subnormal` シグナルも同時に発生します。" +"演算結果が微小なため、値丸めによってゼロになった場合に発生しま" +"す。 :class:`Inexact` および :class:`Subnormal` シグナルも同時に発生します。" #: ../../library/decimal.rst:1750 msgid "Enable stricter semantics for mixing floats and Decimals." @@ -2507,26 +2722,26 @@ msgstr "float と Decimal の混合の厳密なセマンティクスを有効に #: ../../library/decimal.rst:1752 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " -"permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." -"Context.create_decimal` and all comparison operators. Both conversion and " -"comparisons are exact. Any occurrence of a mixed operation is silently " -"recorded by setting :exc:`FloatOperation` in the context flags. Explicit " -"conversions with :meth:`~decimal.Decimal.from_float` or :meth:`~decimal." -"Context.create_decimal_from_float` do not set the flag." +"permitted in the :class:`~decimal.Decimal` " +"constructor, :meth:`~decimal.Context.create_decimal` and all comparison " +"operators. Both conversion and comparisons are exact. Any occurrence of a " +"mixed operation is silently recorded by setting :exc:`FloatOperation` in the " +"context flags. Explicit conversions with :meth:`~decimal.Decimal.from_float` " +"or :meth:`~decimal.Context.create_decimal_from_float` do not set the flag." msgstr "" "シグナルがトラップされなかった場合 (デフォルト)、:class:`~decimal.Decimal` コ" "ンストラクタ、 :meth:`~decimal.Context.create_decimal` 、およびすべての比較演" "算子において float と Decimal の混合が許されます。変換も比較も正確です。コン" "テキストフラグ内に :exc:`FloatOperation` を設定することで、混合操作は現れるた" -"びに暗黙に記録されます。 :meth:`~decimal.Decimal.from_float` や :meth:" -"`~decimal.Context.create_decimal_from_float` による明示的な変換はフラグを設定" -"しません。" +"びに暗黙に記録されます。 :meth:`~decimal.Decimal.from_float` " +"や :meth:`~decimal.Context.create_decimal_from_float` による明示的な変換はフ" +"ラグを設定しません。" #: ../../library/decimal.rst:1760 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " -"conversions are silent. All other mixed operations raise :exc:" -"`FloatOperation`." +"conversions are silent. All other mixed operations " +"raise :exc:`FloatOperation`." msgstr "" "そうでなければ (シグナルがトラップされれば)、等価性比較および明示的な変換のみ" "が静かにに行われ、その他の混合演算は :exc:`FloatOperation` を送出します。" @@ -2535,7 +2750,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 +2763,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 +2793,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 +2800,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 +2822,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 +2846,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 +2860,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" @@ -2643,10 +2895,10 @@ msgid "" "infinity can result from rounding beyond the limits of the largest " "representable number." msgstr "" -"無限大 (Infinity) は ``Decimal('Infinity')`` で直接構築できます。また、 :exc:" -"`DivisionByZero` をトラップせずにゼロで除算を行った場合にも出てきます。同様" -"に、 :exc:`Overflow` シグナルをトラップしなければ、表現可能な最大の数値の制限" -"を越えた値を丸めたときに出てきます。" +"無限大 (Infinity) は ``Decimal('Infinity')`` で直接構築できます。ま" +"た、 :exc:`DivisionByZero` をトラップせずにゼロで除算を行った場合にも出てきま" +"す。同様に、 :exc:`Overflow` シグナルをトラップしなければ、表現可能な最大の数" +"値の制限を越えた値を丸めたときに出てきます。" #: ../../library/decimal.rst:1850 msgid "" @@ -2660,17 +2912,17 @@ msgstr "" #: ../../library/decimal.rst:1854 msgid "" -"Some operations are indeterminate and return ``NaN``, or if the :exc:" -"`InvalidOperation` signal is trapped, raise an exception. For example, " -"``0/0`` returns ``NaN`` which means \"not a number\". This variety of " -"``NaN`` is quiet and, once created, will flow through other computations " +"Some operations are indeterminate and return ``NaN``, or if " +"the :exc:`InvalidOperation` signal is trapped, raise an exception. For " +"example, ``0/0`` returns ``NaN`` which means \"not a number\". This variety " +"of ``NaN`` is quiet and, once created, will flow through other computations " "always resulting in another ``NaN``. This behavior can be useful for a " "series of computations that occasionally have missing inputs --- it allows " "the calculation to proceed while flagging specific results as invalid." msgstr "" -"演算によっては結果が不確定になるものがあり、 ``NaN`` を返します。ただし、 :" -"exc:`InvalidOperation` シグナルをトラップするようになっていれば例外を送出しま" -"す。例えば、 ``0/0`` は ``NaN`` を返します。 ``NaN`` は「非数値 (not a " +"演算によっては結果が不確定になるものがあり、 ``NaN`` を返します。ただ" +"し、 :exc:`InvalidOperation` シグナルをトラップするようになっていれば例外を送" +"出します。例えば、 ``0/0`` は ``NaN`` を返します。 ``NaN`` は「非数値 (not a " "number)」を表します。このような ``NaN`` は暗黙のうちに生成され、一度生成され" "るとそれを他の計算にも流れてゆき、関係する個々の演算全てが個別の ``NaN`` を返" "すようになります。この挙動は、たまに入力値が欠けるような状況で一連の計算を行" @@ -2694,26 +2946,26 @@ msgid "" "is a quiet or signaling ``NaN`` always returns :const:`False` (even when " "doing ``Decimal('NaN')==Decimal('NaN')``), while a test for inequality " "always returns :const:`True`. An attempt to compare two Decimals using any " -"of the ``<``, ``<=``, ``>`` or ``>=`` operators will raise the :exc:" -"`InvalidOperation` signal if either operand is a ``NaN``, and return :const:" -"`False` if this signal is not trapped. Note that the General Decimal " -"Arithmetic specification does not specify the behavior of direct " +"of the ``<``, ``<=``, ``>`` or ``>=`` operators will raise " +"the :exc:`InvalidOperation` signal if either operand is a ``NaN``, and " +"return :const:`False` if this signal is not trapped. Note that the General " +"Decimal Arithmetic specification does not specify the behavior of direct " "comparisons; these rules for comparisons involving a ``NaN`` were taken from " "the IEEE 854 standard (see Table 3 in section 5.7). To ensure strict " -"standards-compliance, use the :meth:`~Decimal.compare` and :meth:`~Decimal." -"compare_signal` methods instead." +"standards-compliance, use the :meth:`~Decimal.compare` " +"and :meth:`~Decimal.compare_signal` methods instead." msgstr "" "Python の比較演算は ``NaN`` が関わってくると少し驚くようなことがあります。等" -"価性のテストの一方の対象が無言または発信 ``NaN`` である場合いつでも :const:" -"`False` を返し(たとえ ``Decimal('NaN')==Decimal('NaN')`` でも)、一方で不等価" -"をテストするといつでも :const:`True` を返します。二つの Decimal を ``<``, " -"``<=``, ``>`` または ``>=`` を使って比較する試みは一方が ``NaN`` である場合に" -"は :exc:`InvalidOperation` シグナルを送出し、このシグナルをトラップしなければ" -"結果は :const:`False` に終わります。汎用十進演算仕様は直接の比較の振る舞いに" -"ついて定めていないことに注意しておきましょう。ここでの ``NaN`` が関係する比較" -"ルールは IEEE 854 標準から持ってきました (section 5.7 の Table 3 を見て下さ" -"い)。厳格に標準遵守を貫くなら、 :meth:`~Decimal.compare` および :meth:" -"`~Decimal.compare_signal` メソッドを代わりに使いましょう。" +"価性のテストの一方の対象が無言または発信 ``NaN`` である場合いつで" +"も :const:`False` を返し(たとえ ``Decimal('NaN')==Decimal('NaN')`` でも)、一" +"方で不等価をテストするといつでも :const:`True` を返します。二つの Decimal を " +"``<``, ``<=``, ``>`` または ``>=`` を使って比較する試みは一方が ``NaN`` であ" +"る場合には :exc:`InvalidOperation` シグナルを送出し、このシグナルをトラップし" +"なければ結果は :const:`False` に終わります。汎用十進演算仕様は直接の比較の振" +"る舞いについて定めていないことに注意しておきましょう。ここでの ``NaN`` が関係" +"する比較ルールは IEEE 854 標準から持ってきました (section 5.7 の Table 3 を見" +"て下さい)。厳格に標準遵守を貫くなら、 :meth:`~Decimal.compare` およ" +"び :meth:`~Decimal.compare_signal` メソッドを代わりに使いましょう。" #: ../../library/decimal.rst:1879 msgid "" @@ -2727,7 +2979,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 +2986,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,33 +3016,46 @@ 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." +"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 " "context. In this case, :func:`getcontext` will create a new context object " "when called and use the default values from *DefaultContext*. If the flag " -"is true, new threads will start with a copy of context from the caller of :" -"meth:`threading.Thread.start`." +"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 +3070,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" @@ -2995,8 +3277,8 @@ msgid "" "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -"A. :meth:`~Decimal.quantize` メソッドで固定した桁に丸められます。 :const:" -"`Inexact` トラップを設定しておけば、確認にも有用です:" +"A. :meth:`~Decimal.quantize` メソッドで固定した桁に丸められま" +"す。 :const:`Inexact` トラップを設定しておけば、確認にも有用です:" #: ../../library/decimal.rst:2134 msgid "" @@ -3014,8 +3296,8 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" "A. 加減算あるいは整数との乗算のような演算は自動的に固定小数点を守ります。その" -"他の除算や整数以外の乗算などは小数点以下の桁を変えてしまいますので実行後は :" -"meth:`~Decimal.quantize` ステップが必要です:" +"他の除算や整数以外の乗算などは小数点以下の桁を変えてしまいますので実行後" +"は :meth:`~Decimal.quantize` ステップが必要です:" #: ../../library/decimal.rst:2155 msgid "" @@ -3111,11 +3393,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 +3443,6 @@ msgstr "" "get\" (打ち込んだ値が得られる値)という点にあります。入力が丸められないという" "ことを忘れていると結果が奇妙に見えるというのは弱点です:" -#: ../../library/decimal.rst:2247 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -3168,6 +3450,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,17 +3464,19 @@ 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 "" -"Alternatively, inputs can be rounded upon creation using the :meth:`Context." -"create_decimal` method:" +"Alternatively, inputs can be rounded upon creation using " +"the :meth:`Context.create_decimal` method:" msgstr "" "もしくは、入力を :meth:`Context.create_decimal` を使って生成時に丸めてしまう" "こともできます:" @@ -3199,61 +3488,74 @@ msgstr "Q. CPython 実装は大きな数に対しても速いでしょうか?" #: ../../library/decimal.rst:2272 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " -"the decimal module integrate the high speed `libmpdec `_ library for arbitrary precision " -"correctly rounded decimal floating-point arithmetic [#]_. ``libmpdec`` uses " -"`Karatsuba multiplication `_ library for arbitrary " +"precision correctly rounded decimal floating-point arithmetic [#]_. " +"``libmpdec`` uses `Karatsuba multiplication `_ for medium-sized numbers and the `Number Theoretic " "Transform `_ for very " "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." +"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 +3578,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..ea91982be 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,150 +100,175 @@ 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." +"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." +"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." +"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`." +"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 " "large. Enabling the :mod:`tracemalloc` module provides additional " -"information on the origin of some errors. For example, :exc:" -"`ResourceWarning` logs the traceback where the resource was allocated, and a " -"buffer overflow error logs the traceback where the memory block was " -"allocated." +"information on the origin of some errors. For " +"example, :exc:`ResourceWarning` logs the traceback where the resource was " +"allocated, and a 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``." +"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,47 +283,67 @@ 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 "" "$ 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" +"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" 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 "" "$ 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" +"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" @@ -297,11 +351,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 +376,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,29 +413,41 @@ 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 "" "$ 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" +"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' " @@ -373,18 +457,36 @@ 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 " "file descriptor`` error. A file descriptor must be closed only once. In the " -"worst case scenario, closing it twice can lead to a crash (see :issue:" -"`18748` for an example)." +"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..5ba753e58 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 "" @@ -213,10 +215,10 @@ msgstr "" #: ../../library/difflib.rst:105 msgid "" -"*linejunk* and *charjunk* are optional keyword arguments passed into :func:" -"`ndiff` (used by :class:`HtmlDiff` to generate the side by side HTML " -"differences). See :func:`ndiff` documentation for argument default values " -"and descriptions." +"*linejunk* and *charjunk* are optional keyword arguments passed " +"into :func:`ndiff` (used by :class:`HtmlDiff` to generate the side by side " +"HTML differences). See :func:`ndiff` documentation for argument default " +"values and descriptions." msgstr "" "*linejunk* および *charjunk* はオプションのキーワード引数で、 :func:`ndiff` " "(:class:`HtmlDiff` はこの関数を使って左右のテキストの差分を HTML で生成しま" @@ -294,8 +296,8 @@ msgstr "" #: ../../library/difflib.rst:145 msgid "" -"The arguments for this method are the same as those for the :meth:" -"`make_file` method." +"The arguments for this method are the same as those for " +"the :meth:`make_file` method." msgstr "このメソッドの引数は、 :meth:`make_file` メソッドの引数と同じです。" #: ../../library/difflib.rst:152 @@ -326,9 +328,9 @@ msgid "" "trailing newlines." msgstr "" "デフォルトで、 diff 制御行 (``***`` や ``---`` を含む行) は改行付きで生成され" -"ます。 :func:`io.IOBase.readlines` で作られた入力が :func:`io.IOBase." -"writelines` で扱うのに適した diff になるので (なぜなら入力と出力の両方が改行" -"付きのため) 、これは有用です。" +"ます。 :func:`io.IOBase.readlines` で作られた入力" +"が :func:`io.IOBase.writelines` で扱うのに適した diff になるので (なぜなら入" +"力と出力の両方が改行付きのため) 、これは有用です。" #: ../../library/difflib.rst:165 ../../library/difflib.rst:297 msgid "" @@ -420,10 +422,10 @@ msgstr "" "*linejunk*: 文字列型の引数 1 つを受け取る関数です。文字列が junk の場合は真" "を、そうでない場合は偽を返します。デフォルトでは ``None`` です。モジュールレ" "べルの関数 :func:`IS_LINE_JUNK` は、高々 1 つのシャープ記号(``'#'``)を除いて" -"可視の文字を含まない行をフィルタリングするものです。しかし、下層にある :" -"class:`SequenceMatcher` クラスが、どの行が雑音となるほど頻繁に登場するかを動" -"的に分析します。このクラスによる分析は、この関数を使用するよりも通常うまく動" -"作します。" +"可視の文字を含まない行をフィルタリングするものです。しかし、下層にあ" +"る :class:`SequenceMatcher` クラスが、どの行が雑音となるほど頻繁に登場するか" +"を動的に分析します。このクラスによる分析は、この関数を使用するよりも通常うま" +"く動作します。" #: ../../library/difflib.rst:239 msgid "" @@ -433,9 +435,9 @@ msgid "" "characters (a blank or tab; it's a bad idea to include newline in this!)." msgstr "" "*charjunk*: 文字 (長さ1の文字列) を受け取る関数です。文字列が junk の場合は真" -"を、そうでない場合は偽を返します。デフォルトでは、モジュールレべルの関数 :" -"func:`IS_CHARACTER_JUNK` であり、これは空白文字類 (空白またはタブ、改行文字を" -"これに含めてはいけません) をフィルタして排除します。" +"を、そうでない場合は偽を返します。デフォルトでは、モジュールレべルの関" +"数 :func:`IS_CHARACTER_JUNK` であり、これは空白文字類 (空白またはタブ、改行文" +"字をこれに含めてはいけません) をフィルタして排除します。" #: ../../library/difflib.rst:260 msgid "Return one of the two sequences that generated a delta." @@ -485,11 +487,10 @@ msgid "" "trailing newlines." msgstr "" "デフォルトで、 diff 制御行 (``---``, ``+++``, ``@@`` を含む行) は改行付きで生" -"成されます。 :func:`io.IOBase.readlines` で作られた入力が :func:`io.IOBase." -"writelines` で扱うのに適した diff になるので (なぜなら入力と出力の両方が改行" -"付きのため) 、これは有用です。" +"成されます。 :func:`io.IOBase.readlines` で作られた入力" +"が :func:`io.IOBase.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 "" @@ -506,8 +512,8 @@ msgid "" msgstr "" "*dfunc* を使用して *a* と *b* (bytes オブジェクトのリスト) を比較して、差分形" "式の行 (これも bytes オブジェクトです) を*dfunc* の戻り値の形式で返します。" -"*dfunc* は、呼び出し可能である必要があります。一般に、これは :func:" -"`unified_diff` または :func:`context_diff` です。" +"*dfunc* は、呼び出し可能である必要があります。一般に、これ" +"は :func:`unified_diff` または :func:`context_diff` です。" #: ../../library/difflib.rst:329 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`." +"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 "" @@ -621,8 +627,8 @@ msgid "" "elements of *b* for which *isjunk* is ``True``; *bpopular* is the set of non-" "junk elements considered popular by the heuristic (if it is not disabled); " "*b2j* is a dict mapping the remaining elements of *b* to a list of positions " -"where they occur. All three are reset whenever *b* is reset with :meth:" -"`set_seqs` or :meth:`set_seq2`." +"where they occur. All three are reset whenever *b* is reset " +"with :meth:`set_seqs` or :meth:`set_seq2`." msgstr "" "SequenceMatcher オブジェクトは3つのデータ属性を持っています: *bjunk* は、 " "*isjunk* が ``True`` であるような *b* の要素の集合です; *bpopular* は、 (無効" @@ -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*." +"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`." @@ -873,9 +887,10 @@ msgstr "" #: ../../library/difflib.rst:547 msgid "" -"This is expensive to compute if :meth:`get_matching_blocks` or :meth:" -"`get_opcodes` hasn't already been called, in which case you may want to try :" -"meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an upper bound." +"This is expensive to compute if :meth:`get_matching_blocks` " +"or :meth:`get_opcodes` hasn't already been called, in which case you may " +"want to try :meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an " +"upper bound." msgstr "" "このメソッドは :meth:`get_matching_blocks` または :meth:`get_opcodes` がまだ" "呼び出されていない場合には非常にコストが高いです。この場合、上限を素早く計算" @@ -906,14 +921,18 @@ 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 :" -"meth:`~SequenceMatcher.quick_ratio` and :meth:`~SequenceMatcher." -"real_quick_ratio` are always at least as large as :meth:`~SequenceMatcher." -"ratio`:" +"give different results due to differing levels of approximation, " +"although :meth:`~SequenceMatcher.quick_ratio` " +"and :meth:`~SequenceMatcher.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 +942,40 @@ 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:" +"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:" +"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``." +"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`:" +"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 +985,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`." +"simple-version-control/>`_ for a small application built " +"with :class:`SequenceMatcher`." msgstr "" +":class:`SequenceMatcher` で作った小さなアプリケーションについては、`簡単な" +"バージョン管理のレシピ `_ を参照してください。" #: ../../library/difflib.rst:641 msgid "Differ Objects" @@ -1017,17 +1046,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 "" @@ -1046,28 +1074,32 @@ msgstr "" #: ../../library/difflib.rst:679 msgid "" "Each sequence must contain individual single-line strings ending with " -"newlines. Such sequences can be obtained from the :meth:`~io.IOBase." -"readlines` method of file-like objects. The delta generated also consists " -"of newline-terminated strings, ready to be printed as-is via the :meth:`~io." -"IOBase.writelines` method of a file-like object." +"newlines. Such sequences can be obtained from " +"the :meth:`~io.IOBase.readlines` method of file-like objects. The delta " +"generated also consists of newline-terminated strings, ready to be printed " +"as-is via the :meth:`~io.IOBase.writelines` method of a file-like object." msgstr "" "各シーケンスの要素は、改行で終わる独立した単一行からなる文字列でなければなり" -"ません。そのようなシーケンスは、ファイル風オブジェクトの :meth:`~io.IOBase." -"readlines` メソッドによって得ることができます。(得られる)差分は改行文字で終" -"了する文字列のシーケンスとして得られ、ファイル風オブジェクトの :meth:`~io." -"IOBase.writelines` メソッドによって出力できる形になっています。" +"ません。そのようなシーケンスは、ファイル風オブジェクト" +"の :meth:`~io.IOBase.readlines` メソッドによって得ることができます。(得られ" +"る)差分は改行文字で終了する文字列のシーケンスとして得られ、ファイル風オブ" +"ジェクトの :meth:`~io.IOBase.writelines` メソッドによって出力できる形になって" +"います。" #: ../../library/difflib.rst:690 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 +1131,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 "" @@ -1159,8 +1192,8 @@ msgid "" " elif options.n:\n" " diff = difflib.ndiff(fromlines, tolines)\n" " elif options.m:\n" -" diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile," -"tofile,context=options.c,numlines=n)\n" +" diff = " +"difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)\n" " else:\n" " diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, " "fromdate, todate, n=n)\n" @@ -1171,13 +1204,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 "" @@ -1207,8 +1238,8 @@ msgid "" "confusing if the source files contain tab characters.\n" "\n" "The first file can be recovered by retaining only lines that begin with\n" -"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with -" -"r1.\n" +"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with " +"-r1.\n" "\n" "The second file can be recovered similarly, but by retaining only \" \" " "and\n" diff --git a/library/dis.po b/library/dis.po index 9a70d93be..eb20c3206 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,70 +66,74 @@ 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 "" "Some instructions are accompanied by one or more inline cache entries, which " "take the form of :opcode:`CACHE` instructions. These instructions are hidden " -"by default, but can be shown by passing ``show_caches=True`` to any :mod:" -"`dis` utility. Furthermore, the interpreter now adapts the bytecode to " -"specialize it for different runtime conditions. The adaptive bytecode can be " -"shown by passing ``adaptive=True``." +"by default, but can be shown by passing ``show_caches=True`` to " +"any :mod:`dis` utility. Furthermore, the interpreter now adapts the bytecode " +"to specialize it for different runtime conditions. The adaptive bytecode can " +"be 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." +"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" @@ -193,9 +201,9 @@ msgstr "バイトコード解析" #: ../../library/dis.rst:136 msgid "" -"The bytecode analysis API allows pieces of Python code to be wrapped in a :" -"class:`Bytecode` object that provides easy access to details of the compiled " -"code." +"The bytecode analysis API allows pieces of Python code to be wrapped in " +"a :class:`Bytecode` object that provides easy access to details of the " +"compiled code." msgstr "" "バイトコード解析の API を使うと、 Python のコード片を :class:`Bytecode` オブ" "ジェクトでラップでき、コンパイルされたコードの細かいところに簡単にアクセスで" @@ -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 "" @@ -287,8 +300,8 @@ msgstr "コードオブジェクトのソースの最初の行 (利用可能で #: ../../library/dis.rst:188 msgid "" -"Return a formatted view of the bytecode operations (the same as printed by :" -"func:`dis.dis`, but returned as a multi-line string)." +"Return a formatted view of the bytecode operations (the same as printed " +"by :func:`dis.dis`, but returned as a multi-line string)." msgstr "" "バイトコード命令の整形された表示を返します (:func:`dis.dis` と同じ出力になり" "ますが、複数行文字列として返されます)。" @@ -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 ``-->``," @@ -517,74 +547,88 @@ msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -"イテレータは、与えられたコードの各命令の詳細情報を保持する名前付きタプル :" -"class:`Instruction` からなる列を生成します。" +"イテレータは、与えられたコードの各命令の詳細情報を保持する名前付きタプ" +"ル :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." +"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 "" -"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" -"attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " +"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " +"the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "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,234 +992,266 @@ 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]``." +"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 "" -"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" -"`MAP_ADD` instructions, while the added value or key/value pair is popped " -"off, the container object remains on the stack so that it is available for " -"further iterations of the loop." +"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` " +"and :opcode:`MAP_ADD` instructions, while the added value or key/value pair " +"is popped off, the container object remains on the stack so that it is " +"available for further iterations of the loop." msgstr "" ":opcode:`SET_ADD`, :opcode:`LIST_APPEND`, :opcode:`MAP_ADD` は、追加した値ま" "たは 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." +"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`." +"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 +1259,82 @@ 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``." +"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." +"objects>`. 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 `." +"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 +1342,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 +1355,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 `." +"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 `." +"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 +1401,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 +1413,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`." +"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 +1436,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 +1458,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 +1478,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 +1553,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 "" @@ -1436,16 +1589,17 @@ msgstr "" #: ../../library/dis.rst:1251 msgid "" -"The low bit of ``namei`` signals to attempt a method load, as with :opcode:" -"`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " -"it is unset a single value is pushed to the stack." +"The low bit of ``namei`` signals to attempt a method load, as " +"with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " +"method. When 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,83 +1608,102 @@ 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`." +"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:" -"`__import__`. The module object is pushed onto the stack. The current " -"namespace is not affected: for a proper import statement, a subsequent :" -"opcode:`STORE_FAST` instruction modifies the namespace." -msgstr "" +"popped and provide the *fromlist* and *level* arguments " +"of :func:`__import__`. The module object is pushed onto the stack. The " +"current 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 +1713,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,200 +1733,223 @@ 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 " -"found there, loads it from the cell contained in slot ``i``, similar to :" -"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"found there, loads it from the cell contained in slot ``i``, similar " +"to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " "` in class bodies (which previously used :opcode:`!" "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 +1960,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 +1975,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 +2237,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." +"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 +2424,63 @@ 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." +"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 +2500,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 +2523,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 +2537,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 +2560,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..cd2ac3bff 100644 --- a/library/distutils.po +++ b/library/distutils.po @@ -12,26 +12,31 @@ 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 `_." +"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..c241f2a1b 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,21 +263,36 @@ 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 "" -"That's all you need to know to start making productive use of :mod:" -"`doctest`! Jump in. The following sections provide full details. Note that " -"there are many examples of doctests in the standard Python test suite and " -"libraries. Especially useful examples can be found in the standard test " -"file :file:`Lib/test/test_doctest/test_doctest.py`." +"That's all you need to know to start making productive use " +"of :mod:`doctest`! Jump in. The following sections provide full details. " +"Note that there are many examples of doctests in the standard Python test " +"suite and libraries. Especially useful examples can be found in the standard " +"test 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 "" @@ -282,15 +368,16 @@ msgid "" "has no effect)." msgstr "" "``verbose=True`` を :func:`testmod` に渡せば、詳細報告 (verbose) モードを強制" -"できます。また、 ``verbose=False`` にすれば禁止できます。どちらの場合にも、 :" -"func:`testmod` は ``sys.argv`` 上のスイッチを調べません。(したがって、 ``-" -"v`` をつけても効果はありません)。" +"できます。また、 ``verbose=False`` にすれば禁止できます。どちらの場合に" +"も、 :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,13 +470,20 @@ 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 "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " -"cause(s) of the failure(s) are printed to stdout, using the same format as :" -"func:`testmod`." +"cause(s) of the failure(s) are printed to stdout, using the same format " +"as :func:`testmod`." msgstr "" ":func:`testmod` と同じく、 :func:`testfile` は実行例が失敗しない限り何も表示" "しません。実行例が失敗すると、失敗した実行例とその原因が (場合によっては複" @@ -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,44 +535,50 @@ 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 "" -"This will import :file:`example.py` as a standalone module and run :func:" -"`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." +"This will import :file:`example.py` as a standalone module and " +"run :func:`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`." +"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,24 +612,32 @@ 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 " "the docstring. Doctest looks for a module-level variable called ``__test__`` " "and uses it to locate other tests. If ``M.__test__`` exists, it must be a " "dict, and each entry maps a (string) name to a function object, class " -"object, or string. Function and class object docstrings found from ``M." -"__test__`` are searched, and strings are treated as if they were " -"docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M." -"__test__.K``." -msgstr "" +"object, or string. Function and class object docstrings found from " +"``M.__test__`` are searched, and strings are treated as if they were " +"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,15 +649,28 @@ 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 " -"that the value can be mapped to a function, class object, or module; if so, :" -"mod:`!doctest` searches them recursively for docstrings, which are then " +"that the value can be mapped to a function, class object, or module; if " +"so, :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 "" @@ -607,19 +758,19 @@ msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " "hard tabs in the sample output *are* expanded, this means that if the code " -"output includes hard tabs, the only way the doctest can pass is if the :" -"const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` " -"is in effect. Alternatively, the test can be rewritten to capture the output " -"and compare it to an expected value as part of the test. This handling of " -"tabs in the source was arrived at through trial and error, and has proven to " -"be the least error prone way of handling them. It is possible to use a " -"different algorithm for handling tabs by writing a custom :class:" -"`DocTestParser` class." +"output includes hard tabs, the only way the doctest can pass is if " +"the :const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` is in effect. Alternatively, the test can be rewritten to " +"capture the output and compare it to an expected value as part of the test. " +"This handling of tabs in the source was arrived at through trial and error, " +"and has proven to be the least error prone way of handling them. It is " +"possible to use a different algorithm for handling tabs by writing a " +"custom :class:`DocTestParser` class." msgstr "" "全てのタブ文字は 8 カラムのタブ位置でスペースに展開されます。テスト対象のコー" "ドが作成した出力にあるタブは変更されません。出力例にあるどんなタブも展開 *さ" -"れる* ので、コードの出力がハードタブを含んでいた場合、 doctest が通るには :" -"const:`NORMALIZE_WHITESPACE` オプションか :ref:`directive ` を有効にするしかありません。そうする代わりに、テストが出力を読み" "取りテストの一部として期待される値と正しく比較するように、テストを書き直すこ" "ともできます。このソース中のタブの扱いは試行錯誤の結果であり、タブの扱いの中" @@ -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,21 +908,24 @@ 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 "" -"That doctest succeeds if :exc:`ValueError` is raised, with the ``list." -"remove(x): x not in list`` detail as shown." +"That doctest succeeds if :exc:`ValueError` is raised, with the " +"``list.remove(x): x not in list`` detail as shown." msgstr "" -"この doctest は、 :exc:`ValueError` が送出され、その詳細情報が ``list." -"remove(x): x not in list`` である場合に成功します。" +"この doctest は、 :exc:`ValueError` が送出され、その詳細情報が " +"``list.remove(x): x not in list`` である場合に成功します。" #: ../../library/doctest.rst:472 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,20 +1006,26 @@ 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:" -"`ELLIPSIS` option. The ellipsis in that example could be left out, or could " -"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 のスキットを" -"インデントして書き写したものかもしれません。" +"rewritten example, the use of ``...`` is independent of " +"doctest's :const:`ELLIPSIS` option. The ellipsis in that example could be " +"left out, or could just as well be three (or three hundred) commas or " +"digits, or an indented transcript of a Monty Python skit." +msgstr "" +"トレースバックは特別な方法で扱われる点に注意してください。\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:" @@ -890,8 +1073,8 @@ msgstr "" #: ../../library/doctest.rst:533 msgid "" -"The interactive shell omits the traceback header line for some :exc:" -"`SyntaxError`\\ s. But doctest uses the traceback header line to " +"The interactive shell omits the traceback header line for " +"some :exc:`SyntaxError`\\ s. But doctest uses the traceback header line to " "distinguish exceptions from non-exceptions. So in the rare case where you " "need to test a :exc:`SyntaxError` that omits the traceback header, you will " "need to manually add the traceback header line to your test example." @@ -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" @@ -944,17 +1136,17 @@ msgstr "オプションフラグ" #: ../../library/doctest.rst:567 msgid "" "A number of option flags control various aspects of doctest's behavior. " -"Symbolic names for the flags are supplied as module constants, which can be :" -"ref:`bitwise ORed ` together and passed to various functions. The " -"names can also be used in :ref:`doctest directives `, " -"and may be passed to the doctest command line interface via the ``-o`` " -"option." +"Symbolic names for the flags are supplied as module constants, which can " +"be :ref:`bitwise ORed ` together and passed to various functions. " +"The names can also be used in :ref:`doctest directives `, and may be passed to the doctest command line interface via " +"the ``-o`` option." msgstr "" "doctest の振る舞いは、数多くのオプションフラグによって様々な側面から制御され" "ています。フラグのシンボル名はモジュールの定数として提供され、 :ref:`ビット単" -"位論理和 ` でつないで様々な関数に渡すことができます。シンボル名は :" -"ref:`doctest directives ` でも使用でき、doctest コマンド" -"ラインインターフェースに ``-o`` を通して与えることができます。" +"位論理和 ` でつないで様々な関数に渡すことができます。シンボル名" +"は :ref:`doctest directives ` でも使用でき、doctest コマ" +"ンドラインインターフェースに ``-o`` を通して与えることができます。" #: ../../library/doctest.rst:573 msgid "" @@ -969,36 +1161,37 @@ msgstr "" msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " -"match, and similarly for ``0`` versus ``False``. When :const:" -"`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is allowed. The " -"default behavior caters to that Python changed the return type of many " -"functions from integer to boolean; doctests expecting \"little integer\" " -"output still work in these cases. This option will probably go away, but " -"not for several years." +"match, and similarly for ``0`` versus ``False``. " +"When :const:`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is " +"allowed. The default behavior caters to that Python changed the return type " +"of many functions from integer to boolean; doctests expecting \"little " +"integer\" output still work in these cases. This option will probably go " +"away, but not for several years." msgstr "" "デフォルトでは、期待する出力ブロックに単に ``1`` だけが入っており、実際の出力" "ブロックに ``1`` または ``True`` だけが入っていた場合、これらの出力は一致して" -"いるとみなされます。 ``0`` と ``False`` の場合も同様です。 :const:" -"`DONT_ACCEPT_TRUE_FOR_1` を指定すると、こうした値の読み替えを行いません。デ" -"フォルトの挙動で読み替えを行うのは、最近の Python で多くの関数の戻り値型が整" -"数型からブール型に変更されたことに対応するためです; 読み替えを行う場合、\"通" -"常の整数\" の出力を期待する出力とするような doctest も動作します。このオプ" -"ションはそのうちなくなるでしょうが、ここ数年はそのままでしょう。" +"いるとみなされます。 ``0`` と ``False`` の場合も同様で" +"す。 :const:`DONT_ACCEPT_TRUE_FOR_1` を指定すると、こうした値の読み替えを行い" +"ません。デフォルトの挙動で読み替えを行うのは、最近の Python で多くの関数の戻" +"り値型が整数型からブール型に変更されたことに対応するためです; 読み替えを行う" +"場合、\"通常の整数\" の出力を期待する出力とするような doctest も動作します。" +"このオプションはそのうちなくなるでしょうが、ここ数年はそのままでしょう。" #: ../../library/doctest.rst:591 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " "output. Because a genuinely blank line delimits the expected output, this " -"is the only way to communicate that a blank line is expected. When :const:" -"`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." +"is the only way to communicate that a blank line is expected. " +"When :const:`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not " +"allowed." msgstr "" "デフォルトでは、期待する出力ブロックに ```` だけの入った行がある場" "合、その行は実際の出力における空行に一致するようになります。完全な空行を入れ" "てしまうと期待する出力がそこで終わっているとみなされてしまうため、期待する出" -"力に空行を入れたい場合にはこの方法を使わなければなりません。 :const:" -"`DONT_ACCEPT_BLANKLINE` を指定すると、 ```` の読み替えを行わなくな" -"ります。" +"力に空行を入れたい場合にはこの方法を使わなければなりませ" +"ん。 :const:`DONT_ACCEPT_BLANKLINE` を指定すると、 ```` の読み替え" +"を行わなくなります。" #: ../../library/doctest.rst:600 msgid "" @@ -1011,9 +1204,9 @@ msgid "" msgstr "" "このフラグを指定すると、連続する空白 (空白と改行文字) は互いに等価であるとみ" "なします。期待する出力における任意の空白列は実際の出力における任意の空白と一" -"致します。デフォルトでは、空白は厳密に一致しなければなりません。 :const:" -"`NORMALIZE_WHITESPACE` は、期待する出力の内容が非常に長いために、ソースコード" -"中でその内容を複数行に折り返して書きたい場合に特に便利です。" +"致します。デフォルトでは、空白は厳密に一致しなければなりませ" +"ん。 :const:`NORMALIZE_WHITESPACE` は、期待する出力の内容が非常に長いために、" +"ソースコード中でその内容を複数行に折り返して書きたい場合に特に便利です。" #: ../../library/doctest.rst:611 msgid "" @@ -1030,24 +1223,31 @@ 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:" -"`TypeError` is raised instead. It will also ignore any fully qualified name " -"included before the exception class, which can vary between implementations " -"and versions of Python and the code/libraries in use. Hence, all three of " -"these variations will work with the flag specified:" +"exception raised is ``ValueError: 3*14``, but will fail if, say, " +"a :exc:`TypeError` is raised instead. It will also ignore any fully " +"qualified name included before the exception class, which can vary between " +"implementations 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 +1261,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 "" @@ -1129,12 +1342,13 @@ msgid "" "output contains letter ``l``, a line is inserted with a caret marking the " "mismatching column positions." msgstr "" -"このオプションを指定すると、期待する出力と実際の出力との間の差分を ``difflib." -"Differ`` を使って算出します。使われているアルゴリズムは有名な :file:`ndiff." -"py` ユーティリティと同じです。これは、行単位の差分と同じように行内の差分に" -"マーカをつけられるようにする唯一の手段です。例えば、期待する出力のある行に数" -"字の ``1`` が入っていて、実際の出力には ``l`` が入っている場合、不一致の起き" -"ているカラム位置を示すキャレットの入った行が一行挿入されます。" +"このオプションを指定すると、期待する出力と実際の出力との間の差分を " +"``difflib.Differ`` を使って算出します。使われているアルゴリズムは有名" +"な :file:`ndiff.py` ユーティリティと同じです。これは、行単位の差分と同じよう" +"に行内の差分にマーカをつけられるようにする唯一の手段です。例えば、期待する出" +"力のある行に数字の ``1`` が入っていて、実際の出力には ``l`` が入っている場" +"合、不一致の起きているカラム位置を示すキャレットの入った行が一行挿入されま" +"す。" #: ../../library/doctest.rst:696 msgid "" @@ -1150,10 +1364,10 @@ msgstr "" "し、それ以後の実行例の出力を抑制します。これにより、正しく書かれた実行例が、" "それ以前の実行例の失敗によっておかしくなってしまった場合に、 doctest がそれを" "報告しないようになります。とはいえ、最初に失敗を引き起こした実行例とは関係な" -"く誤って書かれた実行例の報告も抑制してしまいます。 :const:" -"`REPORT_ONLY_FIRST_FAILURE` を指定した場合、実行例がどこかで失敗しても、それ" -"以後の実行例を続けて実行し、失敗したテストの総数を報告します; 出力が抑制され" -"るだけです。" +"く誤って書かれた実行例の報告も抑制してしまいま" +"す。 :const:`REPORT_ONLY_FIRST_FAILURE` を指定した場合、実行例がどこかで失敗" +"しても、それ以後の実行例を続けて実行し、失敗したテストの総数を報告します; 出" +"力が抑制されるだけです。" #: ../../library/doctest.rst:707 msgid "" @@ -1182,34 +1396,33 @@ msgstr "" #: ../../library/doctest.rst:724 msgid "" "Create a new option flag with a given name, and return the new flag's " -"integer value. :func:`register_optionflag` can be used when subclassing :" -"class:`OutputChecker` or :class:`DocTestRunner` to create new options that " -"are supported by your subclasses. :func:`register_optionflag` should always " -"be called using the following idiom::" +"integer value. :func:`register_optionflag` can be used when " +"subclassing :class:`OutputChecker` or :class:`DocTestRunner` to create new " +"options that are supported by your subclasses. :func:`register_optionflag` " +"should always be called using the following idiom::" msgstr "" "名前 *name* の新たなオプションフラグを作成し、作成されたフラグの整数値を返し" -"ます。 :func:`register_optionflag` は :class:`OutputChecker` や :class:" -"`DocTestRunner` をサブクラス化して、その中で新たに作成したオプションをサポー" -"トさせる際に使います。 :func:`register_optionflag` は以下のような定形文で呼び" -"出さなければなりません::" +"ます。 :func:`register_optionflag` は :class:`OutputChecker` " +"や :class:`DocTestRunner` をサブクラス化して、その中で新たに作成したオプショ" +"ンをサポートさせる際に使います。 :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 +1446,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 +1479,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 +1494,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 +1513,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 +1557,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 +1598,6 @@ msgstr "" "以下のように、オブジェクトアドレスを埋め込むような結果を print するのもよくあ" "りません :" -#: ../../library/doctest.rst:846 msgid "" ">>> id(1.0) # certain to fail some of the time\n" "7948648\n" @@ -1382,6 +1605,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 +1617,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 +1653,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 +1672,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 +1717,8 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" "*module_relative* が ``True`` (デフォルト) の場合、*filename* は OS に依存し" -"ないモジュールの相対パスになります。デフォルトでは、このパスは関数 :func:" -"`testfile` を呼び出しているモジュールからの相対パスになります; ただし、" +"ないモジュールの相対パスになります。デフォルトでは、このパスは関数 " +"``testfile()`` を呼び出しているモジュールからの相対パスになります; ただし、" "*package* 引数を指定した場合には、パッケージからの相対になります。OS への依存" "性を除くため、*filename* ではパスを分割する文字に ``/`` を使わなければなら" "ず、絶対パスにしてはなりません (パス文字列を ``/`` で始めてはなりません)。" @@ -1567,8 +1796,8 @@ msgid "" "v'`` is in ``sys.argv``." msgstr "" "オプション引数 *verbose* が真の場合、様々な情報を出力します。偽の場合にはテス" -"トの失敗だけを報告します。デフォルトの場合や ``None`` を指定した場合、``sys." -"argv`` に ``'-v'`` を指定しない限りこの値は真になりません。" +"トの失敗だけを報告します。デフォルトの場合や ``None`` を指定した場合、" +"``sys.argv`` に ``'-v'`` を指定しない限りこの値は真になりません。" #: ../../library/doctest.rst:943 msgid "" @@ -1638,13 +1867,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." +"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 "" @@ -1668,12 +1901,20 @@ msgstr "" msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " -"a backward compatibility hack, so that code still using :meth:`doctest." -"master.summarize ` in conjunction with :func:" -"`testmod` continues to get output for objects with no tests. The " -"*exclude_empty* argument to the newer :class:`DocTestFinder` constructor " -"defaults to true." -msgstr "" +"a backward compatibility hack, so that code still " +"using :meth:`doctest.master.summarize ` in " +"conjunction with :func:`testmod` continues to get output for objects with no " +"tests. The *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 +1989,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 +2005,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 "" @@ -1770,18 +2023,18 @@ msgstr "" #: ../../library/doctest.rst:1043 msgid "" -"Convert doctest tests from one or more text files to a :class:`unittest." -"TestSuite`." +"Convert doctest tests from one or more text files to " +"a :class:`unittest.TestSuite`." msgstr "" -"単一または複数のテキストファイルに入っている doctest 形式のテストを、 :class:" -"`unittest.TestSuite` インスタンスに変換します。" +"単一または複数のテキストファイルに入っている doctest 形式のテスト" +"を、 :class:`unittest.TestSuite` インスタンスに変換します。" #: ../../library/doctest.rst:1046 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " -"any file fails, then the synthesized unit test fails, and a :exc:" -"`failureException` exception is raised showing the name of the file " +"any file fails, then the synthesized unit test fails, and " +"a :exc:`failureException` exception is raised showing the name of the file " "containing the test and a (sometimes approximate) line number. If all the " "examples in a file are skipped, then the synthesized unit test is also " "marked as skipped." @@ -1795,7 +2048,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 +2075,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 "" @@ -1884,9 +2137,10 @@ msgstr "" #: ../../library/doctest.rst:1093 msgid "" "Optional argument *optionflags* specifies the default doctest options for " -"the tests, created by or-ing together individual option flags. See section :" -"ref:`doctest-options`. See function :func:`set_unittest_reportflags` below " -"for a better way to set reporting options." +"the tests, created by or-ing together individual option flags. See " +"section :ref:`doctest-options`. See " +"function :func:`set_unittest_reportflags` below for a better way to set " +"reporting options." msgstr "" "オプション引数 *optionflags* には、テストを実行する際にデフォルトで適用され" "る doctest オプションを OR で結合して指定します。 :ref:`doctest-options` 節を" @@ -1940,16 +2194,17 @@ msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -"オプション引数 *test_finder* は、モジュールから doctest を抽出するための :" -"class:`DocTestFinder` オブジェクト (またはその代替となるオブジェクト) です。" +"オプション引数 *test_finder* は、モジュールから doctest を抽出するため" +"の :class:`DocTestFinder` オブジェクト (またはその代替となるオブジェクト) で" +"す。" #: ../../library/doctest.rst:1134 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -"オプション引数 *setUp* 、 *tearDown* 、および *optionflags* は上の :func:" -"`DocFileSuite` と同じです。" +"オプション引数 *setUp* 、 *tearDown* 、および *optionflags* は上" +"の :func:`DocFileSuite` と同じです。" #: ../../library/doctest.rst:1137 msgid "This function uses the same search technique as :func:`testmod`." @@ -1960,19 +2215,18 @@ msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -"*module* がドキュメンテーション文字列を含まない場合には、 :func:" -"`DocTestSuite` は :exc:`ValueError` を送出するのではなく空の :class:" -"`unittest.TestSuite` を返します。" +"*module* がドキュメンテーション文字列を含まない場合に" +"は、 :func:`DocTestSuite` は :exc:`ValueError` を送出するのではなく空" +"の :class:`unittest.TestSuite` を返します。" #: ../../library/doctest.rst:1145 msgid "" -"When doctests which have been converted to unit tests by :func:" -"`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " -"showing the name of the file containing the test and a (sometimes " +"When doctests which have been converted to unit tests " +"by :func:`DocFileSuite` or :func:`DocTestSuite` fail, this exception is " +"raised showing the name of the file containing the test and a (sometimes " "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,25 +2234,32 @@ 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 "" -"So both ways of creating a :class:`unittest.TestSuite` run instances of :" -"class:`!DocTestCase`. This is important for a subtle reason: when you run :" -"mod:`doctest` functions yourself, you can control the :mod:`doctest` options " -"in use directly, by passing option flags to :mod:`doctest` functions. " -"However, if you're writing a :mod:`unittest` framework, :mod:`unittest` " -"ultimately controls when and how tests get run. The framework author " -"typically wants to control :mod:`doctest` reporting options (perhaps, e.g., " -"specified by command line options), but there's no way to pass options " -"through :mod:`unittest` to :mod:`doctest` test runners." +"So both ways of creating a :class:`unittest.TestSuite` run instances " +"of :class:`!DocTestCase`. This is important for a subtle reason: when you " +"run :mod:`doctest` functions yourself, you can control the :mod:`doctest` " +"options in use directly, by passing option flags to :mod:`doctest` " +"functions. However, if you're writing a :mod:`unittest` " +"framework, :mod:`unittest` ultimately controls when and how tests get run. " +"The framework author typically wants to control :mod:`doctest` reporting " +"options (perhaps, e.g., specified by command line options), but there's no " +"way to pass options through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" #: ../../library/doctest.rst:1169 @@ -2026,14 +2287,14 @@ msgstr "" msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" -"DocTestCase` looks at the option flags specified for the test case when the :" -"class:`!DocTestCase` instance was constructed. If no reporting flags were " -"specified (which is the typical and expected case), :mod:`!doctest`'s :mod:" -"`unittest` reporting flags are :ref:`bitwise ORed ` into the option " -"flags, and the option flags so augmented are passed to the :class:" -"`DocTestRunner` instance created to run the doctest. If any reporting flags " -"were specified when the :class:`!DocTestCase` instance was constructed, :mod:" -"`!doctest`'s :mod:`unittest` reporting flags are ignored." +"DocTestCase` looks at the option flags specified for the test case when " +"the :class:`!DocTestCase` instance was constructed. If no reporting flags " +"were specified (which is the typical and expected case), :mod:`!" +"doctest`'s :mod:`unittest` reporting flags are :ref:`bitwise ORed ` " +"into the option flags, and the option flags so augmented are passed to " +"the :class:`DocTestRunner` instance created to run the doctest. If any " +"reporting flags were specified when the :class:`!DocTestCase` instance was " +"constructed, :mod:`!doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" #: ../../library/doctest.rst:1191 @@ -2094,9 +2355,9 @@ msgstr "" #: ../../library/doctest.rst:1217 msgid "" -":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" -"class:`DocTestParser` to create a :class:`DocTest` from every docstring that " -"contains interactive examples." +":class:`DocTestFinder`: Finds all docstrings in a given module, and uses " +"a :class:`DocTestParser` to create a :class:`DocTest` from every docstring " +"that contains interactive examples." msgstr "" ":class:`DocTestFinder`: 与えられたモジュールからすべての docstring を検索" "し、 :class:`DocTestParser` を使って対話モードでの実行例が入ったすべての " @@ -2107,16 +2368,16 @@ msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -":class:`DocTestParser`: (オブジェクトの docstring 等の) 文字列から :class:" -"`DocTest` オブジェクトを生成します。" +":class:`DocTestParser`: (オブジェクトの docstring 等の) 文字列か" +"ら :class:`DocTest` オブジェクトを生成します。" #: ../../library/doctest.rst:1224 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -":class:`DocTestRunner`: :class:`DocTest` 内の実行例を実行し、 :class:" -"`OutputChecker` を使って出力を検証します。" +":class:`DocTestRunner`: :class:`DocTest` 内の実行例を実行" +"し、 :class:`OutputChecker` を使って出力を検証します。" #: ../../library/doctest.rst:1227 msgid "" @@ -2132,7 +2393,6 @@ msgid "" "following diagram::" msgstr "これらの処理クラスの関係を図にまとめると、以下のようになります::" -#: ../../library/doctest.rst:1233 msgid "" " list of:\n" "+------+ +---------+\n" @@ -2143,6 +2403,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 +2423,7 @@ msgid "" "names." msgstr "" "単一の名前空間内で実行される doctest 実行例の集まりです。コンストラクタの引数" -"は :class:`DocTest` インスタンス中の同名の属性の初期化に使われます。" +"は ``DocTest`` インスタンス中の同名の属性の初期化に使われます。" #: ../../library/doctest.rst:1255 msgid "" @@ -2170,15 +2438,15 @@ msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -"対話モードにおける実行例それぞれをエンコードしていて、テストで実行される、 :" -"class:`Example` オブジェクトからなるリストです。" +"対話モードにおける実行例それぞれをエンコードしていて、テストで実行され" +"る、 :class:`Example` オブジェクトからなるリストです。" #: ../../library/doctest.rst:1267 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " -"the examples (such as binding new variables) will be reflected in :attr:" -"`globs` after the test is run." +"the examples (such as binding new variables) will be reflected " +"in :attr:`globs` after the test is run." msgstr "" "実行例を実行する名前空間 (いわゆるグローバル変数) です。このメンバは、名前か" "ら値への対応付けを行っている辞書です。実行例が名前空間に対して (新たな変数を" @@ -2199,9 +2467,9 @@ msgid "" "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -":class:`DocTest` を取り出したファイルの名前です; ファイル名が未知の場合や :" -"class:`DocTest` をファイルから取り出したのでない場合には ``None`` になりま" -"す。" +":class:`DocTest` を取り出したファイルの名前です; ファイル名が未知の場合" +"や :class:`DocTest` をファイルから取り出したのでない場合には ``None`` になり" +"ます。" #: ../../library/doctest.rst:1288 msgid "" @@ -2233,8 +2501,8 @@ msgid "" "attributes of the same names." msgstr "" "ひとつの Python 文と、それに対する期待する出力からなる、単一の対話的モードの" -"実行例です。コンストラクタの引数は :class:`Example` インスタンス中の同名の属" -"性の初期化に使われます。" +"実行例です。コンストラクタの引数は ``Example`` インスタンス中の同名の属性の初" +"期化に使われます。" #: ../../library/doctest.rst:1312 msgid "" @@ -2244,14 +2512,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 "" @@ -2269,15 +2537,15 @@ msgstr "" msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " -"exception. This exception message is compared against the return value of :" -"func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a newline " -"unless it's ``None``. The constructor adds a newline if needed." +"exception. This exception message is compared against the return value " +"of :func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a " +"newline unless it's ``None``. The constructor adds a newline if needed." msgstr "" "実行例が例外を生成すると期待される場合の例外メッセージです。例外を送出しない" -"場合には ``None`` です。この例外メッセージは、 :func:`traceback." -"format_exception_only` の戻り値と比較されます。値が ``None`` でない限り、 :" -"attr:`exc_msg` は改行で終わっていなければなりません; コンストラクタは必要に応" -"じて改行を追加します。" +"場合には ``None`` です。この例外メッセージ" +"は、 :func:`traceback.format_exception_only` の戻り値と比較されます。値が " +"``None`` でない限り、 :attr:`exc_msg` は改行で終わっていなければなりません; " +"コンストラクタは必要に応じて改行を追加します。" #: ../../library/doctest.rst:1342 msgid "" @@ -2296,7 +2564,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 +2571,12 @@ 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 +2607,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 "" @@ -2349,8 +2622,9 @@ msgstr "" #: ../../library/doctest.rst:1384 msgid "" -"If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." -"find` will include tests for objects with empty docstrings." +"If the optional argument *exclude_empty* is false, " +"then :meth:`DocTestFinder.find` will include tests for objects with empty " +"docstrings." msgstr "" "オプション引数 *exclude_empty* が偽の場合、 :meth:`DocTestFinder.find` は空" "の docstring を持つオブジェクトもテスト対象に含めます。" @@ -2367,15 +2641,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 +2675,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 +2687,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 +2694,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 "" @@ -2464,21 +2736,21 @@ msgstr ":class:`DocTestParser` では以下のメソッドを定義していま #: ../../library/doctest.rst:1445 msgid "" -"Extract all doctest examples from the given string, and collect them into a :" -"class:`DocTest` object." +"Extract all doctest examples from the given string, and collect them into " +"a :class:`DocTest` object." msgstr "" "指定した文字列からすべての doctest 実行例を抽出し、 :class:`DocTest` オブジェ" "クト内に集めます。" #: ../../library/doctest.rst:1448 msgid "" -"*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" -"`DocTest` object. See the documentation for :class:`DocTest` for more " -"information." +"*globs*, *name*, *filename*, and *lineno* are attributes for the " +"new :class:`DocTest` object. See the documentation for :class:`DocTest` for " +"more information." msgstr "" -"*globs*, *name*, *filename*, および *lineno* は新たに作成される :class:" -"`DocTest` オブジェクトの属性になります。詳しくは :class:`DocTest` のドキュメ" -"ントを参照してください。" +"*globs*, *name*, *filename*, および *lineno* は新たに作成され" +"る :class:`DocTest` オブジェクトの属性になります。詳しくは :class:`DocTest` " +"のドキュメントを参照してください。" #: ../../library/doctest.rst:1455 msgid "" @@ -2488,9 +2760,9 @@ msgid "" "error messages." msgstr "" "指定した文字列からすべての doctest 実行例を抽出し、 :class:`Example` オブジェ" -"クトからなるリストにして返します。各 :class:`Example` の行番号は 0 から数えま" -"す。オプション引数 *name* はこの文字列につける名前で、エラーメッセージにしか" -"使われません。" +"クトからなるリストにして返します。各 ``Example`` の行番号は 0 から数えます。" +"オプション引数 *name* はこの文字列につける名前で、エラーメッセージにしか使わ" +"れません。" #: ../../library/doctest.rst:1462 msgid "" @@ -2499,26 +2771,23 @@ msgid "" "the :class:`Example`\\ s are 0-based. The optional argument *name* is a " "name identifying this string, and is only used for error messages." msgstr "" -"指定した文字列を、実行例とその間のテキストに分割し、実行例を :class:" -"`Example` オブジェクトに変換し、 :class:`Example` と文字列からなるリストにし" -"て返します。各 :class:`Example` の行番号は 0から数えます。オプション引数 " -"*name* はこの文字列につける名前で、エラーメッセージにしか使われません。" +"指定した文字列を、実行例とその間のテキストに分割し、実行例" +"を :class:`Example` オブジェクトに変換し、 :class:`Example` と文字列からなる" +"リストにして返します。各 :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" @@ -2526,18 +2795,18 @@ msgstr "DocTestRunner オブジェクト" #: ../../library/doctest.rst:1497 msgid "" -"A processing class used to execute and verify the interactive examples in a :" -"class:`DocTest`." +"A processing class used to execute and verify the interactive examples in " +"a :class:`DocTest`." msgstr "" ":class:`DocTest` 内の対話モード実行例を実行し、検証する際に用いられる処理クラ" "スです。" #: ../../library/doctest.rst:1500 msgid "" -"The comparison between expected outputs and actual outputs is done by an :" -"class:`OutputChecker`. This comparison may be customized with a number of " -"option flags; see section :ref:`doctest-options` for more information. If " -"the option flags are insufficient, then the comparison may also be " +"The comparison between expected outputs and actual outputs is done by " +"an :class:`OutputChecker`. This comparison may be customized with a number " +"of option flags; see section :ref:`doctest-options` for more information. " +"If the option flags are insufficient, then the comparison may also be " "customized by passing a subclass of :class:`OutputChecker` to the " "constructor." msgstr "" @@ -2551,11 +2820,12 @@ msgstr "" msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " -"with strings that should be displayed. It defaults to ``sys.stdout." -"write``. If capturing the output is not sufficient, then the display output " -"can be also customized by subclassing DocTestRunner, and overriding the " -"methods :meth:`report_start`, :meth:`report_success`, :meth:" -"`report_unexpected_exception`, and :meth:`report_failure`." +"with strings that should be displayed. It defaults to " +"``sys.stdout.write``. If capturing the output is not sufficient, then the " +"display output can be also customized by subclassing DocTestRunner, and " +"overriding the " +"methods :meth:`report_start`, :meth:`report_success`, :meth:`report_unexpected_exception`, " +"and :meth:`report_failure`." msgstr "" #: ../../library/doctest.rst:1514 @@ -2570,11 +2840,12 @@ msgstr "" #: ../../library/doctest.rst:1518 msgid "" -"The optional keyword argument *verbose* controls the :class:" -"`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " -"printed about each example, as it is run. If *verbose* is ``False``, then " -"only failures are printed. If *verbose* is unspecified, or ``None``, then " -"verbose output is used iff the command-line switch ``-v`` is used." +"The optional keyword argument *verbose* controls " +"the :class:`DocTestRunner`'s verbosity. If *verbose* is ``True``, then " +"information is printed about each example, as it is run. If *verbose* is " +"``False``, then only failures are printed. If *verbose* is unspecified, or " +"``None``, then verbose output is used iff the command-line switch ``-v`` is " +"used." msgstr "" "オプションのキーワード引数 *verbose* は、 :class:`DocTestRunner` の出すメッ" "セージの冗長性を制御します。 *verbose* が ``True`` の場合、各実行例を実行する" @@ -2593,17 +2864,21 @@ 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." +"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 "" @@ -2611,15 +2886,15 @@ msgid "" "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -"テストランナーが実行例を処理しようとしているときにレポートを出力します。 :" -"class:`DocTestRunner` の出力をサブクラスでカスタマイズできるようにするための" -"メソッドです。直接呼び出してはなりません。" +"テストランナーが実行例を処理しようとしているときにレポートを出力しま" +"す。 :class:`DocTestRunner` の出力をサブクラスでカスタマイズできるようにする" +"ためのメソッドです。直接呼び出してはなりません。" #: ../../library/doctest.rst:1542 msgid "" "*example* is the example about to be processed. *test* is the test " -"*containing example*. *out* is the output function that was passed to :meth:" -"`DocTestRunner.run`." +"*containing example*. *out* is the output function that was passed " +"to :meth:`DocTestRunner.run`." msgstr "" "*example* は処理する実行例です。 *test* は *example* の入っているテストで" "す。 *out* は出力用の関数で、 :meth:`DocTestRunner.run` に渡されます。" @@ -2630,9 +2905,9 @@ msgid "" "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -"与えられた実行例が正しく動作したことを報告します。このメソッドは :class:" -"`DocTestRunner` のサブクラスで出力をカスタマイズできるようにするために提供さ" -"れています; 直接呼び出してはなりません。" +"与えられた実行例が正しく動作したことを報告します。このメソッド" +"は :class:`DocTestRunner` のサブクラスで出力をカスタマイズできるようにするた" +"めに提供されています; 直接呼び出してはなりません。" #: ../../library/doctest.rst:1553 ../../library/doctest.rst:1564 msgid "" @@ -2641,8 +2916,8 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" "*example* は処理する実行例です。 *got* は実行例から実際に得られた出力です。 " -"*test* は *example* の入っているテストです。 *out* は出力用の関数で、 :meth:" -"`DocTestRunner.run` に渡されます。" +"*test* は *example* の入っているテストです。 *out* は出力用の関数" +"で、 :meth:`DocTestRunner.run` に渡されます。" #: ../../library/doctest.rst:1560 msgid "" @@ -2650,9 +2925,9 @@ msgid "" "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -"与えられた実行例が正しく動作しなかったことを報告します。このメソッドは :" -"class:`DocTestRunner` のサブクラスで出力をカスタマイズできるようにするために" -"提供されています; 直接呼び出してはなりません。" +"与えられた実行例が正しく動作しなかったことを報告します。このメソッド" +"は :class:`DocTestRunner` のサブクラスで出力をカスタマイズできるようにするた" +"めに提供されています; 直接呼び出してはなりません。" #: ../../library/doctest.rst:1571 msgid "" @@ -2667,21 +2942,23 @@ msgstr "" #: ../../library/doctest.rst:1575 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " -"containing information about the unexpected exception (as returned by :func:" -"`sys.exc_info`). *test* is the test containing *example*. *out* is the " -"output function that was passed to :meth:`DocTestRunner.run`." +"containing information about the unexpected exception (as returned " +"by :func:`sys.exc_info`). *test* is the test containing *example*. *out* is " +"the output function that was passed to :meth:`DocTestRunner.run`." msgstr "" "*example* は処理する実行例です。 *exc_info* には予期せず送出された例外の情報" "を入れたタプル (:func:`sys.exc_info` の返す内容) になります。 *test* は " -"*example* の入っているテストです。 *out* は出力用の関数で、 :meth:" -"`DocTestRunner.run` に渡されます。" +"*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 +2982,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." +"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 +3011,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" @@ -2751,10 +3027,10 @@ msgstr "OutputChecker オブジェクト" #: ../../library/doctest.rst:1635 msgid "" "A class used to check the whether the actual output from a doctest example " -"matches the expected output. :class:`OutputChecker` defines two methods: :" -"meth:`check_output`, which compares a given pair of outputs, and returns " -"``True`` if they match; and :meth:`output_difference`, which returns a " -"string describing the differences between two outputs." +"matches the expected output. :class:`OutputChecker` defines two " +"methods: :meth:`check_output`, which compares a given pair of outputs, and " +"returns ``True`` if they match; and :meth:`output_difference`, which returns " +"a string describing the differences between two outputs." msgstr "" "doctest 実行例を実際に実行したときの出力が期待する出力と一致するかどうかを" "チェックするために使われるクラスです。\n" @@ -2771,8 +3047,8 @@ msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " "they are identical; but depending on what option flags the test runner is " -"using, several non-exact match types are also possible. See section :ref:" -"`doctest-options` for more information about option flags." +"using, several non-exact match types are also possible. See " +"section :ref:`doctest-options` for more information about option flags." msgstr "" "実行例から実際に得られた出力 (*got*) と、期待する出力 (*want*) が一致する場合" "にのみ ``True`` を返します。二つの文字列がまったく同一の場合には常に一致する" @@ -2797,8 +3073,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 "" @@ -2821,26 +3097,25 @@ msgstr "" #: ../../library/doctest.rst:1675 msgid "" -"The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" -"meth:`debug` method defined by :class:`unittest.TestCase`." +"The :mod:`unittest` cases generated by :func:`DocTestSuite` support " +"the :meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -":func:`DocTestSuite` の生成する :mod:`unittest` テストケースは、 :meth:" -"`debug` メソッドをサポートしています。 :meth:`debug` は :class:`unittest." -"TestCase` で定義されています。" +":func:`DocTestSuite` の生成する :mod:`unittest` テストケース" +"は、 :meth:`debug` メソッドをサポートしています。 ``debug()`` " +"は :class:`unittest.TestCase` で定義されています。" #: ../../library/doctest.rst:1678 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " -"inspect current values of variables, and so on. For example, suppose :file:" -"`a.py` contains just this module docstring::" +"inspect current values of variables, and so on. For example, " +"suppose :file:`a.py` contains just this module docstring::" msgstr "" ":func:`pdb.set_trace` を doctest 実行例の中で呼び出しておけば、その行が実行さ" "れたときに Python デバッガが組み込まれます。デバッガを組み込んだあとは、変数" "の現在の値などを調べられます。たとえば、以下のようなモジュールレベルの " "docstring の入ったファイル :file:`a.py` があるとします::" -#: ../../library/doctest.rst:1683 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2852,12 +3127,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 +3172,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 +3226,6 @@ msgstr "" "Python のコメント文になります。生成したスクリプトを文字列で返します。例え" "ば、 ::" -#: ../../library/doctest.rst:1739 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2926,12 +3237,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 +3260,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 +3281,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 +3289,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." @@ -2983,10 +3318,10 @@ msgstr "オブジェクトの持つ doctest をデバッグします。" #: ../../library/doctest.rst:1786 msgid "" -"The *module* and *name* arguments are the same as for function :func:" -"`testsource` above. The synthesized Python script for the named object's " -"docstring is written to a temporary file, and then that file is run under " -"the control of the Python debugger, :mod:`pdb`." +"The *module* and *name* arguments are the same as for " +"function :func:`testsource` above. The synthesized Python script for the " +"named object's docstring is written to a temporary file, and then that file " +"is run under the control of the Python debugger, :mod:`pdb`." msgstr "" "*module* および *name* 引数は上の :func:`testsource` と同じです。指定したオブ" "ジェクトの docstring から合成された Python スクリプトは一時ファイルに書き出さ" @@ -3005,19 +3340,19 @@ msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " "gets involved only if the script terminates via raising an unhandled " -"exception. If it does, then post-mortem debugging is invoked, via :func:" -"`pdb.post_mortem`, passing the traceback object from the unhandled " +"exception. If it does, then post-mortem debugging is invoked, " +"via :func:`pdb.post_mortem`, passing the traceback object from the unhandled " "exception. If *pm* is not specified, or is false, the script is run under " "the debugger from the start, via passing an appropriate :func:`exec` call " "to :func:`pdb.run`." msgstr "" "オプション引数 *pm* は、検死デバッグを行うかどうかを指定します。 *pm* が真の" "場合、スクリプトファイルは直接実行され、スクリプトが送出した例外が処理されな" -"いまま終了した場合にのみデバッガが立ち入ります。その場合、 :func:`pdb." -"post_mortem` によって検死デバッグを起動し、処理されなかった例外から得られたト" -"レースバックオブジェクトを渡します。 *pm* を指定しないか値を偽にした場合、 :" -"func:`pdb.run` に適切な :func:`exec` 呼び出しを渡して、最初からデバッガの下で" -"スクリプトを実行します。" +"いまま終了した場合にのみデバッガが立ち入ります。その場" +"合、 :func:`pdb.post_mortem` によって検死デバッグを起動し、処理されなかった例" +"外から得られたトレースバックオブジェクトを渡します。 *pm* を指定しないか値を" +"偽にした場合、 :func:`pdb.run` に適切な :func:`exec` 呼び出しを渡して、最初か" +"らデバッガの下でスクリプトを実行します。" #: ../../library/doctest.rst:1805 msgid "Debug the doctests in a string." @@ -3057,24 +3392,24 @@ msgid "" msgstr "" ":class:`DebugRunner` クラス自体や :class:`DebugRunner` クラスが送出する特殊な" "例外は、テストフレームワークの作者にとって非常に興味のあるところですが、ここ" -"では概要しか述べられません。詳しくはソースコード、とりわけ :class:" -"`DebugRunner` の docstring (それ自体 doctest です!) を参照してください:" +"では概要しか述べられません。詳しくはソースコード、とりわけ ``DebugRunner`` " +"の docstring (それ自体 doctest です!) を参照してください:" #: ../../library/doctest.rst:1825 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " -"failure is encountered. If an unexpected exception occurs, an :exc:" -"`UnexpectedException` exception is raised, containing the test, the example, " -"and the original exception. If the output doesn't match, then a :exc:" -"`DocTestFailure` exception is raised, containing the test, the example, and " -"the actual output." -msgstr "" -"テストの失敗に遭遇するとすぐに例外を送出するようになっている :class:" -"`DocTestRunner` のサブクラスです。予期しない例外が生じると、 :exc:" -"`UnexpectedException` 例外を送出します。この例外には、テスト、実行例、もとも" -"と送出された例外が入っています。期待する出力と実際の出力が一致しないために失" -"敗した場合には、 :exc:`DocTestFailure` 例外を送出します。この例外には、テス" -"ト、実行例、実際の出力が入っています。" +"failure is encountered. If an unexpected exception occurs, " +"an :exc:`UnexpectedException` exception is raised, containing the test, the " +"example, and the original exception. If the output doesn't match, then " +"a :exc:`DocTestFailure` exception is raised, containing the test, the " +"example, and the actual output." +msgstr "" +"テストの失敗に遭遇するとすぐに例外を送出するようになってい" +"る :class:`DocTestRunner` のサブクラスです。予期しない例外が生じる" +"と、 :exc:`UnexpectedException` 例外を送出します。この例外には、テスト、実行" +"例、もともと送出された例外が入っています。期待する出力と実際の出力が一致しな" +"いために失敗した場合には、 :exc:`DocTestFailure` 例外を送出します。この例外に" +"は、テスト、実行例、実際の出力が入っています。" #: ../../library/doctest.rst:1832 msgid "" @@ -3098,9 +3433,9 @@ msgid "" "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -"doctest 実行例の実際の出力が期待する出力と一致しなかったことを示すために :" -"class:`DocTestRunner` が送出する例外です。コンストラクタの引数は、インスタン" -"スの同名の属性を初期化するために使われます。" +"doctest 実行例の実際の出力が期待する出力と一致しなかったことを示すため" +"に :class:`DocTestRunner` が送出する例外です。コンストラクタの引数は、インス" +"タンスの同名の属性を初期化するために使われます。" #: ../../library/doctest.rst:1844 msgid ":exc:`DocTestFailure` defines the following attributes:" @@ -3124,9 +3459,9 @@ msgid "" "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -"doctest 実行例が予期しない例外を送出したことを示すために :class:" -"`DocTestRunner` が送出する例外です。コンストラクタの引数は、インスタンスの同" -"名の属性を初期化するために使われます。" +"doctest 実行例が予期しない例外を送出したことを示すため" +"に :class:`DocTestRunner` が送出する例外です。コンストラクタの引数は、インス" +"タンスの同名の属性を初期化するために使われます。" #: ../../library/doctest.rst:1868 msgid ":exc:`UnexpectedException` defines the following attributes:" @@ -3193,7 +3528,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 +3547,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 "" @@ -3244,10 +3584,10 @@ msgid "" "although is easiest to do for new projects, designed from the start to use " "doctest." msgstr "" -"テストケースを対話モードの実行例にして入れたテキストファイルを書き、 :func:" -"`testfile` や :func:`DocFileSuite` を使ってそのファイルをテストします。この方" -"法をお勧めします。最初から doctest を使うようにしている新たなプロジェクトで" -"は、この方法が一番簡単です。" +"テストケースを対話モードの実行例にして入れたテキストファイルを書" +"き、 :func:`testfile` や :func:`DocFileSuite` を使ってそのファイルをテストし" +"ます。この方法をお勧めします。最初から doctest を使うようにしている新たなプロ" +"ジェクトでは、この方法が一番簡単です。" #: ../../library/doctest.rst:1939 msgid "" @@ -3269,20 +3609,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 +3637,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 +3670,8 @@ msgstr "" msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:373 msgid "interpreter prompt" -msgstr "" +msgstr "インタープリタのプロンプト" #: ../../library/doctest.rst:373 ../../library/doctest.rst:608 msgid "..." @@ -3330,17 +3681,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..4c8754d34 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 @@ -51,8 +51,8 @@ msgid "" "This module provides a class :class:`Charset` for representing character " "sets and character set conversions in email messages, as well as a character " "set registry and several convenience methods for manipulating this registry. " -"Instances of :class:`Charset` are used in several other modules within the :" -"mod:`email` package." +"Instances of :class:`Charset` are used in several other modules within " +"the :mod:`email` package." msgstr "" "このモジュールは文字集合の表現および電子メールメッセージの文字集合の変換を行" "う :class:`Charset` クラスに加え、文字集合のレジストリとそれを操作する簡易メ" @@ -139,16 +139,16 @@ msgid "" "shortest of QP or BASE64 encoding. Otherwise, it will be ``None``." msgstr "" "この文字集合が電子メールヘッダに使われる前にエンコードされなければならない場" -"合、この属性は ``charset.QP`` (quoted-printable エンコーディング)、``charset." -"BASE64`` (base64 エンコーディング)、あるいは最短の QP または BASE64 エンコー" -"ディングである ``charset.SHORTEST`` に設定されます。そうでない場合、この値は " -"``None`` になります。" +"合、この属性は ``charset.QP`` (quoted-printable エンコーディング)、" +"``charset.BASE64`` (base64 エンコーディング)、あるいは最短の QP または " +"BASE64 エンコーディングである ``charset.SHORTEST`` に設定されます。そうでない" +"場合、この値は ``None`` になります。" #: ../../library/email.charset.rst:69 msgid "" "Same as *header_encoding*, but describes the encoding for the mail message's " -"body, which indeed may be different than the header encoding. ``charset." -"SHORTEST`` is not allowed for *body_encoding*." +"body, which indeed may be different than the header encoding. " +"``charset.SHORTEST`` is not allowed for *body_encoding*." msgstr "" "*header_encoding* と同じですが、この値はメッセージ本体のためのエンコーディン" "グを記述します。これはヘッダ用のエンコーディングとは違うかもしれません。" @@ -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 "" @@ -333,11 +331,11 @@ msgid "" "``None`` for no encoding." msgstr "" "オプション引数 *header_enc* および *body_enc* は quoted-printable エンコー" -"ディングを表す ``charset.QP`` か、base64 エンコーディングを表す ``charset." -"BASE64``、最短の quoted-printable または base64 エンコーディングを表す " -"``charset.SHORTEST``、あるいはエンコーディングなしの ``None`` のいずれかにな" -"ります。``SHORTEST`` が使えるのは *header_enc* だけです。デフォルトの値はエン" -"コーディングなしの ``None`` になっています。" +"ディングを表す ``charset.QP`` か、base64 エンコーディングを表す " +"``charset.BASE64``、最短の quoted-printable または base64 エンコーディングを" +"表す ``charset.SHORTEST``、あるいはエンコーディングなしの ``None`` のいずれか" +"になります。``SHORTEST`` が使えるのは *header_enc* だけです。デフォルトの値は" +"エンコーディングなしの ``None`` になっています。" #: ../../library/email.charset.rst:184 msgid "" @@ -346,10 +344,10 @@ msgid "" "charset when the method :meth:`Charset.convert` is called. The default is " "to output in the same character set as the input." msgstr "" -"オプション引数 *output_charset* には出力用の文字集合が入ります。 :meth:" -"`Charset.convert` が呼ばれたときの変換はまず入力用の文字集合を Unicode に変換" -"し、それから出力用の文字集合に変換されます。デフォルトでは、出力は入力と同じ" -"文字集合になっています。" +"オプション引数 *output_charset* には出力用の文字集合が入りま" +"す。 :meth:`Charset.convert` が呼ばれたときの変換はまず入力用の文字集合を " +"Unicode に変換し、それから出力用の文字集合に変換されます。デフォルトでは、出" +"力は入力と同じ文字集合になっています。" #: ../../library/email.charset.rst:189 msgid "" @@ -399,8 +397,9 @@ msgstr "" #: ../../library/email.charset.rst:211 msgid "" "*charset* is the canonical name of a character set. *codecname* is the name " -"of a Python codec, as appropriate for the second argument to the :class:" -"`str`'s :meth:`~str.encode` method." +"of a Python codec, as appropriate for the second argument to " +"the :class:`str`'s :meth:`~str.encode` method." msgstr "" -"*charset* は文字集合の正式な名前です。 *codecname* は、 :class:`str` の :" -"meth:`~str.encode` メソッドの第 2 引数で使える Python コーデックの名前です。" +"*charset* は文字集合の正式な名前です。 *codecname* は、 :class:`str` " +"の :meth:`~str.encode` メソッドの第 2 引数で使える Python コーデックの名前で" +"す。" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index e7e4d7ba1..6aed4c576 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -17,55 +17,68 @@ 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 msgid "" -":mod:`email.message.Message`: Representing an email message using the :data:" -"`~email.policy.compat32` API" +":mod:`email.message.Message`: Representing an email message using " +"the :data:`~email.policy.compat32` API" 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 " -"default behavior of certain other methods being slightly different. We also " -"document here some methods that, while supported by the :class:`~email." -"message.EmailMessage` class, are not recommended unless you are dealing with " -"legacy code." +"The :class:`Message` class is very similar to " +"the :class:`~email.message.EmailMessage` class, without the methods added by " +"that class, and with the default behavior of certain other methods being " +"slightly different. We also document here some methods that, while " +"supported by the :class:`~email.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." +"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 " +"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 " "separated by a colon. The colon is not part of either the field name or the " "field value. The payload may be a simple text message, or a binary object, " "or a structured sequence of sub-messages each with their own set of headers " "and their own payload. The latter type of payload is indicated by the " -"message having a MIME type such as :mimetype:`multipart/\\*` or :mimetype:" -"`message/rfc822`." +"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 " @@ -85,29 +102,44 @@ msgid "" "matched case-insensitively. There may also be a single envelope header, " "also known as the *Unix-From* header or the ``From_`` header. The *payload* " "is either a string or bytes, in the case of simple message objects, or a " -"list of :class:`Message` objects, for MIME container documents (e.g. :" -"mimetype:`multipart/\\*` and :mimetype:`message/rfc822`)." -msgstr "" +"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 " -"of the message. If *policy* is not set, use the :class:`compat32 ` policy, which maintains backward compatibility with the " -"Python 3.2 version of the email package. For more information see the :mod:" -"`~email.policy` documentation." +"of the message. If *policy* is not set, use the :class:`compat32 " +"` policy, which maintains backward compatibility with " +"the 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,17 +174,24 @@ 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 " "mangling of lines that begin with ``From`` that is required by the Unix mbox " -"format. For more flexibility, instantiate a :class:`~email.generator." -"Generator` instance and use its :meth:`~email.generator.Generator.flatten` " -"method directly. For example::" +"format. For more flexibility, instantiate " +"a :class:`~email.generator.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,26 +200,32 @@ 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 "" "If the message object contains binary data that is not encoded according to " "RFC standards, the non-compliant data will be replaced by unicode \"unknown " -"character\" code points. (See also :meth:`.as_bytes` and :class:`~email." -"generator.BytesGenerator`.)" +"character\" code points. (See also :meth:`.as_bytes` " +"and :class:`~email.generator.BytesGenerator`.)" msgstr "" #: ../../library/email.compat32-message.rst:103 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,18 +234,33 @@ 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 " "mangling of lines that begin with ``From`` that is required by the Unix mbox " -"format. For more flexibility, instantiate a :class:`~email.generator." -"BytesGenerator` instance and use its :meth:`~email.generator.BytesGenerator." -"flatten` method directly. For example::" +"format. For more flexibility, instantiate " +"a :class:`~email.generator.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,23 +269,39 @@ 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 "" - -#: ../../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` " -"returns ``False``, the payload should be a string object (which might be a " -"CTE encoded binary payload). (Note that :meth:`is_multipart` returning " -"``True`` does not necessarily mean that \"msg.get_content_maintype() == " -"'multipart'\" will return the ``True``. For example, ``is_multipart`` will " -"return ``True`` when the :class:`Message` is of type ``message/rfc822``.)" -msgstr "" +":meth:`.as_bytes` と同じです。\n" +"``bytes(msg)`` で、書式化されたメッセージを含む bytes オブジェクトを生成でき" +"るようにします。" + +msgid "" +"Return ``True`` if the message's payload is a list of sub-" +"\\ :class:`Message` objects, otherwise return ``False``. " +"When :meth:`is_multipart` returns ``False``, the payload should be a string " +"object (which might be a CTE encoded binary payload). (Note " +"that :meth:`is_multipart` returning ``True`` does not necessarily mean that " +"\"msg.get_content_maintype() == '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 "" @@ -248,8 +335,9 @@ msgstr "" #: ../../library/email.compat32-message.rst:183 msgid "" "This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by :meth:`~email.message.EmailMessage." -"set_content` and the related ``make`` and ``add`` methods." +"class its functionality is replaced " +"by :meth:`~email.message.EmailMessage.set_content` and the related ``make`` " +"and ``add`` methods." msgstr "" #: ../../library/email.compat32-message.rst:191 @@ -270,17 +358,16 @@ msgid "" "element of the payload, counting from zero, if :meth:`is_multipart` is " "``True``. An :exc:`IndexError` will be raised if *i* is less than 0 or " "greater than or equal to the number of items in the payload. If the payload " -"is a string (i.e. :meth:`is_multipart` is ``False``) and *i* is given, a :" -"exc:`TypeError` is raised." -msgstr "" -"オプション引数の *i* がある場合、 :meth:`is_multipart` が ``True`` ならば :" -"meth:`get_payload` はペイロード中で 0 から数えて *i* 番目の要素を返します。 " -"*i* が 0 より小さい場合、あるいはペイロードの個数以上の場合は :exc:" -"`IndexError` が発生します。ペイロードが文字列 (つまり :meth:`is_multipart` " -"が ``False``) にもかかわらず *i* が与えられたときは :exc:`TypeError` が発生し" -"ます。" +"is a string (i.e. :meth:`is_multipart` is ``False``) and *i* is given, " +"a :exc:`TypeError` is raised." +msgstr "" +"オプション引数の *i* がある場合、 :meth:`is_multipart` が ``True`` なら" +"ば :meth:`get_payload` はペイロード中で 0 から数えて *i* 番目の要素を返しま" +"す。 *i* が 0 より小さい場合、あるいはペイロードの個数以上の場合" +"は :exc:`IndexError` が発生します。ペイロードが文字列 (つま" +"り :meth:`is_multipart` が ``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,94 +382,114 @@ 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 " "a :mailheader:`Content-Transfer-Encoding` of 8bit, an attempt is made to " -"decode the original bytes using the ``charset`` specified by the :mailheader:" -"`Content-Type` header, using the ``replace`` error handler. If no " -"``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 the original bytes using the ``charset`` specified by " +"the :mailheader:`Content-Type` header, using the ``replace`` error handler. " +"If no ``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 "" "This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by :meth:`~email.message.EmailMessage." -"get_content` and :meth:`~email.message.EmailMessage.iter_parts`." +"class its functionality is replaced " +"by :meth:`~email.message.EmailMessage.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 "" "This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by :meth:`~email.message.EmailMessage." -"set_content`." +"class its functionality is replaced " +"by :meth:`~email.message.EmailMessage.set_content`." msgstr "" #: ../../library/email.compat32-message.rst:245 msgid "" -"Set the character set of the payload to *charset*, which can either be a :" -"class:`~email.charset.Charset` instance (see :mod:`email.charset`), a string " -"naming a character set, or ``None``. If it is a string, it will be " +"Set the character set of the payload to *charset*, which can either be " +"a :class:`~email.charset.Charset` instance (see :mod:`email.charset`), a " +"string naming a character set, or ``None``. If it is a string, it will be " "converted to a :class:`~email.charset.Charset` instance. If *charset* is " -"``None``, the ``charset`` parameter will be removed from the :mailheader:" -"`Content-Type` header (the message will not be otherwise modified). " -"Anything else will generate a :exc:`TypeError`." -msgstr "" -"ペイロードの文字セットを *charset* に変更します。これは :class:`~email." -"charset.Charset` インスタンス (:mod:`email.charset` 参照)、文字セット名を表す" -"文字列、あるいは ``None`` のいずれかです。文字列を指定した場合は :class:" -"`~email.charset.Charset` インスタンスに変換されます。 *charset* が ``None`` " -"の場合、 ``charset`` 引数は :mailheader:`Content-Type` ヘッダから除去されま" -"す (それ以外にメッセージは変更されません)。これら以外のものを文字セットとして" -"指定した場合、 :exc:`TypeError` を送出します。" +"``None``, the ``charset`` parameter will be removed from " +"the :mailheader:`Content-Type` header (the message will not be otherwise " +"modified). Anything else will generate a :exc:`TypeError`." +msgstr "" +"ペイロードの文字セットを *charset* に変更します。これ" +"は :class:`~email.charset.Charset` インスタンス (:mod:`email.charset` 参照)、" +"文字セット名を表す文字列、あるいは ``None`` のいずれかです。文字列を指定した" +"場合は :class:`~email.charset.Charset` インスタンスに変換されます。 " +"*charset* が ``None`` の場合、 ``charset`` 引数は :mailheader:`Content-Type` " +"ヘッダから除去されます (それ以外にメッセージは変更されません)。これら以外のも" +"のを文字セットとして指定した場合、 :exc:`TypeError` を送出します。" #: ../../library/email.compat32-message.rst:253 msgid "" "If there is no existing :mailheader:`MIME-Version` header one will be " "added. If there is no existing :mailheader:`Content-Type` header, one will " -"be added with a value of :mimetype:`text/plain`. Whether the :mailheader:" -"`Content-Type` header already exists or not, its ``charset`` parameter will " -"be set to *charset.output_charset*. If *charset.input_charset* and " -"*charset.output_charset* differ, the payload will be re-encoded to the " -"*output_charset*. If there is no existing :mailheader:`Content-Transfer-" -"Encoding` header, then the payload will be transfer-encoded, if needed, " -"using the specified :class:`~email.charset.Charset`, and a header with the " -"appropriate value will be added. If a :mailheader:`Content-Transfer-" -"Encoding` header already exists, the payload is assumed to already be " -"correctly encoded using that :mailheader:`Content-Transfer-Encoding` and is " -"not modified." -msgstr "" -":mailheader:`MIME-Version` ヘッダが存在しなければ、追加されます。 :" -"mailheader:`Content-Type` ヘッダが存在しなければ、 :mimetype:`text/plain` を" -"値として追加されます。 :mailheader:`Content-Type` が存在していてもいなくて" -"も、 ``charset`` パラメタは *charset.output_charset* に設定されます。 " +"be added with a value of :mimetype:`text/plain`. Whether " +"the :mailheader:`Content-Type` header already exists or not, its ``charset`` " +"parameter will be set to *charset.output_charset*. If " +"*charset.input_charset* and *charset.output_charset* differ, the payload " +"will be re-encoded to the *output_charset*. If there is no " +"existing :mailheader:`Content-Transfer-Encoding` header, then the payload " +"will be transfer-encoded, if needed, using the " +"specified :class:`~email.charset.Charset`, and a header with the appropriate " +"value will be added. If a :mailheader:`Content-Transfer-Encoding` header " +"already exists, the payload is assumed to already be correctly encoded using " +"that :mailheader:`Content-Transfer-Encoding` and is not modified." +msgstr "" +":mailheader:`MIME-Version` ヘッダが存在しなければ、追加されま" +"す。 :mailheader:`Content-Type` ヘッダが存在しなければ、 :mimetype:`text/" +"plain` を値として追加されます。 :mailheader:`Content-Type` が存在していてもい" +"なくても、 ``charset`` パラメタは *charset.output_charset* に設定されます。 " "*charset.input_charset* と *charset.output_charset* が異なるなら、ペイロード" "は *output_charset* に再エンコードされます。 :mailheader:`Content-Transfer-" -"Encoding` ヘッダが存在しなければ、ペイロードは、必要なら指定された :class:" -"`~email.charset.Charset` を使って transfer エンコードされ、適切な値のヘッダが" -"追加されます。 :mailheader:`Content-Transfer-Encoding` ヘッダがすでに存在すれ" -"ば、ペイロードはすでにその :mailheader:`Content-Transfer-Encoding` によって正" -"しくエンコードされたものと見なされ、変形されません。" +"Encoding` ヘッダが存在しなければ、ペイロードは、必要なら指定され" +"た :class:`~email.charset.Charset` を使って transfer エンコードされ、適切な値" +"のヘッダが追加されます。 :mailheader:`Content-Transfer-Encoding` ヘッダがすで" +"に存在すれば、ペイロードはすでにその :mailheader:`Content-Transfer-Encoding` " +"によって正しくエンコードされたものと見なされ、変形されません。" #: ../../library/email.compat32-message.rst:267 msgid "" "This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by the *charset* parameter of the :meth:" -"`email.emailmessage.EmailMessage.set_content` method." +"class its functionality is replaced by the *charset* parameter of " +"the :meth:`email.emailmessage.EmailMessage.set_content` method." msgstr "" #: ../../library/email.compat32-message.rst:275 @@ -406,10 +513,11 @@ msgid "" "differences between these methods and a normal mapping (i.e. dictionary) " "interface. For example, in a dictionary there are no duplicate keys, but " "here there may be duplicate message headers. Also, in dictionaries there is " -"no guaranteed order to the keys returned by :meth:`keys`, but in a :class:" -"`Message` object, headers are always returned in the order they appeared in " -"the original message, or were added to the message later. Any header " -"deleted and then re-added are always appended to the end of the header list." +"no guaranteed order to the keys returned by :meth:`keys`, but in " +"a :class:`Message` object, headers are always returned in the order they " +"appeared in the original message, or were added to the message later. Any " +"header deleted and then re-added are always appended to the end of the " +"header list." msgstr "" "以下のメソッドは、メッセージの :rfc:`2822` ヘッダにアクセスするためのマップ " "(辞書) 形式のインタフェイスを実装したものです。これらのメソッドと、通常のマッ" @@ -437,13 +545,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,21 +570,22 @@ 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 "" "Return the value of the named header field. *name* should not include the " -"colon field separator. If the header is missing, ``None`` is returned; a :" -"exc:`KeyError` is never raised." +"colon field separator. If the header is missing, ``None`` is returned; " +"a :exc:`KeyError` is never raised." msgstr "" "指定された名前のヘッダフィールドの値を返します。 *name* は最後にコロンをふく" -"んでいてはいけません。そのヘッダがない場合は ``None`` が返され、 :exc:" -"`KeyError` 例外は発生しません。" +"んでいてはいけません。そのヘッダがない場合は ``None`` が返さ" +"れ、 :exc:`KeyError` 例外は発生しません。" #: ../../library/email.compat32-message.rst:326 msgid "" @@ -506,11 +617,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 +649,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``)." +"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 +672,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 "" @@ -578,11 +693,11 @@ msgid "" "key will be added. If the value contains non-ASCII characters, it can be " "specified as a three tuple in the format ``(CHARSET, LANGUAGE, VALUE)``, " "where ``CHARSET`` is a string naming the charset to be used to encode the " -"value, ``LANGUAGE`` can usually be set to ``None`` or the empty string (see :" -"rfc:`2231` for other possibilities), and ``VALUE`` is the string value " +"value, ``LANGUAGE`` can usually be set to ``None`` or the empty string " +"(see :rfc:`2231` for other possibilities), and ``VALUE`` is the string value " "containing non-ASCII code points. If a three tuple is not passed and the " -"value contains non-ASCII characters, it is automatically encoded in :rfc:" -"`2231` format using a ``CHARSET`` of ``utf-8`` and a ``LANGUAGE`` of " +"value contains non-ASCII characters, it is automatically encoded " +"in :rfc:`2231` format using a ``CHARSET`` of ``utf-8`` and a ``LANGUAGE`` of " "``None``." msgstr "" "キーワード引数辞書 *_params* の各項目ごとに、そのキーがパラメータ名として扱わ" @@ -602,36 +717,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 "" @@ -646,18 +761,18 @@ msgstr "" #: ../../library/email.compat32-message.rst:432 msgid "" "Return the message's content type. The returned string is coerced to lower " -"case of the form :mimetype:`maintype/subtype`. If there was no :mailheader:" -"`Content-Type` header in the message the default type as given by :meth:" -"`get_default_type` will be returned. Since according to :rfc:`2045`, " -"messages always have a default type, :meth:`get_content_type` will always " -"return a value." -msgstr "" -"そのメッセージの content-type を返します。返された文字列は強制的に小文字で :" -"mimetype:`maintype/subtype` の形式に変換されます。メッセージ中に :mailheader:" -"`Content-Type` ヘッダがない場合、デフォルトの content-type は :meth:" -"`get_default_type` が返す値によって与えられます。 :rfc:`2045` によればメッ" -"セージはつねにデフォルトの content-type をもっているので、 :meth:" -"`get_content_type` はつねになんらかの値を返すはずです。" +"case of the form :mimetype:`maintype/subtype`. If there was " +"no :mailheader:`Content-Type` header in the message the default type as " +"given by :meth:`get_default_type` will be returned. Since according " +"to :rfc:`2045`, messages always have a default " +"type, :meth:`get_content_type` will always return a value." +msgstr "" +"そのメッセージの content-type を返します。返された文字列は強制的に小文字" +"で :mimetype:`maintype/subtype` の形式に変換されます。メッセージ中" +"に :mailheader:`Content-Type` ヘッダがない場合、デフォルトの content-type " +"は :meth:`get_default_type` が返す値によって与えられます。 :rfc:`2045` によれ" +"ばメッセージはつねにデフォルトの content-type をもっているの" +"で、 :meth:`get_content_type` はつねになんらかの値を返すはずです。" #: ../../library/email.compat32-message.rst:439 msgid "" @@ -667,13 +782,13 @@ msgid "" "Type` header has an invalid type specification, :rfc:`2045` mandates that " "the default type be :mimetype:`text/plain`." msgstr "" -":rfc:`2045` はメッセージのデフォルト content-type を、それが :mimetype:" -"`multipart/digest` コンテナに現れているとき以外は :mimetype:`text/plain` に規" -"定しています。あるメッセージが :mimetype:`multipart/digest` コンテナ中にある" -"場合、その content-type は :mimetype:`message/rfc822` になります。もし :" -"mailheader:`Content-Type` ヘッダが適切でない content-type 書式だった場合、 :" -"rfc:`2045` はそれのデフォルトを :mimetype:`text/plain` として扱うよう定めてい" -"ます。" +":rfc:`2045` はメッセージのデフォルト content-type を、それ" +"が :mimetype:`multipart/digest` コンテナに現れているとき以外" +"は :mimetype:`text/plain` に規定しています。あるメッセージ" +"が :mimetype:`multipart/digest` コンテナ中にある場合、その content-type " +"は :mimetype:`message/rfc822` になります。もし :mailheader:`Content-Type` " +"ヘッダが適切でない content-type 書式だった場合、 :rfc:`2045` はそれのデフォル" +"トを :mimetype:`text/plain` として扱うよう定めています。" #: ../../library/email.compat32-message.rst:448 msgid "" @@ -695,14 +810,14 @@ msgstr "" #: ../../library/email.compat32-message.rst:460 msgid "" "Return the default content type. Most messages have a default content type " -"of :mimetype:`text/plain`, except for messages that are subparts of :" -"mimetype:`multipart/digest` containers. Such subparts have a default " +"of :mimetype:`text/plain`, except for messages that are subparts " +"of :mimetype:`multipart/digest` containers. Such subparts have a default " "content type of :mimetype:`message/rfc822`." msgstr "" "デフォルトの content-type を返します。ほどんどのメッセージではデフォルトの " -"content-type は :mimetype:`text/plain` ですが、メッセージが :mimetype:" -"`multipart/digest` コンテナに含まれているときだけ例外的に :mimetype:`message/" -"rfc822` になります。" +"content-type は :mimetype:`text/plain` ですが、メッセージ" +"が :mimetype:`multipart/digest` コンテナに含まれているときだけ例外的" +"に :mimetype:`message/rfc822` になります。" #: ../../library/email.compat32-message.rst:468 msgid "" @@ -721,8 +836,9 @@ msgid "" "elements of the returned list are 2-tuples of key/value pairs, as split on " "the ``'='`` sign. The left hand side of the ``'='`` is the key, while the " "right hand side is the value. If there is no ``'='`` sign in the parameter " -"the value is the empty string, otherwise the value is as described in :meth:" -"`get_param` and is unquoted if optional *unquote* is ``True`` (the default)." +"the value is the empty string, otherwise the value is as described " +"in :meth:`get_param` and is unquoted if optional *unquote* is ``True`` (the " +"default)." msgstr "" "メッセージの :mailheader:`Content-Type` パラメータをリストとして返します。返" "されるリストはキー/値の組からなる2要素タプルが連なったものであり、これらは " @@ -734,13 +850,13 @@ msgstr "" #: ../../library/email.compat32-message.rst:484 msgid "" -"Optional *failobj* is the object to return if there is no :mailheader:" -"`Content-Type` header. Optional *header* is the header to search instead " -"of :mailheader:`Content-Type`." +"Optional *failobj* is the object to return if there is " +"no :mailheader:`Content-Type` header. Optional *header* is the header to " +"search instead of :mailheader:`Content-Type`." msgstr "" "オプション引数 *failobj* は、 :mailheader:`Content-Type` ヘッダが存在しなかっ" -"た場合に返すオブジェクトです。オプション引数 *header* には :mailheader:" -"`Content-Type` のかわりに検索すべきヘッダを指定します。" +"た場合に返すオブジェクトです。オプション引数 *header* に" +"は :mailheader:`Content-Type` のかわりに検索すべきヘッダを指定します。" #: ../../library/email.compat32-message.rst:488 #: ../../library/email.compat32-message.rst:526 @@ -750,26 +866,25 @@ 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 "" -"Optional *header* if given, specifies the message header to use instead of :" -"mailheader:`Content-Type`." +"Optional *header* if given, specifies the message header to use instead " +"of :mailheader:`Content-Type`." 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,33 +893,38 @@ 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 "" -"If your application doesn't care whether the parameter was encoded as in :" -"rfc:`2231`, you can collapse the parameter value by calling :func:`email." -"utils.collapse_rfc2231_value`, passing in the return value from :meth:" -"`get_param`. This will return a suitably decoded Unicode string when the " -"value is a tuple, or the original string unquoted if it isn't. For example::" +"If your application doesn't care whether the parameter was encoded as " +"in :rfc:`2231`, you can collapse the parameter value by " +"calling :func:`email.utils.collapse_rfc2231_value`, passing in the return " +"value from :meth:`get_param`. This will return a suitably decoded Unicode " +"string when the value is a tuple, or the original string unquoted if it " +"isn't. For example::" msgstr "" "この関数を使うアプリケーションが、パラメータが :rfc:`2231` 形式でエンコードさ" -"れているかどうかを気にしないのであれば、 :func:`email.utils." -"collapse_rfc2231_value` に :meth:`get_param` の返り値を渡して呼び出すことで、" -"このパラメータをひとつにまとめることができます。この値がタプルならばこの関数" -"は適切にデコードされた Unicode 文字列を返し、そうでない場合は unquote された" -"元の文字列を返します。たとえば::" +"れているかどうかを気にしないのであれ" +"ば、 :func:`email.utils.collapse_rfc2231_value` に :meth:`get_param` の返り値" +"を渡して呼び出すことで、このパラメータをひとつにまとめることができます。この" +"値がタプルならばこの関数は適切にデコードされた 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 "" @@ -825,20 +945,20 @@ msgid "" "value will be appended as per :rfc:`2045`." msgstr "" ":mailheader:`Content-Type` ヘッダ中のパラメータを設定します。指定されたパラ" -"メータがヘッダ中にすでに存在する場合、その値は *value* に置き換えられます。 :" -"mailheader:`Content-Type` ヘッダがまだこのメッセージ中に存在していない場" -"合、 :rfc:`2045` にしたがいこの値には :mimetype:`text/plain` が設定され、新し" -"いパラメータ値が末尾に追加されます。" +"メータがヘッダ中にすでに存在する場合、その値は *value* に置き換えられま" +"す。 :mailheader:`Content-Type` ヘッダがまだこのメッセージ中に存在していない" +"場合、 :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 +972,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." @@ -868,14 +990,14 @@ msgid "" "Remove the given parameter completely from the :mailheader:`Content-Type` " "header. The header will be re-written in place without the parameter or its " "value. All values will be quoted as necessary unless *requote* is ``False`` " -"(the default is ``True``). Optional *header* specifies an alternative to :" -"mailheader:`Content-Type`." +"(the default is ``True``). Optional *header* specifies an alternative " +"to :mailheader:`Content-Type`." msgstr "" "指定されたパラメータを :mailheader:`Content-Type` ヘッダ中から完全にとりのぞ" "きます。ヘッダはそのパラメータと値がない状態に書き換えられます。 *requote* " "が ``False`` でない限り (デフォルトでは ``True`` です)、すべての値は必要に応" -"じて quote されます。オプション変数 *header* が与えられた場合、 :mailheader:" -"`Content-Type` のかわりにそのヘッダが使用されます。" +"じて quote されます。オプション変数 *header* が与えられた場" +"合、 :mailheader:`Content-Type` のかわりにそのヘッダが使用されます。" #: ../../library/email.compat32-message.rst:568 msgid "" @@ -901,9 +1023,9 @@ msgstr "" #: ../../library/email.compat32-message.rst:577 msgid "" -"An alternative header can be specified in the *header* argument. When the :" -"mailheader:`Content-Type` header is set a :mailheader:`MIME-Version` header " -"is also added." +"An alternative header can be specified in the *header* argument. When " +"the :mailheader:`Content-Type` header is set a :mailheader:`MIME-Version` " +"header is also added." msgstr "" "オプション変数 *header* が与えられた場合、 :mailheader:`Content-Type` のかわ" "りにそのヘッダが使用されます。 :mailheader:`Content-Type` ヘッダが設定される" @@ -939,8 +1061,8 @@ msgid "" msgstr "" "そのメッセージ中の :mailheader:`Content-Type` ヘッダにある、 ``boundary`` パ" "ラメータの値を返します。目的のヘッダが欠けていたり、 ``boundary`` パラメータ" -"がない場合には *failobj* が返されます。返される文字列はつねに :func:`email." -"utils.unquote` によって unquote されます。" +"がない場合には *failobj* が返されます。返される文字列はつね" +"に :func:`email.utils.unquote` によって unquote されます。" #: ../../library/email.compat32-message.rst:607 msgid "" @@ -954,41 +1076,42 @@ 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 " -"via :meth:`add_header`, because :meth:`set_boundary` preserves the order of " -"the :mailheader:`Content-Type` header in the list of headers. However, it " -"does *not* preserve any continuation lines which may have been present in " -"the original :mailheader:`Content-Type` header." +"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 via :meth:`add_header`, because :meth:`set_boundary` preserves the " +"order of the :mailheader:`Content-Type` header in the list of headers. " +"However, it does *not* preserve any continuation lines which may have been " +"present in the original :mailheader:`Content-Type` header." 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 "" -"Note that this method differs from :meth:`get_charset` which returns the :" -"class:`~email.charset.Charset` instance for the default encoding of the " +"Note that this method differs from :meth:`get_charset` which returns " +"the :class:`~email.charset.Charset` instance for the default encoding of the " "message body." msgstr "" "注意: これは :meth:`get_charset` メソッドとは異なります。こちらのほうは文字列" -"のかわりに、そのメッセージボディのデフォルトエンコーディングの :class:" -"`~email.charset.Charset` インスタンスを返します。" +"のかわりに、そのメッセージボディのデフォルトエンコーディング" +"の :class:`~email.charset.Charset` インスタンスを返します。" #: ../../library/email.compat32-message.rst:632 msgid "" @@ -1009,19 +1132,22 @@ msgid "" "no ``charset`` parameter, or is not of the :mimetype:`text` main MIME type, " "then that item in the returned list will be *failobj*." msgstr "" -"リスト中の各要素は文字列であり、これは対応する subpart 中のそれぞれの :" -"mailheader:`Content-Type` ヘッダにある ``charset`` の値です。しかし、その " -"subpart が :mailheader:`Content-Type` をもってないか、 ``charset`` がないか、" -"あるいは MIME maintype が :mimetype:`text` でないいずれかの場合には、リストの" -"要素として *failobj* が返されます。" +"リスト中の各要素は文字列であり、これは対応する subpart 中のそれぞれ" +"の :mailheader:`Content-Type` ヘッダにある ``charset`` の値です。しかし、そ" +"の subpart が :mailheader:`Content-Type` をもってないか、 ``charset`` がない" +"か、あるいは 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`." +"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 +1170,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 +1181,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 +1224,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 "" @@ -1125,20 +1284,21 @@ msgid "" "The *preamble* attribute contains this leading extra-armor text for MIME " "documents. When the :class:`~email.parser.Parser` discovers some text after " "the headers but before the first boundary string, it assigns this text to " -"the message's *preamble* attribute. When the :class:`~email.generator." -"Generator` is writing out the plain text representation of a MIME message, " -"and it finds the message has a *preamble* attribute, it will write this text " -"in the area between the headers and the first boundary. See :mod:`email." -"parser` and :mod:`email.generator` for details." +"the message's *preamble* attribute. When " +"the :class:`~email.generator.Generator` is writing out the plain text " +"representation of a MIME message, and it finds the message has a *preamble* " +"attribute, it will write this text in the area between the headers and the " +"first boundary. See :mod:`email.parser` and :mod:`email.generator` for " +"details." msgstr "" "*preamble* 属性は MIME ドキュメントに加えるこの最初の MIME 範囲外テキストを含" "んでいます。 :class:`~email.parser.Parser` があるテキストをヘッダ以降に発見し" "たが、それはまだ最初の MIME 境界文字列が現れる前だった場合、パーザはそのテキ" -"ストをメッセージの *preamble* 属性に格納します。 :class:`~email.generator." -"Generator` がある MIME メッセージからプレーンテキスト形式を生成するときメッ" -"セージが *preamble* 属性を持つことが発見されれば、これはそのテキストをヘッダ" -"と最初の MIME 境界の間に挿入します。詳細は :mod:`email.parser` および :mod:" -"`email.generator` を参照してください。" +"ストをメッセージの *preamble* 属性に格納しま" +"す。 :class:`~email.generator.Generator` がある MIME メッセージからプレーンテ" +"キスト形式を生成するときメッセージが *preamble* 属性を持つことが発見されれ" +"ば、これはそのテキストをヘッダと最初の MIME 境界の間に挿入します。詳細" +"は :mod:`email.parser` および :mod:`email.generator` を参照してください。" #: ../../library/email.compat32-message.rst:741 msgid "" @@ -1159,8 +1319,9 @@ msgstr "" #: ../../library/email.compat32-message.rst:751 msgid "" -"You do not need to set the epilogue to the empty string in order for the :" -"class:`~email.generator.Generator` to print a newline at the end of the file." +"You do not need to set the epilogue to the empty string in order for " +"the :class:`~email.generator.Generator` to print a newline at the end of the " +"file." msgstr "" ":class:`~email.generator.Generator` でファイル終端に改行を出力するため、 " "epilogue に空文字列を設定する必要はなくなりました。" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index ce024a87a..09f16824d 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``)" @@ -98,19 +111,16 @@ msgstr "型自身 (``typ``)" #: ../../library/email.contentmanager.rst:59 msgid "" -"the type's fully qualified name (``typ.__module__ + '.' + typ." -"__qualname__``)." +"the type's fully qualified name (``typ.__module__ + '.' + " +"typ.__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,37 @@ 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 "" +"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 "" @@ -165,52 +188,63 @@ msgstr "" #: ../../library/email.contentmanager.rst:112 msgid "" -"Return the payload of the part as either a string (for ``text`` parts), an :" -"class:`~email.message.EmailMessage` object (for ``message/rfc822`` parts), " -"or a ``bytes`` object (for all other non-multipart types). Raise a :exc:" -"`KeyError` if called on a ``multipart``. If the part is a ``text`` part and " -"*errors* is specified, use it as the error handler when decoding the payload " -"to unicode. The default error handler is ``replace``." +"Return the payload of the part as either a string (for ``text`` parts), " +"an :class:`~email.message.EmailMessage` object (for ``message/rfc822`` " +"parts), or a ``bytes`` object (for all other non-multipart types). Raise " +"a :exc:`KeyError` if called on a ``multipart``. If the part is a ``text`` " +"part and *errors* is specified, use it as the error handler when decoding " +"the payload 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." +"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 +253,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 +268,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 +288,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." +"``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 +311,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." +"``(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..22483319d 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 @@ -35,8 +35,8 @@ msgstr "**ソースコード:** :source:`Lib/email/encoders.py`" #: ../../library/email.encoders.rst:11 msgid "" "This module is part of the legacy (``Compat32``) email API. In the new API " -"the functionality is provided by the *cte* parameter of the :meth:`~email." -"message.EmailMessage.set_content` method." +"the functionality is provided by the *cte* parameter of " +"the :meth:`~email.message.EmailMessage.set_content` method." msgstr "" "このモジュールは、レガシーな (``Compat32``) email APIの一部です。新しいAPIで" "は、この機能は :meth:`~email.message.EmailMessage.set_content` メソッドの" @@ -49,10 +49,10 @@ msgid "" "sets the content type and CTE header using the *_subtype* and *_charset* " "values passed during the instantiation of that class." msgstr "" -"このモジュールはPython3で非推奨になりました。 :class:`~email.mime.text." -"MIMEText` クラスはクラスのインスタンス化中に渡された *_subtype* と " -"*_charset* の値を使ってcontent typeとCTEヘッダを設定するので、ここで提供され" -"ている関数は明示的に呼び出すべきではありません。" +"このモジュールはPython3で非推奨になりまし" +"た。 :class:`~email.mime.text.MIMEText` クラスはクラスのインスタンス化中に渡" +"された *_subtype* と *_charset* の値を使ってcontent typeとCTEヘッダを設定する" +"ので、ここで提供されている関数は明示的に呼び出すべきではありません。" #: ../../library/email.encoders.rst:20 msgid "" @@ -64,8 +64,8 @@ msgstr "この節の以降のテキストはモジュールの元々のドキュ msgid "" "When creating :class:`~email.message.Message` objects from scratch, you " "often need to encode the payloads for transport through compliant mail " -"servers. This is especially true for :mimetype:`image/\\*` and :mimetype:" -"`text/\\*` type messages containing binary data." +"servers. This is especially true for :mimetype:`image/\\*` " +"and :mimetype:`text/\\*` type messages containing binary data." msgstr "" "何もないところから :class:`~email.message.Message` を作成するときしばしば必要" "になるのが、ペイロードをメールサーバに通すためにエンコードすることです。これ" @@ -74,29 +74,30 @@ msgstr "" #: ../../library/email.encoders.rst:27 msgid "" -"The :mod:`email` package provides some convenient encoders in its :mod:" -"`~email.encoders` module. These encoders are actually used by the :class:" -"`~email.mime.audio.MIMEAudio` and :class:`~email.mime.image.MIMEImage` class " -"constructors to provide default encodings. All encoder functions take " -"exactly one argument, the message object to encode. They usually extract " -"the payload, encode it, and reset the payload to this newly encoded value. " -"They should also set the :mailheader:`Content-Transfer-Encoding` header as " -"appropriate." +"The :mod:`email` package provides some convenient encoders in " +"its :mod:`~email.encoders` module. These encoders are actually used by " +"the :class:`~email.mime.audio.MIMEAudio` " +"and :class:`~email.mime.image.MIMEImage` class constructors to provide " +"default encodings. All encoder functions take exactly one argument, the " +"message object to encode. They usually extract the payload, encode it, and " +"reset the payload to this newly encoded value. They should also set " +"the :mailheader:`Content-Transfer-Encoding` header as appropriate." msgstr "" ":mod:`email` パッケージでは、 :mod:`~email.encoders` モジュールにおいていくか" -"の便宜的なエンコーダをサポートしています。実際にはこれらのエンコーダは :" -"class:`~email.mime.audio.MIMEAudio` および :class:`~email.mime.image." -"MIMEImage` クラスのコンストラクタでデフォルトエンコーダとして使われています。" -"すべてのエンコーディング関数は、エンコードするメッセージオブジェクトひとつだ" -"けを引数にとります。これらはふつうペイロードを取りだし、それをエンコードし" -"て、ペイロードをエンコードされたものにセットしなおします。これらはまた :" -"mailheader:`Content-Transfer-Encoding` ヘッダを適切な値に設定します。" +"の便宜的なエンコーダをサポートしています。実際にはこれらのエンコーダ" +"は :class:`~email.mime.audio.MIMEAudio` およ" +"び :class:`~email.mime.image.MIMEImage` クラスのコンストラクタでデフォルトエ" +"ンコーダとして使われています。すべてのエンコーディング関数は、エンコードする" +"メッセージオブジェクトひとつだけを引数にとります。これらはふつうペイロードを" +"取りだし、それをエンコードして、ペイロードをエンコードされたものにセットしな" +"おします。これらはまた :mailheader:`Content-Transfer-Encoding` ヘッダを適切な" +"値に設定します。" #: ../../library/email.encoders.rst:35 msgid "" "Note that these functions are not meaningful for a multipart message. They " -"must be applied to individual subparts instead, and will raise a :exc:" -"`TypeError` if passed a message whose type is multipart." +"must be applied to individual subparts instead, and will raise " +"a :exc:`TypeError` if passed a message whose type is multipart." msgstr "" "マルチパートメッセージにこれら関数を使うことは全く無意味です。それらは各々の" "サブパートごとに適用されるべきものです。メッセージがマルチパートのものを渡す" @@ -108,10 +109,10 @@ msgstr "提供されているエンコーディング関数は以下のとおり #: ../../library/email.encoders.rst:44 msgid "" -"Encodes the payload into quoted-printable form and sets the :mailheader:" -"`Content-Transfer-Encoding` header to ``quoted-printable`` [#]_. This is a " -"good encoding to use when most of your payload is normal printable data, but " -"contains a few unprintable characters." +"Encodes the payload into quoted-printable form and sets " +"the :mailheader:`Content-Transfer-Encoding` header to ``quoted-printable`` " +"[#]_. This is a good encoding to use when most of your payload is normal " +"printable data, but contains a few unprintable characters." msgstr "" "ペイロードを quoted-printable 形式にエンコードし、 :mailheader:`Content-" "Transfer-Encoding` ヘッダを ``quoted-printable`` [#]_ に設定します。これはそ" @@ -134,13 +135,13 @@ msgstr "" #: ../../library/email.encoders.rst:61 msgid "" -"This doesn't actually modify the message's payload, but it does set the :" -"mailheader:`Content-Transfer-Encoding` header to either ``7bit`` or ``8bit`` " -"as appropriate, based on the payload data." +"This doesn't actually modify the message's payload, but it does set " +"the :mailheader:`Content-Transfer-Encoding` header to either ``7bit`` or " +"``8bit`` as appropriate, based on the payload data." msgstr "" -"これは実際にはペイロードを変更はしませんが、ペイロードの形式に応じて :" -"mailheader:`Content-Transfer-Encoding` ヘッダを ``7bit`` あるいは ``8bit`` に" -"適した形に設定します。" +"これは実際にはペイロードを変更はしませんが、ペイロードの形式に応じ" +"て :mailheader:`Content-Transfer-Encoding` ヘッダを ``7bit`` あるいは " +"``8bit`` に適した形に設定します。" #: ../../library/email.encoders.rst:68 msgid "" diff --git a/library/email.errors.po b/library/email.errors.po index 7d7ea066d..4010fae89 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,54 +47,72 @@ 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`." +"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:" -"`~email.message.EmailMessage.set_boundary` method will raise this error if " -"the content type is unknown when the method is called. :class:`~email.header." -"Header` may raise this error for certain base64 decoding errors, and when an " -"attempt is made to create a header that appears to contain an embedded " -"header (that is, there is what is supposed to be a continuation line that " -"has no leading whitespace and looks like a header)." -msgstr "" +"message, this class is derived from :exc:`MessageParseError`. " +"The :meth:`~email.message.EmailMessage.set_boundary` method will raise this " +"error if the content type is unknown when the method is " +"called. :class:`~email.header.Header` may raise this error for certain " +"base64 decoding errors, and when an attempt is made to create a header that " +"appears to contain an embedded 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." -"MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). :exc:" -"`MultipartConversionError` multiply inherits from :exc:`MessageError` and " -"the built-in :exc:`TypeError`." +"instance of a class derived " +"from :class:`~email.mime.nonmultipart.MIMENonMultipart` " +"(e.g. :class:`~email.mime.image.MIMEImage`). :exc:`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 +135,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`." +"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..a14dff921 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" @@ -449,8 +690,8 @@ msgid "" " 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" +" 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" @@ -466,8 +707,8 @@ msgid "" " # again strip the <> to go from email form of cid to html form.\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" +" 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" @@ -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..7433266fa 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -17,48 +17,63 @@ 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 " -"to do this if you want to send your message via :meth:`smtplib.SMTP." -"sendmail`, or print the message on the console. Taking a message object " -"structure and producing a serialized representation is the job of the " -"generator classes." +"to do this if you want to send your message " +"via :meth:`smtplib.SMTP.sendmail`, or print the message on the console. " +"Taking a message object 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 " "yourself. However the bundled generator knows how to generate most email in " "a standards-compliant way, should handle MIME and non-MIME email messages " "just fine, and is designed so that the bytes-oriented parsing and generation " -"operations are inverses, assuming the same non-transforming :mod:`~email." -"policy` is used for both. That is, parsing the serialized byte stream via " -"the :class:`~email.parser.BytesParser` class and then regenerating the " -"serialized byte stream using :class:`BytesGenerator` should produce output " -"identical to the input [#]_. (On the other hand, using the generator on an :" -"class:`~email.message.EmailMessage` constructed by program may result in " -"changes to the :class:`~email.message.EmailMessage` object as defaults are " -"filled in.)" -msgstr "" +"operations are inverses, assuming the same non-" +"transforming :mod:`~email.policy` is used for both. That is, parsing the " +"serialized byte stream via the :class:`~email.parser.BytesParser` class and " +"then regenerating the serialized byte stream using :class:`BytesGenerator` " +"should produce output identical to the input [#]_. (On the other hand, " +"using the generator on an :class:`~email.message.EmailMessage` constructed " +"by program may result in 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,34 +82,57 @@ 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." +"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 " "is ``From`` followed by a space at the beginning of a line. *mangle_from_* " "defaults to the value of the :attr:`~email.policy.Policy.mangle_from_` " -"setting of the *policy* (which is ``True`` for the :data:`~email.policy." -"compat32` policy and ``False`` for all others). *mangle_from_* is intended " -"for use when messages are stored in Unix mbox format (see :mod:`mailbox` and " -"`WHY THE CONTENT-LENGTH FORMAT IS BAD `_)." -msgstr "" +"setting of the *policy* (which is ``True`` for " +"the :data:`~email.policy.compat32` policy and ``False`` for all others). " +"*mangle_from_* is intended for use when messages are stored in Unix mbox " +"format (see :mod:`mailbox` and `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,24 +142,30 @@ 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 :" -"class:`~email.message.Message` or :class:`~email.message.EmailMessage` " -"object passed to ``flatten`` to control the message generation. See :mod:" -"`email.policy` for details on what *policy* controls." -msgstr "" +"*policy* is ``None`` (the default), use the policy associated with " +"the :class:`~email.message.Message` or :class:`~email.message.EmailMessage` " +"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,23 +177,35 @@ 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 " "have not been modified to the output with any bytes with the high bit set " -"reproduced as in the original, and preserve the non-ASCII :mailheader:" -"`Content-Transfer-Encoding` of any body parts that have them. If " -"``cte_type`` is ``7bit``, convert the bytes with the high bit set as needed " -"using an ASCII-compatible :mailheader:`Content-Transfer-Encoding`. That is, " -"transform parts with non-ASCII :mailheader:`Content-Transfer-Encoding` (:" -"mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII compatible :" -"mailheader:`Content-Transfer-Encoding`, and encode RFC-invalid non-ASCII " -"bytes in headers using the MIME ``unknown-8bit`` character set, thus " -"rendering them RFC-compliant." -msgstr "" +"reproduced as in the original, and preserve the non-" +"ASCII :mailheader:`Content-Transfer-Encoding` of any body parts that have " +"them. If ``cte_type`` is ``7bit``, convert the bytes with the high bit set " +"as needed using an ASCII-compatible :mailheader:`Content-Transfer-Encoding`. " +"That is, transform parts with non-ASCII :mailheader:`Content-Transfer-" +"Encoding` (:mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII " +"compatible :mailheader:`Content-Transfer-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`` (デ" +"フォルト) の場合、解析した元のメッセージのうち変更されていないヘッダーを出力" +"へコピーします。\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,54 +213,75 @@ 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." +"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. :" -"meth:`~email.message.EmailMessage.__bytes__`), which simplify the generation " -"of a serialized binary representation of a message object. For more detail, " -"see :mod:`email.message`." +"As a convenience, :class:`~email.message.EmailMessage` provides the " +"methods :meth:`~email.message.EmailMessage.as_bytes` and ``bytes(aMessage)`` " +"(a.k.a. :meth:`~email.message.EmailMessage.__bytes__`), which simplify the " +"generation 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 "" "Because strings cannot represent binary data, the :class:`Generator` class " "must convert any binary data in any message it flattens to an ASCII " -"compatible format, by converting them to an ASCII compatible :mailheader:" -"`Content-Transfer_Encoding`. Using the terminology of the email RFCs, you " -"can think of this as :class:`Generator` serializing to an I/O stream that is " -"not \"8 bit clean\". In other words, most applications will want to be " -"using :class:`BytesGenerator`, and not :class:`Generator`." +"compatible format, by converting them to an ASCII " +"compatible :mailheader:`Content-Transfer_Encoding`. Using the terminology " +"of the email RFCs, you can think of this as :class:`Generator` serializing " +"to an I/O stream that is not \"8 bit clean\". In other words, most " +"applications will want to be 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,18 +293,28 @@ 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 " "is required because strings cannot represent non-ASCII bytes.) Convert any " -"bytes with the high bit set as needed using an ASCII-compatible :mailheader:" -"`Content-Transfer-Encoding`. That is, transform parts with non-ASCII :" -"mailheader:`Content-Transfer-Encoding` (:mailheader:`Content-Transfer-" -"Encoding: 8bit`) to an ASCII compatible :mailheader:`Content-Transfer-" -"Encoding`, and encode RFC-invalid non-ASCII bytes in headers using the MIME " -"``unknown-8bit`` character set, thus rendering them RFC-compliant." -msgstr "" +"bytes with the high bit set as needed using an ASCII-" +"compatible :mailheader:`Content-Transfer-Encoding`. That is, transform " +"parts with non-ASCII :mailheader:`Content-Transfer-Encoding` " +"(:mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII " +"compatible :mailheader:`Content-Transfer-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,52 +324,66 @@ 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." +"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. :" -"meth:`~email.message.EmailMessage.__str__`), which simplify the generation " -"of a formatted string representation of a message object. For more detail, " -"see :mod:`email.message`." +"As a convenience, :class:`~email.message.EmailMessage` provides the " +"methods :meth:`~email.message.EmailMessage.as_string` and ``str(aMessage)`` " +"(a.k.a. :meth:`~email.message.EmailMessage.__str__`), which simplify the " +"generation 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 "" -"The :mod:`email.generator` module also provides a derived class, :class:" -"`DecodedGenerator`, which is like the :class:`Generator` base class, except " -"that non-\\ :mimetype:`text` parts are not serialized, but are instead " -"represented in the output stream by a string derived from a template filled " -"in with information about the part." +"The :mod:`email.generator` module also provides a derived " +"class, :class:`DecodedGenerator`, which is like the :class:`Generator` base " +"class, except that non-\\ :mimetype:`text` parts are not serialized, but are " +"instead represented in the output stream by a string derived from a template " +"filled 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 :" -"mimetype:`text`, print the decoded payload of the subpart, and if the main " -"type is not :mimetype:`text`, instead of printing it fill in the string " +"passed to :meth:`Generator.flatten`, if the subpart is of main " +"type :mimetype:`text`, print the decoded payload of the subpart, and if the " +"main type is not :mimetype:`text`, instead of printing it fill in the string " "*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,33 +415,38 @@ 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 "" -"Optional *_mangle_from_* and *maxheaderlen* are as with the :class:" -"`Generator` base class." +"Optional *_mangle_from_* and *maxheaderlen* are as with " +"the :class:`Generator` base class." msgstr "" #: ../../library/email.generator.rst:275 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 " -"automatic adjustments (for example, :attr:`~email.policy.EmailPolicy." -"refold_source` must be ``none``, which is *not* the default). It is also " -"not 100% true, since if the message does not conform to the RFC standards " -"occasionally information about the exact original text is lost during " -"parsing error recovery. It is a goal to fix these latter edge cases when " -"possible." -msgstr "" +"automatic adjustments (for " +"example, :attr:`~email.policy.EmailPolicy.refold_source` must be ``none``, " +"which is *not* the default). It is also not 100% true, since if the message " +"does not conform to the RFC standards occasionally information about the " +"exact original text is lost during 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..5ba1f7a5d 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 @@ -72,27 +72,28 @@ msgid "" "used in email messages. The base standard still requires email messages to " "be transferred using only 7-bit ASCII characters, so a slew of RFCs have " "been written describing how to encode email containing non-ASCII characters " -"into :rfc:`2822`\\ -compliant format. These RFCs include :rfc:`2045`, :rfc:" -"`2046`, :rfc:`2047`, and :rfc:`2231`. The :mod:`email` package supports " -"these standards in its :mod:`email.header` and :mod:`email.charset` modules." +"into :rfc:`2822`\\ -compliant format. These RFCs " +"include :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, and :rfc:`2231`. " +"The :mod:`email` package supports these standards in its :mod:`email.header` " +"and :mod:`email.charset` modules." msgstr "" "もちろん、電子メールが世界的に普及するにつれ、この仕様は国際化されてきまし" "た。今では電子メールに言語依存の文字集合を使うことができます。基本規格では、" "まだ電子メールメッセージを 7-bit ASCII 文字のみを使って転送するよう要求してい" "ますので、多くの RFC でどうやって非ASCII の電子メールを :rfc:`2822` 準拠な形" "式にエンコードするかが記述されています。これらの RFC は以下のものを含みま" -"す: :rfc:`2045` 、 :rfc:`2046` 、 :rfc:`2047` 、および :rfc:`2231` 。 :mod:" -"`email` パッケージは、 :mod:`email.header` および :mod:`email.charset` モ" -"ジュールでこれらの規格をサポートしています。" +"す: :rfc:`2045` 、 :rfc:`2046` 、 :rfc:`2047` 、およ" +"び :rfc:`2231` 。 :mod:`email` パッケージは、 :mod:`email.header` およ" +"び :mod:`email.charset` モジュールでこれらの規格をサポートしています。" #: ../../library/email.header.rst:33 msgid "" "If you want to include non-ASCII characters in your email headers, say in " -"the :mailheader:`Subject` or :mailheader:`To` fields, you should use the :" -"class:`Header` class and assign the field in the :class:`~email.message." -"Message` object to an instance of :class:`Header` instead of using a string " -"for the header value. Import the :class:`Header` class from the :mod:`email." -"header` module. For example::" +"the :mailheader:`Subject` or :mailheader:`To` fields, you should use " +"the :class:`Header` class and assign the field in " +"the :class:`~email.message.Message` object to an instance of :class:`Header` " +"instead of using a string for the header value. Import the :class:`Header` " +"class from the :mod:`email.header` module. For example::" msgstr "" "ご自分の電子メールヘッダ、たとえば :mailheader:`Subject` や :mailheader:`To` " "などのフィールドに非ASCII文字を入れたい場合、 :class:`Header` クラスを使う必" @@ -100,7 +101,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,22 +110,30 @@ 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 "" "Notice here how we wanted the :mailheader:`Subject` field to contain a non-" "ASCII character? We did this by creating a :class:`Header` instance and " "passing in the character set that the byte string was encoded in. When the " -"subsequent :class:`~email.message.Message` instance was flattened, the :" -"mailheader:`Subject` field was properly :rfc:`2047` encoded. MIME-aware " -"mail readers would show this header using the embedded ISO-8859-1 character." +"subsequent :class:`~email.message.Message` instance was flattened, " +"the :mailheader:`Subject` field was properly :rfc:`2047` encoded. MIME-" +"aware mail readers would show this header using the embedded ISO-8859-1 " +"character." msgstr "" ":mailheader:`Subject` フィールドに非ASCII文字を含めていることに注目してくださ" -"い。ここでは、含めたいバイト列がエンコードされている文字集合を指定して :" -"class:`Header` インスタンスを作成することによって実現しています。のちにこの :" -"class:`~email.message.Message` インスタンスからフラットなテキストを生成する際" -"に、この :mailheader:`Subject` フィールドは :rfc:`2047` 準拠の適切な形式にエ" -"ンコードされます。MIME 機能のあるメーラなら、このヘッダに埋めこまれた " +"い。ここでは、含めたいバイト列がエンコードされている文字集合を指定し" +"て :class:`Header` インスタンスを作成することによって実現しています。のちにこ" +"の :class:`~email.message.Message` インスタンスからフラットなテキストを生成す" +"る際に、この :mailheader:`Subject` フィールドは :rfc:`2047` 準拠の適切な形式" +"にエンコードされます。MIME 機能のあるメーラなら、このヘッダに埋めこまれた " "ISO-8859-1 文字を正しく表示するでしょう。" #: ../../library/email.header.rst:57 @@ -141,15 +149,15 @@ msgstr "別の文字集合の文字列を含む MIME 準拠なヘッダを作成 #: ../../library/email.header.rst:65 msgid "" "Optional *s* is the initial header value. If ``None`` (the default), the " -"initial header value is not set. You can later append to the header with :" -"meth:`append` method calls. *s* may be an instance of :class:`bytes` or :" -"class:`str`, but see the :meth:`append` documentation for semantics." +"initial header value is not set. You can later append to the header " +"with :meth:`append` method calls. *s* may be an instance of :class:`bytes` " +"or :class:`str`, but see the :meth:`append` documentation for semantics." msgstr "" "オプション引数 *s* はヘッダの値の初期値です。これが ``None`` の場合 (デフォル" "ト)、ヘッダの初期値は設定されません。この値はあとから :meth:`append` メソッド" -"を呼びだすことによって追加することができます。 *s* は :class:`bytes` または :" -"class:`str` のインスタンスにできます。このセマンティクスについては :meth:" -"`append` の項を参照してください。" +"を呼びだすことによって追加することができます。 *s* は :class:`bytes` また" +"は :class:`str` のインスタンスにできます。このセマンティクスについて" +"は :meth:`append` の項を参照してください。" #: ../../library/email.header.rst:70 msgid "" @@ -167,7 +175,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 +183,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 "" @@ -213,11 +220,12 @@ msgid "" "``None`` (the default) means that the *charset* given in the constructor is " "used." msgstr "" -"オプション引数 *charset* がもし与えられた場合、これは :class:`~email.charset." -"Charset` インスタンス (:mod:`email.charset` を参照) か、あるいは文字集合の名" -"前でなければなりません。この場合は :class:`~email.charset.Charset` インスタン" -"スに変換されます。この値が ``None`` の場合 (デフォルト)、コンストラクタで与え" -"られた *charset* が使われます。" +"オプション引数 *charset* がもし与えられた場合、これ" +"は :class:`~email.charset.Charset` インスタンス (:mod:`email.charset` を参" +"照) か、あるいは文字集合の名前でなければなりません。この場合" +"は :class:`~email.charset.Charset` インスタンスに変換されます。この値が " +"``None`` の場合 (デフォルト)、コンストラクタで与えられた *charset* が使われま" +"す。" #: ../../library/email.header.rst:102 msgid "" @@ -226,9 +234,10 @@ msgid "" "string, and a :exc:`UnicodeError` will be raised if the string cannot be " "decoded with that character set." msgstr "" -"*s* は :class:`bytes` または :class:`str` のインスタンスです。 :class:" -"`bytes` のインスタンスの場合、 *charset* はその文字列のエンコーディングであ" -"り、この文字セットでデコードできないときは :exc:`UnicodeError` が発生します。" +"*s* は :class:`bytes` または :class:`str` のインスタンスで" +"す。 :class:`bytes` のインスタンスの場合、 *charset* はその文字列のエンコー" +"ディングであり、この文字セットでデコードできないときは :exc:`UnicodeError` が" +"発生します。" #: ../../library/email.header.rst:107 msgid "" @@ -240,15 +249,15 @@ msgstr "" #: ../../library/email.header.rst:110 msgid "" -"In either case, when producing an :rfc:`2822`\\ -compliant header using :rfc:" -"`2047` rules, the string will be encoded using the output codec of the " -"charset. If the string cannot be encoded using the output codec, a " +"In either case, when producing an :rfc:`2822`\\ -compliant header " +"using :rfc:`2047` rules, the string will be encoded using the output codec " +"of the charset. If the string cannot be encoded using the output codec, a " "UnicodeError will be raised." msgstr "" "いずれの場合でも、 :rfc:`2822` 準拠のヘッダを :rfc:`2047` の規則を用いて生成" "する際、文字列は指定された文字セットの出力コーデックを用いてエンコードされま" -"す。出力コーデックを用いて文字列がエンコードできないときは :exc:" -"`UnicodeError` が発生します。" +"す。出力コーデックを用いて文字列がエンコードできないときは ``UnicodeError`` " +"が発生します。" #: ../../library/email.header.rst:115 msgid "" @@ -268,7 +277,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 +288,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 +306,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 +314,7 @@ msgid "" msgstr "" "*linesep* は、折り返しヘッダの行を区切る文字を指定します。デフォルトでは" "Pythonアプリケーションコードに最も有用な値(``\\n``)になりますが、RFC準拠の行" -"区切り文字でヘッダを生成するために``\\r\\n``を指定することができます。" +"区切り文字でヘッダを生成するために ``\\r\\n`` を指定することができます。" #: ../../library/email.header.rst:143 msgid "Added the *linesep* argument." @@ -393,11 +402,11 @@ msgstr "" #: ../../library/email.header.rst:195 msgid "" -"Create a :class:`Header` instance from a sequence of pairs as returned by :" -"func:`decode_header`." +"Create a :class:`Header` instance from a sequence of pairs as returned " +"by :func:`decode_header`." msgstr "" -":func:`decode_header` によって返される 2要素タプルのリストから :class:" -"`Header` インスタンスを作成します。" +":func:`decode_header` によって返される 2要素タプルのリストか" +"ら :class:`Header` インスタンスを作成します。" #: ../../library/email.header.rst:198 msgid "" @@ -409,12 +418,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 " +"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..8b2510345 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`" @@ -40,36 +39,38 @@ msgstr "[1]_" #: ../../library/email.headerregistry.rst:16 msgid "" "Headers are represented by customized subclasses of :class:`str`. The " -"particular class used to represent a given header is determined by the :attr:" -"`~email.policy.EmailPolicy.header_factory` of the :mod:`~email.policy` in " -"effect when the headers are created. This section documents the particular " -"``header_factory`` implemented by the email package for handling :RFC:`5322` " -"compliant email messages, which not only provides customized header objects " -"for various header types, but also provides an extension mechanism for " -"applications to add their own custom header types." +"particular class used to represent a given header is determined by " +"the :attr:`~email.policy.EmailPolicy.header_factory` of " +"the :mod:`~email.policy` in effect when the headers are created. This " +"section documents the particular ``header_factory`` implemented by the email " +"package for handling :RFC:`5322` compliant email messages, which not only " +"provides customized header objects for various header types, but also " +"provides an extension mechanism for applications to add their own custom " +"header types." msgstr "" "ヘッダーは :class:`str` のカスタマイズされたサブクラスで表現されます。 与えら" "れたヘッダーを表現するために使用される特定のクラスは、ヘッダーが作成されると" -"きに有効な :mod:`~email.policy` の :attr:`~email.policy.EmailPolicy." -"header_factory` で決定されます。 このセクションでは、email ライブラリが :RFC:" -"`5322` に準拠したメールメッセージを扱うために実装している、特定の " -"``header_factory`` について説明します。このヘッダーは、様々なヘッダータイプに" -"対してカスタマイズされたヘッダーオブジェクトを提供するだけでなく、アプリケー" -"ションが独自のカスタムヘッダータイプを追加できるような拡張メカニズムも備えて" -"います。" +"きに有効な :mod:`~email.policy` " +"の :attr:`~email.policy.EmailPolicy.header_factory` で決定されます。 このセク" +"ションでは、email ライブラリが :RFC:`5322` に準拠したメールメッセージを扱うた" +"めに実装している、特定の ``header_factory`` について説明します。このヘッダー" +"は、様々なヘッダータイプに対してカスタマイズされたヘッダーオブジェクトを提供" +"するだけでなく、アプリケーションが独自のカスタムヘッダータイプを追加できるよ" +"うな拡張メカニズムも備えています。" #: ../../library/email.headerregistry.rst:25 msgid "" -"When using any of the policy objects derived from :data:`~email.policy." -"EmailPolicy`, all headers are produced by :class:`.HeaderRegistry` and have :" -"class:`.BaseHeader` as their last base class. Each header class has an " -"additional base class that is determined by the type of the header. For " -"example, many headers have the class :class:`.UnstructuredHeader` as their " -"other base class. The specialized second class for a header is determined " -"by the name of the header, using a lookup table stored in the :class:`." -"HeaderRegistry`. All of this is managed transparently for the typical " -"application program, but interfaces are provided for modifying the default " -"behavior for use by more complex applications." +"When using any of the policy objects derived " +"from :data:`~email.policy.EmailPolicy`, all headers are produced " +"by :class:`.HeaderRegistry` and have :class:`.BaseHeader` as their last base " +"class. Each header class has an additional base class that is determined by " +"the type of the header. For example, many headers have the " +"class :class:`.UnstructuredHeader` as their other base class. The " +"specialized second class for a header is determined by the name of the " +"header, using a lookup table stored in the :class:`.HeaderRegistry`. All of " +"this is managed transparently for the typical application program, but " +"interfaces are provided for modifying the default behavior for use by more " +"complex applications." msgstr "" ":data:`~email.policy.EmailPolicy` から派生したポリシーオブジェクトのいずれか" "を使用する場合、すべてのヘッダーは :class:`.HeaderRegistry` によって生成さ" @@ -85,19 +86,20 @@ msgstr "" #: ../../library/email.headerregistry.rst:36 msgid "" "The sections below first document the header base classes and their " -"attributes, followed by the API for modifying the behavior of :class:`." -"HeaderRegistry`, and finally the support classes used to represent the data " -"parsed from structured headers." +"attributes, followed by the API for modifying the behavior " +"of :class:`.HeaderRegistry`, and finally the support classes used to " +"represent the data parsed from structured headers." msgstr "" -"以下のセクションでは、まずヘッダーの基本クラスとその属性を説明し、次に :" -"class:`.HeaderRegistry` の動作を変更するための API、そして最後に構造化ヘッ" -"ダーからパースされたデータを表現するためのサポートクラスについて説明します。" +"以下のセクションでは、まずヘッダーの基本クラスとその属性を説明し、次" +"に :class:`.HeaderRegistry` の動作を変更するための API、そして最後に構造化" +"ヘッダーからパースされたデータを表現するためのサポートクラスについて説明しま" +"す。" #: ../../library/email.headerregistry.rst:44 msgid "" -"*name* and *value* are passed to ``BaseHeader`` from the :attr:`~email." -"policy.EmailPolicy.header_factory` call. The string value of any header " -"object is the *value* fully decoded to unicode." +"*name* and *value* are passed to ``BaseHeader`` from " +"the :attr:`~email.policy.EmailPolicy.header_factory` call. The string value " +"of any header object is the *value* fully decoded to unicode." msgstr "" "*name* と *value* は :attr:`~email.policy.EmailPolicy.header_factory` 呼び出" "しから ``BaseHeader`` に渡されます。 どのヘッダーオブジェクトの文字列値も、完" @@ -110,12 +112,13 @@ msgstr "基底クラスは以下の読み出し専用属性を定義していま #: ../../library/email.headerregistry.rst:53 msgid "" "The name of the header (the portion of the field before the ':'). This is " -"exactly the value passed in the :attr:`~email.policy.EmailPolicy." -"header_factory` call for *name*; that is, case is preserved." +"exactly the value passed in " +"the :attr:`~email.policy.EmailPolicy.header_factory` call for *name*; that " +"is, case is preserved." msgstr "" -"ヘッダーの名前(フィールドの':'の前の部分)。これは :attr:`~email.policy." -"EmailPolicy.header_factory` の *name* の呼び出しで渡された値と全く同じです; " -"つまり、大文字・小文字が保持されます。" +"ヘッダーの名前(フィールドの':'の前の部分)。これ" +"は :attr:`~email.policy.EmailPolicy.header_factory` の *name* の呼び出しで渡" +"された値と全く同じです; つまり、大文字・小文字が保持されます。" #: ../../library/email.headerregistry.rst:61 msgid "" @@ -124,10 +127,11 @@ msgid "" "complete about detecting compliance issues. See the :mod:`~email.errors` " "module for a discussion of the types of defects that may be reported." msgstr "" -"パース中に見つかったRFCのコンプライアンス問題を報告する :exc:`~email.errors." -"HeaderDefect` インスタンスのタプルです。 email パッケージはコンプライアンスに" -"関する問題を完全に検出するように努めています。 報告されるかもしれない欠陥の種" -"類の議論については、 :mod:`~email.errors` モジュールを参照してください。" +"パース中に見つかったRFCのコンプライアンス問題を報告す" +"る :exc:`~email.errors.HeaderDefect` インスタンスのタプルです。 email パッ" +"ケージはコンプライアンスに関する問題を完全に検出するように努めています。 報告" +"されるかもしれない欠陥の種類の議論については、 :mod:`~email.errors` モジュー" +"ルを参照してください。" #: ../../library/email.headerregistry.rst:69 msgid "" @@ -154,18 +158,18 @@ msgstr "" #: ../../library/email.headerregistry.rst:80 msgid "" "Return a string containing :attr:`~email.policy.Policy.linesep` characters " -"as required to correctly fold the header according to *policy*. A :attr:" -"`~email.policy.Policy.cte_type` of ``8bit`` will be treated as if it were " -"``7bit``, since headers may not contain arbitrary binary data. If :attr:" -"`~email.policy.EmailPolicy.utf8` is ``False``, non-ASCII data will be :rfc:" -"`2047` encoded." -msgstr "" -"ヘッダを *policy* に従って正しく折りたたむために必要な :attr:`~email.policy." -"Policy.linesep` 文字を含む文字列を返します。 ヘッダには任意のバイナリデータを" -"含めることができないため、 :attr:`~email.policy.Policy.cte_type` が ``8bit`` " -"の場合は ``7bit`` と同じように扱われます。 もし :attr:`~email.policy." -"EmailPolicy.utf8` が ``False`` であれば、非ASCIIデータは :rfc:`2047` でエン" -"コードされます。" +"as required to correctly fold the header according to *policy*. " +"A :attr:`~email.policy.Policy.cte_type` of ``8bit`` will be treated as if it " +"were ``7bit``, since headers may not contain arbitrary binary data. " +"If :attr:`~email.policy.EmailPolicy.utf8` is ``False``, non-ASCII data will " +"be :rfc:`2047` encoded." +msgstr "" +"ヘッダを *policy* に従って正しく折りたたむために必要" +"な :attr:`~email.policy.Policy.linesep` 文字を含む文字列を返します。 ヘッダに" +"は任意のバイナリデータを含めることができないた" +"め、 :attr:`~email.policy.Policy.cte_type` が ``8bit`` の場合は ``7bit`` と同" +"じように扱われます。 もし :attr:`~email.policy.EmailPolicy.utf8` が " +"``False`` であれば、非ASCIIデータは :rfc:`2047` でエンコードされます。" #: ../../library/email.headerregistry.rst:88 msgid "" @@ -181,9 +185,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 +209,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 +216,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,46 +276,52 @@ 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 " "representing that date. If the timezone of the input date is specified as " "``-0000`` (indicating it is in UTC but contains no information about the " -"source timezone), then :attr:`.datetime` will be a naive :class:`~datetime." -"datetime`. If a specific timezone offset is found (including ``+0000``), " -"then :attr:`.datetime` will contain an aware ``datetime`` that uses :class:" -"`datetime.timezone` to record the timezone offset." -msgstr "" +"source timezone), then :attr:`.datetime` will be a " +"naive :class:`~datetime.datetime`. If a specific timezone offset is found " +"(including ``+0000``), 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 +333,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::" +"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 "" @@ -367,9 +374,9 @@ msgid "" "is ``None``." msgstr "" "ヘッダー値に含まれるアドレスとグループをエンコードした :class:`.Group` オブ" -"ジェクトのタプルです。 グループに属さないアドレスは、このリストでは :attr:`~." -"Group.display_name` が ``None`` であるシングルアドレスの ``Groups`` として表" -"現されます。" +"ジェクトのタプルです。 グループに属さないアドレスは、このリストで" +"は :attr:`~.Group.display_name` が ``None`` であるシングルアドレスの " +"``Groups`` として表現されます。" #: ../../library/email.headerregistry.rst:201 msgid "" @@ -393,7 +400,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 +407,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 +446,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,41 +464,41 @@ 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 "" -"A :class:`ParameterizedMIMEHeader` class that handles the :mailheader:" -"`Content-Type` header." +"A :class:`ParameterizedMIMEHeader` class that handles " +"the :mailheader:`Content-Type` header." 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 "" -"A :class:`ParameterizedMIMEHeader` class that handles the :mailheader:" -"`Content-Disposition` header." +"A :class:`ParameterizedMIMEHeader` class that handles " +"the :mailheader:`Content-Disposition` header." msgstr "" -":mailheader:`Content-Disposition` ヘッダを扱う :class:" -"`ParameterizedMIMEHeader` クラスです。" +":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 +512,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 +523,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 +575,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 +613,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 +631,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 +686,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 +708,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 "" +"where each part must conform to specific syntax rules spelled out " +"in :rfc:`5322`." +msgstr "各部分は :rfc:`5322` で定められた構文規則に従う必要があります。" #: ../../library/email.headerregistry.rst:389 msgid "" @@ -713,12 +733,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 +749,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 " +"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 +783,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 +820,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..7e6289c72 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 @@ -33,10 +33,10 @@ msgstr "**ソースコード:** :source:`Lib/email/iterators.py`" #: ../../library/email.iterators.rst:11 msgid "" -"Iterating over a message object tree is fairly easy with the :meth:`Message." -"walk ` method. The :mod:`email.iterators` " -"module provides some useful higher level iterations over message object " -"trees." +"Iterating over a message object tree is fairly easy with " +"the :meth:`Message.walk ` method. " +"The :mod:`email.iterators` module provides some useful higher level " +"iterations over message object trees." msgstr "" ":meth:`Message.walk ` メソッドを使うと、簡単に" "メッセージオブジェクトツリー内を次から次へとたどる (iteration) ことができま" @@ -61,11 +61,11 @@ msgstr "" #: ../../library/email.iterators.rst:26 msgid "" -"Optional *decode* is passed through to :meth:`Message.get_payload `." +"Optional *decode* is passed through to :meth:`Message.get_payload " +"`." msgstr "" -"オプション引数 *decode* は、 :meth:`Message.get_payload ` にそのまま渡されます。" +"オプション引数 *decode* は、 :meth:`Message.get_payload " +"` にそのまま渡されます。" #: ../../library/email.iterators.rst:32 msgid "" @@ -90,8 +90,8 @@ msgid "" "Thus, by default :func:`typed_subpart_iterator` returns each subpart that " "has a MIME type of :mimetype:`text/\\*`." msgstr "" -"つまり、デフォルトでは :func:`typed_subpart_iterator` は MIME 形式 :mimetype:" -"`text/\\*` をもつサブパートを順に返していくというわけです。" +"つまり、デフォルトでは :func:`typed_subpart_iterator` は MIME 形" +"式 :mimetype:`text/\\*` をもつサブパートを順に返していくというわけです。" #: ../../library/email.iterators.rst:43 msgid "" @@ -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..7e588d468 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,15 @@ 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,38 +93,59 @@ 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 "" "If *policy* is specified use the rules it specifies to update and serialize " -"the representation of the message. If *policy* is not set, use the :class:" -"`~email.policy.default` policy, which follows the rules of the email RFCs " -"except for line endings (instead of the RFC mandated ``\\r\\n``, it uses the " -"Python standard ``\\n`` line endings). For more information see the :mod:" -"`~email.policy` documentation." +"the representation of the message. If *policy* is not set, use " +"the :class:`~email.policy.default` policy, which follows the rules of the " +"email RFCs except for line endings (instead of the RFC mandated ``\\r\\n``, " +"it uses the Python standard ``\\n`` line endings). For more information see " +"the :mod:`~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* " -"defaults to ``False``. For backward compatibility with the base :class:" -"`~email.message.Message` class *maxheaderlen* is accepted, but defaults to " -"``None``, which means that by default the line length is controlled by the :" -"attr:`~email.policy.Policy.max_line_length` of the policy. The *policy* " -"argument may be used to override the default policy obtained from the " -"message instance. This can be used to control some of the formatting " -"produced by the method, since the specified *policy* will be passed to the :" -"class:`~email.generator.Generator`." -msgstr "" +"defaults to ``False``. For backward compatibility with the " +"base :class:`~email.message.Message` class *maxheaderlen* is accepted, but " +"defaults to ``None``, which means that by default the line length is " +"controlled by the :attr:`~email.policy.Policy.max_line_length` of the " +"policy. The *policy* argument may be used to override the default policy " +"obtained from the message instance. This can be used to control some of the " +"formatting 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,79 +157,112 @@ 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 " "dealing with multiple messages. See :class:`email.generator.Generator` for " "a more flexible API for serializing messages. Note also that this method is " -"restricted to producing messages serialized as \"7 bit clean\" when :attr:" -"`~email.policy.EmailPolicy.utf8` is ``False``, which is the default." +"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`." +"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. " "*unixfrom* defaults to ``False``. The *policy* argument may be used to " "override the default policy obtained from the message instance. This can be " "used to control some of the formatting produced by the method, since the " -"specified *policy* will be passed to the :class:`~email.generator." -"BytesGenerator`." +"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:" -"`is_multipart` returns ``False``, the payload should be a string object " -"(which might be a CTE encoded binary payload). Note that :meth:" -"`is_multipart` returning ``True`` does not necessarily mean that \"msg." -"get_content_maintype() == 'multipart'\" will return the ``True``. For " -"example, ``is_multipart`` will return ``True`` when the :class:" -"`EmailMessage` is of type ``message/rfc822``." +"Return ``True`` if the message's payload is a list of sub-" +"\\ :class:`EmailMessage` objects, otherwise return ``False``. " +"When :meth:`is_multipart` returns ``False``, the payload should be a string " +"object (which might be a CTE encoded binary payload). Note " +"that :meth:`is_multipart` returning ``True`` does not necessarily mean that " +"\"msg.get_content_maintype() == 'multipart'\" will return the ``True``. For " +"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 +286,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 +305,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." +"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 +369,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 +384,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 +416,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``)." +"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 +438,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 +457,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,59 +474,80 @@ 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 "" - -#: ../../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` " -"header in the message return the value returned by :meth:" -"`get_default_type`. If the :mailheader:`Content-Type` header is invalid, " -"return ``text/plain``." -msgstr "" - -#: ../../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 " -"message's default type to be :mimetype:`text/plain` unless it appears inside " -"a :mimetype:`multipart/digest` container, in which case it would be :" -"mimetype:`message/rfc822`. If the :mailheader:`Content-Type` header has an " -"invalid type specification, :rfc:`2045` mandates that the default type be :" -"mimetype:`text/plain`.)" -msgstr "" +"ヘッダーを置き換えます。\n" +"*_name* に一致する最初のヘッダーを、元のヘッダーの順序とフィールド名の大文" +"字・小文字を保ったまま置き換えます。\n" +"一致するヘッダーがなければ :exc:`KeyError` を送出します。" + +msgid "" +"Return the message's content type, coerced to lower case of the " +"form :mimetype:`maintype/subtype`. If there is no :mailheader:`Content-" +"Type` header in the message return the value returned " +"by :meth:`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`` を返します。" + +msgid "" +"(According to :rfc:`2045`, messages always have a default " +"type, :meth:`get_content_type` will always return a value. :rfc:`2045` " +"defines a message's default type to be :mimetype:`text/plain` unless it " +"appears inside a :mimetype:`multipart/digest` container, in which case it " +"would be :mimetype:`message/rfc822`. If the :mailheader:`Content-Type` " +"header has an 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 "" @@ -457,16 +569,15 @@ msgstr "" #: ../../library/email.message.rst:340 msgid "" "Return the default content type. Most messages have a default content type " -"of :mimetype:`text/plain`, except for messages that are subparts of :" -"mimetype:`multipart/digest` containers. Such subparts have a default " +"of :mimetype:`text/plain`, except for messages that are subparts " +"of :mimetype:`multipart/digest` containers. Such subparts have a default " "content type of :mimetype:`message/rfc822`." msgstr "" "デフォルトの content-type を返します。ほどんどのメッセージではデフォルトの " -"content-type は :mimetype:`text/plain` ですが、メッセージが :mimetype:" -"`multipart/digest` コンテナに含まれているときだけ例外的に :mimetype:`message/" -"rfc822` になります。" +"content-type は :mimetype:`text/plain` ですが、メッセージ" +"が :mimetype:`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,16 +585,28 @@ 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* " "is ``Content-Type`` (the default) and the header does not yet exist in the " "message, add it, set its value to :mimetype:`text/plain`, and append the new " -"parameter value. Optional *header* specifies an alternative header to :" -"mailheader:`Content-Type`." +"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 +618,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']``)." +"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." @@ -555,8 +682,8 @@ msgid "" msgstr "" "そのメッセージ中の :mailheader:`Content-Type` ヘッダにある、 ``boundary`` パ" "ラメータの値を返します。目的のヘッダが欠けていたり、 ``boundary`` パラメータ" -"がない場合には *failobj* が返されます。返される文字列はつねに :func:`email." -"utils.unquote` によって unquote されます。" +"がない場合には *failobj* が返されます。返される文字列はつね" +"に :func:`email.utils.unquote` によって unquote されます。" #: ../../library/email.message.rst:419 msgid "" @@ -570,24 +697,28 @@ 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." +"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 "" @@ -608,11 +739,11 @@ msgid "" "``charset`` parameter, or is not of the :mimetype:`text` main MIME type, " "then that item in the returned list will be *failobj*." msgstr "" -"リスト中の各要素は文字列であり、これは対応する subpart 中のそれぞれの :" -"mailheader:`Content-Type` ヘッダにある ``charset`` の値です。その subpart " -"が :mailheader:`Content-Type` をもってないか、 ``charset`` がないか、あるい" -"は MIME maintype が :mimetype:`text` でないいずれかの場合には、リストの要素と" -"して *failobj* が返されます。" +"リスト中の各要素は文字列であり、これは対応する subpart 中のそれぞれ" +"の :mailheader:`Content-Type` ヘッダにある ``charset`` の値です。その " +"subpart が :mailheader:`Content-Type` をもってないか、 ``charset`` がないか、" +"あるいは MIME maintype が :mimetype:`text` でないいずれかの場合には、リストの" +"要素として *failobj* が返されます。" #: ../../library/email.message.rst:453 msgid "" @@ -625,25 +756,29 @@ msgstr "" #: ../../library/email.message.rst:456 msgid "" -"is_attachment is now a method instead of a property, for consistency with :" -"meth:`~email.message.Message.is_multipart`." +"is_attachment is now a method instead of a property, for consistency " +"with :meth:`~email.message.Message.is_multipart`." 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`." +"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 +801,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 +812,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 +856,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 +892,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,14 +953,23 @@ 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 " "each of ``text/plain``, ``text/html``, ``multipart/related``, or ``multipart/" -"alternative`` (unless they are explicitly marked as attachments via :" -"mailheader:`Content-Disposition: attachment`), and return all remaining " +"alternative`` (unless they are explicitly marked as attachments " +"via :mailheader:`Content-Disposition: attachment`), and return all remaining " "parts. When applied directly to a ``multipart/related``, return an iterator " "over the all the related parts except the root part (ie: the part pointed to " "by the ``start`` parameter, or the first part if there is no ``start`` " @@ -790,15 +977,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`.)" +"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 +1006,14 @@ 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 +1021,14 @@ 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 +1037,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,65 +1052,102 @@ 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 "" "Convert a non-``multipart``, a ``multipart/related``, or a ``multipart-" -"alternative`` into a ``multipart/mixed``, moving any existing :mailheader:" -"`Content-` headers and payload into a (new) first part of the " -"``multipart``. If *boundary* is specified, use it as the boundary string in " -"the multipart, otherwise leave the boundary to be automatically created when " -"it is needed (for example, when the message is serialized)." +"alternative`` into a ``multipart/mixed``, moving any " +"existing :mailheader:`Content-` headers and payload into a (new) first part " +"of the ``multipart``. If *boundary* is specified, use it as the boundary " +"string in the multipart, otherwise leave the boundary to be automatically " +"created when 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." -"message.Message.attach` it to the ``multipart``. If the message is a non-" -"``multipart``, call :meth:`make_related` and then proceed as above. If the " -"message is any other type of ``multipart``, raise a :exc:`TypeError`. If " -"*content_manager* is not specified, use the ``content_manager`` specified by " -"the current :mod:`~email.policy`. If the added part has no :mailheader:" -"`Content-Disposition` header, add one with the value ``inline``." -msgstr "" +"all of the arguments to its :meth:`set_content` method, " +"and :meth:`~email.message.Message.attach` it to the ``multipart``. If the " +"message is a non-``multipart``, call :meth:`make_related` and then proceed " +"as above. If the message is any other type of ``multipart``, raise " +"a :exc:`TypeError`. If *content_manager* is not specified, use the " +"``content_manager`` specified by 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:" -"`~email.message.Message.attach` it to the ``multipart``. If the message is " -"a non-``multipart`` or ``multipart/related``, call :meth:`make_alternative` " -"and then proceed as above. If the message is any other type of " -"``multipart``, raise a :exc:`TypeError`. If *content_manager* is not " -"specified, use the ``content_manager`` specified by the current :mod:`~email." -"policy`." +"pass all of the arguments to its :meth:`set_content` method, " +"and :meth:`~email.message.Message.attach` it to the ``multipart``. If the " +"message is a non-``multipart`` or ``multipart/related``, " +"call :meth:`make_alternative` and then proceed as above. If the message is " +"any other type of ``multipart``, raise a :exc:`TypeError`. If " +"*content_manager* is not 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." -"message.Message.attach` it to the ``multipart``. If the message is a non-" -"``multipart``, ``multipart/related``, or ``multipart/alternative``, call :" -"meth:`make_mixed` and then proceed as above. If *content_manager* is not " -"specified, use the ``content_manager`` specified by the current :mod:`~email." -"policy`. If the added part has no :mailheader:`Content-Disposition` header, " -"add one with the value ``attachment``. This method can be used both for " -"explicit attachments (:mailheader:`Content-Disposition: attachment`) and " -"``inline`` attachments (:mailheader:`Content-Disposition: inline`), by " -"passing appropriate options to the ``content_manager``." -msgstr "" +"all of the arguments to its :meth:`set_content` method, " +"and :meth:`~email.message.Message.attach` it to the ``multipart``. If the " +"message is a non-``multipart``, ``multipart/related``, or ``multipart/" +"alternative``, call :meth:`make_mixed` and then proceed as above. If " +"*content_manager* is not specified, use the ``content_manager`` specified by " +"the current :mod:`~email.policy`. If the added part has " +"no :mailheader:`Content-Disposition` header, add one with the value " +"``attachment``. This method can be used both for explicit attachments " +"(:mailheader:`Content-Disposition: attachment`) and ``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:" @@ -921,20 +1175,21 @@ msgid "" "The *preamble* attribute contains this leading extra-armor text for MIME " "documents. When the :class:`~email.parser.Parser` discovers some text after " "the headers but before the first boundary string, it assigns this text to " -"the message's *preamble* attribute. When the :class:`~email.generator." -"Generator` is writing out the plain text representation of a MIME message, " -"and it finds the message has a *preamble* attribute, it will write this text " -"in the area between the headers and the first boundary. See :mod:`email." -"parser` and :mod:`email.generator` for details." +"the message's *preamble* attribute. When " +"the :class:`~email.generator.Generator` is writing out the plain text " +"representation of a MIME message, and it finds the message has a *preamble* " +"attribute, it will write this text in the area between the headers and the " +"first boundary. See :mod:`email.parser` and :mod:`email.generator` for " +"details." msgstr "" "*preamble* 属性は MIME ドキュメントに加えるこの最初の MIME 範囲外テキストを含" "んでいます。 :class:`~email.parser.Parser` があるテキストをヘッダ以降に発見し" "たが、それはまだ最初の MIME 境界文字列が現れる前だった場合、パーザはそのテキ" -"ストをメッセージの *preamble* 属性に格納します。 :class:`~email.generator." -"Generator` がある MIME メッセージからプレーンテキスト形式を生成するときメッ" -"セージが *preamble* 属性を持つことが発見されれば、これはそのテキストをヘッダ" -"と最初の MIME 境界の間に挿入します。詳細は :mod:`email.parser` および :mod:" -"`email.generator` を参照してください。" +"ストをメッセージの *preamble* 属性に格納しま" +"す。 :class:`~email.generator.Generator` がある MIME メッセージからプレーンテ" +"キスト形式を生成するときメッセージが *preamble* 属性を持つことが発見されれ" +"ば、これはそのテキストをヘッダと最初の MIME 境界の間に挿入します。詳細" +"は :mod:`email.parser` および :mod:`email.generator` を参照してください。" #: ../../library/email.message.rst:720 msgid "" @@ -944,13 +1199,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 +1220,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." +"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..400e8d6db 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 "" @@ -45,32 +46,31 @@ msgid "" "text to a parser, which parses the text and returns the root message " "object. However you can also build a complete message structure from " "scratch, or even individual :class:`~email.message.Message` objects by " -"hand. In fact, you can also take an existing structure and add new :class:" -"`~email.message.Message` objects, move them around, etc. This makes a very " -"convenient interface for slicing-and-dicing MIME messages." +"hand. In fact, you can also take an existing structure and add " +"new :class:`~email.message.Message` objects, move them around, etc. This " +"makes a very convenient interface for slicing-and-dicing MIME messages." msgstr "" "ふつう、メッセージオブジェクト構造はファイルまたは何がしかのテキストをパーザ" "に通すことで得られます。パーザは与えられたテキストを解析し、基底となる root " "のメッセージオブジェクトを返します。しかし、完全なメッセージオブジェクト構造" -"を何もないところから作成することもまた可能です。個別の :class:`~email." -"message.Message` を手で作成することさえできます。実際には、すでに存在するメッ" -"セージオブジェクト構造をとってきて、そこに新たな :class:`~email.message." -"Message` オブジェクトを追加したり、あるものを別のところへ移動させたりできま" -"す。これは MIME メッセージを切ったりおろしたりするために非常に便利なインター" -"フェイスを提供します。" - -#: ../../library/email.mime.rst:24 +"を何もないところから作成することもまた可能です。個別" +"の :class:`~email.message.Message` を手で作成することさえできます。実際には、" +"すでに存在するメッセージオブジェクト構造をとってきて、そこに新た" +"な :class:`~email.message.Message` オブジェクトを追加したり、あるものを別のと" +"ころへ移動させたりできます。これは MIME メッセージを切ったりおろしたりするた" +"めに非常に便利なインターフェイスを提供します。" + 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." +"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:" @@ -82,8 +82,8 @@ msgstr "モジュール: :mod:`email.mime.base`" #: ../../library/email.mime.rst:37 msgid "" -"This is the base class for all the MIME-specific subclasses of :class:" -"`~email.message.Message`. Ordinarily you won't create instances " +"This is the base class for all the MIME-specific subclasses " +"of :class:`~email.message.Message`. Ordinarily you won't create instances " "specifically of :class:`MIMEBase`, although you could. :class:`MIMEBase` is " "provided primarily as a convenient base class for more specific MIME-aware " "subclasses." @@ -95,23 +95,27 @@ msgstr "" #: ../../library/email.mime.rst:43 msgid "" -"*_maintype* is the :mailheader:`Content-Type` major type (e.g. :mimetype:" -"`text` or :mimetype:`image`), and *_subtype* is the :mailheader:`Content-" -"Type` minor type (e.g. :mimetype:`plain` or :mimetype:`gif`). *_params* is " -"a parameter key/value dictionary and is passed directly to :meth:`Message." -"add_header `." +"*_maintype* is the :mailheader:`Content-Type` major type " +"(e.g. :mimetype:`text` or :mimetype:`image`), and *_subtype* is " +"the :mailheader:`Content-Type` minor type (e.g. :mimetype:`plain` " +"or :mimetype:`gif`). *_params* is a parameter key/value dictionary and is " +"passed directly to :meth:`Message.add_header " +"`." msgstr "" -"*_maintype* は :mailheader:`Content-Type` の主形式 (maintype) であり (:" -"mimetype:`text` や :mimetype:`image` など)、 *_subtype* は :mailheader:" -"`Content-Type` の副形式 (subtype) です (:mimetype:`plain` や :mimetype:`gif` " -"など)。 *_params* は各パラメータのキーと値を格納した辞書であり、これは直接 :" -"meth:`Message.add_header ` に渡されます。" +"*_maintype* は :mailheader:`Content-Type` の主形式 (maintype) であり " +"(:mimetype:`text` や :mimetype:`image` など)、 *_subtype* " +"は :mailheader:`Content-Type` の副形式 (subtype) です (:mimetype:`plain` " +"や :mimetype:`gif` など)。 *_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`." +"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 "" @@ -120,8 +124,9 @@ msgid "" "Version` header (always set to ``1.0``)." msgstr "" ":class:`MIMEBase` クラスはつねに (*_maintype* 、 *_subtype* 、および " -"*_params* にもとづいた) :mailheader:`Content-Type` ヘッダと、 :mailheader:" -"`MIME-Version` ヘッダ (必ず ``1.0`` に設定される) を追加します。" +"*_params* にもとづいた) :mailheader:`Content-Type` ヘッダ" +"と、 :mailheader:`MIME-Version` ヘッダ (必ず ``1.0`` に設定される) を追加しま" +"す。" #: ../../library/email.mime.rst:57 ../../library/email.mime.rst:104 #: ../../library/email.mime.rst:135 ../../library/email.mime.rst:169 @@ -138,17 +143,18 @@ msgstr "モジュール: :mod:`email.mime.nonmultipart`" msgid "" "A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate " "base class for MIME messages that are not :mimetype:`multipart`. The " -"primary purpose of this class is to prevent the use of the :meth:`~email." -"message.Message.attach` method, which only makes sense for :mimetype:" -"`multipart` messages. If :meth:`~email.message.Message.attach` is called, " +"primary purpose of this class is to prevent the use of " +"the :meth:`~email.message.Message.attach` method, which only makes sense " +"for :mimetype:`multipart` messages. " +"If :meth:`~email.message.Message.attach` is called, " "a :exc:`~email.errors.MultipartConversionError` exception is raised." msgstr "" -":class:`~email.mime.base.MIMEBase` のサブクラスで、これは :mimetype:" -"`multipart` 形式でない MIME メッセージのための中間的な基底クラスです。このク" -"ラスのおもな目的は、通常 :mimetype:`multipart` 形式のメッセージに対してのみ意" -"味をなす :meth:`~email.message.Message.attach` メソッドの使用をふせぐことで" -"す。もし :meth:`~email.message.Message.attach` メソッドが呼ばれた場合、これ" -"は :exc:`~email.errors.MultipartConversionError` 例外を発生します。" +":class:`~email.mime.base.MIMEBase` のサブクラスで、これ" +"は :mimetype:`multipart` 形式でない MIME メッセージのための中間的な基底クラス" +"です。このクラスのおもな目的は、通常 :mimetype:`multipart` 形式のメッセージに" +"対してのみ意味をなす :meth:`~email.message.Message.attach` メソッドの使用をふ" +"せぐことです。もし :meth:`~email.message.Message.attach` メソッドが呼ばれた場" +"合、これは :exc:`~email.errors.MultipartConversionError` 例外を発生します。" #: ../../library/email.mime.rst:80 msgid "Module: :mod:`email.mime.multipart`" @@ -159,17 +165,17 @@ msgid "" "A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate " "base class for MIME messages that are :mimetype:`multipart`. Optional " "*_subtype* defaults to :mimetype:`mixed`, but can be used to specify the " -"subtype of the message. A :mailheader:`Content-Type` header of :mimetype:" -"`multipart/_subtype` will be added to the message object. A :mailheader:" -"`MIME-Version` header will also be added." +"subtype of the message. A :mailheader:`Content-Type` header " +"of :mimetype:`multipart/_subtype` will be added to the message object. " +"A :mailheader:`MIME-Version` header will also be added." msgstr "" -":class:`~email.mime.base.MIMEBase` のサブクラスで、これは :mimetype:" -"`multipart` 形式の MIME メッセージのための中間的な基底クラスです。オプション" -"引数 *_subtype* はデフォルトでは :mimetype:`mixed` になっていますが、そのメッ" -"セージの副形式 (subtype) を指定するのに使うことができます。メッセージオブジェ" -"クトには :mimetype:`multipart/_subtype` という値をもつ :mailheader:`Content-" -"Type` ヘッダとともに、 :mailheader:`MIME-Version` ヘッダが追加されるでしょ" -"う。" +":class:`~email.mime.base.MIMEBase` のサブクラスで、これ" +"は :mimetype:`multipart` 形式の MIME メッセージのための中間的な基底クラスで" +"す。オプション引数 *_subtype* はデフォルトでは :mimetype:`mixed` になっていま" +"すが、そのメッセージの副形式 (subtype) を指定するのに使うことができます。メッ" +"セージオブジェクトには :mimetype:`multipart/_subtype` という値をも" +"つ :mailheader:`Content-Type` ヘッダとともに、 :mailheader:`MIME-Version` " +"ヘッダが追加されるでしょう。" #: ../../library/email.mime.rst:89 msgid "" @@ -185,21 +191,20 @@ msgstr "" msgid "" "*_subparts* is a sequence of initial subparts for the payload. It must be " "possible to convert this sequence to a list. You can always attach new " -"subparts to the message by using the :meth:`Message.attach ` method." +"subparts to the message by using the :meth:`Message.attach " +"` method." msgstr "" "*_subparts* はそのペイロードの subpart の初期値からなるシーケンスです。この" "シーケンスはリストに変換できるようになっている必要があります。新しい subpart " "はつねに :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 `." +"Optional *policy* argument defaults to :class:`compat32 " +"`." msgstr "" +"オプション引数 *policy* のデフォルトは :class:`compat32 " +"` です。" #: ../../library/email.mime.rst:100 msgid "" @@ -215,31 +220,38 @@ 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 " -"type :mimetype:`application`. *_data* contains the bytes for the raw " -"application data. Optional *_subtype* specifies the MIME subtype and " +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEApplication` class is used to represent MIME message objects " +"of major type :mimetype:`application`. *_data* contains the bytes for the " +"raw 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 "" "Optional *_encoder* is a callable (i.e. function) which will perform the " "actual encoding of the data for transport. This callable takes one " -"argument, which is the :class:`MIMEApplication` instance. It should use :" -"meth:`~email.message.Message.get_payload` and :meth:`~email.message.Message." -"set_payload` to change the payload to encoded form. It should also add any :" -"mailheader:`Content-Transfer-Encoding` or other headers to the message " -"object as necessary. The default encoding is base64. See the :mod:`email." -"encoders` module for a list of the built-in encoders." +"argument, which is the :class:`MIMEApplication` instance. It should " +"use :meth:`~email.message.Message.get_payload` " +"and :meth:`~email.message.Message.set_payload` to change the payload to " +"encoded form. It should also add any :mailheader:`Content-Transfer-" +"Encoding` or other headers to the message object as necessary. The default " +"encoding is base64. See the :mod:`email.encoders` module for a list of the " +"built-in encoders." msgstr "" "オプション引数の *_encoder* は呼び出し可能なオブジェクト (関数など) で、デー" "タの転送に使う実際のエンコード処理を行います。この呼び出し可能なオブジェクト" "は引数を 1 つ取り、それは :class:`MIMEApplication` のインスタンスです。ペイ" -"ロードをエンコードされた形式に変更するために :meth:`~email.message.Message." -"get_payload` と :meth:`~email.message.Message.set_payload` を使い、必要に応じ" +"ロードをエンコードされた形式に変更するため" +"に :meth:`~email.message.Message.get_payload` " +"と :meth:`~email.message.Message.set_payload` を使い、必要に応じ" "て :mailheader:`Content-Transfer-Encoding` やその他のヘッダをメッセージオブ" "ジェクトに追加するべきです。デフォルトのエンコードは base64 です。組み込みの" "エンコーダの一覧は :mod:`email.encoders` モジュールを見てください。" @@ -252,34 +264,44 @@ 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 :" -"mimetype:`audio`. *_audiodata* contains the bytes for the raw audio data. " -"If this data can be decoded as au, wav, aiff, or aifc, then the subtype will " -"be automatically included in the :mailheader:`Content-Type` header. " -"Otherwise you can explicitly specify the audio subtype via the *_subtype* " -"argument. If the minor type could not be guessed and *_subtype* was not " -"given, then :exc:`TypeError` is raised." +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEAudio` class is used to create MIME message objects of major " +"type :mimetype:`audio`. *_audiodata* contains the bytes for the raw audio " +"data. If this data can be decoded as au, wav, aiff, or aifc, then the " +"subtype will be automatically included in the :mailheader:`Content-Type` " +"header. Otherwise you can explicitly specify the audio subtype via the " +"*_subtype* 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 "" "Optional *_encoder* is a callable (i.e. function) which will perform the " "actual encoding of the audio data for transport. This callable takes one " -"argument, which is the :class:`MIMEAudio` instance. It should use :meth:" -"`~email.message.Message.get_payload` and :meth:`~email.message.Message." -"set_payload` to change the payload to encoded form. It should also add any :" -"mailheader:`Content-Transfer-Encoding` or other headers to the message " -"object as necessary. The default encoding is base64. See the :mod:`email." -"encoders` module for a list of the built-in encoders." +"argument, which is the :class:`MIMEAudio` instance. It should " +"use :meth:`~email.message.Message.get_payload` " +"and :meth:`~email.message.Message.set_payload` to change the payload to " +"encoded form. It should also add any :mailheader:`Content-Transfer-" +"Encoding` or other headers to the message object as necessary. The default " +"encoding is base64. See the :mod:`email.encoders` module for a list of the " +"built-in encoders." msgstr "" "オプション引数の *_encoder* は呼び出し可能なオブジェクト (関数など) で、オー" "ディオデータの転送に使う実際のエンコード処理を行います。この呼び出し可能なオ" "ブジェクトは引数を 1 つ取り、それは :class:`MIMEAudio` のインスタンスです。ペ" -"イロードをエンコードされた形式に変更するために :meth:`~email.message.Message." -"get_payload` と :meth:`~email.message.Message.set_payload` を使い、必要に応じ" +"イロードをエンコードされた形式に変更するため" +"に :meth:`~email.message.Message.get_payload` " +"と :meth:`~email.message.Message.set_payload` を使い、必要に応じ" "て :mailheader:`Content-Transfer-Encoding` やその他のヘッダをメッセージオブ" "ジェクトに追加するべきです。デフォルトのエンコードは base64 です。組み込みの" "エンコーダの一覧は :mod:`email.encoders` モジュールを見てください。" @@ -288,43 +310,54 @@ 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 :" -"mimetype:`image`. *_imagedata* contains the bytes for the raw image data. " -"If this data type can be detected (jpeg, png, gif, tiff, rgb, pbm, pgm, ppm, " -"rast, xbm, bmp, webp, and exr attempted), then the subtype will be " +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEImage` class is used to create MIME message objects of major " +"type :mimetype:`image`. *_imagedata* contains the bytes for the raw image " +"data. If this data type can be detected (jpeg, png, gif, tiff, rgb, pbm, " +"pgm, ppm, rast, xbm, bmp, webp, and exr attempted), then the subtype will be " "automatically included in the :mailheader:`Content-Type` header. Otherwise " "you can explicitly specify the image subtype via the *_subtype* argument. If " -"the minor type could not be guessed and *_subtype* was not given, then :exc:" -"`TypeError` is raised." +"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 "" "Optional *_encoder* is a callable (i.e. function) which will perform the " "actual encoding of the image data for transport. This callable takes one " -"argument, which is the :class:`MIMEImage` instance. It should use :meth:" -"`~email.message.Message.get_payload` and :meth:`~email.message.Message." -"set_payload` to change the payload to encoded form. It should also add any :" -"mailheader:`Content-Transfer-Encoding` or other headers to the message " -"object as necessary. The default encoding is base64. See the :mod:`email." -"encoders` module for a list of the built-in encoders." +"argument, which is the :class:`MIMEImage` instance. It should " +"use :meth:`~email.message.Message.get_payload` " +"and :meth:`~email.message.Message.set_payload` to change the payload to " +"encoded form. It should also add any :mailheader:`Content-Transfer-" +"Encoding` or other headers to the message object as necessary. The default " +"encoding is base64. See the :mod:`email.encoders` module for a list of the " +"built-in encoders." msgstr "" "オプション引数の *_encoder* は呼び出し可能なオブジェクト (関数など) で、画像" "データの転送に使う実際のエンコード処理を行います。この呼び出し可能なオブジェ" "クトは引数を 1 つ取り、それは :class:`MIMEImage` のインスタンスです。ペイロー" -"ドをエンコードされた形式に変更するために :meth:`~email.message.Message." -"get_payload` と :meth:`~email.message.Message.set_payload` を使い、必要に応じ" +"ドをエンコードされた形式に変更するため" +"に :meth:`~email.message.Message.get_payload` " +"と :meth:`~email.message.Message.set_payload` を使い、必要に応じ" "て :mailheader:`Content-Transfer-Encoding` やその他のヘッダをメッセージオブ" "ジェクトに追加するべきです。デフォルトのエンコードは base64 です。組み込みの" "エンコーダの一覧は :mod:`email.encoders` モジュールを見てください。" #: ../../library/email.mime.rst:202 msgid "" -"*_params* are passed straight through to the :class:`~email.mime.base." -"MIMEBase` constructor." +"*_params* are passed straight through to " +"the :class:`~email.mime.base.MIMEBase` constructor." msgstr "" "*_params* は :class:`~email.mime.base.MIMEBase` コンストラクタに直接渡されま" "す。" @@ -335,23 +368,24 @@ msgstr "モジュール: :mod:`email.mime.message`" #: ../../library/email.mime.rst:214 msgid "" -"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" -"`MIMEMessage` class is used to create MIME objects of main type :mimetype:" -"`message`. *_msg* is used as the payload, and must be an instance of class :" -"class:`~email.message.Message` (or a subclass thereof), otherwise a :exc:" -"`TypeError` is raised." +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEMessage` class is used to create MIME objects of main " +"type :mimetype:`message`. *_msg* is used as the payload, and must be an " +"instance of class :class:`~email.message.Message` (or a subclass thereof), " +"otherwise a :exc:`TypeError` is raised." msgstr "" -":class:`MIMEMessage` クラスは :class:`~email.mime.nonmultipart." -"MIMENonMultipart` のサブクラスで、主形式 (maintype) が :mimetype:`message` " -"の MIME オブジェクトを作成するのに使われます。ペイロードとして使われるメッ" -"セージは *_msg* になります。これは :class:`~email.message.Message` クラス (あ" -"るいはそのサブクラス) のインスタンスでなければいけません。そうでない場合、こ" -"の関数は :exc:`TypeError` を発生します。" +":class:`MIMEMessage` クラス" +"は :class:`~email.mime.nonmultipart.MIMENonMultipart` のサブクラスで、主形式 " +"(maintype) が :mimetype:`message` の MIME オブジェクトを作成するのに使われま" +"す。ペイロードとして使われるメッセージは *_msg* になります。これ" +"は :class:`~email.message.Message` クラス (あるいはそのサブクラス) のインスタ" +"ンスでなければいけません。そうでない場合、この関数は :exc:`TypeError` を発生" +"します。" #: ../../library/email.mime.rst:220 msgid "" -"Optional *_subtype* sets the subtype of the message; it defaults to :" -"mimetype:`rfc822`." +"Optional *_subtype* sets the subtype of the message; it defaults " +"to :mimetype:`rfc822`." msgstr "" "オプション引数 *_subtype* はそのメッセージの副形式 (subtype) を設定します。デ" "フォルトではこれは :mimetype:`rfc822` になっています。" @@ -362,27 +396,27 @@ msgstr "モジュール: :mod:`email.mime.text`" #: ../../library/email.mime.rst:234 msgid "" -"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" -"`MIMEText` class is used to create MIME objects of major type :mimetype:" -"`text`. *_text* is the string for the payload. *_subtype* is the minor type " -"and defaults to :mimetype:`plain`. *_charset* is the character set of the " -"text and is passed as an argument to the :class:`~email.mime.nonmultipart." -"MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string " -"contains only ``ascii`` code points, and ``utf-8`` otherwise. The " -"*_charset* parameter accepts either a string or a :class:`~email.charset." -"Charset` instance." +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEText` class is used to create MIME objects of major " +"type :mimetype:`text`. *_text* is the string for the payload. *_subtype* is " +"the minor type and defaults to :mimetype:`plain`. *_charset* is the " +"character set of the text and is passed as an argument to " +"the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it " +"defaults to ``us-ascii`` if the string contains only ``ascii`` code points, " +"and ``utf-8`` otherwise. The *_charset* parameter accepts either a string " +"or a :class:`~email.charset.Charset` instance." msgstr "" -":class:`MIMEText` クラスは :class:`~email.mime.nonmultipart." -"MIMENonMultipart` のサブクラスで、主形式 (maintype) が :mimetype:`text` の " -"MIME オブジェクトを作成するのに使われます。ペイロードの文字列は *_text* にな" -"ります。 *_subtype* には副形式 (subtype) を指定し、デフォルトは :mimetype:" -"`plain` です。 *_charset* はテキストの文字セットで、 :class:`~email.mime." -"nonmultipart.MIMENonMultipart` コンストラクタに引数として渡されます。この値" -"は、文字列が ``ascii`` コードポイントのみを含む場合 ``us-ascii`` 、それ以外" -"は ``utf-8`` がデフォルトになっています。 *_charset* パラメータは、文字列と :" -"class:`~email.charset.Charset` インスタンスの両方を受け付けます。" - -#: ../../library/email.mime.rst:244 +":class:`MIMEText` クラス" +"は :class:`~email.mime.nonmultipart.MIMENonMultipart` のサブクラスで、主形式 " +"(maintype) が :mimetype:`text` の MIME オブジェクトを作成するのに使われます。" +"ペイロードの文字列は *_text* になります。 *_subtype* には副形式 (subtype) を" +"指定し、デフォルトは :mimetype:`plain` です。 *_charset* はテキストの文字セッ" +"トで、 :class:`~email.mime.nonmultipart.MIMENonMultipart` コンストラクタに引" +"数として渡されます。この値は、文字列が ``ascii`` コードポイントのみを含む場" +"合 ``us-ascii`` 、それ以外は ``utf-8`` がデフォルトになっています。 " +"*_charset* パラメータは、文字列と :class:`~email.charset.Charset` インスタン" +"スの両方を受け付けます。" + 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 +430,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..ff00e8546 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 " @@ -49,112 +51,162 @@ msgid "" "root :class:`~email.message.EmailMessage` instance of the object structure. " "For simple, non-MIME messages the payload of this root object will likely be " "a string containing the text of the message. For MIME messages, the root " -"object will return ``True`` from its :meth:`~email.message.EmailMessage." -"is_multipart` method, and the subparts can be accessed via the payload " -"manipulation methods, such as :meth:`~email.message.EmailMessage.get_body`, :" -"meth:`~email.message.EmailMessage.iter_parts`, and :meth:`~email.message." -"EmailMessage.walk`." -msgstr "" +"object will return ``True`` from " +"its :meth:`~email.message.EmailMessage.is_multipart` method, and the " +"subparts can be accessed via the payload manipulation methods, such " +"as :meth:`~email.message.EmailMessage.get_body`, :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` " +"などのペイロード操作用メソッドで各部分にアクセスできます。" + +msgid "" +"There are actually two parser interfaces available for use, " +"the :class:`Parser` API and the incremental :class:`FeedParser` API. " +"The :class:`Parser` API is most useful if you have the entire text of the " +"message in memory, or if the entire message lives in a file on the file " +"system. :class:`FeedParser` is more appropriate when you are reading the " +"message from a stream which might block waiting for more input (such as " +"reading an email message from a socket). The :class:`FeedParser` can " +"consume and parse the 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:30 -msgid "" -"There are actually two parser interfaces available for use, the :class:" -"`Parser` API and the incremental :class:`FeedParser` API. The :class:" -"`Parser` API is most useful if you have the entire text of the message in " -"memory, or if the entire message lives in a file on the file system. :class:" -"`FeedParser` is more appropriate when you are reading the message from a " -"stream which might block waiting for more input (such as reading an email " -"message from a socket). The :class:`FeedParser` can consume and parse the " -"message incrementally, and only returns the root object when you close the " -"parser." -msgstr "" - -#: ../../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 " -"connects the :mod:`email` package's bundled parser and the :class:`~email." -"message.EmailMessage` class is embodied in the :class:`~email.policy.Policy` " -"class, so a custom parser can create message object trees any way it finds " -"necessary by implementing custom versions of the appropriate :class:`!" -"Policy` methods." -msgstr "" +"connects the :mod:`email` package's bundled parser and " +"the :class:`~email.message.EmailMessage` class is embodied in " +"the :class:`~email.policy.Policy` class, so a custom parser can create " +"message object trees any way it finds 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 " "messages, such as would be necessary when reading the text of an email " -"message from a source that can block (such as a socket). The :class:" -"`BytesFeedParser` can of course be used to parse an email message fully " -"contained in a :term:`bytes-like object`, string, or file, but the :class:" -"`BytesParser` API may be more convenient for such use cases. The semantics " -"and results of the two parser APIs are identical." -msgstr "" +"message from a source that can block (such as a socket). " +"The :class:`BytesFeedParser` can of course be used to parse an email message " +"fully contained in a :term:`bytes-like object`, string, or file, but " +"the :class:`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 " "to retrieve the root message object. The :class:`BytesFeedParser` is " "extremely accurate when parsing standards-compliant messages, and it does a " "very good job of parsing non-compliant messages, providing information about " -"how a message was deemed broken. It will populate a message object's :attr:" -"`~email.message.EmailMessage.defects` attribute with a list of any problems " -"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` モジュールを参照してください。" +"how a message was deemed broken. It will populate a message " +"object's :attr:`~email.message.EmailMessage.defects` attribute with a list " +"of any problems it found in a message. See the :mod:`email.errors` module " +"for the list of defects that it can find." +msgstr "" +":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." +"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:" -"`compat32 ` policy, which maintains backward " -"compatibility with the Python 3.2 version of the email package and provides :" -"class:`~email.message.Message` as the default factory. All other policies " -"provide :class:`~email.message.EmailMessage` as the default *_factory*. For " -"more information on what else *policy* controls, see the :mod:`~email." -"policy` documentation." -msgstr "" +"representation of the message. If *policy* is not set, use " +"the :class:`compat32 ` policy, which maintains " +"backward compatibility with the Python 3.2 version of the email package and " +"provides :class:`~email.message.Message` as the default factory. All other " +"policies provide :class:`~email.message.EmailMessage` as the default " +"*_factory*. For 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 "" @@ -164,52 +216,56 @@ msgid "" "any of the three common line endings: carriage return, newline, or carriage " "return and newline (they can even be mixed)." msgstr "" -"パーサーにデータを供給します。 *data* は 1行または複数行からなる :term:" -"`bytes-like object` を渡します。渡される行は完結していなくてもよく、その場合" -"パーサーは部分的な行を適切につなぎ合わせます。各行は3種類の標準的な行末文字 " -"(復帰 CR、改行 LF、または CR+LF) どれかの組み合わせでよく、これらが混在しても" -"かまいません。" +"パーサーにデータを供給します。 *data* は 1行または複数行からな" +"る :term:`bytes-like object` を渡します。渡される行は完結していなくてもよく、" +"その場合パーサーは部分的な行を適切につなぎ合わせます。各行は3種類の標準的な行" +"末文字 (復帰 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 "" -"Works like :class:`BytesFeedParser` except that the input to the :meth:" -"`~BytesFeedParser.feed` method must be a string. This is of limited " -"utility, since the only way for such a message to be valid is for it to " -"contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " +"Works like :class:`BytesFeedParser` except that the input to " +"the :meth:`~BytesFeedParser.feed` method must be a string. This is of " +"limited utility, since the only way for such a message to be valid is for it " +"to contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " "``True``, no binary attachments." msgstr "" -#: ../../library/email.parser.rst:126 msgid "Parser API" -msgstr "" +msgstr "Parser API" #: ../../library/email.parser.rst:128 msgid "" "The :class:`BytesParser` class, imported from the :mod:`email.parser` " "module, provides an API that can be used to parse a message when the " "complete contents of the message are available in a :term:`bytes-like " -"object` or file. The :mod:`email.parser` module also provides :class:" -"`Parser` for parsing strings, and header-only parsers, :class:" -"`BytesHeaderParser` and :class:`HeaderParser`, which can be used if you're " -"only interested in the headers of the message. :class:`BytesHeaderParser` " -"and :class:`HeaderParser` can be much faster in these situations, since they " -"do not attempt to parse the message body, instead setting the payload to the " -"raw body." +"object` or file. The :mod:`email.parser` module also " +"provides :class:`Parser` for parsing strings, and header-only " +"parsers, :class:`BytesHeaderParser` and :class:`HeaderParser`, which can be " +"used if you're only interested in the headers of the " +"message. :class:`BytesHeaderParser` and :class:`HeaderParser` can be much " +"faster in these situations, since they do not attempt to parse the message " +"body, instead setting the payload to the 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,16 +274,14 @@ 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 "" "Read all the data from the binary file-like object *fp*, parse the resulting " -"bytes, and return the message object. *fp* must support both the :meth:`~io." -"IOBase.readline` and the :meth:`~io.IOBase.read` methods." +"bytes, and return the message object. *fp* must support both " +"the :meth:`~io.IOBase.readline` and the :meth:`~io.IOBase.read` methods." msgstr "" #: ../../library/email.parser.rst:161 @@ -237,8 +291,8 @@ msgid "" "and header continuation lines, optionally preceded by an envelope header. " "The header block is terminated either by the end of the data or by a blank " "line. Following the header block is the body of the message (which may " -"contain MIME-encoded subparts, including subparts with a :mailheader:" -"`Content-Transfer-Encoding` of ``8bit``)." +"contain MIME-encoded subparts, including subparts with " +"a :mailheader:`Content-Transfer-Encoding` of ``8bit``)." msgstr "" #: ../../library/email.parser.rst:169 @@ -250,28 +304,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`." +"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 @@ -288,32 +346,34 @@ msgid "" msgstr "" "ファイルなどテキストモードのストリーム形式 (file-like) のオブジェクト *fp* か" "らすべてのデータを読み込み、得られたテキストを解析して基底 (root) メッセージ" -"オブジェクト構造を返します。 *fp* はストリーム形式のオブジェクトで :meth:" -"`~io.TextIOBase.readline` および :meth:`~io.TextIOBase.read` 両方のメソッドを" -"サポートしている必要があります。" +"オブジェクト構造を返します。 *fp* はストリーム形式のオブジェクト" +"で :meth:`~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`." +"Other than the text mode requirement, this method operates " +"like :meth:`BytesParser.parse`." msgstr "" +"テキストモードが必要な点を除き、このメソッドは :meth:`BytesParser.parse` と同" +"様に動作します。" #: ../../library/email.parser.rst:216 msgid "" "Similar to the :meth:`parse` method, except it takes a string object instead " "of a file-like object. Calling this method on a string is equivalent to " -"wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:" -"`parse`." +"wrapping *text* in a :class:`~io.StringIO` instance first and " +"calling :meth:`parse`." msgstr "" ":meth:`parse` メソッドに似ていますが、ファイルなどのストリーム形式のかわりに" "文字列を引数としてとるところが違います。文字列に対してこのメソッドを呼ぶこと" -"は、 *text* を :class:`~io.StringIO` インスタンスとして作成して :meth:" -"`parse` を適用するのと同じです。" +"は、 *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 "" @@ -322,8 +382,8 @@ msgid "" "available in the top-level :mod:`email` package namespace." msgstr "" "ファイルや文字列からメッセージオブジェクト構造を作成するのはかなりよくおこな" -"われる作業なので、便宜上次のような 4つの関数が提供されています。これらは :" -"mod:`email` パッケージのトップレベルの名前空間で使用できます。" +"われる作業なので、便宜上次のような 4つの関数が提供されています。これら" +"は :mod:`email` パッケージのトップレベルの名前空間で使用できます。" #: ../../library/email.parser.rst:239 msgid "" @@ -334,8 +394,9 @@ msgid "" msgstr "" ":term:`bytes-like オブジェクト ` からメッセージオブジェク" "ト構造を作成して返します。これは ``BytesParser().parsebytes(s)`` と同じです。" -"オプション引数 *_class* および *policy* は :class:`~email.parser." -"BytesParser` クラスのコンストラクタと同様に解釈されます。" +"オプション引数 *_class* および *policy* " +"は :class:`~email.parser.BytesParser` クラスのコンストラクタと同様に解釈され" +"ます。" #: ../../library/email.parser.rst:252 msgid "" @@ -355,9 +416,9 @@ msgid "" "``Parser().parsestr(s)``. *_class* and *policy* are interpreted as with " "the :class:`~email.parser.Parser` class constructor." msgstr "" -"文字列からメッセージオブジェクト構造を作成して返します。これは ``Parser()." -"parsestr(s)`` と同じです。 *_class* および *policy* は :class:`~email.parser." -"Parser` クラスのコンストラクタと同様に解釈されます。" +"文字列からメッセージオブジェクト構造を作成して返します。これは " +"``Parser().parsestr(s)`` と同じです。 *_class* および *policy* " +"は :class:`~email.parser.Parser` クラスのコンストラクタと同様に解釈されます。" #: ../../library/email.parser.rst:274 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" @@ -395,45 +457,48 @@ msgstr "以下はテキスト解析の際に適用されるいくつかの規約 msgid "" "Most non-\\ :mimetype:`multipart` type messages are parsed as a single " "message object with a string payload. These objects will return ``False`` " -"for :meth:`~email.message.EmailMessage.is_multipart`, and :meth:`~email." -"message.EmailMessage.iter_parts` will yield an empty list." +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield an empty list." msgstr "" #: ../../library/email.parser.rst:300 msgid "" "All :mimetype:`multipart` type messages will be parsed as a container " "message object with a list of sub-message objects for their payload. The " -"outer container message will return ``True`` for :meth:`~email.message." -"EmailMessage.is_multipart`, and :meth:`~email.message.EmailMessage." -"iter_parts` will yield a list of subparts." +"outer container message will return ``True`` " +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield a list of " +"subparts." msgstr "" #: ../../library/email.parser.rst:306 msgid "" -"Most messages with a content type of :mimetype:`message/\\*` (such as :" -"mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also " -"be parsed as container object containing a list payload of length 1. Their :" -"meth:`~email.message.EmailMessage.is_multipart` method will return ``True``. " -"The single element yielded by :meth:`~email.message.EmailMessage.iter_parts` " -"will be a sub-message object." +"Most messages with a content type of :mimetype:`message/\\*` (such " +"as :mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will " +"also be parsed as container object containing a list payload of length 1. " +"Their :meth:`~email.message.EmailMessage.is_multipart` method will return " +"``True``. The single element yielded " +"by :meth:`~email.message.EmailMessage.iter_parts` will be a sub-message " +"object." msgstr "" #: ../../library/email.parser.rst:313 msgid "" "Some non-standards-compliant messages may not be internally consistent about " -"their :mimetype:`multipart`\\ -edness. Such messages may have a :mailheader:" -"`Content-Type` header of type :mimetype:`multipart`, but their :meth:`~email." -"message.EmailMessage.is_multipart` method may return ``False``. If such " -"messages were parsed with the :class:`~email.parser.FeedParser`, they will " -"have an instance of the :class:`~email.errors." -"MultipartInvariantViolationDefect` class in their *defects* attribute list. " -"See :mod:`email.errors` for details." +"their :mimetype:`multipart`\\ -edness. Such messages may have " +"a :mailheader:`Content-Type` header of type :mimetype:`multipart`, but " +"their :meth:`~email.message.EmailMessage.is_multipart` method may return " +"``False``. If such messages were parsed with " +"the :class:`~email.parser.FeedParser`, they will have an instance of " +"the :class:`~email.errors.MultipartInvariantViolationDefect` class in their " +"*defects* attribute list. See :mod:`email.errors` for details." msgstr "" "いくつかの標準的でないメッセージは、 :mimetype:`multipart` の使い方に統一がと" "れていない場合があります。このようなメッセージは :mailheader:`Content-Type` " -"ヘッダに :mimetype:`multipart` を指定しているものの、その :meth:`~email." -"message.EmailMessage.is_multipart` メソッドは ``False`` を返すことがありま" -"す。もしこのようなメッセージが :class:`~email.parser.FeedParser` によって解析" -"されると、その *defects* 属性のリスト中には :class:`~email.errors." -"MultipartInvariantViolationDefect` クラスのインスタンスが現れます。詳しい情報" -"については :mod:`email.errors` を参照してください。" +"ヘッダに :mimetype:`multipart` を指定しているものの、そ" +"の :meth:`~email.message.EmailMessage.is_multipart` メソッドは ``False`` を返" +"すことがあります。もしこのようなメッセージ" +"が :class:`~email.parser.FeedParser` によって解析されると、その *defects* 属" +"性のリスト中には :class:`~email.errors.MultipartInvariantViolationDefect` ク" +"ラスのインスタンスが現れます。詳しい情報については :mod:`email.errors` を参照" +"してください。" diff --git a/library/email.po b/library/email.po index e345b1055..a8e8b9f2c 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 @@ -35,28 +35,29 @@ msgstr "**ソースコード:** :source:`Lib/email/__init__.py`" #: ../../library/email.rst:15 msgid "" "The :mod:`email` package is a library for managing email messages. It is " -"specifically *not* designed to do any sending of email messages to SMTP (:" -"rfc:`2821`), NNTP, or other servers; those are functions of modules such as :" -"mod:`smtplib`. The :mod:`email` package attempts to be as RFC-compliant as " -"possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-" -"related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:" -"`2231`." +"specifically *not* designed to do any sending of email messages to SMTP " +"(:rfc:`2821`), NNTP, or other servers; those are functions of modules such " +"as :mod:`smtplib`. The :mod:`email` package attempts to be as RFC-compliant " +"as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-" +"related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, " +"and :rfc:`2231`." msgstr "" ":mod:`email` パッケージは、電子メールメッセージを管理するライブラリです。 特" "に、SMTP(:rfc:`2821`)、NNTP、またはその他のサーバーに電子メールメッセージを" "送信するようには設計されていません。これらは、:mod:`smtplib` などのモジュール" "の関数群です。 :mod:`email` パッケージは、可能な限りRFCに準拠するよう試みてい" -"ます。 :rfc:`5322` や :rfc:`6532` のほか、:rfc:`2045`、:rfc:`2046`、:rfc:" -"`2047`、:rfc:`2183`、:rfc:`2231` などのMIME関連のRFCに対応しています。" +"ます。 :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 " @@ -65,36 +66,66 @@ msgid "" "to construct a new email, or to add or remove email subcomponents that " "themselves use the same object model interface. That is, following the " "nature of email messages and their MIME subcomponents, the email object " -"model is a tree structure of objects that all provide the :class:`~email." -"message.EmailMessage` API." +"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 " -"an email message (a stream of bytes) and converts it into a tree of :class:" -"`~email.message.EmailMessage` objects. The generator takes an :class:" -"`~email.message.EmailMessage` and turns it back into a serialized byte " -"stream. (The parser and generator also handle streams of text characters, " -"but this usage is discouraged as it is too easy to end up with messages that " -"are not valid in one way or another.)" +"an email message (a stream of bytes) and converts it into a tree " +"of :class:`~email.message.EmailMessage` objects. The generator takes " +"an :class:`~email.message.EmailMessage` and turns it back into a serialized " +"byte stream. (The parser and generator also handle streams of text " +"characters, 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:" -"`~email.parser` has an associated :mod:`~email.policy` object that controls " -"its behavior. Usually an application only needs to specify the policy when " -"an :class:`~email.message.EmailMessage` is created, either by directly " -"instantiating an :class:`~email.message.EmailMessage` to create a new " -"email, or by parsing an input stream using a :mod:`~email.parser`. But the " -"policy can be changed when the message is serialized using a :mod:`~email." -"generator`. This allows, for example, a generic email message to be parsed " -"from disk, but to serialize it using standard SMTP settings when sending it " -"to an email server." +"The control component is the :mod:`~email.policy` module. " +"Every :class:`~email.message.EmailMessage`, every :mod:`~email.generator`, " +"and every :mod:`~email.parser` has an associated :mod:`~email.policy` object " +"that controls its behavior. Usually an application only needs to specify " +"the policy when an :class:`~email.message.EmailMessage` is created, either " +"by directly instantiating an :class:`~email.message.EmailMessage` to create " +"a new email, or by parsing an input stream using a :mod:`~email.parser`. " +"But the policy can be changed when the message is serialized using " +"a :mod:`~email.generator`. This allows, for example, a generic email message " +"to be parsed 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 "" @@ -117,48 +148,58 @@ msgstr "" msgid "" "The following sections describe the functionality of the :mod:`email` " "package. We start with the :mod:`~email.message` object model, which is the " -"primary interface an application will use, and follow that with the :mod:" -"`~email.parser` and :mod:`~email.generator` components. Then we cover the :" -"mod:`~email.policy` controls, which completes the treatment of the main " -"components of the library." +"primary interface an application will use, and follow that with " +"the :mod:`~email.parser` and :mod:`~email.generator` components. Then we " +"cover the :mod:`~email.policy` controls, which completes the treatment of " +"the main 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 " -"detect. Then we cover the :mod:`~email.headerregistry` and the :mod:`~email." -"contentmanager` sub-components, which provide tools for doing more detailed " -"manipulation of headers and payloads, respectively. Both of these " -"components contain features relevant to consuming and producing non-trivial " -"messages, but also document their extensibility APIs, which will be of " -"interest to advanced applications." +"detect. Then we cover the :mod:`~email.headerregistry` and " +"the :mod:`~email.contentmanager` sub-components, which provide tools for " +"doing more detailed manipulation of headers and payloads, respectively. " +"Both of these components contain features relevant to consuming and " +"producing non-trivial 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 "" "The foregoing represent the modern (unicode friendly) API of the email " -"package. The remaining sections, starting with the :class:`~email.message." -"Message` class, cover the legacy :data:`~email.policy.compat32` API that " -"deals much more directly with the details of how email messages are " -"represented. The :data:`~email.policy.compat32` API does *not* hide the " -"details of the RFCs from the application, but for applications that need to " -"operate at that level, they can be useful tools. This documentation is also " -"relevant for applications that are still using the :mod:`~email.policy." -"compat32` API for backward compatibility reasons." +"package. The remaining sections, starting with " +"the :class:`~email.message.Message` class, cover the " +"legacy :data:`~email.policy.compat32` API that deals much more directly with " +"the details of how email messages are represented. " +"The :data:`~email.policy.compat32` API does *not* hide the details of the " +"RFCs from the application, but for applications that need to operate at that " +"level, they can be useful tools. This documentation is also relevant for " +"applications that are still using the :mod:`~email.policy.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." +"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 +237,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..cc680aef5 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,46 +64,64 @@ 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. :" -"class:`Policy` instances can be passed to various classes and methods in the " -"email package to alter the default behavior. The settable values and their " -"defaults are described below." +"control the behavior of various components of the email package during " +"use. :class:`Policy` instances can be passed to various classes and methods " +"in the 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, " -"and for the :class:`~email.message.Message` class, this is the :class:" -"`Compat32` policy, via its corresponding pre-defined instance :const:" -"`compat32`. This policy provides for complete backward compatibility (in " -"some cases, including bug compatibility) with the pre-Python3.3 version of " -"the email package." -msgstr "" - -#: ../../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 "" +"and for the :class:`~email.message.Message` class, this is " +"the :class:`Compat32` policy, via its corresponding pre-defined " +"instance :const:`compat32`. This policy provides for complete backward " +"compatibility (in 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 パッケージと完全な後方互換性を提供し" +"ます (場合によってはバグとの互換性も含みます)。" + +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 " -"created by a :mod:`~email.parser`, a policy passed to the parser will be the " -"policy used by the message it creates. If the message is created by the " -"program, then the policy can be specified when it is created. When a " -"message is passed to a :mod:`~email.generator`, the generator uses the " -"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." +"When a :class:`~email.message.Message` " +"or :class:`~email.message.EmailMessage` object is created, it acquires a " +"policy. If the message is created by a :mod:`~email.parser`, a policy " +"passed to the parser will be the policy used by the message it creates. If " +"the message is created by the program, then the policy can be specified when " +"it is created. When a message is passed to a :mod:`~email.generator`, the " +"generator uses the 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 +129,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 +144,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 " +"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 +188,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 +206,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 +233,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 +250,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 +260,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 +287,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,106 +310,139 @@ 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." +"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." +"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 " -"delimited, such that it would be parsed as multiple headers or joined with " -"adjacent data. Such headers can be generated by custom header classes or " -"bugs in the ``email`` module." +"If ``True`` (the default), the generator will " +"raise :exc:`~email.errors.HeaderWriteError` instead of writing a header that " +"is improperly folded or delimited, such that it would be parsed as multiple " +"headers or joined with 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." +"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 +450,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 +466,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 +474,30 @@ 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." +"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 +506,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 +525,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 +539,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 +556,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 +563,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 +587,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,15 +604,20 @@ 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 " "string that represents that header \"folded\" correctly (according to the " -"policy settings) by composing the *name* with the *value* and inserting :" -"attr:`linesep` characters at the appropriate places. See :rfc:`5322` for a " -"discussion of the rules for folding email headers." +"policy settings) by composing the *name* with the *value* and " +"inserting :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 +644,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 +691,47 @@ 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 " +"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,17 +741,34 @@ msgid "" "field types, and the major MIME header field stypes. Support for additional " "custom parsing will be added in the future." msgstr "" - -#: ../../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." -"EmailMessage.set_content` method of an :class:`~email.message.EmailMessage` " -"object is called, it calls the corresponding method of this object, passing " -"it the message object as its first argument, and any arguments or keywords " -"that were passed to it as additional arguments. By default " -"``content_manager`` is set to :data:`~email.contentmanager.raw_data_manager`." -msgstr "" +"ヘッダのフィールド名 ``name`` と折り返しを解除したフィールド値 ``value`` の " +"2 つの引数を取り、そのヘッダを表す文字列のサブクラスを返す呼び出し可能オブ" +"ジェクトです。\n" +"デフォルトの ``header_factory`` (:mod:`~email.headerregistry` を参照) " +"は、:RFC:`5322` の各種アドレス・日付ヘッダフィールドと、主要な MIME ヘッダ" +"フィールドに応じた解析をサポートしています。\n" +"今後、さらに独自の解析への対応が追加される予定です。" + +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.EmailMessage.set_content` method of " +"an :class:`~email.message.EmailMessage` object is called, it calls the " +"corresponding method of this object, passing it the message object as its " +"first argument, and any arguments or keywords 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 +776,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 +801,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 +818,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 +828,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 +845,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 +868,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,68 +888,84 @@ 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 " "words in the headers. Should only be used for SMTP transmission if the " -"sender or recipient addresses have non-ASCII characters (the :meth:`smtplib." -"SMTP.send_message` method handles this automatically)." +"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 "" -"From the application view, this means that any header obtained through the :" -"class:`~email.message.EmailMessage` is a header object with extra " +"From the application view, this means that any header obtained through " +"the :class:`~email.message.EmailMessage` is a header object with extra " "attributes, whose string value is the fully decoded unicode value of the " "header. Likewise, a header may be assigned a new value, or a new header " "created, using a unicode string, and the policy will take care of converting " @@ -770,8 +974,8 @@ msgstr "" #: ../../library/email.policy.rst:596 msgid "" -"The header objects and their attributes are described in :mod:`~email." -"headerregistry`." +"The header objects and their attributes are described " +"in :mod:`~email.headerregistry`." msgstr "" "ヘッダオブジェクトとその属性は :mod:`~email.headerregistry` で述べられていま" "す。" @@ -779,16 +983,17 @@ msgstr "" #: ../../library/email.policy.rst:603 msgid "" "This concrete :class:`Policy` is the backward compatibility policy. It " -"replicates the behavior of the email package in Python 3.2. The :mod:" -"`~email.policy` module also defines an instance of this class, :const:" -"`compat32`, that is used as the default policy. Thus the default behavior " -"of the email package is to maintain compatibility with Python 3.2." +"replicates the behavior of the email package in Python 3.2. " +"The :mod:`~email.policy` module also defines an instance of this " +"class, :const:`compat32`, that is used as the default policy. Thus the " +"default behavior of the email package is to maintain compatibility with " +"Python 3.2." msgstr "" #: ../../library/email.policy.rst:609 msgid "" -"The following attributes have values that are different from the :class:" -"`Policy` default:" +"The following attributes have values that are different from " +"the :class:`Policy` default:" msgstr "以下の属性は :class:`Policy` デフォルトとは異なる値を持ちます:" #: ../../library/email.policy.rst:615 @@ -799,22 +1004,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." +"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 +1034,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 +1055,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..e7bf1211e 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`" @@ -42,38 +41,39 @@ msgstr "" #: ../../library/email.utils.rst:16 msgid "" "Return local time as an aware datetime object. If called without arguments, " -"return current time. Otherwise *dt* argument should be a :class:`~datetime." -"datetime` instance, and it is converted to the local time zone according to " -"the system time zone database. If *dt* is naive (that is, ``dt.tzinfo`` is " -"``None``), it is assumed to be in local time." +"return current time. Otherwise *dt* argument should be " +"a :class:`~datetime.datetime` instance, and it is converted to the local " +"time zone according to the system time zone database. If *dt* is naive " +"(that is, ``dt.tzinfo`` is ``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 "" -"Returns a string suitable for an :rfc:`2822`\\ -compliant :mailheader:" -"`Message-ID` header. Optional *idstring* if given, is a string used to " -"strengthen the uniqueness of the message id. Optional *domain* if given " -"provides the portion of the msgid after the '@'. The default is the local " -"hostname. It is not normally necessary to override this default, but may be " -"useful certain cases, such as a constructing distributed system that uses a " -"consistent domain name across multiple hosts." +"Returns a string suitable for an :rfc:`2822`\\ " +"-compliant :mailheader:`Message-ID` header. Optional *idstring* if given, " +"is a string used to strengthen the uniqueness of the message id. Optional " +"*domain* if given provides the portion of the msgid after the '@'. The " +"default is the local hostname. It is not normally necessary to override " +"this default, but may be useful certain cases, such as a constructing " +"distributed system that uses a consistent domain name across multiple hosts." msgstr "" #: ../../library/email.utils.rst:37 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,33 +94,34 @@ 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 "" "The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form " -"``(realname, email_address)`` and returns the string value suitable for a :" -"mailheader:`To` or :mailheader:`Cc` header. If the first element of *pair* " -"is false, then the second element is returned unmodified." +"``(realname, email_address)`` and returns the string value suitable for " +"a :mailheader:`To` or :mailheader:`Cc` header. If the first element of " +"*pair* is false, then the second element is returned unmodified." msgstr "" ":meth:`parseaddr` の逆で、2 要素のタプル ``(realname, email_address)`` を取っ" "て :mailheader:`To` や :mailheader:`Cc` ヘッダに適した文字列を返します。タプ" @@ -130,12 +131,13 @@ msgstr "" msgid "" "Optional *charset* is the character set that will be used in the :rfc:`2047` " "encoding of the ``realname`` if the ``realname`` contains non-ASCII " -"characters. Can be an instance of :class:`str` or a :class:`~email.charset." -"Charset`. Defaults to ``utf-8``." +"characters. Can be an instance of :class:`str` or " +"a :class:`~email.charset.Charset`. Defaults to ``utf-8``." msgstr "" -"任意の *charset* は、 ``realname`` が非 ASCII 文字を含んでいる場合にその :" -"rfc:`2047` エンコーディングに使われる文字集合です。:class:`str` か :class:" -"`~email.charset.Charset` のインスタンスで、デフォルトは ``utf-8`` です。" +"任意の *charset* は、 ``realname`` が非 ASCII 文字を含んでいる場合にそ" +"の :rfc:`2047` エンコーディングに使われる文字集合です。:class:`str` " +"か :class:`~email.charset.Charset` のインスタンスで、デフォルトは ``utf-8`` " +"です。" #: ../../library/email.utils.rst:85 msgid "Added the *charset* option." @@ -148,11 +150,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,15 +162,22 @@ 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 "" "Attempts to parse a date according to the rules in :rfc:`2822`. however, " "some mailers don't follow that format as specified, so :func:`parsedate` " -"tries to guess correctly in such cases. *date* is a string containing an :" -"rfc:`2822` date, such as ``\"Mon, 20 Nov 1995 19:12:08 -0500\"``. If it " -"succeeds in parsing the date, :func:`parsedate` returns a 9-tuple that can " -"be passed directly to :func:`time.mktime`; otherwise ``None`` will be " +"tries to guess correctly in such cases. *date* is a string containing " +"an :rfc:`2822` date, such as ``\"Mon, 20 Nov 1995 19:12:08 -0500\"``. If " +"it succeeds in parsing the date, :func:`parsedate` returns a 9-tuple that " +"can be passed directly to :func:`time.mktime`; otherwise ``None`` will be " "returned. Note that indexes 6, 7, and 8 of the result tuple are not usable." msgstr "" ":rfc:`2822` の規則に基づいて日付の解析を試みます。\n" @@ -183,7 +190,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,18 +199,27 @@ 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 "" -"The inverse of :func:`format_datetime`. Performs the same function as :func:" -"`parsedate`, but on success returns a :mod:`~datetime.datetime`; otherwise " -"``ValueError`` is raised if *date* contains an invalid value such as an hour " -"greater than 23 or a timezone offset not between -24 and 24 hours. If the " -"input date has a timezone of ``-0000``, the ``datetime`` will be a naive " -"``datetime``, and if the date is conforming to the RFCs it will represent a " -"time in UTC but with no indication of the actual source timezone of the " -"message the date comes from. If the input date has any other valid timezone " -"offset, the ``datetime`` will be an aware ``datetime`` with the " +"The inverse of :func:`format_datetime`. Performs the same function " +"as :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`; " +"otherwise ``ValueError`` is raised if *date* contains an invalid value such " +"as an hour greater than 23 or a timezone offset not between -24 and 24 " +"hours. If the input date has a timezone of ``-0000``, the ``datetime`` will " +"be a naive ``datetime``, and if the date is conforming to the RFCs it will " +"represent a time in UTC but with no indication of the actual source timezone " +"of the message the date comes from. If the input date has any other valid " +"timezone offset, the ``datetime`` will be an aware ``datetime`` with the " "corresponding a :class:`~datetime.timezone` :class:`~datetime.tzinfo`." msgstr "" @@ -222,15 +237,14 @@ 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 "" -"Optional *timeval* if given is a floating-point time value as accepted by :" -"func:`time.gmtime` and :func:`time.localtime`, otherwise the current time is " -"used." +"Optional *timeval* if given is a floating-point time value as accepted " +"by :func:`time.gmtime` and :func:`time.localtime`, otherwise the current " +"time is used." msgstr "" #: ../../library/email.utils.rst:165 @@ -289,25 +303,25 @@ msgstr "" #: ../../library/email.utils.rst:205 msgid "" -"When a header parameter is encoded in :rfc:`2231` format, :meth:`Message." -"get_param ` may return a 3-tuple containing " -"the character set, language, and value. :func:`collapse_rfc2231_value` " -"turns this into a unicode string. Optional *errors* is passed to the " -"*errors* argument of :class:`str`'s :func:`~str.encode` method; it defaults " -"to ``'replace'``. Optional *fallback_charset* specifies the character set " -"to use if the one in the :rfc:`2231` header is not known by Python; it " -"defaults to ``'us-ascii'``." +"When a header parameter is encoded in :rfc:`2231` " +"format, :meth:`Message.get_param ` may " +"return a 3-tuple containing the character set, language, and " +"value. :func:`collapse_rfc2231_value` turns this into a unicode string. " +"Optional *errors* is passed to the *errors* argument " +"of :class:`str`'s :func:`~str.encode` method; it defaults to ``'replace'``. " +"Optional *fallback_charset* specifies the character set to use if the one in " +"the :rfc:`2231` header is not known by Python; it defaults to ``'us-ascii'``." msgstr "" -"ヘッダのパラメータが :rfc:`2231` 形式でエンコードされている場合、 :meth:" -"`Message.get_param ` は 3 要素からなるタプル" -"を返すことがあります。ここには、そのパラメータの文字セット、言語、および値の" -"順に格納されています。 :func:`collapse_rfc2231_value` はこのパラメータをひと" -"つの Unicode 文字列にまとめます。オプション引数 *errors* は :class:`str` の :" -"func:`~str.encode` メソッドの引数 *errors* に渡されます。このデフォルト値は " -"``'replace'`` となっています。オプション引数 *fallback_charset* は、もし :" -"rfc:`2231` ヘッダの使用している文字セットが Python の知っているものではなかっ" -"た場合の非常用文字セットとして使われます。デフォルトでは、この値は ``'us-" -"ascii'`` です。" +"ヘッダのパラメータが :rfc:`2231` 形式でエンコードされている場" +"合、 :meth:`Message.get_param ` は 3 要素か" +"らなるタプルを返すことがあります。ここには、そのパラメータの文字セット、言" +"語、および値の順に格納されています。 :func:`collapse_rfc2231_value` はこのパ" +"ラメータをひとつの Unicode 文字列にまとめます。オプション引数 *errors* " +"は :class:`str` の :func:`~str.encode` メソッドの引数 *errors* に渡されます。" +"このデフォルト値は ``'replace'`` となっています。オプション引数 " +"*fallback_charset* は、もし :rfc:`2231` ヘッダの使用している文字セットが " +"Python の知っているものではなかった場合の非常用文字セットとして使われます。デ" +"フォルトでは、この値は ``'us-ascii'`` です。" #: ../../library/email.utils.rst:214 msgid "" @@ -318,13 +332,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" @@ -337,5 +351,5 @@ msgid "" "follows the POSIX standard while this module follows :rfc:`2822`." msgstr "" "注意: この時間帯のオフセット値は ``time.timezone`` の値と符号が逆です。これ" -"は ``time.timezone`` が POSIX 標準に準拠しているのに対して、こちらは :rfc:" -"`2822` に準拠しているからです。" +"は ``time.timezone`` が POSIX 標準に準拠しているのに対して、こちら" +"は :rfc:`2822` に準拠しているからです。" diff --git a/library/ensurepip.po b/library/ensurepip.po index 75c084f9f..421736f84 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,17 @@ 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 +110,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 +138,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 +166,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 "" @@ -273,8 +277,8 @@ msgstr "" #: ../../library/ensurepip.rst:139 msgid "" -"The bootstrapping process has side effects on both ``sys.path`` and ``os." -"environ``. Invoking the command line interface in a subprocess instead " +"The bootstrapping process has side effects on both ``sys.path`` and " +"``os.environ``. Invoking the command line interface in a subprocess instead " "allows these side effects to be avoided." msgstr "" "ブートストラップ処理は ``sys.path``, ``os.environ`` の両方に対して副作用を持" diff --git a/library/enum.po b/library/enum.po index 2c1e46e82..cf02be74f 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 "" @@ -159,8 +168,8 @@ msgstr ":class:`IntEnum`" #: ../../library/enum.rst:77 msgid "" -"Base class for creating enumerated constants that are also subclasses of :" -"class:`int`. (`Notes`_)" +"Base class for creating enumerated constants that are also subclasses " +"of :class:`int`. (`Notes`_)" msgstr "" ":class:`int` のサブクラスでもある列挙型定数を作成する基底クラスです。" "(`Notes`_)" @@ -171,8 +180,8 @@ msgstr ":class:`StrEnum`" #: ../../library/enum.rst:82 msgid "" -"Base class for creating enumerated constants that are also subclasses of :" -"class:`str`. (`Notes`_)" +"Base class for creating enumerated constants that are also subclasses " +"of :class:`str`. (`Notes`_)" msgstr "" ":class:`str` のサブクラスでもある列挙型定数を作成する基底クラスです。" "(`Notes`_)" @@ -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`" @@ -196,8 +205,9 @@ msgstr ":class:`IntFlag`" #: ../../library/enum.rst:92 msgid "" "Base class for creating enumerated constants that can be combined using the " -"bitwise operators without losing their :class:`IntFlag` membership. :class:" -"`IntFlag` members are also subclasses of :class:`int`. (`Notes`_)" +"bitwise operators without losing their :class:`IntFlag` " +"membership. :class:`IntFlag` members are also subclasses of :class:`int`. " +"(`Notes`_)" msgstr "" "列挙型定数を作成する基底クラスで、ビット演算子を使って組み合わせられ、その結" "果も :class:`IntFlag` メンバーになります。\n" @@ -225,9 +235,9 @@ msgid "" "``UNIQUE``, for use with :func:`verify` to ensure various constraints are " "met by a given enumeration." msgstr "" -"``CONTINUOUS``、``NAMED_FLAGS``、``UNIQUE`` の値を持つ列挙型です。 :func:" -"`verify` と共に使用して、指定された列挙型がさまざまな制約を満たしていることを" -"確認します。" +"``CONTINUOUS``、``NAMED_FLAGS``、``UNIQUE`` の値を持つ列挙型で" +"す。 :func:`verify` と共に使用して、指定された列挙型がさまざまな制約を満たし" +"ていることを確認します。" #: ../../library/enum.rst:107 msgid ":class:`FlagBoundary`" @@ -242,13 +252,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`" @@ -256,9 +266,9 @@ msgstr ":class:`auto`" #: ../../library/enum.rst:119 msgid "" -"Instances are replaced with an appropriate value for Enum members. :class:" -"`StrEnum` defaults to the lower-cased version of the member name, while " -"other Enums default to 1 and increase from there." +"Instances are replaced with an appropriate value for Enum " +"members. :class:`StrEnum` defaults to the lower-cased version of the member " +"name, while other Enums default to 1 and increase from there." msgstr "" "インスタンスは列挙型のメンバーに適切な値で置き換えられます。:class:`StrEnum` " "ではデフォルトの値がメンバー名を小文字にしたものですが、その他の列挙型のデ" @@ -292,11 +302,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 +329,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 +358,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 +375,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." +"``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 +424,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 +442,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 +474,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 +481,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,77 +502,86 @@ 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` を送出します::" +"Returns the Enum member in *cls* matching *name*, or raises " +"a :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 "" -"Adds a new name as an alias to an existing member. Raises a :exc:" -"`NameError` if the name is already assigned to a different member." +"Adds a new name as an alias to an existing member. Raises " +"a :exc:`NameError` if the name is already assigned to a different member." msgstr "" #: ../../library/enum.rst:261 msgid "" -"Adds a new value as an alias to an existing member. Raises a :exc:" -"`ValueError` if the value is already linked with a different member." +"Adds a new value as an alias to an existing member. Raises " +"a :exc:`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 +591,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 +629,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 "" @@ -628,8 +659,8 @@ msgstr "" #: ../../library/enum.rst:319 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " -"names will also be removed from the completed enumeration. See :ref:" -"`TimePeriod ` for an example." +"names will also be removed from the completed enumeration. " +"See :ref:`TimePeriod ` for an example." msgstr "" "``_ignore_`` は、メンバーにならず、作成された列挙から削除される名前のリストで" "す。例については、:ref:`TimePeriod ` を参照してください。" @@ -639,8 +670,8 @@ msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" msgstr "" -" ``['__class__', '__doc__', '__module__', 'name', 'value']`` と *self." -"__class__* に定義されたpublicなメソッドを返します::" +" ``['__class__', '__doc__', '__module__', 'name', 'value']`` と " +"*self.__class__* に定義されたpublicなメソッドを返します::" #: ../../library/enum.rst:328 msgid "" @@ -692,8 +723,8 @@ msgstr "定義済みの値のリスト。" #: ../../library/enum.rst:351 msgid "" -"A *staticmethod* that is used to determine the next value returned by :class:" -"`auto`::" +"A *staticmethod* that is used to determine the next value returned " +"by :class:`auto`::" msgstr "" ":class:`auto` によって返される次の値を決定するために使用される " "*staticmethod* です::" @@ -775,16 +806,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 "" @@ -804,8 +836,8 @@ msgid "" "... cls_name = self.__class__.__name__\n" "... return f'{cls_name}.{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" msgstr "" @@ -826,8 +858,8 @@ msgid "" "... def __str__(self):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" msgstr "" @@ -849,8 +881,8 @@ msgid "" "... def __format__(self, spec):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" msgstr "" @@ -866,13 +898,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 "" @@ -889,8 +924,9 @@ msgid "" "already :meth:`!int.__format__` for that same reason." msgstr "" ":meth:`~object.__str__` は、既存の定数を置き換えるユースケースをより良くサ" -"ポートするために :meth:`!int.__str__` に変更されました。同じ理由で、:meth:" -"`~object.__format__` は既に :meth:`!int.__format__` に変更されています。" +"ポートするために :meth:`!int.__str__` に変更されました。同じ理由" +"で、:meth:`~object.__format__` は既に :meth:`!int.__format__` に変更されてい" +"ます。" #: ../../library/enum.rst:507 msgid "" @@ -930,18 +966,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 +997,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 +1050,6 @@ msgstr "" "メンバーがflagに含まれている場合は *True* を返し、それ以外の場合は *False* を" "返します::" -#: ../../library/enum.rst:584 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1001,46 +1059,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 +1121,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 +1144,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 +1164,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" +"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 "" @@ -1127,8 +1212,9 @@ msgid "" "was already :meth:`!int.__format__` for that same reason." msgstr "" ":meth:`~object.__str__` は、既存の定数を置き換えるユースケースをより良くサ" -"ポートするために :meth:`!int.__str__` に変更されました。同じ理由で、:meth:" -"`~object.__format__` は既に :meth:`!int.__format__` に変更されています。" +"ポートするために :meth:`!int.__str__` に変更されました。同じ理由" +"で、:meth:`~object.__format__` は既に :meth:`!int.__format__` に変更されてい" +"ます。" #: ../../library/enum.rst:687 msgid "" @@ -1140,44 +1226,41 @@ 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 "" -"Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" -"`format` of the mixed-in data type instead of using the :class:`Enum`-" -"default :meth:`str() `." +"Inherit from :class:`!ReprEnum` to keep the :class:`str() " +"` / :func:`format` of the mixed-in data type instead of using " +"the :class:`Enum`-default :meth:`str() `." msgstr "" ":class:`!ReprEnum` を継承することで、:class:`Enum` デフォルトの :meth:`str() " "` を使用する代わりに、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 +1273,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 +1290,6 @@ msgid "" "the highest-valued member::" msgstr "最小値のメンバーと最大値のメンバーの間に欠損値がないことを確認します::" -#: ../../library/enum.rst:732 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1209,16 +1301,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 +1333,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 +1353,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." +"``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 +1368,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 +1382,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::" +"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 +1411,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`." +"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 +1444,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 +1461,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:`|= `." +"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,23 +1526,22 @@ 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 "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" -":attr:`~Enum._ignore_` -- 名前のリストで、 :class:`list` もしくは :class:" -"`str` です。この名前の要素はメンバーへの変換が行われず、最終的なクラスから削" -"除されます。" +":attr:`~Enum._ignore_` -- 名前のリストで、 :class:`list` もしく" +"は :class:`str` です。この名前の要素はメンバーへの変換が行われず、最終的なク" +"ラスから削除されます。" #: ../../library/enum.rst:878 msgid "" @@ -1402,13 +1549,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 +1572,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 +1593,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" @@ -1457,10 +1605,11 @@ msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " "appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " -"value will be the last value plus one; for :class:`Flag` and :class:" -"`IntFlag` it will be the first power-of-two greater than the highest value; " -"for :class:`StrEnum` it will be the lower-cased version of the member's " -"name. Care must be taken if mixing *auto()* with manually specified values." +"value will be the last value plus one; for :class:`Flag` " +"and :class:`IntFlag` it will be the first power-of-two greater than the " +"highest value; for :class:`StrEnum` it will be the lower-cased version of " +"the member's name. Care must be taken if mixing *auto()* with manually " +"specified values." msgstr "" #: ../../library/enum.rst:916 @@ -1535,11 +1684,10 @@ msgid "" "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " "if any are found :exc:`ValueError` is raised with the details::" msgstr "" -"列挙型専用の :keyword:`class` デコレーターです。列挙型の :attr:`~EnumType." -"__members__` に別名がないかどうか検索します; 見つかった場合、:exc:" -"`ValueError` が詳細情報とともに送出されます::" +"列挙型専用の :keyword:`class` デコレーターです。列挙型" +"の :attr:`~EnumType.__members__` に別名がないかどうか検索します; 見つかった場" +"合、:exc:`ValueError` が詳細情報とともに送出されます::" -#: ../../library/enum.rst:955 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1553,12 +1701,23 @@ 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 "" -"A :keyword:`class` decorator specifically for enumerations. Members from :" -"class:`EnumCheck` are used to specify which constraints should be checked on " -"the decorated enumeration." +"A :keyword:`class` decorator specifically for enumerations. Members " +"from :class:`EnumCheck` are used to specify which constraints should be " +"checked on the decorated enumeration." msgstr "" "列挙型専用の :keyword:`class` デコレーターです。対象の列挙型に対してチェック" "を行う制約の指定には :class:`EnumCheck` のメンバーが使用されます。" @@ -1571,13 +1730,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 +1781,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..2462528a6 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 @@ -50,8 +50,8 @@ msgstr "" #: ../../library/errno.rst:21 msgid "" -"To translate a numeric error code to an error message, use :func:`os." -"strerror`." +"To translate a numeric error code to an error message, " +"use :func:`os.strerror`." msgstr "" "数値のエラーコードをエラーメッセージに変換するには、 :func:`os.strerror` を" "使ってください。" @@ -63,33 +63,37 @@ msgid "" "available as ``errno.errorcode.keys()``. Symbols available can include:" msgstr "" "以下のリストの内、現在のプラットフォームで使われていないシンボルはモジュール" -"上で定義されていません。定義されているシンボルだけを挙げたリストは ``errno." -"errorcode.keys()`` として取得することができます。取得できるシンボルには以下の" -"ようなものがあります:" +"上で定義されていません。定義されているシンボルだけを挙げたリストは " +"``errno.errorcode.keys()`` として取得することができます。取得できるシンボルに" +"は以下のようなものがあります:" -#: ../../library/errno.rst:30 msgid "" -"Operation not permitted. This error is mapped to the exception :exc:" -"`PermissionError`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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`." +"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..ce809caa6 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 @@ -32,12 +32,13 @@ msgstr "組み込み例外" #: ../../library/exceptions.rst:10 msgid "" -"In Python, all exceptions must be instances of a class that derives from :" -"class:`BaseException`. In a :keyword:`try` statement with an :keyword:" -"`except` clause that mentions a particular class, that clause also handles " -"any exception classes derived from that class (but not exception classes " -"from which *it* is derived). Two exception classes that are not related via " -"subclassing are never equivalent, even if they have the same name." +"In Python, all exceptions must be instances of a class that derives " +"from :class:`BaseException`. In a :keyword:`try` statement with " +"an :keyword:`except` clause that mentions a particular class, that clause " +"also handles any exception classes derived from that class (but not " +"exception classes from which *it* is derived). Two exception classes that " +"are not related via subclassing are never equivalent, even if they have the " +"same name." msgstr "" "Python において、すべての例外は :class:`BaseException` から派生したクラスのイ" "ンスタンスでなければなりません。特定のクラスを言及する :keyword:`except` 節を" @@ -77,10 +78,10 @@ msgstr "" #: ../../library/exceptions.rst:31 msgid "" "The built-in exception classes can be subclassed to define new exceptions; " -"programmers are encouraged to derive new exceptions from the :exc:" -"`Exception` class or one of its subclasses, and not from :exc:" -"`BaseException`. More information on defining exceptions is available in " -"the Python Tutorial under :ref:`tut-userexceptions`." +"programmers are encouraged to derive new exceptions from " +"the :exc:`Exception` class or one of its subclasses, and not " +"from :exc:`BaseException`. More information on defining exceptions is " +"available in the Python Tutorial under :ref:`tut-userexceptions`." msgstr "" "組み込み例外クラスは新たな例外を定義するためにサブクラス化することができま" "す。新しい例外は、:exc:`Exception` クラスかそのサブクラスの一つから派生するこ" @@ -92,33 +93,34 @@ 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 " -"set to the handled exception. An exception may be handled when an :keyword:" -"`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is " -"used." +"set to the handled exception. An exception may be handled when " +"an :keyword:`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 +131,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 "" @@ -147,9 +150,9 @@ msgid "" msgstr "" "デフォルトの traceback 表示コードは、例外自体の traceback に加え、これらの連" "鎖された例外を表示します。:attr:`!__cause__` で明示的に連鎖させた例外は、存在" -"するならば常に表示されます。:attr:`!__context__` で暗黙に連鎖させた例外は、:" -"attr:`!__cause__` が :const:`None` かつ :attr:`!__suppress_context__` が " -"false の場合にのみ表示されます。" +"するならば常に表示されます。:attr:`!__context__` で暗黙に連鎖させた例外" +"は、:attr:`!__cause__` が :const:`None` かつ :attr:`!__suppress_context__` " +"が false の場合にのみ表示されます。" #: ../../library/exceptions.rst:80 msgid "" @@ -164,23 +167,33 @@ 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 " -"impossible to create a subclass that inherits from multiple exception types. " -"The memory layout of a type is an implementation detail and might change " -"between Python versions, leading to new conflicts in the future. Therefore, " -"it's recommended to avoid subclassing multiple exception types altogether." +"Most built-in exceptions are implemented in C for efficiency, " +"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which " +"makes it impossible to create a subclass that inherits from multiple " +"exception types. The memory layout of a type is an implementation detail and " +"might change 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" @@ -195,9 +208,9 @@ msgstr "以下の例外は、主に他の例外の基底クラスとして使わ #: ../../library/exceptions.rst:111 msgid "" "The base class for all built-in exceptions. It is not meant to be directly " -"inherited by user-defined classes (for that, use :exc:`Exception`). If :" -"func:`str` is called on an instance of this class, the representation of the " -"argument(s) to the instance are returned, or the empty string when there " +"inherited by user-defined classes (for that, use :exc:`Exception`). " +"If :func:`str` is called on an instance of this class, the representation of " +"the argument(s) to the instance are returned, or the empty string when there " "were no arguments." msgstr "" "全ての組み込み例外の基底クラスです。ユーザ定義の例外に直接継承されることは意" @@ -213,11 +226,10 @@ msgid "" "usually called only with a single string giving an error message." msgstr "" "例外コンストラクタに与えられた引数のタプルです。組み込み例外は普通、エラー" -"メッセージを与える一つの文字列だけを引数として呼ばれますが、中には (:exc:" -"`OSError` など) いくつかの引数を必要とし、このタプルの要素に特別な意味を込め" -"るものもあります。" +"メッセージを与える一つの文字列だけを引数として呼ばれますが、中には " +"(:exc:`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 +240,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 +258,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 "" @@ -256,11 +284,12 @@ msgstr "" #: ../../library/exceptions.rst:157 msgid "" -"A list of the notes of this exception, which were added with :meth:" -"`add_note`. This attribute is created when :meth:`add_note` is called." +"A list of the notes of this exception, which were added " +"with :meth:`add_note`. This attribute is created when :meth:`add_note` is " +"called." msgstr "" -":meth:`add_note` で追加された例外のノートのリスト。この属性は :meth:" -"`add_note` を呼び出すと生成されます。" +":meth:`add_note` で追加された例外のノートのリスト。この属性" +"は :meth:`add_note` を呼び出すと生成されます。" #: ../../library/exceptions.rst:165 msgid "" @@ -273,11 +302,12 @@ msgstr "" #: ../../library/exceptions.rst:171 msgid "" "The base class for those built-in exceptions that are raised for various " -"arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" -"`FloatingPointError`." +"arithmetic " +"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." msgstr "" -"算術上の様々なエラーに対して送出される組み込み例外 :exc:`OverflowError`, :" -"exc:`ZeroDivisionError`, :exc:`FloatingPointError` の基底クラスです。" +"算術上の様々なエラーに対して送出される組み込み例" +"外 :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError` " +"の基底クラスです。" #: ../../library/exceptions.rst:178 msgid "" @@ -294,8 +324,8 @@ msgid "" "This can be raised directly by :func:`codecs.lookup`." msgstr "" "マッピングまたはシーケンスで使われたキーやインデクスが無効な場合に送出される" -"例外 :exc:`IndexError` および :exc:`KeyError` の基底クラスです。 :func:" -"`codecs.lookup` によって直接送出されることもあります。" +"例外 :exc:`IndexError` および :exc:`KeyError` の基底クラスで" +"す。 :func:`codecs.lookup` によって直接送出されることもあります。" #: ../../library/exceptions.rst:190 msgid "Concrete exceptions" @@ -337,8 +367,9 @@ msgstr ":attr:`name` および :attr:`obj` 属性が追加されました。" #: ../../library/exceptions.rst:217 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " -"without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." -"IOBase.readline` methods return an empty string when they hit EOF.)" +"without reading any data. (N.B.: the :meth:`io.IOBase.read` " +"and :meth:`io.IOBase.readline` methods return an empty string when they hit " +"EOF.)" msgstr "" ":func:`input` が何もデータを読まずに end-of-file (EOF) に達した場合に送出され" "ます。(注意: :meth:`io.IOBase.read` と :meth:`io.IOBase.readline` メソッド" @@ -350,17 +381,16 @@ msgstr "現在は使われていません。" #: ../../library/exceptions.rst:229 msgid "" -"Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" -"`generator.close` and :meth:`coroutine.close`. It directly inherits from :" -"exc:`BaseException` instead of :exc:`Exception` since it is technically not " -"an error." +"Raised when a :term:`generator` or :term:`coroutine` is closed; " +"see :meth:`generator.close` and :meth:`coroutine.close`. It directly " +"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is " +"technically not an error." msgstr "" ":term:`ジェネレータ ` や :term:`コルーチン ` が閉じられ" "たときに送出されます。 :meth:`generator.close` と :meth:`coroutine.close` を" -"参照してください。この例外は厳密に言えばエラーではないので、 :exc:" -"`Exception` ではなく :exc:`BaseException` を直接継承しています。" +"参照してください。この例外は厳密に言えばエラーではないの" +"で、 :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 +398,8 @@ msgid "" msgstr "" ":keyword:`import` 文でモジュールをロードしようとして問題が発生すると送出され" "ます。\n" -"``from ... import`` の中の\"from list\" (訳注:``...`` の部分)の名前が見つか" -"らないときにも送出されます。" +"``from ... import`` の \"from list\" に、見つからない名前が含まれている場合に" +"も送出されます。" #: ../../library/exceptions.rst:241 msgid "" @@ -394,8 +424,8 @@ msgstr ":attr:`name` および :attr:`path` 属性が追加されました。" #: ../../library/exceptions.rst:257 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " -"module could not be located. It is also raised when ``None`` is found in :" -"data:`sys.modules`." +"module could not be located. It is also raised when ``None`` is found " +"in :data:`sys.modules`." msgstr "" ":exc:`ImportError` のサブクラスで、:keyword:`import` 文でモジュールが見つから" "ない場合に送出されます。また、 :data:`sys.modules` に ``None`` が含まれる場合" @@ -421,9 +451,9 @@ msgstr "" #: ../../library/exceptions.rst:282 msgid "" -"Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" -"kbd:`Delete`). During execution, a check for interrupts is made regularly. " -"The exception inherits from :exc:`BaseException` so as to not be " +"Raised when the user hits the interrupt key (normally :kbd:`Control-C` " +"or :kbd:`Delete`). During execution, a check for interrupts is made " +"regularly. The exception inherits from :exc:`BaseException` so as to not be " "accidentally caught by code that catches :exc:`Exception` and thus prevent " "the interpreter from exiting." msgstr "" @@ -432,7 +462,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,16 +469,24 @@ 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 "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " "indicating what kind of (internal) operation ran out of memory. Note that " -"because of the underlying memory management architecture (C's :c:func:" -"`malloc` function), the interpreter may not always be able to completely " -"recover from this situation; it nevertheless raises an exception so that a " -"stack traceback can be printed, in case a run-away program was the cause." +"because of the underlying memory management architecture " +"(C's :c:func:`malloc` function), the interpreter may not always be able to " +"completely recover from this situation; it nevertheless raises an exception " +"so that a stack traceback can be printed, in case a run-away program was the " +"cause." msgstr "" "ある操作中にメモリが不足したが、その状況は (オブジェクトをいくつか消去するこ" "とで) まだ復旧可能かもしれない場合に送出されます。この例外の関連値は、メモリ" @@ -482,40 +519,45 @@ 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." +"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 "" "This exception is raised when a system function returns a system-related " -"error, including I/O failures such as \"file not found\" or \"disk " -"full\" (not for illegal argument types or other incidental errors)." +"error, including I/O failures such as \"file not found\" or \"disk full\" " +"(not for illegal argument types or other incidental errors)." msgstr "" "この例外はシステム関数がシステム関連のエラーを返した場合に送出されます。例え" "ば \"file not found\" や \"disk full\" のような I/O の失敗が発生したときです " @@ -525,47 +567,47 @@ msgstr "" msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " -"For backwards compatibility, if three arguments are passed, the :attr:" -"`~BaseException.args` attribute contains only a 2-tuple of the first two " -"constructor arguments." +"For backwards compatibility, if three arguments are passed, " +"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the " +"first two constructor arguments." msgstr "" "コンストラクタの2番目の形式は下記の対応する属性を設定します。指定されなかった" "場合属性はデフォルトで :const:`None` です。後方互換性のために、引数が3つ渡さ" "れた場合、: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 " -"final :attr:`.errno` value. This behaviour only occurs when constructing :" -"exc:`OSError` directly or via an alias, and is not inherited when " -"subclassing." +"final :attr:`.errno` value. This behaviour only occurs when " +"constructing :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." +"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 "" -"Under Windows, if the *winerror* constructor argument is an integer, the :" -"attr:`.errno` attribute is determined from the Windows error code, and the " -"*errno* argument is ignored. On other platforms, the *winerror* argument is " -"ignored, and the :attr:`winerror` attribute does not exist." +"Under Windows, if the *winerror* constructor argument is an integer, " +"the :attr:`.errno` attribute is determined from the Windows error code, and " +"the *errno* argument is ignored. On other platforms, the *winerror* " +"argument is ignored, and the :attr:`winerror` attribute does not exist." msgstr "" "Windows では、*winerror* コンストラクタ引数が整数の場合 :attr:`.errno` 属性" "は Windows エラーコードから決定され、*errno* 引数は無視されます。他のプラット" @@ -575,8 +617,8 @@ msgstr "" #: ../../library/exceptions.rst:383 msgid "" "The corresponding error message, as provided by the operating system. It is " -"formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" -"`FormatMessage` under Windows." +"formatted by the C functions :c:func:`perror` under POSIX, " +"and :c:func:`FormatMessage` under Windows." msgstr "" "OS が提供するような、対応するエラーメッセージです。\n" "POSIX では :c:func:`perror` で、Windows では :c:func:`FormatMessage` で体裁化" @@ -584,47 +626,47 @@ msgstr "" #: ../../library/exceptions.rst:391 msgid "" -"For exceptions that involve a file system path (such as :func:`open` or :" -"func:`os.unlink`), :attr:`filename` is the file name passed to the function. " -"For functions that involve two file system paths (such as :func:`os." -"rename`), :attr:`filename2` corresponds to the second file name passed to " -"the function." +"For exceptions that involve a file system path (such as :func:`open` " +"or :func:`os.unlink`), :attr:`filename` is the file name passed to the " +"function. For functions that involve two file system paths (such " +"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name " +"passed to the function." msgstr "" -"ファイルシステムパスが1つ関与する例外 (例えば :func:`open` や :func:`os." -"unlink`) の場合、:attr:`filename` は関数に渡されたファイル名です。\n" -"ファイルシステムパスが2つ関与する関数 (例えば :func:`os.rename`) の場合、:" -"attr:`filename2` は関数に渡された2つ目のファイル名です。" +"ファイルシステムパスが1つ関与する例外 (例えば :func:`open` " +"や :func:`os.unlink`) の場合、:attr:`filename` は関数に渡されたファイル名で" +"す。\n" +"ファイルシステムパスが2つ関与する関数 (例えば :func:`os.rename`) の場" +"合、:attr:`filename2` は関数に渡された2つ目のファイル名です。" #: ../../library/exceptions.rst:398 msgid "" -":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." -"error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" -"`OSError`, and the constructor may return a subclass." +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " +"and :exc:`mmap.error` have been merged into :exc:`OSError`, and the " +"constructor may return a subclass." msgstr "" -":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." -"error`, :exc:`select.error`, :exc:`mmap.error` が :exc:`OSError` に統合されま" -"した。コンストラクタはサブクラスを返すかもしれません。" +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.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." +"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 "" "Raised when the result of an arithmetic operation is too large to be " -"represented. This cannot occur for integers (which would rather raise :exc:" -"`MemoryError` than give up). However, for historical reasons, OverflowError " -"is sometimes raised for integers that are outside a required range. " -"Because of the lack of standardization of floating-point exception handling " -"in C, most floating-point operations are not checked." +"represented. This cannot occur for integers (which would rather " +"raise :exc:`MemoryError` than give up). However, for historical reasons, " +"OverflowError is sometimes raised for integers that are outside a required " +"range. Because of the lack of standardization of floating-point exception " +"handling in C, most floating-point operations are not checked." msgstr "" "算術演算の結果が表現できない大きな値になった場合に送出されます。これは整数で" "は起こりません (むしろ :exc:`MemoryError` が送出されることになるでしょう)。し" @@ -632,26 +674,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:" +"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,24 +708,25 @@ 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 "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"interpreter detects that the maximum recursion depth " +"(see :func:`sys.getrecursionlimit`) is exceeded." msgstr "" "この例外は :exc:`RuntimeError` を継承しています。インタープリタが最大再帰深" "度 (:func:`sys.getrecursionlimit` を参照) の超過を検出すると送出されます。" #: ../../library/exceptions.rst:455 msgid "" -"This exception is raised when a weak reference proxy, created by the :func:" -"`weakref.proxy` function, is used to access an attribute of the referent " -"after it has been garbage collected. For more information on weak " +"This exception is raised when a weak reference proxy, created by " +"the :func:`weakref.proxy` function, is used to access an attribute of the " +"referent after it has been garbage collected. For more information on weak " "references, see the :mod:`weakref` module." msgstr "" ":func:`weakref.proxy` によって生成された弱参照 (weak reference) プロキシを" @@ -701,9 +745,9 @@ msgstr "" #: ../../library/exceptions.rst:470 msgid "" -"Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" -"`~iterator.__next__` method to signal that there are no further items " -"produced by the iterator." +"Raised by built-in function :func:`next` and " +"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " +"there are no further items produced by the iterator." msgstr "" "組込み関数 :func:`next` と :term:`iterator` の :meth:`~iterator.__next__` メ" "ソッドによって、そのイテレータが生成するアイテムがこれ以上ないことを伝えるた" @@ -712,20 +756,21 @@ msgstr "" #: ../../library/exceptions.rst:476 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " -"as an argument when constructing the exception, and defaults to :const:" -"`None`." +"as an argument when constructing the exception, and defaults " +"to :const:`None`." msgstr "" "この例外オブジェクトには一つの属性 :attr:`!value` があり、例外を構成する際に" "引数として与えられ、デフォルトは :const:`None` です。" #: ../../library/exceptions.rst:480 msgid "" -"When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" -"`StopIteration` instance is raised, and the value returned by the function " -"is used as the :attr:`value` parameter to the constructor of the exception." +"When a :term:`generator` or :term:`coroutine` function returns, a " +"new :exc:`StopIteration` instance is raised, and the value returned by the " +"function is used as the :attr:`value` parameter to the constructor of the " +"exception." msgstr "" -":term:`generator` や :term:`coroutine` 関数が返るとき、新しい :exc:" -"`StopIteration` インスタンスが送出されます。\n" +":term:`generator` や :term:`coroutine` 関数が返るとき、新し" +"い :exc:`StopIteration` インスタンスが送出されます。\n" "関数の返り値は例外のコンストラクタの :attr:`value` 引数として使われます。" #: ../../library/exceptions.rst:485 @@ -762,24 +807,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)." +"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 "" @@ -846,8 +891,8 @@ msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" -"正しくないインデントに関する構文エラーの基底クラスです。これは :exc:" -"`SyntaxError` のサブクラスです。" +"正しくないインデントに関する構文エラーの基底クラスです。これ" +"は :exc:`SyntaxError` のサブクラスです。" #: ../../library/exceptions.rst:563 msgid "" @@ -857,16 +902,19 @@ 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 " -"a string indicating what went wrong (in low-level terms). In :term:" -"`CPython`, this could be raised by incorrectly using Python's C API, such as " -"returning a ``NULL`` value without an exception set." +"a string indicating what went wrong (in low-level terms). " +"In :term:`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 +924,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 "" @@ -884,21 +939,21 @@ msgid "" "accidentally caught by code that catches :exc:`Exception`. This allows the " "exception to properly propagate up and cause the interpreter to exit. When " "it is not handled, the Python interpreter exits; no stack traceback is " -"printed. The constructor accepts the same optional argument passed to :func:" -"`sys.exit`. If the value is an integer, it specifies the system exit status " -"(passed to C's :c:func:`exit` function); if it is ``None``, the exit status " -"is zero; if it has another type (such as a string), the object's value is " -"printed and the exit status is one." +"printed. The constructor accepts the same optional argument passed " +"to :func:`sys.exit`. If the value is an integer, it specifies the system " +"exit status (passed to C's :c:func:`exit` function); if it is ``None``, the " +"exit status is zero; if it has another type (such as a string), the object's " +"value is printed and the exit status is one." msgstr "" "この例外は :func:`sys.exit` 関数から送出されます。:exc:`Exception` をキャッチ" -"するコードに誤ってキャッチされないように、:exc:`Exception` ではなく :exc:" -"`BaseException` を継承しています。これにより例外は上の階層に適切に伝わり、イ" -"ンタープリタを終了させます。この例外が処理されなかった場合はスタックのトレー" -"スバックを表示せずに Python インタープリタは終了します。コンストラクタは :" -"func:`sys.exit` に渡されるオプション引数と同じものを受け取ります。値が整数の" -"場合、システムの終了ステータス (C 言語の :c:func:`exit` 関数に渡すもの)を指定" -"します。値が ``None`` の場合、終了ステータスは 0 です。それ以外の型の場合 (例" -"えば str)、 オブジェクトの値が表示され、終了ステータスは 1 です。" +"するコードに誤ってキャッチされないように、:exc:`Exception` ではな" +"く :exc:`BaseException` を継承しています。これにより例外は上の階層に適切に伝" +"わり、インタープリタを終了させます。この例外が処理されなかった場合はスタック" +"のトレースバックを表示せずに Python インタープリタは終了します。コンストラク" +"タは :func:`sys.exit` に渡されるオプション引数と同じものを受け取ります。値が" +"整数の場合、システムの終了ステータス (C 言語の :c:func:`exit` 関数に渡すもの)" +"を指定します。値が ``None`` の場合、終了ステータスは 0 です。それ以外の型の場" +"合 (例えば str)、 オブジェクトの値が表示され、終了ステータスは 1 です。" #: ../../library/exceptions.rst:597 msgid "" @@ -909,11 +964,11 @@ msgid "" "absolutely positively necessary to exit immediately (for example, in the " "child process after a call to :func:`os.fork`)." msgstr "" -":func:`sys.exit` は、クリーンアップのための処理 (:keyword:`try` 文の :" -"keyword:`finally` 節) が実行されるようにするため、またデバッガが制御不能にな" -"るリスクを冒さずにスクリプトを実行できるようにするために例外に変換されます。" -"即座に終了することが真に強く必要であるとき (例えば、:func:`os.fork` を呼んだ" -"後の子プロセス内) には :func:`os._exit` 関数を使うことができます。" +":func:`sys.exit` は、クリーンアップのための処理 (:keyword:`try` 文" +"の :keyword:`finally` 節) が実行されるようにするため、またデバッガが制御不能" +"になるリスクを冒さずにスクリプトを実行できるようにするために例外に変換されま" +"す。即座に終了することが真に強く必要であるとき (例えば、:func:`os.fork` を呼" +"んだ後の子プロセス内) には :func:`os._exit` 関数を使うことができます。" #: ../../library/exceptions.rst:606 msgid "" @@ -923,44 +978,43 @@ 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 "" -"Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" -"class:`int` is expected) should result in a :exc:`TypeError`, but passing " -"arguments with the wrong value (e.g. a number outside expected boundaries) " -"should result in a :exc:`ValueError`." +"Passing arguments of the wrong type (e.g. passing a :class:`list` when " +"an :class:`int` is expected) should result in a :exc:`TypeError`, but " +"passing arguments with the wrong value (e.g. a number outside expected " +"boundaries) should result in a :exc:`ValueError`." msgstr "" -"誤った型の引数が渡された場合は (例えば、:class:`int` が期待されるのに、:" -"class:`list` が渡された) :exc:`TypeError` となるべきです。しかし、誤った値(例" -"えば、期待する範囲外の数)が引数として渡された場合は、 :exc:`ValueError` とな" -"るべきです。" +"誤った型の引数が渡された場合は (例えば、:class:`int` が期待されるの" +"に、:class:`list` が渡された) :exc:`TypeError` となるべきです。しかし、誤った" +"値(例えば、期待する範囲外の数)が引数として渡された場合は、 :exc:`ValueError` " +"となるべきです。" #: ../../library/exceptions.rst:627 msgid "" "Raised when a reference is made to a local variable in a function or method, " -"but no value has been bound to that variable. This is a subclass of :exc:" -"`NameError`." +"but no value has been bound to that variable. This is a subclass " +"of :exc:`NameError`." msgstr "" "関数やメソッド内のローカルな変数に対して参照を行ったが、その変数には値が代入" "されていなかった場合に送出されます。 :exc:`NameError` のサブクラスです。" @@ -999,11 +1053,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`." @@ -1014,16 +1069,16 @@ msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -"Unicode 関連のエラーがエンコード中に発生した際に送出されます。 :exc:" -"`UnicodeError` のサブクラスです。" +"Unicode 関連のエラーがエンコード中に発生した際に送出されま" +"す。 :exc:`UnicodeError` のサブクラスです。" #: ../../library/exceptions.rst:676 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -"Unicode 関連のエラーがデコード中に発生した際に送出されます。 :exc:" -"`UnicodeError` のサブクラスです。" +"Unicode 関連のエラーがデコード中に発生した際に送出されま" +"す。 :exc:`UnicodeError` のサブクラスです。" #: ../../library/exceptions.rst:682 msgid "" @@ -1033,23 +1088,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 +1129,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`." +"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 "" @@ -1106,11 +1159,11 @@ msgstr "" #: ../../library/exceptions.rst:736 msgid "" -"Raised when an operation on a child process failed. Corresponds to :c:data:" -"`errno` :py:const:`~errno.ECHILD`." +"Raised when an operation on a child process failed. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECHILD`." msgstr "" -"子プロセスの操作が失敗した場合に送出されます。:c:data:`errno` :py:const:" -"`~errno.ECHILD` に対応します。" +"子プロセスの操作が失敗した場合に送出されま" +"す。:c:data:`errno` :py:const:`~errno.ECHILD` に対応します。" #: ../../library/exceptions.rst:741 msgid "A base class for connection-related issues." @@ -1118,29 +1171,32 @@ msgstr "コネクション関係の問題の基底クラス。" #: ../../library/exceptions.rst:743 msgid "" -"Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" -"`ConnectionRefusedError` and :exc:`ConnectionResetError`." +"Subclasses " +"are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " +"and :exc:`ConnectionResetError`." msgstr "" -"サブクラスは :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" -"`ConnectionRefusedError`, :exc:`ConnectionResetError` です。" +"サブクラス" +"は :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`." +"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 "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNABORTED`." +"aborted by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." msgstr "" ":exc:`ConnectionError` のサブクラスで、接続の試行が通信相手によって中断された" "場合に発生します。 :c:data:`errno` :py:const:`~errno.ECONNABORTED` に対応しま" @@ -1149,8 +1205,8 @@ msgstr "" #: ../../library/exceptions.rst:761 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNREFUSED`." +"refused by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." msgstr "" ":exc:`ConnectionError` のサブクラスで、接続の試行が通信相手によって拒否された" "場合に発生します。 :c:data:`errno` :py:const:`~errno.ECONNREFUSED` に対応しま" @@ -1169,24 +1225,23 @@ msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -"すでに存在するファイルやディレクトリを作成しようとした場合に送出されます。:c:" -"data:`errno` :py:const:`~errno.EEXIST` に対応します。" +"すでに存在するファイルやディレクトリを作成しようとした場合に送出されま" +"す。:c:data:`errno` :py:const:`~errno.EEXIST` に対応します。" #: ../../library/exceptions.rst:778 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -"要求されたファイルやディレクトリが存在しない場合に送出されます。:c:data:" -"`errno` :py:const:`~errno.ENOENT` に対応します。" +"要求されたファイルやディレクトリが存在しない場合に送出されま" +"す。: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,53 +1261,55 @@ 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 " "be raised if an operation attempts to open or traverse a non-directory file " -"as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno." -"ENOTDIR`." +"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 "" "Raised when trying to run an operation without the adequate access rights - " -"for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EACCES`, :py:const:`~errno.EPERM`, and :py:const:`~errno." -"ENOTCAPABLE`." +"for example filesystem permissions. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, " +"and :py:const:`~errno.ENOTCAPABLE`." msgstr "" "十分なアクセス権、例えばファイルシステム権限のない操作が試みられた場合に送出" -"されます。:c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno." -"EPERM` および :py:const:`~errno.ENOTCAPABLE` に対応します。" +"されま" +"す。:c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` およ" +"び :py:const:`~errno.ENOTCAPABLE` に対応します。" #: ../../library/exceptions.rst:812 msgid "" -"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" -"`PermissionError`." +"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " +"to :exc:`PermissionError`." msgstr "" "WASIの :py:const:`~errno.ENOTCAPABLE` は :exc:`PermissionError` にマップされ" "ました。" #: ../../library/exceptions.rst:818 msgid "" -"Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" -"py:const:`~errno.ESRCH`." +"Raised when a given process doesn't exist. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ESRCH`." msgstr "" -"与えられたプロセスが存在しない場合に送出されます。:c:data:`errno` :py:const:" -"`~errno.ESRCH` に対応します。" +"与えられたプロセスが存在しない場合に送出されま" +"す。:c:data:`errno` :py:const:`~errno.ESRCH` に対応します。" #: ../../library/exceptions.rst:823 msgid "" -"Raised when a system function timed out at the system level. Corresponds to :" -"c:data:`errno` :py:const:`~errno.ETIMEDOUT`." +"Raised when a system function timed out at the system level. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" -"システム関数がシステムレベルでタイムアウトした場合に送出されます。:c:data:" -"`errno` :py:const:`~errno.ETIMEDOUT` に対応します。" +"システム関数がシステムレベルでタイムアウトした場合に送出されま" +"す。:c:data:`errno` :py:const:`~errno.ETIMEDOUT` に対応します。" #: ../../library/exceptions.rst:826 msgid "All the above :exc:`OSError` subclasses were added." @@ -1268,8 +1325,8 @@ msgstr "警告" #: ../../library/exceptions.rst:840 msgid "" -"The following exceptions are used as warning categories; see the :ref:" -"`warning-categories` documentation for more details." +"The following exceptions are used as warning categories; see " +"the :ref:`warning-categories` documentation for more details." msgstr "" "次の例外は警告カテゴリとして使われます。詳細については :ref:`warning-" "categories` のドキュメントを参照してください。" @@ -1282,45 +1339,40 @@ 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 "" -"Ignored by the default warning filters, except in the ``__main__`` module (:" -"pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " -"warning." +"Ignored by the default warning filters, except in the ``__main__`` module " +"(:pep:`565`). Enabling the :ref:`Python Development Mode ` shows " +"this warning." msgstr "" "``__main__`` モジュールを除いて(:pep:`565`)、デフォルトの警告フィルターで無効" "化されています。: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 +1383,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,37 +1439,39 @@ 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 " "classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " -"it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:" -"`Exception` and it can only wrap subclasses of :exc:`Exception`. This design " -"is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" -"exc:`BaseExceptionGroup`." +"it can wrap any exception, while :exc:`ExceptionGroup` " +"extends :exc:`Exception` and it can only wrap subclasses " +"of :exc:`Exception`. This design 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:" -"`Exception` instances, so it can be used to make the selection automatic. " -"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` を送出します。" +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions " +"are :exc:`Exception` instances, so it can be used to make the selection " +"automatic. 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` のインスタンスである場合、\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 +1485,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,26 +1500,36 @@ 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." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields. Empty nested " -"groups are omitted from the result." +"as are the values of " +"its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__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,29 +1548,32 @@ 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 "" -":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields from the original " -"exception group to the one returned by :meth:`derive`, so these fields do " -"not need to be updated by :meth:`derive`." +":meth:`subgroup` and :meth:`split` copy " +"the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields from the original exception " +"group to the one returned by :meth:`derive`, so these fields do not need to " +"be updated by :meth:`derive`." msgstr "" -":meth:`subgroup` と :meth:`split` は :attr:`~BaseException.__traceback__`、:" -"attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` と :attr:" -"`~BaseException.__notes__` フィールドを元の例外グループから :meth:`derive` が" -"返す例外グループにコピーするため、:meth:`derive` ではこれらのフィールドを更新" -"する必要がありません。" +":meth:`subgroup` と :meth:`split` " +"は :attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"と :attr:`~BaseException.__notes__` フィールドを元の例外グループか" +"ら :meth:`derive` が返す例外グループにコピーするため、:meth:`derive` ではこれ" +"らのフィールドを更新する必要がありません。" -#: ../../library/exceptions.rst:1021 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1537,6 +1601,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 +1636,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 +1646,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`." +"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..5c58d1c82 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -19,34 +19,34 @@ 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." -"enable` to install fault handlers for the :const:`~signal.SIGSEGV`, :const:" -"`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, and :" -"const:`~signal.SIGILL` signals. You can also enable them at startup by " +"fault, after a timeout, or on a user signal. " +"Call :func:`faulthandler.enable` to install fault handlers for " +"the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, " +"and :const:`~signal.SIGILL` signals. You can also enable them at startup by " "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 +85,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 +117,30 @@ msgstr "" "モジュールはC言語で実装されているので、アプリのクラッシュ時でもPythonがデッド" "ロックした場合でもダンプができます。" -#: ../../library/faulthandler.rst:44 msgid "" -"The :ref:`Python Development Mode ` calls :func:`faulthandler." -"enable` at Python startup." +"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 +154,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 " +"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,62 +195,74 @@ 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." -"SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python traceback. If " +"Enable the fault handler: 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. If " "*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 `." +"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 "" -"Disable the fault handler: uninstall the signal handlers installed by :func:" -"`enable`." +"Disable the fault handler: uninstall the signal handlers installed " +"by :func:`enable`." msgstr "" "フォールトハンドラを無効にします: :func:`enable` によってインストールされたシ" "グナルハンドラをアンインストールします。" @@ -271,27 +279,27 @@ msgstr "タイムアウト後にtracebackをダンプする" msgid "" "Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or " "every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, " -"call :c:func:`!_exit` with status=1 after dumping the tracebacks. (Note :c:" -"func:`!_exit` exits the process immediately, which means it doesn't do any " -"cleanup like flushing file buffers.) If the function is called twice, the " -"new call replaces previous parameters and resets the timeout. The timer has " -"a sub-second resolution." +"call :c:func:`!_exit` with status=1 after dumping the tracebacks. " +"(Note :c:func:`!_exit` exits the process immediately, which means it doesn't " +"do any cleanup like flushing file buffers.) If the function is called twice, " +"the new call replaces previous parameters and resets the timeout. The timer " +"has 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 " +"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 +320,14 @@ 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 `." +"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..582c4ed9e 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -19,41 +19,44 @@ 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 " +"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 "" "All functions in this module take a file descriptor *fd* as their first " -"argument. This can be an integer file descriptor, such as returned by ``sys." -"stdin.fileno()``, or an :class:`io.IOBase` object, such as ``sys.stdin`` " -"itself, which provides a :meth:`~io.IOBase.fileno` that returns a genuine " -"file descriptor." +"argument. This can be an integer file descriptor, such as returned by " +"``sys.stdin.fileno()``, or an :class:`io.IOBase` object, such as " +"``sys.stdin`` itself, which provides a :meth:`~io.IOBase.fileno` that " +"returns a genuine file descriptor." msgstr "" "このモジュール内の全ての関数はファイル記述子 *fd* を最初の引数に取ります。 こ" "の値は ``sys.stdin.fileno()`` が返すような\\ 整数のファイル記述子でも、 " -"``sys.stdin`` 自体のような、純粋にファイル記述子だけを返す :meth:`~io.IOBase." -"fileno` メソッドを提供している :class:`io.IOBase` オブジェクトでもかまいませ" -"ん。" +"``sys.stdin`` 自体のような、純粋にファイル記述子だけを返" +"す :meth:`~io.IOBase.fileno` メソッドを提供している :class:`io.IOBase` オブ" +"ジェクトでもかまいません。" #: ../../library/fcntl.rst:29 msgid "" @@ -63,21 +66,27 @@ 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 :" -"mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " +"obtains the path of a file from a file descriptor. On Linux(>=3.15), " +"the :mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " "``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 "" @@ -138,17 +169,17 @@ msgid "" "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " "for *cmd* are operating system dependent, and are available as constants in " "the :mod:`fcntl` module, using the same names as used in the relevant C " -"header files. The argument *arg* can either be an integer value, 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." +"header files. The argument *arg* can either be an integer value, " +"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 "" -#: ../../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) " @@ -225,14 +262,22 @@ msgid "" "code is passed back to the calling Python, and the buffer's new contents " "reflect the action of the :c:func:`ioctl`. This is a slight simplification, " "because if the supplied buffer is less than 1024 bytes long it is first " -"copied into a static buffer 1024 bytes long which is then passed to :func:" -"`ioctl` and copied back into the supplied buffer." +"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,80 +342,79 @@ 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`` を送出します。 " +"引数 ``fd``, ``operation`` を指定して :ref:`監査イベント ` " +"``fcntl.flock`` を送出します。" #: ../../library/fcntl.rst:202 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " -"*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." -"fileno` method are accepted as well) of the file to lock or unlock, and " -"*cmd* is one of the following values:" +"*fd* is the file descriptor (file objects providing " +"a :meth:`~io.IOBase.fileno` method are accepted as well) of the file to lock " +"or unlock, and *cmd* is one of the following values:" msgstr "" "本質的に :func:`~fcntl.fcntl` によるロッキングの呼び出しをラップしたもので" -"す。 *fd* はロックまたはアンロックするファイルのファイル記述子 (:meth:`~io." -"IOBase.fileno` メソッドを提供するファイルオブジェクトも受け付けられます) " -"で、 *cmd* は以下の値のうちいずれかになります:" +"す。 *fd* はロックまたはアンロックするファイルのファイル記述子 " +"(:meth:`~io.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 " -"set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending on the " -"operating system; for portability, check for both values). On at least some " -"systems, :const:`!LOCK_EX` can only be used if the file descriptor refers to " -"a file opened for writing." +"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 set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending " +"on the operating system; for portability, check for both values). On at " +"least some 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 "" "*len* is the number of bytes to lock, *start* is the byte offset at which " -"the lock starts, relative to *whence*, and *whence* is as with :func:`io." -"IOBase.seek`, specifically:" +"the lock starts, relative to *whence*, and *whence* is as " +"with :func:`io.IOBase.seek`, specifically:" msgstr "" "*len* はロックを行いたいバイト数、 *start* はロック領域先頭の *whence* からの" "相対的なバイトオフセット、 *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 "" @@ -403,28 +462,29 @@ msgid "" "The structure lay-out for the *lockdata* variable is system dependent --- " "therefore using the :func:`flock` call may be better." msgstr "" -"最初の例では、戻り値 *rv* は整数値を保持しています; 二つ目の例では :class:" -"`bytes` オブジェクトを保持しています。 *lockdata* 変数の構造体レイアウトはシ" -"ステム依存です --- 従って :func:`flock` を呼ぶ方が良いでしょう。" +"最初の例では、戻り値 *rv* は整数値を保持しています; 二つ目の例で" +"は :class:`bytes` オブジェクトを保持しています。 *lockdata* 変数の構造体レイ" +"アウトはシステム依存です --- 従って :func:`flock` を呼ぶ方が良いでしょう。" #: ../../library/fcntl.rst:263 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..9e48ba43c 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 "" @@ -80,9 +82,9 @@ msgid "" "entries invalidated if the :func:`os.stat` information for the file " "changes. The entire cache may be cleared using :func:`clear_cache`." msgstr "" -"この関数は過去の比較と結果のキャッシュを使用します。ファイルの :func:`os." -"stat` 情報が変更された場合、キャッシュの項目は無効化されます。:func:" -"`clear_cache` を使用して全キャッシュを削除することが出来ます。" +"この関数は過去の比較と結果のキャッシュを使用します。ファイル" +"の :func:`os.stat` 情報が変更された場合、キャッシュの項目は無効化されま" +"す。:func:`clear_cache` を使用して全キャッシュを削除することが出来ます。" #: ../../library/filecmp.rst:41 msgid "" @@ -110,8 +112,8 @@ msgstr "" #: ../../library/filecmp.rst:51 msgid "" -"The *shallow* parameter has the same meaning and default value as for :func:" -"`filecmp.cmp`." +"The *shallow* parameter has the same meaning and default value as " +"for :func:`filecmp.cmp`." msgstr "" "引数 *shallow* はその意味も標準の設定も :func:`filecmp.cmp` と同じです。" @@ -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]``." +"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*." @@ -240,8 +247,8 @@ msgid "" "Names in both *a* and *b*, such that the type differs between the " "directories, or names for which :func:`os.stat` reports an error." msgstr "" -"*a* および *b* の両方にあり、ディレクトリ間でタイプが異なるか、 :func:`os." -"stat` がエラーを報告するような名前です。" +"*a* および *b* の両方にあり、ディレクトリ間でタイプが異なる" +"か、 :func:`os.stat` がエラーを報告するような名前です。" #: ../../library/filecmp.rst:166 msgid "" @@ -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..4c2c154b8 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 "" @@ -76,14 +78,14 @@ msgstr "" #: ../../library/fileinput.rst:30 msgid "" "All files are opened in text mode by default, but you can override this by " -"specifying the *mode* parameter in the call to :func:`.input` or :class:" -"`FileInput`. If an I/O error occurs during opening or reading a file, :exc:" -"`OSError` is raised." +"specifying the *mode* parameter in the call to :func:`.input` " +"or :class:`FileInput`. If an I/O error occurs during opening or reading a " +"file, :exc:`OSError` is raised." msgstr "" -"全てのファイルはデフォルトでテキストモードでオープンされます。しかし、 :func:" -"`.input` や :class:`FileInput` をコールする際に *mode* パラメータを指定すれ" -"ば、これをオーバーライドすることができます。オープン中あるいは読み込み中にI/O" -"エラーが発生した場合には、 :exc:`OSError` が発生します。" +"全てのファイルはデフォルトでテキストモードでオープンされます。しか" +"し、 :func:`.input` や :class:`FileInput` をコールする際に *mode* パラメータ" +"を指定すれば、これをオーバーライドすることができます。オープン中あるいは読み" +"込み中にI/Oエラーが発生した場合には、 :exc:`OSError` が発生します。" #: ../../library/fileinput.rst:35 msgid ":exc:`IOError` used to be raised; it is now an alias of :exc:`OSError`." @@ -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,40 +129,51 @@ 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 "" -"The :class:`FileInput` instance can be used as a context manager in the :" -"keyword:`with` statement. In this example, *input* is closed after the :" -"keyword:`!with` statement is exited, even if an exception occurs::" +"The :class:`FileInput` instance can be used as a context manager in " +"the :keyword:`with` statement. In this example, *input* is closed after " +"the :keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" ":class:`FileInput` のインスタンスは :keyword:`with` 文の中でコンテキストマ" "ネージャーとして使用できます。\n" "次の例では、仮に例外が生じたとしても :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,15 +184,14 @@ 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 "" -"The following functions use the global state created by :func:`fileinput." -"input`; if there is no active state, :exc:`RuntimeError` is raised." +"The following functions use the global state created " +"by :func:`fileinput.input`; if there is no active state, :exc:`RuntimeError` " +"is raised." msgstr "" "以下の関数は :func:`fileinput.input` 関数によって作られたグローバルな状態を利" "用します。アクティブな状態が無い場合には、 :exc:`RuntimeError` が発生します。" @@ -268,22 +279,20 @@ msgstr "" #: ../../library/fileinput.rst:146 msgid "" -"Class :class:`FileInput` is the implementation; its methods :meth:" -"`filename`, :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:" -"`isfirstline`, :meth:`isstdin`, :meth:`nextfile` and :meth:`close` " -"correspond to the functions of the same name in the module. In addition it " -"is :term:`iterable` and has a :meth:`~io.TextIOBase.readline` method which " -"returns the next input line. The sequence must be accessed in strictly " -"sequential order; random access and :meth:`~io.TextIOBase.readline` cannot " -"be mixed." -msgstr "" -":class:`FileInput` クラスはモジュールの関数に対応するメソッド :meth:" -"`filename` 、 :meth:`fileno` 、 :meth:`lineno` 、 :meth:`filelineno` 、 :" -"meth:`isfirstline` 、 :meth:`isstdin` 、 :meth:`nextfile` および :meth:" -"`close` を実装しています。:term:`イテラブル ` であることに加えて、" -"次の入力行を返す :meth:`~io.TextIOBase.readline` メソッドがあります。シーケン" -"スはシーケンシャルに読み込むことしかできません。つまりランダムアクセスと :" -"meth:`~io.TextIOBase.readline` を混在させることはできません。" +"Class :class:`FileInput` is the implementation; its " +"methods :meth:`filename`, :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:`isfirstline`, :meth:`isstdin`, :meth:`nextfile` " +"and :meth:`close` correspond to the functions of the same name in the " +"module. In addition it is :term:`iterable` and has " +"a :meth:`~io.TextIOBase.readline` method which returns the next input line. " +"The sequence must be accessed in strictly sequential order; random access " +"and :meth:`~io.TextIOBase.readline` cannot be mixed." +msgstr "" +":class:`FileInput` クラスはモジュールの関数に対応するメソッ" +"ド :meth:`filename` 、 :meth:`fileno` 、 :meth:`lineno` 、 :meth:`filelineno` 、 :meth:`isfirstline` 、 :meth:`isstdin` 、 :meth:`nextfile` " +"および :meth:`close` を実装しています。:term:`イテラブル ` であるこ" +"とに加えて、次の入力行を返す :meth:`~io.TextIOBase.readline` メソッドがありま" +"す。シーケンスはシーケンシャルに読み込むことしかできません。つまりランダムア" +"クセスと :meth:`~io.TextIOBase.readline` を混在させることはできません。" #: ../../library/fileinput.rst:154 msgid "" @@ -303,39 +312,41 @@ 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 "" -"A :class:`FileInput` instance can be used as a context manager in the :" -"keyword:`with` statement. In this example, *input* is closed after the :" -"keyword:`!with` statement is exited, even if an exception occurs::" +"A :class:`FileInput` instance can be used as a context manager in " +"the :keyword:`with` statement. In this example, *input* is closed after " +"the :keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" ":class:`FileInput` のインスタンスは :keyword:`with` 文の中でコンテキストマ" "ネージャーとして使用できます。\n" "次の例では、仮に例外が生じたとしても :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,16 +389,18 @@ 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 "" -"Usage example: ``fi = fileinput.FileInput(openhook=fileinput." -"hook_compressed, encoding=\"utf-8\")``" +"Usage example: ``fi = " +"fileinput.FileInput(openhook=fileinput.hook_compressed, encoding=\"utf-8\")``" msgstr "" "使用例: ``fi = fileinput.FileInput(openhook=fileinput.hook_compressed, " "encoding=\"utf-8\")``" @@ -402,18 +415,21 @@ msgstr "" #: ../../library/fileinput.rst:219 msgid "" -"Usage example: ``fi = fileinput.FileInput(openhook=fileinput." -"hook_encoded(\"utf-8\", \"surrogateescape\"))``" +"Usage example: ``fi = " +"fileinput.FileInput(openhook=fileinput.hook_encoded(\"utf-8\", " +"\"surrogateescape\"))``" msgstr "" -"使用例: ``fi = fileinput.FileInput(openhook=fileinput." -"hook_encoded(\"utf-8\", \"surrogateescape\"))``" +"使用例: ``fi = " +"fileinput.FileInput(openhook=fileinput.hook_encoded(\"utf-8\", " +"\"surrogateescape\"))``" #: ../../library/fileinput.rst:223 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." +"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..b06a44397 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,27 +93,31 @@ 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 :" -"func:`.filter` to match pathname segments). Similarly, filenames starting " -"with a period are not special for this module, and are matched by the ``*`` " -"and ``?`` patterns." +"module. See module :mod:`glob` for pathname expansion (:mod:`glob` " +"uses :func:`.filter` to match pathname segments). Similarly, filenames " +"starting 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 "" @@ -125,16 +129,16 @@ msgstr "" #: ../../library/fnmatch.rst:61 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " -"returning ``True`` or ``False``. Both parameters are case-normalized using :" -"func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a case-" -"sensitive comparison, regardless of whether that's standard for the " +"returning ``True`` or ``False``. Both parameters are case-normalized " +"using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a " +"case-sensitive comparison, regardless of whether that's standard for the " "operating system." msgstr "" "ファイルの文字列 *name* がパターン文字列 *pat* にマッチするかテストして、 " -"``True`` または ``False`` のいずれかを返します。どちらの引数とも :func:`os." -"path.normcase` を使って、大文字、小文字が正規化されます。オペレーティングシス" -"テムが標準でどうなっているかに関係なく、大文字、小文字を区別して比較する場合" -"には、 :func:`fnmatchcase` が使用できます。" +"``True`` または ``False`` のいずれかを返します。どちらの引数と" +"も :func:`os.path.normcase` を使って、大文字、小文字が正規化されます。オペ" +"レーティングシステムが標準でどうなっているかに関係なく、大文字、小文字を区別" +"して比較する場合には、 :func:`fnmatchcase` が使用できます。" #: ../../library/fnmatch.rst:67 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 "" @@ -161,23 +170,29 @@ msgid "" "not apply :func:`os.path.normcase`." msgstr "" "ファイル名の文字列 *name* がパターン文字列 *pat* にマッチするかテストして、 " -"``True`` または ``False`` を返します。比較は大文字、小文字を区別し、 :func:" -"`os.path.normcase` は適用しません。" +"``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..a981bfcf3 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,48 +52,57 @@ 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:" -"`float` and :class:`decimal.Decimal`). It returns a :class:`Fraction` " -"instance with exactly the same value. Assumed, that the :meth:`!" -"as_integer_ratio` method returns a pair of coprime integers and last one is " -"positive. Note that due to the usual issues with binary point (see :ref:`tut-" -"fp-issues`), the argument to ``Fraction(1.1)`` is not exactly equal to " -"11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as " -"one might expect. (But see the documentation for the :meth:" -"`limit_denominator` method below.)" -msgstr "" +"The second version requires that *number* is an instance " +"of :class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method " +"(this includes :class:`float` and :class:`decimal.Decimal`). It returns " +"a :class:`Fraction` instance with exactly the same value. Assumed, that " +"the :meth:`!as_integer_ratio` method returns a pair of coprime integers and " +"last one is positive. Note that due to the usual issues with binary point " +"(see :ref:`tut-fp-issues`), the argument to ``Fraction(1.1)`` is not exactly " +"equal to 11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, " +"10)`` as 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 "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " -"any string that represents a finite value and is accepted by the :class:" -"`float` constructor is also accepted by the :class:`Fraction` constructor. " -"In either form the input string may also have leading and/or trailing " -"whitespace. Here are some examples::" +"any string that represents a finite value and is accepted by " +"the :class:`float` constructor is also accepted by the :class:`Fraction` " +"constructor. In either form the input string may also have leading and/or " +"trailing whitespace. Here are some examples::" msgstr "" "ここで、オプションの ``sign`` は '+' か '-' のどちらかであり、\\ " "``numerator`` および (存在する場合) ``denominator`` は十進数の数字の文字列で" "す (コード中の整数リテラルと同様、アンダースコアを使って桁を区切れます)。さら" -"に、 :class:`float` コンストラクタで受け付けられる有限の値を表す文字列は、:" -"class:`Fraction` コンストラクタでも受け付けられます。どちらの形式でも、入力さ" -"れる文字列は前後に空白があって構いません。以下に、いくつかの例を示します::" +"に、 :class:`float` コンストラクタで受け付けられる有限の値を表す文字列" +"は、:class:`Fraction` コンストラクタでも受け付けられます。どちらの形式でも、" +"入力される文字列は前後に空白があって構いません。以下に、いくつかの例を示しま" +"す::" -#: ../../library/fractions.rst:57 msgid "" ">>> from fractions import Fraction\n" ">>> Fraction(16, -10)\n" @@ -120,51 +129,81 @@ 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 "" -"The :class:`Fraction` class inherits from the abstract base class :class:" -"`numbers.Rational`, and implements all of the methods and operations from " -"that class. :class:`Fraction` instances are :term:`hashable`, and should be " -"treated as immutable. In addition, :class:`Fraction` has the following " -"properties and methods:" +"The :class:`Fraction` class inherits from the abstract base " +"class :class:`numbers.Rational`, and implements all of the methods and " +"operations from that class. :class:`Fraction` instances " +"are :term:`hashable`, and should be treated as immutable. In " +"addition, :class:`Fraction` has the following properties and methods:" msgstr "" ":class:`Fraction` クラスは抽象基底クラス :class:`numbers.Rational` を継承し、" -"その全てのメソッドと演算を実装します。 :class:`Fraction` インスタンスは :" -"term:`ハッシュ可能 ` で、不変 (immutable) であるものとして扱われま" -"す。加えて、 :class:`Fraction` には以下のプロパティとメソッドがあります:" +"その全てのメソッドと演算を実装します。 :class:`Fraction` インスタンス" +"は :term:`ハッシュ可能 ` で、不変 (immutable) であるものとして扱わ" +"れます。加えて、 :class:`Fraction` には以下のプロパティとメソッドがあります:" #: ../../library/fractions.rst:89 msgid "" -"The :class:`Fraction` constructor now accepts :class:`float` and :class:" -"`decimal.Decimal` instances." +"The :class:`Fraction` constructor now accepts :class:`float` " +"and :class:`decimal.Decimal` instances." msgstr "" -":class:`Fraction` のコンストラクタが :class:`float` および :class:`decimal." -"Decimal` インスタンスを受け付けるようになりました。" +":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." +":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 +212,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 +234,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)``." +"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,27 +262,31 @@ 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`." +"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 "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -"Python 3.2 以降では、 :class:`decimal.Decimal` インスタンスから直接 :class:" -"`Fraction` インスタンスを構築できるようになりました。" +"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." +"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 "" @@ -259,8 +307,8 @@ msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -"最大の :class:`int` ``<= self`` を返します。このメソッドは :func:`math." -"floor` 関数からでもアクセスできます:" +"最大の :class:`int` ``<= self`` を返します。このメソッド" +"は :func:`math.floor` 関数からでもアクセスできます:" #: ../../library/fractions.rst:212 msgid "" @@ -275,22 +323,23 @@ msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " "``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " -"rounding half toward even. This method can also be accessed through the :" -"func:`round` function." +"rounding half toward even. This method can also be accessed through " +"the :func:`round` function." msgstr "" "第一のバージョンは、 ``self`` に最も近い :class:`int` を偶数丸めで返します。" "第二のバージョンは、このメソッドは ``self`` に最も近い ``Fraction(1, " "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 `." +"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 +350,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 +393,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 +420,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..acab4f0ce 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 @@ -37,42 +37,39 @@ msgstr "**ソースコード:** :source:`Lib/ftplib.py`" #: ../../library/ftplib.rst:15 msgid "" -"This module defines the class :class:`FTP` and a few related items. The :" -"class:`FTP` class implements the client side of the FTP protocol. You can " -"use this to write Python programs that perform a variety of automated FTP " -"jobs, such as mirroring other FTP servers. It is also used by the module :" -"mod:`urllib.request` to handle URLs that use FTP. For more information on " -"FTP (File Transfer Protocol), see internet :rfc:`959`." +"This module defines the class :class:`FTP` and a few related items. " +"The :class:`FTP` class implements the client side of the FTP protocol. You " +"can use this to write Python programs that perform a variety of automated " +"FTP jobs, such as mirroring other FTP servers. It is also used by the " +"module :mod:`urllib.request` to handle URLs that use FTP. For more " +"information on FTP (File Transfer Protocol), see internet :rfc:`959`." msgstr "" "このモジュールでは :class:`FTP` クラスと、それに関連するいくつかの項目を定義" "しています。 :class:`FTP` クラスは、FTPプロトコルのクライアント側の機能を備え" "ています。このクラスを使うとFTPのいろいろな機能の自動化、例えば他のFTPサーバ" "のミラーリングといったことを実行するPythonプログラムを書くことができます。ま" "た、 :mod:`urllib.request` モジュールもFTPを使うURLを操作するのにこのクラスを" -"使っています。 FTP (File Transfer Protocol)についての詳しい情報はinternet :" -"rfc:`959` を参照して下さい。" +"使っています。 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/ftplib.rst:26 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 " +"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`` を送出します。 " +"引数 ``self``, ``cmd`` を指定して :ref:`監査イベント ` " +"``ftplib.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." +"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,29 +444,47 @@ 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` のものと同じです。" - -#: ../../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 " -"a list of strings representing the type of information desired (e.g. " -"``[\"type\", \"size\", \"perm\"]``). Return a generator object yielding a " -"tuple of two elements for every file found in path. First element is the " -"file name, the second one is a dictionary containing facts about the file " -"name. Content of this dictionary might be limited by the *facts* argument " -"but server is not guaranteed to return all requested facts." -msgstr "" +":meth:`transfercmd` と同様ですが、データ接続と転送データの予想サイズのタプル" +"を返します。\n" +"予想サイズを計算できない場合、その要素は ``None`` になります。\n" +"*cmd* と *rest* の意味は :meth:`transfercmd` と同じです。" + +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 a list of strings representing the type of information desired " +"(e.g. ``[\"type\", \"size\", \"perm\"]``). Return a generator object " +"yielding a tuple of two elements for every file found in path. First " +"element is the file name, the second one is a dictionary containing facts " +"about the file 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 "" @@ -509,63 +583,65 @@ msgid "" "connection by issuing another :meth:`login` method)." msgstr "" "接続を一方的に閉じます。既に閉じた接続に対して実行すべきではありません(例え" -"ば :meth:`~FTP.quit` を呼び出して成功した後など)。この実行の後、 :class:" -"`FTP` インスタンスはもう使用すべきではありません( :meth:`close` あるいは :" -"meth:`~FTP.quit` を呼び出した後で、 :meth:`login` メソッドをもう一度実行して" -"再び接続を開くことはできません)。" +"ば :meth:`~FTP.quit` を呼び出して成功した後など)。この実行の" +"後、 :class:`FTP` インスタンスはもう使用すべきではありません( :meth:`close` " +"あるいは :meth:`~FTP.quit` を呼び出した後で、 :meth:`login` メソッドをもう一" +"度実行して再び接続を開くことはできません)。" #: ../../library/ftplib.rst:447 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." +"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." +"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`)." +"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 +657,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 +690,23 @@ 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`)." +"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 +749,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 +782,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..c700113fc 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." +"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 "" @@ -531,8 +529,8 @@ msgid "" msgstr "" "整数を先頭に \"0b\" が付いた 2 進文字列に変換します。\n" "結果は Python の式としても使える形式になります。\n" -"*x* が Python の :class:`int` オブジェクトでない場合、整数を返す :meth:" -"`~object.__index__` メソッドが定義されていなければなりません。\n" +"*x* が Python の :class:`int` オブジェクトでない場合、整数を返" +"す :meth:`~object.__index__` メソッドが定義されていなければなりません。\n" "いくつかの例を示します:" #: ../../library/functions.rst:134 @@ -553,17 +551,17 @@ msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " "argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" -"`typesnumeric`). It cannot be subclassed further. Its only instances are " -"``False`` and ``True`` (see :ref:`typebool`)." -msgstr "" -"真偽値、すなわち ``True`` か ``False`` のいずれかを返します。引数は標準の :" -"ref:`真偽値判定手続き ` を用いて変換されます。引数が偽かまたは省略され" -"た場合、この関数は ``False`` を返します。それ以外の場合は ``True`` を返しま" -"す。 :class:`bool` クラスは :class:`int` クラスの派生クラスです (:ref:" -"`typesnumeric` を参照してください)。このクラスからさらに派生することはできま" -"せん。このクラスのインスタンスは ``False`` と ``True`` のみです (:ref:" -"`typebool` を参照してください)。" +"``True``. The :class:`bool` class is a subclass of :class:`int` " +"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " +"instances are ``False`` and ``True`` (see :ref:`typebool`)." +msgstr "" +"真偽値、すなわち ``True`` か ``False`` のいずれかを返します。引数は標準" +"の :ref:`真偽値判定手続き ` を用いて変換されます。引数が偽かまたは省略" +"された場合、この関数は ``False`` を返します。それ以外の場合は ``True`` を返し" +"ます。 :class:`bool` クラスは :class:`int` クラスの派生クラスです " +"(:ref:`typesnumeric` を参照してください)。このクラスからさらに派生することは" +"できません。このクラスのインスタンスは ``False`` と ``True`` のみです " +"(:ref:`typebool` を参照してください)。" #: ../../library/functions.rst:156 ../../library/functions.rst:815 msgid "The parameter is now positional-only." @@ -581,24 +579,24 @@ msgid "" "you to drop into the debugger of choice. If :func:`sys.breakpointhook` is " "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" -"この関数は、呼び出された箇所にて処理をデバッガに移行します。具体的には、 :" -"func:`sys.breakpointhook` を呼び出し、 ``args`` と ``kws`` をそのまま渡しま" -"す。デフォルトでは、 ``sys.breakpointhook()`` は引数なしで :func:`pdb." -"set_trace` を呼び出すだけです。その場合、これは単なる便利関数でデバッガに入る" -"ために :mod:`pdb` を明示的にインポートしたり多くのコードを書いたりせずに済む" -"だけです。ですが、 :func:`sys.breakpointhook` は別の関数に設定でき、 :func:" -"`breakpoint` はそれを自動で呼び出すため、自分好みのデバッガに処理を移行させる" -"ことができます。 :func:`sys.breakpointhook` にアクセスできない場合、この関数" -"は :exc:`RuntimeError` を送出します。" +"この関数は、呼び出された箇所にて処理をデバッガに移行します。具体的に" +"は、 :func:`sys.breakpointhook` を呼び出し、 ``args`` と ``kws`` をそのまま渡" +"します。デフォルトでは、 ``sys.breakpointhook()`` は引数なし" +"で :func:`pdb.set_trace` を呼び出すだけです。その場合、これは単なる便利関数で" +"デバッガに入るために :mod:`pdb` を明示的にインポートしたり多くのコードを書い" +"たりせずに済むだけです。ですが、 :func:`sys.breakpointhook` は別の関数に設定" +"でき、 :func:`breakpoint` はそれを自動で呼び出すため、自分好みのデバッガに処" +"理を移行させることができます。 :func:`sys.breakpointhook` にアクセスできない" +"場合、この関数は :exc:`RuntimeError` を送出します。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with the :" -"envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." -"breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with " +"the :envvar:`PYTHONBREAKPOINT` environment variable. " +"See :func:`sys.breakpointhook` for usage details." msgstr "" -"デフォルトでは、環境変数 :envvar:`PYTHONBREAKPOINT` をセットすることで :func:" -"`breakpoint` の動作を変えることができます。\n" +"デフォルトでは、環境変数 :envvar:`PYTHONBREAKPOINT` をセットすること" +"で :func:`breakpoint` の動作を変えることができます。\n" "使い方の詳細は :func:`sys.breakpointhook` を参照してください。" #: ../../library/functions.rst:177 @@ -614,20 +612,22 @@ msgid "" "Raises an :ref:`auditing event ` ``builtins.breakpoint`` with " "argument ``breakpointhook``." msgstr "" -"引数 ``breakpointhook`` 付きで :ref:`監査イベント ` ``builtins." -"breakpoint`` を送出します。" +"引数 ``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 "" @@ -680,8 +680,8 @@ msgstr ":ref:`binaryseq` と :ref:`typebytearray` も参照してください。 #: ../../library/functions.rst:222 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" -"class:`bytearray` -- it has the same non-mutating methods and the same " +"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " +"of :class:`bytearray` -- it has the same non-mutating methods and the same " "indexing and slicing behavior." msgstr "" "範囲 ``0 <= x < 256`` の整数のイミュータブルなシーケンスである \"bytes\" オブ" @@ -706,20 +706,21 @@ 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 " -"fails, but if it is ``False``, calling *object* will never succeed. Note " -"that classes are callable (calling a class returns a new instance); " -"instances are callable if their class has a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears " +"callable, :const:`False` if not. If this returns ``True``, it is still " +"possible that a call fails, but if it is ``False``, calling *object* will " +"never succeed. Note 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 "" @@ -772,11 +773,11 @@ msgstr "" #: ../../library/functions.rst:269 msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@classmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" -"``@classmethod`` 形式は関数 :term:`デコレータ ` です。詳しくは :" -"ref:`function` を参照してください。" +"``@classmethod`` 形式は関数 :term:`デコレータ ` です。詳しく" +"は :ref:`function` を参照してください。" #: ../../library/functions.rst:272 msgid "" @@ -785,8 +786,8 @@ msgid "" "class. If a class method is called for a derived class, the derived class " "object is passed as the implied first argument." msgstr "" -"クラスメソッドは、(``C.f()`` のように) クラスから呼び出すことも、(``C()." -"f()`` のように) インスタンスから呼び出すこともできます。\n" +"クラスメソッドは、(``C.f()`` のように) クラスから呼び出すことも、" +"(``C().f()`` のように) インスタンスから呼び出すこともできます。\n" "インスタンスはそのクラスが何であるかを除いて無視されます。\n" "クラスメソッドが派生クラスから呼び出される場合は、その派生クラスオブジェクト" "が暗黙の第一引数として渡されます。" @@ -803,23 +804,23 @@ msgstr "" #: ../../library/functions.rst:281 msgid "" -"Class methods can now wrap other :term:`descriptors ` such as :" -"func:`property`." +"Class methods can now wrap other :term:`descriptors ` such " +"as :func:`property`." msgstr "" "クラスメソッドは :func:`property` など、他の :term:`デスクリプタ " "` をラップすることができるようになりました。" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " -"new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " +"attribute." msgstr "" -"クラスメソッドはメソッド属性 (:attr:`~function.__module__`, :attr:`~function." -"__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` と :" -"attr:`~function.__annotations__`) を継承するようになりました。また、新たに " -"``__wrapped__`` 属性を持つようになりました。" +"クラスメソッドはメソッド属性 " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"と :attr:`~function.__annotations__`) を継承するようになりました。また、新た" +"に ``__wrapped__`` 属性を持つようになりました。" #: ../../library/functions.rst:292 msgid "" @@ -829,28 +830,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 "" @@ -867,16 +868,16 @@ msgstr "" #: ../../library/functions.rst:314 msgid "" -"The optional arguments *flags* and *dont_inherit* control which :ref:" -"`compiler options ` should be activated and which :ref:" -"`future features ` should be allowed. If neither is present (or both " -"are zero) the code is compiled with the same flags that affect the code that " -"is calling :func:`compile`. If the *flags* argument is given and " -"*dont_inherit* is not (or is zero) then the compiler options and the future " -"statements specified by the *flags* argument are used in addition to those " -"that would be used anyway. If *dont_inherit* is a non-zero integer then the " -"*flags* argument is it -- the flags (future features and compiler options) " -"in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control " +"which :ref:`compiler options ` should be activated and " +"which :ref:`future features ` should be allowed. If neither is " +"present (or both are zero) the code is compiled with the same flags that " +"affect the code that is calling :func:`compile`. If the *flags* argument is " +"given and *dont_inherit* is not (or is zero) then the compiler options and " +"the future statements specified by the *flags* argument are used in addition " +"to those that would be used anyway. If *dont_inherit* is a non-zero integer " +"then the *flags* argument is it -- the flags (future features and compiler " +"options) in the surrounding code are ignored." msgstr "" "オプション引数 *flags* と *dont_inherit* は、どの :ref:`コンパイラオプション " "` を有効化するか、 :ref:`将来の機能 ` のどれを許" @@ -892,18 +893,19 @@ msgstr "" msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as the :attr:`~__future__." -"_Feature.compiler_flag` attribute on the :class:`~__future__._Feature` " -"instance in the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` prefix." +"specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on " +"the :class:`~__future__._Feature` instance in the :mod:`__future__` " +"module. :ref:`Compiler flags ` can be found " +"in :mod:`ast` module, with ``PyCF_`` prefix." msgstr "" "有効化するコンパイラオプションと future 文はビットフィールドで指定可能で、" "ビット単位の OR をとることで複数のオプションを一緒に指定することができます。" -"特定の future 機能を指定するために必要なビットフィールドの情報は、 :mod:" -"`__future__` モジュールにおける :class:`~__future__._Feature` インスタンス" -"の :attr:`~__future__._Feature.compiler_flag` 属性で得ることができます。 :" -"ref:`コンパイラフラグ ` の情報は :mod:`ast` モジュールの " -"``PyCF_`` で始まるフラグで得ることができます。" +"特定の future 機能を指定するために必要なビットフィールドの情報" +"は、 :mod:`__future__` モジュールにおける :class:`~__future__._Feature` イン" +"スタンスの :attr:`~__future__._Feature.compiler_flag` 属性で得ることができま" +"す。 :ref:`コンパイラフラグ ` の情報は :mod:`ast` モ" +"ジュールの ``PyCF_`` で始まるフラグで得ることができます。" #: ../../library/functions.rst:333 msgid "" @@ -929,8 +931,8 @@ msgstr "" #: ../../library/functions.rst:342 msgid "" -"If you want to parse Python code into its AST representation, see :func:`ast." -"parse`." +"If you want to parse Python code into its AST representation, " +"see :func:`ast.parse`." msgstr "" "Python コードをパースしてその AST 表現を得たいのであれば、 :func:`ast.parse` " "を参照してください。" @@ -949,12 +951,12 @@ msgstr "" msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in the :mod:" -"`code` module." +"to facilitate detection of incomplete and complete statements in " +"the :mod:`code` module." msgstr "" "複数行に渡るコードの文字列を ``'single'`` や ``'eval'`` モードでコンパイルす" -"るとき、入力は一つ以上の改行文字で終端されなければなりません。これは、 :mod:" -"`code` モジュールで不完全な文と完全な文を検知しやすくするためです。" +"るとき、入力は一つ以上の改行文字で終端されなければなりません。これ" +"は、 :mod:`code` モジュールで不完全な文と完全な文を検知しやすくするためです。" #: ../../library/functions.rst:360 msgid "" @@ -1040,7 +1042,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 " @@ -1050,28 +1051,28 @@ msgid "" "and ``')'``, which are ignored. The string must not contain whitespace " "between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " "number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to the :" -"token:`~float:complexvalue` production rule in the following grammar, after " -"parentheses and leading and trailing whitespace characters are removed:" +"raises :exc:`ValueError`. More precisely, the input must conform to " +"the :token:`~float:complexvalue` production rule in the following grammar, " +"after parentheses and leading and trailing whitespace characters are removed:" msgstr "" "引数が文字列の場合、実数部( :func:`float` と同じ形式)、虚数部(同様の形式" "で ``'j'`` または ``'J'`` 接尾辞)どちらか、あるいは両方(この場合、虚数部の" -"符号は必須)を含まなければなりません。文字列 は空白や括弧 ``'('`` と``')'`` " +"符号は必須)を含まなければなりません。文字列 は空白や括弧 ``'('`` と ``')'`` " "で囲むこともできますが、無視されます。文字列は、 ``'+'`` 、``'-'`` 、 " "``'j'`` または ``'J'`` 接尾辞 、そして10進数の間に空白を含んではなりません。" -"たとえば ``complex('1+2j')`` はよいですが、 ``complex('1 + 2j')`` は :exc:" -"`ValueError` を送出します。より正確には、入力は括弧および先頭と末尾の空白文字" -"を除去した後、以下の文法における :token:`~float:complexvalue` の生成規則を満" -"たす必要があります:" +"たとえば ``complex('1+2j')`` はよいですが、 ``complex('1 + 2j')`` " +"は :exc:`ValueError` を送出します。より正確には、入力は括弧および先頭と末尾の" +"空白文字を除去した後、以下の文法における :token:`~float:complexvalue` の生成" +"規則を満たす必要があります:" #: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." -"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " -"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." -"__index__`." +"``complex(x)`` delegates to ``x.__complex__()``. " +"If :meth:`~object.__complex__` is not defined then it falls back " +"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "引数が数値の場合、コンストラクタは :class:`int` や :class:`float` のように数" "値変換します。一般的な Python オブジェクト ``x`` では、 ``complex(x)`` は " @@ -1101,6 +1102,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,15 +1112,13 @@ 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 "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" -"meth:`~object.__float__` are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " +"and :meth:`~object.__float__` are not defined." msgstr "" ":meth:`~object.__complex__` と :meth:`~object.__float__` が定義されていない場" "合、 :meth:`~object.__index__` へフォールバックします。" @@ -1128,6 +1128,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 "" @@ -1154,11 +1156,12 @@ msgstr "" #: ../../library/functions.rst:479 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, and :" -"class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, " +"and :class:`tuple` classes, as well as the :mod:`collections` module." msgstr "" -"他のコンテナについては、 ビルトインの :class:`list`, :class:`set`, :class:" -"`tuple` クラスおよび :mod:`collections` モジュールを参照してください。" +"他のコンテナについては、 ビルトイン" +"の :class:`list`, :class:`set`, :class:`tuple` クラスおよ" +"び :mod:`collections` モジュールを参照してください。" #: ../../library/functions.rst:486 msgid "" @@ -1173,9 +1176,9 @@ msgstr "" msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` or :func:`~object." -"__getattribute__` function to customize the way :func:`dir` reports their " -"attributes." +"implement a custom :func:`~object.__getattr__` " +"or :func:`~object.__getattribute__` function to customize the " +"way :func:`dir` reports their attributes." msgstr "" "オブジェクトが :meth:`~object.__dir__` という名のメソッドを持つなら、そのメ" "ソッドが呼び出され、属性のリストを返さなければなりません。これにより、カスタ" @@ -1188,22 +1191,21 @@ msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " "attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a custom :" -"func:`~object.__getattr__`." +"necessarily complete and may be inaccurate when the object has a " +"custom :func:`~object.__getattr__`." msgstr "" "オブジェクトが :meth:`~object.__dir__` を提供しない場合、その型オブジェクト" "と、定義されていればオブジェクトの :attr:`~object.__dict__` 属性から、できる" -"だけ情報を集めようとします。結果のリストは必ずしも完全ではなく、カスタムの :" -"func:`~object.__getattr__` を持つ場合は不正確かもしれません。" +"だけ情報を集めようとします。結果のリストは必ずしも完全ではなく、カスタム" +"の :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 +1215,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 "" @@ -1254,10 +1255,10 @@ msgid "" "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " "For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually ``math." -"floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " -"is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " -"and ``0 <= abs(a % b) < abs(b)``." +"point numbers the result is ``(q, a % b)``, where *q* is usually " +"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " +"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " +"*b*, and ``0 <= abs(a % b) < abs(b)``." msgstr "" "2つの (複素数でない) 数を引数としてとり、整数の除法を行ったときの商と剰余から" "なる2つの数のペアを返します。被演算子の型が異なる場合、二項算術演算子での規則" @@ -1269,18 +1270,18 @@ msgstr "" #: ../../library/functions.rst:558 msgid "" -"Return an enumerate object. *iterable* must be a sequence, an :term:" -"`iterator`, or some other object which supports iteration. The :meth:" -"`~iterator.__next__` method of the iterator returned by :func:`enumerate` " -"returns a tuple containing a count (from *start* which defaults to 0) and " -"the values obtained from iterating over *iterable*." -msgstr "" -"enumerate オブジェクトを返します。 *iterable* は、シーケンスか :term:" -"`iterator` か、あるいはイテレーションをサポートするその他のオブジェクトでなけ" -"ればなりません。 :func:`enumerate` によって返されたイテレータの :meth:" -"`~iterator.__next__` メソッドは、 (デフォルトでは 0 となる *start* からの) カ" -"ウントと、 *iterable* 上のイテレーションによって得られた値を含むタプルを返し" -"ます。" +"Return an enumerate object. *iterable* must be a sequence, " +"an :term:`iterator`, or some other object which supports iteration. " +"The :meth:`~iterator.__next__` method of the iterator returned " +"by :func:`enumerate` returns a tuple containing a count (from *start* which " +"defaults to 0) and the values obtained from iterating over *iterable*." +msgstr "" +"enumerate オブジェクトを返します。 *iterable* は、シーケンス" +"か :term:`iterator` か、あるいはイテレーションをサポートするその他のオブジェ" +"クトでなければなりません。 :func:`enumerate` によって返されたイテレータ" +"の :meth:`~iterator.__next__` メソッドは、 (デフォルトでは 0 となる *start* " +"からの) カウントと、 *iterable* 上のイテレーションによって得られた値を含むタ" +"プルを返します。" #: ../../library/functions.rst:570 msgid "Equivalent to::" @@ -1349,14 +1350,14 @@ msgid "" "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " -"dictionary. If both mappings are omitted, the expression is executed with " -"the *globals* and *locals* in the environment where :func:`eval` is called. " -"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " -"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" -"`nonlocal` statement)." +"own ``__builtins__`` dictionary into *globals* before passing it " +"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " +"*globals* dictionary. If both mappings are omitted, the expression is " +"executed with the *globals* and *locals* in the environment " +"where :func:`eval` is called. Note, *eval()* will only have access to " +"the :term:`nested scopes ` (non-locals) in the enclosing " +"environment if they are already referenced in the scope that is " +"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." msgstr "" "*expression* 引数のパースと評価は、 *globals* / *locals* のマッピング(訳注:" "dict相当)をグローバル / ローカルの名前空間とした Python 式 (技術的な言葉では" @@ -1396,10 +1397,10 @@ msgid "" "current global and local dictionary, respectively, which may be useful to " "pass around for use by :func:`eval` or :func:`exec`." msgstr "" -"ヒント: :func:`exec` 関数により文の動的な実行がサポートされています。:func:" -"`globals` および :func:`locals` 関数は、それぞれ現在のグローバルおよびローカ" -"ルな辞書を返すので、それらを :func:`eval` や :func:`exec` に渡して使うことが" -"できます。" +"ヒント: :func:`exec` 関数により文の動的な実行がサポートされていま" +"す。:func:`globals` および :func:`locals` 関数は、それぞれ現在のグローバルお" +"よびローカルな辞書を返すので、それらを :func:`eval` や :func:`exec` に渡して" +"使うことができます。" #: ../../library/functions.rst:634 msgid "" @@ -1414,8 +1415,8 @@ msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." msgstr "" -"リテラルだけを含む式の文字列を安全に評価できる関数、 :func:`ast." -"literal_eval` も参照してください。" +"リテラルだけを含む式の文字列を安全に評価できる関" +"数、 :func:`ast.literal_eval` も参照してください。" #: ../../library/functions.rst:640 ../../library/functions.rst:642 #: ../../library/functions.rst:702 ../../library/functions.rst:704 @@ -1445,20 +1446,20 @@ msgid "" "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " "cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that the :" -"keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may " -"not be used outside of function definitions even within the context of code " -"passed to the :func:`exec` function. The return value is ``None``." +"the section :ref:`file-input` in the Reference Manual). Be aware that " +"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " +"may not be used outside of function definitions even within the context of " +"code passed to the :func:`exec` function. The return value is ``None``." msgstr "" "この関数は Python コードの動的な実行をサポートします。 *source* は文字列か" "コードオブジェクトでなければなりません。文字列の場合、その文字列は一連の " "Python 文として解析され、そして (構文エラーにならない限り) 実行されます。 " "[#]_ コードオブジェクトの場合は、単純に実行されます。どの場合でも、実行される" "コードはファイル入力形式として有効であることが期待されます (リファレンスマ" -"ニュアルの :ref:`file-input` 節を参照してください)。 :keyword:`nonlocal`, :" -"keyword:`yield`, および :keyword:`return` 文は、 :func:`exec` 関数に渡された" -"コードの文脈中でさえ、関数定義の外側で使うことはできません。戻り値は " -"``None`` です。" +"ニュアルの :ref:`file-input` 節を参照してくださ" +"い)。 :keyword:`nonlocal`, :keyword:`yield`, および :keyword:`return` 文" +"は、 :func:`exec` 関数に渡されたコードの文脈中でさえ、関数定義の外側で使うこ" +"とはできません。戻り値は ``None`` です。" #: ../../library/functions.rst:674 msgid "" @@ -1495,9 +1496,9 @@ msgstr "" #: ../../library/functions.rst:690 msgid "" "If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in module :mod:" -"`builtins` is inserted under that key. That way you can control what " -"builtins are available to the executed code by inserting your own " +"``__builtins__``, a reference to the dictionary of the built-in " +"module :mod:`builtins` is inserted under that key. That way you can control " +"what builtins are available to the executed code by inserting your own " "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "*globals* 辞書がキー ``__builtins__`` に対する値を含まなければ、そのキーに対" @@ -1530,44 +1531,45 @@ msgid "" "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"標準では *locals* は後に述べる関数 :func:`locals` のように動作します。 :func:" -"`exec` の呼び出しが返る時にコードが *locals* に与える影響を知りたいなら、明示" -"的に *locals* 辞書を渡してください。" +"標準では *locals* は後に述べる関数 :func:`locals` のように動作しま" +"す。 :func:`exec` の呼び出しが返る時にコードが *locals* に与える影響を知りた" +"いなら、明示的に *locals* 辞書を渡してください。" #: ../../library/functions.rst:719 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 +1599,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 +1608,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 "" @@ -1630,23 +1632,23 @@ msgid "" "float, an :exc:`OverflowError` will be raised." msgstr "" "また、引数が整数または浮動小数点数なら、 (Python の浮動小数点数の精度で) 同じ" -"値の浮動小数点数が返されます。 引数が Python の浮動小数点数の範囲外なら、 :" -"exc:`OverflowError` が送出されます。" +"値の浮動小数点数が返されます。 引数が 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__`." +"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:" -"`~object.__index__` へフォールバックします。" +"に委譲します。 :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,21 +1685,22 @@ 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 " -"searching for the value's :meth:`~object.__format__` method. A :exc:" -"`TypeError` exception is raised if the method search reaches :mod:`object` " -"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` が" -"送出されます。" +"A call to ``format(value, format_spec)`` is translated to " +"``type(value).__format__(value, format_spec)`` which bypasses the instance " +"dictionary when searching for the value's :meth:`~object.__format__` method. " +"A :exc:`TypeError` exception is raised if the method search " +"reaches :mod:`object` 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)`` に置き換えられ、\n" +"``value`` の :meth:`~object.__format__` メソッドを探す際にインスタンスの辞書" +"を参照しません。\n" +"メソッドの探索が :mod:`object` に到達し、かつ *format_spec* が空でない場合" +"や、\n" +"*format_spec* または返り値が文字列でない場合は、:exc:`TypeError` が送出されま" +"す。" #: ../../library/functions.rst:843 msgid "" @@ -1710,8 +1713,8 @@ msgstr "" #: ../../library/functions.rst:852 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" -"ref:`types-set` for documentation about this class." +"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " +"and :ref:`types-set` for documentation about this class." msgstr "" "新しい :class:`frozenset` オブジェクトを返します。オプションで *iterable* か" "ら得られた要素を含みます。 ``frozenset`` はビルトインクラスです。このクラスに" @@ -1720,11 +1723,13 @@ msgstr "" #: ../../library/functions.rst:856 msgid "" -"For other containers see the built-in :class:`set`, :class:`list`, :class:" -"`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." +"For other containers see the built-" +"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " +"as well as the :mod:`collections` module." msgstr "" -"他のコンテナについては、ビルトインクラス :class:`set`, :class:`list`, :class:" -"`tuple`, :class:`dict` や :mod:`collections` モジュールを見てください。" +"他のコンテナについては、ビルトインクラ" +"ス :class:`set`, :class:`list`, :class:`tuple`, :class:`dict` " +"や :mod:`collections` モジュールを見てください。" #: ../../library/functions.rst:864 msgid "" @@ -1737,33 +1742,32 @@ msgid "" msgstr "" "*object* の指定された属性の値を返します。 *name* は文字列でなければなりませ" "ん。与えられた文字列がオブジェクトの属性名のうちいずれかに一致すれば、戻り値" -"はその属性の値になります。たとえば、 ``getattr(x, 'foobar')`` は ``x." -"foobar`` と等価です。もし指定された属性が存在しない場合、 *default* が指定さ" -"れていればその値が返されます。そうでない場合は :exc:`AttributeError` が送出さ" -"れます。 *name* は Python 識別子である必要はありません (:func:`setattr` を参" -"照してください)。" +"はその属性の値になります。たとえば、 ``getattr(x, 'foobar')`` は " +"``x.foobar`` と等価です。もし指定された属性が存在しない場合、 *default* が指" +"定されていればその値が返されます。そうでない場合は :exc:`AttributeError` が送" +"出されます。 *name* は Python 識別子である必要はありません (:func:`setattr` " +"を参照してください)。" #: ../../library/functions.rst:873 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it with :func:" -"`getattr`." +"with two leading underscores) name in order to retrieve it " +"with :func:`getattr`." msgstr "" ":ref:`プライベートな名前のマングリング ` はコンパイル" "時に行われます。そのため、プライベートな属性 (先頭に2つのアンダースコアを伴う" "名前を持つ属性) の値を :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 "" @@ -1791,12 +1795,13 @@ msgstr "" #: ../../library/functions.rst:903 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note that :func:" -"`hash` truncates the return value based on the bit width of the host machine." +"For objects with custom :meth:`~object.__hash__` methods, note " +"that :func:`hash` truncates the return value based on the bit width of the " +"host machine." msgstr "" -"独自の :meth:`~object.__hash__` メソッドを実装したオブジェクトを使う場合、:" -"func:`hash` が実行するマシンのビット幅に合わせて戻り値を切り捨てることに注意" -"してください。" +"独自の :meth:`~object.__hash__` メソッドを実装したオブジェクトを使う場" +"合、:func:`hash` が実行するマシンのビット幅に合わせて戻り値を切り捨てることに" +"注意してください。" #: ../../library/functions.rst:910 msgid "" @@ -1826,11 +1831,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 "" @@ -1843,12 +1847,12 @@ msgstr "" #: ../../library/functions.rst:931 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" -"meth:`~object.__index__` method that returns an integer. Some examples:" +"\"0x\". If *x* is not a Python :class:`int` object, it has to define " +"an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" "整数を先頭に \"0x\" が付いた小文字の 16 進文字列に変換します。\n" -"*x* が Python の :class:`int` オブジェクトでない場合、整数を返す :meth:" -"`~object.__index__` メソッドが定義されていなければなりません。\n" +"*x* が Python の :class:`int` オブジェクトでない場合、整数を返" +"す :meth:`~object.__index__` メソッドが定義されていなければなりません。\n" "いくつかの例を示します:" #: ../../library/functions.rst:940 @@ -1869,8 +1873,8 @@ msgstr "" #: ../../library/functions.rst:957 msgid "" -"To obtain a hexadecimal string representation for a float, use the :meth:" -"`float.hex` method." +"To obtain a hexadecimal string representation for a float, use " +"the :meth:`float.hex` method." msgstr "" "浮動小数点数の16進文字列表記を得たい場合には、 :meth:`float.hex` メソッドを" "使って下さい。" @@ -1890,24 +1894,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 +1921,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 "" @@ -1980,10 +1988,15 @@ msgstr "" #: ../../library/functions.rst:1023 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." -"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " -"``x.__index__()``. For floating-point numbers, this truncates towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " +"``x.__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 "" @@ -1994,13 +2007,12 @@ msgid "" "whitespace, and have single underscores interspersed between digits." msgstr "" "引数が数値でないか、または *base* が与えられた場合、引数は *base* を基数とし" -"た整数を表現する文字列、 :class:`bytes` インスタンス、または :class:" -"`bytearray` インスタンスのいずれかでなければなりません。文字列は先頭に ``+`` " -"または ``-`` を伴ったり (符号と数値の間に空白文字を入れてはいけません)、数値" -"の先頭に任意の数のゼロを付けたり、前後に空白文字を付けたり、各桁を単一の下線" -"で区切ったりしても有効です。" +"た整数を表現する文字列、 :class:`bytes` インスタンス、また" +"は :class:`bytearray` インスタンスのいずれかでなければなりません。文字列は先" +"頭に ``+`` または ``-`` を伴ったり (符号と数値の間に空白文字を入れてはいけま" +"せん)、数値の先頭に任意の数のゼロを付けたり、前後に空白文字を付けたり、各桁を" +"単一の下線で区切ったりしても有効です。" -#: ../../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 +2025,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`." @@ -2031,16 +2043,16 @@ msgstr "整数型については、 :ref:`typesnumeric` も参照してくださ #: ../../library/functions.rst:1047 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has a :" -"meth:`base.__index__ ` method, that method is called to " +"If *base* is not an instance of :class:`int` and the *base* object has " +"a :meth:`base.__index__ ` method, that method is called to " "obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" -"*base* が :class:`int` のインスタンスでなく、*base* オブジェクトが :meth:" -"`base.__index__ ` メソッドを持っている場合、そのメソッドを" -"呼んで底に対する整数を得ることができます。以前のバージョンでは :meth:`base." -"__index__ ` ではなく :meth:`base.__int__ ` " -"を使用していました。" +"*base* が :class:`int` のインスタンスでなく、*base* オブジェクト" +"が :meth:`base.__index__ ` メソッドを持っている場合、そのメ" +"ソッドを呼んで底に対する整数を得ることができます。以前のバージョンで" +"は :meth:`base.__index__ ` ではなく :meth:`base.__int__ " +"` を使用していました。" #: ../../library/functions.rst:1057 msgid "The first parameter is now positional-only." @@ -2059,20 +2071,21 @@ msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " "limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See the :" -"ref:`integer string conversion length limitation ` " +"converting an :class:`int` into a string would exceed the limit. See " +"the :ref:`integer string conversion length limitation ` " "documentation." msgstr "" ":class:`int` への文字列入力やその文字列表現は、サービス拒否攻撃 (DoS 攻撃) を" -"避けるために制限されることがあります。文字列を :class:`int` に変換したり :" -"class:`int` を文字列に変換したりする際にその制限を超えた場合、 :exc:" -"`ValueError` が送出されます。詳しくは :ref:`整数文字列の変換における長さ制限 " -"` を参照してください。" +"避けるために制限されることがあります。文字列を :class:`int` に変換した" +"り :class:`int` を文字列に変換したりする際にその制限を超えた場" +"合、 :exc:`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 "" @@ -2082,9 +2095,9 @@ msgid "" "the function always returns ``False``. If *classinfo* is a tuple of type " "objects (or recursively, other such tuples) or a :ref:`types-union` of " "multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, a :" -"exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for " -"an invalid type if an earlier check succeeds." +"types. If *classinfo* is not a type or tuple of types and such tuples, " +"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " +"for an invalid type if an earlier check succeeds." msgstr "" "*object* 引数が *classinfo* 引数に指定した型、またはその (直接、間接、また" "は :term:`仮想 ` の) サブクラスのインスタンスである場合" @@ -2103,10 +2116,10 @@ msgstr "*classinfo* に :ref:`types-union` を指定できるようになりま #: ../../library/functions.rst:1093 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, or :term:" -"`virtual `) of *classinfo*. A class is considered a " -"subclass of itself. *classinfo* may be a tuple of class objects (or " -"recursively, other such tuples) or a :ref:`types-union`, in which case " +"Return ``True`` if *class* is a subclass (direct, indirect, " +"or :term:`virtual `) of *classinfo*. A class is " +"considered a subclass of itself. *classinfo* may be a tuple of class objects " +"(or recursively, other such tuples) or a :ref:`types-union`, in which case " "return ``True`` if *class* is a subclass of any entry in *classinfo*. In " "any other case, a :exc:`TypeError` exception is raised." msgstr "" @@ -2122,10 +2135,10 @@ msgstr "" msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " -"second argument, *object* must be a collection object which supports the :" -"term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must " -"support the sequence protocol (the :meth:`~object.__getitem__` method with " -"integer arguments starting at ``0``). If it does not support either of " +"second argument, *object* must be a collection object which supports " +"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it " +"must support the sequence protocol (the :meth:`~object.__getitem__` method " +"with integer arguments starting at ``0``). If it does not support either of " "those protocols, :exc:`TypeError` is raised. If the second argument, " "*sentinel*, is given, then *object* must be a callable object. The iterator " "created in this case will call *object* with no arguments for each call to " @@ -2134,16 +2147,17 @@ msgid "" "returned." msgstr "" ":term:`iterator` オブジェクトを返します。第二引数があるかどうかによって第一引" -"数の解釈は大きく異なります。第二引数がない場合、 *object* は :term:" -"`iterable` プロトコル (:meth:`~object.__iter__` メソッド) をサポートするコレ" -"クションオブジェクトか、またはシーケンスプロトコル (``0`` から始まる整数を引" -"数にとる :meth:`~object.__getitem__` メソッド) をサポートするオブジェクトでな" -"ければなりません。第一引数がどちらのプロトコルもサポートしない場合は :exc:" -"`TypeError` 例外が送出されます。第二引数 *sentinel* が与えられた場合、 " -"*object* は呼び出し可能オブジェクトでなければなりません。この場合に生成される" -"イテレータは :meth:`~iterator.__next__` メソッドを呼び出すごとに引数なしで " -"*object* を呼び出します; 戻り値が *sentinel* と等しければ、 :exc:" -"`StopIteration` が送出されます。それ以外の場合は戻り値がそのまま返されます。" +"数の解釈は大きく異なります。第二引数がない場合、 *object* " +"は :term:`iterable` プロトコル (:meth:`~object.__iter__` メソッド) をサポート" +"するコレクションオブジェクトか、またはシーケンスプロトコル (``0`` から始まる" +"整数を引数にとる :meth:`~object.__getitem__` メソッド) をサポートするオブジェ" +"クトでなければなりません。第一引数がどちらのプロトコルもサポートしない場合" +"は :exc:`TypeError` 例外が送出されます。第二引数 *sentinel* が与えられた場" +"合、 *object* は呼び出し可能オブジェクトでなければなりません。この場合に生成" +"されるイテレータは :meth:`~iterator.__next__` メソッドを呼び出すごとに引数な" +"しで *object* を呼び出します; 戻り値が *sentinel* と等しけれ" +"ば、 :exc:`StopIteration` が送出されます。それ以外の場合は戻り値がそのまま返" +"されます。" #: ../../library/functions.rst:1122 msgid "See also :ref:`typeiter`." @@ -2183,19 +2197,20 @@ msgstr "" #: ../../library/functions.rst:1142 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." -"maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger " +"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." msgstr "" -"``len`` は、例えば :class:`range(2 ** 100) ` のような、 :data:`sys." -"maxsize` を超える長さに対して :exc:`OverflowError` を送出します。" +"``len`` は、例えば :class:`range(2 ** 100) ` のよう" +"な、 :data:`sys.maxsize` を超える長さに対して :exc:`OverflowError` を送出しま" +"す。" #: ../../library/functions.rst:1151 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." msgstr "" -":class:`list` は、実際には関数ではなくミュータブルなシーケンス型で、 :ref:" -"`typesseq-list` と :ref:`typesseq` にドキュメント化されています。" +":class:`list` は、実際には関数ではなくミュータブルなシーケンス型" +"で、 :ref:`typesseq-list` と :ref:`typesseq` にドキュメント化されています。" #: ../../library/functions.rst:1157 msgid "" @@ -2209,26 +2224,25 @@ msgstr "" #: ../../library/functions.rst:1161 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace as :func:" -"`globals`." +"single namespace, this function returns the same namespace " +"as :func:`globals`." 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 "" @@ -2295,10 +2309,10 @@ msgstr "" #: ../../library/functions.rst:1200 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior in :term:" -"`optimized scopes ` is now as described above. Aside from " -"being defined, the behaviour in other scopes remains unchanged from previous " -"versions." +"returned from this function are now defined. The behavior " +"in :term:`optimized scopes ` is now as described above. " +"Aside from being defined, the behaviour in other scopes remains unchanged " +"from previous versions." msgstr "" ":pep:`667` の一部として、この関数から返されるマッピングオブジェクトを変更する" "セマンティクスが定義されました。 :term:`optimized scopes ` " @@ -2316,10 +2330,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,23 +2350,22 @@ 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 "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " "*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, a :exc:" -"`ValueError` is raised." +"empty. If the iterable is empty and *default* is not provided, " +"a :exc:`ValueError` is raised." msgstr "" "任意のキーワード専用引数が 2 つあります。\n" "*key* 引数は引数を 1 つ取る順序関数 (:meth:`list.sort` のもののように) を指定" @@ -2358,13 +2379,13 @@ msgstr "" msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq." -"nlargest(1, iterable, key=keyfunc)``." +"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " +"``heapq.nlargest(1, iterable, key=keyfunc)``." msgstr "" "最大の要素が複数あるとき、この関数はそのうち最初に現れたものを返します。これ" -"は、``sorted(iterable, key=keyfunc, reverse=True)[0]`` や ``heapq." -"nlargest(1, iterable, key=keyfunc)`` のような、他のソート安定性を維持するツー" -"ルと両立します。" +"は、``sorted(iterable, key=keyfunc, reverse=True)[0]`` や " +"``heapq.nlargest(1, iterable, key=keyfunc)`` のような、他のソート安定性を維持" +"するツールと両立します。" #: ../../library/functions.rst:1246 ../../library/functions.rst:1284 msgid "Added the *default* keyword-only parameter." @@ -2376,8 +2397,8 @@ msgstr "*key* 引数が ``None`` であることを許容します。" #: ../../library/functions.rst:1257 msgid "" -"Return a \"memory view\" object created from the given argument. See :ref:" -"`typememoryview` for more information." +"Return a \"memory view\" object created from the given argument. " +"See :ref:`typememoryview` for more information." msgstr "" "与えられたオブジェクトから作られた \"メモリビュー\" オブジェクトを返します。" "詳しくは :ref:`typememoryview` を参照してください。" @@ -2389,15 +2410,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 "" @@ -2412,9 +2432,10 @@ msgstr "" #: ../../library/functions.rst:1294 msgid "" -"Retrieve the next item from the :term:`iterator` by calling its :meth:" -"`~iterator.__next__` method. If *default* is given, it is returned if the " -"iterator is exhausted, otherwise :exc:`StopIteration` is raised." +"Retrieve the next item from the :term:`iterator` by calling " +"its :meth:`~iterator.__next__` method. If *default* is given, it is " +"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " +"raised." msgstr "" ":term:`iterator` の :meth:`~iterator.__next__` メソッドを呼び出すことにより、" "次の要素を取得します。イテレータが使い尽くされた場合、 *default* が与えられて" @@ -2428,12 +2449,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 "" @@ -2444,8 +2472,8 @@ msgid "" msgstr "" "整数を先頭に \"0o\" が付いた 8 進文字列に変換します。\n" "結果は Python の式としても使える形式になります。\n" -"*x* が Python の :class:`int` オブジェクトでない場合、整数を返す :meth:" -"`~object.__index__` メソッドが定義されていなければなりません。\n" +"*x* が Python の :class:`int` オブジェクトでない場合、整数を返" +"す :meth:`~object.__index__` メソッドが定義されていなければなりません。\n" "例えば、次のようになります:" #: ../../library/functions.rst:1325 @@ -2466,7 +2494,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 +2501,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 "" @@ -2488,10 +2516,10 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-dependent: :func:" -"`locale.getencoding` is called to get the current locale encoding. (For " -"reading and writing raw bytes use binary mode and leave *encoding* " -"unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-" +"dependent: :func:`locale.getencoding` is called to get the current locale " +"encoding. (For reading and writing raw bytes use binary mode and leave " +"*encoding* unspecified.) The available modes are:" msgstr "" "*mode* オプション文字列はファイルが開かれる際のモードを指定します。デフォルト" "は ``'r'`` で、読み込み用にテキストモードで開くという意味です。その他によく使" @@ -2568,15 +2596,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 "" @@ -2626,10 +2654,10 @@ msgstr "" "の形式でバッファサイズを指定した場合、バイナリ形式でバッファリングをサポート" "する I/O (buffered I/O) にはそのまま適用されますが、 ``TextIOWrapper`` (すな" "わち ``mode='r+'`` のモードでオープンされたファイル) では別のバッファリングを" -"行うかもしれません。 ``TextIOWrapper`` でバッファリングを無効化するには、 :" -"func:`io.TextIOWrapper.reconfigure` で ``write_through`` フラグを使うことを検" -"討してください。 *buffering* 引数が与えられなかった場合、デフォルトのバッファ" -"リングポリシーは以下のように動作します:" +"行うかもしれません。 ``TextIOWrapper`` でバッファリングを無効化するに" +"は、 :func:`io.TextIOWrapper.reconfigure` で ``write_through`` フラグを使うこ" +"とを検討してください。 *buffering* 引数が与えられなかった場合、デフォルトの" +"バッファリングポリシーは以下のように動作します:" #: ../../library/functions.rst:1408 msgid "" @@ -2638,6 +2666,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 "" @@ -2669,14 +2701,15 @@ msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " "standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered with :func:`codecs." -"register_error` is also valid. The standard names include:" +"though any error handling name that has been registered " +"with :func:`codecs.register_error` is also valid. The standard names " +"include:" msgstr "" "*errors* はオプションの文字列で、エンコードやデコードでのエラーをどのように扱" "うかを指定するものです。バイナリモードでは使用できません。様々な標準のエラー" -"ハンドラが使用可能です (:ref:`error-handlers` に列記されています) が、 :func:" -"`codecs.register_error` に登録されているエラー処理の名前も使用可能です。標準" -"のエラーハンドラの名前には、以下のようなものがあります:" +"ハンドラが使用可能です (:ref:`error-handlers` に列記されています) " +"が、 :func:`codecs.register_error` に登録されているエラー処理の名前も使用可能" +"です。標準のエラーハンドラの名前には、以下のようなものがあります:" #: ../../library/functions.rst:1431 msgid "" @@ -2772,10 +2805,10 @@ msgstr "" #: ../../library/functions.rst:1475 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line separator, :" -"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " -"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " -"characters written are translated to the given string." +"characters written are translated to the system default line " +"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " +"translation takes place. If *newline* is any of the other legal values, any " +"``'\\n'`` characters written are translated to the given string." msgstr "" "ストリームへの出力の書き込み時、*newline* が ``None`` の場合、全ての " "``'\\n'`` 文字はシステムのデフォルトの行セパレータ :data:`os.linesep` に変換" @@ -2816,8 +2849,8 @@ msgstr "新たに作成されたファイルは :ref:`継承不可 ` parameter of the :func:" -"`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of " +"the :func:`os.open` function to open a file relative to a given directory::" msgstr "" "次の例は :func:`os.open` 関数の :ref:`dir_fd ` 引数を使い、与えられた" "ディレクトリからの相対パスで指定されたファイルを開きます::" @@ -2848,22 +2881,22 @@ msgstr "" msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :" -"class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used " -"to open a file in a binary mode with buffering, the returned class is a " +"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " +"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " +"used to open a file in a binary mode with buffering, the returned class is a " "subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " "binary mode, it returns an :class:`io.BufferedReader`; in write binary and " "append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" "write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io." -"FileIO`, is returned." -msgstr "" -":func:`open` 関数が返す :term:`file object` の型はモードに依存します。 :func:" -"`open` をファイルをテキストモード (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, な" -"ど) で開くのに使ったときは :class:`io.TextIOBase` (特に :class:`io." -"TextIOWrapper`) のサブクラスを返します。\n" -"ファイルをバッファリング付きのバイナリモードで開くのに使ったときは :class:" -"`io.BufferedIOBase` のサブクラスを返します。\n" +"disabled, the raw stream, a subclass " +"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." +msgstr "" +":func:`open` 関数が返す :term:`file object` の型はモードに依存しま" +"す。 :func:`open` をファイルをテキストモード (``'w'``, ``'r'``, ``'wt'``, " +"``'rt'``, など) で開くのに使ったときは :class:`io.TextIOBase` (特" +"に :class:`io.TextIOWrapper`) のサブクラスを返します。\n" +"ファイルをバッファリング付きのバイナリモードで開くのに使ったとき" +"は :class:`io.BufferedIOBase` のサブクラスを返します。\n" "実際のクラスは様々です。\n" "読み込みバイナリモードでは :class:`io.BufferedReader` を返します。\n" "書き込みバイナリモードや追記バイナリモードでは :class:`io.BufferedWriter` を" @@ -2875,12 +2908,12 @@ msgstr "" #: ../../library/functions.rst:1528 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" -"`tempfile`, and :mod:`shutil`." +"(where :func:`open` is " +"declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" -":mod:`fileinput` 、(:func:`open` が宣言された場所である) :mod:`io` 、 :mod:" -"`os` 、 :mod:`os.path` 、 :mod:`tempfile` 、 :mod:`shutil` などの、ファイル操" -"作モジュールも参照してください。" +":mod:`fileinput` 、(:func:`open` が宣言された場所であ" +"る) :mod:`io` 、 :mod:`os` 、 :mod:`os.path` 、 :mod:`tempfile` 、 :mod:`shutil` " +"などの、ファイル操作モジュールも参照してください。" #: ../../library/functions.rst:1532 msgid "" @@ -2888,7 +2921,7 @@ msgid "" "``mode``, ``flags``." msgstr "" "引数 ``path``, ``mode``, ``flags`` を指定して :ref:`監査イベント ` " -"``open`` を送出します。 " +"``open`` を送出します。" #: ../../library/functions.rst:1534 msgid "" @@ -2917,8 +2950,8 @@ msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"既存のファイルを 排他的生成モード(``'x'``)で開いた場合、 :exc:" -"`FileExistsError` を送出するようになりました。" +"既存のファイルを 排他的生成モード(``'x'``)で開いた場" +"合、 :exc:`FileExistsError` を送出するようになりました。" #: ../../library/functions.rst:1547 msgid "The file is now non-inheritable." @@ -2927,8 +2960,8 @@ msgstr "ファイルが継承不可になりました。" #: ../../library/functions.rst:1551 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising an :" -"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "システムコールが中断されシグナルハンドラが例外を送出しなかった場合、この関数" "は :exc:`InterruptedError` 例外を送出する代わりにシステムコールを再試行するよ" @@ -2943,13 +2976,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`." +"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 +2999,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 @@ -2989,20 +3021,20 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" -"`float` with an integral exponent, a float result is delivered. For example, " -"``pow(-9, 2.0)`` returns ``81.0``." +"close to ``3j``. Whereas, for a negative base of type :class:`int` " +"or :class:`float` with an integral exponent, a float result is delivered. " +"For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" "引数は数値型でなければなりません。型混合の場合、二項算術演算における型強制規" "則が適用されます。 :class:`int` オペランドの場合、第2引数が負でない限り、結果" "は (型強制後の) オペランドと同じ型になります; 第2引数が負の場合、全ての引数は" "浮動小数点数に変換され、浮動小数点数の結果が返されます。例えば、 ``pow(10, " -"2)`` は ``100`` を返しますが、 ``pow(10, -2)`` は ``0.01`` を返します。底が :" -"class:`int` 型または :class:`float` 型で負の値であり、かつ指数が整数でない場" -"合、複素数の結果が返されます。例えば、 ``pow(-9, 0.5)`` は ``3j`` に近い値を" -"返します。一方で底が :class:`int` 型または :class:`float` の負の数であり、指" -"数が整数の場合、浮動小数点数の結果が返されます。例えば、``pow(-9, 2.0)`` は " -"``81.0`` を返します。" +"2)`` は ``100`` を返しますが、 ``pow(10, -2)`` は ``0.01`` を返します。底" +"が :class:`int` 型または :class:`float` 型で負の値であり、かつ指数が整数でな" +"い場合、複素数の結果が返されます。例えば、 ``pow(-9, 0.5)`` は ``3j`` に近い" +"値を返します。一方で底が :class:`int` 型または :class:`float` の負の数であ" +"り、指数が整数の場合、浮動小数点数の結果が返されます。例えば、``pow(-9, " +"2.0)`` は ``81.0`` を返します。" #: ../../library/functions.rst:1592 msgid "" @@ -3072,8 +3104,8 @@ msgstr "" "キーワードなしの引数はすべて、 :func:`str` がするように文字列に変換され、 " "*sep* で区切られながらストリームに書き出され、最後に *end* が続きます。 " "*sep* と *end* の両方とも、文字列でなければなりません。これらを ``None`` にす" -"ると、デフォルトの値が使われます。 *objects* が与えられなければ、 :func:" -"`print` は *end* だけを書き出します。" +"ると、デフォルトの値が使われます。 *objects* が与えられなけれ" +"ば、 :func:`print` は *end* だけを書き出します。" #: ../../library/functions.rst:1627 msgid "" @@ -3085,8 +3117,8 @@ msgstr "" "*file* 引数は、 ``write(string)`` メソッドを持つオブジェクトでなければなりま" "せん。指定されないか、 ``None`` である場合、 :data:`sys.stdout` が使われま" "す。表示される引数は全てテキスト文字列に変換されますから、 :func:`print` はバ" -"イナリモードファイルオブジェクトには使用できません。代わりに ``file." -"write(...)`` を使ってください。" +"イナリモードファイルオブジェクトには使用できません。代わりに " +"``file.write(...)`` を使ってください。" #: ../../library/functions.rst:1632 msgid "" @@ -3114,9 +3146,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 "" @@ -3162,8 +3193,8 @@ msgstr "" msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as a :" -"term:`decorator`::" +"possible to create read-only properties easily using :func:`property` as " +"a :term:`decorator`::" msgstr "" "*doc* は、与えられれば property 属性のドキュメント文字列になります。\n" "与えられなければ、 property は *fget* のドキュメント文字列 (もしあれば) をコ" @@ -3266,9 +3297,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 "" @@ -3281,10 +3313,9 @@ msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -":class:`range` は、実際には関数ではなくイミュータブルなシーケンス型で、 :ref:" -"`typesseq-range` と :ref:`typesseq` にドキュメント化されています。" +":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 +3327,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::" @@ -3329,16 +3362,16 @@ msgstr "" #: ../../library/functions.rst:1766 msgid "" -"Return a reverse :term:`iterator`. *seq* must be an object which has a :" -"meth:`~object.__reversed__` method or supports the sequence protocol (the :" -"meth:`~object.__len__` method and the :meth:`~object.__getitem__` method " -"with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. *seq* must be an object which has " +"a :meth:`~object.__reversed__` method or supports the sequence protocol " +"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " +"method with integer arguments starting at ``0``)." msgstr "" "要素を逆順に取り出すイテレータ (reverse :term:`iterator`) を返します。 *seq* " -"は :meth:`~object.__reversed__` メソッドを持つか、シーケンス型プロトコル ( :" -"meth:`~object.__len__` メソッド、および、 ``0`` 以上の整数を引数とする :meth:" -"`~object.__getitem__` メソッド) をサポートするオブジェクトでなければなりませ" -"ん。" +"は :meth:`~object.__reversed__` メソッドを持つか、シーケンス型プロトコル " +"( :meth:`~object.__len__` メソッド、および、 ``0`` 以上の整数を引数とす" +"る :meth:`~object.__getitem__` メソッド) をサポートするオブジェクトでなければ" +"なりません。" #: ../../library/functions.rst:1774 msgid "" @@ -3367,13 +3400,12 @@ msgstr "" "返り値は *ndigits* が指定されていないか ``None`` の場合は整数、そうでなければ" "返り値は *number* と同じ型です。" -#: ../../library/functions.rst:1787 msgid "" -"For a general Python object ``number``, ``round`` delegates to ``number." -"__round__``." +"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 "" @@ -3395,18 +3427,18 @@ msgid "" "set` for documentation about this class." msgstr "" "オプションで *iterable* の要素を持つ、新しい :class:`set` オブジェクトを返し" -"ます。 ``set`` は組み込みクラスです。このクラスについて詳しい情報は :class:" -"`set` や :ref:`types-set` を参照してください。" +"ます。 ``set`` は組み込みクラスです。このクラスについて詳しい情報" +"は :class:`set` や :ref:`types-set` を参照してください。" #: ../../library/functions.rst:1808 msgid "" -"For other containers see the built-in :class:`frozenset`, :class:`list`, :" -"class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " -"module." +"For other containers see the built-" +"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " +"classes, as well as the :mod:`collections` module." msgstr "" -"他のコンテナについては :mod:`collections` モジュールや組み込みの :class:" -"`frozenset` 、 :class:`list` 、 :class:`tuple` 、 :class:`dict` クラスを参照" -"してください。" +"他のコンテナについては :mod:`collections` モジュールや組み込み" +"の :class:`frozenset` 、 :class:`list` 、 :class:`tuple` 、 :class:`dict` ク" +"ラスを参照してください。" #: ../../library/functions.rst:1815 msgid "" @@ -3424,10 +3456,10 @@ msgstr "" #: ../../library/functions.rst:1821 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a custom :meth:" -"`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute " -"whose name is not an identifier will not be accessible using the dot " -"notation, but is accessible through :func:`getattr` etc.." +"unless the object chooses to enforce that, for example in a " +"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " +"attribute whose name is not an identifier will not be accessible using the " +"dot notation, but is accessible through :func:`getattr` etc.." msgstr "" ":meth:`~object.__getattribute__` のカスタマイズや :attr:`~object.__slots__` " "を通じてオブジェクトが強制していない限り、 *name* は :ref:`identifiers` で定" @@ -3452,9 +3484,9 @@ msgid "" "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -"``range(start, stop, step)`` で指定されたインデックスのセットを表す :term:" -"`slice` オブジェクトを返します。 引数 *start* と *step* のデフォルトは " -"``None`` です。" +"``range(start, stop, step)`` で指定されたインデックスのセットを表" +"す :term:`slice` オブジェクトを返します。 引数 *start* と *step* のデフォル" +"トは ``None`` です。" #: ../../library/functions.rst:1846 msgid "" @@ -3471,8 +3503,9 @@ msgstr "" #: ../../library/functions.rst:1851 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" -"`itertools.islice` for an alternate version that returns an :term:`iterator`." +"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " +"See :func:`itertools.islice` for an alternate version that returns " +"an :term:`iterator`." msgstr "" "スライスオブジェクトは、拡張インデックス構文が使われた場合にも作られます。 " "例: ``a[start:stop:step]`` や ``a[start:stop, i]`` 。 :term:`iterator` を返" @@ -3480,8 +3513,9 @@ msgstr "" #: ../../library/functions.rst:1856 msgid "" -"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" -"`~slice.stop`, and :attr:`~slice.step` are hashable)." +"Slice objects are now :term:`hashable` " +"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " +"are hashable)." msgstr "" "スライスオブジェクトが :term:`hashable` (ハッシュ可能) となりました (ただし、" "属性 :attr:`~slice.start` 、 :attr:`~slice.stop` 、 :attr:`~slice.step` がす" @@ -3498,14 +3532,14 @@ 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)." +"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 @@ -3552,9 +3586,9 @@ msgstr "" "が、 :PEP:`8` は6つの :ref:`比較演算子 ` を全て実装することを推" "奨しています。これにより、異なるメソッドを必要とする :func:`max` のような他の" "ソートツールを、同じデータに対して適用することによって起こりうるバグを避ける" -"助けになります。6つの比較演算子を全て実装することは、リフレクションによって :" -"meth:`~object.__gt__` メソッドを呼び出す可能性のある型混合の比較での混乱を避" -"けることにも役立ちます。 " +"助けになります。6つの比較演算子を全て実装することは、リフレクションによっ" +"て :meth:`~object.__gt__` メソッドを呼び出す可能性のある型混合の比較での混乱" +"を避けることにも役立ちます。 " #: ../../library/functions.rst:1890 msgid "" @@ -3586,23 +3620,23 @@ msgstr "" #: ../../library/functions.rst:1903 msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@staticmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" -"``@staticmethod`` 形式は関数 :term:`デコレータ ` です。詳しくは :" -"ref:`function` を参照してください。" +"``@staticmethod`` 形式は関数 :term:`デコレータ ` です。詳しく" +"は :ref:`function` を参照してください。" #: ../../library/functions.rst:1906 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static method :term:" -"`descriptor` is also callable, so it can be used in the class definition " -"(such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static " +"method :term:`descriptor` is also callable, so it can be used in the class " +"definition (such as ``f()``)." msgstr "" -"静的メソッドは (``C.f()`` のように) クラスに対して呼び出すことも、 (``C()." -"f()`` のように) インスタンスに対して呼び出すこともできます。さらに、静的メ" -"ソッド :term:`descriptor` は呼び出し可能でもあるため、(``f()`` のように) クラ" -"ス定義の中でも使用できます。" +"静的メソッドは (``C.f()`` のように) クラスに対して呼び出すことも、 " +"(``C().f()`` のように) インスタンスに対して呼び出すこともできます。さらに、静" +"的メソッド :term:`descriptor` は呼び出し可能でもあるため、(``f()`` のように) " +"クラス定義の中でも使用できます。" #: ../../library/functions.rst:1911 msgid "" @@ -3646,13 +3680,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." +"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,22 +3707,21 @@ 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 "" "For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling ``''." -"join(sequence)``. To add floating-point values with extended precision, " -"see :func:`math.fsum`\\. To concatenate a series of iterables, consider " -"using :func:`itertools.chain`." +"preferred, fast way to concatenate a sequence of strings is by calling " +"``''.join(sequence)``. To add floating-point values with extended " +"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " +"consider using :func:`itertools.chain`." msgstr "" "使う場面によっては、 :func:`sum` よりもいい選択肢があります。文字列からなる" "シーケンスを結合する高速かつ望ましい方法は ``''.join(sequence)`` を呼ぶことで" @@ -3698,19 +3735,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 "" @@ -3732,18 +3770,24 @@ msgstr "" #: ../../library/functions.rst:1985 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" -"> A -> object`` and the value of *type* is ``B``, then :func:`super` " +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " +"-> 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." +"*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 +3828,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 +3839,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::" @@ -3829,8 +3873,8 @@ msgid "" "` in a parent or sibling class." msgstr "" "メソッドのルックアップに加えて、 :func:`super` は属性のルックアップに対しても" -"同様に動作します。考えうる用途のひとつは親クラスや兄弟クラスの :term:" -"`descriptors ` (デスクリプタ) を呼び出すことです。" +"同様に動作します。考えうる用途のひとつは親クラスや兄弟クラス" +"の :term:`descriptors ` (デスクリプタ) を呼び出すことです。" #: ../../library/functions.rst:2032 msgid "" @@ -3842,13 +3886,12 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" "なお、:func:`super` は ``super().__getitem__(name)`` のような明示的なドット表" -"記属性探索の束縛処理の一部として実装されています。これは、 :meth:`~object." -"__getattribute__` メソッドを予測可能な順序でクラスを検索するように実装し、協" -"調的な多重継承をサポートすることで実現されています。従って、 :func:`super` は" -"文や ``super()[name]`` のような演算子を使った暗黙の探索向けには定義されていま" -"せん。" +"記属性探索の束縛処理の一部として実装されています。これ" +"は、 :meth:`~object.__getattribute__` メソッドを予測可能な順序でクラスを検索" +"するように実装し、協調的な多重継承をサポートすることで実現されています。従っ" +"て、 :func:`super` は文や ``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,17 +3900,18 @@ 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 "" -"For practical suggestions on how to design cooperative classes using :func:" -"`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes " +"using :func:`super`, see `guide to using super() `_." msgstr "" ":func:`super` を用いて協調的なクラスを設計する方法の実践的な提案は、 `guide " "to using super() ` and :mod:" -"`copyable `." +":class:`super` objects are now :mod:`pickleable ` " +"and :mod:`copyable `." msgstr "" +":class:`super` オブジェクトは :mod:`pickle 可能 ` かつ :mod:`コピー可" +"能 ` になりました。" #: ../../library/functions.rst:2061 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -":class:`tuple` は、実際は関数ではなくイミュータブルなシーケンス型で、:ref:" -"`typesseq-tuple` と :ref:`typesseq` にドキュメント化されています。" +":class:`tuple` は、実際は関数ではなくイミュータブルなシーケンス型" +"で、:ref:`typesseq-tuple` と :ref:`typesseq` にドキュメント化されています。" #: ../../library/functions.rst:2070 msgid "" "With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned by :attr:`object." -"__class__`." +"type object and generally the same object as returned " +"by :attr:`object.__class__`." msgstr "" +"引数が1つだけの場合、*object* の型を返します。返り値は型オブジェクトで、一般" +"に :attr:`object.__class__` によって返されるのと同じオブジェクトです。" #: ../../library/functions.rst:2074 msgid "" @@ -3910,22 +3958,28 @@ msgid "" "tuple contains the base classes and becomes the :attr:`~type.__bases__` " "attribute; if empty, :class:`object`, the ultimate base of all classes, is " "added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming the :attr:`~type." -"__dict__` attribute. The following two statements create identical :class:`!" -"type` objects:" -msgstr "" +"the class body; it may be copied or wrapped before becoming " +"the :attr:`~type.__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`" @@ -3939,8 +3993,8 @@ msgid "" "would." msgstr "" "三引数形式の呼び出しに与えられたキーワード引数は、(*metaclass* を除く) クラス" -"定義におけるキーワード引数と同様に、適切なメタクラスの機構 (通常は :meth:" -"`~object.__init_subclass__`) に渡されます。" +"定義におけるキーワード引数と同様に、適切なメタクラスの機構 (通常" +"は :meth:`~object.__init_subclass__`) に渡されます。" #: ../../library/functions.rst:2102 msgid "See also :ref:`class-customization`." @@ -3951,20 +4005,30 @@ 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 "" -"Objects such as modules and instances have an updateable :attr:`~object." -"__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." -"MappingProxyType` to prevent direct dictionary updates)." +"Objects such as modules and instances have an " +"updateable :attr:`~object.__dict__` attribute; however, other objects may " +"have write restrictions on 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`." @@ -3977,8 +4041,8 @@ msgid "" "defines the :attr:`~object.__slots__` attribute)." msgstr "" "指定されたオブジェクトに :attr:`~object.__dict__` 属性がない場合 (たとえばそ" -"のクラスが :attr:`~object.__slots__` 属性を定義している場合)、 :exc:" -"`TypeError` 例外が送出されます。" +"のクラスが :attr:`~object.__slots__` 属性を定義している場" +"合)、 :exc:`TypeError` 例外が送出されます。" #: ../../library/functions.rst:2127 msgid "" @@ -4027,8 +4091,8 @@ msgstr "" #: ../../library/functions.rst:2148 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"columns into rows. This is similar to `transposing a matrix `_." msgstr "" ":func:`zip` に対する別の考え方は、この関数は行を列に、また列を行に変換すると" "いうことです。これは `行列の転置 `_ " @@ -4037,8 +4101,8 @@ msgstr "" #: ../../library/functions.rst:2152 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" -"`list`." +"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " +"a :class:`list`." msgstr "" ":func:`zip` は遅延評価です: イテラブルが :keyword:`!for` ループに渡された" "り、 :class:`list` でラップされたりするなどして反復処理されるまで、要素が実際" @@ -4100,21 +4164,20 @@ 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 "" "Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done by :func:`itertools." -"zip_longest`." +"iterables have the same length. This is done " +"by :func:`itertools.zip_longest`." msgstr "" "短いイテラブルを一定の値でパディングして全てのイテラブルが同じ長さになるよう" "にすることもできます。この機能は :func:`itertools.zip_longest` で提供されま" @@ -4146,12 +4209,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 "" @@ -4199,11 +4261,10 @@ msgstr "" "置き換えて :keyword:`!import` 文のセマンティクスを変更することができますが、" "同様のことをするのに通常はインポートフック (:pep:`302` 参照) を利用する方が簡" "単で、かつデフォルトのインポート実装が使用されていることを仮定するコードとの" -"間で問題が起きないので、このやり方は *強く* 推奨されません。 :func:" -"`__import__` を直接使用することも推奨されず、 :func:`importlib." -"import_module` の方が好まれます。" +"間で問題が起きないので、このやり方は *強く* 推奨されませ" +"ん。 :func:`__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 +4273,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 +4288,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 +4326,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 +4377,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..ef8e67e06 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 @@ -56,8 +56,8 @@ msgid "" "Simple lightweight unbounded function cache. Sometimes called `\"memoize\" " "`_." msgstr "" -"簡単で軽量な無制限の関数キャッシュです。 `\"メモ化 (memoize)\" `_ とも呼ばれることがあります。" +"簡単で軽量な無制限の関数キャッシュです。 `\"メモ化 (memoize)\" `_ とも呼ばれることがあります。" #: ../../library/functools.rst:34 msgid "" @@ -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 "" @@ -109,17 +113,16 @@ msgid "" "computed properties of instances that are otherwise effectively immutable." msgstr "" "クラスのメソッドを、値を一度だけ計算して通常の属性としてキャッシュするプロパ" -"ティに変換します。キャッシュはインスタンスの生存期間にわたって有効です。:" -"func:`property` に似ていて、さらにキャッシュを行います。計算コストが高く、一" -"度計算すればその後は不変であるようなインスタンスのプロパティに対して有用で" -"す。" +"ティに変換します。キャッシュはインスタンスの生存期間にわたって有効で" +"す。:func:`property` に似ていて、さらにキャッシュを行います。計算コストが高" +"く、一度計算すればその後は不変であるようなインスタンスのプロパティに対して有" +"用です。" #: ../../library/functools.rst:70 ../../library/functools.rst:142 #: ../../library/functools.rst:432 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/functools.rst:72 msgid "" "class DataSet:\n" "\n" @@ -130,18 +133,25 @@ 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 "" -"The mechanics of :func:`cached_property` are somewhat different from :func:" -"`property`. A regular property blocks attribute writes unless a setter is " -"defined. In contrast, a *cached_property* allows writes." +"The mechanics of :func:`cached_property` are somewhat different " +"from :func:`property`. A regular property blocks attribute writes unless a " +"setter is defined. In contrast, a *cached_property* allows writes." msgstr "" ":func:`cached_property` のしくみは :func:`property` とやや異なります。通常の" "プロパティは、セッター (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 "" @@ -203,8 +221,8 @@ msgid "" "If a mutable mapping is not available or if space-efficient key sharing is " "desired, an effect similar to :func:`cached_property` can also be achieved " "by stacking :func:`property` on top of :func:`lru_cache`. See :ref:`faq-" -"cache-method-calls` for more details on how this differs from :func:" -"`cached_property`." +"cache-method-calls` for more details on how this differs " +"from :func:`cached_property`." msgstr "" #: ../../library/functools.rst:120 @@ -219,17 +237,16 @@ msgstr "" #: ../../library/functools.rst:130 msgid "" "Transform an old-style comparison function to a :term:`key function`. Used " -"with tools that accept key functions (such as :func:`sorted`, :func:`min`, :" -"func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:" -"`itertools.groupby`). This function is primarily used as a transition tool " -"for programs being converted from Python 2 which supported the use of " -"comparison functions." +"with tools that accept key functions (such " +"as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). " +"This function is primarily used as a transition tool for programs being " +"converted from Python 2 which supported the use of comparison functions." msgstr "" "古いスタイルの比較関数を :term:`key function` に変換します。key 関数を受け取" -"るツール (:func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :" -"func:`heapq.nsmallest`, :func:`itertools.groupby` など) と共に使用します。こ" -"の関数は、主に比較関数を使っていた Python 2 からプログラムの移行のための変換" -"ツールとして使われます。" +"るツール " +"(:func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby` " +"など) と共に使用します。この関数は、主に比較関数を使っていた Python 2 からプ" +"ログラムの移行のための変換ツールとして使われます。" #: ../../library/functools.rst:137 msgid "" @@ -243,10 +260,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 +290,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 +326,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 +346,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 +375,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." +"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 +407,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 +421,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,18 +449,34 @@ 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 "" -"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " -"programming `_ technique::" +"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a " +"`dynamic programming `_ " +"technique::" 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 "" @@ -471,11 +529,10 @@ msgid "" "or :meth:`__ge__`. In addition, the class should supply an :meth:`__eq__` " "method." msgstr "" -"引数のクラスは、 :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, :meth:" -"`__ge__` の中からどれか1つと、 :meth:`__eq__` メソッドを定義する必要がありま" -"す。" +"引数のクラス" +"は、 :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, :meth:`__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,36 +670,47 @@ 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 "" -"If :func:`!partial` is applied to an existing :func:`!partial` object, :data:" -"`!Placeholder` sentinels of the input object are filled in with new " -"positional arguments. A placeholder can be retained by inserting a new :data:" -"`!Placeholder` sentinel to the place held by a previous :data:`!Placeholder`:" +"If :func:`!partial` is applied to an existing :func:`!partial` " +"object, :data:`!Placeholder` sentinels of the input object are filled in " +"with new positional arguments. A placeholder can be retained by inserting a " +"new :data:`!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,22 +724,33 @@ 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 "" -"Return a new :class:`partialmethod` descriptor which behaves like :class:" -"`partial` except that it is designed to be used as a method definition " -"rather than being directly callable." +"Return a new :class:`partialmethod` descriptor which behaves " +"like :class:`partial` except that it is designed to be used as a method " +"definition rather than being directly callable." msgstr "" ":class:`partial` と似た動作をする新しい :class:`partialmethod` 記述子 (デスク" "リプタ) を返します。直接呼び出しではなく、メソッド定義としての使用が目的であ" @@ -654,32 +766,31 @@ msgstr "" #: ../../library/functools.rst:420 msgid "" -"When *func* is a descriptor (such as a normal Python function, :func:" -"`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or another " -"instance of :class:`partialmethod`), calls to ``__get__`` are delegated to " -"the underlying descriptor, and an appropriate :ref:`partial object` returned as the result." +"When *func* is a descriptor (such as a normal Python " +"function, :func:`classmethod`, :func:`staticmethod`, :func:`abstractmethod` " +"or another instance of :class:`partialmethod`), calls to ``__get__`` are " +"delegated to the underlying descriptor, and an appropriate :ref:`partial " +"object` returned as the result." msgstr "" -"*func* が記述子 (Python の通常の関数、 :func:`classmethod`、:func:" -"`staticmethod`、:func:`abstractmethod` または別の :class:`partialmethod` のイ" -"ンスタンスなど) の場合、 ``__get__`` への呼び出しは下層の記述子に委譲され、返" -"り値として適切な :ref:`partial オブジェクト` が返されます。" +"*func* が記述子 (Python の通常の関" +"数、 :func:`classmethod`、:func:`staticmethod`、:func:`abstractmethod` または" +"別の :class:`partialmethod` のインスタンスなど) の場合、 ``__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 " "a method: the *self* argument will be inserted as the first positional " -"argument, even before the *args* and *keywords* supplied to the :class:" -"`partialmethod` constructor." +"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 +810,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 +839,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,26 +877,26 @@ 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 "" -"Transform a function into a :term:`single-dispatch ` :term:" -"`generic function`." +"Transform a function into a :term:`single-dispatch ` :term:`generic function`." 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 +905,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 +924,6 @@ msgstr "" "型アノテーションが付いている関数については、このデコレータは1つ目の引数の型を" "自動的に推測します。" -#: ../../library/functools.rst:507 msgid "" ">>> @fun.register\n" "... def _(arg: int, verbose=False):\n" @@ -796,12 +938,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 +970,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 +993,6 @@ msgstr "" "型アノテーションを使っていないコードについては、デコレータに適切な型引数を明" "示的に渡せます::" -#: ../../library/functools.rst:540 msgid "" ">>> @fun.register(complex)\n" "... def _(arg, verbose=False):\n" @@ -836,16 +1001,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 +1026,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 +1054,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 +1075,6 @@ msgstr "" "り、複層デコレータ、デコレータの :mod:`pickle 化 `、各変数の独立なユ" "ニットテストの作成が可能です::" -#: ../../library/functools.rst:579 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -901,6 +1086,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 +1102,6 @@ msgid "" "argument::" msgstr "汎用関数は、呼び出されると 1 つ目の引数の型でディスパッチします::" -#: ../../library/functools.rst:592 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -927,19 +1120,35 @@ 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 " -"function decorated with ``@singledispatch`` is registered for the base :" -"class:`object` type, which means it is used if no better implementation is " -"found." +"function decorated with ``@singledispatch`` is registered for the " +"base :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 +1159,6 @@ msgstr "" "抽象基底クラス (:term:`abstract base class`) に対して実装が登録されると、基底" "クラスの仮想サブクラスに対してもその実装がディスパッチされます::" -#: ../../library/functools.rst:619 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -963,6 +1171,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 "" @@ -1013,8 +1231,8 @@ msgstr "" #: ../../library/functools.rst:662 msgid "" -"Transform a method into a :term:`single-dispatch ` :term:" -"`generic function`." +"Transform a method into a :term:`single-dispatch ` :term:`generic function`." msgstr "" "メソッドを :term:`シングルディスパッチ ` :term:`ジェネリック" "関数 ` に変換します。" @@ -1027,7 +1245,6 @@ msgid "" "argument::" msgstr "" -#: ../../library/functools.rst:670 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1042,14 +1259,26 @@ 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 "" -"``@singledispatchmethod`` supports nesting with other decorators such as :" -"func:`@classmethod`. Note that to allow for ``dispatcher." -"register``, ``singledispatchmethod`` must be the *outer most* decorator. " -"Here is the ``Negator`` class with the ``neg`` methods bound to the class, " -"rather than an instance of the class::" +"``@singledispatchmethod`` supports nesting with other decorators such " +"as :func:`@classmethod`. Note that to allow for " +"``dispatcher.register``, ``singledispatchmethod`` must be the *outer most* " +"decorator. Here is the ``Negator`` class with the ``neg`` methods bound to " +"the class, rather than an instance of the class::" msgstr "" "``@singledispatchmethod`` は :func:`@classmethod` など他のデコ" "レータとの入れ子構造をサポートします。 ``dispatcher.register`` を可能にするた" @@ -1057,7 +1286,6 @@ msgstr "" "でなければなりません。この ``Negator`` クラスの例では、クラスのインスタンスに" "ではなく、クラスに ``neg`` メソッドが紐付きます::" -#: ../../library/functools.rst:689 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1075,18 +1303,32 @@ 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 "" -"The same pattern can be used for other similar decorators: :func:" -"`@staticmethod`, :func:`@abstractmethod`, " +"The same pattern can be used for other similar " +"decorators: :func:`@staticmethod`, :func:`@abstractmethod`, " "and others." msgstr "" -"同様のパターンが他の似たようなデコレータに対しても適用できます: :func:" -"`@staticmethod`, :func:`@abstractmethod` な" -"ど。" +"同様のパターンが他の似たようなデコレータに対しても適用できま" +"す: :func:`@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 " @@ -1094,13 +1336,22 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" -"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." -"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " -"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " -"dictionary)." -msgstr "" +"(which assigns to the wrapper " +"function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, " +"and :attr:`~function.__doc__`, the documentation string) and " +"``WRAPPER_UPDATES`` (which updates 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`." +"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`)" +"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,12 +1449,32 @@ 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 "" "Without the use of this decorator factory, the name of the example function " -"would have been ``'wrapper'``, and the docstring of the original :func:" -"`example` would have been lost." +"would have been ``'wrapper'``, and the docstring of the " +"original :func:`example` would have been lost." msgstr "" "このデコレータ・ファクトリを使用しないと、上の例中の関数の名前は " "``'wrapper'`` となり、元の :func:`example` のドキュメンテーション文字列は失わ" @@ -1242,11 +1515,15 @@ 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 " -"attributes. There are some important differences. For instance, the :attr:" -"`~definition.__name__` and :attr:`~definition.__doc__` attributes are not " -"created automatically." -msgstr "" +"attributes. There are some important differences. For instance, " +"the :attr:`~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..0045f5877 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 @@ -47,9 +47,9 @@ msgstr "" "環ガベージコレクタはPythonの参照カウントを補うためのものなので、もしプログラ" "ム中で循環参照が発生しない事が明らかな場合には検出をする必要はありません。自" "動検出は、 ``gc.disable()`` で停止する事ができます。メモリリークをデバッグす" -"るときには、 ``gc.set_debug(gc.DEBUG_LEAK)`` とします。これは ``gc." -"DEBUG_SAVEALL`` を含んでいることに注意しましょう。ガベージとして検出されたオ" -"ブジェクトは、インスペクション用に gc.garbage に保存されます。" +"るときには、 ``gc.set_debug(gc.DEBUG_LEAK)`` とします。これは " +"``gc.DEBUG_SAVEALL`` を含んでいることに注意しましょう。ガベージとして検出され" +"たオブジェクトは、インスペクション用に gc.garbage に保存されます。" #: ../../library/gc.rst:23 msgid "The :mod:`gc` module provides the following functions:" @@ -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 "" @@ -119,9 +119,9 @@ msgid "" "written to ``sys.stderr``. See below for a list of debugging flags which " "can be combined using bit operations to control debugging." msgstr "" -"ガベージコレクションのデバッグフラグを設定します。デバッグ情報は ``sys." -"stderr`` に出力されます。デバッグフラグは、下の値の組み合わせを指定する事がで" -"きます。" +"ガベージコレクションのデバッグフラグを設定します。デバッグ情報は " +"``sys.stderr`` に出力されます。デバッグフラグは、下の値の組み合わせを指定する" +"事ができます。" #: ../../library/gc.rst:76 msgid "Return the debugging flags currently set." @@ -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 "" @@ -280,8 +277,8 @@ msgid "" msgstr "" "尚、戻り値のリストには、すでに参照されなくなっているが、循環参照の一部でまだ" "ガベージコレクションで回収されていないオブジェクトも含まれるので注意が必要で" -"す。有効なオブジェクトのみを取得する場合、 :func:`get_referrers` の前に :" -"func:`collect` を呼び出してください。" +"す。有効なオブジェクトのみを取得する場合、 :func:`get_referrers` の前" +"に :func:`collect` を呼び出してください。" #: ../../library/gc.rst:174 msgid "" @@ -294,41 +291,40 @@ 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:" -"member:`~PyTypeObject.tp_traverse` methods (if any), and may not be all " -"objects actually directly reachable. :c:member:`~PyTypeObject.tp_traverse` " -"methods are supported only by objects that support garbage collection, and " -"are only required to visit objects that may be involved in a cycle. So, for " -"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` はガベージコレクションをサポートするオブジェクト" -"のみが実装しており、ここで取得できるオブジェクトは循環参照の一部となる可能性" -"のあるオブジェクトのみです。従って、例えば整数オブジェクトが直接到達可能で" -"あっても、このオブジェクトは戻り値には含まれません。" - -#: ../../library/gc.rst:192 +"referents returned are those objects visited by the arguments' C-" +"level :c:member:`~PyTypeObject.tp_traverse` methods (if any), and may not be " +"all objects actually directly " +"reachable. :c:member:`~PyTypeObject.tp_traverse` methods are supported only " +"by objects that support garbage collection, and are only required to visit " +"objects that may be involved in a cycle. So, for example, if an integer is " +"directly reachable from an argument, that integer object may or may not " +"appear in the result list." +msgstr "" +"引数のいずれかから直接参照されているオブジェクトのリストを返します。\n" +"返される参照先は、各引数の C レベルの :c:member:`~PyTypeObject.tp_traverse` " +"メソッド (存在する場合) がたどったオブジェクトであり、実際に直接到達できるオ" +"ブジェクトがすべて含まれるとは限りません。\n" +":c:member:`~PyTypeObject.tp_traverse` メソッドをサポートするのはガベージコレ" +"クションをサポートするオブジェクトだけで、循環参照に関与し得るオブジェクトだ" +"けをたどることが要求されます。\n" +"例えば、引数から整数オブジェクトに直接到達できる場合、その整数が結果のリスト" +"に含まれることも、含まれないこともあります。" + 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 +358,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 +379,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 +409,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 +430,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 "" @@ -444,21 +459,22 @@ msgstr "" #: ../../library/gc.rst:283 msgid "" -"If this list is non-empty at :term:`interpreter shutdown`, a :exc:" -"`ResourceWarning` is emitted, which is silent by default. If :const:" -"`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable objects are " -"printed." +"If this list is non-empty at :term:`interpreter shutdown`, " +"a :exc:`ResourceWarning` is emitted, which is silent by default. " +"If :const:`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable " +"objects are printed." msgstr "" ":term:`インタプリタシャットダウン ` 時にこのリストが空" "でない場合、(デフォルトでは黙りますが) :exc:`ResourceWarning` が発行されま" "す。 :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 "" @@ -562,8 +578,8 @@ msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." msgstr "" -":term:`インタプリタシャットダウン ` 時に :data:" -"`garbage` リストが空でない場合に、その中身の出力も行います。" +":term:`インタプリタシャットダウン ` 時" +"に :data:`garbage` リストが空でない場合に、その中身の出力も行います。" #: ../../library/gc.rst:355 msgid "" diff --git a/library/getopt.po b/library/getopt.po index ae5857d10..2dbc6a49b 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,17 +36,26 @@ 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` " +"This module helps scripts to parse the command line arguments in " +"``sys.argv``. It supports the same conventions as the Unix :c:func:`!getopt` " "function (including the special meanings of arguments of the form '``-``' " "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,30 +64,44 @@ 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. " "Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option " "letters that the script wants to recognize, with options that require an " "argument followed by a colon (``':'``) and options that accept an optional " -"argument followed by two colons (``'::'``); i.e., the same format that Unix :" -"c:func:`!getopt` uses." -msgstr "" +"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 " @@ -91,9 +112,20 @@ msgid "" "string. Long options on the command line can be recognized so long as they " "provide a prefix of the option name that matches exactly one of the accepted " "options. For example, if *longopts* is ``['foo', 'frob']``, the option ``--" -"fo`` will match as ``--foo``, but ``--f`` will not match uniquely, so :exc:" -"`GetoptError` will be raised." -msgstr "" +"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 "" @@ -101,9 +133,9 @@ msgid "" "value)`` pairs; the second is the list of program arguments left after the " "option list was stripped (this is a trailing slice of *args*). Each option-" "and-value pair returned has the option as its first element, prefixed with a " -"hyphen for short options (e.g., ``'-x'``) or two hyphens for long options (e." -"g., ``'--long-option'``), and the option argument as its second element, or " -"an empty string if the option has no argument. The options occur in the " +"hyphen for short options (e.g., ``'-x'``) or two hyphens for long options " +"(e.g., ``'--long-option'``), and the option argument as its second element, " +"or an empty string if the option has no argument. The options occur in the " "list in the same order in which they were found, thus allowing multiple " "occurrences. Long and short options may be mixed." msgstr "" @@ -116,9 +148,8 @@ msgstr "" "順に並んでいて、複数回同じオプションを指定できます。長形式と短形式のオプショ" "ンは混在できます。" -#: ../../library/getopt.rst:75 msgid "Optional arguments are supported." -msgstr "" +msgstr "省略可能な引数がサポートされました。" #: ../../library/getopt.rst:81 msgid "" @@ -127,19 +158,20 @@ msgid "" "intermixed. The :func:`getopt` function stops processing options as soon as " "a non-option argument is encountered." msgstr "" -"この関数はデフォルトで GNU スタイルのスキャンモードを使う以外は :func:" -"`getopt` と同じように動作します。つまり、オプションとオプションでない引数とを" -"混在させることができます。:func:`getopt` 関数はオプションでない引数を見つける" -"と解析を停止します。" +"この関数はデフォルトで GNU スタイルのスキャンモードを使う以外" +"は :func:`getopt` と同じように動作します。つまり、オプションとオプションでな" +"い引数とを混在させることができます。: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:" +"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..4a4f391b5 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,23 +31,21 @@ 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/getpass.rst:17 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 "" @@ -75,30 +74,29 @@ msgstr "" #: ../../library/getpass.rst:34 msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " -"message to *stream* and reading from ``sys.stdin`` and issuing a :exc:" -"`GetPassWarning`." +"message to *stream* and reading from ``sys.stdin`` and issuing " +"a :exc:`GetPassWarning`." msgstr "" "もしエコーなしで入力が利用できない場合は、 ``getpass()`` は *stream* に警告" "メッセージを出力し、 ``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." @@ -106,21 +104,21 @@ msgstr "ユーザーの \"ログイン名\"を返します。" #: ../../library/getpass.rst:54 msgid "" -"This function checks the environment variables :envvar:`LOGNAME`, :envvar:" -"`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " -"value of the first one which is set to a non-empty string. If none are set, " -"the login name from the password database is returned on systems which " -"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." +"This function checks the environment " +"variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " +"and :envvar:`USERNAME`, in order, and returns the value of the first one " +"which is set to a non-empty string. If none are set, the login name from " +"the password database is returned on systems which support the :mod:`pwd` " +"module, otherwise, an :exc:`OSError` is raised." msgstr "" -"この関数は環境変数 :envvar:`LOGNAME` :envvar:`USER` :envvar:`!LNAME` :envvar:" -"`USERNAME` の順序でチェックして、最初の空ではない文字列が設定された値を返しま" -"す。もし、なにも設定されていない場合は :mod:`pwd` モジュールが提供するシステ" -"ム上のパスワードデータベースから返します。それ以外の場合は、 :exc:" -"`OSError` が送出されます。" +"この関数は環境変数 :envvar:`LOGNAME` :envvar:`USER` :envvar:`!" +"LNAME` :envvar:`USERNAME` の順序でチェックして、最初の空ではない文字列が設定" +"された値を返します。もし、なにも設定されていない場合は :mod:`pwd` モジュール" +"が提供するシステム上のパスワードデータベースから返します。それ以外の場合" +"は、 :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..141dd4479 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 @@ -88,19 +88,21 @@ msgstr "" #: ../../library/gettext.rst:39 msgid "" -"Bind the *domain* to the locale directory *localedir*. More concretely, :" -"mod:`gettext` will look for binary :file:`.mo` files for the given domain " -"using the path (on Unix): :file:`{localedir}/{language}/LC_MESSAGES/{domain}." -"mo`, where *language* is searched for in the environment variables :envvar:" -"`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, and :envvar:`LANG` " -"respectively." +"Bind the *domain* to the locale directory *localedir*. More " +"concretely, :mod:`gettext` will look for binary :file:`.mo` files for the " +"given domain using the path (on Unix): :file:`{localedir}/{language}/" +"LC_MESSAGES/{domain}.mo`, where *language* is searched for in the " +"environment " +"variables :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, " +"and :envvar:`LANG` respectively." msgstr "" "*domain* をロケールディレクトリ *localedir* に対応付けます。\n" -"具体的には、 :mod:`gettext` は与えられたドメインに対するバイナリ形式の :file:" -"`.mo` ファイルを探しに、(Unixでは) :file:`{localedir}/{language}/LC_MESSAGES/" -"{domain}.mo` というパスを見に行きます。\n" -"ここで *language* はそれぞれ環境変数 :envvar:`LANGUAGE` 、 :envvar:" -"`LC_ALL` 、 :envvar:`LC_MESSAGES` 、 :envvar:`LANG` の中から検索されます。" +"具体的には、 :mod:`gettext` は与えられたドメインに対するバイナリ形式" +"の :file:`.mo` ファイルを探しに、(Unixでは) :file:`{localedir}/{language}/" +"LC_MESSAGES/{domain}.mo` というパスを見に行きます。\n" +"ここで *language* はそれぞれ環境変" +"数 :envvar:`LANGUAGE` 、 :envvar:`LC_ALL` 、 :envvar:`LC_MESSAGES` 、 :envvar:`LANG` " +"の中から検索されます。" #: ../../library/gettext.rst:45 msgid "" @@ -121,12 +123,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 +139,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 +173,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 +201,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" @@ -218,8 +230,8 @@ msgid "" "*localedir* is as in :func:`bindtextdomain`. Optional *languages* is a list " "of strings, where each string is a language code." msgstr "" -"この関数は標準的な :file:`.mo` ファイル検索アルゴリズムを実装しています。 :" -"func:`textdomain` と同じく、 *domain* を引数にとります。オプションの " +"この関数は標準的な :file:`.mo` ファイル検索アルゴリズムを実装していま" +"す。 :func:`textdomain` と同じく、 *domain* を引数にとります。オプションの " "*localedir* は :func:`bindtextdomain` と同じです。またオプションの " "*languages* は文字列を列挙したリストで、各文字列は言語コードを表します。" @@ -227,46 +239,43 @@ msgstr "" msgid "" "If *localedir* is not given, then the default system locale directory is " "used. [#]_ If *languages* is not given, then the following environment " -"variables are searched: :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:" -"`LC_MESSAGES`, and :envvar:`LANG`. The first one returning a non-empty " -"value is used for the *languages* variable. The environment variables should " -"contain a colon separated list of languages, which will be split on the " -"colon to produce the expected list of language code strings." +"variables are " +"searched: :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, " +"and :envvar:`LANG`. The first one returning a non-empty value is used for " +"the *languages* variable. The environment variables should contain a colon " +"separated list of languages, which will be split on the colon to produce the " +"expected list of language code strings." msgstr "" "*localedir* が与えられていない場合、標準のシステムロケールディレクトリが使わ" -"れます。 [#]_ *languages* が与えられなかった場合、以下の環境変数: :envvar:" -"`LANGUAGE` 、 :envvar:`LC_ALL` 、 :envvar:`LC_MESSAGES` 、および :envvar:" -"`LANG` が検索されます。空でない値を返した最初の候補が *languages* 変数として" -"使われます。この環境変数は言語名をコロンで分かち書きしたリストを含んでいなけ" -"ればなりません。 :func:`find` はこの文字列をコロンで分割し、言語コードの候補" -"リストを生成します。" +"れます。 [#]_ *languages* が与えられなかった場合、以下の環境変" +"数: :envvar:`LANGUAGE` 、 :envvar:`LC_ALL` 、 :envvar:`LC_MESSAGES` 、およ" +"び :envvar:`LANG` が検索されます。空でない値を返した最初の候補が *languages* " +"変数として使われます。この環境変数は言語名をコロンで分かち書きしたリストを含" +"んでいなければなりません。 ``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 +284,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 "" @@ -292,12 +310,12 @@ msgstr "" #: ../../library/gettext.rst:165 msgid "" "If no :file:`.mo` file is found, this function raises :exc:`OSError` if " -"*fallback* is false (which is the default), and returns a :class:" -"`NullTranslations` instance if *fallback* is true." +"*fallback* is false (which is the default), and returns " +"a :class:`NullTranslations` instance if *fallback* is true." msgstr "" ":file:`.mo` ファイルが見つからなかった場合、 *fallback* が偽 (デフォルト値) " -"ならこの関数は :exc:`OSError` を送出し、 *fallback* が真なら :class:" -"`NullTranslations` インスタンスが返されます。" +"ならこの関数は :exc:`OSError` を送出し、 *fallback* が真な" +"ら :class:`NullTranslations` インスタンスが返されます。" #: ../../library/gettext.rst:169 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." @@ -305,46 +323,46 @@ 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`." +"on *domain* and *localedir* which are passed to the " +"function :func:`translation`." msgstr "" +"*domain* と *localedir* を :func:`translation` 関数に渡し、それに基づいて " +"Python の組み込み名前空間に :func:`!_` 関数をインストールします。" #: ../../library/gettext.rst:180 msgid "" "For the *names* parameter, please see the description of the translation " "object's :meth:`~NullTranslations.install` method." msgstr "" -"*names* パラメータについては、翻訳オブジェクトの :meth:`~NullTranslations." -"install` メソッドの説明を参照ください。" +"*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" @@ -360,9 +378,9 @@ msgid "" msgstr "" "翻訳クラスは、元のソースファイル中のメッセージ文字列から翻訳されたメッセージ" "文字列への変換処理が実際に実装されているクラスです。\n" -"全ての翻訳クラスで基底クラスとして使われているクラスが :class:" -"`NullTranslations` です; このクラスは、独自の翻訳クラスを実装するのに使える基" -"本的なインターフェースを提供しています。\n" +"全ての翻訳クラスで基底クラスとして使われているクラス" +"が :class:`NullTranslations` です; このクラスは、独自の翻訳クラスを実装するの" +"に使える基本的なインターフェースを提供しています。\n" "以下に :class:`!NullTranslations` のメソッドを示します:" #: ../../library/gettext.rst:208 @@ -443,11 +461,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,35 +478,45 @@ 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 " -"entire application globally, and specifically the built-in namespace, " +"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 entire application globally, and specifically the built-in namespace, " "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,38 +526,57 @@ 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." +"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 " -"the translation for the empty string. This metadata is in :rfc:`822`\\ -" -"style ``key: value`` pairs, and should contain the ``Project-Id-Version`` " +"the translation for the empty string. This metadata is in :rfc:`822`\\ " +"-style ``key: value`` pairs, and should contain the ``Project-Id-Version`` " "key. If the key ``Content-Type`` is found, then the ``charset`` property is " "used to initialize the \"protected\" :attr:`!_charset` instance variable, " "defaulting to ``None`` if not found. If the charset encoding is specified, " "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 +594,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,29 +601,29 @@ 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 "" "If the message id is not found in the catalog, and a fallback is specified, " -"the request is forwarded to the fallback's :meth:`~NullTranslations." -"ngettext` method. Otherwise, when *n* is 1 *singular* is returned, and " -"*plural* is returned in all other cases." +"the request is forwarded to the " +"fallback's :meth:`~NullTranslations.ngettext` method. Otherwise, when *n* " +"is 1 *singular* is returned, and *plural* is returned in all other cases." msgstr "" "メッセージ id がカタログ中に見つからず、フォールバックが指定されている場合" "は、メッセージ検索要求はフォールバックの :meth:`~NullTranslations.ngettext` " @@ -590,7 +635,6 @@ msgstr "" msgid "Here is an example::" msgstr "以下に例を示します。::" -#: ../../library/gettext.rst:350 msgid "" "n = len(os.listdir('.'))\n" "cat = GNUTranslations(somefile)\n" @@ -599,8 +643,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 +657,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 +712,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 +780,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 "" @@ -777,15 +837,16 @@ msgstr "" #: ../../library/gettext.rst:452 msgid "" -"(Python also includes pure-Python versions of these programs, called :" -"program:`pygettext.py` and :program:`msgfmt.py`; some Python distributions " -"will install them for you. :program:`pygettext.py` is similar to :program:" -"`xgettext`, but only understands Python source code and cannot handle other " -"programming languages such as C or C++. :program:`pygettext.py` supports a " -"command-line interface similar to :program:`xgettext`; for details on its " -"use, run ``pygettext.py --help``. :program:`msgfmt.py` is binary compatible " -"with GNU :program:`msgfmt`. With these two programs, you may not need the " -"GNU :program:`gettext` package to internationalize your Python applications.)" +"(Python also includes pure-Python versions of these programs, " +"called :program:`pygettext.py` and :program:`msgfmt.py`; some Python " +"distributions will install them for you. :program:`pygettext.py` is similar " +"to :program:`xgettext`, but only understands Python source code and cannot " +"handle other programming languages such as C or C++. :program:`pygettext.py` " +"supports a command-line interface similar to :program:`xgettext`; for " +"details on its use, run ``pygettext.py --help``. :program:`msgfmt.py` is " +"binary compatible with GNU :program:`msgfmt`. With these two programs, you " +"may not need the GNU :program:`gettext` package to internationalize your " +"Python applications.)" msgstr "" "(Python には :program:`pygettext.py` および :program:`msgfmt.py` という名前" "の pure-Python 版プログラムもあります;\n" @@ -802,10 +863,10 @@ msgstr "" #: ../../library/gettext.rst:464 msgid "" -":program:`xgettext`, :program:`pygettext`, and similar tools generate :file:" -"`.po` files that are message catalogs. They are structured human-readable " -"files that contain every marked string in the source code, along with a " -"placeholder for the translated versions of these strings." +":program:`xgettext`, :program:`pygettext`, and similar tools " +"generate :file:`.po` files that are message catalogs. They are structured " +"human-readable files that contain every marked string in the source code, " +"along with a placeholder for the translated versions of these strings." msgstr "" ":program:`xgettext` や :program:`pygettext` のようなツールは、メッセージカタ" "ログである :file:`.po` ファイルを生成します。\n" @@ -816,11 +877,11 @@ msgstr "" msgid "" "Copies of these :file:`.po` files are then handed over to the individual " "human translators who write translations for every supported natural " -"language. They send back the completed language-specific versions as a :" -"file:`.po` file that's compiled into a machine-readable :file:" -"`.mo` binary catalog file using the :program:`msgfmt` program. The :file:`." -"mo` files are used by the :mod:`gettext` module for the actual translation " -"processing at run-time." +"language. They send back the completed language-specific versions as " +"a :file:`.po` file that's compiled into a machine-" +"readable :file:`.mo` binary catalog file using the :program:`msgfmt` " +"program. The :file:`.mo` files are used by the :mod:`gettext` module for " +"the actual translation processing at run-time." msgstr "" "生成された :file:`.po` ファイルは翻訳者個々人へ頒布され、サポート対象の各自然" "言語への訳文が書き込まれます。\n" @@ -847,8 +908,8 @@ msgstr "モジュールを地域化する" #: ../../library/gettext.rst:487 msgid "" "If you are localizing your module, you must take care not to make global " -"changes, e.g. to the built-in namespace. You should not use the GNU :program:" -"`gettext` API but instead the class-based API." +"changes, e.g. to the built-in namespace. You should not use the " +"GNU :program:`gettext` API but instead the class-based API." msgstr "" "モジュールを地域化する場合、グローバルな変更、例えば組み込み名前空間への変更" "を行わないように注意しなければなりません。GNU :program:`gettext` API ではな" @@ -862,28 +923,34 @@ msgid "" "your module::" msgstr "" "仮に対象のモジュール名を \"spam\" とし、モジュールの各言語における翻訳が収め" -"られた :file:`.mo` ファイルが :file:`/usr/share/locale` に GNU :program:" -"`gettext` 形式で置かれているとします。この場合、モジュールの最初で以下のよう" -"にします::" +"られた :file:`.mo` ファイルが :file:`/usr/share/locale` に " +"GNU :program:`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 +960,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::" +"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 +995,6 @@ msgstr "" "て、例えば以下のコードのように、インスタンスを明示的に切り替えてもかまいませ" "ん。::" -#: ../../library/gettext.rst:529 msgid "" "import gettext\n" "\n" @@ -944,6 +1011,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 +1041,6 @@ msgstr "" "が行われるように遅延させる必要が生じます。古典的な例は以下のようなコートで" "す::" -#: ../../library/gettext.rst:552 msgid "" "animals = ['mollusk',\n" " 'albatross',\n" @@ -971,6 +1051,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 +1073,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 +1088,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 +1109,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 +1141,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 +1163,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 +1222,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 +1231,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..08c1be750 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 @@ -47,21 +47,21 @@ msgstr "" ":mod:`glob` モジュールは Unix シェルで使われているルールに従い指定されたパ" "ターンに一致するすべてのパス名を見つけ出します。返される結果の順序は不定で" "す。チルダ展開は行われませんが、``*``, ``?``, および ``[]`` で表現される文字" -"範囲については正しくマッチされます。これは、関数 :func:`os.scandir` および :" -"func:`fnmatch.fnmatch` を使用して行われており、実際にサブシェルを呼び出してい" -"るわけではありません。" +"範囲については正しくマッチされます。これは、関数 :func:`os.scandir` およ" +"び :func:`fnmatch.fnmatch` を使用して行われており、実際にサブシェルを呼び出し" +"ているわけではありません。" #: ../../library/glob.rst:28 msgid "" "Note that files beginning with a dot (``.``) can only be matched by patterns " -"that also start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib." -"Path.glob`. (For tilde and shell variable expansion, use :func:`os.path." -"expanduser` and :func:`os.path.expandvars`.)" +"that also start with a dot, unlike :func:`fnmatch.fnmatch` " +"or :func:`pathlib.Path.glob`. (For tilde and shell variable expansion, " +"use :func:`os.path.expanduser` and :func:`os.path.expandvars`.)" msgstr "" "ドット (``.``) で始まるファイルは、同じくドットで始まるパターンにのみマッチし" "ます。この動作は :func:`fnmatch.fnmatch` や :func:`pathlib.Path.glob` とは異" -"なります。 (チルダやシェル変数の展開には、 :func:`os.path.expanduser` と :" -"func:`os.path.expandvars` を使ってください。)" +"なります。 (チルダやシェル変数の展開には、 :func:`os.path.expanduser` " +"と :func:`os.path.expandvars` を使ってください。)" #: ../../library/glob.rst:34 msgid "" @@ -79,12 +79,12 @@ msgstr ":mod:`glob` モジュールは以下の関数を定義しています:" msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " -"absolute (like :file:`/usr/src/Python-1.5/Makefile`) or relative (like :file:" -"`../../Tools/\\*/\\*.gif`), and can contain shell-style wildcards. Broken " -"symlinks are included in the results (as in the shell). Whether or not the " -"results are sorted depends on the file system. If a file that satisfies " -"conditions is removed or added during the call of this function, whether a " -"path name for that file will be included is unspecified." +"absolute (like :file:`/usr/src/Python-1.5/Makefile`) or relative " +"(like :file:`../../Tools/\\*/\\*.gif`), and can contain shell-style " +"wildcards. Broken symlinks are included in the results (as in the shell). " +"Whether or not the results are sorted depends on the file system. If a file " +"that satisfies conditions is removed or added during the call of this " +"function, whether a path name for that file will be included is unspecified." msgstr "" "パスの仕様を含む文字列 *pathname* にマッチするパス名のリストを返します。戻り" "値のリストは空になる可能性があります。 *pathname* は (:file:`/usr/src/" @@ -99,8 +99,8 @@ msgstr "" #: ../../library/glob.rst:52 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " -"specifying the root directory for searching. It has the same effect on :" -"func:`glob` as changing the current directory before calling it. If " +"specifying the root directory for searching. It has the same effect " +"on :func:`glob` as changing the current directory before calling it. If " "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" "*root_dir* が ``None`` でない場合、その値は検索のルートディレクトリを指定す" @@ -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 "" @@ -205,8 +203,9 @@ msgstr "" #: ../../library/glob.rst:128 msgid "" -"Convert the given path specification to a regular expression for use with :" -"func:`re.match`. The path specification can contain shell-style wildcards." +"Convert the given path specification to a regular expression for use " +"with :func:`re.match`. The path specification can contain shell-style " +"wildcards." msgstr "" "与えられたパスの仕様を :func:`re.match` で利用するための正規表現に変換しま" "す。シェル形式のワイルドカードを含めることもできます。" @@ -217,9 +216,9 @@ msgstr "例えば:" #: ../../library/glob.rst:142 msgid "" -"Path separators and segments are meaningful to this function, unlike :func:" -"`fnmatch.translate`. By default wildcards do not match path separators, and " -"``*`` pattern segments match precisely one path segment." +"Path separators and segments are meaningful to this function, " +"unlike :func:`fnmatch.translate`. By default wildcards do not match path " +"separators, and ``*`` pattern segments match precisely one path segment." msgstr "" ":func:`fnmatch.translate` と違って、この関数ではパスの要素を区切るセパレータ" "とセグメントには意味があります。デフォルトでは、ワイルドカードはパスのセパ" @@ -264,17 +263,17 @@ 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 " -"the file :file:`3.txt`. :func:`glob` will produce the following results. " +"Consider a directory containing the following " +"files: :file:`1.gif`, :file:`2.txt`, :file:`card.gif` and a " +"subdirectory :file:`sub` which contains only the " +"file :file:`3.txt`. :func:`glob` will produce the following results. " "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:`1.gif`, :file:`2.txt`, :file:`card.gif` および :file:`3.txt` だけ" +"を含む :file:`sub` サブディレクトリ。このとき、 :func:`glob` は以下の結果を" +"返します。パスにおける先頭の要素がどのように保持されるかに注意してください::" #: ../../library/glob.rst:173 msgid "" @@ -305,8 +304,8 @@ msgstr "" #: ../../library/glob.rst:185 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " -"default. For example, consider a directory containing :file:`card.gif` and :" -"file:`.card.gif`::" +"default. For example, consider a directory containing :file:`card.gif` " +"and :file:`.card.gif`::" msgstr "" "ディレクトリが ``.`` で始まるファイルを含んでいる場合、デフォルトでそれらは" "マッチしません。例えば、 :file:`card.gif` と :file:`.card.gif` を含むディレク" diff --git a/library/graphlib.po b/library/graphlib.po index 61b00d2b5..69d4ae24d 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 @@ -105,27 +105,30 @@ msgid "" "nodes returned by :meth:`~TopologicalSorter.get_ready` and process them. " "Call :meth:`~TopologicalSorter.done` on each node as it finishes processing." msgstr "" -":meth:`~TopologicalSorter.is_active` が ``True`` の間、 :meth:" -"`~TopologicalSorter.get_ready` によって返されたノード群をイテレートし、それら" -"を処理します。ノードの処理が終わる都度、:meth:`~TopologicalSorter.done` を呼" -"び出します。" +":meth:`~TopologicalSorter.is_active` が ``True`` の" +"間、 :meth:`~TopologicalSorter.get_ready` によって返されたノード群をイテレー" +"トし、それらを処理します。ノードの処理が終わる都" +"度、:meth:`~TopologicalSorter.done` を呼び出します。" #: ../../library/graphlib.rst:49 msgid "" "In case just an immediate sorting of the nodes in the graph is required and " -"no parallelism is involved, the convenience method :meth:`TopologicalSorter." -"static_order` can be used directly:" +"no parallelism is involved, the convenience " +"method :meth:`TopologicalSorter.static_order` can be used directly:" 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,85 +219,106 @@ 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." -"get_ready` can still be used to obtain as many nodes as possible until " -"cycles block more progress. After a call to this function, the graph cannot " -"be modified, and therefore no more nodes can be added using :meth:" -"`~TopologicalSorter.add`." +"is detected, :exc:`CycleError` will be raised, " +"but :meth:`~TopologicalSorter.get_ready` can still be used to obtain as many " +"nodes as possible until cycles block more progress. After a call to this " +"function, the graph cannot 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`." +"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 " -"are still nodes ready that haven't yet been returned by :meth:" -"`TopologicalSorter.get_ready` or the number of nodes marked :meth:" -"`TopologicalSorter.done` is less than the number that have been returned by :" -"meth:`TopologicalSorter.get_ready`." +"are still nodes ready that haven't yet been returned " +"by :meth:`TopologicalSorter.get_ready` or the number of nodes " +"marked :meth:`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 "" -"Raises :exc:`ValueError` if called without calling :meth:`~TopologicalSorter." -"prepare` previously." +"Raises :exc:`ValueError` if called without " +"calling :meth:`~TopologicalSorter.prepare` previously." 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 " -"the graph by using :meth:`TopologicalSorter.add`, if called without calling :" -"meth:`~TopologicalSorter.prepare` or if node has not yet been returned by :" -"meth:`~TopologicalSorter.get_ready`." +"the graph by using :meth:`TopologicalSorter.add`, if called without " +"calling :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::" +"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." +"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,18 +412,28 @@ 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 "" - -#: ../../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 " -"list of nodes, such that each node is, in the graph, an immediate " -"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 "" +"処理対象のグラフに閉路がある場合に :meth:`TopologicalSorter.prepare` が送出す" +"る、:exc:`ValueError` のサブクラスです。\n" +"閉路が複数ある場合は、そのうち 1 つだけが選ばれて報告され、例外に含まれま" +"す。\n" +"どれが選ばれるかは未定義です。" + +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 list of nodes, such that each node is, in the graph, an " +"immediate 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..ef565f557 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 "" @@ -118,8 +117,8 @@ msgid "" "members of the group they are in according to the password database. Check " "both databases to get complete membership information. Also note that a " "``gr_name`` that starts with a ``+`` or ``-`` is likely to be a YP/NIS " -"reference and may not be accessible via :func:`getgrnam` or :func:" -"`getgrgid`.)" +"reference and may not be accessible via :func:`getgrnam` " +"or :func:`getgrgid`.)" msgstr "" "gid は整数、名前およびパスワードは文字列、そしてメンバリストは文字列からなる" "リストです。 (ほとんどのユーザは、パスワードデータベースで自分が入れられてい" @@ -135,8 +134,8 @@ msgstr "このモジュールでは以下の内容を定義しています:" #: ../../library/grp.rst:45 msgid "" -"Return the group database entry for the given numeric group ID. :exc:" -"`KeyError` is raised if the entry asked for cannot be found." +"Return the group database entry for the given numeric group " +"ID. :exc:`KeyError` is raised if the entry asked for cannot be found." msgstr "" "与えられたグループ ID に対するグループデータベースエントリを返します。要求し" "たエントリが見つからなかった場合、 :exc:`KeyError` が送出されます。" @@ -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..b6f77d04a 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 @@ -46,22 +46,23 @@ msgstr "データ圧縮は :mod:`zlib` モジュールで提供されていま #: ../../library/gzip.rst:16 msgid "" -"The :mod:`gzip` module provides the :class:`GzipFile` class, as well as the :" -"func:`.open`, :func:`compress` and :func:`decompress` convenience functions. " -"The :class:`GzipFile` class reads and writes :program:`gzip`\\ -format " -"files, automatically compressing or decompressing the data so that it looks " -"like an ordinary :term:`file object`." +"The :mod:`gzip` module provides the :class:`GzipFile` class, as well as " +"the :func:`.open`, :func:`compress` and :func:`decompress` convenience " +"functions. The :class:`GzipFile` class reads and writes :program:`gzip`\\ " +"-format files, automatically compressing or decompressing the data so that " +"it looks like an ordinary :term:`file object`." msgstr "" -":mod:`gzip` は :class:`GzipFile` クラスと、簡易関数 :func:`.open`、:func:" -"`compress`、および :func:`decompress` を提供しています。:class:`GzipFile` ク" -"ラスは通常の :term:`ファイルオブジェクト ` と同様に :program:" -"`gzip` 形式のファイルを読み書きし、データを自動的に圧縮または展開します。" +":mod:`gzip` は :class:`GzipFile` クラスと、簡易関" +"数 :func:`.open`、:func:`compress`、および :func:`decompress` を提供していま" +"す。:class:`GzipFile` クラスは通常の :term:`ファイルオブジェクト ` と同様に :program:`gzip` 形式のファイルを読み書きし、データを自動的" +"に圧縮または展開します。" #: ../../library/gzip.rst:22 msgid "" -"Note that additional file formats which can be decompressed by the :program:" -"`gzip` and :program:`gunzip` programs, such as those produced by :program:" -"`compress` and :program:`pack`, are not supported by this module." +"Note that additional file formats which can be decompressed by " +"the :program:`gzip` and :program:`gunzip` programs, such as those produced " +"by :program:`compress` and :program:`pack`, are not supported by this module." msgstr "" ":program:`compress` や :program:`pack` 等によって作成され、:program:`gzip` " "や :program:`gunzip` が展開できる他のファイル形式についてはこのモジュールは対" @@ -81,8 +82,9 @@ msgstr "" #: ../../library/gzip.rst:34 msgid "" -"The *filename* argument can be an actual filename (a :class:`str` or :class:" -"`bytes` object), or an existing file object to read from or write to." +"The *filename* argument can be an actual filename (a :class:`str` " +"or :class:`bytes` object), or an existing file object to read from or write " +"to." msgstr "" "引数 *filename* には実際のファイル名 (:class:`str` または :class:`bytes` オブ" "ジェクト) か、既存のファイルオブジェクトを指定します。" @@ -100,8 +102,8 @@ msgstr "" #: ../../library/gzip.rst:41 msgid "" -"The *compresslevel* argument is an integer from 0 to 9, as for the :class:" -"`GzipFile` constructor." +"The *compresslevel* argument is an integer from 0 to 9, as for " +"the :class:`GzipFile` constructor." msgstr "" "引数 *compresslevel* は :class:`GzipFile` コンストラクタと同様に 0 から 9 の" "整数を取ります。" @@ -118,13 +120,13 @@ msgstr "" #: ../../library/gzip.rst:48 msgid "" -"For text mode, a :class:`GzipFile` object is created, and wrapped in an :" -"class:`io.TextIOWrapper` instance with the specified encoding, error " +"For text mode, a :class:`GzipFile` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" "テキストモードでは、:class:`GzipFile` オブジェクトが作成され、指定されたエン" -"コーディング、エラーハンドラの挙動、および改行文字で :class:`io." -"TextIOWrapper` インスタンスにラップされます。" +"コーディング、エラーハンドラの挙動、および改行文字" +"で :class:`io.TextIOWrapper` インスタンスにラップされます。" #: ../../library/gzip.rst:52 msgid "" @@ -142,20 +144,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." +"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." +"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 +193,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 +201,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 "" @@ -200,8 +215,8 @@ msgid "" "an :class:`io.TextIOWrapper`)." msgstr "" "ファイルは常にバイナリモードで開かれることに注意してください。圧縮ファイルを" -"テキストモードで開く場合、:func:`.open` (または :class:`GzipFile` を :class:" -"`io.TextIOWrapper` でラップしたオブジェクト) を使ってください。" +"テキストモードで開く場合、:func:`.open` (または :class:`GzipFile` " +"を :class:`io.TextIOWrapper` でラップしたオブジェクト) を使ってください。" #: ../../library/gzip.rst:98 msgid "" @@ -222,77 +237,93 @@ 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 "" "Calling a :class:`GzipFile` object's :meth:`!close` method does not close " "*fileobj*, since you might wish to append more material after the compressed " "data. This also allows you to pass an :class:`io.BytesIO` object opened for " -"writing as *fileobj*, and retrieve the resulting memory buffer using the :" -"class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." +"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 "" ":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, " -"including iteration and the :keyword:`with` statement. Only the :meth:`~io." -"IOBase.truncate` method isn't implemented." +"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 "" -"While calling :meth:`peek` does not change the file position of the :class:" -"`GzipFile`, it may change the position of the underlying file object (e.g. " -"if the :class:`GzipFile` was constructed with the *fileobj* parameter)." +"While calling :meth:`peek` does not change the file position of " +"the :class:`GzipFile`, it may change the position of the underlying file " +"object (e.g. if the :class:`GzipFile` was constructed with the *fileobj* " +"parameter)." msgstr "" ":meth:`peek` の呼び出しでは :class:`GzipFile` のファイル位置は変わりません" -"が、下層のファイルオブジェクトの位置が変わる惧れがあります。(e.g. :class:" -"`GzipFile` が *fileobj* 引数で作成された場合)" +"が、下層のファイルオブジェクトの位置が変わる惧れがあります。" +"(e.g. :class:`GzipFile` が *fileobj* 引数で作成された場合)" #: ../../library/gzip.rst:136 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 "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" -":keyword:`with` 文がサポートされました。*mtime* コンストラクタ引数と :attr:" -"`mtime` 属性が追加されました。" +":keyword:`with` 文がサポートされました。*mtime* コンストラクタ引数" +"と :attr:`mtime` 属性が追加されました。" #: ../../library/gzip.rst:158 msgid "Support for zero-padded and unseekable files was added." @@ -317,52 +348,61 @@ 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." -"compress` for better speed. In this situation the output may contain a gzip " -"header \"OS\" byte value other than 255 \"unknown\" as supplied by the " -"underlying zlib implementation." +"fashion. Calls with *mtime* set to ``0`` are delegated " +"to :func:`zlib.compress` for better speed. In this situation the output may " +"contain a gzip 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 +410,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 +432,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 +467,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 +498,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 +521,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..190ac68b6 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,11 +39,17 @@ 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 "" -"If you want the adler32 or crc32 hash functions, they are available in the :" -"mod:`zlib` module." +"If you want the adler32 or crc32 hash functions, they are available in " +"the :mod:`zlib` module." msgstr "" "adler32 や crc32 ハッシュ関数は :mod:`zlib` モジュールで提供されています。" @@ -55,56 +60,70 @@ msgstr "ハッシュアルゴリズム" #: ../../library/hashlib.rst:40 msgid "" "There is one constructor method named for each type of :dfn:`hash`. All " -"return a hash object with the same simple interface. For example: use :func:" -"`sha256` to create a SHA-256 hash object. You can now feed this object with :" -"term:`bytes-like objects ` (normally :class:`bytes`) " -"using the :meth:`update` method. At any point you can ask it " -"for the :dfn:`digest` of the concatenation of the data fed to it so far " -"using the :meth:`digest()` or :meth:`hexdigest()` methods." -msgstr "" +"return a hash object with the same simple interface. For example: " +"use :func:`sha256` to create a SHA-256 hash object. You can now feed this " +"object with :term:`bytes-like objects ` " +"(normally :class:`bytes`) using the :meth:`update` method. At " +"any point you can ask it for the :dfn:`digest` of the concatenation of the " +"data fed to it so far 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." +"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 "" -"Constructors for hash algorithms that are always present in this module are :" -"func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:" -"`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:" -"`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, and :func:" -"`blake2s`. :func:`md5` is normally available as well, though it may be " -"missing or blocked if you are using a rare \"FIPS compliant\" build of " -"Python. These correspond to :data:`algorithms_guaranteed`." +"Constructors for hash algorithms that are always present in this module " +"are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, " +"and :func:`blake2s`. :func:`md5` is normally available as well, though it " +"may be missing or blocked if you are using a rare \"FIPS compliant\" build " +"of Python. These correspond to :data:`algorithms_guaranteed`." msgstr "" #: ../../library/hashlib.rst:63 msgid "" -"Additional algorithms may also be available if your Python distribution's :" -"mod:`hashlib` was linked against a build of OpenSSL that provides others. " -"Others *are not guaranteed available* on all installations and will only be " -"accessible by name via :func:`new`. See :data:`algorithms_available`." +"Additional algorithms may also be available if your Python " +"distribution's :mod:`hashlib` was linked against a build of OpenSSL that " +"provides others. Others *are not guaranteed available* on all installations " +"and will only be 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." +"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 +131,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 +161,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" @@ -142,11 +171,19 @@ msgid "" ">>> 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" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> 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 +191,7 @@ msgstr "もっと簡潔に書くと、このようになります:" #: ../../library/hashlib.rst:118 msgid "Constructors" -msgstr "" +msgstr "コンストラクタ" #: ../../library/hashlib.rst:122 msgid "" @@ -163,24 +200,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 "" @@ -197,19 +236,18 @@ msgstr "" #: ../../library/hashlib.rst:165 msgid "" "A set containing the names of the hash algorithms that are available in the " -"running Python interpreter. These names will be recognized when passed to :" -"func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " +"running Python interpreter. These names will be recognized when passed " +"to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " "same algorithm may appear multiple times in this set under different names " "(thanks to OpenSSL)." msgstr "" "実行中の Python インタープリタで利用可能なハッシュアルゴリズム名の set です。" -"これらの名前は :func:`new` に渡すことができます。:attr:" -"`algorithms_guaranteed` は常にサブセットです。この set の中に同じアルゴリズム" -"が違う名前で複数回現れることがあります (OpenSSL 由来)。" +"これらの名前は :func:`new` に渡すことができま" +"す。:attr:`algorithms_guaranteed` は常にサブセットです。この set の中に同じア" +"ルゴリズムが違う名前で複数回現れることがあります (OpenSSL 由来)。" -#: ../../library/hashlib.rst:174 msgid "Hash Objects" -msgstr "" +msgstr "ハッシュオブジェクト" #: ../../library/hashlib.rst:176 msgid "" @@ -295,13 +333,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 +352,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,48 +362,63 @@ 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` " "instances, SocketIO objects from :meth:`socket.socket.makefile`, and " -"similar. *fileobj* must be opened in blocking mode, otherwise a :exc:" -"`BlockingIOError` may be raised." +"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*." +"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 +470,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 +477,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 +490,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,45 +527,52 @@ 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 "" -"Hash objects from this module follow the API of standard library's :mod:" -"`hashlib` objects." +"Hash objects from this module follow the API of standard " +"library's :mod:`hashlib` objects." msgstr "" "このモジュールのハッシュオブジェクトは標準ライブラリーの :mod:`hashlib` オブ" "ジェクトの API に従います。" @@ -507,39 +586,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 +675,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 +683,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 +698,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 +764,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,30 +784,36 @@ 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:" -"`blake2s`), then update it with the data by calling :meth:`~hash.update` on " -"the object, and, finally, get the digest out of the object by calling :meth:" -"`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." +"calling the appropriate constructor function (:func:`blake2b` " +"or :func:`blake2s`), then update it with the data by " +"calling :meth:`~hash.update` on 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 +826,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." +"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 +864,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 +904,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 +944,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 +981,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 +1041,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 +1073,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 +1100,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 +1143,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 +1218,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 +1267,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 +1299,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..f58b44387 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,93 +71,109 @@ 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 " "index for a node and the indexes for its children slightly less obvious, but " "is more suitable since Python uses zero-based indexing. (b) Textbooks often " "focus on max-heaps, due to their suitability for in-place sorting. Our " -"implementation favors min-heaps as they better correspond to Python :class:" -"`lists `." +"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." +"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 "" "Pop and return the smallest item from the *heap*, and also push the new " -"*item*. The heap size doesn't change. If the heap is empty, :exc:" -"`IndexError` is raised." +"*item*. The heap size doesn't change. If the heap is " +"empty, :exc:`IndexError` is raised." 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`." +"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." +"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." @@ -281,8 +312,8 @@ msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " "is used to extract a comparison key from each element in *iterable* (for " -"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:" -"n]``." +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)" +"[:n]``." msgstr "" "*iterable* で定義されるデータセットのうち、最小値から昇順に *n* 個の値のリス" "トを返します。(あたえられた場合) *key* は、引数を一つとる、*iterable* のそれ" @@ -293,14 +324,14 @@ msgstr "" msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " -"``n==1``, it is more efficient to use the built-in :func:`min` and :func:" -"`max` functions. If repeated usage of these functions is required, consider " -"turning the iterable into an actual heap." +"``n==1``, it is more efficient to use the built-in :func:`min` " +"and :func:`max` functions. If repeated usage of these functions is " +"required, consider turning the iterable into an actual heap." msgstr "" -"後ろ二つの関数は *n* の値が小さな場合に最適な動作をします。大きな値の時には :" -"func:`sorted` 関数の方が効率的です。さらに、 ``n==1`` の時には :func:`min` お" -"よび :func:`max` 関数の方が効率的です。この関数を繰り返し使うことが必要なら、" -"iterable を実際のヒープに変えることを考えてください。" +"後ろ二つの関数は *n* の値が小さな場合に最適な動作をします。大きな値の時に" +"は :func:`sorted` 関数の方が効率的です。さらに、 ``n==1`` の時に" +"は :func:`min` および :func:`max` 関数の方が効率的です。この関数を繰り返し使" +"うことが必要なら、iterable を実際のヒープに変えることを考えてください。" #: ../../library/heapq.rst:204 msgid "Basic Examples" @@ -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..3c6150a87 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,34 +62,36 @@ 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 " "or inline implementation, which is faster for messages that fit into memory. " -"The parameters *key*, *msg*, and *digest* have the same meaning as in :func:" -"`~hmac.new`." +"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:" @@ -92,8 +100,8 @@ msgstr "HMAC オブジェクトは以下のメソッドを持っています:" #: ../../library/hmac.rst:54 msgid "" "Update the hmac object with *msg*. Repeated calls are equivalent to a " -"single call with the concatenation of all the arguments: ``m.update(a); m." -"update(b)`` is equivalent to ``m.update(a + b)``." +"single call with the concatenation of all the arguments: ``m.update(a); " +"m.update(b)`` is equivalent to ``m.update(a + b)``." msgstr "" "hmac オブジェクトを *msg* で更新します。このメソッドの呼出の繰り返しは、それ" "らの引数を全て結合した引数で単一の呼び出しをした際と同じになります。すなわち " @@ -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." +"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." +"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:" @@ -181,8 +195,8 @@ msgid "" "Return ``a == b``. This function uses an approach designed to prevent " "timing analysis by avoiding content-based short circuiting behaviour, making " "it appropriate for cryptography. *a* and *b* must both be of the same type: " -"either :class:`str` (ASCII only, as e.g. returned by :meth:`HMAC." -"hexdigest`), or a :term:`bytes-like object`." +"either :class:`str` (ASCII only, as e.g. returned " +"by :meth:`HMAC.hexdigest`), or a :term:`bytes-like object`." msgstr "" "``a == b`` を返します。この関数は、内容ベースの短絡的な振る舞いを避けることに" "よってタイミング分析を防ぐよう設計されたアプローチを用い、暗号化に用いるのに" @@ -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..b5beb0b50 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 @@ -33,11 +33,13 @@ msgstr "**ソースコード:** :source:`Lib/html/entities.py`" #: ../../library/html.entities.rst:13 msgid "" -"This module defines four dictionaries, :data:`html5`, :data:" -"`name2codepoint`, :data:`codepoint2name`, and :data:`entitydefs`." +"This module defines four " +"dictionaries, :data:`html5`, :data:`name2codepoint`, :data:`codepoint2name`, " +"and :data:`entitydefs`." msgstr "" -"このモジュールは 4 つの辞書、:data:`html5`、:data:`name2codepoint`、:data:" -"`codepoint2name`、および :data:`entitydefs` を定義しています。" +"このモジュールは 4 つの辞" +"書、:data:`html5`、:data:`name2codepoint`、:data:`codepoint2name`、およ" +"び :data:`entitydefs` を定義しています。" #: ../../library/html.entities.rst:19 msgid "" @@ -45,14 +47,14 @@ msgid "" "equivalent Unicode character(s), e.g. ``html5['gt;'] == '>'``. Note that the " "trailing semicolon is included in the name (e.g. ``'gt;'``), however some of " "the names are accepted by the standard even without the semicolon: in this " -"case the name is present with and without the ``';'``. See also :func:`html." -"unescape`." +"case the name is present with and without the ``';'``. See " +"also :func:`html.unescape`." msgstr "" "HTML5 名前付き文字参照 [#]_ と Unicode 文字とを対応付ける辞書です (例: " "``html5['gt;'] == '>'``)。末尾のセミコロンは名前に含まれますが (例: " "``'gt;'``)、一部の名前はセミコロンなしでも標準で受け付けます。この場合、" -"``';'`` ありの名前と ``';'`` なしの名前が両方存在します。 :func:`html." -"unescape` も参照してください。" +"``';'`` ありの名前と ``';'`` なしの名前が両方存在しま" +"す。 :func:`html.unescape` も参照してください。" #: ../../library/html.entities.rst:31 msgid "" diff --git a/library/html.parser.po b/library/html.parser.po index 7c32bee84..10a618303 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:" +"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`." +"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 "" @@ -167,8 +192,8 @@ msgstr "" "全てのバッファーされているデータについて、その後にファイル終端マークが続いて" "いるとみなして強制的に処理を行います。このメソッドは入力データの終端で行う追" "加処理を定義するために、派生クラスで再定義することができます。しかし、再定義" -"されたバージョンでは、常に :class:`HTMLParser` 基底クラスのメソッド :meth:" -"`close` を呼び出さなくてはなりません。" +"されたバージョンでは、常に :class:`HTMLParser` 基底クラスのメソッ" +"ド :meth:`close` を呼び出さなくてはなりません。" #: ../../library/html.parser.rst:107 msgid "" @@ -182,28 +207,27 @@ 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 "" "The following methods are called when data or markup elements are " "encountered and they are meant to be overridden in a subclass. The base " -"class implementations do nothing (except for :meth:`~HTMLParser." -"handle_startendtag`):" +"class implementations do nothing (except " +"for :meth:`~HTMLParser.handle_startendtag`):" msgstr "" "以下のメソッドはデータまたはマークアップ要素が見つかる度に呼び出されます。こ" -"れらはサブクラスで上書きされることを想定されています。基底クラスの実装は (:" -"meth:`~HTMLParser.handle_startendtag` を除き) 何もしません:" +"れらはサブクラスで上書きされることを想定されています。基底クラスの実装は " +"(:meth:`~HTMLParser.handle_startendtag` を除き) 何もしません:" #: ../../library/html.parser.rst:131 msgid "" @@ -229,19 +253,19 @@ msgstr "" #: ../../library/html.parser.rst:139 msgid "" "For instance, for the tag ````, this method " -"would be called as ``handle_starttag('a', [('href', 'https://www.cwi." -"nl/')])``." +"would be called as ``handle_starttag('a', [('href', 'https://" +"www.cwi.nl/')])``." 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 "" @@ -258,8 +282,8 @@ msgid "" "Similar to :meth:`handle_starttag`, but called when the parser encounters an " "XHTML-style empty tag (````). This method may be overridden by " "subclasses which require this particular lexical information; the default " -"implementation simply calls :meth:`handle_starttag` and :meth:" -"`handle_endtag`." +"implementation simply calls :meth:`handle_starttag` " +"and :meth:`handle_endtag`." msgstr "" ":meth:`handle_starttag` と似ていますが、パーサーが XHTML 形式の空タグ " "(````) を見つける度に呼び出されます。この特定の字句情報が必要な場" @@ -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\"" +"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,15 +575,23 @@ 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 "" -"Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but :meth:" -"`~HTMLParser.handle_data` might be called more than once (unless " +"Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, " +"but :meth:`~HTMLParser.handle_data` might be called more than once (unless " "*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..caa33690c 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,19 +49,18 @@ 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. " -"This function uses the rules defined by the HTML 5 standard for both valid " -"and invalid character references, and the :data:`list of HTML 5 named " -"character references `." +"Convert all named and numeric character references (e.g. ``>``, " +"``>``, ``>``) in the string *s* to the corresponding Unicode " +"characters. This function uses the rules defined by the HTML 5 standard for " +"both valid 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..98f5966a7 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 @@ -39,13 +39,13 @@ msgstr "**ソースコード:** :source:`Lib/http/client.py`" #: ../../library/http.client.rst:17 msgid "" "This module defines classes that implement the client side of the HTTP and " -"HTTPS protocols. It is normally not used directly --- the module :mod:" -"`urllib.request` uses it to handle URLs that use HTTP and HTTPS." +"HTTPS protocols. It is normally not used directly --- the " +"module :mod:`urllib.request` uses it to handle URLs that use HTTP and HTTPS." msgstr "" "このモジュールでは HTTP および HTTPS プロトコルのクライアントサイドを実装して" -"いるクラスを定義しています。通常、このモジュールは直接使いません --- :mod:" -"`urllib.request` モジュールが HTTP や HTTPS を使った URL を扱う上でこのモ" -"ジュールを使います。" +"いるクラスを定義しています。通常、このモジュールは直接使いません " +"--- :mod:`urllib.request` モジュールが HTTP や HTTPS を使った URL を扱う上で" +"このモジュールを使います。" #: ../../library/http.client.rst:23 msgid "" @@ -63,17 +63,16 @@ msgstr "" "HTTPS のサポートは、Python が SSL サポート付きでコンパイルされている場合にの" "み利用できます (:mod:`ssl` モジュールによって)。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/http.client.rst:33 msgid "The module provides the following classes:" @@ -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." @@ -163,8 +165,8 @@ msgstr "*source_address*、*context* そして *check_hostname* が追加され #: ../../library/http.client.rst:84 msgid "" -"This class now supports HTTPS virtual hosts if possible (that is, if :const:" -"`ssl.HAS_SNI` is true)." +"This class now supports HTTPS virtual hosts if possible (that is, " +"if :const:`ssl.HAS_SNI` is true)." msgstr "" "このクラスは現在、可能であれば (つまり :const:`ssl.HAS_SNI` が真の場合) " "HTTPS のバーチャルホストをサポートしています。" @@ -180,40 +182,44 @@ msgstr "" #: ../../library/http.client.rst:92 msgid "" "This class now performs all the necessary certificate and hostname checks by " -"default. To revert to the previous, unverified, behavior :func:`!ssl." -"_create_unverified_context` can be passed to the *context* parameter." +"default. To revert to the previous, unverified, behavior :func:`!" +"ssl._create_unverified_context` can be passed to the *context* parameter." 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`." +"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,30 @@ 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 "" +"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:" @@ -256,8 +271,8 @@ msgstr "状況に応じて、以下の例外が送出されます:" #: ../../library/http.client.rst:147 msgid "" -"The base class of the other exceptions in this module. It is a subclass of :" -"exc:`Exception`." +"The base class of the other exceptions in this module. It is a subclass " +"of :exc:`Exception`." msgstr "" "このモジュールにおける他の例外クラスの基底クラスです。 :exc:`Exception` のサ" "ブクラスです。" @@ -281,43 +296,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 +348,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 +363,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,23 +370,27 @@ 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 "" "If *body* is specified, the specified data is sent after the headers are " -"finished. It may be a :class:`str`, a :term:`bytes-like object`, an open :" -"term:`file object`, or an iterable of :class:`bytes`. If *body* is a " +"finished. It may be a :class:`str`, a :term:`bytes-like object`, an " +"open :term:`file object`, or an iterable of :class:`bytes`. If *body* is a " "string, it is encoded as ISO-8859-1, the default for HTTP. If it is a bytes-" "like object, the bytes are sent as is. If it is a :term:`file object`, the " "contents of the file is sent; this file object should support at least the " -"``read()`` method. If the file object is an instance of :class:`io." -"TextIOBase`, the data returned by the ``read()`` method will be encoded as " -"ISO-8859-1, otherwise the data returned by ``read()`` is sent as is. If " -"*body* is an iterable, the elements of the iterable are sent as is until the " -"iterable is exhausted." +"``read()`` method. If the file object is an instance " +"of :class:`io.TextIOBase`, the data returned by the ``read()`` method will " +"be encoded as ISO-8859-1, otherwise the data returned by ``read()`` is sent " +"as is. If *body* is an iterable, the elements of the iterable are sent as " +"is until the 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 +398,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 +415,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 +451,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 +503,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." +"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 +533,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 +547,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 +555,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 "" @@ -570,11 +650,11 @@ msgid "" "with non-False values." msgstr "" "サーバへの接続が確立したら、最初にこのメソッドを呼び出さなくてはなりません。" -"このメソッドは *method* 文字列、*url* 文字列、そして HTTP バージョン " -"(``HTTP/1.1``) からなる一行を送信します。``Host:`` や ``Accept-Encoding:`` " -"ヘッダの自動送信を無効にしたい場合 (例えば別のコンテンツエンコーディングを受" -"け入れたい場合) には、*skip_host* や *skip_accept_encoding* を偽でない値に設" -"定してください。" +"このメソッドは *method* 文字列、*url* 文字列、そして HTTP バージョン (``HTTP/" +"1.1``) からなる一行を送信します。``Host:`` や ``Accept-Encoding:`` ヘッダの自" +"動送信を無効にしたい場合 (例えば別のコンテンツエンコーディングを受け入れたい" +"場合) には、*skip_host* や *skip_accept_encoding* を偽でない値に設定してくだ" +"さい。" #: ../../library/http.client.rst:436 msgid "" @@ -597,44 +677,60 @@ 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 " "3.3.1. How the data is encoded is dependent on the type of *message_body*. " "If *message_body* implements the :ref:`buffer interface ` the " -"encoding will result in a single chunk. If *message_body* is a :class:" -"`collections.abc.Iterable`, each iteration of *message_body* will result in " -"a chunk. If *message_body* is a :term:`file object`, each call to ``." -"read()`` will result in a chunk. The method automatically signals the end of " -"the chunk-encoded data immediately after *message_body*." -msgstr "" +"encoding will result in a single chunk. If *message_body* is " +"a :class:`collections.abc.Iterable`, each iteration of *message_body* will " +"result in a chunk. If *message_body* is a :term:`file object`, each call to " +"``.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." +"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 +747,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 +766,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 +787,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`." +"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 "" @@ -709,8 +814,8 @@ msgstr "" #: ../../library/http.client.rst:534 msgid "" -"Headers of the response in the form of an :class:`email.message." -"EmailMessage` instance." +"Headers of the response in the form of " +"an :class:`email.message.EmailMessage` instance." msgstr "" #: ../../library/http.client.rst:538 @@ -721,11 +826,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 +858,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 +882,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 +270,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 +310,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 "" @@ -295,30 +352,33 @@ msgstr "" #: ../../library/reprlib.rst:224 msgid "" "Formatting methods for specific types are implemented as methods with a name " -"based on the type name. In the method name, **TYPE** is replaced by ``'_'." -"join(type(obj).__name__.split())``. Dispatch to these methods is handled by :" -"meth:`repr1`. Type-specific methods which need to recursively format a value " -"should call ``self.repr1(subobj, level - 1)``." +"based on the type name. In the method name, **TYPE** is replaced by " +"``'_'.join(type(obj).__name__.split())``. Dispatch to these methods is " +"handled by :meth:`repr1`. Type-specific methods which need to recursively " +"format a value should call ``self.repr1(subobj, level - 1)``." msgstr "" "型名に基づく名前をもつメソッドとして、特定の型に対するフォーマットメソッドは" -"実装されます。メソッド名では、 **TYPE** は ``'_'.join(type(obj).__name__." -"split())`` に置き換えられます。これらのメソッドへのディスパッチは :meth:" -"`repr1` によって処理されます。再帰的に値をフォーマットする必要がある型固有の" -"メソッドは、 ``self.repr1(subobj, level - 1)`` を呼び出します。" +"実装されます。メソッド名では、 **TYPE** は " +"``'_'.join(type(obj).__name__.split())`` に置き換えられます。これらのメソッド" +"へのディスパッチは :meth:`repr1` によって処理されます。再帰的に値をフォーマッ" +"トする必要がある型固有のメソッドは、 ``self.repr1(subobj, level - 1)`` を呼び" +"出します。" #: ../../library/reprlib.rst:234 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 " +"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 +393,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..b18741c33 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 "" @@ -126,26 +120,27 @@ msgid "" "unlimited." msgstr "" "*resource* の新たな消費制限を設定します。 *limits* 引数には、タプル ``(soft, " -"hard)`` による二つの整数で、新たな制限を記述しなければなりません。 :data:" -"`~resource.RLIM_INFINITY` を指定することで、無制限を要求することが出来ます。" +"hard)`` による二つの整数で、新たな制限を記述しなければなりませ" +"ん。 :data:`~resource.RLIM_INFINITY` を指定することで、無制限を要求することが" +"出来ます。" #: ../../library/resource.rst:69 msgid "" "Raises :exc:`ValueError` if an invalid resource is specified, if the new " "soft limit exceeds the hard limit, or if a process tries to raise its hard " "limit. Specifying a limit of :data:`~resource.RLIM_INFINITY` when the hard " -"or system limit for that resource is not unlimited will result in a :exc:" -"`ValueError`. A process with the effective UID of super-user can request " -"any valid limit value, including unlimited, but :exc:`ValueError` will still " -"be raised if the requested limit exceeds the system imposed limit." +"or system limit for that resource is not unlimited will result in " +"a :exc:`ValueError`. A process with the effective UID of super-user can " +"request any valid limit value, including unlimited, but :exc:`ValueError` " +"will still be raised if the requested limit exceeds the system imposed limit." msgstr "" "無効なリソースが指定された場合、ソフトリミットの値がハードリミットの値を超え" -"ている場合、プロセスがハードリミットを引き上げようとした場合には :exc:" -"`ValueError` が送出されます。リソースのハードリミットやシステムリミットが無制" -"限でないのに :data:`~resource.RLIM_INFINITY` を指定した場合も、 :exc:" -"`ValueError` になります。スーパーユーザの実効 UID を持ったプロセスは無制限を" -"含めあらゆる妥当な制限値を要求出来ますが、システムが課している制限を超過した" -"要求ではやはり :exc:`ValueError` となります。" +"ている場合、プロセスがハードリミットを引き上げようとした場合に" +"は :exc:`ValueError` が送出されます。リソースのハードリミットやシステムリミッ" +"トが無制限でないのに :data:`~resource.RLIM_INFINITY` を指定した場合" +"も、 :exc:`ValueError` になります。スーパーユーザの実効 UID を持ったプロセス" +"は無制限を含めあらゆる妥当な制限値を要求出来ますが、システムが課している制限" +"を超過した要求ではやはり :exc:`ValueError` となります。" #: ../../library/resource.rst:78 msgid "" @@ -159,13 +154,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 "" @@ -178,8 +172,8 @@ msgstr "" "1つの関数の中で :func:`setrlimit` と :func:`getrlimit` を組み合わせ、任意のプ" "ロセスのリソースの制限値を取得したり設定したりします。\n" "*pid* が 0 の場合は、現在のプロセスに適用されます。\n" -"*resource* および *limits* は、 *limits* がオプションであることを除けば、 :" -"func:`setrlimit` と同じ意味です。" +"*resource* および *limits* は、 *limits* がオプションであることを除け" +"ば、 :func:`setrlimit` と同じ意味です。" #: ../../library/resource.rst:94 msgid "" @@ -194,20 +188,19 @@ msgstr "" #: ../../library/resource.rst:98 msgid "" -"Raises :exc:`ProcessLookupError` when *pid* can't be found and :exc:" -"`PermissionError` when the user doesn't have ``CAP_SYS_RESOURCE`` for the " -"process." +"Raises :exc:`ProcessLookupError` when *pid* can't be found " +"and :exc:`PermissionError` when the user doesn't have ``CAP_SYS_RESOURCE`` " +"for the process." 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 "" @@ -341,9 +334,9 @@ msgstr "" msgid "" "The maximum size (in bytes) of the swap space that may be reserved or used " "by all of this user id's processes. This limit is enforced only if bit 1 of " -"the vm.overcommit sysctl is set. Please see `tuning(7) `__ for a complete description of " -"this sysctl." +"the vm.overcommit sysctl is set. Please see `tuning(7) `__ for a complete " +"description of this sysctl." msgstr "" "このユーザ ID のすべてのプロセスで予約または使用できるスワップスペースの最大" "サイズ (バイト単位)。この制限は vm.overcommit sysctl のビット 1 が設定されて" @@ -355,9 +348,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 +359,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." +"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 +387,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 "" @@ -420,9 +425,9 @@ msgid "" "The fields :attr:`ru_utime` and :attr:`ru_stime` of the return value are " "floating-point values representing the amount of time spent executing in " "user mode and the amount of time spent executing in system mode, " -"respectively. The remaining values are integers. Consult the :manpage:" -"`getrusage(2)` man page for detailed information about these values. A brief " -"summary is presented here:" +"respectively. The remaining values are integers. Consult " +"the :manpage:`getrusage(2)` man page for detailed information about these " +"values. A brief summary is presented here:" msgstr "" #: ../../library/resource.rst:314 @@ -445,9 +450,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 +461,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 +650,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." +"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 +666,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..85eda6f7f 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,67 +45,85 @@ 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" ">>> 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.__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." 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`)." +"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 "" "On platforms without :mod:`readline`, the :class:`Completer` class defined " "by this module can still be used for custom purposes." msgstr "" -":mod:`readline` のないプラットフォームでも、このモジュールで定義される :" -"class:`Completer` クラスは独自の目的に使えます。" +":mod:`readline` のないプラットフォームでも、このモジュールで定義され" +"る :class:`Completer` クラスは独自の目的に使えます。" #: ../../library/rlcompleter.rst:46 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 "" "If called for *text* that doesn't include a period character (``'.'``), it " -"will complete from names currently defined in :mod:`__main__`, :mod:" -"`builtins` and keywords (as defined by the :mod:`keyword` module)." +"will complete from names currently defined " +"in :mod:`__main__`, :mod:`builtins` and keywords (as defined by " +"the :mod:`keyword` module)." msgstr "" -"もし *text* がピリオド(``'.'``)を含まない場合、 :mod:`__main__` 、 :mod:" -"`builtins` で定義されている名前か、キーワード (:mod:`keyword` モジュールで定" -"義されている) から補完されます。" +"もし *text* がピリオド(``'.'``)を含まない場" +"合、 :mod:`__main__` 、 :mod:`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 +132,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..c5d5f3811 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,30 +71,40 @@ 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* " "will not be modified. If any of the special global variables below are " -"defined in *init_globals*, those definitions are overridden by :func:" -"`run_module`." +"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,50 +115,55 @@ 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." +"``__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*)." +"(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 "" -"``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` are :ref:" -"`set as normal ` based on the module spec." +"``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` " +"are :ref:`set as normal ` based on the module spec." msgstr "" #: ../../library/runpy.rst:69 msgid "" "If the argument *alter_sys* is supplied and evaluates to :const:`True`, then " -"``sys.argv[0]`` is updated with the value of ``__file__`` and ``sys." -"modules[__name__]`` is updated with a temporary module object for the module " -"being executed. Both ``sys.argv[0]`` and ``sys.modules[__name__]`` are " -"restored to their original values before the function returns." +"``sys.argv[0]`` is updated with the value of ``__file__`` and " +"``sys.modules[__name__]`` is updated with a temporary module object for the " +"module being executed. Both ``sys.argv[0]`` and ``sys.modules[__name__]`` " +"are restored to their original values before the function returns." msgstr "" -"引数 *alter_sys* が与えられて :const:`True` に評価されるならば、 ``sys." -"argv[0]`` は ``__file__`` の値で更新され ``sys.modules[__name__]`` は実行され" -"るモジュールの一時的モジュールオブジェクトで更新されます。 ``sys.argv[0]`` " -"と ``sys.modules[__name__]`` はどちらも関数が処理を戻す前にもとの値に復旧しま" -"す。" +"引数 *alter_sys* が与えられて :const:`True` に評価されるならば、 " +"``sys.argv[0]`` は ``__file__`` の値で更新され ``sys.modules[__name__]`` は実" +"行されるモジュールの一時的モジュールオブジェクトで更新されます。 " +"``sys.argv[0]`` と ``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``." +"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,23 +226,35 @@ 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* " "will not be modified. If any of the special global variables below are " -"defined in *init_globals*, those definitions are overridden by :func:" -"`run_path`." +"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." +"``__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 "" @@ -231,21 +269,24 @@ msgid "" "If *file_path* is a reference to a valid :data:`sys.path` entry, then " "``__spec__`` will be set appropriately for the imported :mod:`__main__` " "module (that is, ``__spec__.name`` will always be ``__main__``). " -"``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` will be :" -"ref:`set as normal ` based on the module spec." +"``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` will " +"be :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 " -"updated with the value of *file_path* and ``sys.modules[__name__]`` is " +"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 updated with the value of *file_path* and ``sys.modules[__name__]`` is " "updated with a temporary module object for the module being executed. All " "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..1429eed23 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" @@ -145,8 +171,8 @@ msgid "" "Return value is an event which may be used for later cancellation of the " "event (see :meth:`cancel`)." msgstr "" -"戻り値は、後にイベントをキャンセルする時に使われる可能性のあるイベントです (:" -"meth:`cancel` を参照)。" +"戻り値は、後にイベントをキャンセルする時に使われる可能性のあるイベントです " +"(:meth:`cancel` を参照)。" #: ../../library/sched.rst:86 ../../library/sched.rst:99 msgid "*argument* parameter is optional." @@ -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..717f602bb 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 @@ -48,9 +48,9 @@ msgid "" "pseudo-random number generator in the :mod:`random` module, which is " "designed for modelling and simulation, not security or cryptography." msgstr "" -"特に、 :mod:`random` モジュールのデフォルトの擬似乱数ジェネレータよりも :mod:" -"`secrets` を使用するべきです。 :mod:`random` モジュールはモデル化やシミュレー" -"ション向けで、セキュリティや暗号学的に設計されてはいません。" +"特に、 :mod:`random` モジュールのデフォルトの擬似乱数ジェネレータより" +"も :mod:`secrets` を使用するべきです。 :mod:`random` モジュールはモデル化やシ" +"ミュレーション向けで、セキュリティや暗号学的に設計されてはいません。" #: ../../library/secrets.rst:30 msgid ":pep:`506`" @@ -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?" @@ -213,8 +219,8 @@ msgstr "" "文字列または :term:`bytes-like オブジェクト ` *a* と *b* " "が等しければ ``True`` を、そうでなければ ``False`` を返します。比較は `タイミ" "ング攻撃 `_ のリスクを減ら" -"す \"定数時間比較\" の方法で行われます。詳細については :func:`hmac." -"compare_digest` を参照してください。" +"す \"定数時間比較\" の方法で行われます。詳細について" +"は :func:`hmac.compare_digest` を参照してください。" #: ../../library/secrets.rst:140 msgid "Recipes and best practices" @@ -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..12d287778 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`" +":mod:`base64`: :ref:`base64 security considerations ` " +"in :rfc:`4648`" msgstr "" +":mod:`base64`: :rfc:`4648` にある :ref:`base64 のセキュリティ上の注意点 " +"`" #: ../../library/security_warnings.rst:12 msgid "" @@ -43,76 +43,88 @@ 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:" -"`PYTHONSAFEPATH` environment variable can be used to not prepend a " -"potentially unsafe path to :data:`sys.path` such as the current directory, " +"mode. When it cannot be used, the :option:`-P` option or " +"the :envvar:`PYTHONSAFEPATH` environment variable can be used to not prepend " +"a 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..b9b3406ae 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 @@ -35,20 +35,20 @@ msgstr ":mod:`!select` --- I/O 完了の待機" msgid "" "This module provides access to the :c:func:`!select` and :c:func:`!poll` " "functions available in most operating systems, :c:func:`!devpoll` available " -"on Solaris and derivatives, :c:func:`!epoll` available on Linux 2.5+ and :c:" -"func:`!kqueue` available on most BSD. Note that on Windows, it only works " -"for sockets; on other operating systems, it also works for other file types " -"(in particular, on Unix, it works on pipes). It cannot be used on regular " -"files to determine whether a file has grown since it was last read." +"on Solaris and derivatives, :c:func:`!epoll` available on Linux 2.5+ " +"and :c:func:`!kqueue` available on most BSD. Note that on Windows, it only " +"works for sockets; on other operating systems, it also works for other file " +"types (in particular, on Unix, it works on pipes). It cannot be used on " +"regular files to determine whether a file has grown since it was last read." msgstr "" "このモジュールでは、ほとんどのオペレーティングシステムで利用可能な :c:func:`!" -"select` および :c:func:`!poll` 関数、Solaris やその派生で利用可能な :c:func:" -"`!devpoll` 、Linux 2.5+ で利用可能な :c:func:`!epoll` 、多くのBSDで利用可能" -"な :c:func:`!kqueue` 関数に対するアクセスを提供しています。 Windows 上ではソ" -"ケットに対してしか動作しないので注意してください; その他のオペレーティングシ" -"ステムでは、他のファイル形式でも (特に Unixではパイプにも) 動作します。通常の" -"ファイルに対して適用し、最後にファイルを読み出した時から内容が増えているかを" -"決定するために使うことはできません。" +"select` および :c:func:`!poll` 関数、Solaris やその派生で利用可能" +"な :c:func:`!devpoll` 、Linux 2.5+ で利用可能な :c:func:`!epoll` 、多くのBSD" +"で利用可能な :c:func:`!kqueue` 関数に対するアクセスを提供しています。 " +"Windows 上ではソケットに対してしか動作しないので注意してください; その他のオ" +"ペレーティングシステムでは、他のファイル形式でも (特に Unixではパイプにも) 動" +"作します。通常のファイルに対して適用し、最後にファイルを読み出した時から内容" +"が増えているかを決定するために使うことはできません。" #: ../../library/select.rst:20 msgid "" @@ -59,20 +59,19 @@ msgid "" msgstr "" ":mod:`selectors` モジュールにより、:mod:`select` モジュールプリミティブに基づ" "く高水準かつ効率的な I/O の多重化が行うことが出来ます。\n" -"OS レベルプリミティブを使用した正確な制御を求めない限り、代わりに :mod:" -"`selectors` を使用することが推奨されます。" +"OS レベルプリミティブを使用した正確な制御を求めない限り、代わり" +"に :mod:`selectors` を使用することが推奨されます。" -#: ../../library/select.rst:177 ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/select.rst:27 msgid "The module defines the following:" @@ -101,9 +100,10 @@ msgstr "" #: ../../library/select.rst:44 msgid "" ":c:func:`!devpoll` objects are linked to the number of file descriptors " -"allowed at the time of instantiation. If your program reduces this value, :c:" -"func:`!devpoll` will fail. If your program increases this value, :c:func:`!" -"devpoll` may return an incomplete list of active file descriptors." +"allowed at the time of instantiation. If your program reduces this " +"value, :c:func:`!devpoll` will fail. If your program increases this " +"value, :c:func:`!devpoll` may return an incomplete list of active file " +"descriptors." msgstr "" ":c:func:`!devpoll` オブジェクトはインスタンス化時に許されるファイル記述子の数" "にリンクされます。プログラムがこの値を減らす場合 :c:func:`!devpoll` は失敗し" @@ -137,26 +137,27 @@ 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 "" -"``epoll`` objects support the context management protocol: when used in a :" -"keyword:`with` statement, the new file descriptor is automatically closed at " -"the end of the block." +"``epoll`` objects support the context management protocol: when used in " +"a :keyword:`with` statement, the new file descriptor is automatically closed " +"at the end of the block." msgstr "" "``epoll`` オブジェクトはコンテキストマネジメントプロトコルをサポートしていま" "す。\n" @@ -195,13 +196,14 @@ msgstr "" "(全てのオペレーティングシステムでサポートされているわけではありません) ポーリ" "ングオブジェクトを返します。このオブジェクトはファイル記述子を登録したり登録" "解除したりすることができ、ファイル記述子に対する I/O イベント発生をポーリング" -"することができます; ポーリングオブジェクトが提供しているメソッドについては :" -"ref:`poll-objects` 節を参照してください。" +"することができます; ポーリングオブジェクトが提供しているメソッドについて" +"は :ref:`poll-objects` 節を参照してください。" #: ../../library/select.rst:103 msgid "" -"(Only supported on BSD.) Returns a kernel queue object; see section :ref:" -"`kqueue-objects` below for the methods supported by kqueue objects." +"(Only supported on BSD.) Returns a kernel queue object; see " +"section :ref:`kqueue-objects` below for the methods supported by kqueue " +"objects." msgstr "" "(BSD でのみサポート) カーネルキュー(kernel queue)オブジェクトを返します。カー" "ネルキューオブジェクトが提供しているメソッドについては、 :ref:`kqueue-" @@ -209,20 +211,24 @@ msgstr "" #: ../../library/select.rst:114 msgid "" -"(Only supported on BSD.) Returns a kernel event object; see section :ref:" -"`kevent-objects` below for the methods supported by kevent objects." +"(Only supported on BSD.) Returns a kernel event object; see " +"section :ref:`kevent-objects` below for the methods supported by kevent " +"objects." msgstr "" "(BSD でのみサポート) カーネルイベント(kernel event)オブジェクトを返します。" "カーネルイベントオブジェクトが提供しているメソッドについては、 :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" @@ -264,26 +270,28 @@ msgstr "" #: ../../library/select.rst:145 msgid "" "Among the acceptable object types in the iterables are Python :term:`file " -"objects ` (e.g. ``sys.stdin``, or objects returned by :func:" -"`open` or :func:`os.popen`), socket objects returned by :func:`socket." -"socket`. You may also define a :dfn:`wrapper` class yourself, as long as it " -"has an appropriate :meth:`~io.IOBase.fileno` method (that really returns a " -"file descriptor, not just a random integer)." +"objects ` (e.g. ``sys.stdin``, or objects returned " +"by :func:`open` or :func:`os.popen`), socket objects returned " +"by :func:`socket.socket`. You may also define a :dfn:`wrapper` class " +"yourself, as long as it has an appropriate :meth:`~io.IOBase.fileno` method " +"(that really returns a file descriptor, not just a random integer)." msgstr "" "イテラブルの中に含めることのできるオブジェクトは Python :term:`ファイルオブ" -"ジェクト ` (例えば ``sys.stdin`` や、 :func:`open` または :func:" -"`os.popen` が返すオブジェクト)、 :func:`socket.socket` が返すソケットオブジェ" -"クトです。 :dfn:`ラッパー ` クラスを自分で定義することもできます。こ" -"の場合、適切な (まったくデタラメな数ではなく本物のファイル記述子を返す) :" -"meth:`~io.IOBase.fileno` メソッドを持つ必要があります。" +"ジェクト ` (例えば ``sys.stdin`` や、 :func:`open` また" +"は :func:`os.popen` が返すオブジェクト)、 :func:`socket.socket` が返すソケッ" +"トオブジェクトです。 :dfn:`ラッパー ` クラスを自分で定義することもで" +"きます。この場合、適切な (まったくデタラメな数ではなく本物のファイル記述子を" +"返す) :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 @@ -301,9 +309,10 @@ msgstr "" #: ../../library/select.rst:170 msgid "" "The minimum number of bytes which can be written without blocking to a pipe " -"when the pipe has been reported as ready for writing by :func:`~select." -"select`, :func:`!poll` or another interface in this module. This doesn't " -"apply to other kind of file-like objects such as sockets." +"when the pipe has been reported as ready for writing " +"by :func:`~select.select`, :func:`!poll` or another interface in this " +"module. This doesn't apply to other kind of file-like objects such as " +"sockets." msgstr "" #: ../../library/select.rst:175 @@ -314,17 +323,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." @@ -340,10 +352,10 @@ msgstr "ポーリングオブジェクトのファイル記述子番号を返し #: ../../library/select.rst:218 ../../library/select.rst:396 msgid "" -"Register a file descriptor with the polling object. Future calls to the :" -"meth:`poll` method will then check whether the file descriptor has any " -"pending I/O events. *fd* can be either an integer, or an object with a :" -"meth:`~io.IOBase.fileno` method that returns an integer. File objects " +"Register a file descriptor with the polling object. Future calls to " +"the :meth:`poll` method will then check whether the file descriptor has any " +"pending I/O events. *fd* can be either an integer, or an object with " +"a :meth:`~io.IOBase.fileno` method that returns an integer. File objects " "implement :meth:`!fileno`, so they can also be used as the argument." msgstr "" "ファイル記述子をポーリングオブジェクトに登録します。これ以降の :meth:`poll` " @@ -356,16 +368,19 @@ msgstr "" msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " "check for. The constants are the same that with :c:func:`!poll` object. The " -"default value is a combination of the constants :const:`POLLIN`, :const:" -"`POLLPRI`, and :const:`POLLOUT`." +"default value is a combination of the " +"constants :const:`POLLIN`, :const:`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 "" @@ -377,13 +392,13 @@ msgstr "" #: ../../library/select.rst:246 ../../library/select.rst:440 msgid "" -"Remove a file descriptor being tracked by a polling object. Just like the :" -"meth:`register` method, *fd* can be an integer or an object with a :meth:" -"`~io.IOBase.fileno` method that returns an integer." +"Remove a file descriptor being tracked by a polling object. Just like " +"the :meth:`register` method, *fd* can be an integer or an object with " +"a :meth:`~io.IOBase.fileno` method that returns an integer." msgstr "" -"ポーリングオブジェクトによって追跡中のファイル記述子を登録解除します。 :meth:" -"`register` メソッドと同様に、 *fd* は整数か、整数値を返す :meth:`~io.IOBase." -"fileno` メソッドを持つオブジェクトを取ります。" +"ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま" +"す。 :meth:`register` メソッドと同様に、 *fd* は整数か、整数値を返" +"す :meth:`~io.IOBase.fileno` メソッドを持つオブジェクトを取ります。" #: ../../library/select.rst:250 msgid "" @@ -391,30 +406,34 @@ 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 " "events or errors to report. *fd* is the file descriptor, and *event* is a " -"bitmask with bits set for the reported events for that descriptor --- :const:" -"`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the descriptor " -"can be written to, and so forth. An empty list indicates that the call timed " -"out and no file descriptors had any events to report. If *timeout* is given, " -"it specifies the length of time in milliseconds which the system will wait " -"for events before returning. If *timeout* is omitted, -1, or :const:`None`, " -"the call will block until there is an event for this poll object." +"bitmask with bits set for the reported events for that descriptor " +"--- :const:`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the " +"descriptor can be written to, and so forth. An empty list indicates that the " +"call timed out and no file descriptors had any events to report. If " +"*timeout* is given, it specifies the length of time in milliseconds which " +"the system will wait for events before returning. If *timeout* is omitted, " +"-1, or :const:`None`, the call will block until there is an event for this " +"poll object." 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 +585,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 +633,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 +646,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,19 +656,28 @@ 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 "" "*eventmask* is an optional bitmask describing the type of events you want to " -"check for, and can be a combination of the constants :const:`POLLIN`, :const:" -"`POLLPRI`, and :const:`POLLOUT`, described in the table below. If not " -"specified, the default value used will check for all 3 types of events." +"check for, and can be a combination of the " +"constants :const:`POLLIN`, :const:`POLLPRI`, and :const:`POLLOUT`, described " +"in the table below. If not specified, the default value used will check for " +"all 3 types of events." msgstr "" "*eventmask* はオプションのビットマスクで、どの種類の I/O イベントを監視したい" -"かを記述します。この値は以下の表で述べる定数 :const:`POLLIN` 、 :const:" -"`POLLPRI` 、および :const:`POLLOUT` の組み合わせにすることができます。ビット" -"マスクを指定しない場合、標準の値が使われ、 3 種類のイベント全てに対して監視が" -"行われます。" +"かを記述します。この値は以下の表で述べる定" +"数 :const:`POLLIN` 、 :const:`POLLPRI` 、および :const:`POLLOUT` の組み合わせ" +"にすることができます。ビットマスクを指定しない場合、標準の値が使われ、 3 種類" +"のイベント全てに対して監視が行われます。" #: ../../library/select.rst:410 msgid ":const:`POLLIN`" @@ -724,8 +750,8 @@ msgstr "" msgid "" "Modifies an already registered fd. This has the same effect as " "``register(fd, eventmask)``. Attempting to modify a file descriptor that " -"was never registered causes an :exc:`OSError` exception with errno :const:" -"`ENOENT` to be raised." +"was never registered causes an :exc:`OSError` exception with " +"errno :const:`ENOENT` to be raised." msgstr "" "登録されているファイル記述子 *fd* を変更する。これは、 ``register(fd, " "eventmask)`` と同じ効果を持ちます。登録されていないファイル記述子に対してこの" @@ -734,36 +760,40 @@ msgstr "" #: ../../library/select.rst:444 msgid "" -"Attempting to remove a file descriptor that was never registered causes a :" -"exc:`KeyError` exception to be raised." +"Attempting to remove a file descriptor that was never registered causes " +"a :exc:`KeyError` exception to be raised." 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 " "events or errors to report. *fd* is the file descriptor, and *event* is a " -"bitmask with bits set for the reported events for that descriptor --- :const:" -"`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the descriptor " -"can be written to, and so forth. An empty list indicates that the call timed " -"out and no file descriptors had any events to report. If *timeout* is given, " -"it specifies the length of time in milliseconds which the system will wait " -"for events before returning. If *timeout* is omitted, negative, or :const:" -"`None`, the call will block until there is an event for this poll object." +"bitmask with bits set for the reported events for that descriptor " +"--- :const:`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the " +"descriptor can be written to, and so forth. An empty list indicates that the " +"call timed out and no file descriptors had any events to report. If " +"*timeout* is given, it specifies the length of time in milliseconds which " +"the system will wait for events before returning. If *timeout* is omitted, " +"negative, or :const:`None`, the call will block until there is an event for " +"this poll object." 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 +833,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 "" @@ -815,9 +844,9 @@ msgid "" "the integer internally." msgstr "" "イベントを特定するための値。この値は、フィルタにもよりますが、大抵の場合は" -"ファイル記述子です。コンストラクタでは、 ident として、整数値か :meth:`~io." -"IOBase.fileno` メソッドを持ったオブジェクトを渡せます。 kevent は内部で整数値" -"を保存します。" +"ファイル記述子です。コンストラクタでは、 ident として、整数値" +"か :meth:`~io.IOBase.fileno` メソッドを持ったオブジェクトを渡せます。 kevent " +"は内部で整数値を保存します。" #: ../../library/select.rst:525 msgid "Name of the kernel filter." @@ -1145,14 +1174,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..60798c9b2 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 @@ -49,10 +49,11 @@ msgstr "" #: ../../library/selectors.rst:20 msgid "" "It defines a :class:`BaseSelector` abstract base class, along with several " -"concrete implementations (:class:`KqueueSelector`, :class:" -"`EpollSelector`...), that can be used to wait for I/O readiness notification " -"on multiple file objects. In the following, \"file object\" refers to any " -"object with a :meth:`~io.IOBase.fileno` method, or a raw file descriptor. " +"concrete implementations " +"(:class:`KqueueSelector`, :class:`EpollSelector`...), that can be used to " +"wait for I/O readiness notification on multiple file objects. In the " +"following, \"file object\" refers to any object with " +"a :meth:`~io.IOBase.fileno` method, or a raw file descriptor. " "See :term:`file object`." msgstr "" "このモジュールは :class:`BaseSelector` 抽象基底クラスと、いくつかの具象実装 " @@ -72,17 +73,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,17 +92,16 @@ 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/selectors.rst:44 msgid "Classes" @@ -112,7 +111,6 @@ msgstr "クラス" msgid "Classes hierarchy::" msgstr "クラス階層::" -#: ../../library/selectors.rst:48 msgid "" "BaseSelector\n" "+-- SelectSelector\n" @@ -121,6 +119,12 @@ msgid "" "+-- DevpollSelector\n" "+-- KqueueSelector" msgstr "" +"BaseSelector\n" +"+-- SelectSelector\n" +"+-- PollSelector\n" +"+-- EpollSelector\n" +"+-- DevpollSelector\n" +"+-- KqueueSelector" #: ../../library/selectors.rst:56 msgid "" @@ -148,17 +152,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,59 +184,58 @@ 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 " "method to wait for I/O events on those streams, with an optional timeout. " -"It's an abstract base class, so cannot be instantiated. Use :class:" -"`DefaultSelector` instead, or one of :class:`SelectSelector`, :class:" -"`KqueueSelector` etc. if you want to specifically use an implementation, and " -"your platform supports it. :class:`BaseSelector` and its concrete " -"implementations support the :term:`context manager` protocol." +"It's an abstract base class, so cannot be instantiated. " +"Use :class:`DefaultSelector` instead, or one " +"of :class:`SelectSelector`, :class:`KqueueSelector` etc. if you want to " +"specifically use an implementation, and your platform supports " +"it. :class:`BaseSelector` and its concrete 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." +"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." @@ -241,10 +243,10 @@ msgstr "*fileobj* は登録済みのファイルオブジェクトでなけれ #: ../../library/selectors.rst:128 msgid "" -"This returns the associated :class:`SelectorKey` instance, or raises a :exc:" -"`KeyError` if *fileobj* is not registered. It will raise :exc:`ValueError` " -"if *fileobj* is invalid (e.g. it has no ``fileno()`` method or its " -"``fileno()`` method has an invalid return value)." +"This returns the associated :class:`SelectorKey` instance, or raises " +"a :exc:`KeyError` if *fileobj* is not registered. It will " +"raise :exc:`ValueError` if *fileobj* is invalid (e.g. it has no ``fileno()`` " +"method or its ``fileno()`` method has an invalid return value)." msgstr "" "関連付けられた :class:`SelectorKey` インスタンスを返します。*fileobj* が登録" "されていない場合 :exc:`KeyError` を送出します。*fileobj* が不正な場合 (例え" @@ -267,9 +269,9 @@ msgstr "" #: ../../library/selectors.rst:141 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 not registered." +"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 not registered." msgstr "" "新たな :class:`SelectorKey` インスタンスを返します。\n" "イベントマスクやファイル記述子が不正な場合は :exc:`ValueError` を、ファイルオ" @@ -367,9 +369,9 @@ msgid "" "This returns a :class:`~collections.abc.Mapping` instance mapping registered " "file objects to their associated :class:`SelectorKey` instance." msgstr "" -"これは、登録済みのファイルオブジェクトを、それらに関連づけられた :class:" -"`SelectorKey` インスタンスにマッピングする :class:`~collections.abc.Mapping` " -"のインスタンスを返します。" +"これは、登録済みのファイルオブジェクトを、それらに関連づけられ" +"た :class:`SelectorKey` インスタンスにマッピングす" +"る :class:`~collections.abc.Mapping` のインスタンスを返します。" #: ../../library/selectors.rst:201 msgid "" @@ -380,17 +382,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,26 +399,24 @@ 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 "" -"This returns the file descriptor used by the underlying :func:`select." -"devpoll` object." +"This returns the file descriptor used by the " +"underlying :func:`select.devpoll` object." 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 "" -"This returns the file descriptor used by the underlying :func:`select." -"kqueue` object." +"This returns the file descriptor used by the " +"underlying :func:`select.kqueue` object." msgstr "" "下層の :func:`select.kqueue` オブジェクトが使用しているファイル記述子を返しま" "す。" @@ -432,7 +429,6 @@ msgstr "使用例" msgid "Here is a simple echo server implementation::" msgstr "簡単なエコーサーバの実装です::" -#: ../../library/selectors.rst:251 msgid "" "import selectors\n" "import socket\n" @@ -467,3 +463,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..a6cee0e98 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 @@ -55,8 +55,8 @@ msgid "" "for the underlying database. As a side-effect, an extension may be added to " "the filename and more than one file may be created. By default, the " "underlying database file is opened for reading and writing. The optional " -"*flag* parameter has the same interpretation as the *flag* parameter of :" -"func:`dbm.open`." +"*flag* parameter has the same interpretation as the *flag* parameter " +"of :func:`dbm.open`." msgstr "" "永続的な辞書を開きます。指定された *filename* は、根底にあるデータベースの基" "本ファイル名となります。副作用として、 *filename* には拡張子がつけられる場合" @@ -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 "" @@ -78,13 +80,13 @@ msgid "" "dictionary entry is modified. By default modified objects are written " "*only* when assigned to the shelf (see :ref:`shelve-example`). If the " "optional *writeback* parameter is set to ``True``, all entries accessed are " -"also cached in memory, and written back on :meth:`~Shelf.sync` and :meth:" -"`~Shelf.close`; this can make it handier to mutate mutable entries in the " -"persistent dictionary, but, if many entries are accessed, it can consume " -"vast amounts of memory for the cache, and it can make the close operation " -"very slow since all accessed entries are written back (there is no way to " -"determine which accessed entries are mutable, nor which ones were actually " -"mutated)." +"also cached in memory, and written back on :meth:`~Shelf.sync` " +"and :meth:`~Shelf.close`; this can make it handier to mutate mutable entries " +"in the persistent dictionary, but, if many entries are accessed, it can " +"consume vast amounts of memory for the cache, and it can make the close " +"operation very slow since all accessed entries are written back (there is no " +"way to determine which accessed entries are mutable, nor which ones were " +"actually mutated)." msgstr "" "Python の意味論により、シェルフには永続的な辞書の可変エントリがいつ変更された" "かを知る術がありません。\n" @@ -99,30 +101,32 @@ 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 "" -"Do not rely on the shelf being closed automatically; always call :meth:" -"`~Shelf.close` explicitly when you don't need it any more, or use :func:" -"`shelve.open` as a context manager::" +"Do not rely on the shelf being closed automatically; always " +"call :meth:`~Shelf.close` explicitly when you don't need it any more, or " +"use :func:`shelve.open` as a context manager::" 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 "" @@ -155,23 +159,24 @@ msgid "" msgstr "" "シェルフが *writeback* を :const:`True` にセットして開かれている場合に、" "キャッシュ中の全てのエントリを書き戻します。また可能な場合は、キャッシュを空" -"にしてディスク上の永続的な辞書を同期します。このメソッドはシェルフを :meth:" -"`close` によって閉じるとき自動的に呼び出されます。" +"にしてディスク上の永続的な辞書を同期します。このメソッドはシェルフ" +"を :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" @@ -187,13 +192,13 @@ msgid "" "the database should be fairly small, and in rare cases key collisions may " "cause the database to refuse updates." msgstr "" -"どのデータベースパッケージが使われるか (例えば :mod:`dbm.ndbm` 、 :mod:`dbm." -"gnu`) は、どのインターフェースが利用可能かに依存します。従って、データベース" -"を :mod:`dbm` を使って直接開く方法は安全ではありません。データベースはま" -"た、 :mod:`dbm` が使われた場合 (不幸なことに) その制約に縛られます --- これは" -"データベースに記録されたオブジェクト (の pickle 化された表現) はかなり小さく" -"なければならず、キー衝突が生じた場合に、稀にデータベースを更新することができ" -"なくなることを意味します。" +"どのデータベースパッケージが使われるか (例え" +"ば :mod:`dbm.ndbm` 、 :mod:`dbm.gnu`) は、どのインターフェースが利用可能かに" +"依存します。従って、データベースを :mod:`dbm` を使って直接開く方法は安全では" +"ありません。データベースはまた、 :mod:`dbm` が使われた場合 (不幸なことに) そ" +"の制約に縛られます --- これはデータベースに記録されたオブジェクト (の pickle " +"化された表現) はかなり小さくなければならず、キー衝突が生じた場合に、稀にデー" +"タベースを更新することができなくなることを意味します。" #: ../../library/shelve.rst:109 msgid "" @@ -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* に書き戻され" "ます; この機能により、可変のエントリに対して自然な操作が可能になりますが、さ" "らに多くのメモリを消費し、辞書をファイルと同期して閉じる際に長い時間がかかる" "ようになります。" @@ -277,15 +286,15 @@ msgstr "コンテキストマネージャーサポートが追加されました #: ../../library/shelve.rst:155 msgid "" -"A subclass of :class:`Shelf` which exposes :meth:`!first`, :meth:`!next`, :" -"meth:`!previous`, :meth:`!last` and :meth:`!set_location` methods. These are " -"available in the third-party :mod:`!bsddb` module from `pybsddb `_ but not in other database modules. The " -"*dict* object passed to the constructor must support those methods. This is " -"generally accomplished by calling one of :func:`!bsddb.hashopen`, :func:`!" -"bsddb.btopen` or :func:`!bsddb.rnopen`. The optional *protocol*, " -"*writeback*, and *keyencoding* parameters have the same interpretation as " -"for the :class:`Shelf` class." +"A subclass of :class:`Shelf` which exposes :meth:`!first`, :meth:`!" +"next`, :meth:`!previous`, :meth:`!last` and :meth:`!set_location` methods. " +"These are available in the third-party :mod:`!bsddb` module from `pybsddb " +"`_ but not in other database " +"modules. The *dict* object passed to the constructor must support those " +"methods. This is generally accomplished by calling one of :func:`!" +"bsddb.hashopen`, :func:`!bsddb.btopen` or :func:`!bsddb.rnopen`. The " +"optional *protocol*, *writeback*, and *keyencoding* parameters have the same " +"interpretation as for the :class:`Shelf` class." msgstr "" #: ../../library/shelve.rst:169 @@ -293,9 +302,9 @@ msgid "" "A subclass of :class:`Shelf` which accepts a *filename* instead of a dict-" "like object. The underlying file will be opened using :func:`dbm.open`. By " "default, the file will be created and opened for both read and write. The " -"optional *flag* parameter has the same interpretation as for the :func:`." -"open` function. The optional *protocol* and *writeback* parameters have the " -"same interpretation as for the :class:`Shelf` class." +"optional *flag* parameter has the same interpretation as for " +"the :func:`.open` function. The optional *protocol* and *writeback* " +"parameters have the same interpretation as for the :class:`Shelf` class." msgstr "" ":class:`Shelf` のサブクラスで、辞書に似たオブジェクトの代わりに *filename* を" "受理します。根底にあるファイルは :func:`dbm.open` を使って開かれます。デフォ" @@ -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..c93c0736e 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:" @@ -49,36 +49,39 @@ msgstr ":mod:`shlex` モジュールは以下の関数を定義しています:" #: ../../library/shlex.rst:26 msgid "" -"Split the string *s* using shell-like syntax. If *comments* is :const:" -"`False` (the default), the parsing of comments in the given string will be " -"disabled (setting the :attr:`~shlex.commenters` attribute of the :class:" -"`~shlex.shlex` instance to the empty string). This function operates in " -"POSIX mode by default, but uses non-POSIX mode if the *posix* argument is " -"false." +"Split the string *s* using shell-like syntax. If *comments* " +"is :const:`False` (the default), the parsing of comments in the given string " +"will be disabled (setting the :attr:`~shlex.commenters` attribute of " +"the :class:`~shlex.shlex` instance to the empty string). This function " +"operates in POSIX mode by default, but uses non-POSIX mode if the *posix* " +"argument is false." msgstr "" -"シェルに似た文法を使って、文字列 *s* を分割します。 *comments* が :const:" -"`False` (デフォルト値) の場合、受理した文字列内のコメントを解析しません (:" -"class:`~shlex.shlex` インスタンスの :attr:`~shlex.commenters` メンバの値を空" -"文字列にします)。この関数はデフォルトでは POSIX モードで動作し、 *posix* 引数" -"が偽の場合は非 POSIX モードで動作します。" +"シェルに似た文法を使って、文字列 *s* を分割します。 *comments* " +"が :const:`False` (デフォルト値) の場合、受理した文字列内のコメントを解析しま" +"せん (:class:`~shlex.shlex` インスタンスの :attr:`~shlex.commenters` メンバの" +"値を空文字列にします)。この関数はデフォルトでは 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``." +"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,32 +130,60 @@ 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 " -"characters from. It must be a file-/stream-like object with :meth:`~io." -"TextIOBase.read` and :meth:`~io.TextIOBase.readline` methods, or a string. " -"If no argument is given, input will be taken from ``sys.stdin``. The second " -"optional argument is a filename string, which sets the initial value of the :" -"attr:`~shlex.infile` attribute. If the *instream* argument is omitted or " -"equal to ``sys.stdin``, this second argument defaults to \"stdin\". The " -"*posix* argument defines the operational mode: when *posix* is not true " -"(default), the :class:`~shlex.shlex` instance will operate in compatibility " -"mode. When operating in POSIX mode, :class:`~shlex.shlex` will try to be as " -"close as possible to the POSIX shell parsing rules. The *punctuation_chars* " -"argument provides a way to make the behaviour even closer to how real shells " -"parse. This can take a number of values: the default value, ``False``, " -"preserves the behaviour seen under Python 3.5 and earlier. If set to " -"``True``, then parsing of the characters ``();<>|&`` is changed: any run of " -"these characters (considered punctuation characters) is returned as a single " -"token. If set to a non-empty string of characters, those characters will be " -"used as the punctuation characters. Any characters in the :attr:`wordchars` " -"attribute that appear in *punctuation_chars* will be removed from :attr:" -"`wordchars`. See :ref:`improved-shell-compatibility` for more information. " +"characters from. It must be a file-/stream-like object " +"with :meth:`~io.TextIOBase.read` and :meth:`~io.TextIOBase.readline` " +"methods, or a string. If no argument is given, input will be taken from " +"``sys.stdin``. The second optional argument is a filename string, which sets " +"the initial value of the :attr:`~shlex.infile` attribute. If the *instream* " +"argument is omitted or equal to ``sys.stdin``, this second argument defaults " +"to \"stdin\". The *posix* argument defines the operational mode: when " +"*posix* is not true (default), the :class:`~shlex.shlex` instance will " +"operate in compatibility mode. When operating in POSIX " +"mode, :class:`~shlex.shlex` will try to be as close as possible to the POSIX " +"shell parsing rules. The *punctuation_chars* argument provides a way to " +"make the behaviour even closer to how real shells parse. This can take a " +"number of values: the default value, ``False``, preserves the behaviour seen " +"under Python 3.5 and earlier. If set to ``True``, then parsing of the " +"characters ``();<>|&`` is changed: any run of these characters (considered " +"punctuation characters) is returned as a single token. If set to a non-" +"empty string of characters, those characters will be used as the punctuation " +"characters. Any characters in the :attr:`wordchars` attribute that appear " +"in *punctuation_chars* will be removed from :attr:`wordchars`. " +"See :ref:`improved-shell-compatibility` for more information. " "*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." @@ -243,8 +277,9 @@ msgstr "" msgid "" "This hook is exposed so that you can use it to implement directory search " "paths, addition of file extensions, and other namespace hacks. There is no " -"corresponding 'close' hook, but a shlex instance will call the :meth:`~io." -"IOBase.close` method of the sourced input stream when it returns EOF." +"corresponding 'close' hook, but a shlex instance will call " +"the :meth:`~io.IOBase.close` method of the sourced input stream when it " +"returns EOF." msgstr "" "このフックはディレクトリサーチパスや、ファイル拡張子の追加、その他の名前空間" "に関するハックを実装できるようにするために公開されています。 'close' フックに" @@ -256,8 +291,8 @@ msgid "" "For more explicit control of source stacking, use the :meth:`push_source` " "and :meth:`pop_source` methods." msgstr "" -"ソーススタックをより明示的に操作するには、 :meth:`push_source` および :meth:" -"`pop_source` メソッドを使ってください。" +"ソーススタックをより明示的に操作するには、 :meth:`push_source` およ" +"び :meth:`pop_source` メソッドを使ってください。" #: ../../library/shlex.rst:199 msgid "" @@ -266,8 +301,8 @@ msgid "" "the same method used internally by the :meth:`sourcehook` method." msgstr "" "入力ソースストリームを入力スタックにプッシュします。ファイル名引数が指定され" -"た場合、以後のエラーメッセージ中で利用することができます。 :meth:" -"`sourcehook` メソッドが内部で使用しているのと同じメソッドです。" +"た場合、以後のエラーメッセージ中で利用することができま" +"す。 :meth:`sourcehook` メソッドが内部で使用しているのと同じメソッドです。" #: ../../library/shlex.rst:206 msgid "" @@ -277,7 +312,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 +319,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,27 +343,33 @@ 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, " -"the accented characters in the Latin-1 set are also included. If :attr:" -"`punctuation_chars` is not empty, the characters ``~-./*?=``, which can " -"appear in filename specifications and command line parameters, will also be " -"included in this attribute, and any characters which appear in " +"the accented characters in the Latin-1 set are also included. " +"If :attr:`punctuation_chars` is not empty, the characters ``~-./*?=``, which " +"can appear in filename specifications and command line parameters, will also " +"be included in this attribute, and any characters which appear in " "``punctuation_chars`` will be removed from ``wordchars`` if they are present " "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,20 +411,25 @@ 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 " -"tokens in a similar way to shell arguments. When used in combination with :" -"attr:`punctuation_chars`, tokens will be split on whitespace in addition to " -"those characters." +"tokens in a similar way to shell arguments. When used in combination " +"with :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." +"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,13 +459,13 @@ msgid "" "original input stream. Source requests may be stacked any number of levels " "deep." msgstr "" -"このメンバ変数は標準で :const:`None` を取ります。この値に文字列を代入すると、" -"その文字列は多くのシェルにおける ``source`` キーワードに似た、字句解析レベル" -"でのインクルード要求として認識されます。すなわち、その直後に現れるトークンを" -"ファイル名として新たなストリームを開き、そのストリームを入力として、EOF に到" -"達するまで読み込まれます。新たなストリームの EOF に到達した時点で :meth:`~io." -"IOBase.close` が呼び出され、入力は元の入力ストリームに戻されます。ソースリク" -"エストは任意のレベルの深さまでスタックしてかまいません。" +"このメンバ変数は標準で ``None`` を取ります。この値に文字列を代入すると、その" +"文字列は多くのシェルにおける ``source`` キーワードに似た、字句解析レベルでの" +"インクルード要求として認識されます。すなわち、その直後に現れるトークンをファ" +"イル名として新たなストリームを開き、そのストリームを入力として、EOF に到達す" +"るまで読み込まれます。新たなストリームの EOF に到達した時点" +"で :meth:`~io.IOBase.close` が呼び出され、入力は元の入力ストリームに戻されま" +"す。ソースリクエストは任意のレベルの深さまでスタックしてかまいません。" #: ../../library/shlex.rst:310 msgid "" @@ -427,9 +473,10 @@ msgid "" "instance will print verbose progress output on its behavior. If you need to " "use this, you can read the module source code to learn the details." msgstr "" -"このメンバ変数が数値で、かつ ``1`` またはそれ以上の値の場合、 :class:`~shlex." -"shlex` インスタンスは動作に関する冗長な進捗報告を出力します。この出力を使いた" -"いなら、モジュールのソースコードを読めば詳細を学ぶことができます。" +"このメンバ変数が数値で、かつ ``1`` またはそれ以上の値の場" +"合、 :class:`~shlex.shlex` インスタンスは動作に関する冗長な進捗報告を出力しま" +"す。この出力を使いたいなら、モジュールのソースコードを読めば詳細を学ぶことが" +"できます。" #: ../../library/shlex.rst:317 msgid "Source line number (count of newlines seen so far plus one)." @@ -450,7 +497,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 +504,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" @@ -542,21 +594,22 @@ msgstr "" #: ../../library/shlex.rst:378 msgid "" -"Enclosing characters in quotes which are not part of :attr:`~shlex." -"escapedquotes` (e.g. ``\"'\"``) preserve the literal value of all characters " -"within the quotes;" +"Enclosing characters in quotes which are not part " +"of :attr:`~shlex.escapedquotes` (e.g. ``\"'\"``) preserve the literal value " +"of all characters within the quotes;" msgstr "" ":attr:`~shlex.escapedquotes` でない引用符文字 (``\"'\"`` など) で囲まれている" "全ての文字のリテラル値を保持する" #: ../../library/shlex.rst:382 msgid "" -"Enclosing characters in quotes which are part of :attr:`~shlex." -"escapedquotes` (e.g. ``'\"'``) preserves the literal value of all characters " -"within the quotes, with the exception of the characters mentioned in :attr:" -"`~shlex.escape`. The escape characters retain its special meaning only when " -"followed by the quote in use, or the escape character itself. Otherwise the " -"escape character will be considered a normal character." +"Enclosing characters in quotes which are part " +"of :attr:`~shlex.escapedquotes` (e.g. ``'\"'``) preserves the literal value " +"of all characters within the quotes, with the exception of the characters " +"mentioned in :attr:`~shlex.escape`. The escape characters retain its " +"special meaning only when followed by the quote in use, or the escape " +"character itself. Otherwise the escape character will be considered a normal " +"character." msgstr "" "引用符に囲まれた :attr:`~shlex.escapedquotes` に含まれる文字 (``'\"'`` など) " "は、 :attr:`~shlex.escape` に含まれる文字を除き、全ての文字のリテラル値を保持" @@ -572,11 +625,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 +641,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 +666,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 +725,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." +"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`.)" +"``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..bfd474466 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 @@ -51,8 +51,8 @@ msgstr "" #: ../../library/shutil.rst:25 msgid "" -"Even the higher-level file copying functions (:func:`shutil.copy`, :func:" -"`shutil.copy2`) cannot copy all file metadata." +"Even the higher-level file copying functions " +"(:func:`shutil.copy`, :func:`shutil.copy2`) cannot copy all file metadata." msgstr "" "高水準のファイルコピー関数 (:func:`shutil.copy`, :func:`shutil.copy2`) でも、" "ファイルのメタデータの全てをコピーすることはできません。" @@ -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`` を送出します。 " +"引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` " +"``shutil.copyfile`` を送出します。" #: ../../library/shutil.rst:72 msgid "" @@ -174,19 +183,26 @@ msgid "" "like object>` or path names given as strings. If *follow_symlinks* is false, " "and both *src* and *dst* are symbolic links, :func:`copymode` will attempt " "to modify the mode of *dst* itself (rather than the file it points to). " -"This functionality is not available on every platform; please see :func:" -"`copystat` for more information. If :func:`copymode` cannot modify symbolic " -"links on the local platform, and it is asked to do so, it will do nothing " -"and return." +"This functionality is not available on every platform; please " +"see :func:`copystat` for more information. If :func:`copymode` cannot " +"modify symbolic 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`` を送出します。 " +"引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` " +"``shutil.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 "" @@ -226,27 +247,27 @@ msgid "" "If ``os.chmod in os.supports_follow_symlinks`` is ``True``, :func:`copystat` " "can modify the permission bits of a symbolic link." msgstr "" -"``os.chmod in os.supports_follow_symlinks`` が ``True`` の場合 :func:" -"`copystat` はシンボリックリンクのパーミッションを変更できます。" +"``os.chmod in os.supports_follow_symlinks`` が ``True`` の場" +"合 :func:`copystat` はシンボリックリンクのパーミッションを変更できます。" #: ../../library/shutil.rst:136 msgid "" "If ``os.utime in os.supports_follow_symlinks`` is ``True``, :func:`copystat` " "can modify the last access and modification times of a symbolic link." msgstr "" -"``os.utime in os.supports_follow_symlinks`` が ``True`` の場合 :func:" -"`copystat` はシンボリックリンクの最終アクセス時間と最終変更時間を変更できま" -"す。" +"``os.utime in os.supports_follow_symlinks`` が ``True`` の場" +"合 :func:`copystat` はシンボリックリンクの最終アクセス時間と最終変更時間を変" +"更できます。" #: ../../library/shutil.rst:140 msgid "" -"If ``os.chflags in os.supports_follow_symlinks`` is ``True``, :func:" -"`copystat` can modify the flags of a symbolic link. (``os.chflags`` is not " -"available on all platforms.)" +"If ``os.chflags in os.supports_follow_symlinks`` is " +"``True``, :func:`copystat` can modify the flags of a symbolic link. " +"(``os.chflags`` is not available on all platforms.)" msgstr "" -"``os.chflags in os.supports_follow_symlinks`` が ``True`` の場合 :func:" -"`copystat` はシンボリックリンクのフラグを変更できます。 (``os.chflags`` がな" -"いプラットフォームもあります。)" +"``os.chflags in os.supports_follow_symlinks`` が ``True`` の場" +"合 :func:`copystat` はシンボリックリンクのフラグを変更できます。 " +"(``os.chflags`` がないプラットフォームもあります。)" #: ../../library/shutil.rst:145 msgid "" @@ -255,21 +276,20 @@ msgid "" "can. :func:`copystat` never returns failure." msgstr "" "機能の幾つか、もしくは全てが利用できないプラットフォームでシンボリックリンク" -"を変更しようとした場合、 :func:`copystat` は可能な限り全てをコピーします。:" -"func:`copystat` が失敗を返すことはありません。" +"を変更しようとした場合、 :func:`copystat` は可能な限り全てをコピーしま" +"す。:func:`copystat` が失敗を返すことはありません。" #: ../../library/shutil.rst:150 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`` を送出します。 " +"引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` " +"``shutil.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 "" @@ -325,8 +344,8 @@ msgid "" "Identical to :func:`~shutil.copy` except that :func:`copy2` also attempts to " "preserve file metadata." msgstr "" -":func:`copy2` はファイルのメタデータを保持しようとすることを除けば :func:" -"`~shutil.copy` と等価です。" +":func:`copy2` はファイルのメタデータを保持しようとすることを除け" +"ば :func:`~shutil.copy` と等価です。" #: ../../library/shutil.rst:195 msgid "" @@ -334,15 +353,23 @@ msgid "" "attempts to copy all metadata from the *src* symbolic link to the newly " "created *dst* symbolic link. However, this functionality is not available on " "all platforms. On platforms where some or all of this functionality is " -"unavailable, :func:`copy2` will preserve all the metadata it can; :func:" -"`copy2` never raises an exception because it cannot preserve file metadata." -msgstr "" +"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 "" -":func:`copy2` uses :func:`copystat` to copy the file metadata. Please see :" -"func:`copystat` for more information about platform support for modifying " -"symbolic link metadata." +":func:`copy2` uses :func:`copystat` to copy the file metadata. Please " +"see :func:`copystat` for more information about platform support for " +"modifying symbolic link metadata." msgstr "" ":func:`copy2` はファイルのメタデータをコピーするために :func:`copystat` を利" "用します。シンボリックリンクのメタデータを変更するためのプラットフォームサ" @@ -360,29 +387,32 @@ msgstr "" #: ../../library/shutil.rst:224 msgid "" -"This factory function creates a function that can be used as a callable for :" -"func:`copytree`\\'s *ignore* argument, ignoring files and directories that " -"match one of the glob-style *patterns* provided. See the example below." +"This factory function creates a function that can be used as a callable " +"for :func:`copytree`\\'s *ignore* argument, ignoring files and directories " +"that match one of the glob-style *patterns* provided. See the example below." msgstr "" "このファクトリ関数は、 :func:`copytree` 関数の *ignore* 引数に渡すための呼び" "出し可能オブジェクトを作成します。 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 "" "Permissions and times of directories are copied with :func:`copystat`, " "individual files are copied using :func:`~shutil.copy2`." msgstr "" -"各ディレクトリのパーミッション、最終アクセス時間、最終変更時間は :func:" -"`copystat` でコピーされます。それぞれのファイルは :func:`~shutil.copy2` でコ" -"ピーされます。" +"各ディレクトリのパーミッション、最終アクセス時間、最終変更時間" +"は :func:`copystat` でコピーされます。それぞれのファイル" +"は :func:`~shutil.copy2` でコピーされます。" #: ../../library/shutil.rst:240 msgid "" @@ -399,12 +429,17 @@ msgstr "" #: ../../library/shutil.rst:245 msgid "" "When *symlinks* is false, if the file pointed to by the symlink doesn't " -"exist, an exception will be added in the list of errors raised in an :exc:" -"`Error` exception at the end of the copy process. You can set the optional " -"*ignore_dangling_symlinks* flag to true if you want to silence this " +"exist, an exception will be added in the list of errors raised in " +"an :exc:`Error` exception at the end of the copy process. You can set the " +"optional *ignore_dangling_symlinks* flag to true if you want to silence this " "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 +467,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,33 +474,38 @@ 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 " +"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 " "operation will continue if it encounters existing directories, and files " "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`` を送出します。 " +"引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` " +"``shutil.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 +515,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 +524,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,17 +555,18 @@ msgstr "" "それ以外のプラットフォームでは、 :func:`rmtree` の実装はシンボリックリンク攻" "撃の影響を受けます。適当なタイミングと環境で攻撃者はファイルシステム上のシン" "ボリックリンクを操作して、それ以外の方法ではアクセス不可能なファイルを削除す" -"ることが出来ます。アプリケーションは、どちらのバージョンの :func:`rmtree` が" -"利用されているかを知るために関数のデータ属性 :data:`rmtree." -"avoids_symlink_attacks` を利用することができます。" +"ることが出来ます。アプリケーションは、どちらのバージョンの ``rmtree()`` が利" +"用されているかを知るために関数のデータ属" +"性 :data:`rmtree.avoids_symlink_attacks` を利用することができます。" #: ../../library/shutil.rst:318 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 +574,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`` を送出します。 " +"引数 ``path``, ``dir_fd`` を指定して :ref:`監査イベント ` " +"``shutil.rmtree`` を送出します。" #: ../../library/shutil.rst:332 msgid "" @@ -563,16 +614,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." +"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 "" @@ -580,29 +633,34 @@ msgid "" "attack resistant version of :func:`rmtree`. Currently this is only true for " "platforms supporting fd-based directory access functions." msgstr "" -"プラットフォームと実装がシンボリックリンク攻撃に耐性のあるバージョンの :func:" -"`rmtree` を提供しているかどうかを示します。現在のところ、この属性は fd ベース" -"のディレクトリアクセス関数をサポートしているプラットフォームでのみ真になりま" -"す。" +"プラットフォームと実装がシンボリックリンク攻撃に耐性のあるバージョン" +"の :func:`rmtree` を提供しているかどうかを示します。現在のところ、この属性は " +"fd ベースのディレクトリアクセス関数をサポートしているプラットフォームでのみ真" +"になります。" #: ../../library/shutil.rst:363 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,24 +670,31 @@ 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 " -"if :func:`os.rename` cannot be used. If the source is a directory, :func:" -"`copytree` is called, passing it the *copy_function*. The default " -"*copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " +"if :func:`os.rename` cannot be used. If the source is a " +"directory, :func:`copytree` is called, passing it the *copy_function*. The " +"default *copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " "*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`` を送出します。 " +"引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` " +"``shutil.move`` を送出します。" #: ../../library/shutil.rst:388 msgid "" @@ -661,12 +726,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 +742,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 +761,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 +785,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." +"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 +816,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 +831,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 +868,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 +877,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 "" @@ -807,20 +902,20 @@ msgstr "プラットフォーム依存の効率的なコピー操作" #: ../../library/shutil.rst:509 msgid "" -"Starting from Python 3.8, all functions involving a file copy (:func:" -"`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" -"`move`) may use platform-specific \"fast-copy\" syscalls in order to copy " -"the file more efficiently (see :issue:`33671`). \"fast-copy\" means that the " -"copying operation occurs within the kernel, avoiding the use of userspace " -"buffers in Python as in \"``outfd.write(infd.read())``\"." -msgstr "" -"Python 3.8 から、ファイルのコピーを伴う全ての関数 (:func:`copyfile`, :func:" -"`~shutil.copy`, :func:`copy2`, :func:`copytree`, および :func:`move`) はより" -"効率的なファイルのコピーのためにプラットフォーム特有の \"高速なコピー\" を行" -"うことがあります (:issue:`33671` を参照してください). ここで \"高速なコピー" -"\" とは、 \"``outfd.write(infd.read())``\" のようにPython が管理するユーザー" -"空間のバッファを利用することを避け、コピー操作がカーネル空間内で行われること" -"を意味します。" +"Starting from Python 3.8, all functions involving a file copy " +"(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, " +"and :func:`move`) may use platform-specific \"fast-copy\" syscalls in order " +"to copy the file more efficiently (see :issue:`33671`). \"fast-copy\" means " +"that the copying operation occurs within the kernel, avoiding the use of " +"userspace buffers in Python as in \"``outfd.write(infd.read())``\"." +msgstr "" +"Python 3.8 から、ファイルのコピーを伴う全ての関数 " +"(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, お" +"よび :func:`move`) はより効率的なファイルのコピーのためにプラットフォーム特有" +"の \"高速なコピー\" を行うことがあります (:issue:`33671` を参照してくださ" +"い). ここで \"高速なコピー\" とは、 \"``outfd.write(infd.read())``\" のよう" +"にPython が管理するユーザー空間のバッファを利用することを避け、コピー操作が" +"カーネル空間内で行われることを意味します。" #: ../../library/shutil.rst:517 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." @@ -831,40 +926,43 @@ 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 "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " -"instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." -"copyfileobj` is used." +"instead of 64 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used." msgstr "" "Windows では :func:`shutil.copyfile` はより大きなバッファサイズをデフォルトと" -"して使います (6 KiB の代わりに 1 MiB が使われます)。また、 :func:" -"`memoryview` ベースの変形である :func:`shutil.copyfileobj` が使われます。" +"して使います (6 KiB の代わりに 1 MiB が使われます)。ま" +"た、 :func:`memoryview` ベースの変形である :func:`shutil.copyfileobj` が使わ" +"れます。" #: ../../library/shutil.rst:527 msgid "" "If the fast-copy operation fails and no data was written in the destination " -"file then shutil will silently fallback on using less efficient :func:" -"`copyfileobj` function internally." +"file then shutil will silently fallback on using less " +"efficient :func:`copyfileobj` function internally." 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." +"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 +972,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 +993,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 +1003,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 +1038,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" @@ -961,8 +1079,8 @@ msgstr "" msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " -"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if the :mod:" -"`lzma` module is available)." +"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if " +"the :mod:`lzma` module is available)." msgstr "" #: ../../library/shutil.rst:612 @@ -1029,13 +1147,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." +"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 +1166,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 +1238,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 +1245,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 +1268,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." @@ -1167,10 +1292,11 @@ msgstr "" #: ../../library/shutil.rst:708 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " -"\"bztar\", or \"xztar\". Or any other format registered with :func:" -"`register_unpack_format`. If not provided, :func:`unpack_archive` will use " -"the archive file name extension and see if an unpacker was registered for " -"that extension. In case none is found, a :exc:`ValueError` is raised." +"\"bztar\", or \"xztar\". Or any other format registered " +"with :func:`register_unpack_format`. If not " +"provided, :func:`unpack_archive` will use the archive file name extension " +"and see if an unpacker was registered for that extension. In case none is " +"found, a :exc:`ValueError` is raised." msgstr "" "*format* はアーカイブフォーマットで、 \"zip\", \"tar\", \"gztar\", " "\"bztar\", \"xztar\" あるいは :func:`register_unpack_format` で登録したその他" @@ -1179,7 +1305,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 +1312,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 +1333,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,52 +1352,51 @@ msgstr "" #: ../../library/shutil.rst:739 msgid "Added the *filter* argument." -msgstr "" +msgstr "*filter* 引数が追加されました。" #: ../../library/shutil.rst:744 msgid "" "Registers an unpack format. *name* is the name of the format and " -"*extensions* is a list of extensions corresponding to the format, like ``." -"zip`` for Zip files." +"*extensions* is a list of extensions corresponding to the format, like " +"``.zip`` for Zip files." msgstr "" "アンパック用のフォーマットを登録します。 *name* はフォーマット名で、 " "*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 "" +"possibly a *filter* keyword argument, if it was given " +"to :func:`unpack_archive`;" +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 "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -"フォーマットの説明として *description* を指定することができます。これは :" -"func:`get_unpack_formats` 関数によって返されます。" +"フォーマットの説明として *description* を指定することができます。これ" +"は :func:`get_unpack_formats` 関数によって返されます。" #: ../../library/shutil.rst:764 msgid "Unregister an unpack format. *name* is the name of the format." @@ -1312,7 +1443,6 @@ msgstr "" "この例では、ユーザの :file:`.ssh` ディレクトリにあるすべてのファイルを含む、 " "gzip された tar ファイルアーカイブを作成します::" -#: ../../library/shutil.rst:794 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1321,12 +1451,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 +1473,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*" @@ -1349,9 +1493,9 @@ msgid "" "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -"この例では、 `上記の例 `_ と同じく :func:" -"`make_archive` の使い方を示しますが、ここでは特に *base_dir* の使い方を説明し" -"ます。以下のようなディレクトリ構造があるとします。" +"この例では、 `上記の例 `_ と同じ" +"く :func:`make_archive` の使い方を示しますが、ここでは特に *base_dir* の使い" +"方を説明します。以下のようなディレクトリ構造があるとします。" #: ../../library/shutil.rst:825 msgid "" @@ -1363,14 +1507,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::" +"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` は含まないようにします。この場合以下のようにします。" +"作成するアーカイブには :file:`please_add.txt` が含まれますが、いっぽ" +"う :file:`do_not_add.txt` は含まないようにします。\n" +"この場合以下のようにします。 ::" #: ../../library/shutil.rst:838 msgid "" @@ -1396,6 +1547,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" @@ -1417,12 +1571,12 @@ msgstr "" #: ../../library/shutil.rst:869 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " -"terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" -"`os.get_terminal_size`." +"terminal connected to :data:`sys.__stdout__` is queried by " +"invoking :func:`os.get_terminal_size`." msgstr "" -"典型的な ``COLUMNS`` や ``LINES`` が定義されていない場合には、 :data:`sys." -"__stdout__` に接続されているターミナルに :func:`os.get_terminal_size` を呼び" -"出して問い合わせます。" +"典型的な ``COLUMNS`` や ``LINES`` が定義されていない場合に" +"は、 :data:`sys.__stdout__` に接続されているターミナル" +"に :func:`os.get_terminal_size` を呼び出して問い合わせます。" #: ../../library/shutil.rst:873 msgid "" @@ -1449,11 +1603,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..d7feb5798 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,31 +51,35 @@ 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 "" "A handler for a particular signal, once set, remains installed until it is " "explicitly reset (Python emulates the BSD style interface regardless of the " -"underlying implementation), with the exception of the handler for :const:" -"`SIGCHLD`, which follows the underlying implementation." +"underlying implementation), with the exception of the handler " +"for :const:`SIGCHLD`, which follows the underlying implementation." msgstr "" "特定のシグナルに対するハンドラが一度設定されると、明示的にリセットしないかぎ" "り設定されたままになります (Python は背後の実装系に関係なく BSD 形式のイン" "ターフェースをエミュレートします)。例外は :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" @@ -92,18 +95,23 @@ msgid "" msgstr "" "Python のシグナルハンドラは、低水準 (C言語) のシグナルハンドラ内で実行される" "わけではありません。代わりに、低水準のシグナルハンドラが :term:`virtual " -"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 " -"will return from the signal handler to the C code, which is likely to raise " -"the same signal again, causing Python to apparently hang. From Python 3.3 " -"onwards, you can use the :mod:`faulthandler` module to report on synchronous " -"errors." -msgstr "" +"machine` が対応する Python のシグナルハンドラを後から (例えば次" +"の :term:`bytecode` 命令時に) 実行するようにフラグを立てます:" + +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 will return from the signal handler to the C code, which is likely to " +"raise the same signal again, causing Python to apparently hang. From Python " +"3.3 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" @@ -137,8 +147,8 @@ msgid "" msgstr "" "Python のシグナルハンドラは、もしシグナルを受け取ったのが別のスレッドだったと" "しても、常にメインインタープリターの Python のメインスレッドで実行されます。" -"このためシグナルをスレッド間通信に使うことはできません。代わりに :mod:" -"`threading` モジュールが提供している同期プリミティブを利用できます。" +"このためシグナルをスレッド間通信に使うことはできません。代わり" +"に :mod:`threading` モジュールが提供している同期プリミティブを利用できます。" #: ../../library/signal.rst:69 msgid "" @@ -154,58 +164,43 @@ msgstr "モジュールの内容" #: ../../library/signal.rst:75 msgid "" -"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" -"const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " -"constants listed below were turned into :class:`enums ` (:" -"class:`Signals`, :class:`Handlers` and :class:`Sigmasks` respectively). :" -"func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:" -"`sigwait` functions return human-readable :class:`enums ` as :" -"class:`Signals` objects." +"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask " +"(:const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " +"constants listed below were turned into :class:`enums ` " +"(:class:`Signals`, :class:`Handlers` and :class:`Sigmasks` " +"respectively). :func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` " +"and :func:`sigwait` functions return human-readable :class:`enums " +"` as :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 "" -":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" -"`SIG_IGN`." +":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` " +"and :const:`SIG_IGN`." msgstr "" #: ../../library/signal.rst:101 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" -"`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" +":class:`enum.IntEnum` collection the " +"constants :const:`SIG_BLOCK`, :const:`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -#: ../../library/signal.rst:105 ../../library/signal.rst:473 +msgid "Availability" +msgstr "利用可能な環境" + 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." +"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 "" @@ -339,48 +320,50 @@ msgid "" "signal is defined as :const:`signal.SIGHUP`; the variable names are " "identical to the names used in C programs, as found in ````. The " "Unix man page for ':c:func:`signal`' lists the existing signals (on some " -"systems this is :manpage:`signal(2)`, on others the list is in :manpage:" -"`signal(7)`). Note that not all systems define the same set of signal names; " -"only those names defined by the system are defined by this module." +"systems this is :manpage:`signal(2)`, on others the list is " +"in :manpage:`signal(7)`). Note that not all systems define the same set of " +"signal names; only those names defined by the system are defined by this " +"module." msgstr "" "全てのシグナル番号はシンボル定義されています。例えば、ハングアップシグナル" "は :const:`signal.SIGHUP` で定義されています; 変数名は C 言語のプログラムで使" "われているのと同じ名前で、 ```` にあります。 ':c:func:`signal`' に" "関する Unix マニュアルページでは、システムで定義されているシグナルを列挙して" -"います (あるシステムではリストは :manpage:`signal(2)` に、別のシステムでは :" -"manpage:`signal(7)` に列挙されています)。全てのシステムで同じシグナル名のセッ" -"トを定義しているわけではないので注意してください; このモジュールでは、システ" -"ムで定義されているシグナル名だけを定義しています。" +"います (あるシステムではリストは :manpage:`signal(2)` に、別のシステムで" +"は :manpage:`signal(7)` に列挙されています)。全てのシステムで同じシグナル名の" +"セットを定義しているわけではないので注意してください; このモジュールでは、シ" +"ステムで定義されているシグナル名だけを定義しています。" #: ../../library/signal.rst:259 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -":kbd:`CTRL+C` キーストロークに該当するシグナル。このシグナルは :func:`os." -"kill` でだけ利用できます。" +":kbd:`CTRL+C` キーストロークに該当するシグナル。このシグナル" +"は :func:`os.kill` でだけ利用できます。" #: ../../library/signal.rst:269 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." msgstr "" -":kbd:`CTRL+BREAK` キーストロークに該当するシグナル。このシグナルは :func:`os." -"kill` でだけ利用できます。" +":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." +"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 "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." msgstr "" -"実時間でデクリメントするインターバルタイマーです。タイマーが発火したときに :" -"const:`SIGALRM` を送ります。" +"実時間でデクリメントするインターバルタイマーです。タイマーが発火したとき" +"に :const:`SIGALRM` を送ります。" #: ../../library/signal.rst:291 msgid "" @@ -388,7 +371,7 @@ msgid "" "SIGVTALRM upon expiration." msgstr "" "プロセスの実行時間だけデクリメントするインターバルタイマーです。タイマーが発" -"火したときに :const:`SIGVTALRM` を送ります。" +"火したときに ``SIGVTALRM`` を送ります。" #: ../../library/signal.rst:297 msgid "" @@ -400,8 +383,7 @@ msgstr "" "プロセスの実行中と、システムがそのプロセスのために実行している時間だけデクリ" "メントするインターバルタイマーです。ITIMER_VIRTUAL と組み合わせて、このタイ" "マーはよくアプリケーションがユーザー空間とカーネル空間で消費した時間のプロ" -"ファイリングに利用されます。タイマーが発火したときに :const:`SIGPROF` を送り" -"ます。" +"ファイリングに利用されます。タイマーが発火したときに ``SIGPROF`` を送ります。" #: ../../library/signal.rst:305 msgid "" @@ -419,13 +401,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:" @@ -433,23 +414,22 @@ msgstr ":mod:`signal` モジュールは1つの例外を定義しています:" #: ../../library/signal.rst:329 msgid "" -"Raised to signal an error from the underlying :func:`setitimer` or :func:" -"`getitimer` implementation. Expect this error if an invalid interval timer " -"or a negative time is passed to :func:`setitimer`. This error is a subtype " -"of :exc:`OSError`." +"Raised to signal an error from the underlying :func:`setitimer` " +"or :func:`getitimer` implementation. Expect this error if an invalid " +"interval timer or a negative time is passed to :func:`setitimer`. This error " +"is a subtype of :exc:`OSError`." msgstr "" "背後の :func:`setitimer` または :func:`getitimer` 実装からエラーを通知するた" "めに送出されます。無効なインタバルタイマーや負の時間が :func:`setitimer` に渡" "された場合、このエラーを予期してください。このエラーは :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`." +"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,41 +453,46 @@ 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 "" "Return the current signal handler for the signal *signalnum*. The returned " -"value may be a callable Python object, or one of the special values :const:" -"`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. Here, :const:" -"`signal.SIG_IGN` means that the signal was previously ignored, :const:" -"`signal.SIG_DFL` means that the default way of handling the signal was " -"previously in use, and ``None`` means that the previous signal handler was " -"not installed from Python." +"value may be a callable Python object, or one of the special " +"values :const:`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. " +"Here, :const:`signal.SIG_IGN` means that the signal was previously " +"ignored, :const:`signal.SIG_DFL` means that the default way of handling the " +"signal was previously in use, and ``None`` means that the previous signal " +"handler was not installed from Python." msgstr "" "シグナル *signalnum* に対する現在のシグナルハンドラを返します。戻り値は呼び出" -"し可能な Python オブジェクトか、 :const:`signal.SIG_IGN`\\ 、 :const:`signal." -"SIG_DFL`\\ 、および :const:`None` といった特殊な値のいずれかです。ここで :" -"const:`signal.SIG_IGN` は以前そのシグナルが無視されていたことを示し、 :const:" -"`signal.SIG_DFL` は以前そのシグナルの標準の処理方法が使われていたことを示" -"し、 ``None`` はシグナルハンドラがまだ Python によってインストールされていな" -"いことを示します。" +"し可能な Python オブジェクト" +"か、 :const:`signal.SIG_IGN`\\ 、 :const:`signal.SIG_DFL`\\ 、およ" +"び :const:`None` といった特殊な値のいずれかです。ここ" +"で :const:`signal.SIG_IGN` は以前そのシグナルが無視されていたことを示" +"し、 :const:`signal.SIG_DFL` は以前そのシグナルの標準の処理方法が使われていた" +"ことを示し、 ``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." +"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,35 +502,38 @@ 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 "" -"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" -"func:`sigpending`." +"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` " +"and :func:`sigpending`." msgstr "" -":func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` :func:" -"`sigpending` も参照してください。" +":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." msgstr "" -"さらに詳しい情報についてはオンラインマニュアルページ :manpage:" -"`pidfd_send_signal(2)` を参照してください。" +"さらに詳しい情報についてはオンラインマニュアルペー" +"ジ :manpage:`pidfd_send_signal(2)` を参照してください。" #: ../../library/signal.rst:420 msgid "" @@ -558,30 +546,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`." @@ -629,13 +620,13 @@ msgstr ":data:`SIG_SETMASK`: シグナルマスク全体を *mask* としてセ #: ../../library/signal.rst:462 msgid "" -"*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" -"`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " -"including all signals." +"*mask* is a set of signal numbers (e.g. " +"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`}). " +"Use :func:`~signal.valid_signals` for a full mask including all signals." msgstr "" -"*mask* はシグナル番号の集合です (例えば {:const:`signal.SIGINT`, :const:" -"`signal.SIGTERM`})。全てのシグナルを含む全集合として :func:`~signal." -"valid_signals` を使うことが出来ます。" +"*mask* はシグナル番号の集合です (例えば " +"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`})。全てのシグナルを含む全集" +"合として :func:`~signal.valid_signals` を使うことが出来ます。" #: ../../library/signal.rst:466 msgid "" @@ -645,9 +636,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`." @@ -655,31 +645,33 @@ msgstr ":func:`pause`, :func:`sigpending`, :func:`sigwait` も参照して下さ #: ../../library/signal.rst:483 msgid "" -"Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" -"`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " -"to fire after *seconds* (float is accepted, different from :func:`alarm`) " -"and after that every *interval* seconds (if *interval* is non-zero). The " -"interval timer specified by *which* can be cleared by setting *seconds* to " -"zero." +"Sets given interval timer (one " +"of :const:`signal.ITIMER_REAL`, :const:`signal.ITIMER_VIRTUAL` " +"or :const:`signal.ITIMER_PROF`) specified by *which* to fire after *seconds* " +"(float is accepted, different from :func:`alarm`) and after that every " +"*interval* seconds (if *interval* is non-zero). The interval timer specified " +"by *which* can be cleared by setting *seconds* to zero." msgstr "" -"*which* で指定されたタイマー (:const:`signal.ITIMER_REAL`, :const:`signal." -"ITIMER_VIRTUAL`, :const:`signal.ITIMER_PROF` のどれか) を、 *seconds* 秒後と " -"(:func:`alarm` と異なり、floatを指定できます)、それから (*interval* が0でなけ" -"れば) *interval* 秒間隔で起動するように設定します。 *seconds* に0を指定する" -"と、*which* で指定されたタイマーをクリアすることができます。" +"*which* で指定されたタイマー " +"(:const:`signal.ITIMER_REAL`, :const:`signal.ITIMER_VIRTUAL`, :const:`signal.ITIMER_PROF` " +"のどれか) を、 *seconds* 秒後と (:func:`alarm` と異なり、floatを指定できま" +"す)、それから (*interval* が0でなければ) *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`." +"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)." @@ -687,8 +679,8 @@ msgstr "以前の値が (delay, interval) のタプルとして返されます #: ../../library/signal.rst:498 msgid "" -"Attempting to pass an invalid interval timer will cause an :exc:" -"`ItimerError`." +"Attempting to pass an invalid interval timer will cause " +"an :exc:`ItimerError`." msgstr "" "無効なインターバルタイマーを渡すと :exc:`ItimerError` 例外が発生します。" @@ -696,7 +688,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 +696,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 +726,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 +744,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 +762,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,32 +787,34 @@ 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 "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " "the special values :const:`signal.SIG_IGN` or :const:`signal.SIG_DFL`. The " -"previous signal handler will be returned (see the description of :func:" -"`getsignal` above). (See the Unix man page :manpage:`signal(2)` for further " -"information.)" +"previous signal handler will be returned (see the description " +"of :func:`getsignal` above). (See the Unix man page :manpage:`signal(2)` " +"for further information.)" msgstr "" "シグナル *signalnum* に対するハンドラを関数 *handler* にします。 *handler* は" -"二つの引数 (下記参照) を取る呼び出し可能な Python オブジェクトか、 :const:" -"`signal.SIG_IGN` あるいは :const:`signal.SIG_DFL` といった特殊な値にすること" -"ができます。以前に使われていたシグナルハンドラが返されます (上記の :func:" -"`getsignal` の記述を参照してください)。 (さらに詳しい情報については Unix マ" -"ニュアルページ :manpage:`signal(2)` を参照してください。)" +"二つの引数 (下記参照) を取る呼び出し可能な Python オブジェクト" +"か、 :const:`signal.SIG_IGN` あるいは :const:`signal.SIG_DFL` といった特殊な" +"値にすることができます。以前に使われていたシグナルハンドラが返されます (上記" +"の :func:`getsignal` の記述を参照してください)。 (さらに詳しい情報については " +"Unix マニュアルページ :manpage:`signal(2)` を参照してください。)" #: ../../library/signal.rst:585 msgid "" @@ -807,18 +825,24 @@ msgid "" msgstr "" "*handler* は二つの引数とともに呼び出されます: シグナル番号、および現在のス" "タックフレーム (``None`` またはフレームオブジェクト; フレームオブジェクトにつ" -"いての記述は :ref:`標準型の階層における説明 ` か、 :mod:" -"`inspect` モジュールの属性の説明を参照してください)。" +"いての記述は :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:" -"`SIGTERM`, or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any " -"other case. Note that not all systems define the same set of signal names; " +"On Windows, :func:`signal` can only be called " +"with :const:`SIGABRT`, :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:`SIGTERM`, " +"or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any other case. " +"Note that not all systems define the same set of signal names; " "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 +853,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,17 +872,17 @@ 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 "" -"See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" -"`sigwaitinfo` and :func:`sigtimedwait`." +"See " +"also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:`sigwaitinfo` " +"and :func:`sigtimedwait`." msgstr "" -":func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" -"`sigwaitinfo`, :func:`sigtimedwait` も参照して下さい。" +":func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:`sigwaitinfo`, :func:`sigtimedwait` " +"も参照して下さい。" #: ../../library/signal.rst:632 msgid "" @@ -868,61 +891,66 @@ msgid "" "signal and removes it from the pending list of signals. If one of the " "signals in *sigset* is already pending for the calling thread, the function " "will return immediately with information about that signal. The signal " -"handler is not called for the delivered signal. The function raises an :exc:" -"`InterruptedError` if it is interrupted by a signal that is not in *sigset*." +"handler is not called for the delivered signal. The function raises " +"an :exc:`InterruptedError` if it is interrupted by a signal that is not in " +"*sigset*." msgstr "" #: ../../library/signal.rst:641 msgid "" -"The return value is an object representing the data contained in the :c:type:" -"`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" -"`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:" -"`si_band`." +"The return value is an object representing the data contained in " +"the :c:type:`siginfo_t` structure, " +"namely: :attr:`si_signo`, :attr:`si_code`, :attr:`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:`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 +959,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,21 +985,40 @@ 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 " -"standard output closes early. This results in an exception like :code:" -"`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " -"entry point to catch this exception as follows::" +"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 standard output closes early. This results in an exception " +"like :code:`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 +1042,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 +1086,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,19 +1112,38 @@ 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 " -"complex or require high reliability should avoid raising exceptions from " +"For many programs, especially those that merely want to exit " +"on :exc:`KeyboardInterrupt`, this is not a problem, but applications that " +"are complex or require high reliability should avoid raising exceptions from " "signal handlers. They should also avoid catching :exc:`KeyboardInterrupt` as " "a means of gracefully shutting down. Instead, they should install their " "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 +1175,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..224633c80 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 @@ -57,8 +57,8 @@ msgstr "" #: ../../library/site.rst:25 msgid "" -"Importing the module used to trigger paths manipulation even when using :" -"option:`-S`." +"Importing the module used to trigger paths manipulation even when " +"using :option:`-S`." msgstr "" "以前は :option:`-S` を使っているときでも、モジュールをインポートするとパス変" "更が起動されていました。" @@ -81,21 +81,23 @@ 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 "" -":mod:`site` is no longer responsible for updating :data:`sys.prefix` and :" -"data:`sys.exec_prefix` on :ref:`sys-path-init-virtual-environments`. This is " -"now done during the :ref:`path initialization `. As a result, " -"under :ref:`sys-path-init-virtual-environments`, :data:`sys.prefix` and :" -"data:`sys.exec_prefix` no longer depend on the :mod:`site` initialization, " -"and are therefore unaffected by :option:`-S`." +":mod:`site` is no longer responsible for updating :data:`sys.prefix` " +"and :data:`sys.exec_prefix` on :ref:`sys-path-init-virtual-environments`. " +"This is now done during the :ref:`path initialization `. As a " +"result, under :ref:`sys-path-init-virtual-environments`, :data:`sys.prefix` " +"and :data:`sys.exec_prefix` no longer depend on the :mod:`site` " +"initialization, and are therefore unaffected by :option:`-S`." msgstr "" #: ../../library/site.rst:63 @@ -109,14 +111,14 @@ msgstr "" #: ../../library/site.rst:73 msgid "" -"A path configuration file is a file whose name has the form :file:`{name}." -"pth` and exists in one of the four directories mentioned above; its contents " -"are additional items (one per line) to be added to ``sys.path``. Non-" -"existing items are never added to ``sys.path``, and no check is made that " -"the item refers to a directory rather than a file. No item is added to " -"``sys.path`` more than once. Blank lines and lines beginning with ``#`` are " -"skipped. Lines starting with ``import`` (followed by space or tab) are " -"executed." +"A path configuration file is a file whose name has the " +"form :file:`{name}.pth` and exists in one of the four directories mentioned " +"above; its contents are additional items (one per line) to be added to " +"``sys.path``. Non-existing items are never added to ``sys.path``, and no " +"check is made that the item refers to a directory rather than a file. No " +"item is added to ``sys.path`` more than once. Blank lines and lines " +"beginning with ``#`` are skipped. Lines starting with ``import`` (followed " +"by space or tab) are executed." msgstr "" "パス設定ファイルは :file:`{name}.pth` という形式の名前をもつファイルで、上の4" "つのディレクトリのひとつにあります。その内容は ``sys.path`` に追加される追加" @@ -140,37 +142,37 @@ msgstr "" ":file:`.pth` ファイル内の実行可能な行は、特定のモジュールが実際に使用されるか" "どうかに関係なく、Pythonの起動時に毎回実行されます。したがって、その影響は最" "小限に抑えられるべきです。実行可能な行の主な目的は、対応するモジュールをイン" -"ポート可能にすることです(サードパーティ製インポートフックのロード、 :envvar:" -"`PATH` の調整など)。その他の初期化は、モジュールが実際にインポートされたとき" -"に行われます。コードのチャンクを1行に制限することは、より複雑なものをここに入" -"れないようにするための意図的な手段です。" +"ポート可能にすることです(サードパーティ製インポートフックのロー" +"ド、 :envvar:`PATH` の調整など)。その他の初期化は、モジュールが実際にインポー" +"トされたときに行われます。コードのチャンクを1行に制限することは、より複雑なも" +"のをここに入れないようにするための意図的な手段です。" #: ../../library/site.rst:94 msgid "" -"The :file:`.pth` files are now decoded by UTF-8 at first and then by the :" -"term:`locale encoding` if it fails." +"The :file:`.pth` files are now decoded by UTF-8 at first and then by " +"the :term:`locale encoding` if it fails." msgstr "" ":file:`.pth` ファイルは、最初に UTF-8 で、失敗した場合は :term:`locale " "encoding` でデコードされるようになります。" #: ../../library/site.rst:102 msgid "" -"For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set to :file:" -"`/usr/local`. The Python X.Y library is then installed in :file:`/usr/local/" -"lib/python{X.Y}`. Suppose this has a subdirectory :file:`/usr/local/lib/" -"python{X.Y}/site-packages` with three subsubdirectories, :file:`foo`, :file:" -"`bar` and :file:`spam`, and two path configuration files, :file:`foo.pth` " -"and :file:`bar.pth`. Assume :file:`foo.pth` contains the following::" +"For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set " +"to :file:`/usr/local`. The Python X.Y library is then installed in :file:`/" +"usr/local/lib/python{X.Y}`. Suppose this has a subdirectory :file:`/usr/" +"local/lib/python{X.Y}/site-packages` with three " +"subsubdirectories, :file:`foo`, :file:`bar` and :file:`spam`, and two path " +"configuration files, :file:`foo.pth` and :file:`bar.pth`. " +"Assume :file:`foo.pth` contains the following::" msgstr "" "例えば、 ``sys.prefix`` と ``sys.exec_prefix`` が :file:`/usr/local` に設定さ" "れていると仮定します。そのときPython X.Y ライブラリは :file:`/usr/local/lib/" "python{X.Y}` にインストールされています。ここにはサブディレクトリ :file:`/" "usr/local/lib/python{X.Y}/site-packages` があり、その中に三つのサブディレクト" -"リ :file:`foo`, :file:`bar` および :file:`spam` と二つのパス設定ファイル :" -"file:`foo.pth` と :file:`bar.pth` をもつと仮定します。 :file:`foo.pth` には以" -"下のものが記載されていると想定してください::" +"リ :file:`foo`, :file:`bar` および :file:`spam` と二つのパス設定ファイ" +"ル :file:`foo.pth` と :file:`bar.pth` をもつと仮定します。 :file:`foo.pth` に" +"は以下のものが記載されていると想定してください::" -#: ../../library/site.rst:110 msgid "" "# foo package configuration\n" "\n" @@ -178,44 +180,53 @@ 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 "" "Then the following version-specific directories are added to ``sys.path``, " "in this order::" msgstr "" -"が記載されているとします。そのとき、次のバージョンごとのディレクトリが ``sys." -"path`` へこの順番で追加されます::" +"が記載されているとします。そのとき、次のバージョンごとのディレクトリが " +"``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 "" -"Note that :file:`bletch` is omitted because it doesn't exist; the :file:" -"`bar` directory precedes the :file:`foo` directory because :file:`bar.pth` " -"comes alphabetically before :file:`foo.pth`; and :file:`spam` is omitted " -"because it is not mentioned in either path configuration file." +"Note that :file:`bletch` is omitted because it doesn't exist; " +"the :file:`bar` directory precedes the :file:`foo` directory " +"because :file:`bar.pth` comes alphabetically before :file:`foo.pth`; " +"and :file:`spam` is omitted because it is not mentioned in either path " +"configuration file." msgstr "" -":file:`bletch` は存在しないため省略されるということに注意してください。 :" -"file:`bar` ディレクトリは :file:`foo` ディレクトリの前に来ます。なぜなら、 :" -"file:`bar.pth` がアルファベット順で :file:`foo.pth` の前に来るからです。ま" -"た、 :file:`spam` はどちらのパス設定ファイルにも記載されていないため、省略さ" -"れます。" +":file:`bletch` は存在しないため省略されるということに注意してくださ" +"い。 :file:`bar` ディレクトリは :file:`foo` ディレクトリの前に来ます。なぜな" +"ら、 :file:`bar.pth` がアルファベット順で :file:`foo.pth` の前に来るからで" +"す。また、 :file:`spam` はどちらのパス設定ファイルにも記載されていないため、" +"省略されます。" #: ../../library/site.rst:134 msgid ":mod:`sitecustomize`" @@ -223,16 +234,16 @@ msgstr ":mod:`sitecustomize`" #: ../../library/site.rst:138 msgid "" -"After these path manipulations, an attempt is made to import a module named :" -"mod:`sitecustomize`, which can perform arbitrary site-specific " +"After these path manipulations, an attempt is made to import a module " +"named :mod:`sitecustomize`, which can perform arbitrary site-specific " "customizations. It is typically created by a system administrator in the " "site-packages directory. If this import fails with an :exc:`ImportError` or " "its subclass exception, and the exception's :attr:`~ImportError.name` " "attribute equals to ``'sitecustomize'``, it is silently ignored. If Python " "is started without output streams available, as with :file:`pythonw.exe` on " -"Windows (which is used by default to start IDLE), attempted output from :mod:" -"`sitecustomize` is ignored. Any other exception causes a silent and perhaps " -"mysterious failure of the process." +"Windows (which is used by default to start IDLE), attempted output " +"from :mod:`sitecustomize` is ignored. Any other exception causes a silent " +"and perhaps mysterious failure of the process." msgstr "" "これらのパス操作の後に、 :mod:`sitecustomize` という名前のモジュールをイン" "ポートしようします。そのモジュールは任意のサイト固有のカスタマイゼーションを" @@ -240,10 +251,10 @@ msgstr "" "レクトリに作成されます。 このインポートが :exc:`ImportError` またはそのサブク" "ラス例外で失敗し、例外の :attr:`~ImportError.name` 属性が " "``'sitecustomize'`` に等しい場合は、何も表示せずに無視されます。Pythonが出力" -"ストリームを利用できない状態で起動された場合、Windowsでは :file:`pythonw." -"exe` (IDLEを開始するとデフォルトで使われます) のような、 :mod:" -"`sitecustomize` から試みられた出力は無視されます。その他の例外は黙殺され、そ" -"してそれはおそらく不可思議な失敗にみえるでしょう。" +"ストリームを利用できない状態で起動された場合、Windowsで" +"は :file:`pythonw.exe` (IDLEを開始するとデフォルトで使われます) のよう" +"な、 :mod:`sitecustomize` から試みられた出力は無視されます。その他の例外は黙" +"殺され、そしてそれはおそらく不可思議な失敗にみえるでしょう。" #: ../../library/site.rst:150 msgid ":mod:`usercustomize`" @@ -251,32 +262,33 @@ msgstr ":mod:`usercustomize`" #: ../../library/site.rst:154 msgid "" -"After this, an attempt is made to import a module named :mod:" -"`usercustomize`, which can perform arbitrary user-specific customizations, " -"if :data:`~site.ENABLE_USER_SITE` is true. This file is intended to be " -"created in the user site-packages directory (see below), which is part of " -"``sys.path`` unless disabled by :option:`-s`. If this import fails with an :" -"exc:`ImportError` or its subclass exception, and the exception's :attr:" -"`~ImportError.name` attribute equals to ``'usercustomize'``, it is silently " -"ignored." +"After this, an attempt is made to import a module " +"named :mod:`usercustomize`, which can perform arbitrary user-specific " +"customizations, if :data:`~site.ENABLE_USER_SITE` is true. This file is " +"intended to be created in the user site-packages directory (see below), " +"which is part of ``sys.path`` unless disabled by :option:`-s`. If this " +"import fails with an :exc:`ImportError` or its subclass exception, and the " +"exception's :attr:`~ImportError.name` attribute equals to " +"``'usercustomize'``, it is silently ignored." msgstr "" "このあとで、 :data:`~site.ENABLE_USER_SITE` が真であれば、任意のユーザ固有の" "カスタマイズを行うことが出来る :mod:`usercustomize` と名付けられたモジュール" "のインポートが試みられます。このファイルはユーザの site-packages ディレクトリ" "(下記参照)に作られることを意図していて、その場所はオプション :option:`-s` に" -"よって無効にされない限りは ``sys.path`` に含まれます。このインポートが :exc:" -"`ImportError` またはそのサブクラス例外で失敗し、例外の :attr:`~ImportError." -"name` 属性が ``'usercustomize'`` と等しい場合、それは黙って無視されます。" +"よって無効にされない限りは ``sys.path`` に含まれます。このインポート" +"が :exc:`ImportError` またはそのサブクラス例外で失敗し、例外" +"の :attr:`~ImportError.name` 属性が ``'usercustomize'`` と等しい場合、それは" +"黙って無視されます。" #: ../../library/site.rst:162 msgid "" "Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` " -"are empty, and the path manipulations are skipped; however the import of :" -"mod:`sitecustomize` and :mod:`usercustomize` is still attempted." +"are empty, and the path manipulations are skipped; however the import " +"of :mod:`sitecustomize` and :mod:`usercustomize` is still attempted." msgstr "" "いくつかの非Unixシステムでは、 ``sys.prefix`` と ``sys.exec_prefix`` は空で、" -"パス操作は省略されます。しかし、 :mod:`sitecustomize` と :mod:" -"`usercustomize` のインポートはそのときでも試みられます。" +"パス操作は省略されます。しかし、 :mod:`sitecustomize` " +"と :mod:`usercustomize` のインポートはそのときでも試みられます。" #: ../../library/site.rst:171 msgid "Readline configuration" @@ -285,25 +297,25 @@ msgstr "readline の設定" #: ../../library/site.rst:173 msgid "" "On systems that support :mod:`readline`, this module will also import and " -"configure the :mod:`rlcompleter` module, if Python is started in :ref:" -"`interactive mode ` and without the :option:`-S` option. " -"The default behavior is enable tab-completion and to use :file:`~/." -"python_history` as the history save file. To disable it, delete (or " -"override) the :data:`sys.__interactivehook__` attribute in your :mod:" -"`sitecustomize` or :mod:`usercustomize` module or your :envvar:" -"`PYTHONSTARTUP` file." +"configure the :mod:`rlcompleter` module, if Python is started " +"in :ref:`interactive mode ` and without the :option:`-S` " +"option. The default behavior is enable tab-completion and to " +"use :file:`~/.python_history` as the history save file. To disable it, " +"delete (or override) the :data:`sys.__interactivehook__` attribute in " +"your :mod:`sitecustomize` or :mod:`usercustomize` module or " +"your :envvar:`PYTHONSTARTUP` file." msgstr "" ":mod:`readline` をサポートするシステムではこのモジュールは、Python を :ref:`" "対話モード ` で :option:`-S` オプションなしで開始した場合" "に :mod:`rlcompleter` モジュールをインポートして設定します。デフォルトの振る" "舞いでは、タブ補完を有効にし、履歴保存ファイルに :file:`~/.python_history` を" -"使います。これを無効にするには、あなたの :mod:`sitecustomize` または :mod:" -"`usercustomize` あるいは :envvar:`PYTHONSTARTUP` ファイル内で :data:`sys." -"__interactivehook__` 属性を削除 (または上書き) してください。 (---訳注: site " -"モジュールは :data:`~sys.__interactivehook__` に readline 設定関数を設定後" -"に :mod:`sitecustomize` 等のユーザ設定を実行します。 :data:`~sys." -"__interactivehook__` のチェックが行われるのは site モジュール実行の後です。 " -"---)" +"使います。これを無効にするには、あなたの :mod:`sitecustomize` また" +"は :mod:`usercustomize` あるいは :envvar:`PYTHONSTARTUP` ファイル内" +"で :data:`sys.__interactivehook__` 属性を削除 (または上書き) してください。 " +"(---訳注: site モジュールは :data:`~sys.__interactivehook__` に readline 設定" +"関数を設定後に :mod:`sitecustomize` 等のユーザ設定を実行しま" +"す。 :data:`~sys.__interactivehook__` のチェックが行われるのは site モジュー" +"ル実行の後です。 ---)" #: ../../library/site.rst:182 msgid "Activation of rlcompleter and history was made automatic." @@ -322,47 +334,57 @@ msgstr "siteパッケージディレクトリのprefixのリスト。" msgid "" "Flag showing the status of the user site-packages directory. ``True`` means " "that it is enabled and was added to ``sys.path``. ``False`` means that it " -"was disabled by user request (with :option:`-s` or :envvar:" -"`PYTHONNOUSERSITE`). ``None`` means it was disabled for security reasons " -"(mismatch between user or group id and effective id) or by an administrator." +"was disabled by user request (with :option:`-s` " +"or :envvar:`PYTHONNOUSERSITE`). ``None`` means it was disabled for security " +"reasons (mismatch between user or group id and effective id) or by an " +"administrator." msgstr "" "ユーザサイトディレクトリのステータスを示すフラグ。 ``True`` の場合、ユーザサ" "イトディレクトリが有効で ``sys.path`` に追加されていることを意味しています。 " -"``False`` の場合、ユーザによるリクエスト(オプション :option:`-s` か :envvar:" -"`PYTHONNOUSERSITE`)によって、 ``None`` の場合セキュリティ上の理由(ユーザまた" -"はグループ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:" -"`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-framework macOS " -"builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS " -"framework builds, and :file:`{%APPDATA%}\\\\Python\\\\Python{XY}\\\\site-" -"packages` on Windows. The optional \"t\" indicates the free-threaded " -"build. This directory is a site directory, which means that :file:`.pth` " -"files in it will be processed." -msgstr "" +"``False`` の場合、ユーザによるリクエスト(オプション :option:`-s` " +"か :envvar:`PYTHONNOUSERSITE`)によって、 ``None`` の場合セキュリティ上の理由" +"(ユーザまたはグループIDと実効IDの間のミスマッチ)あるいは管理者によって、ユー" +"ザサイトディレクトリが無効になっていることを示しています。" + +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:`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-" +"framework macOS builds, :file:`~/Library/Python/{X.Y}/lib/python/site-" +"packages` for macOS framework builds, and :file:`{%APPDATA%}\\\\Python\\" +"\\Python{XY}\\\\site-packages` on Windows. The optional \"t\" indicates the " +"free-threaded 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 "" -"Path to the base directory for the user site-packages. Can be ``None`` if :" -"func:`getuserbase` hasn't been called yet. Default value is :file:`~/." -"local` for UNIX and macOS non-framework builds, :file:`~/Library/Python/{X.Y}" -"` for macOS framework builds, and :file:`{%APPDATA%}\\\\Python` for " -"Windows. This value is used to compute the installation directories for " -"scripts, data files, Python modules, etc. for the :ref:`user installation " -"scheme `. See also :envvar:`PYTHONUSERBASE`." -msgstr "" -"ユーザの site-packages のベースとなるディレクトリへのパスです。 :func:" -"`getuserbase` がまだ呼び出されていなければ ``None`` かもしれません。デフォル" -"ト値は UNIX と frameworkなしの macOS ビルドでは :file:`~/.local` 、macOS " -"framework ビルドでは :file:`~/Library/Python/{X.Y}` 、Windows では :file:" -"`{%APPDATA%}\\\\Python` です。この値は、スクリプト、データファイル、Python モ" -"ジュールなどのインストール先のディレクトリを :ref:`ユーザーインストールスキー" -"ム ` で計算するのに使われます。 :envvar:" -"`PYTHONUSERBASE` も参照してください。" +"Path to the base directory for the user site-packages. Can be ``None`` " +"if :func:`getuserbase` hasn't been called yet. Default value " +"is :file:`~/.local` for UNIX and macOS non-framework builds, :file:`~/" +"Library/Python/{X.Y}` for macOS framework builds, and :file:`{%APPDATA%}\\" +"\\Python` for Windows. This value is used to compute the installation " +"directories for scripts, data files, Python modules, etc. for the :ref:`user " +"installation scheme `. See " +"also :envvar:`PYTHONUSERBASE`." +msgstr "" +"ユーザの site-packages のベースとなるディレクトリへのパスで" +"す。 :func:`getuserbase` がまだ呼び出されていなければ ``None`` かもしれませ" +"ん。デフォルト値は UNIX と frameworkなしの macOS ビルドで" +"は :file:`~/.local` 、macOS framework ビルドでは :file:`~/Library/Python/" +"{X.Y}` 、Windows では :file:`{%APPDATA%}\\\\Python` です。この値は、スクリプ" +"ト、データファイル、Python モジュールなどのインストール先のディレクトリ" +"を :ref:`ユーザーインストールスキーム ` で計算するのに" +"使われます。 :envvar:`PYTHONUSERBASE` も参照してください。" #: ../../library/site.rst:230 msgid "" @@ -393,18 +415,19 @@ msgstr "全てのグローバルな site-packages ディレクトリのリスト #: ../../library/site.rst:253 msgid "" "Return the path of the user base directory, :data:`USER_BASE`. If it is not " -"initialized yet, this function will also set it, respecting :envvar:" -"`PYTHONUSERBASE`." +"initialized yet, this function will also set it, " +"respecting :envvar:`PYTHONUSERBASE`." msgstr "" "ユーザのベースディレクトリへのパス :data:`USER_BASE` を返します。未初期化であ" "ればこの関数は :envvar:`PYTHONUSERBASE` を参考にして、設定もします。" #: ../../library/site.rst:262 msgid "" -"Return the path of the user-specific site-packages directory, :data:" -"`USER_SITE`. If it is not initialized yet, this function will also set it, " -"respecting :data:`USER_BASE`. To determine if the user-specific site-" -"packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` should be used." +"Return the path of the user-specific site-packages " +"directory, :data:`USER_SITE`. If it is not initialized yet, this function " +"will also set it, respecting :data:`USER_BASE`. To determine if the user-" +"specific site-packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` " +"should be used." msgstr "" "ユーザ固有の site パッケージのディレクトリへのパス :data:`USER_SITE` を返しま" "す。未初期化であればこの関数は :data:`USER_BASE` を参考にして、設定もしま" @@ -424,23 +447,24 @@ 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 "" -"If it is called without arguments, it will print the contents of :data:`sys." -"path` on the standard output, followed by the value of :data:`USER_BASE` and " -"whether the directory exists, then the same thing for :data:`USER_SITE`, and " -"finally the value of :data:`ENABLE_USER_SITE`." +"If it is called without arguments, it will print the contents " +"of :data:`sys.path` on the standard output, followed by the value " +"of :data:`USER_BASE` and whether the directory exists, then the same thing " +"for :data:`USER_SITE`, and finally the value of :data:`ENABLE_USER_SITE`." msgstr "" -"引数なしで呼び出された場合、:data:`sys.path` の中身を表示し、続けて :data:" -"`USER_BASE` とそのディレクトリが存在するかどうか、 :data:`USER_SITE` とその" -"ディレクトリが存在するかどうか、最後に :data:`ENABLE_USER_SITE` の値を、標準" -"出力に出力します。" +"引数なしで呼び出された場合、:data:`sys.path` の中身を表示し、続け" +"て :data:`USER_BASE` とそのディレクトリが存在するかどう" +"か、 :data:`USER_SITE` とそのディレクトリが存在するかどうか、最後" +"に :data:`ENABLE_USER_SITE` の値を、標準出力に出力します。" #: ../../library/site.rst:293 msgid "Print the path to the user base directory." diff --git a/library/smtpd.po b/library/smtpd.po index 9993eebf5..933a916e7 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`." +"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..5ff25120f 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,17 +48,16 @@ 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/smtplib.rst:26 msgid "" @@ -67,17 +66,18 @@ msgid "" "*host* and *port* parameters are given, the SMTP :meth:`connect` method is " "called with those parameters during initialization. If specified, " "*local_hostname* is used as the FQDN of the local host in the HELO/EHLO " -"command. Otherwise, the local hostname is found using :func:`socket." -"getfqdn`. If the :meth:`connect` call returns anything other than a success " -"code, an :exc:`SMTPConnectError` is raised. The optional *timeout* parameter " -"specifies a timeout in seconds for blocking operations like the connection " -"attempt (if not specified, the global default timeout setting will be " -"used). If the timeout expires, :exc:`TimeoutError` is raised. The optional " -"*source_address* parameter allows binding to some specific source address in " -"a machine with multiple network interfaces, and/or to some specific source " -"TCP port. It takes a 2-tuple ``(host, port)``, for the socket to bind to as " -"its source address before connecting. If omitted (or if *host* or *port* are " -"``''`` and/or ``0`` respectively) the OS default behavior will be used." +"command. Otherwise, the local hostname is found " +"using :func:`socket.getfqdn`. If the :meth:`connect` call returns anything " +"other than a success code, an :exc:`SMTPConnectError` is raised. The " +"optional *timeout* parameter specifies a timeout in seconds for blocking " +"operations like the connection attempt (if not specified, the global default " +"timeout setting will be used). If the timeout expires, :exc:`TimeoutError` " +"is raised. The optional *source_address* parameter allows binding to some " +"specific source address in a machine with multiple network interfaces, and/" +"or to some specific source TCP port. It takes a 2-tuple ``(host, port)``, " +"for the socket to bind to as its source address before connecting. If " +"omitted (or if *host* or *port* are ``''`` and/or ``0`` respectively) the OS " +"default behavior will be used." msgstr "" ":class:`SMTP` インスタンスはSMTP接続をカプセル化します。SMTPとESMTP操作の完全" "なレパートリーをサポートするメソッドがあります。オプションパラメータの " @@ -85,37 +85,37 @@ msgstr "" "初期化中にこれらのパラメータを使って呼び出されます。 *local_hostname* を指定" "した場合、それはHELO/EHLOコマンドのローカルホストのFQDNとして使用されます。指" "定しない場合、ローカルホスト名は :func:`socket.getfqdn` を使用して検索されま" -"す。 :meth:`connect` 呼び出しが成功コード以外を返すと、 :exc:" -"`SMTPConnectError` が送出されます。オプションの *timeout* パラメータは、接続" -"試行のようなブロッキング操作のタイムアウトを秒単位で指定します(指定されてい" -"ない場合、グローバルなデフォルトのタイムアウト設定が使用されます)。タイムア" -"ウトが切れると、 :exc:`TimeoutError` が送出されます。オプションの " -"*source_address* パラメータを使用すると、複数のネットワークインターフェースを" -"持つマシンの特定の送信元アドレス、かつ(または)特定の送信元TCPポートにバイン" -"ドできます。接続する前にソケットを送信元アドレスとしてバインドするためにタプ" -"ル ``(host, port)`` が必要です。省略された場合(あるいは、*host* または " +"す。 :meth:`connect` 呼び出しが成功コード以外を返す" +"と、 :exc:`SMTPConnectError` が送出されます。オプションの *timeout* パラメー" +"タは、接続試行のようなブロッキング操作のタイムアウトを秒単位で指定します(指" +"定されていない場合、グローバルなデフォルトのタイムアウト設定が使用されま" +"す)。タイムアウトが切れると、 :exc:`TimeoutError` が送出されます。オプション" +"の *source_address* パラメータを使用すると、複数のネットワークインターフェー" +"スを持つマシンの特定の送信元アドレス、かつ(または)特定の送信元TCPポートにバ" +"インドできます。接続する前にソケットを送信元アドレスとしてバインドするために" +"タプル ``(host, port)`` が必要です。省略された場合(あるいは、*host* または " "*port* がそれぞれ ``''`` かつ/または ``0`` の場合)、OSのデフォルト動作が使用" "されます。" #: ../../library/smtplib.rst:44 msgid "" -"For normal use, you should only require the initialization/connect, :meth:" -"`sendmail`, and :meth:`SMTP.quit` methods. An example is included below." +"For normal use, you should only require the initialization/" +"connect, :meth:`sendmail`, and :meth:`SMTP.quit` methods. An example is " +"included below." msgstr "" -"普通に使う場合は、初期化と接続を行ってから、 :meth:`sendmail` と :meth:`SMTP." -"quit` メソッドを呼びます。使用例は先の方で記載しています。" +"普通に使う場合は、初期化と接続を行ってから、 :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.::" +"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 +124,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." +"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." @@ -149,18 +153,18 @@ msgstr "SMTPUTF8 拡張 (:rfc:`6531`) がサポートされました。" #: ../../library/smtplib.rst:74 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." +"If the *timeout* parameter is set to be zero, it will raise " +"a :class:`ValueError` to prevent the creation of a non-blocking socket." msgstr "" "*timeout* パラメータが0に設定されている場合、非ブロッキングソケットの作成を防" "ぐために :class:`ValueError` を送出します。" #: ../../library/smtplib.rst:81 msgid "" -"An :class:`SMTP_SSL` instance behaves exactly the same as instances of :" -"class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is " -"required from the beginning of the connection and using :meth:`starttls` is " -"not appropriate. If *host* is not specified, the local host is used. If " +"An :class:`SMTP_SSL` instance behaves exactly the same as instances " +"of :class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL " +"is required from the beginning of the connection and using :meth:`starttls` " +"is not appropriate. If *host* is not specified, the local host is used. If " "*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional " "arguments *local_hostname*, *timeout* and *source_address* have the same " "meaning as they do in the :class:`SMTP` class. *context*, also optional, " @@ -168,36 +172,35 @@ msgid "" "aspects of the secure connection. Please read :ref:`ssl-security` for best " "practices." msgstr "" -":class:`SMTP_SSL` インスタンスは :class:`SMTP` と全く同じように動作します。:" -"class:`SMTP_SSL` は、接続の始めからSSLが必要であり、 :meth:`starttls` が適切" -"でない状況で使用するべきです。 *host* が指定されていない場合、ローカルホスト" -"が使用されます。 *port* が0の場合、標準のSMTP-over-SSLポート(465)が使用され" -"ます。オプション引数 *local_hostname*, *timeout*, *source_address* は :class:" -"`SMTP` クラスと同じ意味を持ちます。 *context* オプションは :class:`~ssl." -"SSLContext` を含むことができ、安全な接続のさまざまな側面を設定することができ" -"ます。ベストプラクティスについては :ref:`ssl-security` を読んでください。" +":class:`SMTP_SSL` インスタンスは :class:`SMTP` と全く同じように動作しま" +"す。:class:`SMTP_SSL` は、接続の始めからSSLが必要であり、 :meth:`starttls` が" +"適切でない状況で使用するべきです。 *host* が指定されていない場合、ローカルホ" +"ストが使用されます。 *port* が0の場合、標準のSMTP-over-SSLポート(465)が使用" +"されます。オプション引数 *local_hostname*, *timeout*, *source_address* " +"は :class:`SMTP` クラスと同じ意味を持ちます。 *context* オプション" +"は :class:`~ssl.SSLContext` を含むことができ、安全な接続のさまざまな側面を設" +"定することができます。ベストプラクティスについては :ref:`ssl-security` を読ん" +"でください。" #: ../../library/smtplib.rst:92 ../../library/smtplib.rst:415 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`)." +"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 "" -"If the *timeout* parameter is set to be zero, it will raise a :class:" -"`ValueError` to prevent the creation of a non-blocking socket" +"If the *timeout* parameter is set to be zero, it will raise " +"a :class:`ValueError` to prevent the creation of a non-blocking socket" msgstr "" "*timeout* パラメータが0に設定されている場合、非ブロッキングソケットの作成を防" "ぐために :class:`ValueError` を送出します。" @@ -209,22 +212,22 @@ msgstr "非推奨の *keyfile* と *certfile* 引数を削除しました。" #: ../../library/smtplib.rst:113 msgid "" "The LMTP protocol, which is very similar to ESMTP, is heavily based on the " -"standard SMTP client. It's common to use Unix sockets for LMTP, so our :meth:" -"`connect` method must support that as well as a regular host:port server. " -"The optional arguments *local_hostname* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. To specify a Unix socket, you " -"must use an absolute path for *host*, starting with a '/'." +"standard SMTP client. It's common to use Unix sockets for LMTP, so " +"our :meth:`connect` method must support that as well as a regular host:port " +"server. The optional arguments *local_hostname* and *source_address* have " +"the same meaning as they do in the :class:`SMTP` class. To specify a Unix " +"socket, you 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 +249,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 +268,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." +"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 +362,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 "" @@ -390,13 +388,12 @@ msgstr "" #: ../../library/smtplib.rst:239 msgid "" -"If the connection to the server is lost while waiting for the reply, :exc:" -"`SMTPServerDisconnected` will be raised." +"If the connection to the server is lost while waiting for the " +"reply, :exc:`SMTPServerDisconnected` will be raised." 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 +403,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 "" @@ -448,17 +447,17 @@ msgid "" "response for ESMTP option and store them for use by :meth:`has_extn`. Also " "sets several informational attributes: the message returned by the server is " "stored as the :attr:`ehlo_resp` attribute, :attr:`does_esmtp` is set to " -"``True`` or ``False`` depending on whether the server supports ESMTP, and :" -"attr:`esmtp_features` will be a dictionary containing the names of the SMTP " -"service extensions this server supports, and their parameters (if any)." +"``True`` or ``False`` depending on whether the server supports ESMTP, " +"and :attr:`esmtp_features` will be a dictionary containing the names of the " +"SMTP service extensions this server supports, and their parameters (if any)." msgstr "" "``EHLO`` を利用し、ESMTPサーバに身元を明かします。デフォルトではhostname引数" "はローカルホストのFQDNです。また、ESMTPオプションのために応答を調べたもの" "は、 :meth:`has_extn` に備えて保存されます。また、幾つかの情報を属性に保存し" -"ます: サーバーが返したメッセージは :attr:`ehlo_resp` 属性に、 :attr:" -"`does_esmtp` 属性はサーバーがESMTPをサポートしているかどうかによって " -"``True`` か ``False`` に、 :attr:`esmtp_features` 属性は辞書で、サーバーが対" -"応しているSMTP サービス拡張の名前と、もしあればそのパラメータを格納します。" +"ます: サーバーが返したメッセージは :attr:`ehlo_resp` 属性" +"に、 :attr:`does_esmtp` 属性はサーバーがESMTPをサポートしているかどうかによっ" +"て ``True`` か ``False`` に、 :attr:`esmtp_features` 属性は辞書で、サーバーが" +"対応しているSMTP サービス拡張の名前と、もしあればそのパラメータを格納します。" #: ../../library/smtplib.rst:279 msgid "" @@ -509,13 +508,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 +520,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 +579,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 +613,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,15 +631,25 @@ 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." -"auth_plain``, and ``SMTP.auth_login`` respectively. They all require that " -"the ``user`` and ``password`` properties of the ``SMTP`` instance are set to " -"appropriate values." +"and ``LOGIN`` mechanisms; they are named ``SMTP.auth_cram_md5``, " +"``SMTP.auth_plain``, and ``SMTP.auth_login`` respectively. They all require " +"that 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,19 +660,19 @@ 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 "" -"If *keyfile* and *certfile* are provided, they are used to create an :class:" -"`ssl.SSLContext`." +"If *keyfile* and *certfile* are provided, they are used to create " +"an :class:`ssl.SSLContext`." msgstr "" #: ../../library/smtplib.rst:396 @@ -685,15 +704,18 @@ msgstr "実行中の Python インタプリタで、SSL/TLS サポートが利 #: ../../library/smtplib.rst:418 msgid "" -"The method now supports hostname check with :attr:`SSLContext." -"check_hostname` and *Server Name Indicator* (see :const:`~ssl.HAS_SNI`)." +"The method now supports hostname check " +"with :attr:`SSLContext.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`." +"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 "" @@ -707,33 +729,36 @@ msgid "" "level methods such as :meth:`mail`, :meth:`rcpt` and :meth:`data` to send " "the message.)" msgstr "" -"メールを送信します。必要な引数は :rfc:`822` のfromアドレス文字列、 :rfc:" -"`822` のtoアドレス文字列またはアドレス文字列のリスト、メッセージ文字列です。" -"送信側は ``MAIL FROM`` コマンドで使用される *mail_options* の ESMTPオプション" -"(``8bitmime`` のような)のリストを得るかもしれません。全ての ``RCPT`` コマンド" -"で使われるべきESMTPオプション (例えば ``DSN`` コマンド)は、 *rcpt_options* を" -"通して利用することができます。(もし送信先別にESMTPオプションを使う必要があれ" -"ば、メッセージを送るために :meth:`mail` 、 :meth:`rcpt` 、 :meth:`data` と" -"いった下位レベルのメソッドを使う必要があります。)" +"メールを送信します。必要な引数は :rfc:`822` のfromアドレス文字" +"列、 :rfc:`822` のtoアドレス文字列またはアドレス文字列のリスト、メッセージ文" +"字列です。送信側は ``MAIL FROM`` コマンドで使用される *mail_options* の ESMTP" +"オプション(``8bitmime`` のような)のリストを得るかもしれません。全ての " +"``RCPT`` コマンドで使われるべきESMTPオプション (例えば ``DSN`` コマンド)は、 " +"*rcpt_options* を通して利用することができます。(もし送信先別にESMTPオプション" +"を使う必要があれば、メッセージを送るため" +"に :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 +766,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 +780,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 +842,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,42 +861,58 @@ 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 " "specified in :rfc:`5322`\\: *from_addr* is set to the :mailheader:`Sender` " "field if it is present, and otherwise to the :mailheader:`From` field. " -"*to_addrs* combines the values (if any) of the :mailheader:`To`, :mailheader:" -"`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one set of :" -"mailheader:`Resent-*` headers appear in the message, the regular headers are " -"ignored and the :mailheader:`Resent-*` headers are used instead. If the " -"message contains more than one set of :mailheader:`Resent-*` headers, a :exc:" -"`ValueError` is raised, since there is no way to unambiguously detect the " -"most recent set of :mailheader:`Resent-` headers." -msgstr "" +"*to_addrs* combines the values (if any) of " +"the :mailheader:`To`, :mailheader:`Cc`, and :mailheader:`Bcc` fields from " +"*msg*. If exactly one set of :mailheader:`Resent-*` headers appear in the " +"message, the regular headers are ignored and the :mailheader:`Resent-*` " +"headers are used instead. If the message contains more than one set " +"of :mailheader:`Resent-*` headers, a :exc:`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 "" -"``send_message`` serializes *msg* using :class:`~email.generator." -"BytesGenerator` with ``\\r\\n`` as the *linesep*, and calls :meth:`sendmail` " -"to transmit the resulting message. Regardless of the values of *from_addr* " -"and *to_addrs*, ``send_message`` does not transmit any :mailheader:`Bcc` or :" -"mailheader:`Resent-Bcc` headers that may appear in *msg*. If any of the " -"addresses in *from_addr* and *to_addrs* contain non-ASCII characters and the " -"server does not advertise ``SMTPUTF8`` support, an :exc:" -"`SMTPNotSupportedError` is raised. Otherwise the ``Message`` is serialized " -"with a clone of its :mod:`~email.policy` with the :attr:`~email.policy." -"EmailPolicy.utf8` attribute set to ``True``, and ``SMTPUTF8`` and " -"``BODY=8BITMIME`` are added to *mail_options*." +"``send_message`` serializes *msg* " +"using :class:`~email.generator.BytesGenerator` with ``\\r\\n`` as the " +"*linesep*, and calls :meth:`sendmail` to transmit the resulting message. " +"Regardless of the values of *from_addr* and *to_addrs*, ``send_message`` " +"does not transmit any :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers " +"that may appear in *msg*. If any of the addresses in *from_addr* and " +"*to_addrs* contain non-ASCII characters and the server does not advertise " +"``SMTPUTF8`` support, an :exc:`SMTPNotSupportedError` is raised. Otherwise " +"the ``Message`` is serialized with a clone of its :mod:`~email.policy` with " +"the :attr:`~email.policy.EmailPolicy.utf8` attribute set to ``True``, and " +"``SMTPUTF8`` and ``BODY=8BITMIME`` are added to *mail_options*." msgstr "" #: ../../library/smtplib.rst:534 @@ -911,7 +953,6 @@ msgid "" "headers explicitly::" msgstr "" -#: ../../library/smtplib.rst:561 msgid "" "import smtplib\n" "\n" @@ -940,25 +981,49 @@ 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 "" "In general, you will want to use the :mod:`email` package's features to " -"construct an email message, which you can then send via :meth:`~smtplib.SMTP." -"send_message`; see :ref:`email-examples`." +"construct an email message, which you can then send " +"via :meth:`~smtplib.SMTP.send_message`; see :ref:`email-examples`." msgstr "" "多くの場合、 :mod:`email` パッケージの機能を使って email メッセージを構築し、" "それを、 :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..f801dad55 100644 --- a/library/sndhdr.po +++ b/library/sndhdr.po @@ -12,32 +12,38 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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." +"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..ae060e1d8 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,48 +52,16 @@ 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/socket.rst:24 msgid "" @@ -101,17 +69,17 @@ msgid "" "call and library interface for sockets to Python's object-oriented style: " "the :func:`~socket.socket` function returns a :dfn:`socket object` whose " "methods implement the various socket system calls. Parameter types are " -"somewhat higher-level than in the C interface: as with :meth:`read` and :" -"meth:`write` operations on Python files, buffer allocation on receive " +"somewhat higher-level than in the C interface: as with :meth:`read` " +"and :meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" "Pythonインターフェースは、Unixのソケット用システムコールとライブラリインター" "フェースを、そのままPythonのオブジェクト指向スタイルに変換したものです。各種" -"ソケット関連のシステムコールは、 :func:`~socket.socket` 関数で生成される :" -"dfn:`socket オブジェクト` のメソッドとして実装されています。 メソッドの引数" -"は C のインターフェイスよりも多少高水準で、例えばファイルに対する :meth:" -"`read` や :meth:`write` メソッドと同様に、 受信時のバッファ確保は自動的に処理" -"され、送信時のバッファ長は暗黙的に決まります。" +"ソケット関連のシステムコールは、 :func:`~socket.socket` 関数で生成され" +"る :dfn:`socket オブジェクト` のメソッドとして実装されています。 メソッドの引" +"数は C のインターフェイスよりも多少高水準で、例えばファイルに対す" +"る :meth:`read` や :meth:`write` メソッドと同様に、 受信時のバッファ確保は自" +"動的に処理され、送信時のバッファ長は暗黙的に決まります。" #: ../../library/socket.rst:35 msgid "Module :mod:`socketserver`" @@ -184,26 +152,26 @@ 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 "" "For IPv4 addresses, two special forms are accepted instead of a host " "address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all " -"interfaces, and the string ``''`` represents :const:" -"`INADDR_BROADCAST`. This behavior is not compatible with IPv6, therefore, " -"you may want to avoid these if you intend to support IPv6 with your Python " -"programs." +"interfaces, and the string ``''`` " +"represents :const:`INADDR_BROADCAST`. This behavior is not compatible with " +"IPv6, therefore, you may want to avoid these if you intend to support IPv6 " +"with your Python programs." msgstr "" "IPv4ではホストアドレスのほかに2つの特別な形式が使用できます。``''`` はすべて" "のインターフェイスにバインドされるために使われる :const:`INADDR_ANY` を表し、" @@ -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)``." @@ -261,16 +231,18 @@ msgid "" "*addr_type* is one of :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, " "or :const:`TIPC_ADDR_ID`." msgstr "" -"*addr_type* は :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, :const:" -"`TIPC_ADDR_ID` の1つ。" +"*addr_type* " +"は :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, :const:`TIPC_ADDR_ID` " +"の1つ。" #: ../../library/socket.rst:105 msgid "" "*scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`, " "and :const:`TIPC_NODE_SCOPE`." msgstr "" -"*scope* は :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`, :const:" -"`TIPC_NODE_SCOPE` の1つ。" +"*scope* " +"は :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`, :const:`TIPC_NODE_SCOPE` " +"の1つ。" #: ../../library/socket.rst:107 msgid "" @@ -280,14 +252,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 "" @@ -332,11 +302,11 @@ msgid "" "and unit number of the kernel control are known or if a registered ID is " "used." msgstr "" -"文字列またはタプル ``(id, unit)`` は :const:`PF_SYSTEM` ファミリーの :const:" -"`SYSPROTO_CONTROL` プロトコルのために使用されます。この文字列は、動的に割り当" -"てられたIDによるカーネルコントロールの名前です。このタプルは、カーネルコント" -"ロールのIDとユニット番号が既知の場合、または登録済みIDが使用中の場合に使用す" -"ることができます。" +"文字列またはタプル ``(id, unit)`` は :const:`PF_SYSTEM` ファミリー" +"の :const:`SYSPROTO_CONTROL` プロトコルのために使用されます。この文字列は、動" +"的に割り当てられたIDによるカーネルコントロールの名前です。このタプルは、カー" +"ネルコントロールのIDとユニット番号が既知の場合、または登録済みIDが使用中の場" +"合に使用することができます。" #: ../../library/socket.rst:137 msgid "" @@ -345,36 +315,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`." +"``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 +355,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)." +"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 +433,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 +533,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 "" @@ -629,8 +626,8 @@ msgstr "" #: ../../library/socket.rst:297 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " -"generalization of this based on timeouts is supported through :meth:`~socket." -"settimeout`." +"generalization of this based on timeouts is supported " +"through :meth:`~socket.settimeout`." msgstr "" ":meth:`~socket.setblocking` メソッドで、非ブロッキングモードを使用することが" "できます。また、より汎用的に :meth:`~socket.settimeout` メソッドでタイムアウ" @@ -660,14 +657,15 @@ msgstr "" #: ../../library/socket.rst:321 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " -"errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" -"func:`gethostbyname_ex` and :func:`gethostbyaddr`. The accompanying value is " -"a pair ``(h_errno, string)`` representing an error returned by a library " -"call. *h_errno* is a numeric value, while *string* represents the " -"description of *h_errno*, as returned by the :c:func:`hstrerror` C function." -msgstr "" -":exc:`OSError` のサブクラス。この例外はアドレス関連のエラー、つまり :func:" -"`gethostbyname_ex` と :func:`gethostbyaddr` などの、 POSIX C API の " +"errors, i.e. for functions that use *h_errno* in the POSIX C API, " +"including :func:`gethostbyname_ex` and :func:`gethostbyaddr`. The " +"accompanying value is a pair ``(h_errno, string)`` representing an error " +"returned by a library call. *h_errno* is a numeric value, while *string* " +"represents the description of *h_errno*, as returned by " +"the :c:func:`hstrerror` C function." +msgstr "" +":exc:`OSError` のサブクラス。この例外はアドレス関連のエラー、つま" +"り :func:`gethostbyname_ex` と :func:`gethostbyaddr` などの、 POSIX C API の " "*h_errno* を利用する関数のために利用されます。例外に付随する ``(h_errno, " "string)`` ペアはライブラリの呼び出しによって返されたエラーを表します。 " "*h_errno* は数値で、 *string* は、 :c:func:`hstrerror` C関数によって返される " @@ -678,7 +676,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 +684,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`." @@ -695,16 +699,16 @@ msgstr ":exc:`TimeoutError` の非推奨のエイリアスです。" #: ../../library/socket.rst:349 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " -"on a socket which has had timeouts enabled via a prior call to :meth:" -"`~socket.settimeout` (or implicitly through :func:`~socket." -"setdefaulttimeout`). The accompanying value is a string whose value is " -"currently always \"timed out\"." +"on a socket which has had timeouts enabled via a prior call " +"to :meth:`~socket.settimeout` (or implicitly " +"through :func:`~socket.setdefaulttimeout`). The accompanying value is a " +"string whose value is currently always \"timed out\"." msgstr "" -":exc:`OSError` のサブクラスです。この例外は、あらかじめ :meth:`~socket." -"settimeout` を呼び出して (あるいは :func:`~socket.setdefaulttimeout` を利用し" -"て暗黙に) タイムアウトを有効にしてあるソケットでタイムアウトが生じた際に送出" -"されます。 例外に付属する値は文字列で、その内容は現状では常に \"timed out\" " -"となります。" +":exc:`OSError` のサブクラスです。この例外は、あらかじ" +"め :meth:`~socket.settimeout` を呼び出して (あるい" +"は :func:`~socket.setdefaulttimeout` を利用して暗黙に) タイムアウトを有効にし" +"てあるソケットでタイムアウトが生じた際に送出されます。 例外に付属する値は文字" +"列で、その内容は現状では常に \"timed out\" となります。" #: ../../library/socket.rst:358 msgid "This class was made an alias of :exc:`TimeoutError`." @@ -716,34 +720,43 @@ msgstr "定数" #: ../../library/socket.rst:365 msgid "" -"The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" -"`SocketKind` :class:`.IntEnum` collections." +"The AF_* and SOCK_* constants are now :class:`AddressFamily` " +"and :class:`SocketKind` :class:`.IntEnum` collections." msgstr "" -"AF_* 定数と SOCK_* 定数は、 :class:`AddressFamily` と :class:`SocketKind` :" -"class:`.IntEnum` collection になりました。" +"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 " +"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 "" @@ -757,21 +770,26 @@ msgstr "" #: ../../library/socket.rst:405 msgid "" -"`Secure File Descriptor Handling `_ for a more thorough explanation." +"`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -"より完全な説明は `Secure File Descriptor Handling `_ を参照してください。" +"より完全な説明は `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 " -"are generally used in arguments to the :meth:`~socket.setsockopt` and :meth:" -"`~socket.getsockopt` methods of socket objects. In most cases, only those " -"symbols that are defined in the Unix header files are defined; for a few " -"symbols, default values are provided." -msgstr "" +"are generally used in arguments to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of socket objects. In most cases, " +"only those 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 +799,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 +846,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 +894,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 +907,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,48 +927,54 @@ 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 "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -"Windows の WSAIoctl() のための定数です。この定数はソケットオブジェクトの :" -"meth:`~socket.socket.ioctl` メソッドに引数として渡されます。" +"Windows の WSAIoctl() のための定数です。この定数はソケットオブジェクト" +"の :meth:`~socket.socket.ioctl` メソッドに引数として渡されます。" #: ../../library/socket.rst:615 ../../library/socket.rst:1723 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." @@ -948,9 +992,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 +1001,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 "" @@ -968,72 +1010,83 @@ msgid "" "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -"これらは、特別な意味を持つ Bluetooth アドレスを含む文字列定数です。例えば、:" -"const:`BDADDR_ANY` を使用すると、 :const:`BTPROTO_RFCOMM` で束縛ソケットを指" -"定する際に、任意のアドレスを指し示すことができます。" +"これらは、特別な意味を持つ Bluetooth アドレスを含む文字列定数です。例え" +"ば、: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." +"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 +1094,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`." +"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" @@ -1085,23 +1144,23 @@ msgstr "以下の関数は全て :ref:`socket object ` を生成 #: ../../library/socket.rst:841 msgid "" "Create a new socket using the given address family, socket type and protocol " -"number. The address family should be :const:`AF_INET` (the default), :const:" -"`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, or :const:" -"`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the default), :" -"const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_`` " -"constants. The protocol number is usually zero and may be omitted or in the " -"case where the address family is :const:`AF_CAN` the protocol should be one " -"of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` or :const:" -"`CAN_J1939`." +"number. The address family should be :const:`AF_INET` (the " +"default), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, " +"or :const:`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the " +"default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other " +"``SOCK_`` constants. The protocol number is usually zero and may be omitted " +"or in the case where the address family is :const:`AF_CAN` the protocol " +"should be one of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` " +"or :const:`CAN_J1939`." msgstr "" "アドレスファミリー、ソケットタイプ、プロトコル番号を指定してソケットを作成し" -"ます。アドレスファミリーには :const:`AF_INET` (デフォルト値), :const:" -"`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, :const:" -"`AF_RDS` を指定することができます。ソケットタイプには :const:`SOCK_STREAM` " -"(デフォルト値), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` または他の ``SOCK_`` " -"定数の何れかを指定します。プロトコル番号は通常省略するか、または0を指定します" -"が、アドレスファミリーに :const:`AF_CAN` を指定した場合は、プロトコル番号に" -"は const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP`, :const:`CAN_J1939` " +"ます。アドレスファミリーには :const:`AF_INET` (デフォルト" +"値), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, :const:`AF_RDS` " +"を指定することができます。ソケットタイプには :const:`SOCK_STREAM` (デフォルト" +"値), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` または他の ``SOCK_`` 定数の何れか" +"を指定します。プロトコル番号は通常省略するか、または0を指定しますが、アドレス" +"ファミリーに :const:`AF_CAN` を指定した場合は、プロトコル番号に" +"は :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP`, :const:`CAN_J1939` " "のいずれかを指定すべきです。" #: ../../library/socket.rst:851 @@ -1110,9 +1169,9 @@ msgid "" "auto-detected from the specified file descriptor. Auto-detection can be " "overruled by calling the function with explicit *family*, *type*, or *proto* " "arguments. This only affects how Python represents e.g. the return value " -"of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:" -"`socket.fromfd`, *fileno* will return the same socket and not a duplicate. " -"This may help close a detached socket using :meth:`socket.close`." +"of :meth:`socket.getpeername` but not the actual OS resource. " +"Unlike :func:`socket.fromfd`, *fileno* will return the same socket and not a " +"duplicate. This may help close a detached socket using :meth:`socket.close`." msgstr "" #: ../../library/socket.rst:860 ../../library/socket.rst:1006 @@ -1144,25 +1203,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." @@ -1213,10 +1278,10 @@ msgid "" msgstr "" "インターネット *address* (``(host, port)`` ペア) で listen しているTCPサービ" "スに接続し、ソケットオブジェクトを返します。これは :meth:`socket.connect` を" -"高級にした関数です。 *host* が数値でないホスト名の場合、 :data:`AF_INET` と :" -"data:`AF_INET6` の両方で名前解決を試み、得られた全てのアドレスに対して成功す" -"るまで接続を試みます。この関数を使って IPv4 と IPv6 に両対応したクライアント" -"を簡単に書くことができます。" +"高級にした関数です。 *host* が数値でないホスト名の場合、 :data:`AF_INET` " +"と :data:`AF_INET6` の両方で名前解決を試み、得られた全てのアドレスに対して成" +"功するまで接続を試みます。この関数を使って IPv4 と IPv6 に両対応したクライア" +"ントを簡単に書くことができます。" #: ../../library/socket.rst:929 msgid "" @@ -1225,8 +1290,9 @@ msgid "" "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" "オプションの *timeout* 引数を指定すると、接続を試みる前にソケットオブジェクト" -"のタイムアウトを設定します。 *timeout* が指定されない場合、 :func:" -"`getdefaulttimeout` が返すデフォルトのタイムアウト設定値を利用します。" +"のタイムアウトを設定します。 *timeout* が指定されない場" +"合、 :func:`getdefaulttimeout` が返すデフォルトのタイムアウト設定値を利用しま" +"す。" #: ../../library/socket.rst:934 msgid "" @@ -1238,13 +1304,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 +1323,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." +"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 +1353,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,30 +1375,41 @@ 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 "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " -"the result. Address family, socket type and protocol number are as for the :" -"func:`~socket.socket` function above. The file descriptor should refer to a " -"socket, but this is not checked --- subsequent operations on the object may " -"fail if the file descriptor is invalid. This function is rarely needed, but " -"can be used to get or set socket options on a socket passed to a program as " -"standard input or output (such as a server started by the Unix inet " +"the result. Address family, socket type and protocol number are as for " +"the :func:`~socket.socket` function above. The file descriptor should refer " +"to a socket, but this is not checked --- subsequent operations on the object " +"may fail if the file descriptor is invalid. This function is rarely needed, " +"but can be used to get or set socket options on a socket passed to a program " +"as standard input or output (such as a server started by the Unix inet " "daemon). The socket is assumed to be in blocking mode." msgstr "" @@ -1350,12 +1444,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 +1458,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." +"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:" @@ -1398,15 +1500,15 @@ msgstr "``(family, type, proto, canonname, sockaddr)``" msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " -"string representing the canonical name of the *host* if :const:" -"`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be " -"empty. *sockaddr* is a tuple describing a socket address, whose format " -"depends on the returned *family* (a ``(address, port)`` 2-tuple for :const:" -"`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:" -"`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." +"string representing the canonical name of the *host* " +"if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* " +"will be empty. *sockaddr* is a tuple describing a socket address, whose " +"format depends on the returned *family* (a ``(address, port)`` 2-tuple " +"for :const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple " +"for :const:`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 +1516,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 +1537,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 +1562,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 +1578,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 +1604,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 "" @@ -1496,21 +1624,19 @@ msgid "" "stack support." msgstr "" "ホスト名を ``'100.50.200.5'`` のようなIPv4形式のアドレスに変換します。ホスト" -"名としてIPv4アドレスを指定した場合、その値は変換せずにそのまま返ります。 :" -"func:`gethostbyname` APIへのより完全なインターフェイスが必要であれば、 :func:" -"`gethostbyname_ex` を参照してください。 :func:`gethostbyname` は、IPv6名前解" -"決をサポートしていません。IPv4/ v6のデュアルスタックをサポートする場合は :" -"func:`getaddrinfo` を使用します。" +"名としてIPv4アドレスを指定した場合、その値は変換せずにそのまま返りま" +"す。 :func:`gethostbyname` APIへのより完全なインターフェイスが必要であれ" +"ば、 :func:`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`` を送出します。 " +"引数 ``hostname`` を指定して :ref:`監査イベント ` " +"``socket.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 +1647,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 +1665,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,60 +1680,76 @@ 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 " "(possibly empty) list of alternative host names for the same address, and " "*ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the " "same host (most likely containing only a single address). To find the fully " -"qualified domain name, use the function :func:`getfqdn`. :func:" -"`gethostbyaddr` supports both IPv4 and IPv6." +"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`` を送出します。 " +"引数 ``ip_address`` を指定して :ref:`監査イベント ` " +"``socket.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`` を送出します。 " +"引数 ``sockaddr`` を指定して :ref:`監査イベント ` " +"``socket.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." -"socket` function. This is usually only needed for sockets opened in \"raw\" " -"mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol " -"is chosen automatically if the protocol is omitted or zero." -msgstr "" +"suitable for passing as the (optional) third argument to " +"the :func:`~socket.socket` function. This is usually only needed for " +"sockets opened in \"raw\" 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 +1761,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 +1778,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 +1807,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 +1848,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`." +"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 +1873,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 +1882,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 "" @@ -1754,8 +1903,8 @@ msgstr "" msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " -"protocol calls for an object of type :c:struct:`in_addr` (similar to :func:" -"`inet_aton`) or :c:struct:`in6_addr`." +"protocol calls for an object of type :c:struct:`in_addr` (similar " +"to :func:`inet_aton`) or :c:struct:`in6_addr`." msgstr "" "IPアドレスを、アドレスファミリ固有の文字列からパックしたバイナリ形式に変換し" "ます。 :func:`inet_pton` は、 :c:struct:`in_addr` 型 (:func:`inet_aton` と同" @@ -1764,16 +1913,16 @@ msgstr "" #: ../../library/socket.rst:1319 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on both " -"the value of *address_family* and the underlying implementation of :c:func:" -"`inet_pton`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the IP address string *ip_string* is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on both the value of *address_family* and the underlying " +"implementation of :c:func:`inet_pton`." msgstr "" -"現在サポートされている *address_family* は、 :const:`AF_INET` と :const:" -"`AF_INET6` です。 *ip_string* に不正なIPアドレス文字列を指定すると、 :exc:" -"`OSError` が発生します。有効な *ip_string* は、 *address_family* と :c:func:" -"`inet_pton` の実装によって異なります。" +"現在サポートされている *address_family* は、 :const:`AF_INET` " +"と :const:`AF_INET6` です。 *ip_string* に不正なIPアドレス文字列を指定する" +"と、 :exc:`OSError` が発生します。有効な *ip_string* は、 *address_family* " +"と :c:func:`inet_pton` の実装によって異なります。" #: ../../library/socket.rst:1327 ../../library/socket.rst:1347 msgid "Windows support added" @@ -1789,47 +1938,46 @@ msgid "" msgstr "" "パックしたIPアドレス (数バイトからなる :term:`bytes-like オブジェクト ` ) を、 ``'7.10.0.5'`` や ``'5aef:2b::8'`` などの標準的な、アド" -"レスファミリ固有の文字列形式に変換します。 :func:`inet_ntop` は (:func:" -"`inet_ntoa` と同様に)、 :c:struct:`in_addr` 型や :c:struct:`in6_addr` 型のオ" -"ブジェクトを返すライブラリやネットワークプロトコル等で使用することができま" -"す。" +"レスファミリ固有の文字列形式に変換します。 :func:`inet_ntop` は " +"(:func:`inet_ntoa` と同様に)、 :c:struct:`in_addr` 型や :c:struct:`in6_addr` " +"型のオブジェクトを返すライブラリやネットワークプロトコル等で使用することがで" +"きます。" #: ../../library/socket.rst:1340 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " -"for the specified address family, :exc:`ValueError` will be raised. :exc:" -"`OSError` is raised for errors from the call to :func:`inet_ntop`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct " +"length for the specified address family, :exc:`ValueError` will be " +"raised. :exc:`OSError` is raised for errors from the call " +"to :func:`inet_ntop`." msgstr "" -"現在サポートされている *address_family* の値は、 :const:`AF_INET` と :const:" -"`AF_INET6` です。バイトオブジェクトの *packed_ip* の長さが、指定したアドレス" -"ファミリで適切な長さでない場合、 :exc:`ValueError` が発生します。 :func:" -"`inet_ntop` の呼び出しでエラーが起こると、 :exc:`OSError` が発生します。" +"現在サポートされている *address_family* の値は、 :const:`AF_INET` " +"と :const:`AF_INET6` です。バイトオブジェクトの *packed_ip* の長さが、指定し" +"たアドレスファミリで適切な長さでない場合、 :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 " "the buffer size for :meth:`~socket.recvmsg` to receive a single item of " -"ancillary data, but :rfc:`3542` requires portable applications to use :func:" -"`CMSG_SPACE` and thus include space for padding, even when the item will be " -"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` 例外が送出されます。" - -#: ../../library/socket.rst:1373 ../../library/socket.rst:1861 -#: ../../library/socket.rst:1905 ../../library/socket.rst:2013 +"ancillary data, but :rfc:`3542` requires portable applications to " +"use :func:`CMSG_SPACE` and thus include space for padding, even when the " +"item will be the last in the buffer. Raises :exc:`OverflowError` if " +"*length* is outside the permissible range of values." +msgstr "" +"長さ *length* のデータを伴う制御メッセージ (補助データ) 1 件について、末尾の" +"パディングを除いた全体の長さを返します。\n" +"この値は、:meth:`~socket.recvmsg` で制御メッセージを 1 件受信するためのバッ" +"ファサイズとして使える場合が多くあります。\n" +"ただし :rfc:`3542` では、移植可能なアプリケーションは :func:`CMSG_SPACE` を使" +"い、バッファの最後のメッセージであってもパディング用の領域を含める必要がある" +"と定めています。\n" +"*length* が許容範囲外の場合は :exc:`OverflowError` を送出します。" + 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 +1986,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 "" @@ -1873,36 +2020,37 @@ msgstr "" #: ../../library/socket.rst:1410 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " -"socket module is first imported, the default is ``None``. See :meth:" -"`~socket.settimeout` for possible values and their respective meanings." +"socket module is first imported, the default is ``None``. " +"See :meth:`~socket.settimeout` for possible values and their respective " +"meanings." msgstr "" "新規に生成されるソケットオブジェクトの、デフォルトのタイムアウト値を秒数 " "(float 型) で設定します。最初に socket モジュールがインポートされた時の初期値" -"は ``None`` です。指定可能な値とその意味については :meth:`~socket." -"settimeout` メソッドを参照してください。" +"は ``None`` です。指定可能な値とその意味について" +"は :meth:`~socket.settimeout` メソッドを参照してください。" #: ../../library/socket.rst:1418 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -"マシンのホスト名を *name* に設定します。必要な権限がない場合は :exc:" -"`OSError` を送出します。" +"マシンのホスト名を *name* に設定します。必要な権限がない場合" +"は :exc:`OSError` を送出します。" #: ../../library/socket.rst:1421 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." msgstr "" -"引数 ``name`` を指定して :ref:`監査イベント ` ``socket." -"sethostname`` を送出します。" +"引数 ``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,75 +2058,80 @@ 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 "" -"Return a network interface index number corresponding to an interface name. :" -"exc:`OSError` if no interface with the given name exists." +"Return a network interface index number corresponding to an interface " +"name. :exc:`OSError` if no interface with the given name exists." msgstr "" "インターフェース名 *if_name* に対応するネットワークインターフェースのインデッ" -"クス番号を返します。対応するインターフェースが存在しない場合は :exc:" -"`OSError` 例外を送出します。" +"クス番号を返します。対応するインターフェースが存在しない場合" +"は :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 "" -"Return a network interface name corresponding to an interface index number. :" -"exc:`OSError` if no interface with the given index exists." +"Return a network interface name corresponding to an interface index " +"number. :exc:`OSError` if no interface with the given index exists." msgstr "" "インターフェースインデックス番号 *if_index* に対応するネットワークインター" -"フェース名を返します。対応するインターフェースが存在しない場合は :exc:" -"`OSError` 例外を送出します。" +"フェース名を返します。対応するインターフェースが存在しない場合" +"は :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." +"*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." +"*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." @@ -1990,8 +2143,9 @@ msgstr "socket オブジェクト" #: ../../library/socket.rst:1526 msgid "" -"Socket objects have the following methods. Except for :meth:`~socket." -"makefile`, these correspond to Unix system calls applicable to sockets." +"Socket objects have the following methods. Except " +"for :meth:`~socket.makefile`, these correspond to Unix system calls " +"applicable to sockets." msgstr "" "ソケットオブジェクトは以下のメソッドを持ちます。 :meth:`~socket.makefile` 以" "外のメソッドは、Unixのソケット用システムコールに対応しています。" @@ -2019,7 +2173,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 @@ -2027,8 +2181,8 @@ msgstr "ソケットが :ref:`継承不可 ` になりました #: ../../library/socket.rst:1974 ../../library/socket.rst:2019 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the method now retries the system call instead of raising an :exc:" -"`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the method now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "システムコールが中断されシグナルハンドラが例外を送出しなかった場合、このメ" "ソッドは :exc:`InterruptedError` 例外を送出する代わりにシステムコールを再試行" @@ -2043,15 +2197,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 +2211,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 "" @@ -2072,18 +2230,21 @@ msgstr "" #: ../../library/socket.rst:1575 msgid "" -":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" -"`close` call is made." +":exc:`OSError` is now raised if an error occurs when the " +"underlying :c:func:`close` call is made." 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 "" @@ -2098,36 +2259,35 @@ msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " "signal handler doesn't raise an exception and the socket is blocking or has " -"a timeout. For non-blocking sockets, the method raises an :exc:" -"`InterruptedError` exception if the connection is interrupted by a signal " -"(or the exception raised by the signal handler)." +"a timeout. For non-blocking sockets, the method raises " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " +"signal (or the exception raised by the signal handler)." msgstr "" "接続が信号によって中断された場合、このメソッドは接続が完了するまで待機する" "か、タイムアウト時に :exc:`TimeoutError` を送出します。タイムアウトは、信号ハ" "ンドラが例外を送出せず、ソケットがブロックするかタイムアウトが設定されている" "場合に起こります。非ブロックソケットでは、接続が信号によって中断された場合 " -"(あるいは信号ハンドラにより例外が送出された場合)、このメソッドは :exc:" -"`InterruptedError` 例外を送出します。" +"(あるいは信号ハンドラにより例外が送出された場合)、このメソッド" +"は :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 "" -"The method now waits until the connection completes instead of raising an :" -"exc:`InterruptedError` exception if the connection is interrupted by a " +"The method now waits until the connection completes instead of raising " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " "signal, the signal handler doesn't raise an exception and the socket is " "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" "このメソッドは、接続が信号によって中断され、信号ハンドラが例外を送出せず、ソ" -"ケットがブロックであるかタイムアウトが設定されている場合、:exc:" -"`InterruptedError` 例外を送出する代わりに、接続を完了するまで待機するようにな" -"りました (論拠については :pep:`475` を参照してください)。" +"ケットがブロックであるかタイムアウトが設定されている場" +"合、:exc:`InterruptedError` 例外を送出する代わりに、接続を完了するまで待機す" +"るようになりました (論拠については :pep:`475` を参照してください)。" #: ../../library/socket.rst:1612 msgid "" @@ -2157,12 +2317,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 @@ -2171,8 +2331,8 @@ msgid "" "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -"Windowsではこのメソッドで返された小整数をファイル記述子を扱う箇所 (:func:`os." -"fdopen` など) で利用できません。 Unix にはこの制限はありません。" +"Windowsではこのメソッドで返された小整数をファイル記述子を扱う箇所 " +"(:func:`os.fdopen` など) で利用できません。 Unix にはこの制限はありません。" #: ../../library/socket.rst:1655 msgid "" @@ -2206,33 +2366,42 @@ 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. `) are defined in this module. If *buflen* is absent, an " -"integer option is assumed and its integer value is returned by the " -"function. If *buflen* is present, it specifies the maximum length of the " -"buffer used to receive the option in, and this buffer is returned as a bytes " -"object. It is up to the caller to decode the contents of the buffer (see " -"the optional built-in module :mod:`struct` for a way to decode C structures " -"encoded as byte strings)." -msgstr "" +"Return the value of the given socket option (see the Unix man " +"page :manpage:`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* " +"etc. `) are defined in this module. If *buflen* is " +"absent, an integer option is assumed and its integer value is returned by " +"the function. If *buflen* is present, it specifies the maximum length of " +"the buffer used to receive the option in, and this buffer is returned as a " +"bytes object. It is up to the caller to decode the contents of the buffer " +"(see the optional built-in module :mod:`struct` for a way to decode C " +"structures encoded as byte strings)." +msgstr "" +"指定されたソケットオプションの値を返します (Unix のマニュアルペー" +"ジ :manpage:`getsockopt(2)` を参照)。\n" +"必要なシンボル定数 (:ref:`SO_\\* など `) はこのモ" +"ジュールで定義されています。\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 "" "Return the timeout in seconds (float) associated with socket operations, or " -"``None`` if no timeout is set. This reflects the last call to :meth:" -"`setblocking` or :meth:`settimeout`." +"``None`` if no timeout is set. This reflects the last call " +"to :meth:`setblocking` or :meth:`settimeout`." msgstr "" "ソケットに指定されたタイムアウト値を取得します。タイムアウト値が設定されてい" "る場合には浮動小数点型で秒数が、設定されていなければ ``None`` が返ります。こ" @@ -2242,12 +2411,14 @@ msgstr "" #: ../../library/socket.rst:1710 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " -"interface. Please refer to the `Win32 documentation `_ for more information." +"interface. Please refer to the `Win32 documentation `_ for more " +"information." msgstr "" ":meth:`ioctl` メソッドは WSAIoctl システムインターフェースへの制限されたイン" -"ターフェースです。詳しい情報については、 `Win32 documentation `_ を参照してください。" +"ターフェースです。詳しい情報については、 `Win32 documentation `_ を参照してくださ" +"い。" #: ../../library/socket.rst:1715 msgid "" @@ -2282,7 +2453,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 +2460,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 "" @@ -2304,8 +2480,8 @@ msgstr "" #: ../../library/socket.rst:1755 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " -"original socket unless all other file objects have been closed and :meth:" -"`socket.close` has been called on the socket object." +"original socket unless all other file objects have been closed " +"and :meth:`socket.close` has been called on the socket object." msgstr "" ":meth:`makefile` でファイルオブジェクトにソケットを関連づけた場合、ソケットを" "閉じるには、関連づけられたすべてのファイルオブジェクトを閉じたあとで、元のソ" @@ -2326,9 +2502,9 @@ msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " "at once is specified by *bufsize*. A returned empty bytes object indicates " -"that the client has disconnected. See the Unix manual page :manpage:" -"`recv(2)` for the meaning of the optional argument *flags*; it defaults to " -"zero." +"that the client has disconnected. See the Unix manual " +"page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it " +"defaults to zero." msgstr "" #: ../../library/socket.rst:1782 @@ -2342,16 +2518,18 @@ msgid "" msgstr "" "ソケットからデータを受信し、結果をタプル ``(bytes, address)`` として返しま" "す。 *bytes* は受信データの bytes オブジェクトで、 *address* は送信元のアドレ" -"スを示します。オプション引数 *flags* については、 Unix のマニュアルページ :" -"manpage:`recv(2)` を参照してください。デフォルトは0です。 (*address* のフォー" -"マットはアドレスファミリによって異なります(前述))" +"スを示します。オプション引数 *flags* については、 Unix のマニュアルペー" +"ジ :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`." +"``%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 "" @@ -2368,8 +2546,8 @@ msgstr "" "イト数として、サイズが設定されます。このデフォルトは 0 で、補助的なデータを受" "信しないことを意味します。:func:`CMSG_SPACE` または :func:`CMSG_LEN` を使用し" "て、補助的なデータの適切なサイズを計算することができ、バッファ内に収まらない" -"アイテムは、短縮されるか破棄されます。*flags* 引数はデフォルトでは 0 で、:" -"meth:`recv` での意味と同じ意味を持ちます。" +"アイテムは、短縮されるか破棄されます。*flags* 引数はデフォルトでは 0 " +"で、:meth:`recv` での意味と同じ意味を持ちます。" #: ../../library/socket.rst:1810 msgid "" @@ -2390,11 +2568,12 @@ msgstr "" "す。*ancdata* アイテムは、ゼロ以上のタプル ``(cmsg_level, cmsg_type, " "cmsg_data)`` からなるリストで、受信する付属的なデータ (制御メッセージ) を表し" "ます。*cmsg_level* と *cmsg_type* はそれぞれ、プロトコルレベルとプロトコル固" -"有のタイプを指定する整数で、*cmsg_data* は関連するデータを保持する :class:" -"`bytes` オブジェクトです。*msg_flags* アイテムは、受信したメッセージの条件を" -"示す様々なフラグのビット OR です。詳細は、システムのドキュメントを参照してく" -"ださい。受信ソケットが接続されていない場合、*address* は、送信ソケットが利用" -"できる場合にはそのアドレスで、利用できない場合、その値は未指定になります。" +"有のタイプを指定する整数で、*cmsg_data* は関連するデータを保持す" +"る :class:`bytes` オブジェクトです。*msg_flags* アイテムは、受信したメッセー" +"ジの条件を示す様々なフラグのビット OR です。詳細は、システムのドキュメントを" +"参照してください。受信ソケットが接続されていない場合、*address* は、送信ソ" +"ケットが利用できる場合にはそのアドレスで、利用できない場合、その値は未指定に" +"なります。" #: ../../library/socket.rst:1824 msgid "" @@ -2402,49 +2581,49 @@ msgid "" "file descriptors between processes over an :const:`AF_UNIX` socket. When " "this facility is used (it is often restricted to :const:`SOCK_STREAM` " "sockets), :meth:`recvmsg` will return, in its ancillary data, items of the " -"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is a :" -"class:`bytes` object representing the new file descriptors as a binary array " -"of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an exception " -"after the system call returns, it will first attempt to close any file " -"descriptors received via this mechanism." +"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is " +"a :class:`bytes` object representing the new file descriptors as a binary " +"array of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an " +"exception after the system call returns, it will first attempt to close any " +"file descriptors received via this mechanism." msgstr "" "一部のシステムでは、:meth:`sendmsg` と :meth:`recvmsg` を使用して、プロセス間" "で :const:`AF_UNIX` ソケットを経由してファイル記述子を渡すことができます。こ" "の機能を使用する場合 (しばしば :const:`SOCK_STREAM` ソケットに限定されま" -"す)、:meth:`recvmsg` は、付属的なデータ中に、``(socket.SOL_SOCKET, socket." -"SCM_RIGHTS, fds)`` という形式のアイテムを返します。ここで、*fds* は、新しい" -"ファイル記述子をネイティブ C の :c:expr:`int` 型のバイナリ配列として表す :" -"class:`bytes` オブジェクトです。システムコールが返った後 :meth:`recvmsg` が例" -"外を送出する場合、まずこのメカニズムを経由して受信したファイル記述子を全て閉" -"じようと試みます。" +"す)、:meth:`recvmsg` は、付属的なデータ中に、``(socket.SOL_SOCKET, " +"socket.SCM_RIGHTS, fds)`` という形式のアイテムを返します。ここで、*fds* は、" +"新しいファイル記述子をネイティブ C の :c:expr:`int` 型のバイナリ配列として表" +"す :class:`bytes` オブジェクトです。システムコールが返った後 :meth:`recvmsg` " +"が例外を送出する場合、まずこのメカニズムを経由して受信したファイル記述子を全" +"て閉じようと試みます。" #: ../../library/socket.rst:1835 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " -"beyond the end of the buffer, :meth:`recvmsg` will issue a :exc:" -"`RuntimeWarning`, and will return the part of it which is inside the buffer " -"provided it has not been truncated before the start of its associated data." +"beyond the end of the buffer, :meth:`recvmsg` will issue " +"a :exc:`RuntimeWarning`, and will return the part of it which is inside the " +"buffer provided it has not been truncated before the start of its associated " +"data." msgstr "" "一部のシステムでは、部分的に受信した付属的なデータアイテムの短縮された長さが" -"示されません。アイテムがバッファの末尾を超えているようである場合、:meth:" -"`recvmsg` は :exc:`RuntimeWarning` を送出し、関連するデータの開始位置より前で" -"途切れていない場合、バッファ内の付属的なデータの一部を返します。" +"示されません。アイテムがバッファの末尾を超えているようである場" +"合、:meth:`recvmsg` は :exc:`RuntimeWarning` を送出し、関連するデータの開始位" +"置より前で途切れていない場合、バッファ内の付属的なデータの一部を返します。" #: ../../library/socket.rst:1842 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " "data and a list containing the descriptors (while ignoring unexpected " -"conditions such as unrelated control messages being received). See also :" -"meth:`sendmsg`. ::" +"conditions such as unrelated control messages being received). See " +"also :meth:`sendmsg`. ::" msgstr "" ":const:`SCM_RIGHTS` メカニズムをサポートするシステム上では、次の関数が最大 " "*maxfds* のファイル記述子を受信し、メッセージデータと記述子を含むリストを返し" -"ま(無関係な制御メッセージを受信した場合など、予期しない条件は無視します)。 :" -"meth:`sendmsg` も参照してください。" +"ま(無関係な制御メッセージを受信した場合など、予期しない条件は無視しま" +"す)。 :meth:`sendmsg` も参照してください。" -#: ../../library/socket.rst:1848 msgid "" "import socket, array\n" "\n" @@ -2453,52 +2632,65 @@ msgid "" " 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" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == " +"socket.SCM_RIGHTS:\n" " # Append data, ignoring any truncated integers at the end.\n" -" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." -"itemsize)])\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % " +"fds.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 " -"instead of returning a new bytes object. The *buffers* argument must be an " -"iterable of objects that export writable buffers (e.g. :class:`bytearray` " -"objects); these will be filled with successive chunks of the non-ancillary " -"data until it has all been written or there are no more buffers. The " -"operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) " -"on the number of buffers that can be used. The *ancbufsize* and *flags* " -"arguments have the same meaning as for :meth:`recvmsg`." +"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 instead of returning a new bytes object. The *buffers* argument " +"must be an iterable of objects that export writable buffers " +"(e.g. :class:`bytearray` objects); these will be filled with successive " +"chunks of the non-ancillary data until it has all been written or there are " +"no more buffers. The operating system may set a limit (:func:`~os.sysconf` " +"value ``SC_IOV_MAX``) on the number of buffers that can be used. The " +"*ancbufsize* and *flags* 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 +2704,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 "" @@ -2556,9 +2759,9 @@ msgstr "" "なりません。オプション引数 *flags* の意味は、上記 :meth:`recv` と同じです。戻" "り値として、送信したバイト数を返します。アプリケーションでは、必ず戻り値を" "チェックし、全てのデータが送られた事を確認する必要があります。データの一部だ" -"けが送信された場合、アプリケーションで残りのデータを再送信してください。 :" -"ref:`ソケットプログラミングHOWTO ` に、さらに詳しい情報がありま" -"す。" +"けが送信された場合、アプリケーションで残りのデータを再送信してくださ" +"い。 :ref:`ソケットプログラミングHOWTO ` に、さらに詳しい情報が" +"あります。" #: ../../library/socket.rst:1946 msgid "" @@ -2570,11 +2773,11 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" "ソケットにデータを送信します。ソケットはリモートソケットに接続済みでなければ" -"なりません。オプション引数 *flags* の意味は、上記 :meth:`recv` と同じです。 :" -"meth:`send` と異なり、このメソッドは *bytes* の全データを送信するか、エラーが" -"発生するまで処理を継続します。正常終了の場合は ``None`` を返し、エラー発生時" -"には例外が発生します。エラー発生時、送信されたバイト数を調べる事はできませ" -"ん。" +"なりません。オプション引数 *flags* の意味は、上記 :meth:`recv` と同じで" +"す。 :meth:`send` と異なり、このメソッドは *bytes* の全データを送信するか、エ" +"ラーが発生するまで処理を継続します。正常終了の場合は ``None`` を返し、エラー" +"発生時には例外が発生します。エラー発生時、送信されたバイト数を調べる事はでき" +"ません。" #: ../../library/socket.rst:1953 msgid "" @@ -2594,25 +2797,24 @@ msgid "" "address family --- see above.)" msgstr "" "ソケットにデータを送信します。このメソッドでは接続先を *address* で指定するの" -"で、接続済みではいけません。オプション引数 *flags* の意味は、上記 :meth:" -"`recv` と同じです。戻り値として、送信したバイト数を返します。(*address* の" -"フォーマットはアドレスファミリによって異なります --- 前述。)" +"で、接続済みではいけません。オプション引数 *flags* の意味は、上" +"記 :meth:`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 "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " -"The *buffers* argument specifies the non-ancillary data as an iterable of :" -"term:`bytes-like objects ` (e.g. :class:`bytes` objects); " -"the operating system may set a limit (:func:`~os.sysconf` value " +"The *buffers* argument specifies the non-ancillary data as an iterable " +"of :term:`bytes-like objects ` (e.g. :class:`bytes` " +"objects); the operating system may set a limit (:func:`~os.sysconf` value " "``SC_IOV_MAX``) on the number of buffers that can be used. The *ancdata* " "argument specifies the ancillary data (control messages) as an iterable of " "zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)``, where " @@ -2627,46 +2829,49 @@ msgid "" msgstr "" "非付属的なデータを一連のバッファから集め、単一のメッセージにまとめることで、" "通常のデータと付属的なデータをソケットに送信します。*buffers* 引数は、非付属" -"的なデータを :term:`bytes-like objects ` (例: :class:" -"`bytes` オブジェクト) のイテラブルとして指定します。オペレーティングシステム" -"によって、使用できるバッファの数が制限 (:func:`~os.sysconf` 値 " +"的なデータを :term:`bytes-like objects ` " +"(例: :class:`bytes` オブジェクト) のイテラブルとして指定します。オペレーティ" +"ングシステムによって、使用できるバッファの数が制限 (:func:`~os.sysconf` 値 " "``SC_IOV_MAX``) されている場合があります。*ancdata* 引数は付属的なデータ (制" "御メッセージ) をゼロ以上のタプル ``(cmsg_level, cmsg_type, cmsg_data)`` のイ" "テラブルとして指定します。ここで、*cmsg_level* と *cmsg_type* はそれぞれプロ" "トコルレベルとプロトコル固有のタイプを指定する整数で、*cmsg_data* は関連デー" -"タを保持するバイトライクオブジェクトです。一部のシステム (特に :func:" -"`CMSG_SPACE` を持たないシステム) では、一度の呼び出しで一つの制御メッセージの" -"送信しかサポートされていない場合があります。*flags* 引数のデフォルトは 0 であ" -"り、:meth:`send` での意味と同じ意味を持ちます。``None`` 以外の *address* が渡" -"された場合、メッセージの目的地のアドレスを設定します。戻り値は、送信された非" -"付属的データのバイト数です。" +"タを保持するバイトライクオブジェクトです。一部のシステム (特" +"に :func:`CMSG_SPACE` を持たないシステム) では、一度の呼び出しで一つの制御" +"メッセージの送信しかサポートされていない場合があります。*flags* 引数のデフォ" +"ルトは 0 であり、:meth:`send` での意味と同じ意味を持ちます。``None`` 以外の " +"*address* が渡された場合、メッセージの目的地のアドレスを設定します。戻り値" +"は、送信された非付属的データのバイト数です。" #: ../../library/socket.rst:2002 msgid "" -"The following function sends the list of file descriptors *fds* over an :" -"const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " +"The following function sends the list of file descriptors *fds* over " +"an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" "以下の関数は、:const:`SCM_RIGHTS` メカニズムをサポートするシステムで、ファイ" "ル記述子 *fds* を :const:`AF_UNIX` ソケット経由で送信します。:meth:`recvmsg` " "も参照してください。" -#: ../../library/socket.rst:2006 msgid "" "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))])" +" 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,37 +2883,40 @@ 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 " -"be a regular file object opened in binary mode. If :mod:`os.sendfile` is not " -"available (e.g. Windows) or *file* is not a regular file :meth:`send` will " -"be used instead. *offset* tells from where to start reading the file. If " -"specified, *count* is the total number of bytes to transmit as opposed to " -"sending the file until EOF is reached. File position is updated on return or " -"also in case of error in which case :meth:`file.tell() ` can " -"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` タイプでなければなりません。非ブ" -"ロックソケットはサポートされていません。" - -#: ../../library/socket.rst:2051 +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 be a regular file object opened in binary mode. " +"If :mod:`os.sendfile` is not available (e.g. Windows) or *file* is not a " +"regular file :meth:`send` will be used instead. *offset* tells from where to " +"start reading the file. If specified, *count* is the total number of bytes " +"to transmit as opposed to sending the file until EOF is reached. File " +"position is updated on return or also in case of error in which " +"case :meth:`file.tell() ` can 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 まで送信し、送信した総バイ" +"ト数を返します。\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" +"非ブロッキングソケットはサポートされていません。" + msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" "ソケットのファイル記述子、またはソケットのハンドルの、 :ref:`継承可能フラグ " -"` を立てます。" +"` を設定します。" #: ../../library/socket.rst:2059 msgid "" @@ -2733,19 +2941,19 @@ 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`." +"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 "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" -"zero value is given, subsequent socket operations will raise a :exc:" -"`timeout` exception if the timeout period *value* has elapsed before the " -"operation has completed. If zero is given, the socket is put in non-" +"zero value is given, subsequent socket operations will raise " +"a :exc:`timeout` exception if the timeout period *value* has elapsed before " +"the operation has completed. If zero is given, the socket is put in non-" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" @@ -2757,23 +2965,25 @@ msgstr "" "詳しくは :ref:`ソケットタイムアウトの注意事項 ` を参照してく" "ださい。" -#: ../../library/socket.rst:2084 msgid "" -"The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"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 "" -"Set the value of the given socket option (see the Unix manual page :manpage:" -"`setsockopt(2)`). The needed symbolic constants are defined in this module " -"(:ref:`!SO_\\* etc. `). The value can be an integer, " -"``None`` or a :term:`bytes-like object` representing a buffer. In the later " -"case it is up to the caller to ensure that the bytestring contains the " -"proper bits (see the optional built-in module :mod:`struct` for a way to " -"encode C structures as bytestrings). When *value* is set to ``None``, " -"*optlen* argument is required. It's equivalent to call :c:func:`setsockopt` " -"C function with ``optval=NULL`` and ``optlen=optlen``." +"Set the value of the given socket option (see the Unix manual " +"page :manpage:`setsockopt(2)`). The needed symbolic constants are defined " +"in this module (:ref:`!SO_\\* etc. `). The value can " +"be an integer, ``None`` or a :term:`bytes-like object` representing a " +"buffer. In the later case it is up to the caller to ensure that the " +"bytestring contains the proper bits (see the optional built-in " +"module :mod:`struct` for a way to encode C structures as bytestrings). When " +"*value* is set to ``None``, *optlen* argument is required. It's equivalent " +"to call :c:func:`setsockopt` C function with ``optval=NULL`` and " +"``optlen=optlen``." msgstr "" #: ../../library/socket.rst:2110 @@ -2782,10 +2992,10 @@ msgstr "setsockopt(level, optname, None, optlen: int) の形式が追加され #: ../../library/socket.rst:2118 msgid "" -"Shut down one or both halves of the connection. If *how* is :const:" -"`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " -"further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends " -"and receives are disallowed." +"Shut down one or both halves of the connection. If *how* " +"is :const:`SHUT_RD`, further receives are disallowed. If *how* " +"is :const:`SHUT_WR`, further sends are disallowed. If *how* " +"is :const:`SHUT_RDWR`, further sends and receives are disallowed." msgstr "" "接続の片方向、または両方向を切断します。 *how* が :const:`SHUT_RD` の場合、以" "降は受信を行えません。 *how* が :const:`SHUT_WR` の場合、以降は送信を行えませ" @@ -2796,10 +3006,10 @@ msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " "object can then be passed to the target process using some form of " -"interprocess communication and the socket can be recreated there using :func:" -"`fromshare`. Once this method has been called, it is safe to close the " -"socket since the operating system has already duplicated it for the target " -"process." +"interprocess communication and the socket can be recreated there " +"using :func:`fromshare`. Once this method has been called, it is safe to " +"close the socket since the operating system has already duplicated it for " +"the target process." msgstr "" "ソケットを複製し、対象のプロセスと共有するための bytes オブジェクトを返しま" "す。対象のプロセスを *process_id* で指定しなければなりません。戻り値の bytes " @@ -2811,12 +3021,13 @@ msgstr "" #: ../../library/socket.rst:2140 msgid "" -"Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" -"`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." +"Note that there are no methods :meth:`read` or :meth:`write`; " +"use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument " +"instead." msgstr "" ":meth:`read` メソッドと :meth:`write` メソッドは存在しませんので注意してくだ" -"さい。代わりに *flags* を省略した :meth:`~socket.recv` と :meth:`~socket." -"send` を使うことができます。" +"さい。代わりに *flags* を省略した :meth:`~socket.recv` " +"と :meth:`~socket.send` を使うことができます。" #: ../../library/socket.rst:2143 msgid "" @@ -2900,30 +3111,30 @@ msgstr "タイムアウトと ``connect`` メソッド" msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " -"before calling :meth:`~socket.connect` or pass a timeout parameter to :meth:" -"`create_connection`. However, the system network stack may also return a " -"connection timeout error of its own regardless of any Python socket timeout " -"setting." +"before calling :meth:`~socket.connect` or pass a timeout parameter " +"to :meth:`create_connection`. However, the system network stack may also " +"return a connection timeout error of its own regardless of any Python socket " +"timeout setting." msgstr "" -":meth:`~socket.connect` もタイムアウト設定に従います。一般的に、 :meth:" -"`~socket.settimeout` を :meth:`~socket.connect` の前に呼ぶか、 :meth:" -"`create_connection` にタイムアウト引数を渡すことが推奨されます。ただし、シス" -"テムのネットワークスタックが Python のソケットタイムアウトの設定を無視して、" -"自身の接続タイムアウトエラーを返すこともあります。" +":meth:`~socket.connect` もタイムアウト設定に従います。一般的" +"に、 :meth:`~socket.settimeout` を :meth:`~socket.connect` の前に呼ぶ" +"か、 :meth:`create_connection` にタイムアウト引数を渡すことが推奨されます。た" +"だし、システムのネットワークスタックが Python のソケットタイムアウトの設定を" +"無視して、自身の接続タイムアウトエラーを返すこともあります。" #: ../../library/socket.rst:2202 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:" +"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,24 +3161,36 @@ 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 " -"a client using it. Note that a server must perform the sequence :func:" -"`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:" -"`~socket.accept` (possibly repeating the :meth:`~socket.accept` to service " -"more than one client), while a client only needs the sequence :func:`~socket." -"socket`, :meth:`~socket.connect`. Also note that the server does not :meth:" -"`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but " -"on the new socket returned by :meth:`~socket.accept`." -msgstr "" +"a client using it. Note that a server must perform the " +"sequence :func:`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` " +"(possibly repeating the :meth:`~socket.accept` to service more than one " +"client), while a client only needs the " +"sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also note that " +"the server does not :meth:`~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 +3208,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 +3236,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 +3255,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 +3298,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" @@ -3056,8 +3340,8 @@ msgid "" "HOST = 'daring.cwi.nl' # The remote host\n" "PORT = 50007 # The same port as used by the server\n" "s = None\n" -"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." -"SOCK_STREAM):\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" @@ -3079,6 +3363,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 +3403,6 @@ msgstr "" "ファーを書きます。このサンプルを実行するには、インターフェースを操作するため" "の管理者権限が必要です::" -#: ../../library/socket.rst:2339 msgid "" "import socket\n" "\n" @@ -3113,20 +3425,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 +3473,6 @@ msgstr "" msgid "This last example might require special privileges::" msgstr "最後の例では、特権が必要になるかもしれません::" -#: ../../library/socket.rst:2372 msgid "" "import socket\n" "import struct\n" @@ -3183,6 +3513,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 +3561,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 "" @@ -3206,16 +3574,18 @@ msgstr "" #: ../../library/socket.rst:2418 msgid "" -"There is a :mod:`socket` flag to set, in order to prevent this, :const:" -"`socket.SO_REUSEADDR`::" +"There is a :mod:`socket` flag to set, in order to prevent " +"this, :const:`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 +3596,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..9a1b4014d 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,23 +42,21 @@ msgstr "" ":mod:`socketserver` モジュールはネットワークサーバを実装するタスクを単純化し" "ます。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/socketserver.rst:15 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 "" @@ -109,22 +119,21 @@ msgid "" "classes, passing it the server's address and the request handler class. It " "is recommended to use the server in a :keyword:`with` statement. Then call " "the :meth:`~BaseServer.handle_request` or :meth:`~BaseServer.serve_forever` " -"method of the server object to process one or many requests. Finally, call :" -"meth:`~BaseServer.server_close` to close the socket (unless you used a :" -"keyword:`!with` statement)." -msgstr "" -"サーバの作成にはいくつかのステップが必要です。最初に、 :class:" -"`BaseRequestHandler` クラスをサブクラス化して要求処理クラス (request hander " -"class) を生成し、その :meth:`~BaseRequestHandler.handle` メソッドをオーバーラ" -"イドしなければなりません; このメソッドは入力される要求を処理します。次に、" -"サーバクラスのうち一つを、サーバのアドレスと要求処理クラスを渡してインスタン" -"ス化しなければなりません。サーバを :keyword:`with` 文中で使うことが推奨されま" -"す。そして、:meth:`~BaseServer.handle_request` または :meth:`~BaseServer." -"serve_forever` メソッドを呼び出して、一つのまたは多数の要求を処理します。最後" -"に、(:keyword:`!with` 文を使っていなかったなら) :meth:`~BaseServer." -"server_close` を呼び出してソケットを閉じます。" - -#: ../../library/socketserver.rst:64 +"method of the server object to process one or many requests. Finally, " +"call :meth:`~BaseServer.server_close` to close the socket (unless you used " +"a :keyword:`!with` statement)." +msgstr "" +"サーバの作成にはいくつかのステップが必要です。最初" +"に、 :class:`BaseRequestHandler` クラスをサブクラス化して要求処理クラス " +"(request hander class) を生成し、その :meth:`~BaseRequestHandler.handle` メ" +"ソッドをオーバーライドしなければなりません; このメソッドは入力される要求を処" +"理します。次に、サーバクラスのうち一つを、サーバのアドレスと要求処理クラスを" +"渡してインスタンス化しなければなりません。サーバを :keyword:`with` 文中で使う" +"ことが推奨されます。そして、:meth:`~BaseServer.handle_request` また" +"は :meth:`~BaseServer.serve_forever` メソッドを呼び出して、一つのまたは多数の" +"要求を処理します。最後に、(:keyword:`!with` 文を使っていなかったな" +"ら) :meth:`~BaseServer.server_close` を呼び出してソケットを閉じます。" + msgid "" "When inheriting from :class:`ThreadingMixIn` for threaded connection " "behavior, you should explicitly declare how you want your threads to behave " @@ -132,15 +141,17 @@ msgid "" "attribute *daemon_threads*, which indicates whether or not the server should " "wait for thread termination. You should set the flag explicitly if you " "would like threads to behave autonomously; the default is :const:`False`, " -"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` クラスが起動した全てのスレッドが終了するまで実行し続けます。" +"meaning that Python will not exit until all threads created " +"by :class:`ThreadingMixIn` have exited." +msgstr "" +":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 "" @@ -184,9 +207,9 @@ msgid "" "from :class:`UnixStreamServer` --- the only difference between an IP and a " "Unix server is the address family." msgstr "" -":class:`UnixDatagramServer` は :class:`UDPServer` から派生していて、 :class:" -"`UnixStreamServer` からではないことに注意してください --- IP と Unix サーバの" -"唯一の違いはアドレスファミリーです。" +":class:`UnixDatagramServer` は :class:`UDPServer` から派生してい" +"て、 :class:`UnixStreamServer` からではないことに注意してください --- IP と " +"Unix サーバの唯一の違いはアドレスファミリーです。" #: ../../library/socketserver.rst:105 msgid "" @@ -195,95 +218,109 @@ msgid "" "as follows::" msgstr "" "それぞれのタイプのサーバのフォークしたりスレッド実行したりするバージョンはそ" -"れらのミクシン(mix-in)クラスを使って作ることができます。たとえば、:class:" -"`ThreadingUDPServer` は以下のようにして作られます::" +"れらのミクシン(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 "" -"The mix-in class comes first, since it overrides a method defined in :class:" -"`UDPServer`. Setting the various attributes also changes the behavior of " -"the underlying server mechanism." +"The mix-in class comes first, since it overrides a method defined " +"in :class:`UDPServer`. Setting the various attributes also changes the " +"behavior of the underlying server mechanism." msgstr "" "ミクシンクラスは :class:`UDPServer` で定義されるメソッドをオーバライドするた" "めに、最初に来ます。様々な属性を設定することで元になるサーバ機構の振る舞いを" "変えられます。" -#: ../../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." +"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 " -"child processes and non-daemonic threads complete. Add a new :attr:" -"`ForkingMixIn.block_on_close ` class attribute to opt-in for " -"the pre-3.7 behaviour." +":meth:`ForkingMixIn.server_close ` " +"and :meth:`ThreadingMixIn.server_close ` now waits " +"until all child processes and non-daemonic threads complete. Add a " +"new :attr:`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 "" -"To implement a service, you must derive a class from :class:" -"`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " -"method. You can then run various versions of the service by combining one of " -"the server classes with your request handler class. The request handler " -"class must be different for datagram or stream services. This can be hidden " -"by using the handler subclasses :class:`StreamRequestHandler` or :class:" -"`DatagramRequestHandler`." -msgstr "" -"サービスの実装には、 :class:`BaseRequestHandler` からクラスを派生させてその :" -"meth:`~BaseRequestHandler.handle` メソッドを再定義しなければなりません。この" -"ようにすれば、サーバクラスと要求処理クラスを結合して様々なバージョンのサービ" -"スを実行することができます。要求処理クラスはデータグラムサービスかストリーム" -"サービスかで異なることでしょう。この違いは処理サブクラス :class:" -"`StreamRequestHandler` または :class:`DatagramRequestHandler` を使うという形" -"で隠蔽できます。" +"To implement a service, you must derive a class " +"from :class:`BaseRequestHandler` and redefine " +"its :meth:`~BaseRequestHandler.handle` method. You can then run various " +"versions of the service by combining one of the server classes with your " +"request handler class. The request handler class must be different for " +"datagram or stream services. This can be hidden by using the handler " +"subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`." +msgstr "" +"サービスの実装には、 :class:`BaseRequestHandler` からクラスを派生させてそ" +"の :meth:`~BaseRequestHandler.handle` メソッドを再定義しなければなりません。" +"このようにすれば、サーバクラスと要求処理クラスを結合して様々なバージョンの" +"サービスを実行することができます。要求処理クラスはデータグラムサービスかスト" +"リームサービスかで異なることでしょう。この違いは処理サブクラ" +"ス :class:`StreamRequestHandler` または :class:`DatagramRequestHandler` を使" +"うという形で隠蔽できます。" #: ../../library/socketserver.rst:173 msgid "" @@ -321,15 +358,15 @@ msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " "request data. This can be implemented by using a synchronous server and " -"doing an explicit fork in the request handler class :meth:" -"`~BaseRequestHandler.handle` method." +"doing an explicit fork in the request handler " +"class :meth:`~BaseRequestHandler.handle` method." msgstr "" "ある場合には、要求の一部を同期的に処理する一方で、要求データに依って子プロセ" "スをフォークして処理を終了させる、といった方法も適当かもしれません。こうした" -"処理方法は同期サーバを使って要求処理クラスの :meth:`~BaseRequestHandler." -"handle` メソッドの中で自分でフォークするようにして実装することができます。" +"処理方法は同期サーバを使って要求処理クラス" +"の :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 +377,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." +"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 "" @@ -360,27 +408,28 @@ msgid "" "allow monitoring multiple servers in the same process." msgstr "" "サーバが要求待ちを行っているソケットのファイル記述子を整数で返します。この関" -"数は一般的に、同じプロセス中の複数のサーバを監視できるようにするために、 :" -"mod:`selectors` に渡されます。" +"数は一般的に、同じプロセス中の複数のサーバを監視できるようにするため" +"に、 :mod:`selectors` に渡されます。" #: ../../library/socketserver.rst:223 msgid "" "Process a single request. This function calls the following methods in " -"order: :meth:`get_request`, :meth:`verify_request`, and :meth:" -"`process_request`. If the user-provided :meth:`~BaseRequestHandler.handle` " -"method of the handler class raises an exception, the server's :meth:" -"`handle_error` method will be called. If no request is received within :" -"attr:`timeout` seconds, :meth:`handle_timeout` will be called and :meth:" -"`handle_request` will return." -msgstr "" -"単一の要求を処理します。この関数は以下のメソッド: :meth:`get_request` 、 :" -"meth:`verify_request` 、および :meth:`process_request` を順番に呼び出します。" -"ハンドラ中でユーザによって提供された :meth:`~BaseRequestHandler.handle` が例" -"外を送出した場合、サーバの :meth:`handle_error` メソッドが呼び出されます。 :" -"attr:`timeout` 秒以内にリクエストが来なかった場合、 :meth:`handle_timeout` が" -"呼ばれて、 :meth:`handle_request` が終了します。" - -#: ../../library/socketserver.rst:235 +"order: :meth:`get_request`, :meth:`verify_request`, " +"and :meth:`process_request`. If the user-" +"provided :meth:`~BaseRequestHandler.handle` method of the handler class " +"raises an exception, the server's :meth:`handle_error` method will be " +"called. If no request is received within :attr:`timeout` " +"seconds, :meth:`handle_timeout` will be called and :meth:`handle_request` " +"will return." +msgstr "" +"単一の要求を処理します。この関数は以下のメソッ" +"ド: :meth:`get_request` 、 :meth:`verify_request` 、およ" +"び :meth:`process_request` を順番に呼び出します。ハンドラ中でユーザによって提" +"供された :meth:`~BaseRequestHandler.handle` が例外を送出した場合、サーバ" +"の :meth:`handle_error` メソッドが呼び出されます。 :attr:`timeout` 秒以内にリ" +"クエストが来なかった場合、 :meth:`handle_timeout` が呼ばれ" +"て、 :meth:`handle_request` が終了します。" + msgid "" "Handle requests until an explicit :meth:`shutdown` request. Poll for " "shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` " @@ -389,37 +438,54 @@ 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." +"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:" -"`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this module " -"with class attribute ``address_family = AF_INET6`` set if you want IPv6 " -"server classes." -msgstr "" +"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, " +"and :const:`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this " +"module 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 "" @@ -432,9 +498,9 @@ msgstr "" #: ../../library/socketserver.rst:284 msgid "" "The address on which the server is listening. The format of addresses " -"varies depending on the protocol family; see the documentation for the :mod:" -"`socket` module for details. For internet protocols, this is a tuple " -"containing a string giving the address, and an integer port number: " +"varies depending on the protocol family; see the documentation for " +"the :mod:`socket` module for details. For internet protocols, this is a " +"tuple containing a string giving the address, and an integer port number: " "``('127.0.0.1', 80)``, for example." msgstr "" "サーバが要求待ちを行うアドレスです。アドレスの形式はプロトコルファミリによっ" @@ -453,11 +519,12 @@ msgstr "サーバクラスは以下のクラス変数をサポートします:" #: ../../library/socketserver.rst:302 msgid "" -"Whether the server will allow the reuse of an address. This defaults to :" -"const:`False`, and can be set in subclasses to change the policy." +"Whether the server will allow the reuse of an address. This defaults " +"to :const:`False`, and can be set in subclasses to change the policy." msgstr "" -"サーバがアドレスの再使用を許すかどうかを示す値です。この値は標準で :const:" -"`False` で、サブクラスで再使用ポリシを変更するために設定することができます。" +"サーバがアドレスの再使用を許すかどうかを示す値です。この値は標準" +"で :const:`False` で、サブクラスで再使用ポリシを変更するために設定することが" +"できます。" #: ../../library/socketserver.rst:308 msgid "" @@ -475,11 +542,11 @@ msgstr "" #: ../../library/socketserver.rst:317 msgid "" -"The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" -"const:`socket.SOCK_DGRAM` are two common values." +"The type of socket used by the server; :const:`socket.SOCK_STREAM` " +"and :const:`socket.SOCK_DGRAM` are two common values." msgstr "" -"サーバが使うソケットの型です; 一般的な2つの値は、 :const:`socket." -"SOCK_STREAM` と :const:`socket.SOCK_DGRAM` です。" +"サーバが使うソケットの型です; 一般的な2つの値" +"は、 :const:`socket.SOCK_STREAM` と :const:`socket.SOCK_DGRAM` です。" #: ../../library/socketserver.rst:323 msgid "" @@ -487,9 +554,9 @@ msgid "" "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -"タイムアウト時間(秒)、もしくは、タイムアウトを望まない場合に :const:" -"`None` 。 :meth:`handle_request` がこの時間内にリクエストを受信しない場合、 :" -"meth:`handle_timeout` メソッドが呼ばれます。" +"タイムアウト時間(秒)、もしくは、タイムアウトを望まない場合" +"に :const:`None` 。 :meth:`handle_request` がこの時間内にリクエストを受信しな" +"い場合、 :meth:`handle_timeout` メソッドが呼ばれます。" #: ../../library/socketserver.rst:328 msgid "" @@ -506,8 +573,9 @@ msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -":attr:`RequestHandlerClass` をインスタンス化し、 :meth:`~BaseRequestHandler." -"handle` メソッドを呼び出して、実際に要求を処理します。" +":attr:`RequestHandlerClass` をインスタンス化" +"し、 :meth:`~BaseRequestHandler.handle` メソッドを呼び出して、実際に要求を処" +"理します。" #: ../../library/socketserver.rst:343 msgid "" @@ -526,14 +594,14 @@ msgid "" "action is to print the traceback to standard error and continue handling " "further requests." msgstr "" -"この関数は :attr:`RequestHandlerClass` インスタンスの :meth:" -"`~BaseRequestHandler.handle` メソッドが例外を送出した際に呼び出されます。標準" -"の動作では標準エラー出力へトレースバックを出力し、後続する要求を継続して処理" -"します。" +"この関数は :attr:`RequestHandlerClass` インスタンス" +"の :meth:`~BaseRequestHandler.handle` メソッドが例外を送出した際に呼び出され" +"ます。標準の動作では標準エラー出力へトレースバックを出力し、後続する要求を継" +"続して処理します。" -#: ../../library/socketserver.rst:355 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" +":exc:`Exception` クラスから派生した例外に対してのみ呼び出すようになりました。" #: ../../library/socketserver.rst:362 msgid "" @@ -550,22 +618,25 @@ msgstr "" #: ../../library/socketserver.rst:371 msgid "" -"Calls :meth:`finish_request` to create an instance of the :attr:" -"`RequestHandlerClass`. If desired, this function can create a new process " -"or thread to handle the request; the :class:`ForkingMixIn` and :class:" -"`ThreadingMixIn` classes do this." +"Calls :meth:`finish_request` to create an instance of " +"the :attr:`RequestHandlerClass`. If desired, this function can create a new " +"process or thread to handle the request; the :class:`ForkingMixIn` " +"and :class:`ThreadingMixIn` classes do this." msgstr "" ":meth:`finish_request` を呼び出して、 :attr:`RequestHandlerClass` のインスタ" "ンスを生成します。必要なら、この関数から新たなプロセスかスレッドを生成して要" -"求を処理することができます; その処理は :class:`ForkingMixIn` または :class:" -"`ThreadingMixIn` クラスが行います。" +"求を処理することができます; その処理は :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 "" @@ -584,8 +655,8 @@ msgid "" msgstr "" "ブール値を返さなければなりません; 値が :const:`True` の場合には要求が処理さ" "れ、 :const:`False` の場合には要求は拒否されます。サーバへのアクセス制御を実" -"装するためにこの関数を上書きすることができます。標準の実装では常に :const:" -"`True` を返します。" +"装するためにこの関数を上書きすることができます。標準の実装では常" +"に :const:`True` を返します。" #: ../../library/socketserver.rst:402 msgid "" @@ -595,17 +666,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,21 +689,30 @@ 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 " "available to it; the request is available as :attr:`request`; the client " -"address as :attr:`client_address`; and the server instance as :attr:" -"`server`, in case it needs access to per-server information." +"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 +730,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." +"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." +"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" +"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 +779,6 @@ msgstr ":class:`socketserver.TCPServer` の例" msgid "This is the server side::" msgstr "サーバサイドの例です::" -#: ../../library/socketserver.rst:492 msgid "" "import socketserver\n" "\n" @@ -728,6 +814,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 +857,6 @@ msgstr "" "別の、ストリーム(標準のファイル型のインターフェースを利用して通信をシンプルに" "したファイルライクオブジェクト)を使うリクエストハンドラクラスの例です::" -#: ../../library/socketserver.rst:529 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" @@ -753,6 +871,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 +900,6 @@ msgstr "" msgid "This is the client side::" msgstr "クライアントサイドの例::" -#: ../../library/socketserver.rst:554 msgid "" "import socket\n" "import sys\n" @@ -791,6 +920,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 +960,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 +968,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 +1004,6 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:627 msgid "" "import socket\n" "import sys\n" @@ -871,6 +1022,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 "" @@ -884,17 +1051,16 @@ msgstr "非同期処理の Mix-in" #: ../../library/socketserver.rst:650 msgid "" -"To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" -"`ForkingMixIn` classes." +"To build asynchronous handlers, use the :class:`ThreadingMixIn` " +"and :class:`ForkingMixIn` classes." msgstr "" -"複数の接続を非同期に処理するハンドラを作るには、 :class:`ThreadingMixIn` か :" -"class:`ForkingMixIn` クラスを利用します。" +"複数の接続を非同期に処理するハンドラを作るには、 :class:`ThreadingMixIn` " +"か :class:`ForkingMixIn` クラスを利用します。" #: ../../library/socketserver.rst:653 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr ":class:`ThreadingMixIn` クラスの利用例::" -#: ../../library/socketserver.rst:655 msgid "" "import socket\n" "import threading\n" @@ -908,8 +1074,8 @@ msgid "" " response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" " self.request.sendall(response)\n" "\n" -"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." -"TCPServer):\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, " +"socketserver.TCPServer):\n" " pass\n" "\n" "def client(ip, port, message):\n" @@ -941,8 +1107,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 +1159,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..14c36064f 100644 --- a/library/spwd.po +++ b/library/spwd.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/spwd.rst:2 msgid ":mod:`!spwd` --- The shadow password database" -msgstr "" +msgstr ":mod:`!spwd` --- シャドウパスワードデータベース" #: ../../library/spwd.rst:10 msgid "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..aaeef8979 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 @@ -55,8 +55,8 @@ msgstr "" #: ../../library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " -"SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.15.2 or newer." +"SQL interface compliant with the DB-API 2.0 specification described " +"by :pep:`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -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 "" @@ -159,16 +160,15 @@ msgstr "" #: ../../library/sqlite3.rst:89 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " -"will need to use a database cursor. Call :meth:`con.cursor() ` to create the :class:`Cursor`:" +"will need to use a database cursor. Call :meth:`con.cursor() " +"` to create the :class:`Cursor`:" msgstr "" "SQL 文を実行し、SQL クエリから結果を取得するには、データベース・カーソルを使" "用する必要があります。 :meth:`con.cursor() ` を呼び出し" "て :class:`Cursor` を作成してください:" -#: ../../library/sqlite3.rst:93 msgid "cur = con.cursor()" -msgstr "" +msgstr "cur = con.cursor()" #: ../../library/sqlite3.rst:97 msgid "" @@ -176,8 +176,8 @@ msgid "" "database table ``movie`` with columns for title, release year, and review " "score. For simplicity, we can just use column names in the table declaration " "-- thanks to the `flexible typing`_ feature of SQLite, specifying the data " -"types is optional. Execute the ``CREATE TABLE`` statement by calling :meth:" -"`cur.execute(...) `:" +"types is optional. Execute the ``CREATE TABLE`` statement by " +"calling :meth:`cur.execute(...) `:" msgstr "" "さて、今やデータベース接続とカーソルを取得したので、タイトル(title)とリリース" "年(year)と、レビュー・スコア(score)の列(columns)を持つデータベース・テーブル " @@ -186,57 +186,62 @@ 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 "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " "entry for the ``movie`` table definition (see `The Schema Table`_ for " -"details). Execute that query by calling :meth:`cur.execute(...) `, assign the result to ``res``, and call :meth:`res.fetchone() " -"` to fetch the resulting row:" +"details). Execute that query by calling :meth:`cur.execute(...) " +"`, assign the result to ``res``, and " +"call :meth:`res.fetchone() ` to fetch the resulting row:" msgstr "" "SQLite に組み込みの ``sqlite_master`` テーブルに対してクエリを実行すること" "で、新しいテーブルが作成されたことを確認できます。このテーブルには、 " "``movie`` テーブル定義のエントリが含まれているはずです(詳細は `The Schema " "Table`_ 参照)。 :meth:`cur.execute(...) ` を呼び出してクエリ" -"を実行して、その結果を ``res`` に代入し、結果の行(row)を取得するために :meth:" -"`res.fetchone() ` を呼び出します:" +"を実行して、その結果を ``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``:" +"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(...) `:" +"``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,13 +249,18 @@ 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 "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" -"controlling-transactions` for details). Call :meth:`con.commit() ` on the connection object to commit the transaction:" +"controlling-transactions` for details). Call :meth:`con.commit() " +"` on the connection object to commit the transaction:" msgstr "" "``INSERT`` 文は、変更がデータベースに保存される前にコミットする必要がある、ト" "ランザクションを暗黙的に開きます(詳細は、 :ref:`sqlite3-controlling-" @@ -258,46 +268,45 @@ msgstr "" "(connection object)の :meth:`con.commit() ` を呼び出して下" "さい:" -#: ../../library/sqlite3.rst:156 msgid "con.commit()" -msgstr "" +msgstr "con.commit()" #: ../../library/sqlite3.rst:160 msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " -"assign the result to ``res``, and call :meth:`res.fetchall() ` to return all resulting rows:" +"assign the result to ``res``, and call :meth:`res.fetchall() " +"` to return all resulting rows:" msgstr "" "``SELECT`` クエリを実行することで、データが正しく挿入されたことを確認できま" -"す。 結果のすべての行を返すには、おなじみの :meth:`cur.execute(...) ` を使用して結果を ``res`` に代入し、 :meth:`res.fetchall() ` を呼び出して下さい:" +"す。 結果のすべての行を返すには、おなじみの :meth:`cur.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 "" -"Now, insert three more rows by calling :meth:`cur.executemany(...) `:" +"Now, insert three more rows by calling :meth:`cur.executemany(...) " +"`:" 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 +316,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 +345,6 @@ msgstr "" "``SELECT`` クエリを実行することで、新しい行が挿入されたことを確認できます。今" "回は、クエリの結果を反復処理します:" -#: ../../library/sqlite3.rst:198 msgid "" ">>> for row in cur.execute(\"SELECT year, title FROM movie ORDER BY " "year\"):\n" @@ -340,6 +355,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 "" @@ -351,16 +374,16 @@ msgstr "" #: ../../library/sqlite3.rst:211 msgid "" -"Finally, verify that the database has been written to disk by calling :meth:" -"`con.close() ` to close the existing connection, opening a " -"new one, creating a new cursor, then querying the database:" +"Finally, verify that the database has been written to disk by " +"calling :meth:`con.close() ` to close the existing " +"connection, opening a new one, creating a new cursor, then querying the " +"database:" msgstr "" "最後に、 :meth:`con.close() ` を呼び出して既存の接続" "(connection)を閉じ、新しい接続を開き、新しいカーソルを作成してから、データ" "ベースに対してクエリを実行して、データベースがディスクに書き込まれたことを確" "認します:" -#: ../../library/sqlite3.rst:216 msgid "" ">>> con.close()\n" ">>> new_con = sqlite3.connect(\"tutorial.db\")\n" @@ -374,6 +397,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,18 +465,20 @@ 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 "" -"How many seconds the connection should wait before raising an :exc:" -"`OperationalError` when a table is locked. If another connection opens a " -"transaction to modify a table, that table will be locked until the " +"How many seconds the connection should wait before raising " +"an :exc:`OperationalError` when a table is locked. If another connection " +"opens a transaction to modify a table, that table will be locked until the " "transaction is committed. Default five seconds." msgstr "" "テーブルがロックされている場合、 :exc:`OperationalError` を送出する前に接続を" @@ -455,20 +491,29 @@ msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "converters registered with :func:`register_converter`. Set it to any " -"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" -"`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " -"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 " -"more information. Can be ``\"DEFERRED\"`` (default), ``\"EXCLUSIVE\"`` or " -"``\"IMMEDIATE\"``; or ``None`` to disable opening transactions implicitly. " -"Has no effect unless :attr:`Connection.autocommit` is set to :const:" -"`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." -msgstr "" +"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` " +"and :const:`PARSE_COLNAMES` to enable this. Column names takes precedence " +"over declared types if both flags are set. By default (``0``), type " +"detection is disabled." +msgstr "" + +msgid "" +"Control legacy transaction handling behaviour. " +"See :attr:`Connection.isolation_level` and :ref:`sqlite3-transaction-control-" +"isolation-level` for more information. Can be ``\"DEFERRED\"`` (default), " +"``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or ``None`` to disable opening " +"transactions implicitly. 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,34 +561,37 @@ 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 " -"information. *autocommit* currently defaults to :const:`~sqlite3." -"LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " -"future Python release." +"Control :pep:`249` transaction handling behaviour. " +"See :attr:`Connection.autocommit` and :ref:`sqlite3-transaction-control-" +"autocommit` for more information. *autocommit* currently defaults " +"to :const:`~sqlite3.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`` を送出します。 " +"引数 ``database`` を指定して :ref:`監査イベント ` " +"``sqlite3.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 +604,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 +632,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 +661,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 +668,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 "" @@ -717,11 +771,10 @@ msgstr "" #: ../../library/sqlite3.rst:459 msgid "" -"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. Use :" -"const:`!PARSE_COLNAMES` to enforce types for such queries." +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. " +"Use :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 +782,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 +800,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`)," @@ -800,8 +856,8 @@ msgstr "" #: ../../library/sqlite3.rst:510 msgid "" -"Version number of the runtime SQLite library as a :class:`tuple` of :class:" -"`integers `." +"Version number of the runtime SQLite library as a :class:`tuple` " +"of :class:`integers `." msgstr "" ":class:`整数 ` の :class:`タプル ` としての、ランタイム SQLite ラ" "イブラリのバージョン番号。" @@ -857,9 +913,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`_" @@ -916,11 +971,11 @@ msgstr "" #: ../../library/sqlite3.rst:569 msgid "" -"These constants are used for the :meth:`Connection.setconfig` and :meth:" -"`~Connection.getconfig` methods." +"These constants are used for the :meth:`Connection.setconfig` " +"and :meth:`~Connection.getconfig` methods." msgstr "" -"これらの定数は、 :meth:`Connection.setconfig` メソッド や :meth:`~Connection." -"getconfig` メソッドで使用されます。" +"これらの定数は、 :meth:`Connection.setconfig` メソッド " +"や :meth:`~Connection.getconfig` メソッドで使用されます。" #: ../../library/sqlite3.rst:572 msgid "" @@ -930,17 +985,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" @@ -949,8 +1001,9 @@ msgstr "Connection オブジェクト" #: ../../library/sqlite3.rst:592 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " -"is created using :func:`sqlite3.connect`. Their main purpose is creating :" -"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." +"is created using :func:`sqlite3.connect`. Their main purpose is " +"creating :class:`Cursor` objects, and :ref:`sqlite3-controlling-" +"transactions`." msgstr "" "開いた SQLite データベースの各々は、 :func:`sqlite3.connect` を使用して作成さ" "れる ``Connection`` オブジェクトによって表されます。``Connection`` オブジェク" @@ -961,11 +1014,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." +"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:" @@ -975,8 +1029,9 @@ msgstr "" #: ../../library/sqlite3.rst:612 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " -"single optional parameter *factory*. If supplied, this must be a :term:" -"`callable` returning an instance of :class:`Cursor` or its subclasses." +"single optional parameter *factory*. If supplied, this must be " +"a :term:`callable` returning an instance of :class:`Cursor` or its " +"subclasses." msgstr "" ":class:`Cursor` オブジェクトを作成して返します。 cursor メソッドは、単一のオ" "プション・パラメーター *factory* を受け入れます。 *factory* を指定する場合、" @@ -1017,9 +1072,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." @@ -1036,9 +1090,9 @@ msgstr "" #: ../../library/sqlite3.rst:654 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was committed by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was committed by this method." msgstr "" "保留中のトランザクションをデータベースにコミットします。 :attr:`autocommit` " "が ``True`` または開いているトランザクションがない場合、このメソッドは何も行" @@ -1049,9 +1103,9 @@ msgstr "" #: ../../library/sqlite3.rst:662 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was rolled back by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was rolled back by this method." msgstr "" "保留中のトランザクションの先頭にロールバックします。 :attr:`autocommit` が " "``True`` または開いているトランザクションがない場合、このメソッドは何も行いま" @@ -1059,7 +1113,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 +1120,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 "" @@ -1096,9 +1151,9 @@ msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -"新しい :class:`Cursor` オブジェクトを作成し、指定された *sql_script* で :" -"meth:`~Cursor.executescript` を呼び出します。新しいカーソル・オブジェクトを返" -"します。" +"新しい :class:`Cursor` オブジェクトを作成し、指定された *sql_script* " +"で :meth:`~Cursor.executescript` を呼び出します。新しいカーソル・オブジェクト" +"を返します。" #: ../../library/sqlite3.rst:698 msgid "Create or remove a user-defined SQL function." @@ -1116,16 +1171,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 +1192,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 +1201,6 @@ msgstr "" msgid "Example:" msgstr "例:" -#: ../../library/sqlite3.rst:724 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -1159,6 +1212,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 +1244,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 +1251,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 +1286,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 +1307,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 +1397,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 +1443,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 +1514,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 +1533,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``." @@ -1422,27 +1566,27 @@ msgstr "" #: ../../library/sqlite3.rst:935 msgid "" "Call this method from a different thread to abort any queries that might be " -"executing on the connection. Aborted queries will raise an :exc:" -"`OperationalError`." +"executing on the connection. Aborted queries will raise " +"an :exc:`OperationalError`." msgstr "" "このメソッドを別のスレッドから呼び出して、この接続(connection)で、実行中のす" -"べてのクエリを中止(abort)させます。 中止(abort)させられたクエリは :exc:" -"`OperationalError` を送出します。" +"べてのクエリを中止(abort)させます。 中止(abort)させられたクエリ" +"は :exc:`OperationalError` を送出します。" #: ../../library/sqlite3.rst:942 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " -"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" -"`SQLITE_IGNORE` to signal how access to the column should be handled by the " -"underlying SQLite library." +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, " +"or :const:`SQLITE_IGNORE` to signal how access to the column should be " +"handled by the underlying SQLite library." msgstr "" -"データベース内のテーブルの列(column)にアクセスしようとするたびに起動される :" -"term:`呼び出し可能オブジェクト ` *authorizer_callback* を登録しま" -"す。 このコールバックは背後の SQLite ライブラリによって列(column)へのアクセス" -"がどのように処理されるかを通知するために、 :const:`SQLITE_OK` または :const:" -"`SQLITE_DENY` または :const:`SQLITE_IGNORE` のいずれかを返さなければなりませ" -"ん。" +"データベース内のテーブルの列(column)にアクセスしようとするたびに起動され" +"る :term:`呼び出し可能オブジェクト ` *authorizer_callback* を登録し" +"ます。 このコールバックは背後の SQLite ライブラリによって列(column)へのアクセ" +"スがどのように処理されるかを通知するために、 :const:`SQLITE_OK` また" +"は :const:`SQLITE_DENY` または :const:`SQLITE_IGNORE` のいずれかを返さなけれ" +"ばなりません。" #: ../../library/sqlite3.rst:949 msgid "" @@ -1468,8 +1612,8 @@ msgid "" "module." msgstr "" "最初の引数に指定可能な値と、 最初の引数に応じた 2 番目と 3 番目の引数の意味に" -"ついては、 SQLite のドキュメントを参照してください。 必要なすべての定数は :" -"mod:`!sqlite3` モジュールで利用できます。" +"ついては、 SQLite のドキュメントを参照してください。 必要なすべての定数" +"は :mod:`!sqlite3` モジュールで利用できます。" #: ../../library/sqlite3.rst:960 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." @@ -1535,17 +1679,18 @@ msgstr "" msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " -"that the backend does not only run statements passed to the :meth:`Cursor." -"execute` methods. Other sources include the :ref:`transaction management " -"` of the :mod:`!sqlite3` module and the " -"execution of triggers defined in the current database." +"that the backend does not only run statements passed to " +"the :meth:`Cursor.execute` methods. Other sources include " +"the :ref:`transaction management ` of " +"the :mod:`!sqlite3` module and the execution of triggers defined in the " +"current database." msgstr "" "コールバックに渡される唯一の引数は、(:class:`str` として渡される)実行中のSQL" -"文です。 コールバックの戻り値は無視されます。 バックエンドは、 :meth:`Cursor." -"execute` メソッドに渡されたSQL文を実行するだけではないことに注意してくださ" -"い。 :mod:`!sqlite3` モジュールの :ref:`トランザクション管理 ` や、現在のデータベース内で定義されたトリガーの実行" -"その他も行います。" +"文です。 コールバックの戻り値は無視されます。 バックエンド" +"は、 :meth:`Cursor.execute` メソッドに渡されたSQL文を実行するだけではないこと" +"に注意してください。 :mod:`!sqlite3` モジュールの :ref:`トランザクション管理 " +"` や、現在のデータベース内で定義されたトリ" +"ガーの実行その他も行います。" #: ../../library/sqlite3.rst:1002 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." @@ -1588,8 +1733,8 @@ msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " "are compiled without this feature. To get loadable extension support, you " -"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" -"program:`configure`." +"must pass the :option:`--enable-loadable-sqlite-extensions` option " +"to :program:`configure`." msgstr "" ":mod:`!sqlite3` モジュールは、デフォルトではロード可能な拡張機能をサポートす" "るようにビルドされていません。一部のプラットフォーム(特に macOS)には、この機" @@ -1597,19 +1742,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 +1781,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,40 +1831,40 @@ 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 "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " -"when saving an in-memory database for later restoration. Similar to the ``." -"dump`` command in the :program:`sqlite3` shell." +"when saving an in-memory database for later restoration. Similar to the " +"``.dump`` command in the :program:`sqlite3` shell." msgstr "" "データベースを SQL ソース・コードとしてダンプする :term:`iterator` を返しま" -"す。 後で復元するためにメモリ内データベースを保存する場合に便利です。 :" -"program:`sqlite3` シェルの ``.dump`` コマンドに似ています。" +"す。 後で復元するためにメモリ内データベースを保存する場合に便利で" +"す。 :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 +1873,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 +1944,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 +1955,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 +1976,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." @@ -1812,17 +1998,18 @@ msgstr "" #: ../../library/sqlite3.rst:1214 msgid "" -"Example, query the maximum length of an SQL statement for :class:" -"`Connection` ``con`` (the default is 1000000000):" +"Example, query the maximum length of an SQL statement " +"for :class:`Connection` ``con`` (the default is 1000000000):" 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 +2039,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." @@ -1909,10 +2099,10 @@ msgstr "" #: ../../library/sqlite3.rst:1318 msgid "" -"Deserialize a :meth:`serialized ` database into a :class:" -"`Connection`. This method causes the database connection to disconnect from " -"database *name*, and reopen *name* as an in-memory database based on the " -"serialization contained in *data*." +"Deserialize a :meth:`serialized ` database into " +"a :class:`Connection`. This method causes the database connection to " +"disconnect from database *name*, and reopen *name* as an in-memory database " +"based on the serialization contained in *data*." msgstr "" ":meth:`直列化 ` されたデータベースを :class:`Connection` に、 脱直" "列化(deserialize)します。 このメソッドにより、 データベース接続はデータベー" @@ -1951,36 +2141,34 @@ 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 "" -"``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" -"mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" -"meth:`rollback` to close transactions." +"``False``: Select :pep:`249`-compliant transaction behaviour, implying " +"that :mod:`!sqlite3` ensures a transaction is always open. " +"Use :meth:`commit` and :meth:`rollback` to close transactions." msgstr "" -"``False``: :pep:`249` 対応のトランザクションの振る舞いを選びます。 これは、 :" -"mod:`!sqlite3` が、 トランザクションが常に開いていることを保証することを意味" -"します。トランザクションを閉じるには、 :meth:`commit` や :meth:`rollback` を" -"使用します。" +"``False``: :pep:`249` 対応のトランザクションの振る舞いを選びます。 これ" +"は、 :mod:`!sqlite3` が、 トランザクションが常に開いていることを保証すること" +"を意味します。トランザクションを閉じるには、 :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 "" -"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" -"`rollback` have no effect in this mode." +"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` " +"and :meth:`rollback` have no effect in this mode." msgstr "" -"``True``: SQLite の `autocommit mode`_ を使用します。このモードでは :meth:" -"`commit` や :meth:`rollback` は効果がありません。" +"``True``: SQLite の `autocommit mode`_ を使用します。このモードで" +"は :meth:`commit` や :meth:`rollback` は効果がありません。" #: ../../library/sqlite3.rst:1362 msgid "" @@ -1991,16 +2179,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 @@ -2010,11 +2196,11 @@ msgstr "" #: ../../library/sqlite3.rst:1375 msgid "" -"The :attr:`isolation_level` attribute has no effect unless :attr:" -"`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." +"The :attr:`isolation_level` attribute has no effect " +"unless :attr:`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -":attr:`isolation_level` 属性は、 :attr:`autocommit` の値が :data:" -"`LEGACY_TRANSACTION_CONTROL` でない限り、効果がありません。" +":attr:`isolation_level` 属性は、 :attr:`autocommit` の値" +"が :data:`LEGACY_TRANSACTION_CONTROL` でない限り、効果がありません。" #: ../../library/sqlite3.rst:1382 msgid "" @@ -2063,23 +2249,23 @@ msgid "" "default)." msgstr "" "トランザクション処理を制御するには、 :attr:`!isolation_level` を使用するより" -"も :attr:`autocommit` を使用することをお勧めします。 :attr:`autocommit` が :" -"data:`LEGACY_TRANSACTION_CONTROL` (これがデフォルトです)に設定されていない限" -"り、 :attr:`!isolation_level` は効果がありません。" +"も :attr:`autocommit` を使用することをお勧めします。 :attr:`autocommit` " +"が :data:`LEGACY_TRANSACTION_CONTROL` (これがデフォルトです)に設定されていな" +"い限り、 :attr:`!isolation_level` は効果がありません。" #: ../../library/sqlite3.rst:1412 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " -"from this connection. Assigning to this attribute does not affect the :attr:" -"`!row_factory` of existing cursors belonging to this connection, only new " -"ones. Is ``None`` by default, meaning each row is returned as a :class:" -"`tuple`." +"from this connection. Assigning to this attribute does not affect " +"the :attr:`!row_factory` of existing cursors belonging to this connection, " +"only new ones. Is ``None`` by default, meaning each row is returned as " +"a :class:`tuple`." msgstr "" -"この接続から作成された :class:`Cursor` オブジェクトの初期 :attr:`~Cursor." -"row_factory` 。この属性に割り当てを行っても、 この接続に属する、すでに存在す" -"るカーソルの :attr:`!row_factory` には影響せず、 この属性に割り当てを行った後" -"に作成する新しいカーソルのみに影響します。 デフォルトでは ``None`` です。つま" -"り、各行は :class:`タプル ` として返されます。" +"この接続から作成された :class:`Cursor` オブジェクトの初" +"期 :attr:`~Cursor.row_factory` 。この属性に割り当てを行っても、 この接続に属" +"する、すでに存在するカーソルの :attr:`!row_factory` には影響せず、 この属性に" +"割り当てを行った後に作成する新しいカーソルのみに影響します。 デフォルトでは " +"``None`` です。つまり、各行は :class:`タプル ` として返されます。" #: ../../library/sqlite3.rst:1419 ../../library/sqlite3.rst:1705 #: ../../library/sqlite3.rst:1728 @@ -2094,12 +2280,11 @@ msgid "" msgstr "" ":class:`bytes` のパラメータを受け取り、そのテキスト表現を返す :term:`呼び出し" "可能オブジェクト ` です。呼び出し可能オブジェクトは ``TEXT`` データ" -"型である SQLite 値に対して呼び出されます。 デフォルトでは、 この属性は :" -"class:`str` に設定されています。" +"型である 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 "" @@ -2117,8 +2302,8 @@ msgstr "Cursor オブジェクト" msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " -"created using :meth:`Connection.cursor`, or by using any of the :ref:" -"`connection shortcut methods `." +"created using :meth:`Connection.cursor`, or by using any of " +"the :ref:`connection shortcut methods `." msgstr "" "``Cursor`` オブジェクトは、 SQL 文を実行し、 取得操作(fetch operation)のコン" "テキストを管理するために使用されるデータベース・カーソル(`database cursor`_)" @@ -2128,29 +2313,32 @@ msgstr "" #: ../../library/sqlite3.rst:1448 msgid "" -"Cursor objects are :term:`iterators `, meaning that if you :meth:" -"`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " -"to fetch the resulting rows:" +"Cursor objects are :term:`iterators `, meaning that if " +"you :meth:`~Cursor.execute` a ``SELECT`` query, you can simply iterate over " +"the cursor to fetch the resulting rows:" msgstr "" "カーソル・オブジェクトは :term:`イテレータ ` です。つまり、 " "``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 `." +"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." @@ -2173,10 +2361,11 @@ msgstr "*sql* に複数の SQL 文が含まれている場合。" #: ../../library/sqlite3.rst:1497 msgid "" -"If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" -"attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " -"``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is no open " -"transaction, a transaction is implicitly opened before executing *sql*." +"If :attr:`~Connection.autocommit` " +"is :data:`LEGACY_TRANSACTION_CONTROL`, :attr:`~Connection.isolation_level` " +"is not ``None``, *sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or " +"``REPLACE`` statement, and there is no open transaction, a transaction is " +"implicitly opened before executing *sql*." msgstr "" ":attr:`~Connection.autocommit` が :data:`LEGACY_TRANSACTION_CONTROL` で、か" "つ、 :attr:`~Connection.isolation_level` が ``None`` で無く、 かつ、 *sql* " @@ -2187,14 +2376,14 @@ msgstr "" #: ../../library/sqlite3.rst:1506 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" -"`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be raised " -"instead." +"placeholders>` are used and *parameters* is a sequence instead of " +"a :class:`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be " +"raised instead." msgstr "" ":ref:`名前付きプレースホルダー` が使用され、かつ、パラ" -"メーターが :class:`dict` ではなくシーケンスである場合、 :exc:" -"`DeprecationWarning` を送出します。 Python 3.14 以降では、代わりに :exc:" -"`ProgrammingError` を送出します。" +"メーターが :class:`dict` ではなくシーケンスである場" +"合、 :exc:`DeprecationWarning` を送出します。 Python 3.14 以降では、代わり" +"に :exc:`ProgrammingError` を送出します。" #: ../../library/sqlite3.rst:1512 msgid "Use :meth:`executescript` to execute multiple SQL statements." @@ -2232,7 +2421,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 +2429,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 "" @@ -2258,17 +2452,17 @@ msgid "" "be raised instead." msgstr "" ":ref:`名前付きプレースホルダー` が使用され、かつ、パラ" -"メーターが :class:`dict` ではなくシーケンスである場合、 :exc:" -"`DeprecationWarning` を送出します。 Python 3.14 以降では、代わりに :exc:" -"`ProgrammingError` を送出します。" +"メーターが :class:`dict` ではなくシーケンスである場" +"合、 :exc:`DeprecationWarning` を送出します。 Python 3.14 以降では、代わり" +"に :exc:`ProgrammingError` を送出します。" #: ../../library/sqlite3.rst:1568 msgid "" -"Execute the SQL statements in *sql_script*. If the :attr:`~Connection." -"autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " -"transaction, an implicit ``COMMIT`` statement is executed first. No other " -"implicit transaction control is performed; any transaction control must be " -"added to *sql_script*." +"Execute the SQL statements in *sql_script*. If " +"the :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and " +"there is a pending transaction, an implicit ``COMMIT`` statement is executed " +"first. No other implicit transaction control is performed; any transaction " +"control must be added to *sql_script*." msgstr "" "*sql_script* 内の複数のSQL文を実行します。 :attr:`~Connection.autocommit` " "が :data:`LEGACY_TRANSACTION_CONTROL` で、かつ、保留中のトランザクションがあ" @@ -2280,7 +2474,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 +2484,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 "" @@ -2350,9 +2550,9 @@ msgstr "(``__del__`` が呼び出される時ではなく、) 今すぐカーソ #: ../../library/sqlite3.rst:1626 msgid "" -"The cursor will be unusable from this point forward; a :exc:" -"`ProgrammingError` exception will be raised if any operation is attempted " -"with the cursor." +"The cursor will be unusable from this point forward; " +"a :exc:`ProgrammingError` exception will be raised if any operation is " +"attempted with the cursor." msgstr "" "この時点から、このカーソルは使用できなくなります。今後、このカーソルで何らか" "の操作を試みると、 :exc:`ProgrammingError` 例外が送出されます。" @@ -2363,9 +2563,9 @@ msgstr "DB-API で必要です。 :mod:`!sqlite3` では何もしません。" #: ../../library/sqlite3.rst:1639 msgid "" -"Read/write attribute that controls the number of rows returned by :meth:" -"`fetchmany`. The default value is 1 which means a single row would be " -"fetched per call." +"Read/write attribute that controls the number of rows returned " +"by :meth:`fetchmany`. The default value is 1 which means a single row would " +"be fetched per call." msgstr "" ":meth:`fetchmany` によって返される行(row)数を制御する、読み取りと書き込みが可" "能な属性。 デフォルト値は 1 で、これは呼び出しごとに 1 行が取得されることを意" @@ -2374,16 +2574,15 @@ msgstr "" #: ../../library/sqlite3.rst:1644 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" -"`con.cursor() ` will have a :attr:`connection` attribute " -"that refers to *con*:" +"belonging to the cursor. A :class:`Cursor` object created by " +"calling :meth:`con.cursor() ` will have " +"a :attr:`connection` attribute that refers to *con*:" msgstr "" "カーソルが属する SQLite データベース :class:`Connection` を提供する読み取り専" -"用属性。 :meth:`con.cursor() ` と呼び出して作成した :" -"class:`Cursor` オブジェクトには、*con* を参照する :attr:`connection` 属性があ" -"ります:" +"用属性。 :meth:`con.cursor() ` と呼び出して作成し" +"た :class:`Cursor` オブジェクトには、*con* を参照する :attr:`connection` 属性" +"があります:" -#: ../../library/sqlite3.rst:1649 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2391,6 +2590,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 "" @@ -2417,11 +2621,11 @@ msgid "" "``lastrowid`` is left unchanged. The initial value of ``lastrowid`` is " "``None``." msgstr "" -"最後に挿入された行の行 ID (row id) を提供する読み取り専用属性。 :meth:" -"`execute` で ``INSERT`` または ``REPLACE`` 文が成功した後にのみ更新されま" -"す。他のSQL文や、 :meth:`executemany` の後や、 :meth:`executescript` の後" -"や、 挿入が失敗した場合、 ``lastrowid`` の値は変更されません。``lastrowid`` " -"の初期値は ``None`` です。" +"最後に挿入された行の行 ID (row id) を提供する読み取り専用属" +"性。 :meth:`execute` で ``INSERT`` または ``REPLACE`` 文が成功した後にのみ更" +"新されます。他のSQL文や、 :meth:`executemany` の後や、 :meth:`executescript` " +"の後や、 挿入が失敗した場合、 ``lastrowid`` の値は変更されません。" +"``lastrowid`` の初期値は ``None`` です。" #: ../../library/sqlite3.rst:1675 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." @@ -2431,7 +2635,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 +2643,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 +2659,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." +"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" @@ -2478,10 +2682,10 @@ msgstr "Row オブジェクト" #: ../../library/sqlite3.rst:1720 msgid "" -"A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." -"row_factory` for :class:`Connection` objects. It supports iteration, " -"equality testing, :func:`len`, and :term:`mapping` access by column name and " -"index." +"A :class:`!Row` instance serves as a highly " +"optimized :attr:`~Connection.row_factory` for :class:`Connection` objects. " +"It supports iteration, equality testing, :func:`len`, and :term:`mapping` " +"access by column name and index." msgstr "" ":class:`!Row` インスタンスは、 :class:`Connection` オブジェクトの、高度に最適" "化された :attr:`~Connection.row_factory` の役割をします。 反復(iteration)や、" @@ -2497,15 +2701,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`." +"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." @@ -2518,9 +2721,9 @@ msgstr "Blob オブジェクト" #: ../../library/sqlite3.rst:1749 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " -"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" -"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " -"and :term:`slices ` for direct access to the blob data." +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. " +"Call :func:`len(blob) ` to get the size (number of bytes) of the blob. " +"Use indices and :term:`slices ` for direct access to the blob data." msgstr "" ":class:`Blob` インスタンスは、 SQLite の :abbr:`BLOB (Binary Large OBject)` " "とデータを読み書きできる :term:`file-like object` です。 :func:`len(blob) " @@ -2535,7 +2738,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 +2758,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." @@ -2563,47 +2783,49 @@ msgstr "Blob を閉じます。" #: ../../library/sqlite3.rst:1787 msgid "" -"The blob will be unusable from this point onward. An :class:`~sqlite3." -"Error` (or subclass) exception will be raised if any further operation is " -"attempted with the blob." +"The blob will be unusable from this point onward. " +"An :class:`~sqlite3.Error` (or subclass) exception will be raised if any " +"further operation is attempted with the blob." 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." +"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 "" "Write *data* to the blob at the current offset. This function cannot change " -"the blob length. Writing beyond the end of the blob will raise :exc:" -"`ValueError`." +"the blob length. Writing beyond the end of the blob will " +"raise :exc:`ValueError`." msgstr "" "BLOB の現在のオフセット位置から *data* を書き込みます。 この関数では BLOB の" -"長さを変更できません。 BLOB の末尾を超えて書き込もうとすると :exc:" -"`ValueError` を送出します。" +"長さを変更できません。 BLOB の末尾を超えて書き込もうとする" +"と :exc:`ValueError` を送出します。" #: ../../library/sqlite3.rst:1807 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" @@ -2637,8 +2859,8 @@ msgid "" msgstr "" "この例外は、現在 :mod:`!sqlite3` モジュールでは送出しませんが、ユーザー定義関" "数が挿入処理中にデータを切り捨てる場合など、:mod:`!sqlite3` を使用するアプリ" -"ケーションによって送出されるる可能性があります。 ``Warning`` は :exc:" -"`Exception` のサブクラスです。" +"ケーションによって送出されるる可能性があります。 ``Warning`` " +"は :exc:`Exception` のサブクラスです。" #: ../../library/sqlite3.rst:1844 msgid "" @@ -2646,9 +2868,9 @@ msgid "" "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -"このモジュールの他の例外の基底となるクラス。 これを使用すると、1 つの :" -"keyword:`except` 文ですべてのエラーをキャッチできます。 ``Error`` は :exc:" -"`Exception` のサブクラスです。" +"このモジュールの他の例外の基底となるクラス。 これを使用すると、1 つ" +"の :keyword:`except` 文ですべてのエラーをキャッチできます。 ``Error`` " +"は :exc:`Exception` のサブクラスです。" #: ../../library/sqlite3.rst:1848 msgid "" @@ -2660,8 +2882,8 @@ msgstr "" #: ../../library/sqlite3.rst:1853 msgid "" -"The numeric error code from the `SQLite API `_" +"The numeric error code from the `SQLite API `_" msgstr "" "`SQLite API `_ からの数値エラー・コード" @@ -2692,8 +2914,8 @@ msgid "" msgstr "" "データベースに関連するエラーに対して送出される例外。 これは、いくつかの種類の" "データベース・エラーの基底の例外として機能します。 これを特殊化(specialise)し" -"たサブクラスを介して暗黙的にのみ送出されます。 ``DatabaseError`` は :exc:" -"`Error` のサブクラスです。" +"たサブクラスを介して暗黙的にのみ送出されます。 ``DatabaseError`` " +"は :exc:`Error` のサブクラスです。" #: ../../library/sqlite3.rst:1881 msgid "" @@ -2740,13 +2962,13 @@ msgstr "" msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " -"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" -"`DatabaseError`." +"closed :class:`Connection`. ``ProgrammingError`` is a subclass " +"of :exc:`DatabaseError`." msgstr "" ":mod:`!sqlite3` API プログラミング・エラーに対して送出される例外。たとえば、" -"クエリに間違った数のバインディング(結び付け)を指定したり、閉じた後の :class:" -"`Connection` を操作しようとしたりしたとき。 ``ProgrammingError`` は :exc:" -"`DatabaseError` のサブクラスです。" +"クエリに間違った数のバインディング(結び付け)を指定したり、閉じた後" +"の :class:`Connection` を操作しようとしたりしたとき。 ``ProgrammingError`` " +"は :exc:`DatabaseError` のサブクラスです。" #: ../../library/sqlite3.rst:1914 msgid "" @@ -2758,9 +2980,9 @@ msgid "" msgstr "" "メソッドまたはデータベース API が 背後の SQLite ライブラリでサポートしていな" "い場合に送出される例外。たとえば、背後の SQLite ライブラリが決定論的関数" -"(deterministic functions)をサポートしていない場合に、:meth:`~Connection." -"create_function` で *deterministic* を ``True`` に設定したとき。 " -"``NotSupportedError`` は :exc:`DatabaseError` のサブクラスです。" +"(deterministic functions)をサポートしていない場合" +"に、:meth:`~Connection.create_function` で *deterministic* を ``True`` に設定" +"したとき。 ``NotSupportedError`` は :exc:`DatabaseError` のサブクラスです。" #: ../../library/sqlite3.rst:1924 msgid "SQLite and Python types" @@ -2889,11 +3111,11 @@ msgstr "" #: ../../library/sqlite3.rst:1987 msgid "" -"A converter for :ref:`declared ` \"date\" types to :" -"class:`datetime.date` objects." +"A converter for :ref:`declared ` \"date\" types " +"to :class:`datetime.date` objects." msgstr "" -"\"date\" と :ref:`宣言された ` 型を :class:`datetime." -"date` オブジェクトにする変換関数(converter)。" +"\"date\" と :ref:`宣言された ` 型" +"を :class:`datetime.date` オブジェクトにする変換関数(converter)。" #: ../../library/sqlite3.rst:1989 msgid "" @@ -2930,9 +3152,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 +3188,6 @@ msgstr "" "のように単純にシングルクォートを閉じて ``OR TRUE`` を挿入してすべての行を選択" "できます::" -#: ../../library/sqlite3.rst:2047 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2977,6 +3197,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 "" @@ -2986,9 +3213,10 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" "代わりに、DB-API のパラメータ割り当てを使います。クエリ文字列にPythonの変数を" -"挿入するには、クエリ文字列中でプレースホルダを使用し、 かつ、 カーソルの :" -"meth:`~Cursor.execute` メソッドの 2 番目の引数にPythonの変数を値の :class:`タ" -"プル ` として指定することにより、 実際の値をクエリに割り当てます。" +"挿入するには、クエリ文字列中でプレースホルダを使用し、 かつ、 カーソル" +"の :meth:`~Cursor.execute` メソッドの 2 番目の引数にPythonの変数を値" +"の :class:`タプル ` として指定することにより、 実際の値をクエリに割り" +"当てます。" #: ../../library/sqlite3.rst:2060 msgid "" @@ -3009,7 +3237,6 @@ msgstr "" "があり、すべての名前付きパラメーターのキーが含まれている必要があります。余分" "な項目は無視されます。両方のスタイルの例を以下に示します。" -#: ../../library/sqlite3.rst:2071 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -3029,6 +3256,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 +3332,6 @@ msgstr "" "きます。 *protocol* に渡されるオブジェクトは、 :class:`PrepareProtocol` 型に" "なります。" -#: ../../library/sqlite3.rst:2133 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -3105,6 +3348,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 +3377,6 @@ msgstr "" "ことが挙げられます。 この関数は、 :func:`register_adapter` を使用して登録でき" "ます。" -#: ../../library/sqlite3.rst:2163 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -3138,6 +3394,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 +3432,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 +3447,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`" @@ -3204,8 +3476,8 @@ msgstr "明示的: *detect_types* に :const:`PARSE_COLNAMES` と設定。" #: ../../library/sqlite3.rst:2220 msgid "" -"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." -"PARSE_COLNAMES``. Column names take precedence over declared types." +"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | " +"sqlite3.PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" "両方: *detect_types* に ``sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES`` " "を設定。列名での指定は、宣言時の型よりも優先されます。" @@ -3215,7 +3487,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 +3527,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" @@ -3309,24 +3618,23 @@ msgstr "接続(connection)ショートカット・メソッドの使い方" #: ../../library/sqlite3.rst:2343 msgid "" -"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" -"meth:`~Connection.executescript` methods of the :class:`Connection` class, " -"your code can be written more concisely because you don't have to create the " -"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" -"`Cursor` objects are created implicitly and these shortcut methods return " -"the cursor objects. This way, you can execute a ``SELECT`` statement and " -"iterate over it directly using only a single call on the :class:`Connection` " -"object." -msgstr "" -":class:`Connection` クラスのメソッド :meth:`~Connection.execute` と :meth:" -"`~Connection.executemany` と :meth:`~Connection.executescript` を使うこと" -"で、 (しばしば余計な) :class:`Cursor` オブジェクトをわざわざ作り出さずに済む" -"ので、コードをより簡潔に書くことができます。 :class:`Cursor` オブジェクトは暗" -"黙裡に生成され、ショートカット・メソッドの戻り値として受け取ることができま" -"す。この方法を使えば、 ``SELECT`` 文を実行してその結果について反復すること" -"が、 :class:`Connection` オブジェクトに対する呼び出し一つで行なえます。" - -#: ../../library/sqlite3.rst:2352 +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, " +"and :meth:`~Connection.executescript` methods of the :class:`Connection` " +"class, your code can be written more concisely because you don't have to " +"create the (often superfluous) :class:`Cursor` objects explicitly. Instead, " +"the :class:`Cursor` objects are created implicitly and these shortcut " +"methods return the cursor objects. This way, you can execute a ``SELECT`` " +"statement and iterate over it directly using only a single call on " +"the :class:`Connection` object." +msgstr "" +":class:`Connection` クラスのメソッド :meth:`~Connection.execute` " +"と :meth:`~Connection.executemany` と :meth:`~Connection.executescript` を使" +"うことで、 (しばしば余計な) :class:`Cursor` オブジェクトをわざわざ作り出さず" +"に済むので、コードをより簡潔に書くことができます。 :class:`Cursor` オブジェク" +"トは暗黙裡に生成され、ショートカット・メソッドの戻り値として受け取ることがで" +"きます。この方法を使えば、 ``SELECT`` 文を実行してその結果について反復するこ" +"とが、 :class:`Connection` オブジェクトに対する呼び出し一つで行なえます。" + msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -3349,6 +3657,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 +3694,9 @@ msgid "" "rolling back." msgstr "" ":class:`Connection` オブジェクトは、コンテキスト・マネージャーとして使用で" -"き、コンテキスト・マネージャーとして使用すると、 :keyword:`with` ブロックを離" -"れるときに、開いているトランザクションを自動的にコミットまたはロールバックし" -"ます。 :keyword:`with` 文のブロックが例外なく終了すると、トランザクションはコ" +"き、コンテキスト・マネージャーとして使用すると、 ``with`` ブロックを離れると" +"きに、開いているトランザクションを自動的にコミットまたはロールバックしま" +"す。 :keyword:`with` 文のブロックが例外なく終了すると、トランザクションはコ" "ミットされます。このコミットが失敗した、または、 ``with`` 文のブロックで" "キャッチされなかった例外が発生した場合、トランザクションはロールバックされま" "す。 :attr:`~Connection.autocommit` が ``False`` の場合、コミット後またはロー" @@ -3387,15 +3715,14 @@ msgstr "" #: ../../library/sqlite3.rst:2402 msgid "" "The context manager neither implicitly opens a new transaction nor closes " -"the connection. If you need a closing context manager, consider using :meth:" -"`contextlib.closing`." +"the connection. If you need a closing context manager, consider " +"using :meth:`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2406 msgid "" "con = sqlite3.connect(\":memory:\")\n" -"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " -"UNIQUE)\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)" +"\")\n" "\n" "# Successful, con.commit() is called automatically afterwards\n" "with con:\n" @@ -3414,6 +3741,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 +3773,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 +3780,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 +3795,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 +3821,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,47 +3845,46 @@ 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`." +"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 "" -"While :attr:`!row_factory` exists as an attribute both on the :class:" -"`Cursor` and the :class:`Connection`, it is recommended to set :class:" -"`Connection.row_factory`, so all cursors created from the connection will " -"use the same row factory." +"While :attr:`!row_factory` exists as an attribute both on " +"the :class:`Cursor` and the :class:`Connection`, it is recommended to " +"set :class:`Connection.row_factory`, so all cursors created from the " +"connection will use the same row factory." msgstr "" ":attr:`!row_factory` は :class:`Cursor` と :class:`Connection` の両方に属性と" "して存在しますが、 その接続(connection)から作成されたすべてのカーソルが同一の" -"行工場(row factory)を使用するようにするために、 :class:`Connection." -"row_factory` を設定することをお勧めします。" +"行工場(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 +3892,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,38 +3905,51 @@ 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 "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -"各列名が各値にマップされた :class:`dict` として行を返す、カスタム :attr:" -"`~Cursor.row_factory` を作成することもできます:" +"各列名が各値にマップされた :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 +3958,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 +3978,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,63 +4002,83 @@ 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 "" -"With some adjustments, the above recipe can be adapted to use a :class:" -"`~dataclasses.dataclass`, or any other custom class, instead of a :class:" -"`~collections.namedtuple`." +"With some adjustments, the above recipe can be adapted to use " +"a :class:`~dataclasses.dataclass`, or any other custom class, instead of " +"a :class:`~collections.namedtuple`." msgstr "" "上記レシピをチューニングすれば、 :class:`~collections.namedtuple` の代わり" "に :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." +"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 " "even arbitrary data. To demonstrate, let's assume we have a database with " "ISO-8859-2 (Latin-2) encoded text, for example a table of Czech-English " -"dictionary entries. Assuming we now have a :class:`Connection` instance :py:" -"data:`!con` connected to this database, we can decode the Latin-2 encoded " -"text using this :attr:`~Connection.text_factory`:" -msgstr "" +"dictionary entries. Assuming we now have a :class:`Connection` " +"instance :py: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,53 +4088,53 @@ 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`." +"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 "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -"*autocommit* を ``False`` に設定することをお勧めします。そうすると :pep:" -"`249` 対応のトランザクション制御を行います。これは以下のことを意味します:" +"*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 " -"implicitly open a new transaction (immediately after closing the pending " -"one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " -"when opening transactions." +":mod:`!sqlite3` ensures that a transaction is always open, " +"so :func:`connect`, :meth:`Connection.commit`, " +"and :meth:`Connection.rollback` will implicitly open a new transaction " +"(immediately after closing the pending 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,34 +4148,34 @@ msgstr "" "トランザクションは、 :meth:`!rollback` を使用して明示的にロールバックする必要" "があります。" -#: ../../library/sqlite3.rst:2661 msgid "" -"An implicit rollback is performed if the database is :meth:`~Connection." -"close`-ed with pending changes." +"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 "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " "effect. Note that SQLite's autocommit mode is distinct from the :pep:`249`-" -"compliant :attr:`Connection.autocommit` attribute; use :attr:`Connection." -"in_transaction` to query the low-level SQLite autocommit mode." +"compliant :attr:`Connection.autocommit` attribute; " +"use :attr:`Connection.in_transaction` to query the low-level SQLite " +"autocommit mode." msgstr "" "*autocommit* を ``True`` に設定して、SQLite の `autocommit mode`_ を有効にし" -"ます。このモードでは、 :meth:`Connection.commit` と :meth:`Connection." -"rollback` は効果がありません。 SQLite の自動コミット・モード(autocommit mode)" -"は、 :pep:`249` 対応の :attr:`Connection.autocommit` 属性とは異なることに注意" -"してください。 :attr:`Connection.in_transaction` を使用して、低レベル SQLite " -"自動コミット・モードを問い合わせします。" +"ます。このモードでは、 :meth:`Connection.commit` " +"と :meth:`Connection.rollback` は効果がありません。 SQLite の自動コミット・" +"モード(autocommit mode)は、 :pep:`249` 対応の :attr:`Connection.autocommit` " +"属性とは異なることに注意してください。 :attr:`Connection.in_transaction` を使" +"用して、低レベル SQLite 自動コミット・モードを問い合わせします。" #: ../../library/sqlite3.rst:2672 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " -"control behaviour to the :attr:`Connection.isolation_level` attribute. See :" -"ref:`sqlite3-transaction-control-isolation-level` for more information." +"control behaviour to the :attr:`Connection.isolation_level` attribute. " +"See :ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" "*autocommit* を :data:`LEGACY_TRANSACTION_CONTROL` に設定して、トランザクショ" "ン制御の振る舞いを :attr:`Connection.isolation_level` 属性に任せます。詳細に" @@ -3785,9 +4188,9 @@ msgstr "``isolation_level`` 属性に依るトランザクション制御" #: ../../library/sqlite3.rst:2685 msgid "" -"The recommended way of controlling transactions is via the :attr:" -"`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" -"autocommit`." +"The recommended way of controlling transactions is via " +"the :attr:`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-" +"control-autocommit`." msgstr "" "推奨のトランザクション制御方法は、 :attr:`~Connection.autocommit` 属性を使用" "することです。 :ref:`sqlite3-transaction-control-autocommit` を参照してくださ" @@ -3795,40 +4198,40 @@ msgstr "" #: ../../library/sqlite3.rst:2689 msgid "" -"If :attr:`Connection.autocommit` is set to :data:" -"`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " -"controlled using the :attr:`Connection.isolation_level` attribute. " +"If :attr:`Connection.autocommit` is set " +"to :data:`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour " +"is controlled using the :attr:`Connection.isolation_level` attribute. " "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" ":attr:`Connection.autocommit` が :data:`LEGACY_TRANSACTION_CONTROL` (これがデ" -"フォルトです)に設定されている場合、トランザクションの振る舞いは :attr:" -"`Connection.isolation_level` 属性を使用して制御されます。 :data:" -"`LEGACY_TRANSACTION_CONTROL` 以外の場合、 :attr:`!isolation_level` は効果があ" -"りません。" +"フォルトです)に設定されている場合、トランザクションの振る舞い" +"は :attr:`Connection.isolation_level` 属性を使用して制御されます。 " +"``LEGACY_TRANSACTION_CONTROL`` 以外の場合、 :attr:`!isolation_level` は効果が" +"ありません。" #: ../../library/sqlite3.rst:2695 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " -"``None``, new transactions are implicitly opened before :meth:`~Cursor." -"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " -"``DELETE``, or ``REPLACE`` statements; for other statements, no implicit " -"transaction handling is performed. Use the :meth:`~Connection.commit` and :" -"meth:`~Connection.rollback` methods to respectively commit and roll back " -"pending transactions. You can choose the underlying `SQLite transaction " -"behaviour`_ — that is, whether and what type of ``BEGIN`` statements :mod:`!" -"sqlite3` implicitly executes – via the :attr:`~Connection.isolation_level` " -"attribute." -msgstr "" -"接続属性 :attr:`~Connection.isolation_level` が ``None`` で無いのなら、 :" -"meth:`~Cursor.execute` や :meth:`~Cursor.executemany` が ``INSERT`` または " -"``UPDATE`` または ``DELETE`` または ``REPLACE`` 文を実行する前に新しいトラン" -"ザクションが暗黙に開かれます。それ以外のSQL文では暗黙のトランザクション処理は" -"行われません。 :meth:`~Connection.commit` メソッドや :meth:`~Connection." -"rollback` メソッドを使用して、 保留中のトランザクションをそれぞれコミットおよ" -"びロールバックします。あなたは、背後にある SQLite ライブラリのトランザクショ" -"ンの振る舞い(`SQLite transaction behaviour`_) — つまり、 sqlite3 が暗黙に実行" -"する ``BEGIN`` 文の有無とその種類 – を、 :attr:`~Connection.isolation_level` " -"属性を介して選択できます。" +"``None``, new transactions are implicitly opened " +"before :meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes " +"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements; for other " +"statements, no implicit transaction handling is performed. Use " +"the :meth:`~Connection.commit` and :meth:`~Connection.rollback` methods to " +"respectively commit and roll back pending transactions. You can choose the " +"underlying `SQLite transaction behaviour`_ — that is, whether and what type " +"of ``BEGIN`` statements :mod:`!sqlite3` implicitly executes – via " +"the :attr:`~Connection.isolation_level` attribute." +msgstr "" +"接続属性 :attr:`~Connection.isolation_level` が ``None`` で無いのな" +"ら、 :meth:`~Cursor.execute` や :meth:`~Cursor.executemany` が ``INSERT`` ま" +"たは ``UPDATE`` または ``DELETE`` または ``REPLACE`` 文を実行する前に新しいト" +"ランザクションが暗黙に開かれます。それ以外のSQL文では暗黙のトランザクション処" +"理は行われません。 :meth:`~Connection.commit` メソッド" +"や :meth:`~Connection.rollback` メソッドを使用して、 保留中のトランザクション" +"をそれぞれコミットおよびロールバックします。あなたは、背後にある SQLite ライ" +"ブラリのトランザクションの振る舞い(`SQLite transaction behaviour`_) — つま" +"り、 sqlite3 が暗黙に実行する ``BEGIN`` 文の有無とその種類 – " +"を、 :attr:`~Connection.isolation_level` 属性を介して選択できます。" #: ../../library/sqlite3.rst:2708 msgid "" @@ -3836,8 +4239,8 @@ msgid "" "are implicitly opened at all. This leaves the underlying SQLite library in " "`autocommit mode`_, but also allows the user to perform their own " "transaction handling using explicit SQL statements. The underlying SQLite " -"library autocommit mode can be queried using the :attr:`~Connection." -"in_transaction` attribute." +"library autocommit mode can be queried using " +"the :attr:`~Connection.in_transaction` attribute." msgstr "" ":attr:`~Connection.isolation_level` が ``None`` に設定されていると、トランザ" "クションは暗黙に開かれません。これにより、背後にある SQLite ライブラリを自動" @@ -3852,9 +4255,9 @@ msgid "" "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -":meth:`~Cursor.executescript` メソッドは、 :attr:`~Connection." -"isolation_level` の値に関係なく、与えられた SQL スクリプトの実行前に、保留中" -"のトランザクションを暗黙にコミットします。" +":meth:`~Cursor.executescript` メソッド" +"は、 :attr:`~Connection.isolation_level` の値に関係なく、与えられた SQL スク" +"リプトの実行前に、保留中のトランザクションを暗黙にコミットします。" #: ../../library/sqlite3.rst:2720 msgid "" @@ -3866,8 +4269,8 @@ msgstr "" #: ../../library/sqlite3.rst:2724 msgid "" -"The recommended way of controlling transactions is now via the :attr:" -"`~Connection.autocommit` attribute." +"The recommended way of controlling transactions is now via " +"the :attr:`~Connection.autocommit` attribute." msgstr "" "推奨のトランザクションを制御方法は、 :attr:`~Connection.autocommit` 属性を使" "用することです。" @@ -3876,9 +4279,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..f80f258f4 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,36 +51,37 @@ 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/ssl.rst:38 msgid "" @@ -92,17 +93,24 @@ 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 " "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " "certificate of the other side of the connection, :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection or :meth:" -"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"retrieves the cipher being used for the secure connection " +"or :meth:`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,22 @@ 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." +"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 +180,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 +203,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 +226,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" @@ -223,9 +256,9 @@ msgid "" "constructor directly." msgstr "" "新規の :class:`SSLContext` オブジェクトを、与えられた *purpose* のデフォルト" -"設定で返します。設定は :mod:`ssl` モジュールで選択され、通常は :class:" -"`SSLContext` のコンストラクタを直接呼び出すよりも高いセキュリティレベルを表現" -"します。" +"設定で返します。設定は :mod:`ssl` モジュールで選択され、通常" +"は :class:`SSLContext` のコンストラクタを直接呼び出すよりも高いセキュリティレ" +"ベルを表現します。" #: ../../library/ssl.rst:135 msgid "" @@ -239,33 +272,46 @@ 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 " -"high encryption cipher suites without RC4 and without unauthenticated cipher " -"suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* sets :data:" -"`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either loads CA " -"certificates (when at least one of *cafile*, *capath* or *cadata* is given) " -"or uses :meth:`SSLContext.load_default_certs` to load default CA " +"The settings are: :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` " +"with high encryption cipher suites without RC4 and without unauthenticated " +"cipher suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* " +"sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either " +"loads CA certificates (when at least one of *cafile*, *capath* or *cadata* " +"is given) 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 " -"underlying OpenSSL implementation behave more like a conforming " -"implementation of :rfc:`5280`, in exchange for a small amount of " +"The default settings for this context " +"include :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. " +"These make the underlying OpenSSL implementation behave more like a " +"conforming 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 "" @@ -279,11 +325,11 @@ msgstr "" #: ../../library/ssl.rst:165 msgid "" -"If your application needs specific settings, you should create a :class:" -"`SSLContext` and apply the settings yourself." +"If your application needs specific settings, you should create " +"a :class:`SSLContext` and apply the settings yourself." msgstr "" -"もしもあなたのアプリケーションが特定の設定を必要とする場合、 :class:" -"`SSLContext` を作って自分自身で設定を適用すべきです。" +"もしもあなたのアプリケーションが特定の設定を必要とする場" +"合、 :class:`SSLContext` を作って自分自身で設定を適用すべきです。" #: ../../library/ssl.rst:169 msgid "" @@ -291,9 +337,9 @@ msgid "" "with a :class:`SSLContext` created by this function that they get an error " "stating \"Protocol or cipher suite mismatch\", it may be that they only " "support SSL3.0 which this function excludes using the :data:`OP_NO_SSLv3`. " -"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this function but " -"still allow SSL 3.0 connections you can re-enable them using::" +"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this " +"function but still allow SSL 3.0 connections you can re-enable them using::" msgstr "" "ある種の古いクライアントやサーバが接続しようと試みてきた場合に、この関数で作" "られた :class:`SSLContext` が \"Protocol or cipher suite mismatch\" で始まる" @@ -303,25 +349,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 +386,24 @@ 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`." +"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." +"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" @@ -366,9 +420,9 @@ msgid "" msgstr "" "(現在のところ OpenSSL ライブラリによって提供されている)下層の SSL 実装からの" "エラーを伝えるための例外です。このエラーは、低レベルなネットワークの上に載っ" -"ている、高レベルな暗号化と認証レイヤーでの問題を通知します。このエラーは :" -"exc:`OSError` のサブタイプです。 :exc:`SSLError` インスタンスのエラーコードと" -"メッセージは OpenSSL ライブラリによるものです。" +"ている、高レベルな暗号化と認証レイヤーでの問題を通知します。このエラー" +"は :exc:`OSError` のサブタイプです。 :exc:`SSLError` インスタンスのエラーコー" +"ドとメッセージは OpenSSL ライブラリによるものです。" #: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." @@ -393,15 +447,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 +468,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 +497,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,18 +520,17 @@ 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 " -"operation is not supported by the current RAND method. :func:`RAND_status` " -"can be used to check the status of the PRNG and :func:`RAND_add` can be used " -"to seed the PRNG." +"Return *num* cryptographically strong pseudo-random bytes. Raises " +"an :class:`SSLError` if the PRNG has not been seeded with enough data or if " +"the operation is not supported by the current RAND " +"method. :func:`RAND_status` 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 @@ -497,31 +546,35 @@ msgid "" "requirements of a cryptographically strong generator." msgstr "" "暗号論的に強い擬似乱数生成器に要求されることについては Wikipedia の記事 " -"`Cryptographically secure pseudorandom number generator (CSPRNG) `_ " -"(日本語版: `暗号論的擬似乱数生成器 `_ (日本語版: `暗号論" +"的擬似乱数生成器 `_) " "を参照してください。" #: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " -"with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." -"RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-" -"random number generator." +"with 'enough' randomness, and ``False`` otherwise. You can " +"use :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness " +"of the pseudo-random number generator." msgstr "" "SSL 擬似乱数生成器が十分なランダム性(randomness)を受け取っている時に " -"``True`` を、それ以外の場合は `False` を返します。 :func:`ssl.RAND_egd` と :" -"func:`ssl.RAND_add` を使って擬似乱数生成機にランダム性を加えることができま" -"す。" +"``True`` を、それ以外の場合は `False` を返します。 :func:`ssl.RAND_egd` " +"と :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." @@ -560,32 +613,42 @@ msgstr "" #: ../../library/ssl.rst:377 msgid "\"notBefore\" or \"notAfter\" dates must use GMT (:rfc:`5280`)." msgstr "" -"\"notBefore\" や \"notAfter\" の日付には GMT を使わなければなりません(:rfc:" -"`5280`)。" +"\"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 " "PEM-encoded string. If ``ssl_version`` is specified, uses that version of " "the SSL protocol to attempt to connect to the server. If *ca_certs* is " "specified, it should be a file containing a list of root certificates, the " -"same format as used for the *cafile* parameter in :meth:`SSLContext." -"load_verify_locations`. The call will attempt to validate the server " -"certificate against that set of root certificates, and will fail if the " -"validation attempt fails. A timeout can be specified with the ``timeout`` " -"parameter." -msgstr "" +"same format as used for the *cafile* parameter " +"in :meth:`SSLContext.load_verify_locations`. The call will attempt to " +"validate the server certificate against that set of root certificates, and " +"will fail if the 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." @@ -593,11 +656,11 @@ msgstr "この関数はIPv6互換になりました。" #: ../../library/ssl.rst:402 msgid "" -"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" -"`PROTOCOL_TLS` for maximum compatibility with modern servers." +"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` " +"to :data:`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -"*ssl_version* のデフォルトが、最近のサーバへの最大限の互換性のために :data:" -"`PROTOCOL_SSLv3` から :data:`PROTOCOL_TLS` に変更されました。" +"*ssl_version* のデフォルトが、最近のサーバへの最大限の互換性のため" +"に :data:`PROTOCOL_SSLv3` から :data:`PROTOCOL_TLS` に変更されました。" #: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." @@ -645,21 +708,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" @@ -678,10 +739,11 @@ msgstr "" #: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 " -"data. Trust specifies the purpose of the certificate as a set of OIDS or " -"exactly ``True`` if the certificate is trustworthy for all purposes." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data. Trust specifies the purpose of the certificate as a set " +"of OIDS or exactly ``True`` if the certificate is trustworthy for all " +"purposes." msgstr "" "この関数はタプル (cert_bytes, encoding_type, trust) のリストで返します。" "encoding_type は cert_bytes のエンコーディングを表します。X.509 ASN.1 に対す" @@ -694,12 +756,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 "" @@ -713,8 +777,9 @@ msgstr "" #: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data." msgstr "" "この関数はタプル (cert_bytes, encoding_type, trust) のリストで返します。" "encoding_type は cert_bytes のエンコーディングを表します。X.509 ASN.1 に対す" @@ -730,22 +795,28 @@ msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" -"すべての定数が :class:`enum.IntEnum` コレクションまたは :class:`enum." -"IntFlag` コレクションになりました。" +"すべての定数が :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." +"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 +824,18 @@ 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." +"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,31 +843,49 @@ 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`." +"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 :" -"class:`SSLError` will be raised if no certificate is provided, or if its " +"certificates are required from the other side of the socket connection; " +"an :class:`SSLError` will be raised if no certificate is provided, or if its " "validation fails. This mode is **not** sufficient to verify a certificate in " -"client mode as it does not match hostnames. :attr:`~SSLContext." -"check_hostname` must be enabled as well to verify the authenticity of a " -"cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" -"attr:`~SSLContext.check_hostname` by default." +"client mode as it does not match " +"hostnames. :attr:`~SSLContext.check_hostname` must be enabled as well to " +"verify the authenticity of a 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,19 +901,19 @@ 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 " "requires a valid CRL that is signed by the peer cert's issuer (its direct " -"ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." -"load_verify_locations`, validation will fail." +"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 +931,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 +948,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 +955,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 +975,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`." +"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 +1027,24 @@ 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." +"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 +1062,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 +1110,14 @@ 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." +"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 +1130,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 +1144,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 +1151,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 +1186,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 +1231,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 +1277,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 +1358,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 +1377,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 +1390,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 "" @@ -1292,8 +1426,8 @@ msgstr "" #: ../../library/ssl.rst:988 msgid "" -"Used as the return value of the callback function in :meth:`SSLContext." -"set_servername_callback`." +"Used as the return value of the callback function " +"in :meth:`SSLContext.set_servername_callback`." msgstr "" ":meth:`SSLContext.set_servername_callback` でのコールバック関数の戻り値として" "使われます。" @@ -1304,10 +1438,10 @@ msgstr "ALERT_DESCRIPTION_* 定数の :class:`enum.IntEnum` コレクション #: ../../library/ssl.rst:1001 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web servers (therefore, it will be used to create client-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web servers (therefore, it will be used " +"to create client-side sockets)." msgstr "" ":func:`create_default_context` と :meth:`SSLContext.load_default_certs` に渡" "すオプションです。この値はコンテキストが web サーバの認証に使われることを示し" @@ -1316,10 +1450,10 @@ msgstr "" #: ../../library/ssl.rst:1010 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web clients (therefore, it will be used to create server-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web clients (therefore, it will be used " +"to create server-side sockets)." msgstr "" ":func:`create_default_context` と :meth:`SSLContext.load_default_certs` に渡" "すオプションです。この値はコンテキストが web クライアントの認証に使われること" @@ -1330,28 +1464,32 @@ 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`." +":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." +"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 +1499,52 @@ 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 "" +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 +1552,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 "" @@ -1443,8 +1569,8 @@ msgstr "" #: ../../library/ssl.rst:1083 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method." msgstr "" ":class:`SSLSocket` のインスタンスは :meth:`SSLContext.wrap_socket` メソッドを" "使用して作成されなければなりません。" @@ -1465,25 +1591,29 @@ msgstr "" #: ../../library/ssl.rst:1094 msgid "" -"It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" -"`SSLContext.wrap_socket` to wrap a socket." +"It is deprecated to create a :class:`SSLSocket` instance directly, " +"use :meth:`SSLContext.wrap_socket` to wrap a socket." msgstr "" ":class:`SSLSocket` インスタンスを直接作成することは非推奨です。ソケットをラッ" "プするために :meth:`SSLContext.wrap_socket` を使用してください。" #: ../../library/ssl.rst:1098 msgid "" -":class:`SSLSocket` instances must to created with :meth:`~SSLContext." -"wrap_socket`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLSocket` instances must to created " +"with :meth:`~SSLContext.wrap_socket`. In earlier versions, it was possible " +"to create instances 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 +1629,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." +"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 +1669,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." +"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,27 +1700,27 @@ 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 " "decrypt/encrypt it to encrypted, wire-level data. These methods require an " -"active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." -"unwrap` was not called." +"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 "" -"Normally you should use the socket API methods like :meth:`~socket.socket." -"recv` and :meth:`~socket.socket.send` instead of these methods." +"Normally you should use the socket API methods " +"like :meth:`~socket.socket.recv` and :meth:`~socket.socket.send` instead of " +"these methods." msgstr "" -"通常はこれらのメソッドの代わりに :meth:`~socket.socket.recv` や :meth:" -"`~socket.socket.send` のようなソケット API メソッドを使うべきです。" +"通常はこれらのメソッドの代わりに :meth:`~socket.socket.recv` " +"や :meth:`~socket.socket.send` のようなソケット API メソッドを使うべきです。" #: ../../library/ssl.rst:1163 msgid "Perform the SSL setup handshake." @@ -1600,13 +1728,13 @@ msgstr "SSL セットアップのハンドシェイクを実行します。" #: ../../library/ssl.rst:1165 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" -"`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." -"context` is true." +"The handshake method also performs :func:`match_hostname` when " +"the :attr:`~SSLContext.check_hostname` attribute of the " +"socket's :attr:`~SSLSocket.context` is true." msgstr "" -"ソケットの :attr:`~SSLSocket.context` の属性 :attr:`~SSLContext." -"check_hostname` が真の場合に、ハンドシェイクメソッドが :func:" -"`match_hostname` を実行するようになりました。" +"ソケットの :attr:`~SSLSocket.context` の属" +"性 :attr:`~SSLContext.check_hostname` が真の場合に、ハンドシェイクメソッド" +"が :func:`match_hostname` を実行するようになりました。" #: ../../library/ssl.rst:1170 msgid "" @@ -1619,17 +1747,17 @@ msgstr "" #: ../../library/ssl.rst:1174 msgid "" -"Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " -"or IP address, the handshake is aborted early and a TLS alert message is " -"sent to the peer." +"Hostname or IP address is matched by OpenSSL during handshake. The " +"function :func:`match_hostname` is no longer used. In case OpenSSL refuses a " +"hostname or IP address, the handshake is aborted early and a TLS alert " +"message is sent to the peer." msgstr "" #: ../../library/ssl.rst:1182 msgid "" "If there is no certificate for the peer on the other end of the connection, " -"return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" -"`ValueError`." +"return ``None``. If the SSL handshake hasn't been done yet, " +"raise :exc:`ValueError`." msgstr "" "接続先に証明書が無い場合、 ``None`` を返します。SSL ハンドシェイクがまだ行わ" "れていない場合は、 :exc:`ValueError` が送出されます。" @@ -1649,9 +1777,9 @@ msgstr "" "ソッドは :class:`dict` のインスタンスを返します。証明書が認証されていない場" "合、辞書は空です。証明書が認証されていた場合いくつかのキーを持った辞書を返" "し、 ``subject`` (証明書が発行された principal), ``issuer`` (証明書を発行し" -"た principal) を含みます。証明書が *Subject Alternative Name* 拡張(:rfc:" -"`3280` を参照)のインスタンスを格納していた場合、 ``subjectAltName`` キーも辞" -"書に含まれます。" +"た principal) を含みます。証明書が *Subject Alternative Name* 拡張" +"(:rfc:`3280` を参照)のインスタンスを格納していた場合、 ``subjectAltName`` " +"キーも辞書に含まれます。" #: ../../library/ssl.rst:1195 msgid "" @@ -1665,7 +1793,6 @@ msgstr "" "したタプルで、各 RDN は name-value ペアのシーケンスです。現実世界での例をお見" "せします::" -#: ../../library/ssl.rst:1200 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1687,6 +1814,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 "" @@ -1712,18 +1858,17 @@ msgstr "" #: ../../library/ssl.rst:1228 msgid "" "for a server SSL socket, the client will only provide a certificate when " -"requested by the server; therefore :meth:`getpeercert` will return :const:" -"`None` if you used :const:`CERT_NONE` (rather than :const:`CERT_OPTIONAL` " -"or :const:`CERT_REQUIRED`)." +"requested by the server; therefore :meth:`getpeercert` will " +"return :const:`None` if you used :const:`CERT_NONE` (rather " +"than :const:`CERT_OPTIONAL` or :const:`CERT_REQUIRED`)." msgstr "" "サーバ SSL ソケットでは、クライアントはサーバによって認証が要求されている場合" -"にのみ証明書を提供します。したがって、 (:const:`CERT_OPTIONAL` や :const:" -"`CERT_REQUIRED` ではなく) :const:`CERT_NONE` を使用した場合 :meth:" -"`getpeercert` は :const:`None` を返します。" +"にのみ証明書を提供します。したがって、 (:const:`CERT_OPTIONAL` " +"や :const:`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 +1888,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,39 +1950,42 @@ 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 "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " -"list. Currently only the 'tls-unique' channel binding, defined by :rfc:" -"`5929`, is supported. :exc:`ValueError` will be raised if an unsupported " -"channel binding type is requested." +"list. Currently only the 'tls-unique' channel binding, defined " +"by :rfc:`5929`, is supported. :exc:`ValueError` will be raised if an " +"unsupported channel binding type is requested." msgstr "" "*cb_type* パラメータにより、望みのチャネルバインディングのタイプを選択できま" -"す。チャネルバインディングのタイプの妥当なものは :data:" -"`CHANNEL_BINDING_TYPES` でリストされています。現在のところは :rfc:`5929` で定" -"義されている 'tls-unique' のみがサポートされています。未サポートのチャネルバ" -"インディングのタイプが要求された場合、 :exc:`ValueError` を送出します。" +"す。チャネルバインディングのタイプの妥当なもの" +"は :data:`CHANNEL_BINDING_TYPES` でリストされています。現在のところ" +"は :rfc:`5929` で定義されている 'tls-unique' のみがサポートされています。未サ" +"ポートのチャネルバインディングのタイプが要求された場合、 :exc:`ValueError` を" +"送出します。" #: ../../library/ssl.rst:1305 msgid "" -"Return the protocol that was selected during the TLS handshake. If :meth:" -"`SSLContext.set_alpn_protocols` was not called, if the other party does not " -"support ALPN, if this socket does not support any of the client's proposed " -"protocols, or if the handshake has not happened yet, ``None`` is returned." +"Return the protocol that was selected during the TLS handshake. " +"If :meth:`SSLContext.set_alpn_protocols` was not called, if the other party " +"does not support ALPN, if this socket does not support any of the client's " +"proposed protocols, or if the handshake has not happened yet, ``None`` is " +"returned." msgstr "" -"TLS ハンドシェイクで選択されたプロトコルを返します。 :meth:`SSLContext." -"set_alpn_protocols` が呼ばれていない場合、相手側が ALPN をサポートしていない" -"場合、クライアントが提案したプロトコルのどれもソケットがサポートしない場合、" -"あるいはハンドシェイクがまだ行われていない場合には、 ``None`` が返されます。" +"TLS ハンドシェイクで選択されたプロトコルを返しま" +"す。 :meth:`SSLContext.set_alpn_protocols` が呼ばれていない場合、相手側が " +"ALPN をサポートしていない場合、クライアントが提案したプロトコルのどれもソケッ" +"トがサポートしない場合、あるいはハンドシェイクがまだ行われていない場合には、 " +"``None`` が返されます。" #: ../../library/ssl.rst:1315 msgid "" @@ -1843,14 +1994,13 @@ msgid "" "other party does not support NPN, or if the handshake has not yet happened, " "this will return ``None``." msgstr "" -"TLS/SSL ハンドシェイクで選択された上位レベルのプロトコルを返します。 :meth:" -"`SSLContext.set_npn_protocols` が呼ばれていない場合、相手側が NPN をサポート" -"していない場合、あるいはハンドシェイクがまだ行われていない場合には、 " -"``None`` が返されます。" +"TLS/SSL ハンドシェイクで選択された上位レベルのプロトコルを返しま" +"す。 :meth:`SSLContext.set_npn_protocols` が呼ばれていない場合、相手側が NPN " +"をサポートしていない場合、あるいはハンドシェイクがまだ行われていない場合に" +"は、 ``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 +2016,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`." +"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." +"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 +2066,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,20 +2091,23 @@ 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\"``)." +"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 "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " -"performed. For client sockets the session can be set before :meth:" -"`~SSLSocket.do_handshake` has been called to reuse a session." +"performed. For client sockets the session can be set " +"before :meth:`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" "この SSL 接続に対する :class:`SSLSession` です。このセッションは、TLS ハンド" "シェイクの実行後、クライアントサイドとサーバサイドのソケットで使用できます。" @@ -1971,7 +2130,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 +2139,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 +2245,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,69 +2261,83 @@ 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:" -"`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, and :" -"data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by default. " -"The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " -"ciphers and no ``MD5`` ciphers." +"The context is created with secure default values. The " +"options :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, " +"and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by " +"default. 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." +"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 " -"2048 bits and ECC keys with less than 224 bits are prohibited. :data:" -"`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " -"use TLS 1.2 as minimum TLS version." +"2048 bits and ECC keys with less than 224 bits are " +"prohibited. :data:`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 +2356,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 +2367,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 "" @@ -2216,17 +2401,16 @@ msgstr "新しいオプション引数 *password*。" msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " -"system stores. On all systems it calls :meth:`SSLContext." -"set_default_verify_paths`. In the future the method may load CA certificates " -"from other locations, too." +"system stores. On all systems it " +"calls :meth:`SSLContext.set_default_verify_paths`. In the future the method " +"may load CA certificates from other locations, too." msgstr "" "デフォルトの場所から \"認証局\" (CA=certification authority) 証明書ファイル一" "式をロードします。Windows では、CA 証明書はシステム記憶域の ``CA`` と " -"``ROOT`` からロードします。全てのシステムでは、この関数は :meth:`SSLContext." -"set_default_verify_paths` を呼び出します。将来的にはこのメソッドは、他の場所" -"からも CA 証明書をロードするかもしれません。" +"``ROOT`` からロードします。全てのシステムでは、この関数" +"は :meth:`SSLContext.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,12 +2418,19 @@ 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 "" "Load a set of \"certification authority\" (CA) certificates used to validate " -"other peers' certificates when :data:`verify_mode` is other than :data:" -"`CERT_NONE`. At least one of *cafile* or *capath* must be specified." +"other peers' certificates when :data:`verify_mode` is other " +"than :data:`CERT_NONE`. At least one of *cafile* or *capath* must be " +"specified." msgstr "" ":data:`verify_mode` が :data:`CERT_NONE` でない場合に接続先の証明書ファイルの" "正当性検証に使われる \"認証局\" (CA=certification authority) 証明書ファイル一" @@ -2267,12 +2458,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 "" @@ -2315,11 +2508,11 @@ msgstr "" #: ../../library/ssl.rst:1602 msgid "" -"Get a list of enabled ciphers. The list is in order of cipher priority. See :" -"meth:`SSLContext.set_ciphers`." +"Get a list of enabled ciphers. The list is in order of cipher priority. " +"See :meth:`SSLContext.set_ciphers`." msgstr "" -"有効な暗号化のリストを取得します。リストは暗号化優先度順に並びます。:meth:" -"`SSLContext.set_ciphers` を参照してください。" +"有効な暗号化のリストを取得します。リストは暗号化優先度順に並びま" +"す。:meth:`SSLContext.set_ciphers` を参照してください。" #: ../../library/ssl.rst:1607 msgid "" @@ -2352,7 +2545,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 +2553,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 "" @@ -2387,58 +2579,60 @@ msgstr "" #: ../../library/ssl.rst:1659 msgid "" -"TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." -"set_ciphers`." +"TLS 1.3 cipher suites cannot be disabled " +"with :meth:`~SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1664 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " -"handshake. It should be a list of ASCII strings, like ``['http/1.1', " -"'spdy/2']``, ordered by preference. The selection of a protocol will happen " -"during the handshake, and will play out according to :rfc:`7301`. After a " +"handshake. It should be a list of ASCII strings, like ``['http/1.1', 'spdy/" +"2']``, ordered by preference. The selection of a protocol will happen during " +"the handshake, and will play out according to :rfc:`7301`. After a " "successful handshake, the :meth:`SSLSocket.selected_alpn_protocol` method " "will return the agreed-upon protocol." msgstr "" "SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定します。 " "``['http/1.1', 'spdy/2']`` のような推奨順に並べた ASCII 文字列のリストでなけ" "ればなりません。プロトコルの選択は :rfc:`7301` に従いハンドシェイク中に行われ" -"ます。ハンドシェイクが正常に終了した後、 :meth:`SSLSocket." -"selected_alpn_protocol` メソッドは合意されたプロトコルを返します。" +"ます。ハンドシェイクが正常に終了した" +"後、 :meth:`SSLSocket.selected_alpn_protocol` メソッドは合意されたプロトコル" +"を返します。" #: ../../library/ssl.rst:1671 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is " "``False``." msgstr "" -"このメソッドは :data:`HAS_ALPN` が ``False`` の場合 :exc:" -"`NotImplementedError` を送出します。" +"このメソッドは :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']``, " "ordered by preference. The selection of a protocol will happen during the " "handshake, and will play out according to the `Application Layer Protocol " "Negotiation `_. After a successful handshake, the :meth:" -"`SSLSocket.selected_npn_protocol` method will return the agreed-upon " -"protocol." +"Layer_Protocol_Negotiation>`_. After a successful handshake, " +"the :meth:`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" +"ハンドシェイクが正常に終了した後、 :meth:`SSLSocket.selected_npn_protocol` メ" +"ソッドは合意されたプロトコルを返します。" #: ../../library/ssl.rst:1686 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_NPN` is " "``False``." msgstr "" -"このメソッドは :data:`HAS_NPN` が ``False`` の場合 :exc:" -"`NotImplementedError` を送出します。" +"このメソッドは :data:`HAS_NPN` が ``False`` の場" +"合 :exc:`NotImplementedError` を送出します。" #: ../../library/ssl.rst:1697 msgid "" @@ -2462,7 +2656,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,48 +2665,60 @@ 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 "" -"A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" -"attr:`SSLSocket.context` attribute to a new object of type :class:" -"`SSLContext` representing a certificate chain that matches the server name." +"A typical use of this callback is to change " +"the :class:`ssl.SSLSocket`'s :attr:`SSLSocket.context` attribute to a new " +"object of type :class:`SSLContext` representing a certificate chain that " +"matches the server name." msgstr "" -"このコールバックの典型的な利用方法は、 :class:`ssl.SSLSocket` の :attr:" -"`SSLSocket.context` 属性を、サーバ名に合致する証明書チェインを持つ新しい :" -"class:`SSLContext` オブジェクトに変更することです。" +"このコールバックの典型的な利用方法は、 :class:`ssl.SSLSocket` " +"の :attr:`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." -"selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." -"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." -"compression` methods require that the TLS connection has progressed beyond " -"the TLS Client Hello and therefore will not return meaningful values nor can " -"they be called safely." -msgstr "" +"methods and attributes are usable " +"like :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`. " +"The :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket.get_unverified_chain` :meth:`SSLSocket.cipher` " +"and :meth:`SSLSocket.compression` methods require that the TLS connection " +"has progressed beyond 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 "" "The *sni_callback* function must return ``None`` to allow the TLS " -"negotiation to continue. If a TLS failure is required, a constant :const:" -"`ALERT_DESCRIPTION_* ` can be returned. " -"Other return values will result in a TLS fatal error with :const:" -"`ALERT_DESCRIPTION_INTERNAL_ERROR`." +"negotiation to continue. If a TLS failure is required, a " +"constant :const:`ALERT_DESCRIPTION_* ` can " +"be returned. Other return values will result in a TLS fatal error " +"with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" "TLS ネゴシエーションを継続させるならば、 *sni_callback* 関数は ``None`` を返" -"さなければなりません。TLS が失敗することを必要とするなら、 constant :const:" -"`ALERT_DESCRIPTION_* ` を返してください。こ" -"こにない値を返すと、致命エラー :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` を引" -"き起こします。" +"さなければなりません。TLS が失敗することを必要とするなら、 " +"constant :const:`ALERT_DESCRIPTION_* ` を返" +"してください。ここにない値を返すと、致命エ" +"ラー :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` を引き起こします。" #: ../../library/ssl.rst:1734 msgid "" "If an exception is raised from the *sni_callback* function the TLS " -"connection will terminate with a fatal TLS alert message :const:" -"`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." +"connection will terminate with a fatal TLS alert " +"message :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" "*sni_callback* 関数が例外を送出した場合、TLS 接続は TLS の致命的アラートメッ" "セージ :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE` とともに終了します。" @@ -2526,7 +2731,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 +2738,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,15 +2759,16 @@ 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 "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_DH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_DH_USE` option to further improve security." msgstr "" "この設定はクライアントソケットには適用されません。さらにセキュリティを改善す" "るのに :data:`OP_SINGLE_DH_USE` オプションも利用できます。" @@ -2578,8 +2788,8 @@ msgstr "" #: ../../library/ssl.rst:1778 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_ECDH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" "この設定はクライアントソケットには適用されません。さらにセキュリティを改善す" "るのに :data:`OP_SINGLE_ECDH_USE` オプションも利用できます。" @@ -2588,23 +2798,29 @@ 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." +"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 "" @@ -2621,8 +2837,8 @@ msgid "" "after :meth:`connect` is called on the socket. For server-side sockets, if " "the socket has no remote peer, it is assumed to be a listening socket, and " "the server-side SSL wrapping is automatically performed on client " -"connections accepted via the :meth:`accept` method. The method may raise :" -"exc:`SSLError`." +"connections accepted via the :meth:`accept` method. The method may " +"raise :exc:`SSLError`." msgstr "" "クライアントサイドソケットにおいて、コンテキストの生成は遅延されます。つま" "り、低レイヤのソケットがまだ接続されていない場合、コンテキストの生成はそのソ" @@ -2643,32 +2859,32 @@ msgstr "" "クライアントからの接続では、 *server_hostname* で接続先サービスのホスト名を指" "定できます。これは HTTP バーチャルホストにかなり似て、シングルサーバで複数の " "SSL ベースのサービスを別々の証明書でホストしているようなサーバに対して使えま" -"す。 *server_side* が True の場合に *server_hostname* を指定すると :exc:" -"`ValueError` を送出します。" +"す。 *server_side* が True の場合に *server_hostname* を指定する" +"と :exc:`ValueError` を送出します。" #: ../../library/ssl.rst:1816 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " -"application program will call it explicitly, by invoking the :meth:" -"`SSLSocket.do_handshake` method. Calling :meth:`SSLSocket.do_handshake` " -"explicitly gives the program control over the blocking behavior of the " -"socket I/O involved in the handshake." +"application program will call it explicitly, by invoking " +"the :meth:`SSLSocket.do_handshake` method. " +"Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control " +"over the blocking behavior of the socket I/O involved in the handshake." msgstr "" "``do_handshake_on_connect`` 引数は、 :meth:`socket.connect` の後に自動的に " -"SSLハンドシェイクを行うか、それともアプリケーションが明示的に :meth:" -"`SSLSocket.do_handshake` メソッドを実行するかを指定します。 :meth:`SSLSocket." -"do_handshake` を明示的に呼びだすことで、ハンドシェイクによるソケットI/Oのブ" -"ロッキング動作を制御できます。" +"SSLハンドシェイクを行うか、それともアプリケーションが明示的" +"に :meth:`SSLSocket.do_handshake` メソッドを実行するかを指定しま" +"す。 :meth:`SSLSocket.do_handshake` を明示的に呼びだすことで、ハンドシェイク" +"によるソケットI/Oのブロッキング動作を制御できます。" #: ../../library/ssl.rst:1823 msgid "" -"The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." -"recv` method should signal unexpected EOF from the other end of the " -"connection. If specified as :const:`True` (the default), it returns a " -"normal EOF (an empty bytes object) in response to unexpected EOF errors " -"raised from the underlying socket; if :const:`False`, it will raise the " -"exceptions back to the caller." +"The parameter ``suppress_ragged_eofs`` specifies how " +"the :meth:`SSLSocket.recv` method should signal unexpected EOF from the " +"other end of the connection. If specified as :const:`True` (the default), " +"it returns a normal EOF (an empty bytes object) in response to unexpected " +"EOF errors raised from the underlying socket; if :const:`False`, it will " +"raise the exceptions back to the caller." msgstr "" "``suppress_ragged_eofs`` 引数は、 :meth:`SSLSocket.recv` メソッドが、接続先か" "ら予期しないEOF を受け取った時に通知する方法を指定します。 :const:`True` (デ" @@ -2680,11 +2896,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`." +"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,49 +2915,56 @@ 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 "" -"The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" -"`SSLSocket`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLSocket`." +"The return type of :meth:`SSLContext.wrap_socket`, defaults " +"to :class:`SSLSocket`. The attribute can be overridden on instance of class " +"in order 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 " +"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 "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -"*server_side*、 *server_hostname* 、 *session* 引数は、 :meth:`SSLContext." -"wrap_socket` での意味と同じ意味を持ちます。" +"*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`." +"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,28 +2972,46 @@ 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:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " +"The context's :attr:`~SSLContext.verify_mode` must be set " +"to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " "*server_hostname* to :meth:`~SSLContext.wrap_socket` in order to match the " -"hostname. Enabling hostname checking automatically sets :attr:`~SSLContext." -"verify_mode` from :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be " -"set back to :data:`CERT_NONE` as long as hostname checking is enabled. The :" -"data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " -"With other protocols, hostname checking must be enabled explicitly." -msgstr "" +"hostname. Enabling hostname checking automatically " +"sets :attr:`~SSLContext.verify_mode` from :data:`CERT_NONE` " +"to :data:`CERT_REQUIRED`. It cannot be set back to :data:`CERT_NONE` as " +"long as hostname checking is enabled. The :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 +3024,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`." +":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,43 +3053,58 @@ 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`." +"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 "" -"The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." -"minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " -"and TLS versions of the context. The implementation does not prevent invalid " -"combination. For example a context with :attr:`OP_NO_TLSv1_2` in :attr:" -"`~SSLContext.options` and :attr:`~SSLContext.maximum_version` set to :attr:" -"`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." +"The " +"attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` " +"and :attr:`SSLContext.options` all affect the supported SSL and TLS versions " +"of the context. The implementation does not prevent invalid combination. For " +"example a context with :attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` " +"and :attr:`~SSLContext.maximum_version` set to :attr:`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." +"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 "" "An integer representing the set of SSL options enabled on this context. The " -"default value is :data:`OP_ALL`, but you can specify other options such as :" -"data:`OP_NO_SSLv2` by ORing them together." +"default value is :data:`OP_ALL`, but you can specify other options such " +"as :data:`OP_NO_SSLv2` by ORing them together." msgstr "" "このコンテキストで有効になっている SSL オプションを表す整数。デフォルトの値" "は :data:`OP_ALL` ですが、 :data:`OP_NO_SSLv2` のような他の値をビット OR 演算" @@ -2846,34 +3115,47 @@ 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." +"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." +"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,31 +3165,37 @@ 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 "" -"The flags for certificate verification operations. You can set flags like :" -"data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " -"neither require nor verify certificate revocation lists (CRLs)." +"The flags for certificate verification operations. You can set flags " +"like :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default " +"OpenSSL does neither require nor verify certificate revocation lists (CRLs)." msgstr "" "証明書の検証操作のためのフラグです。 :data:`VERIFY_CRL_CHECK_LEAF` などのフラ" "グをビット OR 演算でセットできます。デフォルトでは OpenSSL は証明書失効リス" @@ -2922,12 +3210,13 @@ msgstr "" #: ../../library/ssl.rst:2047 msgid "" "Whether to try to verify other peers' certificates and how to behave if " -"verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." +"verification fails. This attribute must be one " +"of :data:`CERT_NONE`, :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" "接続先の証明書の検証を試みるかどうか、また、検証が失敗した場合にどのように振" -"舞うべきかを制御します。この属性は :data:`CERT_NONE`, :data:" -"`CERT_OPTIONAL`, :data:`CERT_REQUIRED` のうちどれか一つでなければなりません。" +"舞うべきかを制御します。この属性" +"は :data:`CERT_NONE`, :data:`CERT_OPTIONAL`, :data:`CERT_REQUIRED` のうちどれ" +"か一つでなければなりません。" #: ../../library/ssl.rst:2051 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" @@ -2935,16 +3224,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 +3245,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 +3283,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 +3304,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 +3335,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 +3393,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 +3404,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 "" @@ -3119,16 +3420,18 @@ msgid "" "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -"Python は証明書を格納したファイルを利用します。そのファイルは \"PEM\" (:rfc:" -"`1422` 参照) フォーマットという、ヘッダー行とフッター行の間にbase-64エンコー" -"ドされた形をとっている必要があります。 ::" +"Python は証明書を格納したファイルを利用します。そのファイルは \"PEM\" " +"(:rfc:`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 +3462,6 @@ msgstr "" "ンがある場合、私たちのサーバーの証明書から、私たちのサーバーに署名した認証局" "の証明書、そして認証局の証明書を発行した機関のルート証明書と続きます::" -#: ../../library/ssl.rst:2212 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -3171,6 +3473,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" @@ -3183,31 +3494,34 @@ msgid "" "certificate chains for each issuer you are willing to trust. Again, this " "file just contains these chains concatenated together. For validation, " "Python will use the first chain it finds in the file which matches. The " -"platform's certificates file can be used by calling :meth:`SSLContext." -"load_default_certs`, this is done automatically with :func:`." -"create_default_context`." +"platform's certificates file can be used by " +"calling :meth:`SSLContext.load_default_certs`, this is done automatically " +"with :func:`.create_default_context`." msgstr "" "もし相手から送られてきた証明書の認証をしたい場合、信頼している各発行者の証明" "書チェインが入った \"CA certs\" ファイルを提供する必要があります。繰り返しま" "すが、このファイルは単純に、各チェインを結合しただけのものです。認証のため" -"に、Pythonはそのファイルの中の最初にマッチしたチェインを利用します。:meth:" -"`SSLContext.load_default_certs` を呼び出すことでプラットフォームの証明書ファ" -"イルも使われますが、これは :func:`.create_default_context` によって自動的に行" -"われます。" +"に、Pythonはそのファイルの中の最初にマッチしたチェインを利用しま" +"す。:meth:`SSLContext.load_default_certs` を呼び出すことでプラットフォームの" +"証明書ファイルも使われますが、これは :func:`.create_default_context` によって" +"自動的に行われます。" #: ../../library/ssl.rst:2234 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 +3530,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 +3555,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 +3579,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 +3627,6 @@ msgstr "" "インストールされているPythonがSSLをサポートしているかどうかをテストするため" "に、ユーザーコードは次のイディオムを利用することができます。 ::" -#: ../../library/ssl.rst:2295 msgid "" "try:\n" " import ssl\n" @@ -3295,6 +3635,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 +3654,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 +3665,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,37 +3682,47 @@ 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 " +"When you use the context to connect to a server, :const:`CERT_REQUIRED` " +"and :attr:`~SSLContext.check_hostname` validate the server certificate: it " "ensures that the server certificate was signed with one of the CA " "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,16 +3732,15 @@ msgstr "" "証明書が、期待しているサービス (つまり、 HTTPS ホスト ``www.python.org``) の" "身元を特定していることを視覚的に点検してみましょう::" -#: ../../library/ssl.rst:2343 msgid "" ">>> 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" +" '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" @@ -3422,6 +3777,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 +3870,6 @@ msgstr "" "開き、ポートにバインドし、そのソケットの :meth:`listen` を呼び、クライアント" "からの接続を待ちます。 ::" -#: ../../library/ssl.rst:2418 msgid "" "import socket, ssl\n" "\n" @@ -3483,18 +3880,26 @@ 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 "" "When a client connects, you'll call :meth:`accept` on the socket to get the " -"new socket from the other end, and use the context's :meth:`SSLContext." -"wrap_socket` method to create a server-side SSL socket for the connection::" +"new socket from the other end, and use the " +"context's :meth:`SSLContext.wrap_socket` method to create a server-side SSL " +"socket for the connection::" msgstr "" "クライアントが接続してきた場合、 :meth:`accept` を呼んで新しいソケットを作成" -"し、接続のためにサーバサイドの SSL ソケットを、コンテキストの :meth:" -"`SSLContext.wrap_socket` メソッドで作ります::" +"し、接続のためにサーバサイドの SSL ソケットを、コンテキスト" +"の :meth:`SSLContext.wrap_socket` メソッドで作ります::" -#: ../../library/ssl.rst:2431 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3505,6 +3910,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 +3927,6 @@ msgstr "" "そして、 ``connstream`` からデータを読み、クライアントと切断する(あるいはクラ" "イアントが切断してくる)まで何か処理をします。 ::" -#: ../../library/ssl.rst:2443 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3527,6 +3939,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,34 +3976,34 @@ 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 " "operation would block. :exc:`SSLWantReadError` will be raised if a read " -"operation on the underlying socket is necessary, and :exc:" -"`SSLWantWriteError` for a write operation on the underlying socket. Note " -"that attempts to *write* to an SSL socket may require *reading* from the " -"underlying socket first, and attempts to *read* from the SSL socket may " +"operation on the underlying socket is necessary, " +"and :exc:`SSLWantWriteError` for a write operation on the underlying socket. " +"Note that attempts to *write* to an SSL socket may require *reading* from " +"the 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:" -"`BlockingIOError` ではなく :exc:`SSLWantWriteError` か :exc:" -"`SSLWantReadError` のどちらかを送出します。 :exc:`SSLWantReadError` は下層の" -"ソケットで読み出しが必要な場合に送出され、 :exc:`SSLWantWriteError` は下層の" -"ソケットで書き込みが必要な場合に送出されます。SSL ソケットに対して *書き込み" -"* を試みると下層のソケットから最初に *読み出す* 必要があるかもしれず、SSL ソ" -"ケットに対して *読み出し* を試みると下層のソケットに先に *書き込む* 必要があ" -"るかもしれないことに注意してください。" +"ほとんどの :class:`SSLSocket` のメソッドは、I/O 操作に待機が必要な場" +"合、:exc:`BlockingIOError` ではなく :exc:`SSLWantWriteError` " +"か :exc:`SSLWantReadError` のどちらかを送出します。\n" +":exc:`SSLWantReadError` は下層のソケットで読み出しが必要な場合に送出さ" +"れ、:exc:`SSLWantWriteError` は下層のソケットで書き込みが必要な場合に送出され" +"ます。\n" +"SSL ソケットに対して *書き込み* を試みると下層のソケットから最初に *読み出す" +"* 必要がある場合があり、SSL ソケットに対して *読み出し* を試みると下層のソ" +"ケットに先に *書き込む* 必要がある場合もあることに注意してください。" #: ../../library/ssl.rst:2480 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -"以前の Python バージョンでは、 :meth:`!SSLSocket.send` メソッドは :exc:" -"`SSLWantWriteError` または :exc:`SSLWantReadError` を送出するのではなく、ゼロ" -"を返していました。" +"以前の Python バージョンでは、 :meth:`!SSLSocket.send` メソッド" +"は :exc:`SSLWantWriteError` または :exc:`SSLWantReadError` を送出するのではな" +"く、ゼロを返していました。" #: ../../library/ssl.rst:2484 msgid "" @@ -3589,15 +4011,15 @@ msgid "" "read from (or written to), but it does not imply that there is sufficient " "data at the upper SSL layer. For example, only part of an SSL frame might " "have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` " -"and :meth:`SSLSocket.send` failures, and retry after another call to :func:" -"`~select.select`." +"and :meth:`SSLSocket.send` failures, and retry after another call " +"to :func:`~select.select`." msgstr "" ":func:`~select.select` 呼び出しは OS レベルでのソケットが読み出し可能(または" "書き込み可能)になったことを教えてくれますが、上位の SSL レイヤーでの十分な" "データがあることを意味するわけではありません。例えば、SSL フレームの一部が届" -"いただけかもしれません。ですから、 :meth:`SSLSocket.recv` と :meth:" -"`SSLSocket.send` の失敗を処理することに備え、ほかの :func:`~select.select` 呼" -"び出し後にリトライしなければなりません。" +"いただけかもしれません。ですから、 :meth:`SSLSocket.recv` " +"と :meth:`SSLSocket.send` の失敗を処理することに備え、ほか" +"の :func:`~select.select` 呼び出し後にリトライしなければなりません。" #: ../../library/ssl.rst:2491 msgid "" @@ -3609,31 +4031,30 @@ msgid "" msgstr "" "反対に、SSL レイヤーは独自の枠組みを持っているため、:func:`~select.select` が" "気付かない読み出し可能なデータを SSL ソケットが持っている場合があります。した" -"がって、入手可能な可能性のあるデータをすべて引き出すために最初に :meth:" -"`SSLSocket.recv` を呼び出し、次にそれでもまだ必要な場合にだけ :func:`~select." -"select` 呼び出しでブロックすべきです。" +"がって、入手可能な可能性のあるデータをすべて引き出すために最初" +"に :meth:`SSLSocket.recv` を呼び出し、次にそれでもまだ必要な場合にだ" +"け :func:`~select.select` 呼び出しでブロックすべきです。" #: ../../library/ssl.rst:2497 msgid "" -"(of course, similar provisions apply when using other primitives such as :" -"func:`~select.poll`, or those in the :mod:`selectors` module)" +"(of course, similar provisions apply when using other primitives such " +"as :func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -"(当然のことながら、ほかのプリミティブ、例えば :func:`~select.poll` や :mod:" -"`selectors` モジュール内のものを使う際にも似た但し書きが付きます)" +"(当然のことながら、ほかのプリミティブ、例えば :func:`~select.poll` " +"や :mod:`selectors` モジュール内のものを使う際にも似た但し書きが付きます)" #: ../../library/ssl.rst:2500 msgid "" -"The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." -"do_handshake` method has to be retried until it returns successfully. Here " -"is a synopsis using :func:`~select.select` to wait for the socket's " -"readiness::" +"The SSL handshake itself will be non-blocking: " +"the :meth:`SSLSocket.do_handshake` method has to be retried until it returns " +"successfully. Here is a synopsis using :func:`~select.select` to wait for " +"the socket's readiness::" msgstr "" -"SSL ハンドシェイクそのものがノンブロッキングになります: :meth:`SSLSocket." -"do_handshake` メソッドは成功するまでリトライしなければなりません。 :func:" -"`~select.select` を用いてソケットの準備が整うのを待つためには、およそ以下のよ" -"うにします::" +"SSL ハンドシェイクそのものがノンブロッキングになりま" +"す: :meth:`SSLSocket.do_handshake` メソッドは成功するまでリトライしなければな" +"りません。 :func:`~select.select` を用いてソケットの準備が整うのを待つために" +"は、およそ以下のようにします::" -#: ../../library/ssl.rst:2505 msgid "" "while True:\n" " try:\n" @@ -3644,16 +4065,30 @@ 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 `. It polls for events using the :mod:`selectors` module and " -"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" -"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " -"well." -msgstr "" +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` " +"and :exc:`BlockingIOError` exceptions. It runs the SSL handshake " +"asynchronously as well." +msgstr "" +":mod:`asyncio` モジュールは :ref:`ノンブロッキング SSL ソケット ` に対応し、より高水準の :ref:`Streams API ` を" +"提供します。\n" +":mod:`selectors` モジュールでイベントをポーリング" +"し、:exc:`SSLWantWriteError`、:exc:`SSLWantReadError`、:exc:`BlockingIOError` " +"の各例外を処理します。\n" +"SSL ハンドシェイクも非同期に実行します。" #: ../../library/ssl.rst:2525 msgid "Memory BIO Support" @@ -3661,8 +4096,8 @@ msgstr "メモリ BIO サポート" #: ../../library/ssl.rst:2529 msgid "" -"Ever since the SSL module was introduced in Python 2.6, the :class:" -"`SSLSocket` class has provided two related but distinct areas of " +"Ever since the SSL module was introduced in Python 2.6, " +"the :class:`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" "Python 2.6 で SSL モジュールが導入されて以降、:class:`SSLSocket` クラスは、以" @@ -3683,21 +4118,21 @@ msgid "" "used as a drop-in replacement for a regular socket, making it very easy to " "add SSL support to an existing application." msgstr "" -"ネットワーク IO API は、:class:`socket.socket` が提供するものと同じです。:" -"class:`SSLSocket` も、そのクラスから継承しています。これにより、SSL ソケット" -"は標準のソケットをそっくりそのまま置き換えるものとして使用できるため、既存の" -"アプリケーションを SSL に対応させるのが非常に簡単になります。" +"ネットワーク IO API は、:class:`socket.socket` が提供するものと同じで" +"す。:class:`SSLSocket` も、そのクラスから継承しています。これにより、SSL ソ" +"ケットは標準のソケットをそっくりそのまま置き換えるものとして使用できるため、" +"既存のアプリケーションを SSL に対応させるのが非常に簡単になります。" #: ../../library/ssl.rst:2540 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " "to use a different IO multiplexing model than the \"select/poll on a file " -"descriptor\" (readiness based) model that is assumed by :class:`socket." -"socket` and by the internal OpenSSL socket IO routines. This is mostly " -"relevant for platforms like Windows where this model is not efficient. For " -"this purpose, a reduced scope variant of :class:`SSLSocket` called :class:" -"`SSLObject` is provided." +"descriptor\" (readiness based) model that is assumed " +"by :class:`socket.socket` and by the internal OpenSSL socket IO routines. " +"This is mostly relevant for platforms like Windows where this model is not " +"efficient. For this purpose, a reduced scope variant of :class:`SSLSocket` " +"called :class:`SSLObject` is provided." msgstr "" "SSL プロトコルの処理とネットワーク IO を組み合わせた場合、通常は問題なく動作" "しますが、問題が発生する場合があります。一例を挙げると、非同期 IO フレーム" @@ -3782,13 +4217,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`" @@ -3853,14 +4286,15 @@ msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -"*do_handshake_on_connect* 機構はありません。必ず手動で :meth:`~SSLSocket." -"do_handshake` を呼んで、ハンドシェイクを開始する必要があります。" +"*do_handshake_on_connect* 機構はありません。必ず手動" +"で :meth:`~SSLSocket.do_handshake` を呼んで、ハンドシェイクを開始する必要があ" +"ります。" #: ../../library/ssl.rst:2601 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " -"that are in violation of the protocol are reported via the :exc:" -"`SSLEOFError` exception." +"that are in violation of the protocol are reported via " +"the :exc:`SSLEOFError` exception." msgstr "" "*suppress_ragged_eofs* は処理されません。プロトコルに違反するファイル末尾状態" "は、 :exc:`SSLEOFError` 例外を通じて報告されます。" @@ -3875,13 +4309,13 @@ msgstr "" #: ../../library/ssl.rst:2608 msgid "" -"The *server_name_callback* callback passed to :meth:`SSLContext." -"set_servername_callback` will get an :class:`SSLObject` instance instead of " -"a :class:`SSLSocket` instance as its first parameter." +"The *server_name_callback* callback passed " +"to :meth:`SSLContext.set_servername_callback` will get an :class:`SSLObject` " +"instance instead of a :class:`SSLSocket` instance as its first parameter." msgstr "" ":meth:`SSLContext.set_servername_callback` に渡される *server_name_callback* " -"コールバックは、1 つ目の引数として :class:`SSLSocket` インスタンスではなく :" -"class:`SSLObject` インスタンスを受け取ります。" +"コールバックは、1 つ目の引数として :class:`SSLSocket` インスタンスではな" +"く :class:`SSLObject` インスタンスを受け取ります。" #: ../../library/ssl.rst:2612 msgid "Some notes related to the use of :class:`SSLObject`:" @@ -3890,19 +4324,23 @@ msgstr ":class:`SSLObject` の使用に関する注意:" #: ../../library/ssl.rst:2614 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " -"This means that for example :meth:`~SSLSocket.read` will raise an :exc:" -"`SSLWantReadError` if it needs more data than the incoming BIO has available." +"This means that for example :meth:`~SSLSocket.read` will raise " +"an :exc:`SSLWantReadError` if it needs more data than the incoming BIO has " +"available." msgstr "" ":class:`SSLObject` 上のすべての IO は :ref:`non-blocking ` " "です。例えば、: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." +":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 +4370,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 "" @@ -3961,9 +4398,9 @@ msgid "" "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -"EOF マーカーをメモリ BIO に書き込みます。このメソッドが呼び出された後に :" -"meth:`~MemoryBIO.write` を呼ぶことはできません。:attr:`eof` 属性は、バッファ" -"内のすべてのデータが読み出された後に True になります。" +"EOF マーカーをメモリ BIO に書き込みます。このメソッドが呼び出された後" +"に :meth:`~MemoryBIO.write` を呼ぶことはできません。:attr:`eof` 属性は、バッ" +"ファ内のすべてのデータが読み出された後に True になります。" #: ../../library/ssl.rst:2664 msgid "SSL session" @@ -3984,11 +4421,11 @@ msgstr "最善のデフォルト値" #: ../../library/ssl.rst:2687 msgid "" "For **client use**, if you don't have any special requirements for your " -"security policy, it is highly recommended that you use the :func:" -"`create_default_context` function to create your SSL context. It will load " -"the system's trusted CA certificates, enable certificate validation and " -"hostname checking, and try to choose reasonably secure protocol and cipher " -"settings." +"security policy, it is highly recommended that you use " +"the :func:`create_default_context` function to create your SSL context. It " +"will load the system's trusted CA certificates, enable certificate " +"validation and hostname checking, and try to choose reasonably secure " +"protocol and cipher settings." msgstr "" "**クライアントでの使用** では、セキュリティポリシーによる特殊な要件がない限り" "は、 :func:`create_default_context` 関数を使用して SSL コンテキストを作成する" @@ -4004,7 +4441,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,21 +4448,26 @@ 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 "" -"If a client certificate is needed for the connection, it can be added with :" -"meth:`SSLContext.load_cert_chain`." +"If a client certificate is needed for the connection, it can be added " +"with :meth:`SSLContext.load_cert_chain`." msgstr "" "接続にクライアントの証明書が必要な場合、 :meth:`SSLContext.load_cert_chain` " "によって追加できます。" #: ../../library/ssl.rst:2706 msgid "" -"By contrast, if you create the SSL context by calling the :class:" -"`SSLContext` constructor yourself, it will not have certificate validation " -"nor hostname checking enabled by default. If you do so, please read the " -"paragraphs below to achieve a good security level." +"By contrast, if you create the SSL context by calling " +"the :class:`SSLContext` constructor yourself, it will not have certificate " +"validation nor hostname checking enabled by default. If you do so, please " +"read the paragraphs below to achieve a good security level." msgstr "" "対照的に、自分自身で :class:`SSLContext` クラスのコンストラクタを呼び出すこと" "によって SSL コンテキストを作ると、デフォルトでは証明書検証もホスト名チェック" @@ -4043,23 +4484,23 @@ msgstr "証明書の検証" #: ../../library/ssl.rst:2717 msgid "" -"When calling the :class:`SSLContext` constructor directly, :const:" -"`CERT_NONE` is the default. Since it does not authenticate the other peer, " -"it can be insecure, especially in client mode where most of the time you " -"would like to ensure the authenticity of the server you're talking to. " -"Therefore, when in client mode, it is highly recommended to use :const:" -"`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " -"check that the server certificate, which can be obtained by calling :meth:" -"`SSLSocket.getpeercert`, matches the desired service. For many protocols " -"and applications, the service can be identified by the hostname. This common " -"check is automatically performed when :attr:`SSLContext.check_hostname` is " -"enabled." +"When calling the :class:`SSLContext` constructor " +"directly, :const:`CERT_NONE` is the default. Since it does not authenticate " +"the other peer, it can be insecure, especially in client mode where most of " +"the time you would like to ensure the authenticity of the server you're " +"talking to. Therefore, when in client mode, it is highly recommended to " +"use :const:`CERT_REQUIRED`. However, it is in itself not sufficient; you " +"also have to check that the server certificate, which can be obtained by " +"calling :meth:`SSLSocket.getpeercert`, matches the desired service. For " +"many protocols and applications, the service can be identified by the " +"hostname. This common check is automatically performed " +"when :attr:`SSLContext.check_hostname` is enabled." msgstr "" #: ../../library/ssl.rst:2729 msgid "" -"Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"Hostname matchings is now performed by OpenSSL. Python no longer " +"uses :func:`match_hostname`." msgstr "" #: ../../library/ssl.rst:2733 @@ -4081,15 +4522,15 @@ msgstr "プロトコルのバージョン" msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " -"recommended to use :const:`PROTOCOL_TLS_CLIENT` or :const:" -"`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are disabled " -"by default." +"recommended to use :const:`PROTOCOL_TLS_CLIENT` " +"or :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are " +"disabled by default." msgstr "" "SSL バージョン 2 と 3 は安全性に欠けると考えられており、使用するのは危険で" "す。クライアントとサーバ間の互換性を最大限に確保したい場合、プロトコルバー" -"ジョンとして :const:`PROTOCOL_TLS_CLIENT` または :const:" -"`PROTOCOL_TLS_SERVER` を使用してください。 SSLv2 と SSLv3 はデフォルトで無効" -"になっています。" +"ジョンとして :const:`PROTOCOL_TLS_CLIENT` また" +"は :const:`PROTOCOL_TLS_SERVER` を使用してください。 SSLv2 と SSLv3 はデフォ" +"ルトで無効になっています。" #: ../../library/ssl.rst:2749 msgid "" @@ -4101,27 +4542,35 @@ msgstr "" #: ../../library/ssl.rst:2754 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " -"supported by your system) connections to a server. :const:" -"`PROTOCOL_TLS_CLIENT` implies certificate validation and hostname checks by " -"default. You have to load certificates into the context." +"supported by your system) connections to a " +"server. :const:`PROTOCOL_TLS_CLIENT` implies certificate validation and " +"hostname checks by default. You have to load certificates into the context." msgstr "" #: ../../library/ssl.rst:2761 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:" -"`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " -"disables certain weak ciphers by default, but you may want to further " -"restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled by a given " -"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " -"command on your system." -msgstr "" +"enabled when negotiating a SSL session is possible through " +"the :meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the " +"ssl module disables certain weak ciphers by default, but you may want to " +"further restrict the cipher choice. Be sure to read OpenSSL's documentation " +"about the `cipher list format `_. If you want to check which ciphers are enabled by a " +"given 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,26 +4591,30 @@ 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 "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " -"cipher suites are enabled by default. The method :meth:`SSLContext." -"set_ciphers` cannot enable or disable any TLS 1.3 ciphers yet, but :meth:" -"`SSLContext.get_ciphers` returns them." +"cipher suites are enabled by default. The " +"method :meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3 " +"ciphers yet, but :meth:`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 +4742,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 +4753,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..71efd4be0 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 @@ -39,11 +39,11 @@ msgid "" "exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` " "and :c:func:`!lstat` calls, consult the documentation for your system." msgstr "" -":mod:`stat` モジュールでは、 :func:`os.stat` 、 :func:`os.lstat` 、および :" -"func:`os.fstat` が存在する場合に、これらの関数が返す内容を解釈するための定数" -"や関数を定義しています。 :c:func:`stat` 、 :c:func:`!fstat` 、および :c:func:" -"`!lstat` の関数呼び出しについての完全な記述はシステムのドキュメントを参照して" -"ください。" +":mod:`stat` モジュールでは、 :func:`os.stat` 、 :func:`os.lstat` 、およ" +"び :func:`os.fstat` が存在する場合に、これらの関数が返す内容を解釈するための" +"定数や関数を定義しています。 :c:func:`stat` 、 :c:func:`!fstat` 、およ" +"び :c:func:`!lstat` の関数呼び出しについての完全な記述はシステムのドキュメン" +"トを参照してください。" #: ../../library/stat.rst:19 msgid "The stat module is backed by a C implementation." @@ -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 "" @@ -193,9 +223,9 @@ msgid "" "All the variables below are simply symbolic indexes into the 10-tuple " "returned by :func:`os.stat`, :func:`os.fstat` or :func:`os.lstat`." msgstr "" -"以下の全ての変数は、 :func:`os.stat` 、 :func:`os.fstat` 、または :func:`os." -"lstat` が返す 10 要素のタプルにおけるインデクスを単にシンボル定数化したもので" -"す。" +"以下の全ての変数は、 :func:`os.stat` 、 :func:`os.fstat` 、また" +"は :func:`os.lstat` が返す 10 要素のタプルにおけるインデクスを単にシンボル定" +"数化したものです。" #: ../../library/stat.rst:149 msgid "Inode protection mode." @@ -250,20 +280,21 @@ msgid "" "The interpretation of \"file size\" changes according to the file type. For " "plain files this is the size of the file in bytes. For FIFOs and sockets " "under most flavors of Unix (including Linux in particular), the \"size\" is " -"the number of bytes waiting to be read at the time of the call to :func:`os." -"stat`, :func:`os.fstat`, or :func:`os.lstat`; this can sometimes be useful, " -"especially for polling one of these special files after a non-blocking " -"open. The meaning of the size field for other character and block devices " -"varies more, depending on the implementation of the underlying system call." +"the number of bytes waiting to be read at the time of the call " +"to :func:`os.stat`, :func:`os.fstat`, or :func:`os.lstat`; this can " +"sometimes be useful, especially for polling one of these special files after " +"a non-blocking open. The meaning of the size field for other character and " +"block devices varies more, depending on the implementation of the underlying " +"system call." msgstr "" "\"ファイルサイズ\" の解釈はファイルの型によって異なります。通常のファイルの場" "合、サイズはファイルの大きさをバイトで表したものです。ほとんどの Unix 系 (特" -"に Linux) における FIFO やソケットの場合、\"サイズ\" は :func:`os.stat` 、 :" -"func:`os.fstat` 、あるいは :func:`os.lstat` を呼び出した時点で読み出し待ちで" -"あったデータのバイト数になります; この値は時に有用で、特に上記の特殊なファイ" -"ルを非ブロックモードで開いた後にポーリングを行いたいといった場合に便利です。" -"他のキャラクタ型およびブロック型デバイスにおけるサイズフィールドの意味はさら" -"に異なっていて、背後のシステムコールの実装によります。" +"に Linux) における FIFO やソケットの場合、\"サイズ\" " +"は :func:`os.stat` 、 :func:`os.fstat` 、あるいは :func:`os.lstat` を呼び出し" +"た時点で読み出し待ちであったデータのバイト数になります; この値は時に有用で、" +"特に上記の特殊なファイルを非ブロックモードで開いた後にポーリングを行いたいと" +"いった場合に便利です。他のキャラクタ型およびブロック型デバイスにおけるサイズ" +"フィールドの意味はさらに異なっていて、背後のシステムコールの実装によります。" #: ../../library/stat.rst:207 msgid "The variables below define the flags used in the :data:`ST_MODE` field." @@ -328,15 +359,13 @@ msgstr "" #: ../../library/stat.rst:262 msgid "" -"The following flags can also be used in the *mode* argument of :func:`os." -"chmod`:" +"The following flags can also be used in the *mode* argument " +"of :func:`os.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 +375,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 "" @@ -416,9 +447,9 @@ msgstr "その他は実行権限を持っている。" #: ../../library/stat.rst:335 msgid "" -"System V file locking enforcement. This flag is shared with :data:" -"`S_ISGID`: file/record locking is enforced on files that do not have the " -"group execution bit (:data:`S_IXGRP`) set." +"System V file locking enforcement. This flag is shared " +"with :data:`S_ISGID`: file/record locking is enforced on files that do not " +"have the group execution bit (:data:`S_IXGRP`) set." msgstr "" "System V ファイルロック強制。このフラグは :data:`S_ISGID` と共有されていま" "す。グループ実行ビット (:data:`S_IXGRP`) が設定されていないファイルでは、ファ" @@ -438,25 +469,22 @@ msgstr ":data:`S_IXUSR` の、 Unix V7 のシノニム。" #: ../../library/stat.rst:351 msgid "" -"The following flags can be used in the *flags* argument of :func:`os." -"chflags`:" +"The following flags can be used in the *flags* argument " +"of :func:`os.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 +492,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 "" @@ -531,10 +549,10 @@ msgstr "" #: ../../library/stat.rst:461 msgid "" "On Windows, the following file attribute constants are available for use " -"when testing bits in the ``st_file_attributes`` member returned by :func:`os." -"stat`. See the `Windows API documentation `_ for more detail on the meaning of " -"these constants." +"when testing bits in the ``st_file_attributes`` member returned " +"by :func:`os.stat`. See the `Windows API documentation `_ for more " +"detail on the meaning of these constants." msgstr "" "Windows では、:func:`os.stat` が返す ``st_file_attributes`` メンバー内のビッ" "トを検証する際に、以下のファイル属性定数を使用できます。これらの定数の意味に" diff --git a/library/statistics.po b/library/statistics.po index 9354e7bcd..bfb2f4ec8 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 @@ -57,19 +57,20 @@ msgstr "" #: ../../library/statistics.rst:31 msgid "" -"Unless explicitly noted, these functions support :class:`int`, :class:" -"`float`, :class:`~decimal.Decimal` and :class:`~fractions.Fraction`. " -"Behaviour with other types (whether in the numeric tower or not) is " -"currently unsupported. Collections with a mix of types are also undefined " -"and implementation-dependent. If your input data consists of mixed types, " -"you may be able to use :func:`map` to ensure a consistent result, for " -"example: ``map(float, input_data)``." -msgstr "" -"特に明記しない限り、これらの関数は :class:`int`, :class:`float`, :class:" -"`~decimal.Decimal` そして :class:`~fractions.Fraction` をサポートします。他の" -"型 (算術型及びそれ以外) は現在サポートされていません。型が混ざったコレクショ" -"ンも未定義で実装依存です。入力データが複数の型からなる場合、:func:`map` を使" -"用すると正しい結果が得られるでしょう。 例: ``map(float, input_data)``。" +"Unless explicitly noted, these functions " +"support :class:`int`, :class:`float`, :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Behaviour with other types (whether in the " +"numeric tower or not) is currently unsupported. Collections with a mix of " +"types are also undefined and implementation-dependent. If your input data " +"consists of mixed types, you may be able to use :func:`map` to ensure a " +"consistent result, for example: ``map(float, input_data)``." +msgstr "" +"特に明記しない限り、これらの関数" +"は :class:`int`, :class:`float`, :class:`~decimal.Decimal` そし" +"て :class:`~fractions.Fraction` をサポートします。他の型 (算術型及びそれ以" +"外) は現在サポートされていません。型が混ざったコレクションも未定義で実装依存" +"です。入力データが複数の型からなる場合、:func:`map` を使用すると正しい結果が" +"得られるでしょう。 例: ``map(float, input_data)``。" #: ../../library/statistics.rst:39 msgid "" @@ -88,7 +89,6 @@ msgstr "" "``mode()``, ``multimode()``, そして ``quantiles()`` です。 これらの関数を呼" "ぶ前に、 ``NaN`` 値を取り除く必要があります::" -#: ../../library/statistics.rst:47 msgid "" ">>> from statistics import median\n" ">>> from math import isnan\n" @@ -110,16 +110,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 +151,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 +172,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 +212,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 +243,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 +278,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 +352,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 +366,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 +392,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 +399,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 " +"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." +"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 +506,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 +518,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." +"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 +696,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 +710,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,24 +724,23 @@ 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 "" -"Return the low median of numeric data. If *data* is empty, :exc:" -"`StatisticsError` is raised. *data* can be a sequence or iterable." +"Return the low median of numeric data. If *data* is " +"empty, :exc:`StatisticsError` is raised. *data* can be a sequence or " +"iterable." msgstr "" -"数値データの小さい方の中央値(low median)を返します。もし *data* が空の場合、:" -"exc:`StatisticsError` が送出されます。*data* はシーケンス型またはイテラブルに" -"もなれます。" +"数値データの小さい方の中央値(low median)を返します。もし *data* が空の場" +"合、:exc:`StatisticsError` が送出されます。*data* はシーケンス型またはイテラ" +"ブルにもなれます。" #: ../../library/statistics.rst:374 msgid "" @@ -688,13 +751,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 "" @@ -709,9 +775,9 @@ msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -"データの大きい方の中央値(high median)を返します。もし *data* が空の場合、:" -"exc:`StatisticsError` が送出されます。 *data* はシーケンス型やイテラブルにも" -"なれます。" +"データの大きい方の中央値(high median)を返します。もし *data* が空の場" +"合、:exc:`StatisticsError` が送出されます。 *data* はシーケンス型やイテラブル" +"にもなれます。" #: ../../library/statistics.rst:394 msgid "" @@ -722,13 +788,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 +807,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 +845,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 +881,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 +930,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 +943,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 +959,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 +1000,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 +1020,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 +1048,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 +1065,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 +1088,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 +1106,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 +1113,10 @@ msgid "" "population, the result will be an unbiased estimate of the population " "variance." msgstr "" +"何らかの方法で真の母平均 μ が分かっている場合、その母平均を二つ目の引数に渡す" +"と、この関数で標本の分散を計算できます。\n" +"データ点が母集団からの無作為標本であれば、結果は母分散の不偏推定量になりま" +"す。" #: ../../library/statistics.rst:590 msgid "" @@ -1000,11 +1126,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 +1146,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 +1163,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 +1205,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,63 +1215,80 @@ 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 "" -"If you somehow know the actual population mean μ you should pass it to the :" -"func:`pvariance` function as the *mu* parameter to get the variance of a " -"sample." +"If you somehow know the actual population mean μ you should pass it to " +"the :func:`pvariance` function as the *mu* parameter to get the variance of " +"a sample." 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 +1297,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 +1314,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 +1333,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 +1357,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." +"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 +1375,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 +1393,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 +1400,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 +1421,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,48 +1451,70 @@ 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 " +"Return the slope and intercept of `simple linear regression `_ parameters estimated using " "ordinary least squares. Simple linear regression describes the relationship " "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 "" "Both inputs must be of the same length (no less than two), and the " -"independent variable *x* cannot be constant; otherwise a :exc:" -"`StatisticsError` is raised." +"independent variable *x* cannot be constant; otherwise " +"a :exc:`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 +1522,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 +1565,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 +1597,82 @@ 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." +"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 " +"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,124 +1680,164 @@ 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 " -"the `percent-point `_ " +"the `percent-point `_ " "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 " "distributed random variables `_ represented as instances of :" -"class:`NormalDist`. For example:" +"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 +1847,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 +1872,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 +1930,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 +1958,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 +1987,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 " +"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 +2041,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 +2071,6 @@ msgid "" "given the gender:" msgstr "" -#: ../../library/statistics.rst:1162 msgid "" ">>> prior_male = 0.5\n" ">>> prior_female = 0.5\n" @@ -1743,16 +2080,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..cac136226 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" @@ -85,23 +86,23 @@ msgstr "真理値判定" #: ../../library/stdtypes.rst:41 msgid "" -"Any object can be tested for truth value, for use in an :keyword:`if` or :" -"keyword:`while` condition or as operand of the Boolean operations below." +"Any object can be tested for truth value, for use in an :keyword:`if` " +"or :keyword:`while` condition or as operand of the Boolean operations below." msgstr "" -"どのようなオブジェクトでも真理値として判定でき、 :keyword:`if` や :keyword:" -"`while` の条件あるいは以下のブール演算の被演算子として使えます。" +"どのようなオブジェクトでも真理値として判定でき、 :keyword:`if` " +"や :keyword:`while` の条件あるいは以下のブール演算の被演算子として使えます。" #: ../../library/stdtypes.rst:46 msgid "" -"By default, an object is considered true unless its class defines either a :" -"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object." -"__len__` method that returns zero, when called with the object. [1]_ Here " -"are most of the built-in objects considered false:" +"By default, an object is considered true unless its class defines either " +"a :meth:`~object.__bool__` method that returns ``False`` or " +"a :meth:`~object.__len__` method that returns zero, when called with the " +"object. [1]_ Here are most of the built-in objects considered false:" msgstr "" -"オブジェクトは、デフォルトでは真と判定されます。ただし、そのクラスが :meth:" -"`~object.__bool__` メソッドを定義していて ``False`` を返す場合、または :meth:" -"`~object.__len__` メソッドを定義していてゼロを返す場合は偽と判定されます。 " -"[1]_ 以下は偽と判定される主な組み込みオブジェクトです:" +"オブジェクトは、デフォルトでは真と判定されます。ただし、そのクラス" +"が :meth:`~object.__bool__` メソッドを定義していて ``False`` を返す場合、また" +"は :meth:`~object.__len__` メソッドを定義していてゼロを返す場合は偽と判定され" +"ます。 [1]_ 以下は偽と判定される主な組み込みオブジェクトです:" #: ../../library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" @@ -344,8 +345,8 @@ msgstr "" "せん。 ``==`` 演算子は常に定義されていますが、いくつかのオブジェクト型 (たと" "えばクラスオブジェクト) では :keyword:`is` と同等になります。 ``<``, ``<=``, " "``>`` および ``>=`` 演算子は、それらの意味が明快である場合に限って定義されま" -"す; たとえば、オペランドのいずれかが複素数である場合、これらの演算子は :exc:" -"`TypeError` 例外を送出します。" +"す; たとえば、オペランドのいずれかが複素数である場合、これらの演算子" +"は :exc:`TypeError` 例外を送出します。" #: ../../library/stdtypes.rst:181 msgid "" @@ -359,16 +360,17 @@ msgstr "" msgid "" "Instances of a class cannot be ordered with respect to other instances of " "the same class, or other types of object, unless the class defines enough of " -"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object." -"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :" -"meth:`~object.__eq__` are sufficient, if you want the conventional meanings " -"of the comparison operators)." -msgstr "" -"クラスのインスタンスは、そのクラスがメソッド :meth:`~object.__lt__` 、 :meth:" -"`~object.__le__` 、 :meth:`~object.__gt__` 、 :meth:`~object.__ge__` のうち十" -"分なものを定義していない限り、同じクラスの別のインスタンスや他の型のオブジェ" -"クトとは順序付けできません (一般に、比較演算子の通常の意味を求めるなら、 :" -"meth:`~object.__lt__` と :meth:`~object.__eq__` だけで十分です)。" +"the " +"methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` " +"and :meth:`~object.__eq__` are sufficient, if you want the conventional " +"meanings of the comparison operators)." +msgstr "" +"クラスのインスタンスは、そのクラスがメソッ" +"ド :meth:`~object.__lt__` 、 :meth:`~object.__le__` 、 :meth:`~object.__gt__` 、 :meth:`~object.__ge__` " +"のうち十分なものを定義していない限り、同じクラスの別のインスタンスや他の型の" +"オブジェクトとは順序付けできません (一般に、比較演算子の通常の意味を求めるな" +"ら、 :meth:`~object.__lt__` と :meth:`~object.__eq__` だけで十分です)。" #: ../../library/stdtypes.rst:191 msgid "" @@ -382,8 +384,8 @@ msgstr "" #: ../../library/stdtypes.rst:199 msgid "" -"Two more operations with the same syntactic priority, :keyword:`in` and :" -"keyword:`not in`, are supported by types that are :term:`iterable` or " +"Two more operations with the same syntactic priority, :keyword:`in` " +"and :keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" ":keyword:`in` と :keyword:`not in` という構文上で同じ優先度を持つ演算子がさら" @@ -401,22 +403,23 @@ msgid "" "subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " "about the precision and internal representation of floating-point numbers " -"for the machine on which your program is running is available in :data:`sys." -"float_info`. Complex numbers have a real and imaginary part, which are each " -"a floating-point number. To extract these parts from a complex number *z*, " -"use ``z.real`` and ``z.imag``. (The standard library includes the additional " -"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." -"Decimal`, for floating-point numbers with user-definable precision.)" +"for the machine on which your program is running is available " +"in :data:`sys.float_info`. Complex numbers have a real and imaginary part, " +"which are each a floating-point number. To extract these parts from a " +"complex number *z*, use ``z.real`` and ``z.imag``. (The standard library " +"includes the additional numeric types :mod:`fractions.Fraction`, for " +"rationals, and :mod:`decimal.Decimal`, for floating-point numbers with user-" +"definable precision.)" msgstr "" "数値型には 3 種類あります: :dfn:`整数` 、 :dfn:`浮動小数点数` 、 :dfn:`複素数" "` です。さらに、ブール型は整数のサブタイプです。整数には精度の制限がありませ" "ん。浮動小数点型はたいていは C の :c:expr:`double` を使って実装されています; " -"あなたのプログラムが動作するマシンでの浮動小数点型の精度と内部表現は、 :data:" -"`sys.float_info` から入手可能です。複素数は実部と虚部を持ち、それぞれが浮動小" -"数点数です。複素数 *z* から実部および虚部を取り出すには、 ``z.real`` および " -"``z.imag`` を使ってください。 (標準ライブラリには、さらに分数のための数値型 :" -"mod:`fractions.Fraction` や、ユーザによる精度の定義が可能な浮動小数点数のため" -"の :mod:`decimal.Decimal` があります。)" +"あなたのプログラムが動作するマシンでの浮動小数点型の精度と内部表現" +"は、 :data:`sys.float_info` から入手可能です。複素数は実部と虚部を持ち、それ" +"ぞれが浮動小数点数です。複素数 *z* から実部および虚部を取り出すには、 " +"``z.real`` および ``z.imag`` を使ってください。 (標準ライブラリには、さらに分" +"数のための数値型 :mod:`fractions.Fraction` や、ユーザによる精度の定義が可能な" +"浮動小数点数のための :mod:`decimal.Decimal` があります。)" #: ../../library/stdtypes.rst:238 msgid "" @@ -452,17 +455,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 "" @@ -660,10 +665,10 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" -"整数の除算とも呼ばれます。 :class:`int` 型のオペランドに対しては、結果は :" -"class:`int` 型になります。 :class:`float` 型のオペランドに対しては、結果は :" -"class:`float` 型になります。一般に結果の型は必ずしも :class:`int` 型ではあり" -"ませんが、結果は常に整数です。結果は常に負の無限大の方向に丸められます: " +"整数の除算とも呼ばれます。 :class:`int` 型のオペランドに対しては、結果" +"は :class:`int` 型になります。 :class:`float` 型のオペランドに対しては、結果" +"は :class:`float` 型になります。一般に結果の型は必ずしも :class:`int` 型では" +"ありませんが、結果は常に整数です。結果は常に負の無限大の方向に丸められます: " "``1//2`` は ``0`` 、 ``(-1)//2`` は ``-1`` 、 ``1//(-2)`` は ``-1`` 、そして " "``(-1)//(-2)`` は ``0`` です。" @@ -775,15 +780,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 +882,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 " +"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 +912,6 @@ msgid "" msgstr "" "整数を、符号と先頭の 0 は除いて二進法で表すために必要なビットの数を返します::" -#: ../../library/stdtypes.rst:469 msgid "" ">>> n = -37\n" ">>> bin(n)\n" @@ -917,14 +919,19 @@ 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 "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " -"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." -"bit_length()`` returns ``0``." +"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then " +"``x.bit_length()`` returns ``0``." msgstr "" "正確には、 ``x`` が非 0 なら、 ``x.bit_length()`` は ``2**(k-1) <= abs(x) < " "2**k`` を満たす唯一の正の整数 ``k`` です。同様に、 ``abs(x)`` が十分小さくて" @@ -936,13 +943,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 +962,6 @@ msgstr "" "整数の絶対値の二進数表現における 1 の数を返します。これは population count と" "しても知られています。 例::" -#: ../../library/stdtypes.rst:496 msgid "" ">>> n = 19\n" ">>> bin(n)\n" @@ -962,12 +971,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." @@ -975,9 +992,9 @@ msgstr "整数を表すバイト列を返します。" #: ../../library/stdtypes.rst:525 msgid "" -"The integer is represented using *length* bytes, and defaults to 1. An :exc:" -"`OverflowError` is raised if the integer is not representable with the given " -"number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. " +"An :exc:`OverflowError` is raised if the integer is not representable with " +"the given number of bytes." msgstr "" "整数は *length* バイトで表されます、デフォルト値は 1 です。整数が与えられた数" "のバイトで表せなければ、 :exc:`OverflowError` が送出されます。" @@ -1013,11 +1030,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 +1066,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 "" @@ -1062,8 +1079,8 @@ msgid "" "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte " -"array. To request the native byte order of the host system, use :data:`sys." -"byteorder` as the byte order value." +"array. To request the native byte order of the host system, " +"use :data:`sys.byteorder` as the byte order value." msgstr "" "*byteorder* 引数は、整数を表すのに使われるバイトオーダーを決定します。デフォ" "ルト値は ``\"big\"`` です。 *byteorder* が ``\"big\"`` なら、最上位のバイトが" @@ -1110,8 +1127,8 @@ msgstr "" #: ../../library/stdtypes.rst:624 msgid "" -"Returns ``True``. Exists for duck type compatibility with :meth:`float." -"is_integer`." +"Returns ``True``. Exists for duck type compatibility " +"with :meth:`float.is_integer`." msgstr "" "常に ``True`` を返します。 :meth:`float.is_integer` に対するダックタイピング" "の互換性のために存在しています。" @@ -1132,28 +1149,33 @@ 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 "" "If the argument is an integer or a floating-point number, a floating-point " "number with the same value (within Python's floating-point precision) is " -"returned. If the argument is outside the range of a Python float, an :exc:" -"`OverflowError` will be raised." +"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 " +"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 "" "Return a pair of integers whose ratio is exactly equal to the original " -"float. The ratio is in lowest terms and has a positive denominator. Raises :" -"exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." +"float. The ratio is in lowest terms and has a positive denominator. " +"Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" "比が厳密に元の浮動小数点数であるような一対の整数を返します。比は既約分数とし" "て与えられ、分母は正の値です。無限大に対しては :exc:`OverflowError` を、非数 " @@ -1167,15 +1189,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 +1208,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 "" @@ -1209,8 +1233,8 @@ msgstr "" #: ../../library/stdtypes.rst:692 msgid "" -"Note that :meth:`float.hex` is an instance method, while :meth:`float." -"fromhex` is a class method." +"Note that :meth:`float.hex` is an instance method, " +"while :meth:`float.fromhex` is a class method." msgstr "" ":meth:`float.fromhex` はクラスメソッドですが、 :meth:`float.hex` はインスタン" "スメソッドであることに注意して下さい。" @@ -1221,7 +1245,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 "" @@ -1242,8 +1266,8 @@ msgstr "" "数部に含む必要があります。この制限は C99 規格のセクション 6.4.4.2 で規定され" "ていて、 Java 1.5 以降でも使われています。特に、 :meth:`float.hex` の出力は " "C や Java コード中で、浮動小数点数の 16 進表記として役に立つでしょう。また、 " -"C の ``%a`` 書式や、 Java の ``Double.toHexString`` で書きだされた文字列は :" -"meth:`float.fromhex` で受け付けられます。" +"C の ``%a`` 書式や、 Java の ``Double.toHexString`` で書きだされた文字列" +"は :meth:`float.fromhex` で受け付けられます。" #: ../../library/stdtypes.rst:712 msgid "" @@ -1256,11 +1280,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,26 +1295,30 @@ 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 "" -"The :class:`!complex` type implements the :class:`numbers.Complex` :term:" -"`abstract base class`. :class:`!complex` also has the following additional " -"methods." +"The :class:`!complex` type implements " +"the :class:`numbers.Complex` :term:`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 +1327,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" @@ -1306,28 +1340,30 @@ msgstr "数値型のハッシュ化" #: ../../library/stdtypes.rst:753 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " -"that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." -"__hash__` method documentation for more details). For ease of " -"implementation and efficiency across a variety of numeric types (including :" -"class:`int`, :class:`float`, :class:`decimal.Decimal` and :class:`fractions." -"Fraction`) Python's hash for numeric types is based on a single mathematical " -"function that's defined for any rational number, and hence applies to all " -"instances of :class:`int` and :class:`fractions.Fraction`, and all finite " -"instances of :class:`float` and :class:`decimal.Decimal`. Essentially, this " -"function is given by reduction modulo ``P`` for a fixed prime ``P``. The " -"value of ``P`` is made available to Python as the :attr:`~sys.hash_info." -"modulus` attribute of :data:`sys.hash_info`." +"that ``hash(x) == hash(y)`` whenever ``x == y`` (see " +"the :meth:`~object.__hash__` method documentation for more details). For " +"ease of implementation and efficiency across a variety of numeric types " +"(including :class:`int`, :class:`float`, :class:`decimal.Decimal` " +"and :class:`fractions.Fraction`) Python's hash for numeric types is based on " +"a single mathematical function that's defined for any rational number, and " +"hence applies to all instances of :class:`int` " +"and :class:`fractions.Fraction`, and all finite instances of :class:`float` " +"and :class:`decimal.Decimal`. Essentially, this function is given by " +"reduction modulo ``P`` for a fixed prime ``P``. The value of ``P`` is made " +"available to Python as the :attr:`~sys.hash_info.modulus` attribute " +"of :data:`sys.hash_info`." msgstr "" "数 ``x`` と ``y`` に対して、型が異なっていたとしても、 ``x == y`` であれば必" -"ず ``hash(x) == hash(y)`` であることが要請されます (詳細は :meth:`~object." -"__hash__` メソッドドキュメントを参照してください)。実装の簡単さと 複数の数値" -"型 (:class:`int` 、 :class:`float` 、 :class:`decimal.Decimal` 、 :class:" -"`fractions.Fraction` を含みます) 間の効率のため、Python の 数値型に対するハッ" -"シュ値はある単一の数学的関数に基づいていて、 その関数はすべての有理数に対し定" -"義されているため、 :class:`int` と :class:`fractions.Fraction` のすべてのイン" -"スタンスと、 :class:`float` と :class:`decimal.Decimal` のすべての有限なイン" -"スタンスに 対して適用されます。本質的には、この関数は定数の素数 ``P`` に対し" -"て ``P`` を法とする還元で与えられます。 値 ``P`` は、 :data:`sys.hash_info` " +"ず ``hash(x) == hash(y)`` であることが要請されます (詳細" +"は :meth:`~object.__hash__` メソッドドキュメントを参照してください)。実装の" +"簡単さと 複数の数値型 " +"(:class:`int` 、 :class:`float` 、 :class:`decimal.Decimal` 、 :class:`fractions.Fraction` " +"を含みます) 間の効率のため、Python の 数値型に対するハッシュ値はある単一の数" +"学的関数に基づいていて、 その関数はすべての有理数に対し定義されているた" +"め、 :class:`int` と :class:`fractions.Fraction` のすべてのインスタンス" +"と、 :class:`float` と :class:`decimal.Decimal` のすべての有限なインスタンス" +"に 対して適用されます。本質的には、この関数は定数の素数 ``P`` に対して ``P`` " +"を法とする還元で与えられます。 値 ``P`` は、 :data:`sys.hash_info` " "の :attr:`~sys.hash_info.modulus` 属性として Python で利用できます。" #: ../../library/stdtypes.rst:768 @@ -1383,28 +1419,27 @@ msgstr "" #: ../../library/stdtypes.rst:790 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " -"imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." -"imag * hash(z.imag)``, reduced modulo ``2**sys.hash_info.width`` so that it " -"lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " -"1))``. Again, if the result is ``-1``, it's replaced with ``-2``." +"imaginary parts are combined by computing ``hash(z.real) + " +"sys.hash_info.imag * hash(z.imag)``, reduced modulo " +"``2**sys.hash_info.width`` so that it lies in " +"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))``. " +"Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" "複素 (:class:`complex`) 数 ``z`` に対して、実部と虚部のハッシュ値は、 " -"``hash(z.real) + sys.hash_info.imag * hash(z.imag)`` の ``2**sys.hash_info." -"width`` を法とする還元を計算することにより組み合わせられ、よってこれは " -"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))`` に収ま" -"ります。再び、結果が ``-1`` なら、 ``-2`` で置き換えられます。" +"``hash(z.real) + sys.hash_info.imag * hash(z.imag)`` の " +"``2**sys.hash_info.width`` を法とする還元を計算することにより組み合わせられ、" +"よってこれは ``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`::" +"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" @@ -1446,8 +1481,8 @@ msgid "" "def hash_complex(z):\n" " \"\"\"Compute the hash of a complex number z.\"\"\"\n" "\n" -" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." -"imag)\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * " +"hash_float(z.imag)\n" " # do a signed reduction modulo 2**sys.hash_info.width\n" " M = 2**(sys.hash_info.width - 1)\n" " hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" @@ -1455,6 +1490,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 +1572,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 "" @@ -1527,8 +1610,8 @@ msgstr "" #: ../../library/stdtypes.rst:900 msgid "" -"One method needs to be defined for container objects to provide :term:" -"`iterable` support:" +"One method needs to be defined for container objects to " +"provide :term:`iterable` support:" msgstr "" "コンテナオブジェクトが :term:`イテラブル ` のサポートを提供するため" "には、一つのメソッドが定義されていなければなりません:" @@ -1540,17 +1623,17 @@ msgid "" "of iteration, additional methods can be provided to specifically request " "iterators for those iteration types. (An example of an object supporting " "multiple forms of iteration would be a tree structure which supports both " -"breadth-first and depth-first traversal.) This method corresponds to the :c:" -"member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " -"in the Python/C API." +"breadth-first and depth-first traversal.) This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" ":term:`iterator` オブジェクトを返します。オブジェクトは後述するイテレータプロ" "トコルをサポートする必要があります。もしコンテナが異なる種類の反復処理をサ" "ポートするなら、それぞれの反復処理のためのイテレータを要求するメソッドをそれ" "ぞれ提供しても構いません 。(複数の形式の反復処理を提供するオブジェクトの例と" "して、幅優先探索と深さ優先探索をサポートする木構造が挙げられます。)このメソッ" -"ドは Python/C API での Python オブジェクトの型構造体の :c:member:" -"`~PyTypeObject.tp_iter` スロットに対応します。" +"ドは Python/C API での Python オブジェクトの型構造体" +"の :c:member:`~PyTypeObject.tp_iter` スロットに対応します。" #: ../../library/stdtypes.rst:916 msgid "" @@ -1564,9 +1647,10 @@ msgstr "" #: ../../library/stdtypes.rst:922 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " -"containers and iterators to be used with the :keyword:`for` and :keyword:" -"`in` statements. This method corresponds to the :c:member:`~PyTypeObject." -"tp_iter` slot of the type structure for Python objects in the Python/C API." +"containers and iterators to be used with the :keyword:`for` " +"and :keyword:`in` statements. This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" ":term:`iterator` オブジェクト自体を返します。このメソッドはコンテナとイテレー" "タの両方を :keyword:`for` および :keyword:`in` 文で使えるようにするために必要" @@ -1580,10 +1664,10 @@ msgid "" "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" -":term:`iterator` の次のアイテムを返します。もしそれ以上アイテムが無ければ :" -"exc:`StopIteration` 例外を送出します。 このメソッドは Python/C APIでのPython" -"オブジェクトの型構造体の :c:member:`~PyTypeObject.tp_iternext` スロットに対応" -"します。" +":term:`iterator` の次のアイテムを返します。もしそれ以上アイテムが無けれ" +"ば :exc:`StopIteration` 例外を送出します。 このメソッドは Python/C APIでの" +"Pythonオブジェクトの型構造体の :c:member:`~PyTypeObject.tp_iternext` スロット" +"に対応します。" #: ../../library/stdtypes.rst:936 msgid "" @@ -1598,8 +1682,8 @@ msgstr "" #: ../../library/stdtypes.rst:941 msgid "" -"Once an iterator's :meth:`~iterator.__next__` method raises :exc:" -"`StopIteration`, it must continue to do so on subsequent calls. " +"Once an iterator's :meth:`~iterator.__next__` method " +"raises :exc:`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" "イテレータの :meth:`~iterator.__next__` メソッドが一旦 :exc:`StopIteration` " @@ -1615,11 +1699,18 @@ msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " "iterator protocol. If a container object's :meth:`~object.__iter__` method " "is implemented as a generator, it will automatically return an iterator " -"object (technically, a generator object) supplying the :meth:`~iterator." -"__iter__` and :meth:`~generator.__next__` methods. More information about " -"generators can be found in :ref:`the documentation for the yield expression " -"`." -msgstr "" +"object (technically, a generator object) supplying " +"the :meth:`~iterator.__iter__` and :meth:`~generator.__next__` methods. More " +"information about 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 +1731,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 "" @@ -1810,9 +1900,9 @@ msgstr "" msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " -"underlying sequence is mutated. The iterator terminates only when an :exc:" -"`IndexError` or a :exc:`StopIteration` is encountered (or when the index " -"drops below zero)." +"underlying sequence is mutated. The iterator terminates only when " +"an :exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the " +"index drops below zero)." msgstr "" "ミュータブルなシーケンスに対する前方および逆方向イテレータはインデックスを" "使って要素にアクセスします。インデックスは、仮に参照するシーケンスが変化した" @@ -1827,29 +1917,30 @@ msgid "" "as :class:`str`, :class:`bytes` and :class:`bytearray`) also use them for " "subsequence testing::" msgstr "" -"``in`` および ``not in`` 演算は、一般に単純な包含判定にのみ使われますが、(:" -"class:`str`, :class:`bytes`, :class:`bytearray` のような) 特殊なシーケンスで" -"は部分シーケンス判定にも使われます::" +"``in`` および ``not in`` 演算は、一般に単純な包含判定にのみ使われますが、" +"(: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 +1949,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 +1968,6 @@ msgstr "" "と、その一つのリストが変更されます。別々のリストのリストを作るにはこうしま" "す::" -#: ../../library/stdtypes.rst:1087 msgid "" ">>> lists = [[] for i in range(3)]\n" ">>> lists[0].append(3)\n" @@ -1880,6 +1976,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 "" @@ -1951,25 +2053,25 @@ msgstr "" #: ../../library/stdtypes.rst:1126 msgid "" -"if concatenating :class:`str` objects, you can build a list and use :meth:" -"`str.join` at the end or else write to an :class:`io.StringIO` instance and " -"retrieve its value when complete" +"if concatenating :class:`str` objects, you can build a list and " +"use :meth:`str.join` at the end or else write to an :class:`io.StringIO` " +"instance and retrieve its value when complete" msgstr "" -":class:`str` オブジェクトを結合するには、リストを構築して最後に :meth:`str." -"join` を使うか、 :class:`io.StringIO` インスタンスに書き込んで完成してから値" -"を取得してください" +":class:`str` オブジェクトを結合するには、リストを構築して最後" +"に :meth:`str.join` を使うか、 :class:`io.StringIO` インスタンスに書き込んで" +"完成してから値を取得してください" #: ../../library/stdtypes.rst:1130 msgid "" -"if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." -"join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" -"class:`bytearray` object. :class:`bytearray` objects are mutable and have " -"an efficient overallocation mechanism" +"if concatenating :class:`bytes` objects, you can similarly " +"use :meth:`bytes.join` or :class:`io.BytesIO`, or you can do in-place " +"concatenation with a :class:`bytearray` object. :class:`bytearray` objects " +"are mutable and have an efficient overallocation mechanism" msgstr "" -":class:`bytes` オブジェクトを結合するなら、同様に :meth:`bytes.join` や :" -"class:`io.BytesIO` を使うか、 :class:`bytearray` オブジェクトでインプレースに" -"結合できます。 :class:`bytearray` オブジェクトはミュータブルで、効率のいい割" -"り当て超過機構を備えています" +":class:`bytes` オブジェクトを結合するなら、同様に :meth:`bytes.join` " +"や :class:`io.BytesIO` を使うか、 :class:`bytearray` オブジェクトでインプレー" +"スに結合できます。 :class:`bytearray` オブジェクトはミュータブルで、効率のい" +"い割り当て超過機構を備えています" #: ../../library/stdtypes.rst:1135 msgid "if concatenating :class:`tuple` objects, extend a :class:`list` instead" @@ -2013,8 +2115,8 @@ msgstr "イミュータブルなシーケンス型" #: ../../library/stdtypes.rst:1164 msgid "" "The only operation that immutable sequence types generally implement that is " -"not also implemented by mutable sequence types is support for the :func:" -"`hash` built-in." +"not also implemented by mutable sequence types is support for " +"the :func:`hash` built-in." msgstr "" "イミュータブルなシーケンス型が一般に実装している演算のうち、ミュータブルな" "シーケンス型がサポートしていないのは、組み込みの :func:`hash` だけです。" @@ -2022,8 +2124,8 @@ msgstr "" #: ../../library/stdtypes.rst:1168 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " -"to be used as :class:`dict` keys and stored in :class:`set` and :class:" -"`frozenset` instances." +"to be used as :class:`dict` keys and stored in :class:`set` " +"and :class:`frozenset` instances." msgstr "" "このサポートにより、:class:`tuple` インスタンスのようなイミュータブルなシーケ" "ンスは、 :class:`dict` のキーとして使え、 :class:`set` や :class:`frozenset` " @@ -2041,15 +2143,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 "" @@ -2220,9 +2321,9 @@ msgstr "" msgid "" ":meth:`clear` and :meth:`!copy` are included for consistency with the " "interfaces of mutable containers that don't support slicing operations (such " -"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of the :class:" -"`collections.abc.MutableSequence` ABC, but most concrete mutable sequence " -"classes provide it." +"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of " +"the :class:`collections.abc.MutableSequence` ABC, but most concrete mutable " +"sequence classes provide it." msgstr "" ":meth:`clear` および :meth:`!copy` は、スライシング操作をサポートしないミュー" "タブルなコンテナ (:class:`dict` や :class:`set` など) のインターフェースとの" @@ -2234,18 +2335,17 @@ 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`." +"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" @@ -2329,8 +2429,8 @@ msgstr "" #: ../../library/stdtypes.rst:1340 msgid "" -":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" -"`keyword-only arguments `):" +":meth:`sort` accepts two arguments that can only be passed by keyword " +"(:ref:`keyword-only arguments `):" msgstr "" ":meth:`sort` は、キーワードでしか渡せない 2 つの引数 (:ref:`キーワード専用引" "数 `) を受け付けます:" @@ -2353,8 +2453,8 @@ msgid "" "The :func:`functools.cmp_to_key` utility is available to convert a 2.x style " "*cmp* function to a *key* function." msgstr "" -"2.x 形式の *cmp* 関数を *key* 関数に変換するために、:func:`functools." -"cmp_to_key` ユーティリティが利用できます。" +"2.x 形式の *cmp* 関数を *key* 関数に変換するため" +"に、:func:`functools.cmp_to_key` ユーティリティが利用できます。" #: ../../library/stdtypes.rst:1353 msgid "" @@ -2394,17 +2494,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" @@ -2415,14 +2515,14 @@ msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " "built-in). Tuples are also used for cases where an immutable sequence of " -"homogeneous data is needed (such as allowing storage in a :class:`set` or :" -"class:`dict` instance)." +"homogeneous data is needed (such as allowing storage in a :class:`set` " +"or :class:`dict` instance)." msgstr "" "タプルはイミュータブルなシーケンスで、一般的に異種のデータの集まり (組み込み" "の :func:`enumerate` で作られた 2-タプルなど) を格納するために使われます。タ" -"プルはまた、同種のデータのイミュータブルなシーケンスが必要な場合 (:class:" -"`set` インスタンスや :class:`dict` インスタンスに保存できるようにするためな" -"ど) にも使われます。" +"プルはまた、同種のデータのイミュータブルなシーケンスが必要な場合 " +"(:class:`set` インスタンスや :class:`dict` インスタンスに保存できるようにする" +"ためなど) にも使われます。" #: ../../library/stdtypes.rst:1391 msgid "Tuples may be constructed in a number of ways:" @@ -2489,8 +2589,8 @@ msgid "" "choice than a simple tuple object." msgstr "" "異種のデータの集まりで、インデックスによってアクセスするよりも名前によってア" -"クセスしたほうが明確になるものには、単純なタプルオブジェクトよりも :func:" -"`collections.namedtuple` が向いているかもしれません。" +"クセスしたほうが明確になるものには、単純なタプルオブジェクトより" +"も :func:`collections.namedtuple` が向いているかもしれません。" #: ../../library/stdtypes.rst:1423 msgid "Ranges" @@ -2501,22 +2601,22 @@ msgid "" "The :class:`range` type represents an immutable sequence of numbers and is " "commonly used for looping a specific number of times in :keyword:`for` loops." msgstr "" -":class:`range` 型は、数のイミュータブルなシーケンスを表し、一般に :keyword:" -"`for` ループにおいて特定の回数のループに使われます。" +":class:`range` 型は、数のイミュータブルなシーケンスを表し、一般" +"に :keyword:`for` ループにおいて特定の回数のループに使われます。" #: ../../library/stdtypes.rst:1434 msgid "" -"The arguments to the range constructor must be integers (either built-in :" -"class:`int` or any object that implements the :meth:`~object.__index__` " +"The arguments to the range constructor must be integers (either built-" +"in :class:`int` or any object that implements the :meth:`~object.__index__` " "special method). If the *step* argument is omitted, it defaults to ``1``. " "If the *start* argument is omitted, it defaults to ``0``. If *step* is " "zero, :exc:`ValueError` is raised." msgstr "" -"range コンストラクタの引数は整数 (組み込みの :class:`int` または :meth:" -"`~object.__index__` 特殊メソッドを実装するオブジェクト) でなければなりませ" -"ん。*step* 引数が省略された場合のデフォルト値は ``1`` です。*start* 引数が省" -"略された場合のデフォルト値は ``0`` です。 *step* が 0 の場合、:exc:" -"`ValueError` が送出されます。" +"range コンストラクタの引数は整数 (組み込みの :class:`int` また" +"は :meth:`~object.__index__` 特殊メソッドを実装するオブジェクト) でなければな" +"りません。*step* 引数が省略された場合のデフォルト値は ``1`` です。*start* 引" +"数が省略された場合のデフォルト値は ``0`` です。 *step* が 0 の場" +"合、:exc:`ValueError` が送出されます。" #: ../../library/stdtypes.rst:1440 msgid "" @@ -2548,8 +2648,8 @@ msgstr "" #: ../../library/stdtypes.rst:1453 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " -"permitted but some features (such as :func:`len`) may raise :exc:" -"`OverflowError`." +"permitted but some features (such as :func:`len`) may " +"raise :exc:`OverflowError`." msgstr "" "range は :data:`sys.maxsize` より大きい絶対値を含むことができますが、いくつか" "の機能 (:func:`len` など) は :exc:`OverflowError` を送出することがあります。" @@ -2558,7 +2658,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 +2674,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 "" @@ -2605,16 +2718,16 @@ msgstr "引数 *step* の値 (この引数が与えられていない場合は ` #: ../../library/stdtypes.rst:1493 msgid "" -"The advantage of the :class:`range` type over a regular :class:`list` or :" -"class:`tuple` is that a :class:`range` object will always take the same " +"The advantage of the :class:`range` type over a regular :class:`list` " +"or :class:`tuple` is that a :class:`range` object will always take the same " "(small) amount of memory, no matter the size of the range it represents (as " "it only stores the ``start``, ``stop`` and ``step`` values, calculating " "individual items and subranges as needed)." msgstr "" -":class:`range` 型が通常の :class:`list` や :class:`tuple` にまさる点は、:" -"class:`range` オブジェクトがサイズや表す範囲にかかわらず常に一定の (小さな) " -"量のメモリを使うことです (``start``、``stop``、``step`` の値のみを保存し、後" -"は必要に応じて個々の項目や部分 range を計算するためです)。" +":class:`range` 型が通常の :class:`list` や :class:`tuple` にまさる点" +"は、:class:`range` オブジェクトがサイズや表す範囲にかかわらず常に一定の (小さ" +"な) 量のメモリを使うことです (``start``、``stop``、``step`` の値のみを保存" +"し、後は必要に応じて個々の項目や部分 range を計算するためです)。" #: ../../library/stdtypes.rst:1499 msgid "" @@ -2638,15 +2751,15 @@ msgstr "" "``==`` および ``!=`` による range オブジェクトの等価性の判定は、これらをシー" "ケンスとして比較します。つまり、二つの range オブジェクトは同じ値のシーケンス" "を表すなら等しいとみなされます。(なお、二つの等しいとされる range オブジェク" -"トが異なる :attr:`~range.start`, :attr:`~range.stop` および :attr:`~range." -"step` 属性を持つことがあります。例えば ``range(0) == range(2, 1, 3)`` や " -"``range(0, 3, 2) == range(0, 4, 2)``。)" +"トが異なる :attr:`~range.start`, :attr:`~range.stop` およ" +"び :attr:`~range.step` 属性を持つことがあります。例えば ``range(0) == " +"range(2, 1, 3)`` や ``range(0, 3, 2) == range(0, 4, 2)``。)" #: ../../library/stdtypes.rst:1526 msgid "" -"Implement the Sequence ABC. Support slicing and negative indices. Test :" -"class:`int` objects for membership in constant time instead of iterating " -"through all items." +"Implement the Sequence ABC. Support slicing and negative indices. " +"Test :class:`int` objects for membership in constant time instead of " +"iterating through all items." msgstr "" "シーケンス ABC を実装。スライスと負のインデックスのサポート。:class:`int` オ" "ブジェクトの帰属判定を、すべてのアイテムをイテレートする代わりに、定数時間で" @@ -2678,15 +2791,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 +2807,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 +2834,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`" @@ -3062,9 +3168,9 @@ msgstr "テキストシーケンス型 --- :class:`str`" #: ../../library/stdtypes.rst:1650 msgid "" -"Textual data in Python is handled with :class:`str` objects, or :dfn:" -"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " -"points. String literals are written in a variety of ways:" +"Textual data in Python is handled with :class:`str` objects, " +"or :dfn:`strings`. Strings are immutable :ref:`sequences ` of " +"Unicode code points. String literals are written in a variety of ways:" msgstr "" "Python のテキストデータは :class:`str` オブジェクト、すなわち :dfn:`文字列` " "として扱われます。文字列は Unicode コードポイントのイミュータブルな :ref:`" @@ -3130,14 +3236,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." +"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 "" @@ -3161,39 +3266,39 @@ msgstr "" #: ../../library/stdtypes.rst:1699 msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" -"`type(object).__str__(object) `, which is the \"informal\" " -"or nicely printable string representation of *object*. For string objects, " -"this is the string itself. If *object* does not have a :meth:`~object." -"__str__` method, then :func:`str` falls back to returning :func:" -"`repr(object) `." +"If neither *encoding* nor *errors* is given, ``str(object)`` " +"returns :meth:`type(object).__str__(object) `, which is the " +"\"informal\" or nicely printable string representation of *object*. For " +"string objects, this is the string itself. If *object* does not have " +"a :meth:`~object.__str__` method, then :func:`str` falls back to " +"returning :func:`repr(object) `." msgstr "" "*encoding* も *errors* も与えられない場合、 ``str(object)`` は \"形式ばらず" -"\"、 表示用にきれいに整えられた *object* の文字列表現である :meth:" -"`type(object).__str__(object) ` を返します。文字列オブジェク" -"トに対しては、文字列そのものです。 *object* が :meth:`~object.__str__` メソッ" -"ドを持たない場合、 :func:`str` は代わりに :func:`repr(object) ` の結果" -"を返します。" +"\"、 表示用にきれいに整えられた *object* の文字列表現であ" +"る :meth:`type(object).__str__(object) ` を返します。文字列オ" +"ブジェクトに対しては、文字列そのものです。 *object* " +"が :meth:`~object.__str__` メソッドを持たない場合、 :func:`str` は代わり" +"に :func:`repr(object) ` の結果を返します。" #: ../../library/stdtypes.rst:1711 msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be a :" -"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"If at least one of *encoding* or *errors* is given, *object* should be " +"a :term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " "this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." -"decode(encoding, errors) `. Otherwise, the bytes object " -"underlying the buffer object is obtained before calling :meth:`bytes." -"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " -"buffer objects." -msgstr "" -"*encoding* か *errors* の少なくとも一方が与えられた場合、 *object* は :term:" -"`bytes-like object` (たとえば :class:`bytes` や :class:`bytearray`) でなくて" -"はなりません。*object* が :class:`bytes` (もしくは :class:`bytearray`) オブ" -"ジェクトである場合は、 ``str(bytes, encoding, errors)`` は :meth:`bytes." -"decode(encoding, errors) ` と等価です。そうでない場合は、 :" -"meth:`bytes.decode` が呼ばれる前に buffer オブジェクトの下層にある bytes オブ" -"ジェクトが取得されます。 buffer オブジェクトについて詳しい情報は、 :ref:" -"`binaryseq` や :ref:`bufferobjects` を参照してください。" +"then ``str(bytes, encoding, errors)`` is equivalent " +"to :meth:`bytes.decode(encoding, errors) `. Otherwise, the " +"bytes object underlying the buffer object is obtained before " +"calling :meth:`bytes.decode`. See :ref:`binaryseq` and :ref:`bufferobjects` " +"for information on buffer objects." +msgstr "" +"*encoding* か *errors* の少なくとも一方が与えられた場合、 *object* " +"は :term:`bytes-like object` (たとえば :class:`bytes` や :class:`bytearray`) " +"でなくてはなりません。*object* が :class:`bytes` (もしく" +"は :class:`bytearray`) オブジェクトである場合は、 ``str(bytes, encoding, " +"errors)`` は :meth:`bytes.decode(encoding, errors) ` と等価で" +"す。そうでない場合は、 :meth:`bytes.decode` が呼ばれる前に buffer オブジェク" +"トの下層にある bytes オブジェクトが取得されます。 buffer オブジェクトについて" +"詳しい情報は、 :ref:`binaryseq` や :ref:`bufferobjects` を参照してください。" #: ../../library/stdtypes.rst:1720 msgid "" @@ -3202,27 +3307,28 @@ msgid "" "string representation (see also the :option:`-b` command-line option to " "Python). For example::" msgstr "" -"*encoding* 引数や *errors* 引数無しに :class:`bytes` オブジェクトを :func:" -"`str` に渡すと、略式の文字列表現を返す 1 つ目の場合に該当します。(Python のコ" -"マンドラインオプション :option:`-b` も参照してください) 例えば::" +"*encoding* 引数や *errors* 引数無しに :class:`bytes` オブジェクト" +"を :func:`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." +"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" @@ -3239,11 +3345,11 @@ msgstr "" #: ../../library/stdtypes.rst:1748 msgid "" "Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization (see :meth:`str.format`, :ref:" -"`formatstrings` and :ref:`string-formatting`) and the other based on C " -"``printf`` style formatting that handles a narrower range of types and is " -"slightly harder to use correctly, but is often faster for the cases it can " -"handle (:ref:`old-string-formatting`)." +"degree of flexibility and customization " +"(see :meth:`str.format`, :ref:`formatstrings` and :ref:`string-formatting`) " +"and the other based on C ``printf`` style formatting that handles a narrower " +"range of types and is slightly harder to use correctly, but is often faster " +"for the cases it can handle (:ref:`old-string-formatting`)." msgstr "" "文字列は、二形式の文字列書式化をサポートします。一方は柔軟さが高くカスタマイ" "ズできます (:meth:`str.format`、 :ref:`formatstrings` 、および :ref:`string-" @@ -3290,8 +3396,8 @@ msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " "German lowercase letter ``'ß'`` is equivalent to ``\"ss\"``. Since it is " -"already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" -"`casefold` converts it to ``\"ss\"``." +"already lowercase, :meth:`lower` would do nothing to " +"``'ß'``; :meth:`casefold` converts it to ``\"ss\"``." msgstr "" "casefold は、小文字化と似ていますが、より積極的です。これは文字列の大文字小文" "字の区別をすべて取り去ることを意図しているためです。例えば、ドイツ語の小文字 " @@ -3305,14 +3411,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 +3430,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 +3453,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 +3465,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`." @@ -3361,16 +3485,16 @@ msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." msgstr "" -"*encoding* のデフォルト値は ``'utf-8'`` です; 指定可能な値については :ref:" -"`standard-encodings` を参照してください。" +"*encoding* のデフォルト値は ``'utf-8'`` です; 指定可能な値について" +"は :ref:`standard-encodings` を参照してください。" #: ../../library/stdtypes.rst:1828 msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, " -"``'backslashreplace'`` and any other name registered via :func:`codecs." -"register_error`. See :ref:`error-handlers` for details." +"``'backslashreplace'`` and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" "*errors* はエンコーディングエラーをどのように取り扱うかを制御します。 " "``'strict'`` (デフォルト) では :exc:`UnicodeError` 例外が送出されます。そのほ" @@ -3381,8 +3505,8 @@ msgstr "" #: ../../library/stdtypes.rst:1835 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" -"ref:`debug build ` is used." +"unless an encoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" "パフォーマンス上の理由から、 *errors* の値の妥当性は、エンコーディングエラー" "が実際に発生するか、 :ref:`devmode` が有効になっているか、もしくは :ref:`デ" @@ -3394,8 +3518,8 @@ msgstr "キーワード引数のサポートが追加されました。" #: ../../library/stdtypes.rst:1843 ../../library/stdtypes.rst:3196 msgid "" -"The value of the *errors* argument is now checked in :ref:`devmode` and in :" -"ref:`debug mode `." +"The value of the *errors* argument is now checked in :ref:`devmode` and " +"in :ref:`debug mode `." msgstr "" "*errors* 引数の値は :ref:`devmode` と :ref:`デバッグモード ` で" "チェックされるようになりました。" @@ -3451,18 +3575,19 @@ msgstr "" #: ../../library/stdtypes.rst:1885 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" ":meth:`~str.find` メソッドは、 *sub* の位置を知りたいときにのみ使うべきで" "す。 *sub* が部分文字列であるかどうかのみを調べるには、 :keyword:`in` 演算子" "を使ってください::" -#: ../../library/stdtypes.rst:1889 msgid "" ">>> 'Py' in 'Python'\n" "True" msgstr "" +">>> 'Py' in 'Python'\n" +"True" #: ../../library/stdtypes.rst:1895 msgid "" @@ -3484,34 +3609,35 @@ msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" -"書式指定のオプションについては、書式指定文字列を規定する :ref:" -"`formatstrings` を参照してください。" +"書式指定のオプションについては、書式指定文字列を規定す" +"る :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}'." -"format(1234)``), the function temporarily sets the ``LC_CTYPE`` locale to " -"the ``LC_NUMERIC`` locale to decode ``decimal_point`` and ``thousands_sep`` " -"fields of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, " -"and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " -"This temporary change affects other threads." +"When formatting a number " +"(:class:`int`, :class:`float`, :class:`complex`, :class:`decimal.Decimal` " +"and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the " +"function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " +"locale to decode ``decimal_point`` and ``thousands_sep`` fields " +"of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, 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 "" @@ -3528,27 +3654,27 @@ msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" -":meth:`~str.find` と同様ですが、部分文字列が見つからなかったとき :exc:" -"`ValueError` を送出します。" +":meth:`~str.find` と同様ですが、部分文字列が見つからなかったと" +"き :exc:`ValueError` を送出します。" #: ../../library/stdtypes.rst:1948 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " -"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." -"isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." +"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, " +"``c.isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" "文字列中の全ての文字が英数字で、かつ 1 文字以上あるなら ``True`` を、そうでな" "ければ ``False`` を返します。文字 ``c`` は以下のいずれかが ``True`` を返せば" -"英数字です: ``c.isalpha()`` 、 ``c.isdecimal()`` 、 ``c.isdigit()`` 、 ``c." -"isnumeric()`` 。" +"英数字です: ``c.isalpha()`` 、 ``c.isdecimal()`` 、 ``c.isdigit()`` 、 " +"``c.isnumeric()`` 。" #: ../../library/stdtypes.rst:1956 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " -"those characters defined in the Unicode character database as \"Letter\", i." -"e., those with general category property being one of \"Lm\", \"Lt\", " +"those characters defined in the Unicode character database as \"Letter\", " +"i.e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " "of the Unicode Standard >> from keyword import iskeyword\n" "\n" @@ -3622,6 +3748,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 +3779,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 +3806,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,15 +3820,15 @@ 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, " -"space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." +"A character is *whitespace* if in the Unicode character database " +"(see :mod:`unicodedata`), either its general category is ``Zs`` " +"(\"Separator, space\"), or its bidirectional class is one of ``WS``, ``B``, " +"or ``S``." msgstr "" "Unicode 文字データベース (:mod:`unicodedata` を参照) で一般カテゴリが ``Zs`` " "(\"Seperator, space\") であるか、 双方向クラスが ``WS``、``B``、 ``S`` のい" -"ずれかである場合、その文字は *空白文字(whitespace)* です。 " +"ずれかである場合、その文字は *空白文字(whitespace)* です。" #: ../../library/stdtypes.rst:2059 msgid "" @@ -3711,14 +3853,15 @@ msgstr "" #: ../../library/stdtypes.rst:2084 msgid "" -"Return a string which is the concatenation of the strings in *iterable*. A :" -"exc:`TypeError` will be raised if there are any non-string values in " +"Return a string which is the concatenation of the strings in *iterable*. " +"A :exc:`TypeError` will be raised if there are any non-string values in " "*iterable*, including :class:`bytes` objects. The separator between " "elements is the string providing this method." msgstr "" -"*iterable* 中の文字列を結合した文字列を返します。 *iterable* に :class:" -"`bytes` オブジェクトのような非文字列の値が存在するなら、 :exc:`TypeError` が" -"送出されます。要素間のセパレータは、このメソッドを提供する文字列です。" +"*iterable* 中の文字列を結合した文字列を返します。 *iterable* " +"に :class:`bytes` オブジェクトのような非文字列の値が存在するな" +"ら、 :exc:`TypeError` が送出されます。要素間のセパレータは、このメソッドを提" +"供する文字列です。" #: ../../library/stdtypes.rst:2092 msgid "" @@ -3758,13 +3901,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,18 +3920,21 @@ 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 "" -"This static method returns a translation table usable for :meth:`str." -"translate`." +"This static method returns a translation table usable " +"for :meth:`str.translate`." msgstr "" "この静的メソッドは :meth:`str.translate` に使える変換テーブルを返します。" @@ -3832,13 +3981,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 +4001,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 "" @@ -3924,8 +4079,8 @@ msgstr "" "*sep* を区切り文字とした、文字列中の単語のリストを返します。 *maxsplit* が与" "えられた場合、文字列の *右端* から最大 *maxsplit* 回分割を行います。*sep* が" "指定されていない、あるいは ``None`` のとき、全ての空白文字が区切り文字となり" -"ます。右から分割していくことを除けば、 :meth:`rsplit` は後ほど詳しく述べる :" -"meth:`split` と同様に振る舞います。" +"ます。右から分割していくことを除けば、 :meth:`rsplit` は後ほど詳しく述べ" +"る :meth:`split` と同様に振る舞います。" #: ../../library/stdtypes.rst:2228 msgid "" @@ -3940,13 +4095,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,15 +4114,18 @@ msgstr "" "文字の集合全てではなく、指定した文字列そのものを接尾辞として削除するメソッド" "については :meth:`str.removesuffix` を参照してください。使用例::" -#: ../../library/stdtypes.rst:2241 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" msgstr "" - -#: ../../library/stdtypes.rst:2248 +">>> 'Monty Python'.rstrip(' Python')\n" +"'M'\n" +">>> 'Monty Python'.removesuffix(' Python')\n" +"'Monty'" + +#: ../../library/stdtypes.rst:2248 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3982,9 +4143,9 @@ msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " "``['1', '', '2']``). The *sep* argument may consist of multiple characters " -"as a single delimiter (to split with multiple delimiters, use :func:`re." -"split`). Splitting an empty string with a specified separator returns " -"``['']``." +"as a single delimiter (to split with multiple delimiters, " +"use :func:`re.split`). Splitting an empty string with a specified separator " +"returns ``['']``." msgstr "" "*sep* が与えられた場合、連続した区切り文字はまとめられず、空の文字列を区切っ" "ていると判断されます(例えば ``'1,,2'.split(',')`` は ``['1', '', '2']`` を返" @@ -4005,7 +4166,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/stdtypes.rst:2263 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -4016,6 +4176,14 @@ 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 "" @@ -4031,7 +4199,6 @@ msgstr "" "末尾に空白があっても、結果の最初や最後に空文字列は含まれません。よって、空文" "字列や空白だけの文字列を ``None`` デリミタで分割すると ``[]`` が返されます。" -#: ../../library/stdtypes.rst:2281 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -4040,14 +4207,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 +4229,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 +4281,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 +4352,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 +4423,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,18 +4446,20 @@ 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 "" "Return a copy of the string with uppercase characters converted to lowercase " -"and vice versa. Note that it is not necessarily true that ``s.swapcase()." -"swapcase() == s``." +"and vice versa. Note that it is not necessarily true that " +"``s.swapcase().swapcase() == s``." msgstr "" "大文字が小文字に、小文字が大文字に変換された、文字列のコピーを返します。な" "お、 ``s.swapcase().swapcase() == s`` が真であるとは限りません。" @@ -4280,11 +4472,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 +4491,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 +4512,6 @@ msgid "" "expressions::" msgstr "または、正規表現を使うことでアポストロフィに対応できます::" -#: ../../library/stdtypes.rst:2430 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4329,43 +4522,51 @@ 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 "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " -"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` or :" -"term:`sequence`. When indexed by a Unicode ordinal (an integer), the table " -"object can do any of the following: return a Unicode ordinal or a string, to " -"map the character to one or more other characters; return ``None``, to " -"delete the character from the return string; or raise a :exc:`LookupError` " -"exception, to map the character to itself." +"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` " +"or :term:`sequence`. When indexed by a Unicode ordinal (an integer), the " +"table object can do any of the following: return a Unicode ordinal or a " +"string, to map the character to one or more other characters; return " +"``None``, to delete the character from the return string; or raise " +"a :exc:`LookupError` exception, to map the character to itself." msgstr "" "与えられた変換テーブルに基づいて文字列を構成する各文字をマッピングし、マッピ" -"ング後の文字列のコピーを返します。変換テーブルは、:meth:`~object." -"__getitem__` によるインデックス指定を実装するオブジェクトである必要がありま" -"す。一般的には、 :term:`mapping` または :term:`sequence` です。Unicode 序数 " -"(整数) でインデックス指定する場合、変換テーブルのオブジェクトは次のいずれも行" -"うことができます。Unicode 序数または文字列を返して文字を 1 文字以上の別の文字" -"にマッピングすること、``None`` を返して返り値の文字列から指定した文字を削除す" -"ること、例外 :exc:`LookupError` を送出して文字をその文字自身にマッピングする" -"こと。" +"ング後の文字列のコピーを返します。変換テーブル" +"は、:meth:`~object.__getitem__` によるインデックス指定を実装するオブジェクト" +"である必要があります。一般的には、 :term:`mapping` または :term:`sequence` で" +"す。Unicode 序数 (整数) でインデックス指定する場合、変換テーブルのオブジェク" +"トは次のいずれも行うことができます。Unicode 序数または文字列を返して文字を 1 " +"文字以上の別の文字にマッピングすること、``None`` を返して返り値の文字列から指" +"定した文字を削除すること、例外 :exc:`LookupError` を送出して文字をその文字自" +"身にマッピングすること。" #: ../../library/stdtypes.rst:2451 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -"文字から文字への異なる形式のマッピングから変換マップを作成するために、 :meth:" -"`str.maketrans` が使えます。" +"文字から文字への異なる形式のマッピングから変換マップを作成するため" +"に、 :meth:`str.maketrans` が使えます。" #: ../../library/stdtypes.rst:2454 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -"文字のマッピングを好みに合わせてより柔軟に変更する方法については、:mod:" -"`codecs` モジュールも参照してください。" +"文字のマッピングを好みに合わせてより柔軟に変更する方法について" +"は、:mod:`codecs` モジュールも参照してください。" #: ../../library/stdtypes.rst:2460 msgid "" @@ -4377,8 +4578,8 @@ msgid "" msgstr "" "全ての大小文字の区別のある文字 [4]_ が大文字に変換された、文字列のコピーを返" "します。なお ``s.upper().isupper()`` は、 ``s`` が大小文字の区別のある文字を" -"含まなかったり、結果の文字の Unicode カテゴリが \"Lu\" ではなく例えば " -"\"Lt\" (Letter, titlecase) などであったら、 ``False`` になりえます。" +"含まなかったり、結果の文字の Unicode カテゴリが \"Lu\" ではなく例えば \"Lt\" " +"(Letter, titlecase) などであったら、 ``False`` になりえます。" #: ../../library/stdtypes.rst:2466 msgid "" @@ -4387,45 +4588,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 +4642,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:" @@ -4609,9 +4817,9 @@ msgid "" msgstr "" "ここで解説されているフォーマット操作には、(タプルや辞書を正しく表示するのに失" "敗するなどの) よくある多くの問題を引き起こす、様々な欠陥が出現します。\n" -"新しい :ref:`フォーマット済み文字列リテラル ` や :meth:`str." -"format` インターフェースや :ref:`テンプレート文字列 ` が、" -"これらの問題を回避する助けになるでしょう。\n" +"新しい :ref:`フォーマット済み文字列リテラル ` " +"や :meth:`str.format` インターフェースや :ref:`テンプレート文字列 ` が、これらの問題を回避する助けになるでしょう。\n" "これらの代替手段には、それ自身に、トレードオフや、簡潔さ、柔軟さ、拡張性と" "いった利点があります。" @@ -4630,11 +4838,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 +4905,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 +4973,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 +4992,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 +5082,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'``" @@ -5007,23 +5214,23 @@ msgstr "" #: ../../library/stdtypes.rst:2834 msgid "" -"Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" -"`memoryview`" +"Binary Sequence Types " +"--- :class:`bytes`, :class:`bytearray`, :class:`memoryview`" msgstr "" -"バイナリシーケンス型 --- :class:`bytes`, :class:`bytearray`, :class:" -"`memoryview`" +"バイナリシーケンス型 " +"--- :class:`bytes`, :class:`bytearray`, :class:`memoryview`" #: ../../library/stdtypes.rst:2842 msgid "" -"The core built-in types for manipulating binary data are :class:`bytes` and :" -"class:`bytearray`. They are supported by :class:`memoryview` which uses the :" -"ref:`buffer protocol ` to access the memory of other binary " -"objects without needing to make a copy." +"The core built-in types for manipulating binary data are :class:`bytes` " +"and :class:`bytearray`. They are supported by :class:`memoryview` which uses " +"the :ref:`buffer protocol ` to access the memory of other " +"binary objects without needing to make a copy." msgstr "" -"バイナリデータを操作するためのコア組み込み型は :class:`bytes` および :class:" -"`bytearray` です。これらは、別のバイナリオブジェクトのメモリにコピーを作成す" -"ること無くアクセスするための :ref:`バッファプロトコル ` を利用" -"する :class:`memoryview` でサポートされています。" +"バイナリデータを操作するためのコア組み込み型は :class:`bytes` およ" +"び :class:`bytearray` です。これらは、別のバイナリオブジェクトのメモリにコ" +"ピーを作成すること無くアクセスするための :ref:`バッファプロトコル " +"` を利用する :class:`memoryview` でサポートされています。" #: ../../library/stdtypes.rst:2847 msgid "" @@ -5135,16 +5342,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 +5370,13 @@ 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 +5386,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 +5489,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 +5517,13 @@ 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 +5543,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 +5562,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 +5597,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 +5604,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 +5622,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 +5709,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 +5750,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`." @@ -5557,20 +5773,20 @@ msgstr ":class:`str` にデコードされたbytesを返します。" msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " -"are ``'ignore'``, ``'replace'``, and any other name registered via :func:" -"`codecs.register_error`. See :ref:`error-handlers` for details." +"are ``'ignore'``, ``'replace'``, and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" "*errors* はデコーディングエラーをどのように取り扱うかを制御します。 " "``'strict'`` (デフォルト) では :exc:`UnicodeError` 例外が送出されます。そのほ" -"かに指定可能な値は ``'ignore'``, ``'replace'`` と、そして :func:`codecs." -"register_error` で登録された名前です。詳しくは :ref:`error-handlers` を参照し" -"てください。" +"かに指定可能な値は ``'ignore'``, ``'replace'`` と、そし" +"て :func:`codecs.register_error` で登録された名前です。詳しくは :ref:`error-" +"handlers` を参照してください。" #: ../../library/stdtypes.rst:3183 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" -"`debug build ` is used." +"unless a decoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" "パフォーマンス上の理由から、 *errors* の値の妥当性は、デコーディングエラーが" "実際に発生するか、 :ref:`devmode` が有効になっているか、もしくは :ref:`デバッ" @@ -5578,9 +5794,9 @@ msgstr "" #: ../../library/stdtypes.rst:3189 msgid "" -"Passing the *encoding* argument to :class:`str` allows decoding any :term:" -"`bytes-like object` directly, without needing to make a temporary :class:`!" -"bytes` or :class:`!bytearray` object." +"Passing the *encoding* argument to :class:`str` allows decoding " +"any :term:`bytes-like object` directly, without needing to make a " +"temporary :class:`!bytes` or :class:`!bytearray` object." msgstr "" "引数 *encoding* を :class:`str` に渡すと :term:`bytes-like object` を直接デ" "コードすることができます。つまり、一時的な :class:`!bytes` や :class:`!" @@ -5618,26 +5834,27 @@ msgstr "" #: ../../library/stdtypes.rst:3225 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" ":meth:`~bytes.find` メソッドは、 *sub* の位置を知りたいときにのみ使うべきで" "す。 *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 "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -":meth:`~bytes.find` と同様ですが、部分シーケンスが見つからなかった場合 :exc:" -"`ValueError` を送出します。" +":meth:`~bytes.find` と同様ですが、部分シーケンスが見つからなかった場" +"合 :exc:`ValueError` を送出します。" #: ../../library/stdtypes.rst:3252 msgid "" @@ -5654,17 +5871,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." +"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 "" @@ -5700,8 +5917,8 @@ msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -"検索する部分シーケンスおよび置換後の部分シーケンスとしては、任意の :term:" -"`bytes-like object` を指定できます。" +"検索する部分シーケンスおよび置換後の部分シーケンスとしては、任意" +"の :term:`bytes-like object` を指定できます。" #: ../../library/stdtypes.rst:3303 msgid "" @@ -5778,11 +5995,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." @@ -5810,9 +6028,9 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" "長さ *width* の中央寄せされたシーケンスのコピーを返します。パディングには " -"*fillbyte* で指定された値 (デフォルトでは ASCII スペース) が使われます。 :" -"class:`bytes` オブジェクトの場合、 *width* が ``len(s)`` 以下なら元のシーケン" -"スが返されます。" +"*fillbyte* で指定された値 (デフォルトでは ASCII スペース) が使われま" +"す。 :class:`bytes` オブジェクトの場合、 *width* が ``len(s)`` 以下なら元の" +"シーケンスが返されます。" #: ../../library/stdtypes.rst:3396 msgid "" @@ -5822,9 +6040,9 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" "長さ *width* の左寄せされたシーケンスのコピーを返します。パディングには " -"*fillbyte* で指定された値 (デフォルトでは ASCII スペース) が使われます。 :" -"class:`bytes` オブジェクトの場合、 *width* が ``len(s)`` 以下なら元のシーケン" -"スが返されます。" +"*fillbyte* で指定された値 (デフォルトでは ASCII スペース) が使われま" +"す。 :class:`bytes` オブジェクトの場合、 *width* が ``len(s)`` 以下なら元の" +"シーケンスが返されます。" #: ../../library/stdtypes.rst:3410 msgid "" @@ -5838,17 +6056,21 @@ msgstr "" "先頭から特定のバイト値を除去したコピーを返します。引数 *chars* は除去されるバ" "イト値の集合を指定するバイナリシーケンスです - この名前は、このメソッドが通" "常は ASCII 文字列に対して使われることに由来しています。 *chars* が省略される" -"か ``None`` の場合、 ASCII の空白文字 (訳注: 空白文字の定義については :meth:" -"`bytearray.isspace` を参照) が除去されます。なお *chars* 引数と一致する接頭辞" -"が除去されるのではなく、それに含まれるバイトの組み合わせ全てが除去されます::" +"か ``None`` の場合、 ASCII の空白文字 (訳注: 空白文字の定義について" +"は :meth:`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 "" @@ -5858,16 +6080,19 @@ msgid "" msgstr "" "削除したいバイト値のバイナリシーケンスには、 :term:`bytes-like object` を指定" "することができます。バイナリシーケンスで指定した文字の集合全てではなく、指定" -"した文字列そのものを接頭辞として削除するメソッドについては、 :meth:`~bytes." -"removeprefix` を参照してください。使用例::" +"した文字列そのものを接頭辞として削除するメソッドについて" +"は、 :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 "" @@ -5877,9 +6102,9 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" "長さ *width* の右寄せされたシーケンスのコピーを返します。パディングには " -"*fillbyte* で指定された値 (デフォルトでは ASCII スペース) が使われます。 :" -"class:`bytes` オブジェクトの場合、 *width* が ``len(s)`` 以下なら元のシーケン" -"スが返されます。" +"*fillbyte* で指定された値 (デフォルトでは ASCII スペース) が使われま" +"す。 :class:`bytes` オブジェクトの場合、 *width* が ``len(s)`` 以下なら元の" +"シーケンスが返されます。" #: ../../library/stdtypes.rst:3455 msgid "" @@ -5908,17 +6133,21 @@ msgstr "" "末尾から特定のバイト値を除去したコピーを返します。引数 *chars* は除去されるバ" "イト値の集合を指定するバイナリシーケンスです - この名前は、このメソッドが通" "常は ASCII 文字列に対して使われることに由来しています。 *chars* が省略される" -"か ``None`` の場合、 ASCII の空白文字 (訳注: 空白文字の定義については :meth:" -"`bytearray.isspace` を参照) が除去されます。なお *chars* 引数と一致する接尾辞" -"が除去されるのではなく、それに含まれるバイトの組み合わせ全てが除去されます::" +"か ``None`` の場合、 ASCII の空白文字 (訳注: 空白文字の定義について" +"は :meth:`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 "" @@ -5928,16 +6157,19 @@ msgid "" msgstr "" "削除したいバイト値のバイナリシーケンスには、 :term:`bytes-like object` を指定" "することができます。バイナリシーケンスで指定した文字の集合全てではなく、指定" -"した文字列そのものを接尾辞として削除するメソッドについては、 :meth:`~bytes." -"removesuffix` を参照してください。使用例::" +"した文字列そのものを接尾辞として削除するメソッドについて" +"は、 :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 +6185,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 +6194,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 +6212,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 +6236,6 @@ msgstr "" "がって区切りを指定せずに空のシーケンスや ASCII 空白文字だけのシーケンスを分割" "すると、 ``[]`` が返されます。" -#: ../../library/stdtypes.rst:3532 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -6006,6 +6244,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 +6268,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 +6337,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 +6362,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 +6386,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 +6416,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 +6436,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 +6481,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 +6502,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 +6521,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 +6540,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." +"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 +6607,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 +6626,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 +6649,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 +6667,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 +6681,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" @@ -6429,8 +6720,8 @@ msgid "" "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " "*interpolation* operator. Given ``format % values`` (where *format* is a " "bytes object), ``%`` conversion specifications in *format* are replaced with " -"zero or more elements of *values*. The effect is similar to using the :c:" -"func:`sprintf` in the C language." +"zero or more elements of *values*. The effect is similar to using " +"the :c:func:`sprintf` in the C language." msgstr "" "bytes オブジェクト (``bytes``/``bytearray``) には固有の操作: ``%`` 演算子 (モ" "ジュロ) があります。この演算子は bytes の *書式化* または *補間* 演算子とも呼" @@ -6554,9 +6845,9 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" ":class:`memoryview` は元となる *object* が扱うメモリーの最小単位を *要素* と" -"して扱います。多くの単純なオブジェクト、例えば :class:`bytes` や :class:" -"`bytearray` では、要素は単バイトになりますが、他の :class:`array.array` 等の" -"型では、要素はより大きくなりえます。" +"して扱います。多くの単純なオブジェクト、例えば :class:`bytes` " +"や :class:`bytearray` では、要素は単バイトになりますが、他" +"の :class:`array.array` 等の型では、要素はより大きくなりえます。" #: ../../library/stdtypes.rst:4118 msgid "" @@ -6564,17 +6855,16 @@ msgid "" "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -"``len(view)`` はビューの入れ子になったリスト表現である :class:`~memoryview." -"tolist` の長さと等しくなります。ビューが ``view.ndim = 1`` を満たす場合は" -"ビューの要素数とも等しくなります。" +"``len(view)`` はビューの入れ子になったリスト表現であ" +"る :class:`~memoryview.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 +6880,6 @@ msgstr "" ":class:`memoryview` はスライスおよびインデックス指定で内容を取得できます。一" "次元のスライスは部分ビューになります::" -#: ../../library/stdtypes.rst:4131 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6602,6 +6891,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 +6921,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 +6934,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 +6952,6 @@ msgstr "" "メモリビューの参照しているオブジェクトが書き込み可能であれば、一次元スライス" "での代入が可能です。ただしサイズの変更はできません::" -#: ../../library/stdtypes.rst:4165 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6667,6 +6972,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 +7001,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 +7010,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 "" @@ -6700,8 +7029,8 @@ msgstr "" #: ../../library/stdtypes.rst:4199 msgid "" -"memoryview is now registered automatically with :class:`collections.abc." -"Sequence`" +"memoryview is now registered automatically " +"with :class:`collections.abc.Sequence`" msgstr "" "memoryview は自動的に :class:`collections.abc.Sequence` へ登録されるようにな" "りました。" @@ -6710,9 +7039,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:" @@ -6729,13 +7057,13 @@ msgstr "" #: ../../library/stdtypes.rst:4217 msgid "" -"For the subset of :mod:`struct` format strings currently supported by :meth:" -"`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" +"For the subset of :mod:`struct` format strings currently supported " +"by :meth:`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == " +"w.tolist()``::" msgstr "" -":meth:`tolist` がサポートしている :mod:`struct` フォーマットの一部では、 ``v." -"tolist() == w.tolist()`` が成り立つときに ``v`` == ``w`` になります::" +":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 +7081,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 +7107,6 @@ msgstr "" "(書式文字列とバッファの内容が同一でも) オブジェクトは常に等しくないものとして" "比較されます::" -#: ../../library/stdtypes.rst:4240 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6778,6 +7120,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 "" @@ -6800,10 +7153,9 @@ msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -"バッファ中のデータをバイト文字列として返します。これはメモリビューに対して :" -"class:`bytes` コンストラクタを呼び出すのと同等です。 ::" +"バッファ中のデータをバイト文字列として返します。これはメモリビューに対し" +"て :class:`bytes` コンストラクタを呼び出すのと同等です。 ::" -#: ../../library/stdtypes.rst:4264 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6811,6 +7163,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 +7195,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 +7224,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,11 +7233,18 @@ 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 "" -":meth:`tolist` now supports all single character native formats in :mod:" -"`struct` module syntax as well as multi-dimensional representations." +":meth:`tolist` now supports all single character native formats " +"in :mod:`struct` module syntax as well as multi-dimensional representations." msgstr "" ":meth:`tolist` が :mod:`struct` モジュール文法に含まれるすべての単一文字の " "native フォーマットと多次元の表現をサポートするようになりました。" @@ -6892,7 +7257,6 @@ msgstr "" "読み込み専用のメモリビューオブジェクトを返します。元のメモリビューオブジェク" "トは変更されません。 ::" -#: ../../library/stdtypes.rst:4320 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6906,12 +7270,23 @@ 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 "" "Release the underlying buffer exposed by the memoryview object. Many " -"objects take special actions when a view is held on them (for example, a :" -"class:`bytearray` would temporarily forbid resizing); therefore, calling " +"objects take special actions when a view is held on them (for example, " +"a :class:`bytearray` would temporarily forbid resizing); therefore, calling " "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" @@ -6928,7 +7303,6 @@ msgid "" "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4346 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6937,6 +7311,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 +7326,6 @@ msgstr "" "コンテキストマネージャプロトコルは、 ``with`` 文を使って同様の効果を得るのに" "使えます::" -#: ../../library/stdtypes.rst:4356 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6957,8 +7336,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 +7352,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." +"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 +7399,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 +7436,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 +7476,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 +7515,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 +7531,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,24 +7552,26 @@ 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)`` と一致するとは限りません::" +"``nbytes == product(shape) * itemsize == len(m.tobytes())`` です。\n" +"これは、配列を連続した表現にした場合に使う領域のバイト数です。\n" +"``len(m)`` と等しいとは限りません。 ::" -#: ../../library/stdtypes.rst:4494 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -7140,13 +7587,26 @@ msgid "" "12\n" ">>> len(y.tobytes())\n" "12" -msgstr "" +msgstr "" +">>> 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" #: ../../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 +7619,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." @@ -7173,8 +7643,8 @@ msgid "" msgstr "" "ビューの中の各要素に対する (:mod:`struct` モジュールスタイルの) フォーマット" "を含む文字列。 memoryview は、任意のフォーマット文字列を使ってエクスポーター" -"から作成することができます。しかし、いくつかのメソッド(例えば :meth:" -"`tolist`) はネイティブの単一要素フォーマットに制限されます。" +"から作成することができます。しかし、いくつかのメソッド(例え" +"ば :meth:`tolist`) はネイティブの単一要素フォーマットに制限されます。" #: ../../library/stdtypes.rst:4535 msgid "" @@ -7188,7 +7658,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 +7668,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 "" @@ -7236,14 +7713,14 @@ msgstr "" #: ../../library/stdtypes.rst:4579 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -"メモリーが C 形式の順序で連続しているかどうかを示す真偽値(参考: :term:" -"`contiguous` )。" +"メモリーが C 形式の順序で連続しているかどうかを示す真偽値(参" +"考: :term:`contiguous` )。" #: ../../library/stdtypes.rst:4585 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -"メモリーがFortran形式の順序で連続しているかどうかを示す真偽値(参考: :term:" -"`contiguous` )。" +"メモリーがFortran形式の順序で連続しているかどうかを示す真偽値(参" +"考: :term:`contiguous` )。" #: ../../library/stdtypes.rst:4591 msgid "A bool indicating whether the memory is :term:`contiguous`." @@ -7260,33 +7737,35 @@ msgid "" "objects. Common uses include membership testing, removing duplicates from a " "sequence, and computing mathematical operations such as intersection, union, " "difference, and symmetric difference. (For other containers see the built-" -"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" -"`collections` module.)" +"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" ":dfn:`set` オブジェクトは、固有の :term:`hashable` オブジェクトの順序なしコレ" "クションです。通常の用途には、帰属テスト、シーケンスからの重複除去、積集合、" "和集合、差集合、対称差 (排他的論理和) のような数学的演算の計算が含まれます。" -"(他のコンテナについては組み込みの :class:`dict`, :class:`list`, :class:" -"`tuple` クラスや :mod:`collections` モジュールを参照してください。)" +"(他のコンテナについては組み込み" +"の :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 "" -"There are currently two built-in set types, :class:`set` and :class:" -"`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " -"it is mutable, it has no hash value and cannot be used as either a " +"There are currently two built-in set types, :class:`set` " +"and :class:`frozenset`. The :class:`set` type is mutable --- the contents " +"can be changed using methods like :meth:`~set.add` and :meth:`~set.remove`. " +"Since it is mutable, it has no hash value and cannot be used as either a " "dictionary key or as an element of another set. The :class:`frozenset` type " "is immutable and :term:`hashable` --- its contents cannot be altered after " "it is created; it can therefore be used as a dictionary key or as an element " @@ -7295,10 +7774,10 @@ msgstr "" ":class:`set` および :class:`frozenset` という、2つの組み込みの集合型がありま" "す。 :class:`set` はミュータブルで、:meth:`~set.add` や :meth:`~set.remove` " "のようなメソッドを使って内容を変更できます。ミュータブルなため、ハッシュ値を" -"持たず、また辞書のキーや他の集合の要素として用いることができません。一方、:" -"class:`frozenset` 型はイミュータブルで、:term:`ハッシュ可能` です。" -"作成後に内容を改変できないため、辞書のキーや他の集合の要素として用いることが" -"できます。" +"持たず、また辞書のキーや他の集合の要素として用いることができません。一" +"方、:class:`frozenset` 型はイミュータブルで、:term:`ハッシュ可能` " +"です。作成後に内容を改変できないため、辞書のキーや他の集合の要素として用いる" +"ことができます。" #: ../../library/stdtypes.rst:4623 msgid "" @@ -7306,9 +7785,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 +7800,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:" @@ -7427,19 +7906,19 @@ msgstr "集合の浅いコピーを返します。" #: ../../library/stdtypes.rst:4709 msgid "" -"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" -"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" -"`issuperset` methods will accept any iterable as an argument. In contrast, " -"their operator based counterparts require their arguments to be sets. This " -"precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " -"the more readable ``set('abc').intersection('cbs')``." +"Note, the non-operator versions " +"of :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, " +"and :meth:`issuperset` methods will accept any iterable as an argument. In " +"contrast, their operator based counterparts require their arguments to be " +"sets. This precludes error-prone constructions like ``set('abc') & 'cbs'`` " +"in favor of the more readable ``set('abc').intersection('cbs')``." msgstr "" -"なお、演算子でない版の :meth:`union`, :meth:`intersection`, :meth:" -"`difference`, :meth:`symmetric_difference`, :meth:`issubset`, :meth:" -"`issuperset` メソッドは、任意のイテラブルを引数として受け付けます。対して、演" -"算子を使う版では、引数は集合でなくてはなりません。これは、``set('abc') & " -"'cbs'`` のような誤りがちな構文を予防し、より読みやすい ``set('abc')." -"intersection('cbs')`` を支持します。" +"なお、演算子でない版" +"の :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, :meth:`issuperset` " +"メソッドは、任意のイテラブルを引数として受け付けます。対して、演算子を使う版" +"では、引数は集合でなくてはなりません。これは、``set('abc') & 'cbs'`` のような" +"誤りがちな構文を予防し、より読みやすい ``set('abc').intersection('cbs')`` を" +"支持します。" #: ../../library/stdtypes.rst:4716 msgid "" @@ -7485,8 +7964,8 @@ msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -"集合は半順序(部分集合関係)しか定義しないので、集合のリストにおける :meth:" -"`list.sort` メソッドの出力は未定義です。" +"集合は半順序(部分集合関係)しか定義しないので、集合のリストにおけ" +"る :meth:`list.sort` メソッドの出力は未定義です。" #: ../../library/stdtypes.rst:4735 msgid "Set elements, like dictionary keys, must be :term:`hashable`." @@ -7494,15 +7973,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 "" @@ -7538,8 +8017,8 @@ msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -"要素 *elem* を set から取り除きます。*elem* が set に含まれていなければ :exc:" -"`KeyError` を送出します。" +"要素 *elem* を set から取り除きます。*elem* が set に含まれていなけれ" +"ば :exc:`KeyError` を送出します。" #: ../../library/stdtypes.rst:4775 msgid "Remove element *elem* from the set if it is present." @@ -7550,8 +8029,8 @@ msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -"*s* から任意の要素を取り除き、それを返します。集合が空の場合、 :exc:" -"`KeyError` を送出します" +"*s* から任意の要素を取り除き、それを返します。集合が空の場" +"合、 :exc:`KeyError` を送出します" #: ../../library/stdtypes.rst:4784 msgid "Remove all elements from the set." @@ -7559,20 +8038,22 @@ msgstr "set の全ての要素を取り除きます。" #: ../../library/stdtypes.rst:4787 msgid "" -"Note, the non-operator versions of the :meth:`update`, :meth:" -"`intersection_update`, :meth:`difference_update`, and :meth:" -"`symmetric_difference_update` methods will accept any iterable as an " -"argument." +"Note, the non-operator versions of " +"the :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, " +"and :meth:`symmetric_difference_update` methods will accept any iterable as " +"an argument." msgstr "" -"なお、演算子でない版の :meth:`update`, :meth:`intersection_update`, :meth:" -"`difference_update`, および :meth:`symmetric_difference_update` メソッドは、" -"任意のイテラブルを引数として受け付けます。" +"なお、演算子でない版" +"の :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, お" +"よび :meth:`symmetric_difference_update` メソッドは、任意のイテラブルを引数と" +"して受け付けます。" #: ../../library/stdtypes.rst:4792 msgid "" -"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" -"`remove`, and :meth:`discard` methods may be a set. To support searching " -"for an equivalent frozenset, a temporary one is created from *elem*." +"Note, the *elem* argument to " +"the :meth:`~object.__contains__`, :meth:`remove`, and :meth:`discard` " +"methods may be a set. To support searching for an equivalent frozenset, a " +"temporary one is created from *elem*." msgstr "" ":meth:`~object.__contains__`, :meth:`remove`, :meth:`discard` メソッドの引数 " "*elem* は集合かもしれないことに注意してください。\n" @@ -7587,30 +8068,31 @@ msgstr "マッピング型 --- :class:`dict`" msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " -"type, the :dfn:`dictionary`. (For other containers see the built-in :class:" -"`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " -"module.)" +"type, the :dfn:`dictionary`. (For other containers see the built-" +"in :class:`list`, :class:`set`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" ":term:`マッピング ` オブジェクトは、 :term:`ハッシュ可能 " "` な値を任意のオブジェクトに対応付けます。マッピングはミュータブル" "なオブジェクトです。現在、標準のマッピング型は辞書 (:dfn:`dictionary`) だけで" -"す。 (他のコンテナについては組み込みの :class:`list`, :class:`set`, および :" -"class:`tuple` クラスと、 :mod:`collections` モジュールを参照してください。)" +"す。 (他のコンテナについては組み込みの :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 " -"mutable types (that are compared by value rather than by object identity) " -"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." +"A dictionary's keys are *almost* arbitrary values. Values that are " +"not :term:`hashable`, that is, values containing lists, dictionaries or " +"other mutable types (that are compared by value rather than by object " +"identity) 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 +8126,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 +8137,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 +8170,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 +8177,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 +8193,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 +8211,6 @@ msgstr "" "キーの更新は順序には影響が無いことに注意してください。\n" "いったん削除されてから再度追加されたキーは末尾に挿入されます。::" -#: ../../library/stdtypes.rst:4878 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7724,6 +8227,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 "" @@ -7754,8 +8271,8 @@ msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -"*d* のキー *key* の項目を返します。マップに *key* が存在しなければ、 :exc:" -"`KeyError` を送出します。" +"*d* のキー *key* の項目を返します。マップに *key* が存在しなけれ" +"ば、 :exc:`KeyError` を送出します。" #: ../../library/stdtypes.rst:4915 msgid "" @@ -7763,19 +8280,18 @@ msgid "" "present, the ``d[key]`` operation calls that method with the key *key* as " "argument. The ``d[key]`` operation then returns or raises whatever is " "returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not defined, :" -"exc:`KeyError` is raised. :meth:`__missing__` must be a method; it cannot be " -"an instance variable::" +"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not " +"defined, :exc:`KeyError` is raised. :meth:`__missing__` must be a method; it " +"cannot be an instance variable::" msgstr "" "辞書のサブクラスが :meth:`__missing__` メソッドを定義していて、 *key* が存在" "しない場合、 ``d[key]`` 演算はこのメソッドをキー *key* を引数として呼び出しま" "す。 ``d[key]`` 演算は、 ``__missing__(key)`` の呼び出しによって返された値を" -"そのまま返すか、送出されたものをそのまま送出します。他の演算やメソッドは :" -"meth:`__missing__` を呼び出しません。 :meth:`__missing__` が定義されていない" -"場合、 :exc:`KeyError` が送出されます。 :meth:`__missing__` はメソッドでなけ" -"ればならず、インスタンス変数であってはなりません::" +"そのまま返すか、送出されたものをそのまま送出します。他の演算やメソッド" +"は :meth:`__missing__` を呼び出しません。 :meth:`__missing__` が定義されてい" +"ない場合、 :exc:`KeyError` が送出されます。 :meth:`__missing__` はメソッドで" +"なければならず、インスタンス変数であってはなりません::" -#: ../../library/stdtypes.rst:4923 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7788,12 +8304,22 @@ 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 "" -"The example above shows part of the implementation of :class:`collections." -"Counter`. A different ``__missing__`` method is used by :class:`collections." -"defaultdict`." +"The example above shows part of the implementation " +"of :class:`collections.Counter`. A different ``__missing__`` method is used " +"by :class:`collections.defaultdict`." msgstr "" "ここでお見せした例は :class:`collections.Counter` 実装の一部です。これとは" "違った ``__missing__`` が :class:`collections.defaultdict` で使われています。" @@ -7807,8 +8333,8 @@ msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" -"*d* から ``d[key]`` を削除します。マップに *key* が存在しなければ、 :exc:" -"`KeyError` を送出します。" +"*d* から ``d[key]`` を削除します。マップに *key* が存在しなけれ" +"ば、 :exc:`KeyError` を送出します。" #: ../../library/stdtypes.rst:4949 msgid "Return ``True`` if *d* has a key *key*, else ``False``." @@ -7887,26 +8413,25 @@ msgstr "" #: ../../library/stdtypes.rst:4996 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " -"*default*. If *default* is not given and *key* is not in the dictionary, a :" -"exc:`KeyError` is raised." +"*default*. If *default* is not given and *key* is not in the dictionary, " +"a :exc:`KeyError` is raised." msgstr "" "*key* が辞書に存在すればその値を辞書から消去して返し、そうでなければ " "*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 "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " -"often used in set algorithms. If the dictionary is empty, calling :meth:" -"`popitem` raises a :exc:`KeyError`." +"often used in set algorithms. If the dictionary is empty, " +"calling :meth:`popitem` raises a :exc:`KeyError`." msgstr "" "集合のアルゴリズムで使われるのと同じように、 :meth:`popitem` は辞書に繰り返し" "適用して消去するのに便利です。辞書が空であれば、 :meth:`popitem` の呼び出し" @@ -7946,7 +8471,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 +8478,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 +8504,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 +8537,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 +8548,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." @@ -8023,11 +8564,11 @@ msgstr "辞書がリバース可能になりました。" #: ../../library/stdtypes.rst:5083 msgid "" -":class:`types.MappingProxyType` can be used to create a read-only view of a :" -"class:`dict`." +":class:`types.MappingProxyType` can be used to create a read-only view of " +"a :class:`dict`." msgstr "" -":class:`dict` の読み出し専用ビューを作るために :class:`types." -"MappingProxyType` を使うことができます。" +":class:`dict` の読み出し専用ビューを作るため" +"に :class:`types.MappingProxyType` を使うことができます。" #: ../../library/stdtypes.rst:5090 msgid "Dictionary view objects" @@ -8035,10 +8576,10 @@ msgstr "辞書ビューオブジェクト" #: ../../library/stdtypes.rst:5092 msgid "" -"The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" -"`dict.items` are *view objects*. They provide a dynamic view on the " -"dictionary's entries, which means that when the dictionary changes, the view " -"reflects these changes." +"The objects returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` are *view objects*. They provide a dynamic view on " +"the dictionary's entries, which means that when the dictionary changes, the " +"view reflects these changes." msgstr "" ":meth:`dict.keys`, :meth:`dict.values`, :meth:`dict.items` によって返されるオ" "ブジェクトは、 *ビューオブジェクト* です。これらは、辞書の項目の動的なビュー" @@ -8067,15 +8608,15 @@ msgstr "" #: ../../library/stdtypes.rst:5109 msgid "" "Keys and values are iterated over in insertion order. This allows the " -"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." -"values(), d.keys())``. Another way to create the same list is ``pairs = " -"[(v, k) for (k, v) in d.items()]``." +"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " +"zip(d.values(), d.keys())``. Another way to create the same list is ``pairs " +"= [(v, k) for (k, v) in d.items()]``." msgstr "" "キーと値は挿入順序で反復されます。\n" -"これにより、 ``(value, key)`` の対の列を ``pairs = zip(d.values(), d." -"keys())`` のように :func:`zip` で作成できます。\n" -"同じリストを作成する他の方法は、 ``pairs = [(v, k) for (k, v) in d." -"items()]`` です。 " +"これにより、 ``(value, key)`` の対の列を ``pairs = zip(d.values(), " +"d.keys())`` のように :func:`zip` で作成できます。\n" +"同じリストを作成する他の方法は、 ``pairs = [(v, k) for (k, v) in " +"d.items()]`` です。 " #: ../../library/stdtypes.rst:5114 msgid "" @@ -8097,13 +8638,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 +8657,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 +8678,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 +8723,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,22 +8777,23 @@ 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 "" "An example of a context manager that returns itself is a :term:`file " -"object`. File objects return themselves from __enter__() to allow :func:" -"`open` to be used as the context expression in a :keyword:`with` statement." +"object`. File objects return themselves from __enter__() to " +"allow :func:`open` to be used as the context expression in a :keyword:`with` " +"statement." msgstr "" "自分自身を返すコンテキストマネージャの例として :term:`ファイルオブジェクト " "` があります。ファイルオブジェクトは __enter__() から自分自身を" @@ -8233,11 +8809,12 @@ msgid "" "the body of the :keyword:`with` statement without affecting code outside " "the :keyword:`!with` statement." msgstr "" -"関連オブジェクトを返すコンテキストマネージャの例としては :func:`decimal." -"localcontext` が返すものがあります。このマネージャはアクティブな10進数コンテ" -"キストをオリジナルのコンテキストのコピーにセットしてそのコピーを返します。こ" -"うすることで, :keyword:`with` 文の本体の内部で、:keyword:`!with` 文の外側の" -"コードに影響を与えずに、 10進数コンテキストを変更できます。" +"関連オブジェクトを返すコンテキストマネージャの例として" +"は :func:`decimal.localcontext` が返すものがあります。このマネージャはアク" +"ティブな10進数コンテキストをオリジナルのコンテキストのコピーにセットしてその" +"コピーを返します。こうすることで, :keyword:`with` 文の本体の内部" +"で、:keyword:`!with` 文の外側のコードに影響を与えずに、 10進数コンテキストを" +"変更できます。" #: ../../library/stdtypes.rst:5230 msgid "" @@ -8262,23 +8839,24 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" -"このメソッドから真値が返されると :keyword:`with` 文は例外の発生を抑え、 :" -"keyword:`!with` 文の直後の文に実行を続けます。そうでなければ、このメソッドの" -"実行を終えると例外の伝播が続きます。このメソッドの実行中に起きた例外は :" -"keyword:`!with` 文の本体の実行中に起こった例外を置き換えてしまいます。" +"このメソッドから真値が返されると :keyword:`with` 文は例外の発生を抑" +"え、 :keyword:`!with` 文の直後の文に実行を続けます。そうでなければ、このメ" +"ソッドの実行を終えると例外の伝播が続きます。このメソッドの実行中に起きた例外" +"は :keyword:`!with` 文の本体の実行中に起こった例外を置き換えてしまいます。" #: ../../library/stdtypes.rst:5242 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " "successfully and does not want to suppress the raised exception. This allows " -"context management code to easily detect whether or not an :meth:`~object." -"__exit__` method has actually failed." +"context management code to easily detect whether or not " +"an :meth:`~object.__exit__` method has actually failed." msgstr "" "渡された例外を明示的に再送出すべきではありません。その代わりに、このメソッド" "が偽の値を返すことでメソッドの正常終了と送出された例外を抑制しないことを伝え" -"るべきです。このようにすればコンテキストマネージャは :meth:`~object." -"__exit__` メソッド自体が失敗したのかどうかを簡単に見分けることができます。" +"るべきです。このようにすればコンテキストマネージャ" +"は :meth:`~object.__exit__` メソッド自体が失敗したのかどうかを簡単に見分ける" +"ことができます。" #: ../../library/stdtypes.rst:5248 msgid "" @@ -8291,25 +8869,26 @@ msgstr "" "Python は、易しいスレッド同期、ファイルなどのオブジェクトの即時クローズ、アク" "ティブな小数算術コンテキストの単純な操作をサポートするために、いくつかのコン" "テキストマネージャを用意しています。各型はコンテキスト管理プロトコルを実装し" -"ているという以上の特別の取り扱いを受けるわけではありません。例については :" -"mod:`contextlib` モジュールを参照してください。" +"ているという以上の特別の取り扱いを受けるわけではありません。例について" +"は :mod:`contextlib` モジュールを参照してください。" #: ../../library/stdtypes.rst:5254 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " "generator function is decorated with the :class:`contextlib.contextmanager` " -"decorator, it will return a context manager implementing the necessary :meth:" -"`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " -"rather than the iterator produced by an undecorated generator function." +"decorator, it will return a context manager implementing the " +"necessary :meth:`~contextmanager.__enter__` " +"and :meth:`~contextmanager.__exit__` methods, rather than the iterator " +"produced by an undecorated generator function." msgstr "" -"Python の :term:`ジェネレータ ` と :class:`contextlib." -"contextmanager` :term:`デコレータ ` はこのプロトコルの簡便な実装" +"Python の :term:`ジェネレータ ` " +"と :class:`contextlib.contextmanager` デコレータはこのプロトコルの簡便な実装" "方法を提供します。ジェネレータ関数を :class:`contextlib.contextmanager` デコ" "レータでデコレートすると、デコレートされないジェネレータ関数が作成するイテ" -"レータの代わりに、必要な :meth:`~contextmanager.__enter__` および :meth:" -"`~contextmanager.__exit__` メソッドを実装したコンテキストマネージャを返すよう" -"になります。" +"レータの代わりに、必要な :meth:`~contextmanager.__enter__` およ" +"び :meth:`~contextmanager.__exit__` メソッドを実装したコンテキストマネージャ" +"を返すようになります。" #: ../../library/stdtypes.rst:5261 msgid "" @@ -8325,22 +8904,19 @@ msgstr "" "供しなければなりません。実行時コンテキストを準備するオーバーヘッドに比べた" "ら、一回のクラス辞書の探索のオーバーヘッドは無視できます。" -#: ../../library/stdtypes.rst:5269 msgid "" -"Type Annotation Types --- :ref:`Generic Alias `, :ref:" -"`Union `" +"Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" msgstr "" "型アノテーション型 --- :ref:`ジェネリックエイリアス ` 、 :ref:`ユニオン `" +"genericalias>` 、 :ref:`Union `" -#: ../../library/stdtypes.rst:5274 msgid "" -"The core built-in types for :term:`type annotations ` are :ref:" -"`Generic Alias ` and :ref:`Union `." +"The core built-in types for :term:`type annotations ` " +"are :ref:`Generic Alias ` and :ref:`Union `." msgstr "" ":term:`型アノテーション ` の中心となる組み込みの型は :ref:`ジェネ" -"リックエイリアス ` と :ref:`ユニオン ` で" -"す。" +"リックエイリアス ` と :ref:`Union ` です。" #: ../../library/stdtypes.rst:5281 msgid "Generic Alias Type" @@ -8369,8 +8945,8 @@ msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." msgstr "" -"一般に、クラスへの添字表記は、そのクラスが特殊メソッド :meth:`~object." -"__class_getitem__` を実装しているときに限り可能です。" +"一般に、クラスへの添字表記は、そのクラスが特殊メソッ" +"ド :meth:`~object.__class_getitem__` を実装しているときに限り可能です。" #: ../../library/stdtypes.rst:5300 msgid "" @@ -8385,13 +8961,13 @@ msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " "object contains. For example, ``set[bytes]`` can be used in type annotations " -"to signify a :class:`set` in which all the elements are of type :class:" -"`bytes`." +"to signify a :class:`set` in which all the elements are of " +"type :class:`bytes`." msgstr "" "コンテナクラスに対してクラスの :ref:`添字表記 ` に与えられた単" "一または複数の引数は、そのオブジェクトが包含する要素の型をあらわします。たと" -"えば ``set[bytes]`` という表記は、全ての要素が :class:`bytes` であるような :" -"class:`set` をあらわす型アノテーションとして使うことができます。" +"えば ``set[bytes]`` という表記は、全ての要素が :class:`bytes` であるよう" +"な :class:`set` をあらわす型アノテーションとして使うことができます。" #: ../../library/stdtypes.rst:5309 msgid "" @@ -8422,8 +8998,8 @@ msgstr "" #: ../../library/stdtypes.rst:5321 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " -"``y`` will also be an instance of ``re.Match``, but the return values of ``y." -"group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " +"``y`` will also be an instance of ``re.Match``, but the return values of " +"``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" @@ -8435,9 +9011,9 @@ msgstr "" #: ../../library/stdtypes.rst:5327 msgid "" -"``GenericAlias`` objects are instances of the class :class:`types." -"GenericAlias`, which can also be used to create ``GenericAlias`` objects " -"directly." +"``GenericAlias`` objects are instances of the " +"class :class:`types.GenericAlias`, which can also be used to create " +"``GenericAlias`` objects directly." msgstr "" "``GenericAlias`` オブジェクトは :class:`types.GenericAlias` クラスのインスタ" "ンスです。このクラスは直接 ``GenericAlias`` オブジェクトを生成するのに使うこ" @@ -8454,11 +9030,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 +9049,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 +9064,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 +9089,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 +9106,6 @@ msgstr "" "しかも、パラメータ付きジェネリック型は、オブジェクト生成時にパラメータの型情" "報を削除します::" -#: ../../library/stdtypes.rst:5370 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -8533,16 +9115,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 +9137,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 +9151,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 +9218,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 +9244,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 +9425,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 +9462,22 @@ 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." +"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 "" @@ -8903,8 +9503,8 @@ msgstr "" #: ../../library/stdtypes.rst:5523 msgid "" "Introducing the ability to natively parameterize standard-library classes, " -"provided they implement the special class method :meth:`~object." -"__class_getitem__`." +"provided they implement the special class " +"method :meth:`~object.__class_getitem__`." msgstr "" "特殊なクラスメソッド :meth:`~object.__class_getitem__` を実装している場合に、" "標準ライブラリのクラスに対してネイティブにパラメータ表記を可能にする機能への" @@ -8912,8 +9512,8 @@ msgstr "" #: ../../library/stdtypes.rst:5527 msgid "" -":ref:`Generics`, :ref:`user-defined generics ` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics ` " +"and :class:`typing.Generic`" msgstr "" ":ref:`Generics`, :ref:`ユーザー定義のジェネリック型 `, および :class:`typing.Generic`" @@ -8926,36 +9526,40 @@ msgstr "" "実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解できるジェネ" "リッククラスを実装する方法のドキュメントです。" -#: ../../library/stdtypes.rst:5537 msgid "Union Type" -msgstr "Union 型" +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 " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared to subscripting :" -"class:`typing.Union`." +"expression enables cleaner type hinting syntax compared to " +"subscripting :class:`typing.Union`." msgstr "" +"Union オブジェクトは、複数の :ref:`型オブジェクト ` に対" +"する ``|`` (ビット単位の論理和) 演算の値を保持します。\n" +"これらの型は主に :term:`型アノテーション ` で使うことを想定してい" +"ます。\n" +"Union型の式を使うと、: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`::" +"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* などの型を保持する Union オブジェクトを定義します。\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 +9582,55 @@ msgstr "" "Unionオブジェクトは他のUnionオブジェクトとの等価性をテストできます。以下は詳" "細です:" -#: ../../library/stdtypes.rst:5570 msgid "Unions of unions are flattened::" -msgstr "ユニオン型のユニオン型は平滑化されます::" +msgstr "Union の Union は平坦化されます。 ::" -#: ../../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 "ユニオン型を比較すると順序は無視されます::" +msgstr "Union型を比較すると順序は無視されます::" -#: ../../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オブジェク" -"トをサポートしています。 " +"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 +9640,6 @@ msgstr "" "しかし、Unionオブジェクトの中の :ref:`parameterized generics ` はチェックできません::" -#: ../../library/stdtypes.rst:5603 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -9051,14 +9648,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::" +"The user-exposed type for the union object can be accessed " +"from :class:`typing.Union` and used for :func:`isinstance` checks::" msgstr "" +"利用者が Union オブジェクトの型にアクセスするには :class:`typing.Union` を使" +"います。\n" +":func:`isinstance` による検査にも使えます。 ::" -#: ../../library/stdtypes.rst:5613 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -9068,6 +9672,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 +9690,6 @@ msgstr "" "が追加されました。メタクラスで :meth:`!__or__` を実装するとUnionをオーバーラ" "イドする場合があります::" -#: ../../library/stdtypes.rst:5626 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -9093,17 +9703,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`." +"were instances of :class:`types.UnionType`, which remains an alias " +"for :class:`typing.Union`." msgstr "" +"Union オブジェクトは :class:`typing.Union` のインスタンスになりました。\n" +"以前は :class:`types.UnionType` のインスタンスでしたが、この型名" +"は :class:`typing.Union` のエイリアスとして残っています。" #: ../../library/stdtypes.rst:5655 msgid "Other Built-in Types" @@ -9125,42 +9748,43 @@ msgstr "モジュール" msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " -"table. Module attributes can be assigned to. (Note that the :keyword:" -"`import` statement is not, strictly speaking, an operation on a module " -"object; ``import foo`` does not require a module object named *foo* to " -"exist, rather it requires an (external) *definition* for a module named " +"table. Module attributes can be assigned to. (Note that " +"the :keyword:`import` statement is not, strictly speaking, an operation on a " +"module object; ``import foo`` does not require a module object named *foo* " +"to exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" "モジュールに対する唯一の特殊な演算は属性アクセス: ``m.name`` です。ここで " "*m* はモジュールで、 *name* は *m* のシンボルテーブル上に定義された名前にアク" -"セスします。モジュール属性に代入することもできます。 (なお、:keyword:" -"`import` 文は、厳密にいえば、モジュールオブジェクトに対する演算ではありませ" -"ん; ``import foo`` は *foo* と名づけられたモジュールオブジェクトの存在を必要" -"とはせず、*foo* と名づけられたモジュールの (外部の) *定義* を必要とします。)" +"セスします。モジュール属性に代入することもできます。 (な" +"お、:keyword:`import` 文は、厳密にいえば、モジュールオブジェクトに対する演算" +"ではありません; ``import foo`` は *foo* と名づけられたモジュールオブジェクト" +"の存在を必要とはせず、*foo* と名づけられたモジュールの (外部の) *定義* を必要" +"とします。)" #: ../../library/stdtypes.rst:5673 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " "will actually change the module's symbol table, but direct assignment to " -"the :attr:`~object.__dict__` attribute is not possible (you can write ``m." -"__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write " -"``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " -"recommended." +"the :attr:`~object.__dict__` attribute is not possible (you can write " +"``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't " +"write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is " +"not recommended." msgstr "" "全てのモジュールにある特殊属性が :attr:`~object.__dict__` です。これはモ" "ジュールのシンボルテーブルを含む辞書です。この辞書を書き換えると実際にモ" -"ジュールのシンボルテーブルを変更することができますが、:attr:`~object." -"__dict__` 属性を直接代入することはできません (``m.__dict__['a'] = 1`` と書い" -"て ``m.a`` を ``1`` に定義することはできますが、``m.__dict__ = {}`` と書くこ" -"とはできません)。 :attr:`~object.__dict__` を直接書き換えることは推奨されませ" -"ん。" +"ジュールのシンボルテーブルを変更することができます" +"が、:attr:`~object.__dict__` 属性を直接代入することはできません " +"(``m.__dict__['a'] = 1`` と書いて ``m.a`` を ``1`` に定義することはできます" +"が、``m.__dict__ = {}`` と書くことはできません)。 :attr:`~object.__dict__` を" +"直接書き換えることは推奨されません。" #: ../../library/stdtypes.rst:5681 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" "インタプリタ内に組み込まれたモジュールは、 ```` のよ" "うに書かれます。ファイルから読み出された場合、 ``` (such as :meth:" -"`append` on lists) and :ref:`class instance method `. " -"Built-in methods are described with the types that support them." +"are two flavors: :ref:`built-in methods ` (such " +"as :meth:`append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." msgstr "" "メソッドは属性表記を使って呼び出される関数です。メソッドには二種類あります: " "(リストの :meth:`append` のような) :ref:`built-in methods ` " @@ -9221,23 +9845,23 @@ msgstr "" #: ../../library/stdtypes.rst:5721 msgid "" "If you access a method (a function defined in a class namespace) through an " -"instance, you get a special object: a :dfn:`bound method` (also called :ref:" -"`instance method `) object. When called, it will add the " -"``self`` argument to the argument list. Bound methods have two special read-" -"only attributes: :attr:`m.__self__ ` is the object on which " -"the method operates, and :attr:`m.__func__ ` is the " -"function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` " -"is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " -"arg-2, ..., arg-n)``." +"instance, you get a special object: a :dfn:`bound method` (also " +"called :ref:`instance method `) object. When called, it " +"will add the ``self`` argument to the argument list. Bound methods have two " +"special read-only attributes: :attr:`m.__self__ ` is the " +"object on which the method operates, and :attr:`m.__func__ " +"` is the function implementing the method. Calling " +"``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling " +"``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." msgstr "" "インスタンスを通してメソッド (クラスの名前空間内で定義された関数) にアクセス" "すると、特殊なオブジェクトが得られます。それは束縛メソッド (:dfn:`bound " "method`) オブジェクトで、インスタンスメソッド (:ref:`instance method " "`) とも呼ばれます。呼び出された時、引数リストに ``self`` 引" -"数が追加されます。束縛メソッドには 2 つの特殊読み出し専用属性があります。 :" -"attr:`m.__self__ ` はそのメソッドが操作するオブジェクトで、:" -"attr:`m.__func__ ` はそのメソッドを実装している関数です。 " -"``m(arg-1, arg-2, ..., arg-n)`` の呼び出しは、 ``m.__func__(m.__self__, " +"数が追加されます。束縛メソッドには 2 つの特殊読み出し専用属性がありま" +"す。 :attr:`m.__self__ ` はそのメソッドが操作するオブジェク" +"トで、:attr:`m.__func__ ` はそのメソッドを実装している関数で" +"す。 ``m(arg-1, arg-2, ..., arg-n)`` の呼び出しは、 ``m.__func__(m.__self__, " "arg-1, arg-2, ..., arg-n)`` の呼び出しと完全に等価です。" #: ../../library/stdtypes.rst:5732 @@ -9258,7 +9882,6 @@ msgstr "" "ためには、次のようにその下層の関数オブジェクトに明示的に設定する必要がありま" "す::" -#: ../../library/stdtypes.rst:5740 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -9273,6 +9896,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." @@ -9288,8 +9924,8 @@ msgid "" "executable Python code such as a function body. They differ from function " "objects because they don't contain a reference to their global execution " "environment. Code objects are returned by the built-in :func:`compile` " -"function and can be extracted from function objects through their :attr:" -"`~function.__code__` attribute. See also the :mod:`code` module." +"function and can be extracted from function objects through " +"their :attr:`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" "コードオブジェクトは、関数本体のような \"擬似コンパイルされた\" Python の実行" "可能コードを表すために実装系によって使われます。コードオブジェクトはグローバ" @@ -9298,15 +9934,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 "" @@ -9365,9 +10000,9 @@ msgstr "Ellipsis オブジェクト" #: ../../library/stdtypes.rst:5824 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, named :const:" -"`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:" -"`Ellipsis` singleton." +"no special operations. There is exactly one ellipsis object, " +"named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " +"the :const:`Ellipsis` singleton." msgstr "" "このオブジェクトは一般にスライシングによって使われます (:ref:`slicings` を参" "照してください)。特殊な演算は何もサポートしていません。Ellipsis オブジェクト" @@ -9386,13 +10021,13 @@ msgstr "NotImplemented オブジェクト" msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " -"more information. There is exactly one :data:`NotImplemented` object. :code:" -"`type(NotImplemented)()` produces the singleton instance." +"more information. There is exactly one :data:`NotImplemented` " +"object. :code:`type(NotImplemented)()` produces the singleton instance." msgstr "" "このオブジェクトは、対応していない型に対して比較演算や二項演算が求められたと" "き、それらの演算から返されます。詳細は :ref:`comparisons` を参照してくださ" -"い。 :data:`NotImplemented` オブジェクトは一つだけです。 :code:" -"`type(NotImplemented)()` はこの単一のインスタンスを作成します。" +"い。 :data:`NotImplemented` オブジェクトは一つだけで" +"す。 :code:`type(NotImplemented)()` はこの単一のインスタンスを作成します。" #: ../../library/stdtypes.rst:5842 msgid "It is written as :code:`NotImplemented`." @@ -9419,8 +10054,8 @@ msgstr "特殊属性" #: ../../library/stdtypes.rst:5860 msgid "" "The implementation adds a few special read-only attributes to several object " -"types, where they are relevant. Some of these are not reported by the :func:" -"`dir` built-in function." +"types, where they are relevant. Some of these are not reported by " +"the :func:`dir` built-in function." msgstr "" "実装は、いくつかのオブジェクト型に対して、適切な場合には特殊な読み出し専用の" "属性を追加します。そのうちいくつかは :func:`dir` 組込み関数で報告されません。" @@ -9439,21 +10074,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." +"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" @@ -9461,17 +10098,16 @@ msgstr "整数と文字列の変換での長さ制限" #: ../../library/stdtypes.rst:5903 msgid "" -"CPython has a global limit for converting between :class:`int` and :class:" -"`str` to mitigate denial of service attacks. This limit *only* applies to " -"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " -"binary conversions are unlimited. The limit can be configured." +"CPython has a global limit for converting between :class:`int` " +"and :class:`str` to mitigate denial of service attacks. This limit *only* " +"applies to decimal or other non-power-of-two number bases. Hexadecimal, " +"octal, and binary conversions are unlimited. The limit can be configured." msgstr "" "CPythonはDoS(サービス妨害攻撃)を軽減するために :class:`int` と :class:`str` " "の間の変換に全体的な制限を設けました。この制限は10進数や2のべき乗以外の基数" "に *のみ* 適用されます。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 +10116,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 +10145,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,24 +10167,43 @@ 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 "" -"The default limit is 4300 digits as provided in :data:`sys.int_info." -"default_max_str_digits `. The lowest limit that can be " -"configured is 640 digits as provided in :data:`sys.int_info." -"str_digits_check_threshold `." +"The default limit is 4300 digits as provided " +"in :data:`sys.int_info.default_max_str_digits `. The lowest " +"limit that can be configured is 640 digits as provided " +"in :data:`sys.int_info.str_digits_check_threshold `." msgstr "" "デフォルトの上限値は4,300桁で、:data:`sys.int_info.default_max_str_digits " -"` で定義されています。設定可能な最小の上限値は 640 桁で、 :" -"data:`sys.int_info.str_digits_check_threshold ` で定義されてい" -"ます。" +"` で定義されています。設定可能な最小の上限値は 640 桁" +"で、 :data:`sys.int_info.str_digits_check_threshold ` で定義さ" +"れています。" #: ../../library/stdtypes.rst:5948 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 +10213,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" @@ -9566,8 +10227,8 @@ msgstr "影響のあるAPI" #: ../../library/stdtypes.rst:5965 msgid "" -"The limitation only applies to potentially slow conversions between :class:" -"`int` and :class:`str` or :class:`bytes`:" +"The limitation only applies to potentially slow conversions " +"between :class:`int` and :class:`str` or :class:`bytes`:" msgstr "" "制限は :class:`int` と :class:`str` または :class:`bytes` の間での変換で時間" "がかかる可能性があると適用されます:" @@ -9588,13 +10249,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``。 " +"他の10進数での文字列変換。たとえば ``f\"{integer}\"``、``\"{}" +"\".format(integer)`` や ``b\"%d\" % integer``。" #: ../../library/stdtypes.rst:5975 msgid "The limitations do not apply to functions with a linear algorithm:" @@ -9656,22 +10316,23 @@ msgstr "" #: ../../library/stdtypes.rst:5995 msgid "" -":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" -"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " -"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " -"value of *-1* indicates that both were unset, thus a value of :data:`sys." -"int_info.default_max_str_digits` was used during initialization." +":data:`sys.flags.int_max_str_digits` contains the value " +"of :envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. " +"If both the env var and the ``-X`` option are set, the ``-X`` option takes " +"precedence. A value of *-1* indicates that both were unset, thus a value " +"of :data:`sys.int_info.default_max_str_digits` was used during " +"initialization." msgstr "" ":data:`sys.flags.int_max_str_digits` には :envvar:`PYTHONINTMAXSTRDIGITS` ま" "たは :option:`-X int_max_str_digits <-X>` の値が設定されます。環境変数と ``-" "X`` オプションの両方が指定された場合は ``-X`` オプションが優先されます。 " -"*-1* という値はどちらも未設定であることを表し、その場合は :data:`sys." -"int_info.default_max_str_digits` の値が初期化時に使用されます。" +"*-1* という値はどちらも未設定であることを表し、その場合" +"は :data:`sys.int_info.default_max_str_digits` の値が初期化時に使用されます。" #: ../../library/stdtypes.rst:6001 msgid "" -"From code, you can inspect the current limit and set a new one using these :" -"mod:`sys` APIs:" +"From code, you can inspect the current limit and set a new one using " +"these :mod:`sys` APIs:" msgstr "" "コードでは、以下の :mod:`sys` APIを使用して現在の上限値を調べ、新しい値を設定" "できます。" @@ -9688,8 +10349,8 @@ msgstr "" #: ../../library/stdtypes.rst:6008 msgid "" -"Information about the default and minimum can be found in :data:`sys." -"int_info`:" +"Information about the default and minimum can be found " +"in :data:`sys.int_info`:" msgstr "" "デフォルト値と最小値に関する情報は :data:`sys.int_info` で参照できます:" @@ -9709,7 +10370,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 +10380,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 +10424,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/stdtypes.rst:6043 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9775,6 +10435,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 +10469,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 +10714,8 @@ msgstr "16進数" msgid "octal" msgstr "8進数" -#: ../../library/stdtypes.rst:229 msgid "binary" -msgstr "2進数" +msgstr "二項" #: ../../library/stdtypes.rst:249 msgid "arithmetic" @@ -10399,49 +11066,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 +11108,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 +11222,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..8ab3184c2 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 @@ -54,9 +54,9 @@ msgstr "このモジュールで定義されている定数は以下の通りで #: ../../library/string.rst:26 msgid "" -"The concatenation of the :const:`ascii_lowercase` and :const:" -"`ascii_uppercase` constants described below. This value is not locale-" -"dependent." +"The concatenation of the :const:`ascii_lowercase` " +"and :const:`ascii_uppercase` constants described below. This value is not " +"locale-dependent." msgstr "" "後述の :const:`ascii_lowercase` と :const:`ascii_uppercase` を合わせたもの。" "この値はロケールに依存しません。" @@ -97,29 +97,33 @@ 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`." +"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 `)." +"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" @@ -134,11 +138,11 @@ msgid "" "behaviors using the same implementation as the built-in :meth:`~str.format` " "method." msgstr "" -"組み込みの文字列 (string) クラスには、 :pep:`3101` で記述されている :meth:" -"`~str.format` メソッドによって複雑な変数置換と値のフォーマットを行う機能があ" -"ります。 :mod:`string` モジュールの :class:`Formatter` クラスでは、組み込み" -"の :meth:`~str.format` メソッドと同じ実装を使用して、独自の文字列フォーマット" -"の振る舞いを作成してカスタマイズすることができます。" +"組み込みの文字列 (string) クラスには、 :pep:`3101` で記述されてい" +"る :meth:`~str.format` メソッドによって複雑な変数置換と値のフォーマットを行う" +"機能があります。 :mod:`string` モジュールの :class:`Formatter` クラスでは、組" +"み込みの :meth:`~str.format` メソッドと同じ実装を使用して、独自の文字列フォー" +"マットの振る舞いを作成してカスタマイズすることができます。" #: ../../library/string.rst:97 msgid "The :class:`Formatter` class has the following public methods:" @@ -147,8 +151,8 @@ msgstr ":class:`Formatter` クラスは、以下のメソッドを持ちます:" #: ../../library/string.rst:101 msgid "" "The primary API method. It takes a format string and an arbitrary set of " -"positional and keyword arguments. It is just a wrapper that calls :meth:" -"`vformat`." +"positional and keyword arguments. It is just a wrapper that " +"calls :meth:`vformat`." msgstr "" "主要な API メソッドです。書式文字列と、任意の位置引数およびキーワード引数の" "セットを取ります。これは、:meth:`vformat` を呼び出す単なるラッパーです。" @@ -165,9 +169,10 @@ msgid "" "This function does the actual work of formatting. It is exposed as a " "separate function for cases where you want to pass in a predefined " "dictionary of arguments, rather than unpacking and repacking the dictionary " -"as individual arguments using the ``*args`` and ``**kwargs`` syntax. :meth:" -"`vformat` does the work of breaking up the format string into character data " -"and replacement fields. It calls the various methods described below." +"as individual arguments using the ``*args`` and ``**kwargs`` " +"syntax. :meth:`vformat` does the work of breaking up the format string into " +"character data and replacement fields. It calls the various methods " +"described below." msgstr "" "この関数はフォーマットの実際の仕事をします。この関数は、 ``*args`` および " "``**kwargs`` シンタックスを使用して、辞書を個々の引数として unpack してから再" @@ -196,7 +201,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,66 +210,80 @@ 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` " "before calling this method. Returns a tuple (obj, used_key). The default " -"version takes strings of the form defined in :pep:`3101`, such as " -"\"0[name]\" or \"label.title\". *args* and *kwargs* are as passed in to :" -"meth:`vformat`. The return value *used_key* has the same meaning as the " +"version takes strings of the form defined in :pep:`3101`, such as \"0[name]" +"\" or \"label.title\". *args* and *kwargs* are as passed in " +"to :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 "" -"The *args* parameter is set to the list of positional arguments to :meth:" -"`vformat`, and the *kwargs* parameter is set to the dictionary of keyword " -"arguments." +"The *args* parameter is set to the list of positional arguments " +"to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of " +"keyword arguments." 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." +"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 "" -"If the index or keyword refers to an item that does not exist, then an :exc:" -"`IndexError` or :exc:`KeyError` should be raised." +"If the index or keyword refers to an item that does not exist, then " +"an :exc:`IndexError` or :exc:`KeyError` should be raised." msgstr "" -"インデックスまたはキーワードが存在しないアイテムを参照した場合、 :exc:" -"`IndexError` または :exc:`KeyError` が送出されます。" +"インデックスまたはキーワードが存在しないアイテムを参照した場" +"合、 :exc:`IndexError` または :exc:`KeyError` が送出されます。" #: ../../library/string.rst:172 msgid "" @@ -273,23 +291,23 @@ msgid "" "function is the set of all argument keys that were actually referred to in " "the format string (integers for positional arguments, and strings for named " "arguments), and a reference to the *args* and *kwargs* that was passed to " -"vformat. The set of unused args can be calculated from these parameters. :" -"meth:`check_unused_args` is assumed to raise an exception if the check fails." +"vformat. The set of unused args can be calculated from these " +"parameters. :meth:`check_unused_args` is assumed to raise an exception if " +"the check fails." msgstr "" "希望に応じて未使用の引数がないか確認する機能を実装します。この関数への引数" "は、書式指定文字列で実際に参照されるすべての引数のキーの set (位置引数の整" "数、名前付き引数の文字列) と、vformat に渡される *args* と *kwargs* への参照" -"です。使用されない引数の set は、これらのパラメータから計算されます。 :meth:" -"`check_unused_args` は、確認の結果が偽である場合に例外を送出するものとみなさ" -"れます。" +"です。使用されない引数の set は、これらのパラメータから計算されま" +"す。 :meth:`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 "" @@ -298,8 +316,8 @@ msgid "" "understands 's' (str), 'r' (repr) and 'a' (ascii) conversion types." msgstr "" "(:meth:`get_field` が返す) 値を (:meth:`parse` メソッドが返すタプルの形式で) " -"与えられた変換タイプとして変換します。デフォルトバージョンは 's' (str), " -"'r' (repr), 'a' (ascii) 変換タイプを理解します。" +"与えられた変換タイプとして変換します。デフォルトバージョンは 's' (str), 'r' " +"(repr), 'a' (ascii) 変換タイプを理解します。" #: ../../library/string.rst:196 msgid "Format String Syntax" @@ -368,22 +386,22 @@ msgid "" "not quote-delimited, it is not possible to specify arbitrary dictionary keys " "(e.g., the strings ``'10'`` or ``':-]'``) within a format string. The " "*arg_name* can be followed by any number of index or attribute expressions. " -"An expression of the form ``'.name'`` selects the named attribute using :" -"func:`getattr`, while an expression of the form ``'[index]'`` does an index " -"lookup using :meth:`~object.__getitem__`." +"An expression of the form ``'.name'`` selects the named attribute " +"using :func:`getattr`, while an expression of the form ``'[index]'`` does an " +"index lookup using :meth:`~object.__getitem__`." msgstr "" "*field_name* それ自身は、数かキーワードのいずれかである *arg_name* から始まり" "ます。それが数である場合、位置引数を参照します。また、それがキーワードである" -"場合、指定されたキーワード引数を参照します。文字列に対して :meth:`str." -"isdecimal` を呼び出した結果が真の場合、 *arg_name* は数として扱われます。書式" -"文字列中で数の arg_names が順に 0, 1, 2, ... である場合、それらはすべて (いく" -"つかではありません) 省略することができます。そして数 0, 1, 2, ... は、自動的" -"にその順で挿入されます。 *arg_name* は引用符で区切られていないので、書式文字" -"列内の任意の辞書キー (例えば文字列 ``'10'`` や ``':-]'`` など) を指定すること" -"はできません。 *arg_name* の後に任意の数のインデックス式または属性式を続ける" -"ことができます。 ``'.name'`` 形式の式は :func:`getattr` を使用して指定された" -"属性を選択します。一方、 ``'[index]'`` 形式の式は :meth:`~object." -"__getitem__` を使用してインデックス参照を行います。" +"場合、指定されたキーワード引数を参照します。文字列に対し" +"て :meth:`str.isdecimal` を呼び出した結果が真の場合、 *arg_name* は数として扱" +"われます。書式文字列中で数の arg_names が順に 0, 1, 2, ... である場合、それら" +"はすべて (いくつかではありません) 省略することができます。そして数 0, 1, " +"2, ... は、自動的にその順で挿入されます。 *arg_name* は引用符で区切られていな" +"いので、書式文字列内の任意の辞書キー (例えば文字列 ``'10'`` や ``':-]'`` な" +"ど) を指定することはできません。 *arg_name* の後に任意の数のインデックス式ま" +"たは属性式を続けることができます。 ``'.name'`` 形式の式は :func:`getattr` を" +"使用して指定された属性を選択します。一方、 ``'[index]'`` 形式の式" +"は :meth:`~object.__getitem__` を使用してインデックス参照を行います。" #: ../../library/string.rst:251 msgid "" @@ -424,26 +442,27 @@ 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__` " "method of the value itself. However, in some cases it is desirable to force " "a type to be formatted as a string, overriding its own definition of " -"formatting. By converting the value to a string before calling :meth:" -"`~object.__format__`, the normal formatting logic is bypassed." +"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 "" -"Three conversion flags are currently supported: ``'!s'`` which calls :func:" -"`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` which " -"calls :func:`ascii`." +"Three conversion flags are currently supported: ``'!s'`` which " +"calls :func:`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!" +"a'`` which calls :func:`ascii`." msgstr "" "現在 3つの変換フラグがサポートされています: 値に対して :func:`str` を呼ぶ " "``'!s'`` 、 :func:`repr` を呼ぶ ``'!r'`` 、 :func:`ascii` を呼ぶ ``'!a'``。" @@ -462,16 +481,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 "" @@ -507,14 +526,14 @@ msgstr "書式指定ミニ言語仕様" #: ../../library/string.rst:307 msgid "" "\"Format specifications\" are used within replacement fields contained " -"within a format string to define how individual values are presented (see :" -"ref:`formatstrings` and :ref:`f-strings`). They can also be passed directly " -"to the built-in :func:`format` function. Each formattable type may define " -"how the format specification is to be interpreted." +"within a format string to define how individual values are presented " +"(see :ref:`formatstrings` and :ref:`f-strings`). They can also be passed " +"directly to the built-in :func:`format` function. Each formattable type may " +"define how the format specification is to be interpreted." msgstr "" "書式指定 (\"Format specifications\") は書式指定文字列の個々の値を表現する方法" -"を指定するための、置換フィールドで使用されます (:ref:`formatstrings` および :" -"ref:`f-strings` を参照してください) 。\n" +"を指定するための、置換フィールドで使用されます (:ref:`formatstrings` およ" +"び :ref:`f-strings` を参照してください) 。\n" "それらは、組み込み関数の :func:`format` 関数に直接渡されます。\n" "それぞれの書式指定可能な型について、書式指定がどのように解釈されるかが規定さ" "れます。" @@ -592,26 +611,27 @@ 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 " -"alignment option is only valid for numeric types, excluding :class:" -"`complex`. It becomes the default for numbers when '0' immediately precedes " -"the field width." -msgstr "" +"alignment option is only valid for numeric types, " +"excluding :class:`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 +663,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 +721,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 +765,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 +796,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 +815,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 +835,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 @@ -914,8 +941,8 @@ msgstr "" #: ../../library/string.rst:530 msgid "" -"The available presentation types for :class:`float` and :class:`~decimal." -"Decimal` values are:" +"The available presentation types for :class:`float` " +"and :class:`~decimal.Decimal` values are:" msgstr "" "利用可能な :class:`float` と :class:`~decimal.Decimal` の表現型は以下です:" @@ -923,17 +950,24 @@ 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 " "exponent. The coefficient has one digit before and ``p`` digits after the " "decimal point, for a total of ``p + 1`` significant digits. With no " "precision given, uses a precision of ``6`` digits after the decimal point " -"for :class:`float`, and shows all coefficient digits for :class:`~decimal." -"Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " -"is used." -msgstr "" +"for :class:`float`, and shows all coefficient digits " +"for :class:`~decimal.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 +983,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 +991,13 @@ 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 +1026,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,28 +1038,30 @@ 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`` 桁でフォーマットされます。どちらの場合でも、仮数部の有効で" -"ない末尾のゼロは取り除かれます。また小数点以下に表示する桁が無い場合、 " -"``'#'`` オプションが使われた場合をのぞき、小数点は除去されます。" - -#: ../../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 " -"is formed from the coefficient digits of the value; scientific notation is " -"used for values smaller than ``1e-6`` in absolute value and values where the " -"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" -"より大きい値では科学的表記が使われます。それ以外の場合は固定小数点表記が使わ" -"れます。" +"フォーマットした結果、指数部が ``exp`` になったと仮定します。\n" +"このとき ``m <= exp < p`` ならば、数値は書式 ``'f'`` 型および精度 ``p-1-" +"exp`` 桁でフォーマットされます。\n" +"ただし ``m`` は浮動小数点数では -4 であり、 :class:`Decimals " +"` に対しては -6 です。\n" +"それ以外の場合、数値は書式 ``'e'`` 型および精度 ``p-1`` 桁でフォーマットされ" +"ます。\n" +"どちらの場合も、``'#'`` オプションが使われていなければ、仮数部の有効でない末" +"尾のゼロを取り除き、小数点以下に桁が残らなければ小数点も取り除きます。" + +msgid "" +"With no precision given, uses a precision of ``6`` significant digits " +"for :class:`float`. For :class:`~decimal.Decimal`, the coefficient of the " +"result is formed from the coefficient digits of the value; scientific " +"notation is used for values smaller than ``1e-6`` in absolute value and " +"values where the place value of the least significant digit is larger than " +"1, and fixed-point notation is used otherwise." +msgstr "" +"精度が指定されていない場合、:class:`float` には有効桁数 ``6`` 桁を使用しま" +"す。\n" +":class:`~decimal.Decimal` では、元の値の係数の各桁から結果の係数を構成しま" +"す。\n" +"絶対値が ``1e-6`` より小さい値や、最下位桁が十の位以上にある値には科学的表記" +"を使用し、それ以外には固定小数点表記を使用します。" #: ../../library/string.rst:591 msgid "" @@ -1062,7 +1103,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 +1110,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 +1141,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 +1151,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 +1172,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 "" @@ -1285,16 +1335,16 @@ msgid "" "'+3.140000; -3.140000'\n" ">>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers\n" "' 3.140000; -3.140000'\n" -">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:" -"f}; {:f}'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as " +"'{:f}; {:f}'\n" "'3.140000; -3.140000'" msgstr "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" ">>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers\n" "' 3.140000; -3.140000'\n" -">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:" -"f}; {:f}'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as " +"'{:f}; {:f}'\n" "'3.140000; -3.140000'" #: ../../library/string.rst:721 @@ -1318,11 +1368,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 +1387,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 +1438,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 +1467,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" @@ -1413,12 +1501,13 @@ msgstr "テンプレート文字列" #: ../../library/string.rst:797 msgid "" -"Template strings provide simpler string substitutions as described in :pep:" -"`292`. A primary use case for template strings is for internationalization " -"(i18n) since in that context, the simpler syntax and functionality makes it " -"easier to translate than other built-in string formatting facilities in " -"Python. As an example of a library built on template strings for i18n, see " -"the `flufl.i18n `_ package." +"Template strings provide simpler string substitutions as described " +"in :pep:`292`. A primary use case for template strings is for " +"internationalization (i18n) since in that context, the simpler syntax and " +"functionality makes it easier to translate than other built-in string " +"formatting facilities in Python. As an example of a library built on " +"template strings for i18n, see the `flufl.i18n `_ package." msgstr "" "テンプレート文字列では :pep:`292` で解説されている単純な文字列置換ができま" "す。\n" @@ -1441,7 +1530,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 +1538,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 "" @@ -1469,8 +1558,8 @@ msgstr "" #: ../../library/string.rst:822 msgid "" -"Any other appearance of ``$`` in the string will result in a :exc:" -"`ValueError` being raised." +"Any other appearance of ``$`` in the string will result in " +"a :exc:`ValueError` being raised." msgstr "" "上記以外の書き方で文字列中に ``$`` を使うと :exc:`ValueError` を送出します。" @@ -1530,11 +1619,12 @@ msgstr "" "レースホルダ名を含むような不正なテンプレートを何も警告せずに無視するため、安" "全とはいえないのです。" -#: ../../library/string.rst:861 msgid "" -"Returns ``False`` if the template has invalid placeholders that will cause :" -"meth:`substitute` to raise :exc:`ValueError`." +"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,22 +1697,21 @@ 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 " -"*not* be a regular expression, as the implementation will call :meth:`re." -"escape` on this string as needed. Note further that you cannot change the " -"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 " -"を設定したいのであれば、サブクラスの名前空間で行わなければならない) ことに注" -"意してください。" +"*not* be a regular expression, as the implementation will " +"call :meth:`re.escape` on this string as needed. Note further that you " +"cannot change the 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" +"クラスの作成後に区切り文字を変更することはできません。\n" +"別の区切り文字を使うには、サブクラスのクラス名前空間で設定する必要がありま" +"す。" #: ../../library/string.rst:911 msgid "" @@ -1667,7 +1756,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 +1763,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 +1798,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 "" @@ -1741,11 +1828,11 @@ msgstr "ヘルパー関数" #: ../../library/string.rst:969 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " -"using :meth:`str.capitalize`, and join the capitalized words using :meth:" -"`str.join`. If the optional second argument *sep* is absent or ``None``, " -"runs of whitespace characters are replaced by a single space and leading and " -"trailing whitespace are removed, otherwise *sep* is used to split and join " -"the words." +"using :meth:`str.capitalize`, and join the capitalized words " +"using :meth:`str.join`. If the optional second argument *sep* is absent or " +"``None``, runs of whitespace characters are replaced by a single space and " +"leading and trailing whitespace are removed, otherwise *sep* is used to " +"split and join the words." msgstr "" ":meth:`str.split` を使って引数を単語に分割し、 :meth:`str.capitalize` を使っ" "てそれぞれの単語の先頭の文字を大文字に変換し、 :meth:`str.join` を使ってつな" @@ -1813,7 +1900,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..c11143c4c 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 @@ -82,11 +82,11 @@ msgstr "" #: ../../library/stringprep.rst:34 msgid "" "As a result, these tables are exposed as functions, not as data structures. " -"There are two kinds of tables in the RFC: sets and mappings. For a set, :mod:" -"`stringprep` provides the \"characteristic function\", i.e. a function that " -"returns ``True`` if the parameter is part of the set. For mappings, it " -"provides the mapping function: given the key, it returns the associated " -"value. Below is a list of all functions available in the module." +"There are two kinds of tables in the RFC: sets and mappings. For a " +"set, :mod:`stringprep` provides the \"characteristic function\", i.e. a " +"function that returns ``True`` if the parameter is part of the set. For " +"mappings, it provides the mapping function: given the key, it returns the " +"associated value. Below is a list of all functions available in the module." msgstr "" "その結果、これらのテーブルはデータ構造体ではなく、関数として公開されていま" "す。RFC には 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..db50257e2 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,16 +64,25 @@ 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 "" "Several :mod:`struct` functions (and methods of :class:`Struct`) take a " -"*buffer* argument. This refers to objects that implement the :ref:" -"`bufferobjects` and provide either a readable or read-writable buffer. The " -"most common types used for that purpose are :class:`bytes` and :class:" -"`bytearray`, but many other types that can be viewed as an array of bytes " -"implement the buffer protocol, so that they can be read/filled without " -"additional copying from a :class:`bytes` object." +"*buffer* argument. This refers to objects that implement " +"the :ref:`bufferobjects` and provide either a readable or read-writable " +"buffer. The most common types used for that purpose are :class:`bytes` " +"and :class:`bytearray`, but many other types that can be viewed as an array " +"of bytes implement the buffer protocol, so that they can be read/filled " +"without additional copying from a :class:`bytes` object." msgstr "" "いくつかの :mod:`struct` の関数 (および :class:`Struct` のメソッド) は " "*buffer* 引数を取ります。 これは :ref:`bufferobjects` を実装していて読み取り" @@ -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:" @@ -295,8 +317,8 @@ msgstr "Python の例:" msgid "" "Native byte order is big-endian or little-endian, depending on the host " "system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-" -"endian; IBM z and many legacy architectures are big-endian. Use :data:`sys." -"byteorder` to check the endianness of your system." +"endian; IBM z and many legacy architectures are big-endian. " +"Use :data:`sys.byteorder` to check the endianness of your system." msgstr "" "ネイティブのバイトオーダはビッグエンディアンかリトルエンディアンで、ホストシ" "ステムに依存します。例えば、Intel x86、AMD64 (x86-64) および Apple M1 はリト" @@ -315,8 +337,8 @@ msgstr "" #: ../../library/struct.rst:186 msgid "" -"Standard size depends only on the format character; see the table in the :" -"ref:`format-characters` section." +"Standard size depends only on the format character; see the table in " +"the :ref:`format-characters` section." msgstr "" "標準のサイズはフォーマット文字だけで決まります。 :ref:`format-characters` の" "表を参照して下さい。" @@ -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,33 +808,32 @@ 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 "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " "count. The first byte stored is the length of the string, or 255, whichever " -"is smaller. The bytes of the string follow. If the string passed in to :" -"func:`pack` is too long (longer than the count minus 1), only the leading " -"``count-1`` bytes of the string are stored. If the string is shorter than " -"``count-1``, it is padded with null bytes so that exactly count bytes in all " -"are used. Note that for :func:`unpack`, the ``'p'`` format character " -"consumes ``count`` bytes, but that the string returned can never contain " -"more than 255 bytes." +"is smaller. The bytes of the string follow. If the string passed in " +"to :func:`pack` is too long (longer than the count minus 1), only the " +"leading ``count-1`` bytes of the string are stored. If the string is " +"shorter than ``count-1``, it is padded with null bytes so that exactly count " +"bytes in all are used. Note that for :func:`unpack`, the ``'p'`` format " +"character consumes ``count`` bytes, but that the string returned can never " +"contain more than 255 bytes." msgstr "" "フォーマット文字 ``'p'`` は \"Pascal 文字列 (pascal string)\" をコードしま" "す。Pascal 文字列は count で与えられる *固定長のバイト列* に収められた短い可" "変長の文字列です。このデータの先頭の 1 バイトには文字列の長さか255 のうち、小" -"さい方の数が収められます。その後に文字列のバイトデータが続きます。 :func:" -"`pack` に渡された Pascal 文字列の長さが長すぎた (count-1 よりも長い) 場合、先" -"頭の ``count-1`` バイトが書き込まれます。文字列が ``count-1`` よりも短い場" -"合、指定した count バイトに達するまでの残りの部分はヌルで埋められます。 :" -"func:`unpack` では、フォーマット文字 ``'p'`` は指定された ``count`` バイトだ" -"けデータを読み込みますが、返される文字列は決して 255 文字を超えることはないの" -"で注意してください。" +"さい方の数が収められます。その後に文字列のバイトデータが続きま" +"す。 :func:`pack` に渡された Pascal 文字列の長さが長すぎた (count-1 よりも長" +"い) 場合、先頭の ``count-1`` バイトが書き込まれます。文字列が ``count-1`` よ" +"りも短い場合、指定した count バイトに達するまでの残りの部分はヌルで埋められま" +"す。 :func:`unpack` では、フォーマット文字 ``'p'`` は指定された ``count`` バ" +"イトだけデータを読み込みますが、返される文字列は決して 255 文字を超えることは" +"ないので注意してください。" #: ../../library/struct.rst:346 msgid "" @@ -862,21 +881,21 @@ msgstr "" msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " -"``'Q'``), if ``x`` is outside the valid range for that format then :exc:" -"`struct.error` is raised." +"``'Q'``), if ``x`` is outside the valid range for that format " +"then :exc:`struct.error` is raised." msgstr "" "整数フォーマット (``'b'``, ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, " "``'l'``, ``'L'``, ``'q'``, ``'Q'``) のいずれかを使って値 ``x`` をパックすると" "き ``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 +913,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 +937,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 +982,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 +991,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 +1007,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 +1025,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 +1060,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 +1084,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 +1096,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 +1166,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 "" "Run the command described by *args*. Wait for command to complete, then " "return a :class:`CompletedProcess` instance." msgstr "" -"*args* で指定されたコマンドを実行します。コマンドの完了を待って、:class:" -"`CompletedProcess` インスタンスを返します。" +"*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 " @@ -111,56 +110,77 @@ msgid "" "this function are passed through to that interface. (*timeout*, *input*, " "*check*, and *capture_output* are not.)" msgstr "" -"上記の引数は、もっともよく使われるものだけ示しており、後述の :ref:" -"`frequently-used-arguments` で説明されています (そのためここではキーワード専" -"用引数の表記に省略されています)。関数の完全な使用法を説明しても大部分が :" -"class:`Popen` コンストラクターの内容と同じになります - この関数のほとんどの引" -"数は :class:`Popen` インターフェイスに渡されます。(*timeout*、*input* および " -"*check* は除く。)" +"上記の引数は、もっともよく使われるものだけ示しており、後述" +"の :ref:`frequently-used-arguments` で説明されています (そのためここではキー" +"ワード専用引数の表記に省略されています)。\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* " "and *stderr* both set to :data:`~subprocess.PIPE`. The *stdout* and *stderr* " "arguments may not be supplied at the same time as *capture_output*. If you " -"wish to capture and combine both streams into one, set *stdout* to :data:" -"`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, instead of " -"using *capture_output*." -msgstr "" +"wish to capture and combine both streams into one, set *stdout* " +"to :data:`~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` に設定し" +"てください。" + +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 killed and waited for. The :exc:`TimeoutExpired` exception will be re-" +"raised after the child process has terminated. The initial process creation " +"itself 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: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 " -"killed and waited for. The :exc:`TimeoutExpired` exception will be re-raised " -"after the child process has terminated. The initial process creation itself " -"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 "" - -#: ../../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 " "*encoding* or *errors* is specified or *text* is true. When used, the " -"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 "" +"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 "" -"If *check* is true, and the process exits with a non-zero exit code, a :exc:" -"`CalledProcessError` exception will be raised. Attributes of that exception " -"hold the arguments, the exit code, and stdout and stderr if they were " -"captured." +"If *check* is true, and the process exits with a non-zero exit code, " +"a :exc:`CalledProcessError` exception will be raised. Attributes of that " +"exception hold the arguments, the exit code, and stdout and stderr if they " +"were captured." msgstr "" -"*check* に真を指定した場合、プロセスが非ゼロの終了コードで終了すると :exc:" -"`CalledProcessError` 例外が送出されます。\n" +"*check* に真を指定した場合、プロセスが非ゼロの終了コードで終了する" +"と :exc:`CalledProcessError` 例外が送出されます。\n" "この例外の属性には、引数、終了コード、標準出力および標準エラー出力が捕捉でき" "た場合に格納されます。" -#: ../../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,34 +188,36 @@ 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 " "behavior of inheriting the current process' environment. It is passed " "directly to :class:`Popen`. This mapping can be 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`` 以外の場合、これは新しいプロセスでの環境変数を定義します。" -"デフォルトでは、子プロセスは現在のプロセスの環境変数を引き継ぎます。 :class:" -"`Popen` に直接渡されます。あらゆるプラットフォームで :data:`os.environ` のよ" -"うに文字列から文字列へ、またPOSIX プラットフォームにおいては :data:`os." -"environb` のようにバイトからバイトへも、定義すること出来ます。" +"or bytes to bytes on POSIX platforms much like :data:`os.environ` " +"or :data:`os.environb`." +msgstr "" +"*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 +232,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 "" @@ -229,8 +262,8 @@ msgstr "" msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" -"\\System32\\cmd.exe``. As a result, dropping a malicious program named ``cmd." -"exe`` into a current directory no longer works." +"\\System32\\cmd.exe``. As a result, dropping a malicious program named " +"``cmd.exe`` into a current directory no longer works." msgstr "" "``shell=True`` のときのWindowsシェル検索順序を変更しました。カレントディレク" "トリと ``%PATH%`` は、 ``%COMSPEC%`` と ``%SystemRoot%\\System32\\cmd.exe`` " @@ -265,15 +298,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." +"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 +317,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." +"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`." @@ -305,8 +338,8 @@ msgid "" "to :class:`Popen` and indicates that the special file :data:`os.devnull` " "will be used." msgstr "" -":class:`Popen` の *stdin*, *stdout*, *stderr* 引数に渡して、標準入出力を :" -"data:`os.devnull` から入出力するように指定するための特殊値です。" +":class:`Popen` の *stdin*, *stdout*, *stderr* 引数に渡して、標準入出力" +"を :data:`os.devnull` から入出力するように指定するための特殊値です。" #: ../../library/subprocess.rst:177 msgid "" @@ -347,33 +380,33 @@ 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 " -"any output was captured regardless of the ``text=True`` setting. It may " -"remain ``None`` instead of ``b''`` when no output was observed." +"Output of the child process if it was captured by :func:`run` " +"or :func:`check_output`. Otherwise, ``None``. This is " +"always :class:`bytes` when any output was captured regardless of the " +"``text=True`` setting. It may remain ``None`` instead of ``b''`` when no " +"output was observed." 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" @@ -381,13 +414,13 @@ msgstr "属性 *stdout* および *stderr* が追加されました。" #: ../../library/subprocess.rst:235 msgid "" -"Subclass of :exc:`SubprocessError`, raised when a process run by :func:" -"`check_call`, :func:`check_output`, or :func:`run` (with ``check=True``) " -"returns a non-zero exit status." +"Subclass of :exc:`SubprocessError`, raised when a process run " +"by :func:`check_call`, :func:`check_output`, or :func:`run` (with " +"``check=True``) returns a non-zero exit status." msgstr "" -":exc:`SubprocessError` のサブクラスです。:func:`check_call` または :func:" -"`check_output` 、 ``check=True`` であるときの :func:`run` 、によって実行され" -"たプロセスが非ゼロの終了ステータスを返した場合に送出されます。" +":exc:`SubprocessError` のサブクラスです。:func:`check_call` また" +"は :func:`check_output` 、 ``check=True`` であるときの :func:`run` 、によって" +"実行されたプロセスが非ゼロの終了ステータスを返した場合に送出されます。" #: ../../library/subprocess.rst:242 msgid "" @@ -399,8 +432,8 @@ msgstr "" #: ../../library/subprocess.rst:251 msgid "" -"Output of the child process if it was captured by :func:`run` or :func:" -"`check_output`. Otherwise, ``None``." +"Output of the child process if it was captured by :func:`run` " +"or :func:`check_output`. Otherwise, ``None``." msgstr "" ":func:`run` または :func:`check_output` によって捕捉された子プロセスの出力。" "捕捉されなかったら ``None`` になります。" @@ -453,19 +486,23 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special file :data:" -"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " -"which indicates that the stderr data from the child process should be " -"captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special " +"file :data:`os.devnull` will be used. Additionally, *stderr* can " +"be :data:`STDOUT`, which indicates that the stderr data from the child " +"process should be 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 "" @@ -475,36 +512,37 @@ msgid "" "information see the documentation of the :class:`io.TextIOWrapper` class " "when the *newline* argument to its constructor is ``None``." msgstr "" -"*stdin* については、入力での行末文字 ``'\\n'`` はデフォルトの行セパレーター :" -"data:`os.linesep` に変換されます。*stdout* と *stderr* については、出力での行" -"末はすべて ``'\\n'`` に変換されます。詳細は :class:`io.TextIOWrapper` クラス" -"のドキュメントでコンストラクターの引数 *newline* が ``None`` である場合を参照" -"してください。" +"*stdin* については、入力での行末文字 ``'\\n'`` はデフォルトの行セパレー" +"ター :data:`os.linesep` に変換されます。*stdout* と *stderr* については、出力" +"での行末はすべて ``'\\n'`` に変換されます。詳細は :class:`io.TextIOWrapper` " +"クラスのドキュメントでコンストラクターの引数 *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." +"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 "" @@ -514,30 +552,31 @@ msgid "" "convenient access to other shell features such as shell pipes, filename " "wildcards, environment variable expansion, and expansion of ``~`` to a " "user's home directory. However, note that Python itself offers " -"implementations of many shell-like features (in particular, :mod:`glob`, :" -"mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path." -"expanduser`, and :mod:`shutil`)." +"implementations of many shell-like features (in " +"particular, :mod:`glob`, :mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path.expanduser`, " +"and :mod:`shutil`)." msgstr "" "*shell* が ``True`` なら、指定されたコマンドはシェルによって実行されます。あ" "なたが Python を主として (ほとんどのシステムシェル以上の) 強化された制御フ" "ローのために使用していて、さらにシェルパイプ、ファイル名ワイルドカード、環境" "変数展開、``~`` のユーザーホームディレクトリへの展開のような他のシェル機能へ" "の簡単なアクセスを望むなら、これは有用かもしれません。しかしながら、Python 自" -"身が多くのシェル的な機能の実装を提供していることに注意してください (特に :" -"mod:`glob`, :mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :" -"func:`os.path.expanduser`, :mod:`shutil`)。" +"身が多くのシェル的な機能の実装を提供していることに注意してください (特" +"に :mod:`glob`, :mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path.expanduser`, :mod:`shutil`)。" #: ../../library/subprocess.rst:336 msgid "" -"When *universal_newlines* is ``True``, the class uses the encoding :func:" -"`locale.getpreferredencoding(False) ` instead " -"of ``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` " -"class for more information on this change." +"When *universal_newlines* is ``True``, the class uses the " +"encoding :func:`locale.getpreferredencoding(False) " +"` instead of " +"``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` class " +"for more information on this change." msgstr "" -"*universal_newlines* が ``True`` の場合、クラスはエンコーディング ``locale." -"getpreferredencoding()`` の代わりに :func:`locale." -"getpreferredencoding(False) ` を使用します。この" -"変更についての詳細は、 :class:`io.TextIOWrapper` クラスを参照してください。" +"*universal_newlines* が ``True`` の場合、クラスはエンコーディング " +"``locale.getpreferredencoding()`` の代わり" +"に :func:`locale.getpreferredencoding(False) ` " +"を使用します。この変更についての詳細は、 :class:`io.TextIOWrapper` クラスを参" +"照してください。" #: ../../library/subprocess.rst:344 ../../library/subprocess.rst:465 msgid "" @@ -566,14 +605,14 @@ msgid "" msgstr "" "このモジュールの中で、根底のプロセス生成と管理は :class:`Popen` クラスによっ" "て扱われます。簡易関数によってカバーされないあまり一般的でないケースを開発者" -"が扱えるように、:class:`Popen` クラスは多くの柔軟性を提供しています。" +"が扱えるように、 ``Popen`` クラスは多くの柔軟性を提供しています。" #: ../../library/subprocess.rst:368 msgid "" -"Execute a child program in a new process. On POSIX, the class uses :meth:" -"`os.execvpe`-like behavior to execute the child program. On Windows, the " -"class uses the Windows ``CreateProcess()`` function. The arguments to :" -"class:`Popen` are as follows." +"Execute a child program in a new process. On POSIX, the class " +"uses :meth:`os.execvpe`-like behavior to execute the child program. On " +"Windows, the class uses the Windows ``CreateProcess()`` function. The " +"arguments to :class:`Popen` are as follows." msgstr "" "新しいプロセスで子のプログラムを実行します。POSIX においては、子のプログラム" "を実行するために、このクラスは :meth:`os.execvpe` のような挙動を使用します。" @@ -582,8 +621,8 @@ msgstr "" #: ../../library/subprocess.rst:373 msgid "" -"*args* should be a sequence of program arguments or else a single string or :" -"term:`path-like object`. By default, the program to execute is the first " +"*args* should be a sequence of program arguments or else a single string " +"or :term:`path-like object`. By default, the program to execute is the first " "item in *args* if *args* is a sequence. If *args* is a string, the " "interpretation is platform-dependent and described below. See the *shell* " "and *executable* arguments for additional differences from the default " @@ -597,7 +636,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 +643,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 +663,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 +693,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 +713,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 +746,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 "" @@ -713,8 +780,8 @@ msgid "" "when typed at the shell prompt. This includes, for example, quoting or " "backslash escaping filenames with spaces in them. If *args* is a sequence, " "the first item specifies the command string, and any additional items will " -"be treated as additional arguments to the shell itself. That is to say, :" -"class:`Popen` does the equivalent of::" +"be treated as additional arguments to the shell itself. That is to " +"say, :class:`Popen` does the equivalent of::" msgstr "" "POSIX で ``shell=True`` の場合、シェルのデフォルトは :file:`/bin/sh` になりま" "す。*args* が文字列の場合、この文字列はシェルを介して実行されるコマンドを指定" @@ -724,9 +791,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 "" @@ -738,9 +804,9 @@ msgid "" msgstr "" "Windows で ``shell=True`` とすると、:envvar:`COMSPEC` 環境変数がデフォルト" "シェルを指定します。Windows で ``shell=True`` を指定する必要があるのは、実行" -"したいコマンドがシェルに組み込みの場合だけです (例えば :command:`dir` や :" -"command:`copy`)。バッチファイルやコンソールベースの実行ファイルを実行するため" -"に ``shell=True`` は必要ありません。" +"したいコマンドがシェルに組み込みの場合だけです (例えば :command:`dir` " +"や :command:`copy`)。バッチファイルやコンソールベースの実行ファイルを実行する" +"ために ``shell=True`` は必要ありません。" #: ../../library/subprocess.rst:467 msgid "" @@ -750,17 +816,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" @@ -768,13 +836,12 @@ msgstr "それ以外の正の整数はバッファーのおよそのサイズに #: ../../library/subprocess.rst:477 msgid "" -"negative bufsize (the default) means the system default of io." -"DEFAULT_BUFFER_SIZE will be used." +"negative bufsize (the default) means the system default of " +"io.DEFAULT_BUFFER_SIZE will be used." 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 +849,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 +886,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 "" @@ -827,10 +901,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special file :data:" -"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " -"which indicates that the stderr data from the applications should be " -"captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special " +"file :data:`os.devnull` will be used. Additionally, *stderr* can " +"be :data:`STDOUT`, which indicates that the stderr data from the " +"applications should be captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:523 @@ -851,36 +925,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." +"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,18 +975,21 @@ 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." +"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 "" "*pass_fds* is an optional sequence of file descriptors to keep open between " -"the parent and child. Providing any *pass_fds* forces *close_fds* to be :" -"const:`True`. (POSIX only)" +"the parent and child. Providing any *pass_fds* forces *close_fds* to " +"be :const:`True`. (POSIX only)" msgstr "" "*pass_fds* はオプションで、親と子の間で開いたままにしておくファイル記述子の" "シーケンスを指定します。何らかの *pass_fds* を渡した場合、*close_fds* は強制" @@ -910,14 +999,19 @@ 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:" -"`path-like ` object. On POSIX, the function looks for " -"*executable* (or for the first item in *args*) relative to *cwd* if the " -"executable path is a relative path." -msgstr "" +"*cwd* before executing the child. *cwd* can be a string, bytes " +"or :term:`path-like ` object. On POSIX, the function " +"looks for *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 +1029,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 +1072,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 +1085,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,26 +1098,34 @@ 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 " "behavior of inheriting the current process' environment. This mapping can be " -"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` のようにバイトからバイトへも、" -"定義すること出来ます。" +"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`` でない場合は、新しいプロセスの環境変数を定義するマッピング" +"を指定します。\n" +"現在のプロセスの環境を継承するデフォルトの動作に代わり、このマッピングが使用" +"されます。\n" +":data:`os.environ` と同様に、どのプラットフォームでも文字列から文字列へのマッ" +"ピングを使用できます。\n" +"POSIX では :data:`os.environb` と同様に、バイト列からバイト列へのマッピングも" +"使用できます。" #: ../../library/subprocess.rst:650 msgid "" @@ -1029,7 +1138,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 +1146,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 +1163,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 +1221,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,58 +1246,71 @@ 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 " +"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 " "using :func:`os.posix_spawn` no longer raise an exception on errors like " -"missing program, but the child process fails with a non-zero :attr:`~Popen." -"returncode`." -msgstr "" +"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 "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " -"prepare for :exc:`OSError` exceptions. Note that, when ``shell=True``, :exc:" -"`OSError` will be raised by the child only if the selected shell itself was " -"not found. To determine if the shell failed to find the requested " -"application, it is necessary to check the return code or output from the " -"subprocess." +"prepare for :exc:`OSError` exceptions. Note that, when " +"``shell=True``, :exc:`OSError` will be raised by the child only if the " +"selected shell itself was not found. To determine if the shell failed to " +"find the requested application, it is necessary to check the return code or " +"output from the subprocess." msgstr "" #: ../../library/subprocess.rst:736 @@ -1191,18 +1322,21 @@ msgstr "" #: ../../library/subprocess.rst:739 msgid "" -":func:`check_call` and :func:`check_output` will raise :exc:" -"`CalledProcessError` if the called process returns a non-zero return code." +":func:`check_call` and :func:`check_output` will " +"raise :exc:`CalledProcessError` if the called process returns a non-zero " +"return code." 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." +"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 +1353,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,17 +1364,35 @@ 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 " "this library. This could result in arguments being parsed according to shell " "rules, but without any escaping added by Python. If you are intentionally " "launching a batch file with arguments from untrusted sources, consider " -"passing ``shell=True`` to allow Python to escape special characters. See :gh:" -"`114539` for additional discussion." -msgstr "" +"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" @@ -1254,47 +1405,47 @@ msgstr "" #: ../../library/subprocess.rst:784 msgid "" -"Check if child process has terminated. Set and return :attr:`~Popen." -"returncode` attribute. Otherwise, returns ``None``." +"Check if child process has terminated. Set and " +"return :attr:`~Popen.returncode` attribute. Otherwise, returns ``None``." msgstr "" "子プロセスが終了しているかどうかを調べます。 :attr:`~Popen.returncode` 属性を" "設定して返します。そうでなければ ``None`` を返します。" #: ../../library/subprocess.rst:790 msgid "" -"Wait for child process to terminate. Set and return :attr:`~Popen." -"returncode` attribute." +"Wait for child process to terminate. Set and " +"return :attr:`~Popen.returncode` attribute." msgstr "" "子プロセスが終了するまで待ちます。:attr:`~Popen.returncode` 属性を設定して返" "します。" #: ../../library/subprocess.rst:793 msgid "" -"If the process does not terminate after *timeout* seconds, raise a :exc:" -"`TimeoutExpired` exception. It is safe to catch this exception and retry " -"the wait." +"If the process does not terminate after *timeout* seconds, raise " +"a :exc:`TimeoutExpired` exception. It is safe to catch this exception and " +"retry the wait." 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 "" "When the ``timeout`` parameter is not ``None``, then (on POSIX) the function " "is implemented using a busy loop (non-blocking call and short sleeps). Use " -"the :mod:`asyncio` module for an asynchronous wait: see :class:`asyncio." -"create_subprocess_exec`." +"the :mod:`asyncio` module for an asynchronous wait: " +"see :class:`asyncio.create_subprocess_exec`." msgstr "" #: ../../library/subprocess.rst:811 ../../library/subprocess.rst:852 @@ -1303,7 +1454,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 +1462,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 "" @@ -1333,9 +1493,9 @@ msgstr "" #: ../../library/subprocess.rst:832 msgid "" -"If the process does not terminate after *timeout* seconds, a :exc:" -"`TimeoutExpired` exception will be raised. Catching this exception and " -"retrying communication will not lose any output." +"If the process does not terminate after *timeout* seconds, " +"a :exc:`TimeoutExpired` exception will be raised. Catching this exception " +"and retrying communication will not lose any output." msgstr "" "プロセスが *timeout* 秒後に終了してない場合、:exc:`TimeoutExpired` 例外が送出" "されます。この例外を捕捉して通信を再試行しても出力データは失われません。" @@ -1350,7 +1510,6 @@ msgstr "" "リーンアップを行うために、正常に動作するアプリケーションは子プロセスを kill " "して通信を終了すべきです::" -#: ../../library/subprocess.rst:840 msgid "" "proc = subprocess.Popen(...)\n" "try:\n" @@ -1359,6 +1518,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 +1537,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 +1550,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 +1568,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 +1583,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 +1590,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 +1605,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,18 +1621,25 @@ 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 "" -"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read ` to avoid deadlocks due to any of the other OS pipe buffers filling " -"up and blocking the child process." +"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write " +"`, :attr:`.stdout.read ` or :attr:`.stderr.read " +"` to avoid deadlocks due to any of the other OS pipe buffers " +"filling up and blocking the child process." msgstr "" -":attr:`.stdin.write `, :attr:`.stdout.read `, :" -"attr:`.stderr.read ` を利用すると、別のパイプの OS パイプバッ" -"ファーがいっぱいになってデッドロックが発生する恐れがあります。これを避けるた" -"めには :meth:`~Popen.communicate` を利用してください。" +":attr:`.stdin.write `, :attr:`.stdout.read " +"`, :attr:`.stderr.read ` を利用すると、別のパイプ" +"の OS パイプバッファーがいっぱいになってデッドロックが発生する恐れがありま" +"す。これを避けるためには :meth:`~Popen.communicate` を利用してください。" #: ../../library/subprocess.rst:930 msgid "The process ID of the child process." @@ -1468,18 +1653,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 +1681,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 +1704,45 @@ msgstr "" "特定の :class:`STARTUPINFO` の属性が、プロセスがウィンドウを生成するときに使" "われるかを決定するビットフィールドです::" -#: ../../library/subprocess.rst:971 msgid "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." -"STARTF_USESHOWWINDOW" +"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 " @@ -1558,59 +1751,69 @@ msgid "" "Otherwise, this attribute is ignored." msgstr "" ":attr:`dwFlags` が :data:`STARTF_USESHOWWINDOW` を指定すれば、この属性は " -"`ShowWindow `__ 関数の ``nCmdShow`` 引数で指定された値なら、 ``SW_SHOWDEFAULT`` 以外" -"の任意のものにできます。しかし、この属性は無視されます。" +"`ShowWindow `__ 関数の ``nCmdShow`` 引数で指定された値なら、 " +"``SW_SHOWDEFAULT`` 以外の任意のものにできます。\n" +"それ以外の場合、この属性は無視されます。" #: ../../library/subprocess.rst:1003 msgid "" -":data:`SW_HIDE` is provided for this attribute. It is used when :class:" -"`Popen` is called with ``shell=True``." +":data:`SW_HIDE` is provided for this attribute. It is used " +"when :class:`Popen` is called with ``shell=True``." 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 `__." +"``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 " +"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 " -"other process creation functions that inherit all handles such as :func:`os." -"system`. This also applies to standard handle redirection, which " -"temporarily creates inheritable handles." +"other process creation functions that inherit all handles such " +"as :func:`os.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." @@ -1646,12 +1849,13 @@ msgstr "ウィンドウを隠します。別のウィンドウがアクティブ #: ../../library/subprocess.rst:1060 msgid "" -"Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." -"hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " -"information." +"Specifies that " +"the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO.hStdOutput`, " +"and :attr:`STARTUPINFO.hStdError` attributes contain additional information." msgstr "" -"追加情報を保持する、:attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." -"hStdOutput`, および :attr:`STARTUPINFO.hStdError` 属性を指定します。" +"追加情報を保持す" +"る、:attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO.hStdOutput`, およ" +"び :attr:`STARTUPINFO.hStdError` 属性を指定します。" #: ../../library/subprocess.rst:1066 msgid "" @@ -1660,18 +1864,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 "" @@ -1688,45 +1895,49 @@ msgid "" "the subprocess." msgstr "" "新しいプロセスグループが生成されることを指定する :class:`Popen` " -"``creationflags`` パラメーターです。このフラグは、サブプロセスで :func:`os." -"kill` を使うのに必要です。" +"``creationflags`` パラメーターです。このフラグは、サブプロセス" +"で :func:`os.kill` を使うのに必要です。" #: ../../library/subprocess.rst:1096 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 +1946,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" @@ -1782,21 +2008,21 @@ msgid "" "Run the command described by *args*. Wait for command to complete, then " "return the :attr:`~Popen.returncode` attribute." msgstr "" -"*args* で指定されたコマンドを実行します。コマンドの終了を待ち、:attr:`~Popen." -"returncode` 属性を返します。" +"*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 "" @@ -1805,9 +2031,9 @@ msgid "" "function passes all supplied arguments other than *timeout* directly through " "to that interface." msgstr "" -"上記の引数は、よく使われるものだけ示しています。関数の全使用法は :class:" -"`Popen` コンストラクターの内容と同じになります - この関数は、このインター" -"フェースに直接指定される *timeout* 以外は与えられた全引数を渡します。" +"上記の引数は、よく使われるものだけ示しています。関数の全使用法" +"は :class:`Popen` コンストラクターの内容と同じになります - この関数は、この" +"インターフェースに直接指定される *timeout* 以外は与えられた全引数を渡します。" #: ../../library/subprocess.rst:1204 ../../library/subprocess.rst:1244 msgid "" @@ -1820,18 +2046,24 @@ 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 :" -"exc:`CalledProcessError` object will have the return code in the :attr:" -"`~CalledProcessError.returncode` attribute. If :func:`check_call` was unable " -"to start the process it will propagate the exception that was raised." -msgstr "" +"code was zero then return, otherwise raise :exc:`CalledProcessError`. " +"The :exc:`CalledProcessError` object will have the return code in " +"the :attr:`~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." @@ -1839,33 +2071,37 @@ msgstr "引数でコマンドを実行し、その出力を返します。" #: ../../library/subprocess.rst:1268 msgid "" -"If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" -"exc:`CalledProcessError` object will have the return code in the :attr:" -"`~CalledProcessError.returncode` attribute and any output in the :attr:" -"`~CalledProcessError.output` attribute." +"If the return code was non-zero it raises a :exc:`CalledProcessError`. " +"The :exc:`CalledProcessError` object will have the return code in " +"the :attr:`~CalledProcessError.returncode` attribute and any output in " +"the :attr:`~CalledProcessError.output` attribute." msgstr "" "コマンドのリターンコードが非ゼロならば :exc:`CalledProcessError` 例外が送出さ" -"れます。:exc:`CalledProcessError` オブジェクトには、リターンコードが :attr:" -"`~CalledProcessError.returncode` 属性に、コマンドからの出力が :attr:" -"`~CalledProcessError.output` 属性に、それぞれ格納されています。" +"れます。:exc:`CalledProcessError` オブジェクトには、リターンコード" +"が :attr:`~CalledProcessError.returncode` 属性に、コマンドからの出力" +"が :attr:`~CalledProcessError.output` 属性に、それぞれ格納されています。" #: ../../library/subprocess.rst:1273 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 " -"passed directly through to that interface. One API deviation from :func:" -"`run` behavior exists: passing ``input=None`` will behave the same as " -"``input=b''`` (or ``input=''``, depending on other arguments) rather than " -"using the parent's standard input file handle." -msgstr "" +"passed directly through to that interface. One API deviation " +"from :func:`run` behavior exists: passing ``input=None`` will behave the " +"same as ``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 "" @@ -1886,8 +2122,8 @@ msgstr "" #: ../../library/subprocess.rst:1292 msgid "" -"To also capture standard error in the result, use ``stderr=subprocess." -"STDOUT``::" +"To also capture standard error in the result, use " +"``stderr=subprocess.STDOUT``::" msgstr "" "標準エラー出力も結果に含めるには、``stderr=subprocess.STDOUT`` を使います::" @@ -1904,9 +2140,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" @@ -1923,8 +2160,8 @@ msgstr "" #: ../../library/subprocess.rst:1333 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " -"executed program cannot be found; the \"b\" replacements raise :exc:" -"`OSError` instead." +"executed program cannot be found; the \"b\" replacements " +"raise :exc:`OSError` instead." msgstr "" "この節で紹介されている \"a\" 関数は全て、実行するプログラムが見つからないとき" "は (おおむね) 静かに終了します。それに対して \"b\" 代替手段は :exc:`OSError` " @@ -1932,10 +2169,10 @@ msgstr "" #: ../../library/subprocess.rst:1337 msgid "" -"In addition, the replacements using :func:`check_output` will fail with a :" -"exc:`CalledProcessError` if the requested operation produces a non-zero " -"return code. The output is still available as the :attr:`~CalledProcessError." -"output` attribute of the raised exception." +"In addition, the replacements using :func:`check_output` will fail with " +"a :exc:`CalledProcessError` if the requested operation produces a non-zero " +"return code. The output is still available as " +"the :attr:`~CalledProcessError.output` attribute of the raised exception." msgstr "" "また、要求された操作が非ゼロの終了コードを返した場合、:func:`check_output` を" "使用した置き換えは :exc:`CalledProcessError` で失敗します。その出力は、送出さ" @@ -1949,46 +2186,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 +2235,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,35 +2259,44 @@ 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`." +"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 "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " -"command is running, but the caller must do this separately when using the :" -"mod:`subprocess` module." +"command is running, but the caller must do this separately when using " +"the :mod:`subprocess` module." msgstr "" #: ../../library/subprocess.rst:1405 msgid "A more realistic example would look like this::" msgstr "より現実的な例ではこうなるでしょう::" -#: ../../library/subprocess.rst:1407 msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, file=sys." -"stderr)\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)" 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 +2306,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 +2352,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 +2402,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 +2420,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`." +"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 +2454,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 +2469,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:" +"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 +2565,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 +2575,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..1f6deaf7c 100644 --- a/library/sunau.po +++ b/library/sunau.po @@ -12,25 +12,28 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..7a023a078 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,12 +42,18 @@ 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 "" "Alternatively, modules may appear in this chapter because they are " -"deprecated outright, and awaiting removal in a future release, or they are :" -"term:`soft deprecated` and their use is actively discouraged in new " +"deprecated outright, and awaiting removal in a future release, or they " +"are :term:`soft deprecated` and their use is actively discouraged in new " "projects. With the removal of various obsolete modules through :pep:`594`, " "there are currently no modules in this latter category." msgstr "" diff --git a/library/symtable.po b/library/symtable.po index 789ee6037..72b9e634d 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 @@ -41,8 +41,8 @@ msgid "" "examine these tables." msgstr "" "記号表(symbol table)は、コンパイラが AST からバイトコードを生成する直前に作ら" -"れます。記号表はコード中の全ての識別子のスコープの算出に責任を持ちます。 :" -"mod:`symtable` はこうした記号表を調べるインターフェイスを提供します。" +"れます。記号表はコード中の全ての識別子のスコープの算出に責任を持ちま" +"す。 :mod:`symtable` はこうした記号表を調べるインターフェイスを提供します。" #: ../../library/symtable.rst:22 msgid "Generating Symbol Tables" @@ -55,100 +55,108 @@ msgid "" "like the *mode* argument to :func:`compile`." msgstr "" "Python ソース *code* に対するトップレベルの :class:`SymbolTable` を返しま" -"す。 *filename* はコードを収めてあるファイルの名前です。 *compile_type* は :" -"func:`compile` の *mode* 引数のようなものです。" +"す。 *filename* はコードを収めてあるファイルの名前です。 *compile_type* " +"は :func:`compile` の *mode* 引数のようなものです。" #: ../../library/symtable.rst:32 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." +"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 " "``'top'`` if the table is global (:meth:`get_type` returns ``'module'``). " "For type parameter scopes (which are used for generic classes, functions, " "and type aliases), it is the name of the underlying class, function, or type " -"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 "" +"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 `." +"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`." +"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..0be09dfe6 100644 --- a/library/sys.po +++ b/library/sys.po @@ -23,31 +23,34 @@ 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 "" "On POSIX systems where Python was built with the standard ``configure`` " "script, this contains the ABI flags as specified by :pep:`3149`." msgstr "" -"Python が標準的な ``configure`` でビルトされた POSIX システムにおいて、:pep:" -"`3149` に記述された ABI フラグを含みます。" +"Python が標準的な ``configure`` でビルトされた POSIX システムにおい" +"て、:pep:`3149` に記述された ABI フラグを含みます。" #: ../../library/sys.rst:21 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 " @@ -92,11 +93,19 @@ msgid "" "particular, malicious code can trivially disable or bypass hooks added using " "this function. At a minimum, any security-sensitive hooks must be added " "using the C API :c:func:`PySys_AddAuditHook` before initialising the " -"runtime, and any modules allowing arbitrary memory modification (such as :" -"mod:`ctypes`) should be completely removed or closely monitored." +"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 "" @@ -162,10 +180,9 @@ msgstr "" "Unix では、コマンドライン引数は OS からバイト列で渡されます。\n" "Python はそれをファイルシステムエンコーディングと \"surrogateescape\" エラー" "ハンドラを使ってデコードします。\n" -"オリジナルのバイト列が必要なときには、 ``[os.fsencode(arg) for arg in sys." -"argv]`` で取得できます。" +"オリジナルのバイト列が必要なときには、 ``[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,46 +212,60 @@ 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." +"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:" -"`base_exec_prefix`, conversely, does not change, and always points to the " -"base Python installation. Refer to :ref:`sys-path-init-virtual-environments` " -"for more information." +"When running under :ref:`sys-path-init-virtual-" +"environments`, :data:`exec_prefix` gets overwritten to the virtual " +"environment prefix. :data:`base_exec_prefix`, conversely, does not change, " +"and always points to the 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 "" @@ -254,26 +296,31 @@ msgid "" "other way --- ``modules.keys()`` only lists the imported modules.)" msgstr "" "コンパイル時にPythonインタプリタに組み込まれた、全てのモジュール名を含む文字" -"列のタプル(この情報は、他の手段では取得することができません。 ``modules." -"keys()`` は、インポートされたモジュールのみのリストを返します。)" +"列のタプル(この情報は、他の手段では取得することができません。 " +"``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." +"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 +342,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 "" @@ -313,9 +362,9 @@ msgid "" "given such a frame." msgstr "" "各スレッドの識別子を関数が呼ばれた時点のそのスレッドでアクティブになっている" -"一番上のスタックフレームに結びつける辞書を返します。モジュール :mod:" -"`traceback` の関数を使えばそのように与えられたフレームのコールスタックを構築" -"できます。" +"一番上のスタックフレームに結びつける辞書を返します。モジュー" +"ル :mod:`traceback` の関数を使えばそのように与えられたフレームのコールスタッ" +"クを構築できます。" #: ../../library/sys.rst:216 msgid "" @@ -331,39 +380,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 "" @@ -395,23 +444,24 @@ msgstr "" #: ../../library/sys.rst:256 msgid "" -"The default implementation first consults the environment variable :envvar:" -"`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this function returns " -"immediately; i.e. it is a no-op. If the environment variable is not set, or " -"is set to the empty string, ``pdb.set_trace()`` is called. Otherwise this " -"variable should name a function to run, using Python's dotted-import " -"nomenclature, e.g. ``package.subpackage.module.function``. In this case, " +"The default implementation first consults the environment " +"variable :envvar:`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this " +"function returns immediately; i.e. it is a no-op. If the environment " +"variable is not set, or is set to the empty string, ``pdb.set_trace()`` is " +"called. Otherwise this variable should name a function to run, using " +"Python's dotted-import nomenclature, e.g. " +"``package.subpackage.module.function``. In this case, " "``package.subpackage.module`` would be imported and the resulting module " "must have a callable named ``function()``. This is run, passing in " -"``*args`` and ``**kws``, and whatever ``function()`` returns, ``sys." -"breakpointhook()`` returns to the built-in :func:`breakpoint` function." +"``*args`` and ``**kws``, and whatever ``function()`` returns, " +"``sys.breakpointhook()`` returns to the built-in :func:`breakpoint` function." msgstr "" "デフォルトの実装では、最初に環境変数 :envvar:`PYTHONBREAKPOINT` を調べま" "す。\n" "それが ``\"0\"`` に設定されていた場合は、この関数はすぐに終了します。つまり何" "もしません。\n" -"この環境変数が設定されていないか、空文字列に設定されていた場合は、 ``pdb." -"set_trace()`` が呼ばれます。\n" +"この環境変数が設定されていないか、空文字列に設定されていた場合は、 " +"``pdb.set_trace()`` が呼ばれます。\n" "それ以外の場合は、この変数は実行する関数の名前である必要があります。関数名の" "指定では、例えば ``package.subpackage.module.function`` のようなドットでつな" "がれた Python のインポートの命名体系を使ったを使います。\n" @@ -424,8 +474,8 @@ msgstr "" #: ../../library/sys.rst:268 msgid "" -"Note that if anything goes wrong while importing the callable named by :" -"envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " +"Note that if anything goes wrong while importing the callable named " +"by :envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " "breakpoint is ignored." msgstr "" ":envvar:`PYTHONBREAKPOINT` で指名された呼び出し可能オブジェクトのインポートで" @@ -434,11 +484,11 @@ msgstr "" #: ../../library/sys.rst:272 msgid "" -"Also note that if ``sys.breakpointhook()`` is overridden programmatically, :" -"envvar:`PYTHONBREAKPOINT` is *not* consulted." +"Also note that if ``sys.breakpointhook()`` is overridden " +"programmatically, :envvar:`PYTHONBREAKPOINT` is *not* consulted." msgstr "" -"また、 ``sys.breakpointhook()`` がプログラム上で上書きされていた場合は :" -"envvar:`PYTHONBREAKPOINT` は *調べられない* ことにも注意してください。" +"また、 ``sys.breakpointhook()`` がプログラム上で上書きされていた場合" +"は :envvar:`PYTHONBREAKPOINT` は *調べられない* ことにも注意してください。" #: ../../library/sys.rst:279 msgid "" @@ -448,12 +498,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,26 +519,26 @@ 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 " -"encodable to ``sys.stdout.encoding`` with ``sys.stdout.errors`` error " -"handler (which is probably ``'strict'``), encode it to ``sys.stdout." -"encoding`` with ``'backslashreplace'`` error handler." +"If *value* is not ``None``, this function prints ``repr(value)`` to " +"``sys.stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is " +"not encodable to ``sys.stdout.encoding`` with ``sys.stdout.errors`` error " +"handler (which is probably ``'strict'``), encode it to " +"``sys.stdout.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 "" -"``sys.displayhook`` is called on the result of evaluating an :term:" -"`expression` entered in an interactive Python session. The display of these " -"values can be customized by assigning another one-argument function to ``sys." -"displayhook``." +"``sys.displayhook`` is called on the result of evaluating " +"an :term:`expression` entered in an interactive Python session. The display " +"of these values can be customized by assigning another one-argument function " +"to ``sys.displayhook``." msgstr "" "``sys.displayhook`` は、Pythonの対話セッションで入力された :term:`式 " "` が評価されたときに呼び出されます。対話セッションの出力をカスタ" @@ -496,7 +548,6 @@ msgstr "" msgid "Pseudo-code::" msgstr "擬似コード::" -#: ../../library/sys.rst:315 msgid "" "def displayhook(value):\n" " if value is None:\n" @@ -516,55 +567,76 @@ 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 "" "If this is true, Python won't try to write ``.pyc`` files on the import of " "source modules. This value is initially set to ``True`` or ``False`` " -"depending on the :option:`-B` command line option and the :envvar:" -"`PYTHONDONTWRITEBYTECODE` environment variable, but you can set it yourself " -"to control bytecode file generation." +"depending on the :option:`-B` command line option and " +"the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable, but you can set " +"it yourself to control bytecode file generation." msgstr "" "この値が真の時、Python はソースモジュールをインポートする時に ``.pyc`` ファイ" -"ルを生成しません。この値は :option:`-B` コマンドラインオプションと :envvar:" -"`PYTHONDONTWRITEBYTECODE` 環境変数の値によって、起動時に ``True`` か " -"``False`` に設定されますが、実行時にこの変数を変更してバイトコード生成を制御" -"することもできます。" +"ルを生成しません。この値は :option:`-B` コマンドラインオプション" +"と :envvar:`PYTHONDONTWRITEBYTECODE` 環境変数の値によって、起動時に ``True`` " +"か ``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 +646,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``." +"``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,23 +684,38 @@ 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 " "hook has been set, ``hook`` may be ``None``. If any hook raises an exception " "derived from :class:`RuntimeError` the call to the hook will be suppressed. " -"Otherwise, the audit hook exception will be reported as unraisable and ``sys." -"excepthook`` will be called." +"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`." +"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,42 +739,54 @@ 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 " -"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, e." -"__traceback__)``. That is, a tuple containing the type of the exception (a " -"subclass of :exc:`BaseException`), the exception itself, and a :ref:" -"`traceback object ` which typically encapsulates the call " -"stack at the point where the exception last occurred." -msgstr "" +"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, " +"e.__traceback__)``. That is, a tuple containing the type of the exception (a " +"subclass of :exc:`BaseException`), the exception itself, and " +"a :ref:`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`." +"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 "" @@ -686,28 +794,32 @@ msgid "" "dependent Python files are installed; by default, this is also ``'/usr/" "local'``. This can be set at build time with the ``--exec-prefix`` argument " "to the :program:`configure` script. Specifically, all configuration files " -"(e.g. the :file:`pyconfig.h` header file) are installed in the directory :" -"file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library modules are " -"installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y* " -"is the version number of Python, for example ``3.2``." +"(e.g. the :file:`pyconfig.h` header file) are installed in the " +"directory :file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library " +"modules are installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, " +"where *X.Y* is the version number of Python, for example ``3.2``." msgstr "" "Python のプラットフォーム依存なファイルがインストールされているディレクトリ名" "を示す文字列です。この値はサイト固有であり、デフォルトは ``'/usr/local'`` で" "すが、ビルド時に :program:`configure` の ``--exec-prefix`` 引数で指定すること" -"ができます。すべての設定ファイル (:file:`pyconfig.h` など) は :file:" -"`{exec_prefix}/lib/python{X.Y}/config` に、共有ライブラリは :file:" -"`{exec_prefix}/lib/python{X.Y}/lib-dynload` にインストールされます (*X.Y* は " -"``3.2`` のような Python のバージョン番号)。" +"ができます。すべての設定ファイル (:file:`pyconfig.h` など) " +"は :file:`{exec_prefix}/lib/python{X.Y}/config` に、共有ライブラリ" +"は :file:`{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." +"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 +827,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 +845,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 +887,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." +"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 +954,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`" +":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`" +":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 +1017,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 +1054,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,153 +1069,133 @@ 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 "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " -"``s`` is any string representing a decimal number with at most :attr:`!sys." -"float_info.dig` significant digits, then converting ``s`` to a float and " +"``s`` is any string representing a decimal number with at most :attr:`!" +"sys.float_info.dig` significant digits, then converting ``s`` to a float and " "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 +1204,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 +1219,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,54 +1244,72 @@ 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 " "debugging memory leaks. Because of the interpreter's internal caches, the " -"result can vary from call to call; you may have to call :func:" -"`_clear_internal_caches` and :func:`gc.collect` to get more predictable " -"results." +"result can vary from call to call; you may have to " +"call :func:`_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 ` to convert between Unicode filenames and bytes " -"filenames. The filesystem error handler is returned from :func:" -"`getfilesystemencodeerrors`." -msgstr "" +"filenames. The filesystem error handler is returned " +"from :func:`getfilesystemencodeerrors`." +msgstr "" +":term:`ファイルシステムエンコーディング ` を取得します。\n" +"これは、Unicode のファイル名とバイト列のファイル名を相互に変換するため" +"に、:term:`ファイルシステムエラーハンドラ ` とともに使うエンコーディングです。\n" +"ファイルシステムエラーハンドラは :func:`getfilesystemencodeerrors` が返しま" +"す。" #: ../../library/sys.rst:818 msgid "" @@ -1215,10 +1334,15 @@ msgstr "" #: ../../library/sys.rst:826 ../../library/sys.rst:854 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.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." @@ -1227,8 +1351,8 @@ msgstr "" #: ../../library/sys.rst:834 msgid "" -"Windows is no longer guaranteed to return ``'mbcs'``. See :pep:`529` and :" -"func:`_enablelegacywindowsfsencoding` for more information." +"Windows is no longer guaranteed to return ``'mbcs'``. See :pep:`529` " +"and :func:`_enablelegacywindowsfsencoding` for more information." msgstr "" "Windows はもう ``'mbcs'`` を返す保証は無くなりました。\n" "より詳しいことは :pep:`529` および :func:`_enablelegacywindowsfsencoding` を" @@ -1240,20 +1364,26 @@ 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 " "` to convert between Unicode " -"filenames and bytes filenames. The filesystem encoding is returned from :" -"func:`getfilesystemencoding`." +"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 "" @@ -1267,39 +1397,40 @@ msgstr "" #: ../../library/sys.rst:874 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are :term:" -"`immortal` and have a very high refcount that does not reflect the actual " -"number of references. Consequently, do not rely on the returned value to be " -"accurate, other than a value of 0 or 1." +"the object are actually held. For example, some objects " +"are :term:`immortal` and have a very high refcount that does not reflect the " +"actual number of references. Consequently, do not rely on the returned " +"value to be accurate, other than a value of 0 or 1." msgstr "" "戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映しているとは" -"限らないことに注意してください。例えば、一部のオブジェクトは永続 (:term:" -"`immortal`) であり、実際の参照の数を反映しない非常に高い参照数を持ちます。し" -"たがって、 0 か 1 の値以外では、正確な戻り値に頼らないでください。" +"限らないことに注意してください。例えば、一部のオブジェクトは永続 " +"(:term:`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 "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " -"causing an overflow of the C stack and crashing Python. It can be set by :" -"func:`setrecursionlimit`." +"causing an overflow of the C stack and crashing Python. It can be set " +"by :func:`setrecursionlimit`." msgstr "" "現在の最大再帰数を返します。最大再帰数は、Python インタプリタスタックの最大の" "深さです。この制限は Python プログラムが無限に再帰し、C スタックがオーバーフ" -"ローしてクラッシュすることを防止するために設けられています。この値は :func:" -"`setrecursionlimit` で指定することができます。" +"ローしてクラッシュすることを防止するために設けられています。この値" +"は :func:`setrecursionlimit` で指定することができます。" #: ../../library/sys.rst:899 msgid "" @@ -1327,29 +1458,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`." +"Return the interpreter's \"thread switch interval\" in seconds; " +"see :func:`setswitchinterval`." msgstr "" +"インタープリタの「スレッド切り替え間隔」を秒単位で返します。\n" +":func:`setswitchinterval` を参照してください。" #: ../../library/sys.rst:928 msgid "" @@ -1365,13 +1499,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 +1514,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,45 +1521,65 @@ 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 " -"state (that is, ones created with :c:member:`PyInterpreterConfig." -"use_main_obmalloc` set to 1 or using :c:func:`Py_NewInterpreter`, and the :" -"ref:`main interpreter `). Mixing objects from " -"different interpreters may lead to crashes or other unexpected behavior." -msgstr "" +"state (that is, ones created " +"with :c:member:`PyInterpreterConfig.use_main_obmalloc` set to 1 or " +"using :c:func:`Py_NewInterpreter`, and the :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`." @@ -1456,9 +1608,9 @@ msgid "" "*service_pack_minor*, *service_pack_major*, *suite_mask*, *product_type* and " "*platform_version*. *service_pack* contains a string, *platform_version* a 3-" "tuple and all other values are integers. The components can also be accessed " -"by name, so ``sys.getwindowsversion()[0]`` is equivalent to ``sys." -"getwindowsversion().major``. For compatibility with prior versions, only the " -"first 5 elements are retrievable by indexing." +"by name, so ``sys.getwindowsversion()[0]`` is equivalent to " +"``sys.getwindowsversion().major``. For compatibility with prior versions, " +"only the first 5 elements are retrievable by indexing." msgstr "" "実行中の Windows バージョンを示す、名前付きタプルを返します。\n" "名前の付いている要素は、 *major*, *minor*, *build*, *platform*, " @@ -1471,9 +1623,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 +1638,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 +1680,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,42 +1701,45 @@ 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 " -"*firstiter* and *finalizer* are expected to be either ``None`` or functions " -"which take an :term:`asynchronous generator iterator` as an argument, and " -"are used to schedule finalization of an asynchronous generator by an event " -"loop." +"Returns an *asyncgen_hooks* object, which is similar to " +"a :class:`~collections.namedtuple` of the form ``(firstiter, finalizer)``, " +"where *firstiter* and *finalizer* are expected to be either ``None`` or " +"functions which take an :term:`asynchronous generator iterator` as an " +"argument, and 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`." +"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 +1749,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 +1796,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`." @@ -1709,8 +1861,8 @@ msgstr "" #: ../../library/sys.rst:1178 msgid "" -"*hexversion* is the implementation version in hexadecimal format, like :data:" -"`sys.hexversion`." +"*hexversion* is the implementation version in hexadecimal format, " +"like :data:`sys.hexversion`." msgstr "" "*hexversion* は :data:`sys.hexversion` と同形式の、16 進数での実装のバージョ" "ンです。" @@ -1733,10 +1885,10 @@ msgstr "" msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " -"underscore, and are not described here. Regardless of its contents, :data:" -"`sys.implementation` will not change during a run of the interpreter, nor " -"between implementation versions. (It may change between Python language " -"versions, however.) See :pep:`421` for more information." +"underscore, and are not described here. Regardless of its " +"contents, :data:`sys.implementation` will not change during a run of the " +"interpreter, nor between implementation versions. (It may change between " +"Python language versions, however.) See :pep:`421` for more information." msgstr "" ":data:`sys.implementation` には Python 実装固有の属性を追加することができま" "す。それら非標準属性の名前はアンダースコアから始めなくてはならず、そしてここ" @@ -1745,11 +1897,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 +1912,38 @@ 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>`." +"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`." +"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 "" @@ -1796,18 +1954,18 @@ msgid "" "`." msgstr "" "この属性が存在する場合、インタープリタが :ref:`対話モード ` " -"で起動したときに値は (引数なしで) 自動的に呼ばれます。これは :envvar:" -"`PYTHONSTARTUP` ファイルの読み込み後に行われるため、それにこのフックを設定す" -"ることが出来ます。:mod:`site` モジュールで :ref:`設定します `。" +"で起動したときに値は (引数なしで) 自動的に呼ばれます。これ" +"は :envvar:`PYTHONSTARTUP` ファイルの読み込み後に行われるため、それにこのフッ" +"クを設定することが出来ます。: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 +1976,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,75 +1990,89 @@ 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 " +"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 " -"compilation is available, this can be controlled by setting the :envvar:" -"`PYTHON_JIT` environment variable to ``0`` (disabled) or ``1`` (enabled) at " -"interpreter startup." +"compilation is available, this can be controlled by setting " +"the :envvar:`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 +2086,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 +2107,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." +"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,53 +2176,67 @@ 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 " -"can find the module to be imported. By default, it holds entries that " -"implement Python's default import semantics. The :meth:`~importlib.abc." -"MetaPathFinder.find_spec` method is called with at least the absolute name " -"of the module being imported. If the module to be imported is contained in a " -"package, then the parent package's :attr:`~module.__path__` attribute is " -"passed in as a second argument. The method returns a :term:`module spec`, or " -"``None`` if the module cannot be found." -msgstr "" +"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 can find the module to be imported. By default, it " +"holds entries that implement Python's default import semantics. " +"The :meth:`~importlib.abc.MetaPathFinder.find_spec` method is called with at " +"least the absolute name of the module being imported. If the module to be " +"imported is contained in a package, then the parent " +"package's :attr:`~module.__path__` attribute is 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`." +"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`." +":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." +"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 +2247,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 +2281,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 "" @@ -2097,23 +2325,23 @@ msgid "" "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -"プログラムはその目的のために、このリストを自由に修正できます。文字列だけが :" -"data:`sys.path` に追加でき、 ほかの全てのデータ型はインポート中に無視されま" -"す。" +"プログラムはその目的のために、このリストを自由に修正できます。文字列だけ" +"が :data:`sys.path` に追加でき、 ほかの全てのデータ型はインポート中に無視され" +"ます。" #: ../../library/sys.rst:1498 msgid "" -"Module :mod:`site` This describes how to use .pth files to extend :data:`sys." -"path`." +"Module :mod:`site` This describes how to use .pth files to " +"extend :data:`sys.path`." msgstr "" -":mod:`site` モジュールのドキュメントで、 .pth ファイルを使って :data:`sys." -"path` を拡張する方法を解説しています。" +":mod:`site` モジュールのドキュメントで、 .pth ファイルを使っ" +"て :data:`sys.path` を拡張する方法を解説しています。" #: ../../library/sys.rst:1503 msgid "" -"A list of callables that take a path argument to try to create a :term:" -"`finder` for the path. If a finder can be created, it is to be returned by " -"the callable, else raise :exc:`ImportError`." +"A list of callables that take a path argument to try to create " +"a :term:`finder` for the path. If a finder can be created, it is to be " +"returned by the callable, else raise :exc:`ImportError`." msgstr "" "path を引数にとって、その path に対する :term:`finder` の作成を試みる呼び出し" "可能オブジェクトのリスト。 finder の作成に成功したら、その呼出可能オブジェク" @@ -2131,14 +2359,15 @@ msgid "" "finders that are found. If a path is a valid file system path but no finder " "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -":term:`finder` オブジェクトのキャッシュ機能を果たす辞書です。キーは :data:" -"`sys.path_hooks` に渡されているパスで、値は見つかった finder になります。パス" -"が正常なファイルシステムパスであり、finder が :data:`sys.path_hooks` 上に見つ" -"からない場合は ``None`` が格納されます。" +":term:`finder` オブジェクトのキャッシュ機能を果たす辞書です。キー" +"は :data:`sys.path_hooks` に渡されているパスで、値は見つかった finder になり" +"ます。パスが正常なファイルシステムパスであり、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 +2385,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 +2442,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 +2455,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 +2513,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):" +"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" +"``/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 +2567,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 "" @@ -2358,18 +2608,19 @@ msgid "" "enable a lazy resolving of symbols when importing a module, if called as " "``sys.setdlopenflags(0)``. To share symbols across extension modules, call " "as ``sys.setdlopenflags(os.RTLD_GLOBAL)``. Symbolic names for the flag " -"values can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e." -"g. :const:`os.RTLD_LAZY`)." +"values can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, " +"e.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`." +"` 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 +2634,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`." +"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 +2726,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 +2753,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." +"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,14 +2784,19 @@ 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 " "debugger to support multiple threads, it must register a trace function " -"using :func:`settrace` for each thread being debugged or use :func:" -"`threading.settrace`." +"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 +2821,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,15 +2895,21 @@ 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 " "value specifies the new local trace function. Per-opcode events are not " -"emitted by default: they must be explicitly requested by setting :attr:" -"`~frame.f_trace_opcodes` to :const:`True` on the :ref:`frame `." -msgstr "" +"emitted by default: they must be explicitly requested by " +"setting :attr:`~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,31 +2919,39 @@ 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 " "it being set indirectly via the return value from an already installed trace " "function. This is also required for activating the trace function on the " "current frame, which :func:`settrace` doesn't do. Note that in order for " -"this to work, a global tracing function must have been installed with :func:" -"`settrace` in order to enable the runtime tracing machinery, but it doesn't " -"need to be the same tracing function (e.g. it could be a low overhead " -"tracing function that simply returns ``None`` to disable itself immediately " -"on each frame)." -msgstr "" +"this to work, a global tracing function must have been installed " +"with :func:`settrace` in order to enable the runtime tracing machinery, but " +"it doesn't need to be the same tracing function (e.g. it could be a low " +"overhead 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,51 +2964,55 @@ 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" +"``'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* " +"Accepts two optional keyword arguments which are callables that accept " +"an :term:`asynchronous generator iterator` as an argument. The *firstiter* " "callable will be called when an asynchronous generator is iterated for the " "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." +"Raises an :ref:`auditing event ` " +"``sys.set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``sys." -"set_asyncgen_hooks_firstiter`` を送出します。 " +"引数無しで :ref:`監査イベント ` " +"``sys.set_asyncgen_hooks_firstiter`` を送出します。" -#: ../../library/sys.rst:1848 msgid "" -"Raises an :ref:`auditing event ` ``sys." -"set_asyncgen_hooks_finalizer`` with no arguments." +"Raises an :ref:`auditing event ` " +"``sys.set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``sys." -"set_asyncgen_hooks_finalizer`` を送出します。 " +"引数無しで :ref:`監査イベント ` " +"``sys.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 "" "See :pep:`525` for more details, and for a reference example of a " -"*finalizer* method see the implementation of ``asyncio.Loop." -"shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" +"*finalizer* method see the implementation of " +"``asyncio.Loop.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 +3020,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,60 +3078,75 @@ 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`." +"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 "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -"インタプリタが使用する、それぞれ標準入力、標準出力、および標準エラー出力の :" -"term:`ファイルオブジェクト ` です:" +"インタプリタが使用する、それぞれ標準入力、標準出力、および標準エラー出力" +"の :term:`ファイルオブジェクト ` です:" #: ../../library/sys.rst:1972 msgid "" -"``stdin`` is used for all interactive input (including calls to :func:" -"`input`);" +"``stdin`` is used for all interactive input (including calls " +"to :func:`input`);" msgstr "" "``stdin`` は (:func:`input` の呼び出しも含む) すべての対話型入力に使われま" "す。" @@ -2846,8 +3156,8 @@ msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -"``stdout`` は :func:`print` および :term:`expression` 文の出力と、:func:" -"`input` のプロンプトに使用されます。" +"``stdout`` は :func:`print` および :term:`expression` 文の出力" +"と、:func:`input` のプロンプトに使用されます。" #: ../../library/sys.rst:1976 msgid "The interpreter's own prompts and its error messages go to ``stderr``." @@ -2865,8 +3175,9 @@ msgstr "" #: ../../library/sys.rst:1982 msgid "" -"The encoding and error handling are is initialized from :c:member:`PyConfig." -"stdio_encoding` and :c:member:`PyConfig.stdio_errors`." +"The encoding and error handling are is initialized " +"from :c:member:`PyConfig.stdio_encoding` " +"and :c:member:`PyConfig.stdio_errors`." msgstr "" #: ../../library/sys.rst:1985 @@ -2880,35 +3191,51 @@ 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 " -"using the new :option:`-X` ``utf8`` command line option and :envvar:" -"`PYTHONUTF8` environment variable. However, for the Windows console, this " -"only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." +"Under all platforms, you can override the character encoding by setting " +"the :envvar:`PYTHONIOENCODING` environment variable before starting Python " +"or by using the new :option:`-X` ``utf8`` command line option " +"and :envvar:`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-" "buffered in both cases. You can make both streams unbuffered by passing " -"the :option:`-u` command-line option or setting the :envvar:" -"`PYTHONUNBUFFERED` environment variable." +"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 "" @@ -2916,18 +3243,20 @@ msgid "" "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "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')`` を使用してください。" +"標準ストリームにバイナリーデータの読み書きを行うには下位のバイナ" +"リー :data:`~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 +3281,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 +3289,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 +3362,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,79 +3381,91 @@ 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 "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " -"``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" -"attr:`!err_msg` is ``None``." +"``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message " +"if :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 "" @@ -3134,8 +3477,8 @@ msgid "" msgstr "" "Python インタプリタのバージョン番号の他、ビルド番号や使用コンパイラなどの情報" "を示す文字列です。この文字列は Python 対話型インタプリタが起動した時に表示さ" -"れます。バージョン情報はここから抜き出さずに、 :data:`version_info` および :" -"mod:`platform` が提供する関数を使って下さい。" +"れます。バージョン情報はここから抜き出さずに、 :data:`version_info` およ" +"び :mod:`platform` が提供する関数を使って下さい。" #: ../../library/sys.rst:2164 msgid "" @@ -3152,28 +3495,28 @@ msgid "" "*releaselevel* are integers; the release level is ``'alpha'``, ``'beta'``, " "``'candidate'``, or ``'final'``. The ``version_info`` value corresponding " "to the Python version 2.0 is ``(2, 0, 0, 'final', 0)``. The components can " -"also be accessed by name, so ``sys.version_info[0]`` is equivalent to ``sys." -"version_info.major`` and so on." +"also be accessed by name, so ``sys.version_info[0]`` is equivalent to " +"``sys.version_info.major`` and so on." msgstr "" "バージョン番号を示す 5 要素タプル:*major*, *minor*, *micro*, *releaselevel*, " "*serial* 。 *releaselevel* 以外は全て整数です。 *releaselevel* の値は、 " "``'alpha'``, ``'beta'``, ``'candidate'``, ``'final'`` の何れかです。 Python " "2.0 の ``version_info`` は、 ``(2, 0, 0, 'final', 0)`` となります。構成要素に" -"は名前でもアクセスできるので、 ``sys.version_info[0]`` は ``sys.version_info." -"major`` と等価、などになります。" +"は名前でもアクセスできるので、 ``sys.version_info[0]`` は " +"``sys.version_info.major`` と等価、などになります。" #: ../../library/sys.rst:2178 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 +3527,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 "" @@ -3197,10 +3542,9 @@ msgid "" "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" "コマンドラインオプション :option:`-X` で渡された様々な実装固有のフラグの辞書" -"です。オプション名にはその値が明示されていればそれが、それ以外の場合は :" -"const:`True` がマップされます。例えば:" +"です。オプション名にはその値が明示されていればそれが、それ以外の場合" +"は :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 +3555,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" @@ -3233,12 +3584,11 @@ msgid "" "n1256.pdf\\ ." msgstr "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" この標準のパブリックドラ" -"フトが参照できます: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256." -"pdf\\ 。" +"フトが参照できます: 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 +3638,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..e711e94ef 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." +"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,40 +91,69 @@ 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." -"zip``). On Windows the zip archive is searched for in ``home`` and on Unix " -"the archive is expected to be in :file:`lib`. Note that the expected zip " -"archive location is added to the module search path even if the archive does " -"not exist. If no archive was found, Python on Windows will continue the " -"search for ``prefix`` by looking for :file:`Lib\\\\os.py`. Python on Unix " -"will look for :file:`lib/python{majorversion}.{minorversion}/os.py` (``lib/" -"python3.11/os.py``). On Windows ``prefix`` and ``exec_prefix`` are the same, " -"however on other platforms :file:`lib/python{majorversion}.{minorversion}/" -"lib-dynload` (``lib/python3.11/lib-dynload``) is searched for and used as an " -"anchor for ``exec_prefix``. On some platforms :file:`lib` may be :file:" -"`lib64` or another value, see :data:`sys.platlibdir` and :envvar:" -"`PYTHONPLATLIBDIR`." +"looking for :file:`python{majorversion}{minorversion}.zip` " +"(``python311.zip``). On Windows the zip archive is searched for in ``home`` " +"and on Unix the archive is expected to be in :file:`lib`. Note that the " +"expected zip archive location is added to the module search path even if the " +"archive does not exist. If no archive was found, Python on Windows will " +"continue the search for ``prefix`` by looking for :file:`Lib\\\\os.py`. " +"Python on Unix will look for :file:`lib/python{majorversion}.{minorversion}/" +"os.py` (``lib/python3.11/os.py``). On Windows ``prefix`` and ``exec_prefix`` " +"are the same, however on other platforms :file:`lib/python{majorversion}." +"{minorversion}/lib-dynload` (``lib/python3.11/lib-dynload``) is searched for " +"and used as an anchor for ``exec_prefix``. On some platforms :file:`lib` may " +"be :file:`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." +"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." -"prefix` and :data:`sys.exec_prefix` get set to the directory containing " -"``pyvenv.cfg``, otherwise they are set to the same value as :data:`sys." -"base_prefix` and :data:`sys.base_exec_prefix`, respectively. This is used " -"by :ref:`sys-path-init-virtual-environments`." +"alongside the main executable, or in its parent " +"directory, :data:`sys.prefix` and :data:`sys.exec_prefix` get set to the " +"directory containing ``pyvenv.cfg``, otherwise they are set to the same " +"value as :data:`sys.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 "" @@ -122,45 +165,52 @@ msgstr "" #: ../../library/sys_path_init.rst:67 msgid "" -"Certain command line options may further affect path calculations. See :" -"option:`-E`, :option:`-I`, :option:`-s` and :option:`-S` for further details." +"Certain command line options may further affect path calculations. " +"See :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`." +":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 +221,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 +233,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 +254,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 @@ -217,14 +276,15 @@ msgstr "埋め込みの Python" #: ../../library/sys_path_init.rst:129 msgid "" -"If Python is embedded within another application :c:func:" -"`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure can be used " -"to initialize Python. The path specific details are described at :ref:`init-" -"path-config`." +"If Python is embedded within another " +"application :c:func:`Py_InitializeFromConfig` and the :c:type:`PyConfig` " +"structure can be used to initialize Python. The path specific details are " +"described at :ref:`init-path-config`." msgstr "" -"Python が他のアプリケーションに埋め込まれている場合は、 :c:func:" -"`Py_InitializeFromConfig` と :c:type:`PyConfig` 構造体が Python の初期化に使" -"用可能です。パス固有の詳細は、 :ref:`init-path-config` で説明されています。" +"Python が他のアプリケーションに埋め込まれている場合" +"は、 :c:func:`Py_InitializeFromConfig` と :c:type:`PyConfig` 構造体が Python " +"の初期化に使用可能です。パス固有の詳細は、 :ref:`init-path-config` で説明され" +"ています。" #: ../../library/sys_path_init.rst:135 msgid ":ref:`windows_finding_modules` for detailed Windows notes." diff --git a/library/sysconfig.po b/library/sysconfig.po index e8b31b543..2875210a2 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 @@ -63,9 +63,9 @@ msgid "" ":mod:`sysconfig` puts all variables found in these files in a dictionary " "that can be accessed using :func:`get_config_vars` or :func:`get_config_var`." msgstr "" -":mod:`sysconfig` はこれらのファイルに含まれるすべての変数を辞書に格納し、:" -"func:`get_config_vars` や :func:`get_config_var` でアクセスできるようにしま" -"す。" +":mod:`sysconfig` はこれらのファイルに含まれるすべての変数を辞書に格納" +"し、:func:`get_config_vars` や :func:`get_config_var` でアクセスできるように" +"します。" #: ../../library/sysconfig.rst:34 msgid "Notice that on Windows, it's a much smaller set." @@ -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" @@ -124,10 +128,10 @@ msgstr "インストールパス" #: ../../library/sysconfig.rst:70 msgid "" "Python uses an installation scheme that differs depending on the platform " -"and on the installation options. These schemes are stored in :mod:" -"`sysconfig` under unique identifiers based on the value returned by :const:" -"`os.name`. The schemes are used by package installers to determine where to " -"copy files to." +"and on the installation options. These schemes are stored " +"in :mod:`sysconfig` under unique identifiers based on the value returned " +"by :const:`os.name`. The schemes are used by package installers to determine " +"where to copy files to." msgstr "" #: ../../library/sysconfig.rst:75 @@ -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`)." +"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`)." +"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,49 +341,43 @@ 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 "" "The idea behind the \"home scheme\" is that you build and maintain a " "personal stash of Python modules. This scheme's name is derived from the " "idea of a \"home\" directory on Unix, since it's not unusual for a Unix user " -"to make their home directory have a layout similar to :file:`/usr/` or :file:" -"`/usr/local/`. This scheme can be used by anyone, regardless of the " +"to make their home directory have a layout similar to :file:`/usr/` " +"or :file:`/usr/local/`. This scheme can be used by anyone, regardless of the " "operating system they are installing for." msgstr "" "\"home スキーム\" の背後にある考え方は、Python モジュールを個人用のモジュール" @@ -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 "" @@ -519,35 +509,35 @@ msgstr "" #: ../../library/sysconfig.rst:265 msgid "" -"Return a tuple containing all schemes currently supported in :mod:" -"`sysconfig`." +"Return a tuple containing all schemes currently supported " +"in :mod:`sysconfig`." 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,17 +561,25 @@ 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." +"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 "" -"Return a tuple containing all path names currently supported in :mod:" -"`sysconfig`." +"Return a tuple containing all path names currently supported " +"in :mod:`sysconfig`." msgstr "" "現在 :mod:`sysconfig` でサポートされているすべてのパス名を格納したタプルを返" "します。" @@ -611,31 +609,32 @@ 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 "" -"If *scheme* is provided, it must be a value from the list returned by :func:" -"`get_scheme_names`. Otherwise, the default scheme for the current platform " -"is used." +"If *scheme* is provided, it must be a value from the list returned " +"by :func:`get_scheme_names`. Otherwise, the default scheme for the current " +"platform is used." msgstr "" "*scheme* が指定された場合、:func:`get_scheme_names` が返すリストに含まれる値" "でなければなりません。指定されなかった場合は、現在のプラットフォームでのデ" "フォルトスキームが利用されます。" -#: ../../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 "" @@ -678,11 +677,11 @@ msgstr "*expand* に偽を指定すると、パスは展開されません。" #: ../../library/sysconfig.rst:360 msgid "" -"If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" -"`KeyError`." +"If *scheme* is not an existing scheme, :func:`get_paths` will raise " +"a :exc:`KeyError`." msgstr "" -"*scheme* が実在するスキームでなかった場合、:func:`get_paths` は :exc:" -"`KeyError` を発生させます。" +"*scheme* が実在するスキームでなかった場合、:func:`get_paths` " +"は :exc:`KeyError` を発生させます。" #: ../../library/sysconfig.rst:365 msgid "Other functions" @@ -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,12 +841,33 @@ 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 "" -"This call will print in the standard output the information returned by :" -"func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" -"`get_config_vars`." +"This call will print in the standard output the information returned " +"by :func:`get_platform`, :func:`get_python_version`, :func:`get_path` " +"and :func:`get_config_vars`." msgstr "" "これは、:func:`get_platform`、:func:`get_python_version`、:func:`get_path` お" "よび :func:`get_config_vars` が返す情報を標準出力に出力します。" diff --git a/library/syslog.po b/library/syslog.po index 55db6f562..dde700297 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -20,45 +20,44 @@ 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 "" "This module wraps the system ``syslog`` family of routines. A pure Python " -"library that can speak to a syslog server is available in the :mod:`logging." -"handlers` module as :class:`~logging.handlers.SysLogHandler`." +"library that can speak to a syslog server is available in " +"the :mod:`logging.handlers` module " +"as :class:`~logging.handlers.SysLogHandler`." msgstr "" "このモジュールはシステムの ``syslog`` ファミリのルーチンをラップしています。 " -"syslog サーバーと通信できる pure Python のライブラリが、 :mod:`logging." -"handlers` モジュールの :class:`~logging.handlers.SysLogHandler` にあります。" +"syslog サーバーと通信できる pure Python のライブラリ" +"が、 :mod:`logging.handlers` モジュール" +"の :class:`~logging.handlers.SysLogHandler` にあります。" #: ../../library/syslog.rst:20 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,54 +66,60 @@ 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 "" -"If :func:`openlog` has not been called prior to the call to :func:`syslog`, :" -"func:`openlog` will be called with no arguments." +"If :func:`openlog` has not been called prior to the call " +"to :func:`syslog`, :func:`openlog` will be called with no arguments." 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 " -"most users.) :func:`openlog` must be called in the main interpreter before :" -"func:`syslog` may be used in a subinterpreter. Otherwise it will raise :exc:" -"`RuntimeError`." +"most users.) :func:`openlog` must be called in the main interpreter " +"before :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 "" -"Logging options of subsequent :func:`syslog` calls can be set by calling :" -"func:`openlog`. :func:`syslog` will call :func:`openlog` with no arguments " -"if the log is not currently open." +"Logging options of subsequent :func:`syslog` calls can be set by " +"calling :func:`openlog`. :func:`syslog` will call :func:`openlog` with no " +"arguments if the log is not currently open." msgstr "" ":func:`openlog` 関数を呼び出すことで以降の :func:`syslog` の呼び出しに対する" -"ログオプションを設定することができます。ログがまだ開かれていない状態で :func:" -"`syslog` を呼び出すと :func:`openlog` が引数なしで呼び出されます。" +"ログオプションを設定することができます。ログがまだ開かれていない状態" +"で :func:`syslog` を呼び出すと :func:`openlog` が引数なしで呼び出されます。" #: ../../library/syslog.rst:57 msgid "" @@ -132,27 +137,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." +"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 "" @@ -165,20 +171,19 @@ msgstr "" msgid "" "This causes the module to behave as it does when initially imported. For " "example, :func:`openlog` will be called on the first :func:`syslog` call " -"(if :func:`openlog` hasn't already been called), and *ident* and other :func:" -"`openlog` parameters are reset to defaults." +"(if :func:`openlog` hasn't already been called), and *ident* and " +"other :func:`openlog` parameters are reset to defaults." msgstr "" "この関数を呼ぶと、モジュールが最初に import されたときと同じようにふるまいま" "す。例えば、(:func:`openlog` を呼び出さないで) :func:`syslog` を最初に呼び出" -"したときに、 :func:`openlog` が呼び出され、 *ident* やその他の :func:" -"`openlog` の引数はデフォルト値にリセットされます。" +"したときに、 :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,13 +200,12 @@ 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." -"setlogmask`` を送出します。" +"引数 ``maskpri`` を指定して :ref:`監査イベント ` " +"``syslog.setlogmask`` を送出します。" #: ../../library/syslog.rst:108 msgid "The module defines the following constants:" @@ -211,24 +215,29 @@ 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`." +"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`." +"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`." +"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 +251,6 @@ msgstr "シンプルな例" msgid "A simple set of examples::" msgstr "1つ目のシンプルな例::" -#: ../../library/syslog.rst:176 msgid "" "import syslog\n" "\n" @@ -250,6 +258,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 +273,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..71580d74d 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 @@ -91,11 +91,11 @@ msgstr "" #: ../../library/tabnanny.rst:57 msgid "" -"This function is used by :func:`check` to process tokens generated by the :" -"mod:`tokenize` module." +"This function is used by :func:`check` to process tokens generated by " +"the :mod:`tokenize` module." msgstr "" -"この関数は、 :mod:`tokenize` モジュールによって生成されたトークンを :func:" -"`check` が処理するために使われます。" +"この関数は、 :mod:`tokenize` モジュールによって生成されたトークン" +"を :func:`check` が処理するために使われます。" #: ../../library/tabnanny.rst:66 msgid "Module :mod:`tokenize`" diff --git a/library/tarfile.po b/library/tarfile.po index 2314b8e0d..bb7a5c6c2 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 @@ -41,9 +41,9 @@ msgid "" "in :ref:`shutil `." msgstr "" ":mod:`tarfile` モジュールは、gzip、bz2、および lzma 圧縮されたものを含む、" -"tar アーカイブを読み書きできます。:file:`.zip` ファイルの読み書きには :mod:" -"`zipfile` モジュールか、あるいは :ref:`shutil ` の高水" -"準関数を使用してください。" +"tar アーカイブを読み書きできます。:file:`.zip` ファイルの読み書きに" +"は :mod:`zipfile` モジュールか、あるいは :ref:`shutil ` の高水準関数を使用してください。" #: ../../library/tarfile.rst:19 msgid "Some facts and figures:" @@ -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 "" @@ -111,8 +117,8 @@ msgid "" "allowed, see :ref:`tarfile-objects`." msgstr "" "パス名 *name* の :class:`TarFile` オブジェクトを返します。:class:`TarFile` オ" -"ブジェクトと、利用できるキーワード引数に関する詳細な情報については、:ref:" -"`tarfile-objects` 節を参照してください。" +"ブジェクトと、利用できるキーワード引数に関する詳細な情報について" +"は、:ref:`tarfile-objects` 節を参照してください。" #: ../../library/tarfile.rst:56 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'``" @@ -177,11 +182,11 @@ msgstr "``'x'`` or ``'x:'``" #: ../../library/tarfile.rst:74 msgid "" -"Create a tarfile exclusively without compression. Raise a :exc:" -"`FileExistsError` exception if it already exists." +"Create a tarfile exclusively without compression. Raise " +"a :exc:`FileExistsError` exception if it already exists." msgstr "" -"圧縮せずに tarfile を排他的に作成します。tarfile が既存の場合 :exc:" -"`FileExistsError` 例外を送出します。" +"圧縮せずに tarfile を排他的に作成します。tarfile が既存の場" +"合 :exc:`FileExistsError` 例外を送出します。" #: ../../library/tarfile.rst:79 msgid "``'x:gz'``" @@ -192,8 +197,8 @@ msgid "" "Create a tarfile with gzip compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -"gzip 圧縮で tarfile を作成します。tarfile が既存の場合 :exc:" -"`FileExistsError` 例外を送出します。" +"gzip 圧縮で tarfile を作成します。tarfile が既存の場" +"合 :exc:`FileExistsError` 例外を送出します。" #: ../../library/tarfile.rst:83 msgid "``'x:bz2'``" @@ -204,8 +209,8 @@ msgid "" "Create a tarfile with bzip2 compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -"bzip2 圧縮で tarfile を作成します。tarfile が既存の場合 :exc:" -"`FileExistsError` 例外を送出します。" +"bzip2 圧縮で tarfile を作成します。tarfile が既存の場" +"合 :exc:`FileExistsError` 例外を送出します。" #: ../../library/tarfile.rst:87 msgid "``'x:xz'``" @@ -216,8 +221,8 @@ msgid "" "Create a tarfile with lzma compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -"lzma 圧縮で tarfile を作成します。tarfile が既存の場合 :exc:" -"`FileExistsError` 例外を送出します。" +"lzma 圧縮で tarfile を作成します。tarfile が既存の場" +"合 :exc:`FileExistsError` 例外を送出します。" #: ../../library/tarfile.rst:91 msgid "``'a' or 'a:'``" @@ -266,9 +271,9 @@ msgstr "lzma 圧縮で書き込み用にオープンします。" #: ../../library/tarfile.rst:103 msgid "" "Note that ``'a:gz'``, ``'a:bz2'`` or ``'a:xz'`` is not possible. If *mode* " -"is not suitable to open a certain (compressed) file for reading, :exc:" -"`ReadError` is raised. Use *mode* ``'r'`` to avoid this. If a compression " -"method is not supported, :exc:`CompressionError` is raised." +"is not suitable to open a certain (compressed) file for " +"reading, :exc:`ReadError` is raised. Use *mode* ``'r'`` to avoid this. If a " +"compression method is not supported, :exc:`CompressionError` is raised." msgstr "" "``'a:gz'``、``'a:bz2'``、``'a:xz'`` は利用できないことに注意して下さい。もし " "*mode* が、ある (圧縮した) ファイルを読み込み用にオープンするのに適していない" @@ -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,20 +306,37 @@ 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` " "object that processes its data as a stream of blocks. No random seeking " -"will be done on the file. If given, *fileobj* may be any object that has a :" -"meth:`~io.RawIOBase.read` or :meth:`~io.RawIOBase.write` method (depending " -"on the *mode*) that works with bytes. *bufsize* specifies the blocksize and " -"defaults to ``20 * 512`` bytes. Use this variant in combination with e.g. " -"``sys.stdin.buffer``, a socket :term:`file object` or a tape device. " -"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 "" +"will be done on the file. If given, *fileobj* may be any object that has " +"a :meth:`~io.RawIOBase.read` or :meth:`~io.RawIOBase.write` method " +"(depending on the *mode*) that works with bytes. *bufsize* specifies the " +"blocksize and defaults to ``20 * 512`` bytes. Use this variant in " +"combination with e.g. ``sys.stdin.buffer``, a socket :term:`file object` or " +"a tape device. 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 +430,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 "" @@ -424,9 +447,9 @@ msgstr "" #: ../../library/tarfile.rst:183 msgid "" -"Return :const:`True` if *name* is a tar archive file, that the :mod:" -"`tarfile` module can read. *name* may be a :class:`str`, file, or file-like " -"object." +"Return :const:`True` if *name* is a tar archive file, that " +"the :mod:`tarfile` module can read. *name* may be a :class:`str`, file, or " +"file-like object." msgstr "" "もし *name* が tar アーカイブファイルであり、:mod:`tarfile` モジュールで読み" "込める場合に :const:`True` を返します。 *name* は :class:`str`、ファイルまた" @@ -462,8 +485,8 @@ msgstr "" #: ../../library/tarfile.rst:212 msgid "" -"Is raised for the limitations that are typical for stream-like :class:" -"`TarFile` objects." +"Is raised for the limitations that are typical for stream-" +"like :class:`TarFile` objects." msgstr "" "ストリームのような :class:`TarFile` オブジェクトで典型的な制限のために送出さ" "れます。" @@ -482,38 +505,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 `." +"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:" @@ -524,58 +548,47 @@ msgid "" "The default character encoding: ``'utf-8'`` on Windows, the value returned " "by :func:`sys.getfilesystemencoding` otherwise." msgstr "" -"既定の文字エンコーディング。Windows では ``'utf-8'`` 、それ以外では :func:" -"`sys.getfilesystemencoding` の返り値です。" +"既定の文字エンコーディング。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 "" -"Each of the following constants defines a tar archive format that the :mod:" -"`tarfile` module is able to create. See section :ref:`tar-formats` for " -"details." +"Each of the following constants defines a tar archive format that " +"the :mod:`tarfile` module is able to create. See section :ref:`tar-formats` " +"for details." msgstr "" "以下の各定数は、:mod:`tarfile` モジュールが作成できる tar アーカイブフォー" "マットを定義しています。詳細は、:ref:`tar-formats` を参照してください。" @@ -594,19 +607,19 @@ msgstr "POSIX.1-2001 (pax) フォーマット。" #: ../../library/tarfile.rst:334 msgid "" -"The default format for creating archives. This is currently :const:" -"`PAX_FORMAT`." +"The default format for creating archives. This is " +"currently :const:`PAX_FORMAT`." msgstr "" "アーカイブを作成する際のデフォルトのフォーマット。現在は :const:`PAX_FORMAT` " "です。" #: ../../library/tarfile.rst:336 msgid "" -"The default format for new archives was changed to :const:`PAX_FORMAT` from :" -"const:`GNU_FORMAT`." +"The default format for new archives was changed to :const:`PAX_FORMAT` " +"from :const:`GNU_FORMAT`." msgstr "" -"新しいアーカイブのデフォルトフォーマットが :const:`GNU_FORMAT` から :const:" -"`PAX_FORMAT` に変更されました。" +"新しいアーカイブのデフォルトフォーマットが :const:`GNU_FORMAT` か" +"ら :const:`PAX_FORMAT` に変更されました。" #: ../../library/tarfile.rst:343 msgid "Module :mod:`zipfile`" @@ -648,23 +661,23 @@ msgid "" "The :class:`TarFile` object provides an interface to a tar archive. A tar " "archive is a sequence of blocks. An archive member (a stored file) is made " "up of a header block followed by data blocks. It is possible to store a file " -"in a tar archive several times. Each archive member is represented by a :" -"class:`TarInfo` object, see :ref:`tarinfo-objects` for details." +"in a tar archive several times. Each archive member is represented by " +"a :class:`TarInfo` object, see :ref:`tarinfo-objects` for details." msgstr "" ":class:`TarFile` オブジェクトは、tar アーカイブへのインターフェースを提供しま" "す。tar アーカイブは一連のブロックです。アーカイブメンバー (保存されたファイ" "ル) は、ヘッダーブロックとそれに続くデータブロックで構成されています。一つの " "tar アーカイブにファイルを何回も保存することができます。各アーカイブメンバー" -"は、:class:`TarInfo` オブジェクトで確認できます。詳細については :ref:" -"`tarinfo-objects` を参照してください。" +"は、:class:`TarInfo` オブジェクトで確認できます。詳細について" +"は :ref:`tarinfo-objects` を参照してください。" #: ../../library/tarfile.rst:365 msgid "" -"A :class:`TarFile` object can be used as a context manager in a :keyword:" -"`with` statement. It will automatically be closed when the block is " -"completed. Please note that in the event of an exception an archive opened " -"for writing will not be finalized; only the internally used file object will " -"be closed. See the :ref:`tar-examples` section for a use case." +"A :class:`TarFile` object can be used as a context manager in " +"a :keyword:`with` statement. It will automatically be closed when the block " +"is completed. Please note that in the event of an exception an archive " +"opened for writing will not be finalized; only the internally used file " +"object will be closed. See the :ref:`tar-examples` section for a use case." msgstr "" ":class:`TarFile` オブジェクトは :keyword:`with` 文のコンテキストマネージャー" "として利用できます。with ブロックが終了したときにオブジェクトはクローズされま" @@ -683,12 +696,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 "" @@ -724,8 +740,8 @@ msgid "" "detected, even if different formats are present in a single archive." msgstr "" "*format* はアーカイブの書き込みフォーマットを制御します。モジュールレベルで定" -"義されている、:const:`USTAR_FORMAT`、:const:`GNU_FORMAT`、あるいは :const:" -"`PAX_FORMAT` のいずれかである必要があります。\n" +"義されている、:const:`USTAR_FORMAT`、:const:`GNU_FORMAT`、あるい" +"は :const:`PAX_FORMAT` のいずれかである必要があります。\n" "読み出しのときは、1 つのアーカイブに異なるフォーマットが混在していたとして" "も、フォーマットは自動的に検知されます。" @@ -748,17 +764,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,45 +784,45 @@ 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." +"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 "" "The *pax_headers* argument is an optional dictionary of strings which will " "be added as a pax global header if *format* is :const:`PAX_FORMAT`." msgstr "" -"引数 *pax_headers* は、オプションの文字列辞書で、*format* が :const:" -"`PAX_FORMAT` だった場合に pax グローバルヘッダーに追加されます。" +"引数 *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 +840,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 "" @@ -866,9 +881,9 @@ msgstr "*members* 引数が追加されました。." #: ../../library/tarfile.rst:482 msgid "" -"Return the next member of the archive as a :class:`TarInfo` object, when :" -"class:`TarFile` is opened for reading. Return :const:`None` if there is no " -"more available." +"Return the next member of the archive as a :class:`TarInfo` object, " +"when :class:`TarFile` is opened for reading. Return :const:`None` if there " +"is no more available." msgstr "" ":class:`TarFile` が読み込み用にオープンされている時、アーカイブの次のメンバー" "を :class:`TarInfo` オブジェクトとして返します。もしそれ以上利用可能なものが" @@ -903,7 +918,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 +925,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 +961,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 "" @@ -951,17 +973,16 @@ msgid "" "File attributes (owner, mtime, mode) are set unless *set_attrs* is false." msgstr "" "アーカイブからメンバーの完全な名前を使って、現在のディレクトリに展開します。" -"ファイル情報はできる限り正確に展開されます。 *member* はファイル名もしくは :" -"class:`TarInfo` オブジェクトです。 *path* を使って別のディレクトリを指定する" -"こともできます。 *path* は :term:`path-like object` でも構いません。" +"ファイル情報はできる限り正確に展開されます。 *member* はファイル名もしく" +"は :class:`TarInfo` オブジェクトです。 *path* を使って別のディレクトリを指定" +"することもできます。 *path* は :term:`path-like object` でも構いません。" "*set_attrs* が false でない限り、ファイルの属性 (所有者、最終更新時刻、モー" "ド) は設定されます。" -#: ../../library/tarfile.rst:538 msgid "" -"The *numeric_owner* and *filter* arguments are the same as for :meth:" -"`extractall`." -msgstr "" +"The *numeric_owner* and *filter* arguments are the same as " +"for :meth:`extractall`." +msgstr "*numeric_owner* 引数と *filter* 引数は :meth:`extractall` と同じです。" #: ../../library/tarfile.rst:543 msgid "" @@ -971,11 +992,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,66 +1016,81 @@ 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 " -"messages in the debug output when *debug* is greater than 0. If ``1`` (the " -"default), all *fatal* errors are raised as :exc:`OSError` or :exc:" -"`FilterError` exceptions. If ``2``, all *non-fatal* errors are raised as :" -"exc:`TarError` exceptions as well." +"If *errorlevel* is ``0``, errors are ignored when " +"using :meth:`TarFile.extract` and :meth:`TarFile.extractall`. Nevertheless, " +"they appear as error messages in the debug output when *debug* is greater " +"than 0. If ``1`` (the default), all *fatal* errors are raised " +"as :exc:`OSError` or :exc:`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." +"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`." +"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,25 +1102,28 @@ 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 `." +"the destination. Previously, the default was equivalent " +"to :func:`fully_trusted `." msgstr "" +"デフォルトのフィルターが :func:`data ` になりました。\n" +"絶対パスや展開先の外部を指すリンクなど、危険な機能の一部を許可しません。\n" +"以前のデフォルトは :func:`fully_trusted ` と同等でし" +"た。" #: ../../library/tarfile.rst:633 msgid "" "Add the file *name* to the archive. *name* may be any type of file " "(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an " "alternative name for the file in the archive. Directories are added " -"recursively by default. This can be avoided by setting *recursive* to :const:" -"`False`. Recursion adds entries in sorted order. If *filter* is given, it " -"should be a function that takes a :class:`TarInfo` object argument and " -"returns the changed :class:`TarInfo` object. If it instead returns :const:" -"`None` the :class:`TarInfo` object will be excluded from the archive. See :" -"ref:`tar-examples` for an example." +"recursively by default. This can be avoided by setting *recursive* " +"to :const:`False`. Recursion adds entries in sorted order. If *filter* is " +"given, it should be a function that takes a :class:`TarInfo` object argument " +"and returns the changed :class:`TarInfo` object. If it instead " +"returns :const:`None` the :class:`TarInfo` object will be excluded from the " +"archive. See :ref:`tar-examples` for an example." msgstr "" "ファイル *name* をアーカイブに追加します。\n" "*name* は、任意のファイルタイプ (ディレクトリ、fifo、シンボリックリンク等)で" @@ -1104,20 +1144,24 @@ 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 :" -"term:`binary file`, and ``tarinfo.size`` bytes are read from it and added to " -"the archive. You can create :class:`TarInfo` objects directly, or by using :" -"meth:`gettarinfo`." -msgstr "" +"represents a non zero-size regular file, the *fileobj* argument should be " +"a :term:`binary file`, and ``tarinfo.size`` bytes are read from it and added " +"to 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,29 +1171,32 @@ 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 " -"positioned at the beginning of the file, attributes such as :attr:`~TarInfo." -"size` may need modifying. This is the case for objects such as :class:" -"`~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* はダミーの文字列にすること" -"ができます。" +"positioned at the beginning of the file, attributes such " +"as :attr:`~TarInfo.size` may need modifying. This is the case for objects " +"such as :class:`~gzip.GzipFile`. The :attr:`~TarInfo.name` may also be " +"modified, in which case *arcname* could be a dummy string." +msgstr "" +":meth:`addfile` で追加する前に、:class:`TarInfo` の属性の一部を変更できま" +"す。\n" +"ファイルオブジェクトが、ファイルの先頭に位置する通常のファイルオブジェクトで" +"ない場合は、:attr:`~TarInfo.size` などの属性を変更する必要があるかもしれませ" +"ん。\n" +":class:`~gzip.GzipFile` のようなオブジェクトがこれに当たります。\n" +":attr:`~TarInfo.name` も変更できます。\n" +"その場合、*arcname* はダミーの文字列で構いません。" #: ../../library/tarfile.rst:688 msgid "" @@ -1180,21 +1227,27 @@ 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`." +":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. " -"For cases where this is unwanted, you can use :mod:`copy.copy() ` or " -"call the :meth:`~TarInfo.replace` method to create a modified copy in one " -"step." +"Modifying the objects returned by :meth:`~TarFile.getmember` " +"or :meth:`~TarFile.getmembers` will affect all subsequent operations on the " +"archive. For cases where this is unwanted, you can use :mod:`copy.copy() " +"` or 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 +1256,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 +1290,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,37 +1309,36 @@ 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`." +"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." +"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 "" -"File type. *type* is usually one of these constants: :const:`REGTYPE`, :" -"const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :" -"const:`FIFOTYPE`, :const:`CONTTYPE`, :const:`CHRTYPE`, :const:`BLKTYPE`, :" -"const:`GNUTYPE_SPARSE`. To determine the type of a :class:`TarInfo` object " -"more conveniently, use the ``is*()`` methods below." +"File type. *type* is usually one of these " +"constants: :const:`REGTYPE`, :const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :const:`FIFOTYPE`, :const:`CONTTYPE`, :const:`CHRTYPE`, :const:`BLKTYPE`, :const:`GNUTYPE_SPARSE`. " +"To determine the type of a :class:`TarInfo` object more conveniently, use " +"the ``is*()`` methods below." msgstr "" -"ファイルタイプ。*type* は通常、定数 :const:`REGTYPE`、:const:`AREGTYPE`、:" -"const:`LNKTYPE`、:const:`SYMTYPE`、:const:`DIRTYPE`、:const:`FIFOTYPE`、:" -"const:`CONTTYPE`、:const:`CHRTYPE`、:const:`BLKTYPE`、あるいは :const:" -"`GNUTYPE_SPARSE` のいずれかです。:class:`TarInfo` オブジェクトのタイプをもっ" -"と簡単に解決するには、下記の ``is*()`` メソッドを使って下さい。" +"ファイルタイプ。*type* は通常、定" +"数 :const:`REGTYPE`、:const:`AREGTYPE`、:const:`LNKTYPE`、:const:`SYMTYPE`、:const:`DIRTYPE`、:const:`FIFOTYPE`、:const:`CONTTYPE`、:const:`CHRTYPE`、:const:`BLKTYPE`、" +"あるいは :const:`GNUTYPE_SPARSE` のいずれかです。:class:`TarInfo` オブジェク" +"トのタイプをもっと簡単に解決するには、下記の ``is*()`` メソッドを使って下さ" +"い。" #: ../../library/tarfile.rst:805 msgid "" @@ -1298,12 +1348,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 +1374,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 " +"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 +1425,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`." @@ -1410,14 +1462,12 @@ msgstr "FIFO の場合に :const:`True` を返します。" msgid "" "Return :const:`True` if it is one of character device, block device or FIFO." msgstr "" -"キャラクターデバイス、ブロックデバイスあるいは FIFO のいずれかの場合に :" -"const:`True` を返します。" +"キャラクターデバイス、ブロックデバイスあるいは 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 +1476,267 @@ 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`." +"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:" +"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." +"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 " +"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." +"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`)." +"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`." +"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`)." +"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`)." +"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." +"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 +1744,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." +"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 +1909,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 +1955,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,37 +1981,34 @@ 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:" +"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 "" -"If you want to extract a tar archive into the current directory, use the :" -"option:`-e` option:" +"If you want to extract a tar archive into the current directory, use " +"the :option:`-e` option:" 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 +2018,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 +2056,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,23 +2073,25 @@ 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 "" "How to extract a subset of a tar archive with :meth:`TarFile.extractall` " "using a generator function instead of a list::" msgstr "" -"tar アーカイブの一部を、リストの代わりにジェネレーター関数を利用して :meth:" -"`TarFile.extractall` で展開する方法::" +"tar アーカイブの一部を、リストの代わりにジェネレーター関数を利用し" +"て :meth:`TarFile.extractall` で展開する方法::" -#: ../../library/tarfile.rst:1318 msgid "" "import os\n" "import tarfile\n" @@ -1972,12 +2105,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 +2128,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 +2170,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 +2191,6 @@ msgstr "" ":meth:`TarFile.add` 関数の *filter* 引数を利用してユーザー情報をリセットしな" "がらアーカイブを作成する方法::" -#: ../../library/tarfile.rst:1362 msgid "" "import tarfile\n" "def reset(tarinfo):\n" @@ -2040,6 +2201,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 +2246,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 +2255,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 +2273,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 +2313,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 +2326,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 +2362,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..698c9504e 100644 --- a/library/telnetlib.po +++ b/library/telnetlib.po @@ -12,32 +12,37 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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." +"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..142211999 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 @@ -37,12 +37,20 @@ msgstr "**ソースコード:** :source:`Lib/tempfile.py`" #: ../../library/tempfile.rst:17 msgid "" "This module creates temporary files and directories. It works on all " -"supported platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :" -"class:`TemporaryDirectory`, and :class:`SpooledTemporaryFile` are high-level " -"interfaces which provide automatic cleanup and can be used as :term:`context " -"managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-" -"level functions which require manual cleanup." -msgstr "" +"supported " +"platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :class:`TemporaryDirectory`, " +"and :class:`SpooledTemporaryFile` are high-level interfaces which provide " +"automatic cleanup and can be used as :term:`context 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 "" @@ -91,10 +99,14 @@ msgstr "" #: ../../library/tempfile.rst:44 msgid "" -"The resulting object can be used as a :term:`context manager` (see :ref:" -"`tempfile-examples`). On completion of the context or destruction of the " -"file object the temporary file will be removed from the filesystem." +"The resulting object can be used as a :term:`context manager` " +"(see :ref:`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`` を送出します。 " +"引数 ``fullpath`` を指定して :ref:`監査イベント ` " +"``tempfile.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,43 +235,51 @@ 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 :" -"func:`open`) must be closed before exiting the context manager, else the :" -"func:`os.unlink` call on context manager exit will fail with a :exc:" -"`PermissionError`." +"additional opens that do not share delete access (e.g. created via " +"builtin :func:`open`) must be closed before exiting the context manager, " +"else the :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,31 +288,47 @@ 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 "" "This class operates exactly as :func:`TemporaryFile` does, except that data " "is spooled in memory until the file size exceeds *max_size*, or until the " "file's :func:`~io.IOBase.fileno` method is called, at which point the " -"contents are written to disk and operation proceeds as with :func:" -"`TemporaryFile`." +"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,26 +338,40 @@ 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 "" -"This class securely creates a temporary directory using the same rules as :" -"func:`mkdtemp`. The resulting object can be used as a :term:`context " +"This class securely creates a temporary directory using the same rules " +"as :func:`mkdtemp`. The resulting object can be used as a :term:`context " "manager` (see :ref:`tempfile-examples`). On completion of the context or " "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,16 @@ 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 +412,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`` を送出します。 " +"引数 ``fullpath`` を指定して :ref:`監査イベント ` " +"``tempfile.mkdtemp`` を送出します。" #: ../../library/tempfile.rst:214 msgid "Added *ignore_cleanup_errors* parameter." @@ -352,7 +431,7 @@ msgstr "*ignore_cleanup_errors* 引数が追加されました。" #: ../../library/tempfile.rst:217 msgid "Added the *delete* parameter." -msgstr "" +msgstr "*delete* パラメータが追加されました。" #: ../../library/tempfile.rst:223 msgid "" @@ -395,8 +474,8 @@ msgstr "" #: ../../library/tempfile.rst:239 msgid "" "If *prefix* is not ``None``, the file name will begin with that prefix; " -"otherwise, a default prefix is used. The default is the return value of :" -"func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." +"otherwise, a default prefix is used. The default is the return value " +"of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." msgstr "" "*prefix* が ``None`` でない場合、ファイル名はその接頭辞で始まります。\n" "そうでない場合、デフォルトの接頭辞が使われます。\n" @@ -448,9 +527,9 @@ msgid "" "file (as would be returned by :func:`os.open`) and the absolute pathname of " "that file, in that order." msgstr "" -":func:`mkstemp` は開かれたファイルを扱うための OS レベルのハンドル (:func:" -"`os.open` が返すものと同じ) とファイルの絶対パス名が順番に並んだタプルを返し" -"ます。" +":func:`mkstemp` は開かれたファイルを扱うための OS レベルのハンドル " +"(:func:`os.open` が返すものと同じ) とファイルの絶対パス名が順番に並んだタプル" +"を返します。" #: ../../library/tempfile.rst:266 ../../library/tempfile.rst:292 msgid "" @@ -491,8 +570,8 @@ msgstr "" #: ../../library/tempfile.rst:285 msgid "" -"The *prefix*, *suffix*, and *dir* arguments are the same as for :func:" -"`mkstemp`." +"The *prefix*, *suffix*, and *dir* arguments are the same as " +"for :func:`mkstemp`." msgstr "" "*prefix*, *suffix*, *dir* 引数は :func:`mkstemp` 関数のものと同じです。" @@ -500,11 +579,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 "" @@ -549,8 +628,8 @@ msgstr "" #: ../../library/tempfile.rst:325 msgid "" -"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :" -"file:`/usr/tmp`, in that order." +"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, " +"and :file:`/usr/tmp`, in that order." msgstr "" "その他の全てのプラットフォームでは、 :file:`/tmp` 、 :file:`/var/tmp` 、およ" "び :file:`/usr/tmp` の順。" @@ -567,11 +646,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 +670,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 +678,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,15 +706,21 @@ 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:" -"`mkdtemp` changes to bytes when no explicit ``prefix``, ``suffix``, or " -"``dir`` arguments of type str are supplied. Please do not write code " -"expecting or depending on this. This awkward behavior is maintained for " -"compatibility with the historical implementation." -msgstr "" +"effect: The global default return type of :func:`mkstemp` " +"and :func:`mkdtemp` changes to bytes when no explicit ``prefix``, " +"``suffix``, or ``dir`` arguments of type str are supplied. Please do not " +"write code 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 +730,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 +771,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" @@ -727,9 +861,9 @@ msgid "" msgstr "" "この関数を使うとプログラムのセキュリティホールになる可能性があります。この関" "数がファイル名を返した後、あなたがそのファイル名を使って次に何かをしようとす" -"る段階に至る前に、誰か他の人間があなたを出し抜くことができてしまいます。 :" -"func:`mktemp` の利用は、 :func:`NamedTemporaryFile` に ``delete=False`` 引数" -"を渡すことで、簡単に置き換えることができます::" +"る段階に至る前に、誰か他の人間があなたを出し抜くことができてしまいま" +"す。 :func:`mktemp` の利用は、 :func:`NamedTemporaryFile` に " +"``delete=False`` 引数を渡すことで、簡単に置き換えることができます::" #: ../../library/tempfile.rst:462 msgid "" @@ -743,6 +877,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..313348f6e 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,31 +42,31 @@ msgstr "" "*termios* 形式の端末制御をサポートしていてインストール時に有効にした Unix の" "バージョンでのみ利用可能です。" -#: ../../library/termios.rst:19 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/termios.rst:21 msgid "" "All functions in this module take a file descriptor *fd* as their first " -"argument. This can be an integer file descriptor, such as returned by ``sys." -"stdin.fileno()``, or a :term:`file object`, such as ``sys.stdin`` itself." +"argument. This can be an integer file descriptor, such as returned by " +"``sys.stdin.fileno()``, or a :term:`file object`, such as ``sys.stdin`` " +"itself." msgstr "" "このモジュールの関数は全て、ファイル記述子 *fd* を最初の引数としてとります。" "この値は、 ``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:" @@ -84,32 +84,33 @@ msgid "" msgstr "" "ファイル記述子 *fd* の端末属性を含むリストを返します。その形式は: ``[iflag, " "oflag, cflag, lflag, ispeed, ospeed, cc]`` です。 *cc* は端末特殊文字のリスト" -"です (それぞれ長さ 1 の文字列です。ただしインデクス :const:`VMIN` および :" -"const:`VTIME` の内容は、それらのフィールドが定義されていた場合整数の値となり" -"ます)。端末設定フラグおよび端末速度の解釈、および配列 *cc* のインデクス検索" -"は、 :mod:`termios` で定義されているシンボル定数を使って行わなければなりませ" -"ん。" +"です (それぞれ長さ 1 の文字列です。ただしインデクス :const:`VMIN` およ" +"び :const:`VTIME` の内容は、それらのフィールドが定義されていた場合整数の値と" +"なります)。端末設定フラグおよび端末速度の解釈、および配列 *cc* のインデクス検" +"索は、 :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 +126,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,21 +147,28 @@ 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`." +"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:" -"`tcgetwinsize`. Requires at least one of the pairs (:const:`termios." -"TIOCGWINSZ`, :const:`termios.TIOCSWINSZ`); (:const:`termios.TIOCGSIZE`, :" -"const:`termios.TIOCSSIZE`) to be defined." -msgstr "" +"two-item tuple ``(ws_row, ws_col)`` like the one returned " +"by :func:`tcgetwinsize`. Requires at least one of the pairs " +"(:const:`termios.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 +182,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::" +"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 +207,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..f5f2d9a2d 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 "" @@ -47,14 +46,14 @@ msgstr "" #: ../../library/test.rst:18 msgid "" "The :mod:`test` package contains all regression tests for Python as well as " -"the modules :mod:`test.support` and :mod:`test.regrtest`. :mod:`test." -"support` is used to enhance your tests while :mod:`test.regrtest` drives the " -"testing suite." +"the modules :mod:`test.support` " +"and :mod:`test.regrtest`. :mod:`test.support` is used to enhance your tests " +"while :mod:`test.regrtest` drives the testing suite." msgstr "" -":mod:`test` パッケージには、Python 用の全ての回帰テストの他に、 :mod:`test." -"support` モジュールと :mod:`test.regrtest` モジュールが入っています。 :mod:" -"`test.support` はテストを充実させるために使い、 :mod:`test.regrtest` はテスト" -"スイートを実行するのに使います。" +":mod:`test` パッケージには、Python 用の全ての回帰テストの他" +"に、 :mod:`test.support` モジュールと :mod:`test.regrtest` モジュールが入って" +"います。 :mod:`test.support` はテストを充実させるために使" +"い、 :mod:`test.regrtest` はテストスイートを実行するのに使います。" #: ../../library/test.rst:23 msgid "" @@ -65,10 +64,10 @@ msgid "" "printed to ``sys.stdout``; this style of test is considered deprecated." msgstr "" ":mod:`test` パッケージ内のモジュールのうち、名前が ``test_`` で始まるものは、" -"特定のモジュールや機能に対するテストスイートです。新しいテストはすべて :mod:" -"`unittest` か :mod:`doctest` モジュールを使って書くようにしてください。古いテ" -"ストのいくつかは、 ``sys.stdout`` への出力を比較する「従来の」テスト形式に" -"なっていますが、この形式のテストは廃止予定です。" +"特定のモジュールや機能に対するテストスイートです。新しいテストはすべ" +"て :mod:`unittest` か :mod:`doctest` モジュールを使って書くようにしてくださ" +"い。古いテストのいくつかは、 ``sys.stdout`` への出力を比較する「従来の」テス" +"ト形式になっていますが、この形式のテストは廃止予定です。" #: ../../library/test.rst:32 msgid "Module :mod:`unittest`" @@ -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,25 +152,54 @@ 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 "" -"This code pattern allows the testing suite to be run by :mod:`test." -"regrtest`, on its own as a script that supports the :mod:`unittest` CLI, or " -"via the ``python -m unittest`` CLI." +"This code pattern allows the testing suite to be run " +"by :mod:`test.regrtest`, on its own as a script that supports " +"the :mod:`unittest` CLI, or via the ``python -m unittest`` CLI." msgstr "" "このコードのパターンを使うと :mod:`test.regrtest` からテストスイートを実行で" "き、 :mod:`unittest` のコマンドラインインターフェースをサポートしているスクリ" "プトとして自分自身を起動したり、 ``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,15 +302,33 @@ 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:`!" +"When using this pattern, remember that all classes that inherit " +"from :class:`unittest.TestCase` are run as tests. The :class:`!" "TestFuncAcceptsSequencesMixin` class in the example above does not have any " -"data and so can't be run by itself, thus it does not inherit from :class:" -"`unittest.TestCase`." +"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" @@ -302,14 +348,14 @@ msgid "" "test suite, thanks to the :option:`-m` option: :program:`python -m test`. " "Under the hood, it uses :mod:`test.regrtest`; the call :program:`python -m " "test.regrtest` used in previous Python versions still works. Running the " -"script by itself automatically starts running all regression tests in the :" -"mod:`test` package. It does this by finding all modules in the package whose " -"name starts with ``test_``, importing them, and executing the function :func:" -"`test_main` if present or loading the tests via unittest.TestLoader." -"loadTestsFromModule if ``test_main`` does not exist. The names of tests to " -"execute may also be passed to the script. Specifying a single regression " -"test (:program:`python -m test test_spam`) will minimize output and only " -"print whether the test passed or failed." +"script by itself automatically starts running all regression tests in " +"the :mod:`test` package. It does this by finding all modules in the package " +"whose name starts with ``test_``, importing them, and executing the " +"function :func:`test_main` if present or loading the tests via " +"unittest.TestLoader.loadTestsFromModule if ``test_main`` does not exist. " +"The names of tests to execute may also be passed to the script. Specifying a " +"single regression test (:program:`python -m test test_spam`) will minimize " +"output and only print whether the test passed or failed." msgstr "" ":mod:`test` パッケージはスクリプトとして Python の回帰テストスイートを実行で" "きます。\n" @@ -344,30 +390,31 @@ msgstr "" "行うには、 ``-u`` コマンドラインオプションを使います。 ``-u`` のオプションに " "``all`` を指定すると、すべてのリソースを有効にします: :program:`python -m " "test -uall` 。(よくある場合ですが) 何か一つを除く全てが必要な場合、カンマで区" -"切った不要なリソースのリストを ``all`` の後に並べます。コマンド :program:" -"`python -m test -uall,-audio,-largefile` とすると、 ``audio`` と " +"切った不要なリソースのリストを ``all`` の後に並べます。コマン" +"ド :program:`python -m test -uall,-audio,-largefile` とすると、 ``audio`` と " "``largefile`` リソースを除く全てのリソースを使って :mod:`test` を実行します。" -"すべてのリソースのリストと追加のコマンドラインオプションを出力するには、 :" -"program:`python -m test -h` を実行してください。" +"すべてのリソースのリストと追加のコマンドラインオプションを出力するに" +"は、 :program:`python -m test -h` を実行してください。" #: ../../library/test.rst:189 msgid "" "Some other ways to execute the regression tests depend on what platform the " "tests are being executed on. On Unix, you can run :program:`make test` at " -"the top-level directory where Python was built. On Windows, executing :" -"program:`rt.bat` from your :file:`PCbuild` directory will run all regression " -"tests." +"the top-level directory where Python was built. On Windows, " +"executing :program:`rt.bat` from your :file:`PCbuild` directory will run all " +"regression tests." msgstr "" "テストを実行しようとするプラットフォームによっては、回帰テストを実行する別の" -"方法があります。 Unix では、Python をビルドしたトップレベルディレクトリで :" -"program:`make test` を実行できます。 Windows上では、 :file:`PCbuild` ディレク" -"トリから :program:`rt.bat` を実行すると、すべての回帰テストを実行します。" +"方法があります。 Unix では、Python をビルドしたトップレベルディレクトリ" +"で :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 " +"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 "" @@ -424,8 +471,8 @@ msgstr ":mod:`test.support` モジュールでは、以下の定数を定義し #: ../../library/test.rst:237 msgid "" "``True`` when verbose output is enabled. Should be checked when more " -"detailed information is desired about a running test. *verbose* is set by :" -"mod:`test.regrtest`." +"detailed information is desired about a running test. *verbose* is set " +"by :mod:`test.regrtest`." msgstr "" "冗長な出力が有効な場合は ``True`` です。実行中のテストについてのより詳細な情" "報が欲しいときにチェックします。 *verbose* は :mod:`test.regrtest` によって設" @@ -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`." +"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`." +"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`." +"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,13 @@ 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 +664,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." +"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." +"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 +774,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 +815,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 +830,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 +851,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,64 +872,75 @@ 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." +"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 "" -"A context managers that temporarily replaces the named stream with :class:" -"`io.StringIO` object." +"A context managers that temporarily replaces the named stream " +"with :class:`io.StringIO` object." msgstr "" "名前付きストリ-ムを :class:`io.StringIO` オブジェクトで一時的に置き換えるコ" "ンテキストマネージャです。" @@ -856,7 +949,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 +956,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 +974,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." +"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 "" @@ -997,20 +1121,21 @@ msgstr "" #: ../../library/test.rst:716 msgid "" -"A decorator to conditionally mark tests with :func:`unittest." -"expectedFailure`. Any use of this decorator should have an associated " -"comment identifying the relevant tracker issue." +"A decorator to conditionally mark tests " +"with :func:`unittest.expectedFailure`. Any use of this decorator should have " +"an associated comment identifying the relevant tracker issue." msgstr "" "ある条件で :func:`unittest.expectedFailure` の印をテストに付けるデコレー" "タ。\n" "このデコレータを使うときはいつも、関連する問題を指し示すコメントを付けておく" "べきです。" -#: ../../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 +1151,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 +1284,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 +1300,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 +1318,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`." +"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 +1362,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 +1379,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 +1393,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." +"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." +"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 +1509,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 +1533,78 @@ 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." +"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." +"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,73 +1616,102 @@ 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 "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " -"``sock`` parameter (default is :const:`~socket.AF_INET`, :const:`~socket." -"SOCK_STREAM`), and binding it to the specified host address (defaults to " -"``0.0.0.0``) with the port set to 0, eliciting an unused ephemeral port from " -"the OS. The temporary socket is then closed and deleted, and the ephemeral " -"port is returned." +"``sock`` parameter (default " +"is :const:`~socket.AF_INET`, :const:`~socket.SOCK_STREAM`), and binding it " +"to the specified host address (defaults to ``0.0.0.0``) with the port set to " +"0, eliciting an unused ephemeral port from the OS. The temporary socket is " +"then closed and deleted, and the ephemeral 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 " "test. Which one to use depends on whether the calling code is creating a " "Python socket, or if an unused port needs to be provided in a constructor or " "passed to an external program (i.e. the ``-accept`` argument to openssl's " -"s_server mode). Always prefer :func:`bind_port` over :func:" -"`find_unused_port` where possible. Using a hard coded port is discouraged " -"since it can make multiple instances of the test impossible to run " -"simultaneously, which is a problem for buildbots." -msgstr "" +"s_server mode). Always prefer :func:`bind_port` " +"over :func:`find_unused_port` where possible. Using a hard coded port is " +"discouraged 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 " "important as many tests may be running simultaneously, especially in a " -"buildbot environment. This method raises an exception if the ``sock." -"family`` is :const:`~socket.AF_INET` and ``sock.type`` is :const:`~socket." -"SOCK_STREAM`, and the socket has :const:`~socket.SO_REUSEADDR` or :const:" -"`~socket.SO_REUSEPORT` set on it. Tests should never set these socket " -"options for TCP/IP sockets. The only case for setting these options is " -"testing multicasting via multiple UDP sockets." +"buildbot environment. This method raises an exception if the " +"``sock.family`` is :const:`~socket.AF_INET` and ``sock.type`` " +"is :const:`~socket.SOCK_STREAM`, and the socket " +"has :const:`~socket.SO_REUSEADDR` or :const:`~socket.SO_REUSEPORT` set on " +"it. Tests should never set these socket 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." +"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 +1725,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 +1759,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 +1793,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." +"*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 +1857,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 +1877,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 +1907,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`." +"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 +1975,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 +1994,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 +2030,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 +2063,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 +2084,16 @@ 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__`." +"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 +2101,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 +2113,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 +2137,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 +2159,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." +"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 "" @@ -1906,8 +2200,8 @@ msgstr "" msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " -"If *name* is ``None``, the temporary directory is created using :func:" -"`tempfile.mkdtemp`." +"If *name* is ``None``, the temporary directory is created " +"using :func:`tempfile.mkdtemp`." msgstr "" "一時的にカレントディレクトリを変更する前に、カレントディレクトリに *name* と" "いう名前のディレクトリを作成します。\n" @@ -1930,24 +2224,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." +"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" @@ -1974,9 +2274,10 @@ msgid "" "that unlike :func:`reload`, the original module is not affected by this " "operation." msgstr "" -"この関数は、 *name* で指定された Python モジュールを、インポート前に ``sys." -"modules`` から削除することで新規にインポートしてそのコピーを返します。 :func:" -"`reload` 関数と違い、もとのモジュールはこの操作によって影響をうけません。" +"この関数は、 *name* で指定された Python モジュールを、インポート前に " +"``sys.modules`` から削除することで新規にインポートしてそのコピーを返しま" +"す。 :func:`reload` 関数と違い、もとのモジュールはこの操作によって影響をうけ" +"ません。" #: ../../library/test.rst:1606 msgid "" @@ -2019,10 +2320,9 @@ msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "" -"指定したモジュールがインポートできなかった場合に、この関数は :exc:" -"`ImportError` を送出します。" +"指定したモジュールがインポートできなかった場合に、この関数" +"は :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 +2331,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 "" @@ -2039,69 +2346,86 @@ msgid "" "imported." msgstr "" "この関数は *name* で指定されたモジュールをインポートして返します。通常のイン" -"ポートと異なり、この関数はモジュールをインポートできなかった場合に :exc:" -"`unittest.SkipTest` 例外を発生させます。" +"ポートと異なり、この関数はモジュールをインポートできなかった場合" +"に :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::" +"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,48 +2437,70 @@ 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::" +"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 " "will be converted to a :exc:`SyntaxError` when turned into error. *testcase* " "is the :mod:`unittest` instance for the test. *errtext* is the regular " -"expression which should match the string representation of the emitted :exc:" -"`SyntaxWarning` and raised :exc:`SyntaxError`. If *lineno* is not ``None``, " -"compares to the line of the warning and exception. If *offset* is not " -"``None``, compares to the offset of the exception." +"expression which should match the string representation of the " +"emitted :exc:`SyntaxWarning` and raised :exc:`SyntaxError`. If *lineno* is " +"not ``None``, 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 " -"equivalent to calling ``warnings.catch_warnings(record=True)`` with :meth:" -"`warnings.simplefilter` set to ``always`` and with the option to " +"equivalent to calling ``warnings.catch_warnings(record=True)`` " +"with :meth:`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 +2525,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 "" @@ -2199,11 +2543,12 @@ msgid "" "return ``None``." msgstr "" "コンテキストマネージャーに入る時、 :class:`WarningRecorder` インスタンスが返" -"されます。このレコーダーオブジェクトの :attr:`warnings` 属性から、 :func:" -"`~warnings.catch_warnings` から得られる警告のリストを取得することができます。" -"便利さのために、レコーダーオブジェクトから直接、一番最近に発生した警告を表す" -"オブジェクトの属性にアクセスできます(以下にある例を参照してください)。警告が1" -"つも発生しなかった場合、それらの全ての属性は ``None`` を返します。" +"されます。このレコーダーオブジェクトの :attr:`warnings` 属性か" +"ら、 :func:`~warnings.catch_warnings` から得られる警告のリストを取得すること" +"ができます。便利さのために、レコーダーオブジェクトから直接、一番最近に発生し" +"た警告を表すオブジェクトの属性にアクセスできます(以下にある例を参照してくださ" +"い)。警告が1つも発生しなかった場合、それらの全ての属性は ``None`` を返しま" +"す。" #: ../../library/test.rst:1775 msgid "" @@ -2216,20 +2561,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 @@ -2265,8 +2612,8 @@ msgstr "新しいオプション引数 *filters* と *quiet*" #: ../../library/test.rst:1811 msgid "" -"Class used to record warnings for unit tests. See documentation of :func:" -"`check_warnings` above for more details." +"Class used to record warnings for unit tests. See documentation " +"of :func:`check_warnings` above for more details." msgstr "" -"ユニットテスト時に warning を記録するためのクラスです。上の、 :func:" -"`check_warnings` のドキュメントを参照してください。" +"ユニットテスト時に warning を記録するためのクラスです。上" +"の、 :func:`check_warnings` のドキュメントを参照してください。" 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..f36448224 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 @@ -36,59 +36,57 @@ msgstr "**ソースコード:** :source:`Lib/textwrap.py`" #: ../../library/textwrap.rst:14 msgid "" -"The :mod:`textwrap` module provides some convenience functions, as well as :" -"class:`TextWrapper`, the class that does all the work. If you're just " +"The :mod:`textwrap` module provides some convenience functions, as well " +"as :class:`TextWrapper`, the class that does all the work. If you're just " "wrapping or filling one or two text strings, the convenience functions " -"should be good enough; otherwise, you should use an instance of :class:" -"`TextWrapper` for efficiency." +"should be good enough; otherwise, you should use an instance " +"of :class:`TextWrapper` for efficiency." msgstr "" ":mod:`textwrap` モジュールは、実際の処理を行う :class:`TextWrapper` ととも" "に、いくつかの便利な関数を提供しています。1つか2つの文字列を wrap あるいは " "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 "" -"Optional keyword arguments correspond to the instance attributes of :class:" -"`TextWrapper`, documented below." +"Optional keyword arguments correspond to the instance attributes " +"of :class:`TextWrapper`, documented below." msgstr "" "オプションのキーワード引数は、以下で説明する :class:`TextWrapper` のインスタ" "ンス属性に対応しています。" #: ../../library/textwrap.rst:34 msgid "" -"See the :meth:`TextWrapper.wrap` method for additional details on how :func:" -"`wrap` behaves." +"See the :meth:`TextWrapper.wrap` method for additional details on " +"how :func:`wrap` behaves." 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 "" -"In particular, :func:`fill` accepts exactly the same keyword arguments as :" -"func:`wrap`." +"In particular, :func:`fill` accepts exactly the same keyword arguments " +"as :func:`wrap`." msgstr "" "特に、 :func:`fill` は :func:`wrap` とまったく同じ名前のキーワード引数を受け" "取ります。" @@ -111,7 +109,6 @@ msgstr "" "に収まらない場合、残りの文字数と *placeholder* との和が *width* 内に収まる" "ように、末尾から単語が切り捨てられます::" -#: ../../library/textwrap.rst:65 msgid "" ">>> textwrap.shorten(\"Hello world!\", width=12)\n" "'Hello world!'\n" @@ -120,20 +117,27 @@ 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 "" -"Optional keyword arguments correspond to the instance attributes of :class:" -"`TextWrapper`, documented below. Note that the whitespace is collapsed " -"before the text is passed to the :class:`TextWrapper` :meth:`fill` function, " -"so changing the value of :attr:`.tabsize`, :attr:`.expand_tabs`, :attr:`." -"drop_whitespace`, and :attr:`.replace_whitespace` will have no effect." +"Optional keyword arguments correspond to the instance attributes " +"of :class:`TextWrapper`, documented below. Note that the whitespace is " +"collapsed before the text is passed to the :class:`TextWrapper` :meth:`fill` " +"function, so changing the value " +"of :attr:`.tabsize`, :attr:`.expand_tabs`, :attr:`.drop_whitespace`, " +"and :attr:`.replace_whitespace` will have no effect." msgstr "" "オプションのキーワード引数は、以下で説明する :class:`TextWrapper` インスタン" "スの属性に対応します。文字列が :class:`TextWrapper` の :meth:`fill` 関数に渡" -"される前に、空白が折りたたまれます。そのため、:attr:`.tabsize`、:attr:`." -"expand_tabs`、:attr:`.drop_whitespace`、:attr:`.replace_whitespace` の値を変" -"更しても、意味がありません。" +"される前に、空白が折りたたまれます。そのた" +"め、:attr:`.tabsize`、:attr:`.expand_tabs`、:attr:`.drop_whitespace`、:attr:`.replace_whitespace` " +"の値を変更しても、意味がありません。" #: ../../library/textwrap.rst:82 msgid "Remove any common leading whitespace from every line in *text*." @@ -170,7 +174,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 +184,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 +209,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 +228,6 @@ msgstr "" "できます。例えば、空行や空白文字のみの行にも *prefix* を追加するのは簡単で" "す::" -#: ../../library/textwrap.rst:125 msgid "" ">>> print(indent(s, '+ ', lambda line: True))\n" "+ hello\n" @@ -223,26 +235,31 @@ msgid "" "+\n" "+ world" msgstr "" +">>> print(indent(s, '+ ', lambda line: True))\n" +"+ hello\n" +"+\n" +"+\n" +"+ world" #: ../../library/textwrap.rst:134 msgid "" -":func:`wrap`, :func:`fill` and :func:`shorten` work by creating a :class:" -"`TextWrapper` instance and calling a single method on it. That instance is " -"not reused, so for applications that process many text strings using :func:" -"`wrap` and/or :func:`fill`, it may be more efficient to create your own :" -"class:`TextWrapper` object." +":func:`wrap`, :func:`fill` and :func:`shorten` work by creating " +"a :class:`TextWrapper` instance and calling a single method on it. That " +"instance is not reused, so for applications that process many text strings " +"using :func:`wrap` and/or :func:`fill`, it may be more efficient to create " +"your own :class:`TextWrapper` object." msgstr "" ":func:`wrap`、:func:`fill`、:func:`shorten` は :class:`TextWrapper` インスタ" "ンスを作成し、その一つのメソッドを呼び出すことで機能します。そのインスタンス" "は再利用されません。したがって、:func:`wrap` や :func:`fill` を使用して多くの" -"テキスト文字列を処理するアプリケーションについては、独自の :class:" -"`TextWrapper` オブジェクトを作成する方が効率が良い方法でしょう。" +"テキスト文字列を処理するアプリケーションについては、独自" +"の :class:`TextWrapper` オブジェクトを作成する方が効率が良い方法でしょう。" #: ../../library/textwrap.rst:140 msgid "" "Text is preferably wrapped on whitespaces and right after the hyphens in " -"hyphenated words; only then will long words be broken if necessary, unless :" -"attr:`TextWrapper.break_long_words` is set to false." +"hyphenated words; only then will long words be broken if necessary, " +"unless :attr:`TextWrapper.break_long_words` is set to false." msgstr "" "テキストはなるべく空白か、ハイフンを含む語のハイフンの直後で折り返されま" "す。 :attr:`TextWrapper.break_long_words` が偽に設定されていなければ、必要な" @@ -258,28 +275,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 "" @@ -292,13 +309,13 @@ msgstr "" #: ../../library/textwrap.rst:167 msgid "" "(default: ``70``) The maximum length of wrapped lines. As long as there are " -"no individual words in the input text longer than :attr:`width`, :class:" -"`TextWrapper` guarantees that no output line will be longer than :attr:" -"`width` characters." +"no individual words in the input text longer " +"than :attr:`width`, :class:`TextWrapper` guarantees that no output line will " +"be longer than :attr:`width` characters." msgstr "" -"(デフォルト: ``70``) 折り返しが行われる行の最大の長さ。入力行に :attr:" -"`width` より長い単一の語が無い限り、 :class:`TextWrapper` は :attr:`width` 文" -"字より長い出力行が無いことを保証します。" +"(デフォルト: ``70``) 折り返しが行われる行の最大の長さ。入力行" +"に :attr:`width` より長い単一の語が無い限り、 :class:`TextWrapper` " +"は :attr:`width` 文字より長い出力行が無いことを保証します。" #: ../../library/textwrap.rst:175 msgid "" @@ -319,8 +336,8 @@ msgstr "" #: ../../library/textwrap.rst:190 msgid "" -"(default: ``True``) If true, after tab expansion but before wrapping, the :" -"meth:`wrap` method will replace each whitespace character with a single " +"(default: ``True``) If true, after tab expansion but before wrapping, " +"the :meth:`wrap` method will replace each whitespace character with a single " "space. The whitespace characters replaced are as follows: tab, newline, " "vertical tab, formfeed, and carriage return (``'\\t\\n\\v\\f\\r'``)." msgstr "" @@ -379,7 +396,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 +406,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 +454,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 +462,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 "" @@ -480,24 +494,23 @@ msgstr "" #: ../../library/textwrap.rst:300 msgid "" -"Wraps the single paragraph in *text* (a string) so every line is at most :" -"attr:`width` characters long. All wrapping options are taken from instance " -"attributes of the :class:`TextWrapper` instance. Returns a list of output " -"lines, without final newlines. If the wrapped output has no content, the " -"returned list is empty." +"Wraps the single paragraph in *text* (a string) so every line is at " +"most :attr:`width` characters long. All wrapping options are taken from " +"instance attributes of the :class:`TextWrapper` instance. Returns a list of " +"output lines, without final newlines. If the wrapped output has no content, " +"the returned list is empty." msgstr "" "1段落の文字列 *text* を、各行が :attr:`width` 文字以下になるように wrap しま" "す。 wrap のすべてのオプションは :class:`TextWrapper` インスタンスの属性から" "取得します。結果の、行末に改行のない行のリストを返します。出力の内容が空にな" "る場合は、返すリストも空になります。" -#: ../../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..e19c8640f 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 @@ -41,27 +41,24 @@ msgid "" "This module constructs higher-level threading interfaces on top of the lower " "level :mod:`_thread` module." msgstr "" -"このモジュールでは、高水準のスレッドインターフェースをより低水準 な :mod:" -"`_thread` モジュールの上に構築しています。" +"このモジュールでは、高水準のスレッドインターフェースをより低水準 " +"な :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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/threading.rst:17 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 "" @@ -151,23 +192,23 @@ msgid "" "lock>`, only one thread can execute Python code at once (even though certain " "performance-oriented libraries might overcome this limitation). If you want " "your application to make better use of the computational resources of multi-" -"core machines, you are advised to use :mod:`multiprocessing` or :class:" -"`concurrent.futures.ProcessPoolExecutor`. However, threading is still an " -"appropriate model if you want to run multiple I/O-bound tasks simultaneously." +"core machines, you are advised to use :mod:`multiprocessing` " +"or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is " +"still an appropriate model if you want to run multiple I/O-bound tasks " +"simultaneously." msgstr "" "CPython は :term:`Global Interpreter Lock ` のため、" "ある時点で Python コードを実行できるスレッドは1つに限られます (ただし、いくつ" "かのパフォーマンスが強く求められるライブラリはこの制限を克服しています)。アプ" -"リケーションにマルチコアマシンの計算能力をより良く利用させたい場合は、 :mod:" -"`multiprocessing` モジュールや :class:`concurrent.futures." -"ProcessPoolExecutor` の利用をお勧めします。 ただし、I/Oバウンドなタスクを並行" -"して複数走らせたい場合においては、 マルチスレッドは正しい選択肢です。" +"リケーションにマルチコアマシンの計算能力をより良く利用させたい場合" +"は、 :mod:`multiprocessing` モジュール" +"や :class:`concurrent.futures.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 +218,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 "" @@ -198,24 +246,25 @@ msgid "" "Return the number of :class:`Thread` objects currently alive. The returned " "count is equal to the length of the list returned by :func:`.enumerate`." msgstr "" -"生存中の :class:`Thread` オブジェクトの数を返します。この数は :func:`." -"enumerate` の返すリストの長さと同じです。" +"生存中の :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 +282,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,25 +356,27 @@ 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 "" "Return a list of all :class:`Thread` objects currently active. The list " -"includes daemonic threads and dummy thread objects created by :func:" -"`current_thread`. It excludes terminated threads and threads that have not " -"yet been started. However, the main thread is always part of the result, " -"even when terminated." +"includes daemonic threads and dummy thread objects created " +"by :func:`current_thread`. It excludes terminated threads and threads that " +"have not yet been started. However, the main thread is always part of the " +"result, even when terminated." msgstr "" "現在、アクティブな :class:`Thread` オブジェクト全てのリストを返します。リスト" "には、デーモンスレッド (daemonic thread)、 :func:`current_thread` の生成する" @@ -331,18 +392,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 +419,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 "" @@ -383,9 +452,9 @@ msgid "" "*size* argument specifies the stack size to be used for subsequently created " "threads, and must be 0 (use platform or configured default) or a positive " "integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " -"used. If changing the thread stack size is unsupported, a :exc:" -"`RuntimeError` is raised. If the specified stack size is invalid, a :exc:" -"`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"used. If changing the thread stack size is unsupported, " +"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " +"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " "currently the minimum supported stack size value to guarantee sufficient " "stack space for the interpreter itself. Note that some platforms may have " "particular restrictions on values for the stack size, such as requiring a " @@ -399,35 +468,34 @@ msgstr "" "*size* 引数にはこれ以降に作成するスレッドのスタックサイズを指定し、0 (プラッ" "トフォームのデフォルト値または設定されたデフォルト値) か、 32,768 (32 KiB) 以" "上の正の整数でなければなりません。*size* が指定されない場合 0 が使われます。" -"スレッドのスタックサイズの変更がサポートされていない場合、 :exc:" -"`RuntimeError` を送出します。不正なスタックサイズが指定された場合、 :exc:" -"`ValueError` を送出して、スタックサイズは変更されません。32 KiB は現在のイン" -"タープリタ自身のために十分であると保証された最小のスタックサイズです。いくつ" -"かのプラットフォームではスタックサイズに対して制限があることに注意してくださ" -"い。例えば最小のスタックサイズが 32 KiB より大きかったり、システムのメモリ" -"ページサイズ の整数倍の必要があるなどです。この制限についてはプラットフォーム" -"のドキュメントを参照してください (一般的なページサイズは 4 KiB なので、プラッ" -"トフォームに関する情報がない場合は 4096 の整数倍のスタックサイズを選ぶといい" -"かもしれません)。" - -#: ../../library/threading.rst:295 +"スレッドのスタックサイズの変更がサポートされていない場" +"合、 :exc:`RuntimeError` を送出します。不正なスタックサイズが指定された場" +"合、 :exc:`ValueError` を送出して、スタックサイズは変更されません。32 KiB は" +"現在のインタープリタ自身のために十分であると保証された最小のスタックサイズで" +"す。いくつかのプラットフォームではスタックサイズに対して制限があることに注意" +"してください。例えば最小のスタックサイズが 32 KiB より大きかったり、システム" +"のメモリページサイズ の整数倍の必要があるなどです。この制限についてはプラット" +"フォームのドキュメントを参照してください (一般的なページサイズは 4 KiB なの" +"で、プラットフォームに関する情報がない場合は 4096 の整数倍のスタックサイズを" +"選ぶといいかもしれません)。" + 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`." +"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 "" @@ -449,41 +517,43 @@ msgid "" msgstr "" "このモジュールのおおまかな設計は Java のスレッドモデルに基づいています。とは" "いえ、 Java がロックと条件変数を全てのオブジェクトの基本的な挙動にしているの" -"に対し、 Python ではこれらを別個のオブジェクトに分けています。 Python の :" -"class:`Thread` クラスがサポートしているのは Java の Thread クラスの挙動のサブ" -"セットにすぎません; 現状では、優先度 (priority)やスレッドグループがなく、ス" -"レッドの破壊 (destroy)、中断 (stop)、一時停止 (suspend)、復帰 (resume)、割り" -"込み (interrupt) は行えません。 Java の Thread クラスにおける静的メソッドに対" -"応する機能が実装されている場合にはモジュールレベルの関数になっています。" +"に対し、 Python ではこれらを別個のオブジェクトに分けています。 Python " +"の :class:`Thread` クラスがサポートしているのは Java の Thread クラスの挙動の" +"サブセットにすぎません; 現状では、優先度 (priority)やスレッドグループがなく、" +"スレッドの破壊 (destroy)、中断 (stop)、一時停止 (suspend)、復帰 (resume)、割" +"り込み (interrupt) は行えません。 Java の Thread クラスにおける静的メソッドに" +"対応する機能が実装されている場合にはモジュールレベルの関数になっています。" #: ../../library/threading.rst:321 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 +562,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,35 +587,54 @@ 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 " -"the time the attribute was read. For that reason, you generally don't want " -"to save these values across threads, as they apply only to the thread they " -"came from." +"Of course, values you get from a :class:`local` object, including " +"their :attr:`~object.__dict__` attribute, are for whatever thread was " +"current at the time the attribute was read. For that reason, you generally " +"don't want 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::" +"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 +643,66 @@ 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 +711,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 +729,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 +752,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,23 +796,31 @@ 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 "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " -"normally, or by raising an unhandled exception. The :meth:`~Thread." -"is_alive` method tests whether the thread is alive." +"normally, or by raising an unhandled exception. " +"The :meth:`~Thread.is_alive` method tests whether the thread is alive." msgstr "" "スレッドの活動が始まると、スレッドは '生存中 (alive)' とみなされます。 スレッ" "ドは、通常 :meth:`~Thread.run` メソッドが終了するまで、もしくは捕捉されない例" @@ -718,18 +842,18 @@ msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -"スレッドは名前を持っています。名前はコンストラクタに渡すことができ、 :attr:" -"`~Thread.name` 属性を通して読み出したり変更したりできます。" +"スレッドは名前を持っています。名前はコンストラクタに渡すことがで" +"き、 :attr:`~Thread.name` 属性を通して読み出したり変更したりできます。" #: ../../library/threading.rst:482 msgid "" -"If the :meth:`~Thread.run` method raises an exception, :func:`threading." -"excepthook` is called to handle it. By default, :func:`threading.excepthook` " -"ignores silently :exc:`SystemExit`." +"If the :meth:`~Thread.run` method raises an " +"exception, :func:`threading.excepthook` is called to handle it. By " +"default, :func:`threading.excepthook` ignores silently :exc:`SystemExit`." msgstr "" -":meth:`~Thread.run` メソッドが例外を発生させた場合、:func:`threading." -"excepthook` が呼び出され、例外を処理します。デフォルトでは、:func:`threading." -"excepthook` は :exc:`SystemExit` を黙殺します。" +":meth:`~Thread.run` メソッドが例外を発生させた場" +"合、:func:`threading.excepthook` が呼び出され、例外を処理します。デフォルトで" +"は、:func:`threading.excepthook` は :exc:`SystemExit` を黙殺します。" #: ../../library/threading.rst:486 msgid "" @@ -780,10 +904,10 @@ msgstr "" "\"ダミースレッドオブジェクト (dummy thread objects)\" が作成される場合があり" "ます。ダミースレッドは、 \"外来スレッド (alien thread)\" に相当するスレッドオ" "ブジェクトです。ダミースレッドは、C コードから直接生成されたスレッドのよう" -"な、 :mod:`threading` モジュールの外で開始された処理スレッドです。ダミース" -"レッドオブジェクトには限られた機能しかなく、常に生存中、かつデーモンスレッド" -"であるとみなされ、 :ref:`join ` できません。また、外来ス" -"レッドの終了を検出するのは不可能なので、ダミースレッドは削除できません。" +"な、 ``threading`` モジュールの外で開始された処理スレッドです。ダミースレッド" +"オブジェクトには限られた機能しかなく、常に生存中、かつデーモンスレッドである" +"とみなされ、 :ref:`join ` できません。また、外来スレッドの" +"終了を検出するのは不可能なので、ダミースレッドは削除できません。" #: ../../library/threading.rst:512 msgid "" @@ -807,7 +931,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 +938,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,32 +967,40 @@ 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:" -"`sys.flags.thread_inherit_context` flag controls the behaviour. If the flag " -"is true, threads will start with a copy of the context of the caller of :" -"meth:`~Thread.start`. If false, they will start with an empty context. To " -"explicitly start with an empty context, pass a new instance of :class:" -"`~contextvars.Context()`. To explicitly start with a copy of the current " -"context, pass the value from :func:`~contextvars.copy_context`. The flag " -"defaults true on free-threaded builds and false otherwise." -msgstr "" +"the thread. The default value is ``None`` which indicates that " +"the :data:`sys.flags.thread_inherit_context` flag controls the behaviour. " +"If the flag is true, threads will start with a copy of the context of the " +"caller of :meth:`~Thread.start`. If false, they will start with an empty " +"context. To explicitly start with an empty context, pass a new instance " +"of :class:`~contextvars.Context()`. To explicitly start with a copy of the " +"current 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,28 +1020,30 @@ 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 "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -"同じスレッドオブジェクトに対し、このメソッドを2回以上呼び出した場合、 :exc:" -"`RuntimeError` を送出します。" +"同じスレッドオブジェクトに対し、このメソッドを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." +"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." @@ -930,8 +1063,8 @@ msgstr "" #: ../../library/threading.rst:585 msgid "" -"Using list or tuple as the *args* argument which passed to the :class:" -"`Thread` could achieve the same effect." +"Using list or tuple as the *args* argument which passed to " +"the :class:`Thread` could achieve the same effect." msgstr "" ":class:`Thread` に渡される *args* の引数にリストやタプルを使っても、同じ効果" "が得られます。" @@ -940,7 +1073,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/threading.rst:590 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -950,6 +1082,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 "" @@ -969,8 +1108,8 @@ msgid "" "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof). As :meth:`~Thread.join` always returns ``None``, you " "must call :meth:`~Thread.is_alive` after :meth:`~Thread.join` to decide " -"whether a timeout happened -- if the thread is still alive, the :meth:" -"`~Thread.join` call timed out." +"whether a timeout happened -- if the thread is still alive, " +"the :meth:`~Thread.join` call timed out." msgstr "" #: ../../library/threading.rst:614 @@ -1004,9 +1143,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 +1156,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 +1198,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 +1205,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." @@ -1080,9 +1229,10 @@ msgid "" "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -"このメソッドは、 :meth:`~Thread.run` メソッドが起動する直前から :meth:" -"`~Thread.run` メソッドが終了する直後までの間 ``True`` を返します。モジュール" -"関数 :func:`.enumerate` は、全ての生存中のスレッドのリストを返します。" +"このメソッドは、 :meth:`~Thread.run` メソッドが起動する直前か" +"ら :meth:`~Thread.run` メソッドが終了する直後までの間 ``True`` を返します。モ" +"ジュール関数 :func:`.enumerate` は、全ての生存中のスレッドのリストを返しま" +"す。" #: ../../library/threading.rst:692 msgid "" @@ -1090,8 +1240,8 @@ msgid "" "or not (``False``). This must be set before :meth:`~Thread.start` is " "called, otherwise :exc:`RuntimeError` is raised. Its initial value is " "inherited from the creating thread; the main thread is not a daemon thread " -"and therefore all threads created in the main thread default to :attr:" -"`~Thread.daemon` = ``False``." +"and therefore all threads created in the main thread default " +"to :attr:`~Thread.daemon` = ``False``." msgstr "" "このスレッドがデーモンスレッドか (``True``) か否か (``False``) を示すブール" "値。この値は :meth:`~Thread.start` の呼び出し前に設定されなければなりません。" @@ -1115,16 +1265,15 @@ msgstr "" ":attr:`~Thread.daemon` に対する非推奨 getter/setter API; 代わりにプロパティを" "直接使用してください。" -#: ../../library/threading.rst:713 msgid "Lock objects" -msgstr "" +msgstr "Lock オブジェクト" #: ../../library/threading.rst:715 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " -"synchronization primitive available, implemented directly by the :mod:" -"`_thread` extension module." +"synchronization primitive available, implemented directly by " +"the :mod:`_thread` extension module." msgstr "" "プリミティブロックとは、ロックが生じた際に特定のスレッドによって所有されない" "同期プリミティブです。 Python では現在のところ拡張モジュール :mod:`_thread` " @@ -1133,27 +1282,27 @@ msgstr "" #: ../../library/threading.rst:720 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " -"created in the unlocked state. It has two basic methods, :meth:`~Lock." -"acquire` and :meth:`~Lock.release`. When the state is unlocked, :meth:" -"`~Lock.acquire` changes the state to locked and returns immediately. When " -"the state is locked, :meth:`~Lock.acquire` blocks until a call to :meth:" -"`~Lock.release` in another thread changes it to unlocked, then the :meth:" -"`~Lock.acquire` call resets it to locked and returns. The :meth:`~Lock." -"release` method should only be called in the locked state; it changes the " -"state to unlocked and returns immediately. If an attempt is made to release " -"an unlocked lock, a :exc:`RuntimeError` will be raised." +"created in the unlocked state. It has two basic " +"methods, :meth:`~Lock.acquire` and :meth:`~Lock.release`. When the state is " +"unlocked, :meth:`~Lock.acquire` changes the state to locked and returns " +"immediately. When the state is locked, :meth:`~Lock.acquire` blocks until a " +"call to :meth:`~Lock.release` in another thread changes it to unlocked, then " +"the :meth:`~Lock.acquire` call resets it to locked and returns. " +"The :meth:`~Lock.release` method should only be called in the locked state; " +"it changes the state to unlocked and returns immediately. If an attempt is " +"made to release an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" "プリミティブロックは2つの状態、 \"ロック\" または \"アンロック\" があります。" -"ロックはアンロック状態で作成されます。ロックには基本となる二つのメソッド、 :" -"meth:`~Lock.acquire` と :meth:`~Lock.release` があります。ロックの状態がアン" -"ロックである場合、 :meth:`~Lock.acquire` は状態をロックに変更して即座に処理を" -"戻します。 状態がロックの場合、 :meth:`~Lock.acquire` は他のスレッドが :meth:" -"`~Lock.release` を呼び出してロックの状態をアンロックに変更するまでブロックし" -"ます。その後、 :meth:`~Lock.acquire` 呼び出しは状態を再度ロックに設定してから" -"処理を戻します。 :meth:`~Lock.release` メソッドを呼び出すのはロック状態のとき" -"でなければなりません; このメソッドはロックの状態をアンロックに変更して、即座" -"に処理を戻します。 アンロックの状態のロックを解放しようとすると :exc:" -"`RuntimeError` が送出されます。" +"ロックはアンロック状態で作成されます。ロックには基本となる二つのメソッ" +"ド、 :meth:`~Lock.acquire` と :meth:`~Lock.release` があります。ロックの状態" +"がアンロックである場合、 :meth:`~Lock.acquire` は状態をロックに変更して即座に" +"処理を戻します。 状態がロックの場合、 :meth:`~Lock.acquire` は他のスレッド" +"が :meth:`~Lock.release` を呼び出してロックの状態をアンロックに変更するまでブ" +"ロックします。その後、 :meth:`~Lock.acquire` 呼び出しは状態を再度ロックに設定" +"してから処理を戻します。 :meth:`~Lock.release` メソッドを呼び出すのはロック状" +"態のときでなければなりません; このメソッドはロックの状態をアンロックに変更し" +"て、即座に処理を戻します。 アンロックの状態のロックを解放しようとする" +"と :exc:`RuntimeError` が送出されます。" #: ../../library/threading.rst:731 msgid "Locks also support the :ref:`context management protocol `." @@ -1164,9 +1313,9 @@ msgstr "" #: ../../library/threading.rst:733 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " -"the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." -"release` call resets the state to unlocked; which one of the waiting threads " -"proceeds is not defined, and may vary across implementations." +"the state to turn to unlocked, only one thread proceeds when " +"a :meth:`~Lock.release` call resets the state to unlocked; which one of the " +"waiting threads proceeds is not defined, and may vary across implementations." msgstr "" "複数のスレッドにおいて :meth:`~Lock.acquire` がアンロック状態への遷移を待って" "いるためにブロックが起きている時に :meth:`~Lock.release` を呼び出してロックの" @@ -1188,11 +1337,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 +1395,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 +1437,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 "" @@ -1307,17 +1457,21 @@ msgstr "" #: ../../library/threading.rst:814 msgid "" -"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" -"meth:`~Lock.release` method to unlock it." +"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and " +"its :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." +"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 +1482,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 +1516,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 +1540,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 +1599,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." +"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 "" @@ -1466,40 +1632,41 @@ msgstr "" msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " -"duration of the enclosed block. The :meth:`~Condition.acquire` and :meth:" -"`~Condition.release` methods also call the corresponding methods of the " -"associated lock." +"duration of the enclosed block. The :meth:`~Condition.acquire` " +"and :meth:`~Condition.release` methods also call the corresponding methods " +"of the associated lock." msgstr "" "条件変数は :ref:`コンテキスト管理プロトコル ` に従います: " "``with`` 文を使って囲まれたブロックの間だけ関連付けられたロックを獲得すること" -"ができます。 :meth:`~Condition.acquire` メソッドと :meth:`~Condition." -"release` メソッドは、さらに関連付けられたロックの対応するメソッドを呼び出しま" -"す。" +"ができます。 :meth:`~Condition.acquire` メソッド" +"と :meth:`~Condition.release` メソッドは、さらに関連付けられたロックの対応す" +"るメソッドを呼び出します。" #: ../../library/threading.rst:929 msgid "" -"Other methods must be called with the associated lock held. The :meth:" -"`~Condition.wait` method releases the lock, and then blocks until another " -"thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition." -"notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock " -"and returns. It is also possible to specify a timeout." +"Other methods must be called with the associated lock held. " +"The :meth:`~Condition.wait` method releases the lock, and then blocks until " +"another thread awakens it by calling :meth:`~Condition.notify` " +"or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-" +"acquires the lock and returns. It is also possible to specify a timeout." msgstr "" "他のメソッドは、関連付けられたロックを保持した状態で呼び出さなければなりませ" "ん。 :meth:`~Condition.wait` メソッドはロックを解放します。そして別のスレッド" "が :meth:`~Condition.notify` または :meth:`~Condition.notify_all` を呼ぶこと" -"によってスレッドを起こすまでブロックします。一旦起こされたなら、 :meth:" -"`~Condition.wait` は再びロックを得て戻ります。タイムアウトを指定することも可" -"能です。" +"によってスレッドを起こすまでブロックします。一旦起こされたな" +"ら、 :meth:`~Condition.wait` は再びロックを得て戻ります。タイムアウトを指定す" +"ることも可能です。" #: ../../library/threading.rst:935 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " -"the condition variable, if any are waiting. The :meth:`~Condition." -"notify_all` method wakes up all threads waiting for the condition variable." +"the condition variable, if any are waiting. " +"The :meth:`~Condition.notify_all` method wakes up all threads waiting for " +"the condition variable." msgstr "" -":meth:`~Condition.notify` メソッドは条件変数待ちのスレッドを1つ起こします。 :" -"meth:`~Condition.notify_all` メソッドは条件変数待ちの全てのスレッドを起こしま" -"す。" +":meth:`~Condition.notify` メソッドは条件変数待ちのスレッドを1つ起こしま" +"す。 :meth:`~Condition.notify_all` メソッドは条件変数待ちの全てのスレッドを起" +"こします。" #: ../../library/threading.rst:939 msgid "" @@ -1511,31 +1678,30 @@ msgid "" msgstr "" "注意: :meth:`~Condition.notify` と :meth:`~Condition.notify_all` はロックを解" "放しません; 従って、スレッドが起こされたとき、 :meth:`~Condition.wait` の呼び" -"出しは即座に処理を戻すわけではなく、 :meth:`~Condition.notify` または :meth:" -"`~Condition.notify_all` を呼び出したスレッドが最終的にロックの所有権を放棄し" -"たときに初めて処理を返すのです。" +"出しは即座に処理を戻すわけではなく、 :meth:`~Condition.notify` また" +"は :meth:`~Condition.notify_all` を呼び出したスレッドが最終的にロックの所有権" +"を放棄したときに初めて処理を返すのです。" #: ../../library/threading.rst:945 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " "particular change of state call :meth:`~Condition.wait` repeatedly until " -"they see the desired state, while threads that modify the state call :meth:" -"`~Condition.notify` or :meth:`~Condition.notify_all` when they change the " -"state in such a way that it could possibly be a desired state for one of the " -"waiters. For example, the following code is a generic producer-consumer " -"situation with unlimited buffer capacity::" +"they see the desired state, while threads that modify the state " +"call :meth:`~Condition.notify` or :meth:`~Condition.notify_all` when they " +"change the state in such a way that it could possibly be a desired state for " +"one of the waiters. For example, the following code is a generic producer-" +"consumer situation with unlimited buffer capacity::" msgstr "" "条件変数を使う典型的なプログラミングスタイルでは、何らかの共有された状態変数" "へのアクセスを同期させるためにロックを使います; 状態変数が特定の状態に変化し" -"たことを知りたいスレッドは、自分の望む状態になるまで繰り返し :meth:" -"`~Condition.wait` を呼び出します。その一方で、状態変更を行うスレッドは、前者" -"のスレッドが待ち望んでいる状態であるかもしれないような状態へ変更を行ったとき" -"に :meth:`~Condition.notify` や :meth:`~Condition.notify_all` を呼び出しま" -"す。例えば、以下のコードは無制限のバッファ容量のときの一般的な生産者-消費者問" -"題です::" +"たことを知りたいスレッドは、自分の望む状態になるまで繰り返" +"し :meth:`~Condition.wait` を呼び出します。その一方で、状態変更を行うスレッド" +"は、前者のスレッドが待ち望んでいる状態であるかもしれないような状態へ変更を" +"行ったときに :meth:`~Condition.notify` や :meth:`~Condition.notify_all` を呼" +"び出します。例えば、以下のコードは無制限のバッファ容量のときの一般的な生産者-" +"消費者問題です::" -#: ../../library/threading.rst:954 msgid "" "# Consume one item\n" "with cv:\n" @@ -1548,38 +1714,51 @@ 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 "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " "the condition which prompted the :meth:`~Condition.notify` call may no " -"longer hold true. This is inherent to multi-threaded programming. The :" -"meth:`~Condition.wait_for` method can be used to automate the condition " +"longer hold true. This is inherent to multi-threaded programming. " +"The :meth:`~Condition.wait_for` method can be used to automate the condition " "checking, and eases the computation of timeouts::" msgstr "" -"アプリケーションの条件をチェックする ``while`` ループは必須です。なぜなら、 :" -"meth:`~Condition.wait` が任意の長時間の後で返り、 :meth:`~Condition.notify` " -"呼び出しを促した条件がもはや真でないことがありえるからです。これはマルチス" -"レッドプログラミングに固有です。条件チェックを自動化するために :meth:" -"`~Condition.wait_for` メソッドを使うことができ、それはタイムアウトの計算を簡" -"略化します::" +"アプリケーションの条件をチェックする ``while`` ループは必須です。なぜな" +"ら、 :meth:`~Condition.wait` が任意の長時間の後で返" +"り、 :meth:`~Condition.notify` 呼び出しを促した条件がもはや真でないことがあり" +"えるからです。これはマルチスレッドプログラミングに固有です。条件チェックを自" +"動化するために :meth:`~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 "" -"To choose between :meth:`~Condition.notify` and :meth:`~Condition." -"notify_all`, consider whether one state change can be interesting for only " -"one or several waiting threads. E.g. in a typical producer-consumer " -"situation, adding one item to the buffer only needs to wake up one consumer " -"thread." +"To choose between :meth:`~Condition.notify` " +"and :meth:`~Condition.notify_all`, consider whether one state change can be " +"interesting for only one or several waiting threads. E.g. in a typical " +"producer-consumer situation, adding one item to the buffer only needs to " +"wake up one consumer thread." msgstr "" ":meth:`~Condition.notify` と :meth:`~Condition.notify_all` のどちらを使うか" "は、その状態の変化に興味を持っている待ちスレッドが一つだけなのか、あるいは複" @@ -1600,8 +1779,8 @@ msgid "" "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -"*lock* に ``None`` でない値を指定した場合、その値は :class:`Lock` または :" -"class:`RLock` オブジェクトでなければなりません。\n" +"*lock* に ``None`` でない値を指定した場合、その値は :class:`Lock` また" +"は :class:`RLock` オブジェクトでなければなりません。\n" "この場合、 *lock* は根底にあるロックオブジェクトとして使われます。\n" "それ以外の場合には、 :class:`RLock` オブジェクトを新しく作成して使います。" @@ -1637,17 +1816,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 "" @@ -1658,16 +1836,16 @@ msgstr "" #: ../../library/threading.rst:1026 msgid "" -"When the underlying lock is an :class:`RLock`, it is not released using its :" -"meth:`release` method, since this may not actually unlock the lock when it " -"was acquired multiple times recursively. Instead, an internal interface of " -"the :class:`RLock` class is used, which really unlocks it even when it has " -"been recursively acquired several times. Another internal interface is then " -"used to restore the recursion level when the lock is reacquired." +"When the underlying lock is an :class:`RLock`, it is not released using " +"its :meth:`release` method, since this may not actually unlock the lock when " +"it was acquired multiple times recursively. Instead, an internal interface " +"of the :class:`RLock` class is used, which really unlocks it even when it " +"has been recursively acquired several times. Another internal interface is " +"then used to restore the recursion level when the lock is reacquired." msgstr "" "根底にあるロックが :class:`RLock` である場合、 :meth:`release` メソッドでは" "ロックは解放されません。というのも、ロックが再帰的に複数回獲得されている場合" -"には、 :meth:`release` によって実際にアンロックが行われないかもしれないからで" +"には、 ``release()`` によって実際にアンロックが行われないかもしれないからで" "す。その代わり、ロックが再帰的に複数回獲得されていても確実にアンロックを行え" "る :class:`RLock` クラスの内部インターフェースを使います。その後ロックを再獲" "得する時に、もう一つの内部インターフェースを使ってロックの再帰レベルを復帰し" @@ -1703,9 +1881,9 @@ msgid "" "value of the predicate and will evaluate to ``False`` if the method timed " "out." msgstr "" -"このユーティリティメソッドは、述語が満たされるかタイムアウトが発生するまで :" -"meth:`wait` を繰り返し呼び出す場合があります。戻り値は述語の最後の戻り値で、" -"もしメソッドがタイムアウトすれば、 ``False`` と評価されます。" +"このユーティリティメソッドは、述語が満たされるかタイムアウトが発生するま" +"で :meth:`wait` を繰り返し呼び出す場合があります。戻り値は述語の最後の戻り値" +"で、もしメソッドがタイムアウトすれば、 ``False`` と評価されます。" #: ../../library/threading.rst:1051 msgid "" @@ -1715,11 +1893,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 "" @@ -1734,22 +1913,20 @@ msgstr "" #: ../../library/threading.rst:1065 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " -"calling thread has not acquired the lock when this method is called, a :exc:" -"`RuntimeError` is raised." +"calling thread has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" "デフォルトで、この条件変数を待っている1つのスレッドを起こします。 呼び出し側" -"のスレッドがロックを獲得していないときにこのメソッドを呼び出すと :exc:" -"`RuntimeError` が送出されます。" +"のスレッドがロックを獲得していないときにこのメソッドを呼び出す" +"と :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 +1934,10 @@ msgid "" "threads." msgstr "" "現在の実装では、少なくとも *n* スレッドが待機中であれば、ちょうど *n* スレッ" -"ドを起こします。とはいえ、この挙動に依存するのは安全ではありません。将来、実" -"装の最適化によって、複数のスレッドを起こすようになるかもしれないからです。" +"ドを起こします。\n" +"とはいえ、この挙動に依存するのは安全ではありません。\n" +"将来、実装の最適化によって、*n* 個を超えるスレッドを起こすことがあるかもしれ" +"ないからです。" #: ../../library/threading.rst:1077 msgid "" @@ -1767,54 +1946,52 @@ msgid "" "lock, its caller should." msgstr "" "注意: 起こされたスレッドは実際にロックを再獲得できるまで :meth:`wait` 呼び出" -"しから戻りません。 :meth:`notify` はロックを解放しないので、 :meth:`notify` " -"呼び出し側は明示的にロックを解放しなければなりません。" +"しから戻りません。 :meth:`notify` はロックを解放しないので、 ``notify()`` 呼" +"び出し側は明示的にロックを解放しなければなりません。" #: ../../library/threading.rst:1083 msgid "" -"Wake up all threads waiting on this condition. This method acts like :meth:" -"`notify`, but wakes up all waiting threads instead of one. If the calling " -"thread has not acquired the lock when this method is called, a :exc:" -"`RuntimeError` is raised." +"Wake up all threads waiting on this condition. This method acts " +"like :meth:`notify`, but wakes up all waiting threads instead of one. If the " +"calling thread has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" -"この条件を待っているすべてのスレッドを起こします。このメソッドは :meth:" -"`notify` のように動作しますが、 1 つではなくすべての待ちスレッドを起こしま" -"す。呼び出し側のスレッドがロックを獲得していない場合、 :exc:`RuntimeError` が" -"送出されます。" +"この条件を待っているすべてのスレッドを起こします。このメソッド" +"は :meth:`notify` のように動作しますが、 1 つではなくすべての待ちスレッドを起" +"こします。呼び出し側のスレッドがロックを獲得していない場" +"合、 :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 "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " -"Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore." -"acquire` and :meth:`~Semaphore.release`)." +"Dijkstra (he used the names ``P()`` and ``V()`` instead " +"of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`)." msgstr "" "セマフォ (semaphore) は、計算機科学史上最も古い同期プリミティブの一つ で、草" -"創期のオランダ計算機科学者 Edsger W. Dijkstra によって発明されました (彼は :" -"meth:`~Semaphore.acquire` と :meth:`~Semaphore.release` の代わりに ``P()`` " -"と ``V()`` を使いました)。" +"創期のオランダ計算機科学者 Edsger W. Dijkstra によって発明されました (彼" +"は :meth:`~Semaphore.acquire` と :meth:`~Semaphore.release` の代わりに " +"``P()`` と ``V()`` を使いました)。" #: ../../library/threading.rst:1101 msgid "" -"A semaphore manages an internal counter which is decremented by each :meth:" -"`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " -"call. The counter can never go below zero; when :meth:`~Semaphore.acquire` " -"finds that it is zero, it blocks, waiting until some other thread calls :" -"meth:`~Semaphore.release`." +"A semaphore manages an internal counter which is decremented by " +"each :meth:`~Semaphore.acquire` call and incremented by " +"each :meth:`~Semaphore.release` call. The counter can never go below zero; " +"when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting " +"until some other thread calls :meth:`~Semaphore.release`." msgstr "" -"セマフォは :meth:`~Semaphore.acquire` でデクリメントされ :meth:`~Semaphore." -"release` でインクリメントされるような内部カウンタを管理します。 カウンタは決" -"してゼロより小さくはなりません; :meth:`~Semaphore.acquire` は、カウンタがゼロ" -"になっている場合、他のスレッドが :meth:`~Semaphore.release` を呼び出すまでブ" -"ロックします。" +"セマフォは :meth:`~Semaphore.acquire` でデクリメントさ" +"れ :meth:`~Semaphore.release` でインクリメントされるような内部カウンタを管理" +"します。 カウンタは決してゼロより小さくはなりませ" +"ん; :meth:`~Semaphore.acquire` は、カウンタがゼロになっている場合、他のスレッ" +"ドが :meth:`~Semaphore.release` を呼び出すまでブロックします。" #: ../../library/threading.rst:1107 msgid "" @@ -1823,7 +2000,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 +2007,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,22 +2028,22 @@ 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 "" -"If the internal counter is zero on entry, block until awoken by a call to :" -"meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " -"decrement the counter by 1 and return ``True``. Exactly one thread will be " -"awoken by each call to :meth:`~Semaphore.release`. The order in which " +"If the internal counter is zero on entry, block until awoken by a call " +"to :meth:`~Semaphore.release`. Once awoken (and the counter is greater than " +"0), decrement the counter by 1 and return ``True``. Exactly one thread will " +"be awoken by each call to :meth:`~Semaphore.release`. The order in which " "threads are awoken should not be relied on." msgstr "" @@ -1898,33 +2075,31 @@ 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, :" -"exc:`ValueError` is raised. In most situations semaphores are used to guard " -"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 になります。" - -#: ../../library/threading.rst:1175 +"make sure its current value doesn't exceed its initial value. If it " +"does, :exc:`ValueError` is raised. In most situations semaphores are used to " +"guard 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) オブジェクトを実装しているクラスです。\n" +"有限セマフォは、現在の値が初期値を超過しないようチェックを行います。\n" +"超過を起こした場合、 :exc:`ValueError` を送出します。\n" +"たいていの場合、セマフォは限られた容量のリソースを保護するために使われるもの" +"です。\n" +"従って、セマフォを必要以上の回数解放することはバグが生じているしるしです。\n" +"*value* を指定しない場合、デフォルトの値は 1 になります。" + msgid ":class:`Semaphore` example" -msgstr "" +msgstr ":class:`Semaphore` の使用例" #: ../../library/threading.rst:1177 msgid "" @@ -1938,12 +2113,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 +2128,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 +2138,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 +2154,8 @@ msgstr "" "有限セマフォを使うと、セマフォを獲得回数以上に解放してしまうというプログラム" "上の間違いを見逃しにくくします。" -#: ../../library/threading.rst:1203 msgid "Event objects" -msgstr "" +msgstr "Event オブジェクト" #: ../../library/threading.rst:1205 msgid "" @@ -1986,27 +2167,28 @@ msgstr "" #: ../../library/threading.rst:1208 msgid "" -"An event object manages an internal flag that can be set to true with the :" -"meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " -"method. The :meth:`~Event.wait` method blocks until the flag is true." +"An event object manages an internal flag that can be set to true with " +"the :meth:`~Event.set` method and reset to false with " +"the :meth:`~Event.clear` method. The :meth:`~Event.wait` method blocks " +"until the flag is true." msgstr "" -"イベントオブジェクトは内部フラグを管理します。このフラグは :meth:`~Event." -"set` メソッドで値を true に、 :meth:`~Event.clear` メソッドで値を false にリ" -"セットします。 :meth:`~Event.wait` メソッドはフラグが true になるまでブロック" -"します。" +"イベントオブジェクトは内部フラグを管理します。このフラグ" +"は :meth:`~Event.set` メソッドで値を true に、 :meth:`~Event.clear` メソッド" +"で値を false にリセットします。 :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." +"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." @@ -2023,8 +2205,8 @@ msgid "" "block at all." msgstr "" "内部フラグの値を true にセットします。フラグの値が true になるのを待っている" -"全てのスレッドを起こします。一旦フラグが true になると、スレッドが :meth:" -"`wait` を呼び出しても全くブロックしなくなります。" +"全てのスレッドを起こします。一旦フラグが true になると、スレッド" +"が :meth:`wait` を呼び出しても全くブロックしなくなります。" #: ../../library/threading.rst:1237 msgid "" @@ -2036,7 +2218,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 +2225,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,22 +2238,20 @@ msgid "" "fractions thereof." msgstr "" -#: ../../library/threading.rst:1260 msgid "Timer objects" -msgstr "" +msgstr "Timer オブジェクト" #: ../../library/threading.rst:1262 msgid "" "This class represents an action that should be run only after a certain " -"amount of time has passed --- a timer. :class:`Timer` is a subclass of :" -"class:`Thread` and as such also functions as an example of creating custom " -"threads." +"amount of time has passed --- a timer. :class:`Timer` is a subclass " +"of :class:`Thread` and as such also functions as an example of creating " +"custom threads." 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 +2259,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 +2277,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 +2302,8 @@ msgstr "" "タイマをストップして、その動作の実行をキャンセルします。このメソッドはタイマ" "がまだ活動待ち状態にある場合にのみ動作します。" -#: ../../library/threading.rst:1298 msgid "Barrier objects" -msgstr "" +msgstr "Barrier オブジェクト" #: ../../library/threading.rst:1302 msgid "" @@ -2139,7 +2332,6 @@ msgstr "" "例として、クライアントとサーバの間でスレッドを同期させる単純な方法を紹介しま" "す::" -#: ../../library/threading.rst:1312 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -2156,18 +2348,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 +2396,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 "" @@ -2272,18 +2481,17 @@ msgstr "バリアが broken な状態である場合に ``True`` となるブー #: ../../library/threading.rst:1395 msgid "" -"This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" -"`Barrier` object is reset or broken." +"This exception, a subclass of :exc:`RuntimeError`, is raised when " +"the :class:`Barrier` object is reset or broken." msgstr "" -":class:`Barrier` オブジェクトがリセットされるか broken な場合に、この例外 (:" -"exc:`RuntimeError` のサブクラス) が送出されます。" +":class:`Barrier` オブジェクトがリセットされるか broken な場合に、この例外 " +"(:exc:`RuntimeError` のサブクラス) が送出されます。" #: ../../library/threading.rst:1402 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 +2499,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,16 +2524,21 @@ msgid "" "finally:\n" " some_lock.release()" msgstr "" +"some_lock.acquire()\n" +"try:\n" +" # 何らかの処理を行う...\n" +"finally:\n" +" some_lock.release()" #: ../../library/threading.rst:1421 msgid "" -"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" -"`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" -"`with` statement context managers." +"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:`Semaphore`, " +"and :class:`BoundedSemaphore` objects may be used as :keyword:`with` " +"statement context managers." msgstr "" -"現在のところ、 :class:`Lock` 、 :class:`RLock` 、 :class:`Condition` 、 :" -"class:`Semaphore` 、 :class:`BoundedSemaphore` を :keyword:`with` 文のコンテ" -"キストマネージャとして使うことができます。" +"現在のとこ" +"ろ、 :class:`Lock` 、 :class:`RLock` 、 :class:`Condition` 、 :class:`Semaphore` 、 :class:`BoundedSemaphore` " +"を :keyword:`with` 文のコンテキストマネージャとして使うことができます。" #: ../../library/threading.rst:222 ../../library/threading.rst:240 msgid "trace function" diff --git a/library/time.po b/library/time.po index 7f568b398..e79dbfa77 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 "" @@ -136,24 +143,30 @@ msgstr "" msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " "better than their Unix equivalents: times are expressed as floating-point " -"numbers, :func:`.time` returns the most accurate time available (using Unix :" -"c:func:`!gettimeofday` where available), and :func:`sleep` will accept a " -"time with a nonzero fraction (Unix :c:func:`!select` is used to implement " +"numbers, :func:`.time` returns the most accurate time available (using " +"Unix :c:func:`!gettimeofday` where available), and :func:`sleep` will accept " +"a 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 "" -"The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" -"`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" -"`strftime`, is a sequence of 9 integers. The return values of :func:" -"`gmtime`, :func:`localtime`, and :func:`strptime` also offer attribute names " -"for individual fields." +"The time value as returned by :func:`gmtime`, :func:`localtime`, " +"and :func:`strptime`, and accepted by :func:`asctime`, :func:`mktime` " +"and :func:`strftime`, is a sequence of 9 integers. The return values " +"of :func:`gmtime`, :func:`localtime`, and :func:`strptime` also offer " +"attribute names for individual fields." msgstr "" -":func:`gmtime`, :func:`localtime`, :func:`strptime` が返す時刻値、および :" -"func:`asctime`, :func:`mktime`, :func:`strftime` がとる時刻値は 9 個の整数か" -"らなるシーケンスです。:func:`gmtime`, :func:`localtime`, :func:`strptime` の" -"戻り値は個々の値を属性名で取得することもできます。" +":func:`gmtime`, :func:`localtime`, :func:`strptime` が返す時刻値、およ" +"び :func:`asctime`, :func:`mktime`, :func:`strftime` がとる時刻値は 9 個の整" +"数からなるシーケンスで" +"す。:func:`gmtime`, :func:`localtime`, :func:`strptime` の戻り値は個々の値を" +"属性名で取得することもできます。" #: ../../library/time.rst:88 msgid "See :class:`struct_time` for a description of these objects." @@ -163,16 +176,22 @@ msgstr "" #: ../../library/time.rst:90 msgid "" -"The :class:`struct_time` type was extended to provide the :attr:" -"`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " -"platform supports corresponding ``struct tm`` members." +"The :class:`struct_time` type was extended to provide " +"the :attr:`~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." +"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:" @@ -226,10 +245,11 @@ msgstr "関数" #: ../../library/time.rst:127 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned by :" -"func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " -"Jun 20 23:21:05 1993'``. The day field is two characters long and is space " -"padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 1993'``." +"Convert a tuple or :class:`struct_time` representing a time as returned " +"by :func:`gmtime` or :func:`localtime` to a string of the following form: " +"``'Sun Jun 20 23:21:05 1993'``. The day field is two characters long and is " +"space padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 " +"1993'``." msgstr "" #: ../../library/time.rst:133 @@ -245,38 +265,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 +315,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." +"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." @@ -314,17 +328,18 @@ msgstr ":func:`clock_gettime` に似ていますが、ナノ秒単位の時刻 #: ../../library/time.rst:194 msgid "" -"Set the time of the specified clock *clk_id*. Currently, :data:" -"`CLOCK_REALTIME` is the only accepted value for *clk_id*." +"Set the time of the specified clock *clk_id*. " +"Currently, :data:`CLOCK_REALTIME` is the only accepted value for *clk_id*." 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." +"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." @@ -340,10 +355,10 @@ msgstr "" #: ../../library/time.rst:221 msgid "" -"If *secs* is not provided or :const:`None`, the current time as returned by :" -"func:`.time` is used. ``ctime(secs)`` is equivalent to " -"``asctime(localtime(secs))``. Locale information is not used by :func:" -"`ctime`." +"If *secs* is not provided or :const:`None`, the current time as returned " +"by :func:`.time` is used. ``ctime(secs)`` is equivalent to " +"``asctime(localtime(secs))``. Locale information is not used " +"by :func:`ctime`." msgstr "" "*secs* を指定しないか :const:`None` を指定した場合、:func:`.time` が返す値を" "現在の時刻として使用します。``ctime(secs)`` は ``asctime(localtime(secs))`` " @@ -411,19 +426,19 @@ msgstr "*resolution*: クロックの分解能を秒 (:class:`float`) で表し #: ../../library/time.rst:254 msgid "" -"Convert a time expressed in seconds since the epoch_ to a :class:" -"`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " -"provided or :const:`None`, the current time as returned by :func:`.time` is " -"used. Fractions of a second are ignored. See above for a description of " -"the :class:`struct_time` object. See :func:`calendar.timegm` for the inverse " -"of this function." +"Convert a time expressed in seconds since the epoch_ to " +"a :class:`struct_time` in UTC in which the dst flag is always zero. If " +"*secs* is not provided or :const:`None`, the current time as returned " +"by :func:`.time` is used. Fractions of a second are ignored. See above for " +"a description of the :class:`struct_time` object. " +"See :func:`calendar.timegm` for the inverse of this function." msgstr "" -"エポック (epoch_) からの経過時間で表現された時刻を、UTC で :class:" -"`struct_time` に変換します。このとき dst フラグは常にゼロとして扱われます。" -"*secs* を指定しないか :const:`None` を指定した場合、:func:`.time` が返す値を" -"現在の時刻として使用します。秒の端数は無視されます。:class:`struct_time` オブ" -"ジェクトについては前述の説明を参照してください。:func:`calendar.timegm` はこ" -"の関数と逆の変換を行います。" +"エポック (epoch_) からの経過時間で表現された時刻を、UTC " +"で :class:`struct_time` に変換します。このとき dst フラグは常にゼロとして扱わ" +"れます。*secs* を指定しないか :const:`None` を指定した場合、:func:`.time` が" +"返す値を現在の時刻として使用します。秒の端数は無視されま" +"す。:class:`struct_time` オブジェクトについては前述の説明を参照してくださ" +"い。:func:`calendar.timegm` はこの関数と逆の変換を行います。" #: ../../library/time.rst:264 msgid "" @@ -435,27 +450,40 @@ 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` " -"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :" -"c:func:`gmtime` failure. It's common for this to be restricted to years " +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " +"or :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 "" -"This is the inverse function of :func:`localtime`. Its argument is the :" -"class:`struct_time` or full 9-tuple (since the dst flag is needed; use " +"This is the inverse function of :func:`localtime`. Its argument is " +"the :class:`struct_time` or full 9-tuple (since the dst flag is needed; use " "``-1`` as the dst flag if it is unknown) which expresses the time in *local* " -"time, not UTC. It returns a floating-point number, for compatibility with :" -"func:`.time`. If the input value cannot be represented as a valid time, " -"either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " +"time, not UTC. It returns a floating-point number, for compatibility " +"with :func:`.time`. If the input value cannot be represented as a valid " +"time, either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " "depends on whether the invalid value is caught by Python or the underlying C " "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 +496,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." +"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 +552,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." +"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 +584,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." +"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 +608,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 +636,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,29 +681,30 @@ 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 "" -"Convert a tuple or :class:`struct_time` representing a time as returned by :" -"func:`gmtime` or :func:`localtime` to a string as specified by the *format* " -"argument. If *t* is not provided, the current time as returned by :func:" -"`localtime` is used. *format* must be a string. :exc:`ValueError` is " -"raised if any field in *t* is outside of the allowed range." +"Convert a tuple or :class:`struct_time` representing a time as returned " +"by :func:`gmtime` or :func:`localtime` to a string as specified by the " +"*format* argument. If *t* is not provided, the current time as returned " +"by :func:`localtime` is used. *format* must be a string. :exc:`ValueError` " +"is raised if any field in *t* is outside of the allowed range." msgstr "" -":func:`gmtime` や :func:`localtime` が返す時刻値タプルまたは :class:" -"`struct_time` を、*format* で指定した文字列形式に変換します。*t* が与えられて" -"いない場合、:func:`localtime` が返す値を現在の時刻として使用します。*format* " -"は文字列でなくてはなりません。*t* のいずれかのフィールドが許容範囲外の数値で" -"あった場合、:exc:`ValueError` を送出します。" +":func:`gmtime` や :func:`localtime` が返す時刻値タプルまた" +"は :class:`struct_time` を、*format* で指定した文字列形式に変換します。*t* が" +"与えられていない場合、:func:`localtime` が返す値を現在の時刻として使用しま" +"す。*format* は文字列でなくてはなりません。*t* のいずれかのフィールドが許容範" +"囲外の数値であった場合、:exc:`ValueError` を送出します。" #: ../../library/time.rst:440 msgid "" @@ -754,13 +788,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 +867,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 +885,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 +900,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 +969,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 +1003,18 @@ 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 `." +"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,24 +1050,26 @@ 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 "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " -"of format codes supported on your platform, consult the :manpage:" -"`strftime(3)` documentation." +"of format codes supported on your platform, consult " +"the :manpage:`strftime(3)` documentation." msgstr "" "一部のプラットフォームではさらにいくつかのディレクティブがサポートされていま" "すが、標準 ANSI C で意味のある値はここで列挙したものだけです。あなたのプラッ" -"トフォームでサポートされている書式コードの全一覧については、:manpage:" -"`strftime(3)` のドキュメントを参照してください。" +"トフォームでサポートされている書式コードの全一覧について" +"は、:manpage:`strftime(3)` のドキュメントを参照してください。" #: ../../library/time.rst:582 msgid "" @@ -1049,21 +1092,21 @@ msgstr "" #: ../../library/time.rst:597 msgid "" -"The *format* parameter uses the same directives as those used by :func:" -"`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " -"formatting returned by :func:`ctime`. If *string* cannot be parsed according " -"to *format*, or if it has excess data after parsing, :exc:`ValueError` is " -"raised. The default values used to fill in any missing data when more " -"accurate values cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``. " -"Both *string* and *format* must be strings." +"The *format* parameter uses the same directives as those used " +"by :func:`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which " +"matches the formatting returned by :func:`ctime`. If *string* cannot be " +"parsed according to *format*, or if it has excess data after " +"parsing, :exc:`ValueError` is raised. The default values used to fill in any " +"missing data when more accurate values cannot be inferred are ``(1900, 1, 1, " +"0, 0, 0, 0, 1, -1)``. Both *string* and *format* must be strings." msgstr "" "*format* パラメーターは :func:`strftime` で使うものと同じディレクティブを使い" -"ます; このパラメーターの値はデフォルトでは ``\"%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* も " +"ます; このパラメーターの値はデフォルトでは ``\"%a %b %d %H:%M:%S %Y\"`` " +"で、:func:`ctime` が返すフォーマットに一致します。*string* が *format* に従っ" +"て解釈できなかった場合、例外 :exc:`ValueError` が送出されます。解析しようとす" +"る *string* が解析後に余分なデータを持っていた場合、 ``ValueError`` が送出さ" +"れます。欠落したデータについて、適切な値を推測できない場合はデフォルトの値で" +"埋められ、その値は ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)`` です。*string* も " "*format* も文字列でなければなりません。" #: ../../library/time.rst:605 @@ -1082,7 +1125,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,18 +1132,18 @@ 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 "" -"The type of the time value sequence returned by :func:`gmtime`, :func:" -"`localtime`, and :func:`strptime`. It is an object with a :term:`named " -"tuple` interface: values can be accessed by index and by attribute name. " -"The following values are present:" +"The type of the time value sequence returned " +"by :func:`gmtime`, :func:`localtime`, and :func:`strptime`. It is an object " +"with a :term:`named tuple` interface: values can be accessed by index and by " +"attribute name. The following values are present:" msgstr "" ":func:`gmtime`, :func:`localtime` および :func:`strptime` が返す時刻値シーケ" "ンスの型です。これは :term:`名前付きタプル ` のインターフェース" @@ -1172,9 +1214,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,36 +1253,38 @@ 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." +"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 "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " "systems, the leap seconds are not counted towards the time in seconds since " -"the epoch_. This is commonly referred to as `Unix time `_." +"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,39 +1294,42 @@ 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 :" -"func:`gmtime` function or in local time by passing it to the :func:" -"`localtime` function. In both cases a :class:`struct_time` object is " -"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` オブジェクトが返され、このオブジェクト" -"の属性としてカレンダー日付の構成要素へアクセスできます。" +"time format (i.e. year, month, day, hour, etc...) in UTC by passing it " +"to :func:`gmtime` function or in local time by passing it to " +"the :func:`localtime` function. In both cases a :class:`struct_time` object " +"is 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` オブジェクトを返し、日付や時刻の各要素を属性と" +"して取得できます。" #: ../../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 +1339,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 +1346,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." +"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 +1376,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." +"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 +1405,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:" @@ -1370,8 +1421,8 @@ msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -"三文字またはそれ以上の英数字で、タイムゾーンの略称を与えます。この値は time." -"tzname になります。" +"三文字またはそれ以上の英数字で、タイムゾーンの略称を与えます。この値は " +"time.tzname になります。" #: ../../library/time.rst:792 msgid "``offset``" @@ -1430,17 +1481,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 +1514,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 +1553,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`." +"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 +1615,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 +1632,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 "" +"The following constant is the only parameter that can be sent " +"to :func:`clock_settime`." +msgstr "次の定数は :func:`clock_settime` に渡せる唯一のクロック ID です。" #: ../../library/time.rst:985 msgid "" @@ -1603,21 +1679,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,15 +1722,22 @@ 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 " -"rules in effect at module load time or the last time :func:`tzset` is called " -"and may be incorrect for times in the past. It is recommended to use the :" -"attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" -"func:`localtime` to obtain timezone information." +"For the above Timezone constants " +"(:data:`altzone`, :data:`daylight`, :data:`timezone`, and :data:`tzname`), " +"the value is determined by the timezone rules in effect at module load time " +"or the last time :func:`tzset` is called and may be incorrect for times in " +"the past. It is recommended to use the :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`" @@ -1671,11 +1754,11 @@ msgstr ":mod:`locale` モジュール" #: ../../library/time.rst:1034 msgid "" "Internationalization services. The locale setting affects the " -"interpretation of many format specifiers in :func:`strftime` and :func:" -"`strptime`." +"interpretation of many format specifiers in :func:`strftime` " +"and :func:`strptime`." msgstr "" -"国際化サービスです。ロケールの設定は :func:`strftime` および :func:" -"`strptime` の多くの書式指定子の解釈に影響を及ぼします。" +"国際化サービスです。ロケールの設定は :func:`strftime` およ" +"び :func:`strptime` の多くの書式指定子の解釈に影響を及ぼします。" #: ../../library/time.rst:1037 msgid "Module :mod:`calendar`" @@ -1705,11 +1788,11 @@ msgid "" msgstr "" "``%Z`` の使用は現在非推奨です。ただし、ここで実現したい時間および分オフセット" "への展開を行ってくれる ``%z`` エスケープはすべての ANSI C ライブラリでサポー" -"トされているわけではありません。また、1982 年に提出されたオリジナルの :rfc:" -"`822` 標準では西暦の表現を 2 桁とするよう要求している (``%Y`` でなく ``%y``) " -"ものの、実際には 2000 年になるだいぶ以前から 4 桁の西暦表現に移行しています。" -"その後 :rfc:`822` は撤廃され、4 桁の西暦表現は :rfc:`1123` で初めて勧告さ" -"れ、:rfc:`2822` において義務付けられました。" +"トされているわけではありません。また、1982 年に提出されたオリジナル" +"の :rfc:`822` 標準では西暦の表現を 2 桁とするよう要求している (``%Y`` でなく " +"``%y``) ものの、実際には 2000 年になるだいぶ以前から 4 桁の西暦表現に移行して" +"います。その後 :rfc:`822` は撤廃され、4 桁の西暦表現は :rfc:`1123` で初めて勧" +"告され、:rfc:`2822` において義務付けられました。" #: ../../library/time.rst:22 msgid "epoch" @@ -1719,9 +1802,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 +1838,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..586da6d05 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,12 +109,14 @@ 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 "" "Note however that :func:`.timeit` will automatically determine the number of " -"repetitions only when the command-line interface is used. In the :ref:" -"`timeit-examples` section you can find more advanced examples." +"repetitions only when the command-line interface is used. In " +"the :ref:`timeit-examples` section you can find more advanced examples." msgstr "" "ただし、:func:`timeit` はコマンドラインインターフェイスを使った時だけ繰り返し" "回数を自動で決定する事に注意してください。:ref:`timeit-examples` 節でより高度" @@ -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." @@ -183,13 +198,13 @@ msgstr "" #: ../../library/timeit.rst:111 msgid "" -"To measure the execution time of the first statement, use the :meth:`." -"timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are " -"convenience methods to call :meth:`.timeit` multiple times." +"To measure the execution time of the first statement, use " +"the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` " +"methods are convenience methods to call :meth:`.timeit` multiple times." msgstr "" -"最初の命令文の実行時間を計測するには、:meth:`.timeit` メソッドを使用します。:" -"meth:`.repeat` と :meth:`autorange` メソッドは :meth:`.timeit` を複数回呼び出" -"したい時に使用します。" +"最初の命令文の実行時間を計測するには、:meth:`.timeit` メソッドを使用しま" +"す。:meth:`.repeat` と :meth:`autorange` メソッドは :meth:`.timeit` を複数回" +"呼び出したい時に使用します。" #: ../../library/timeit.rst:115 msgid "" @@ -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`." @@ -283,8 +298,8 @@ msgid "" "for :meth:`.timeit`." msgstr "" "これは :meth:`.timeit` を繰り返し呼び出したい時に有用で、結果をリストにして返" -"します。最初の引数で何回 :meth:`.timeit` を呼ぶか指定します。第 2 引数で :" -"meth:`.timeit` の引数 *number* を指定します。" +"します。最初の引数で何回 :meth:`.timeit` を呼ぶか指定します。第 2 引数" +"で :meth:`.timeit` の引数 *number* を指定します。" #: ../../library/timeit.rst:173 msgid "" @@ -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" @@ -412,16 +433,16 @@ msgstr "" msgid "" ":func:`default_timer` measurements can be affected by other programs running " "on the same machine, so the best thing to do when accurate timing is " -"necessary is to repeat the timing a few times and use the best time. The :" -"option:`-r` option is good for this; the default of 5 repetitions is " +"necessary is to repeat the timing a few times and use the best time. " +"The :option:`-r` option is good for this; the default of 5 repetitions is " "probably enough in most cases. You can use :func:`time.process_time` to " "measure CPU time." msgstr "" ":func:`default_timer` の測定値は、同じマシン上で実行されている他のプログラム" "の影響を受ける可能性があるため、正確な時間計測が必要な場合は、計測を数回繰り" "返し、最適な時間を使用することをおすすめします。 :option:`-r` オプションはこ" -"れに適しています。ほとんどの場合、デフォルトの5回の繰り返しで十分でしょう。 :" -"func:`time.process_time` を使用すればCPU時間を測定できます。" +"れに適しています。ほとんどの場合、デフォルトの5回の繰り返しで十分でしょ" +"う。 :func:`time.process_time` を使用すればCPU時間を測定できます。" #: ../../library/timeit.rst:267 msgid "" @@ -450,10 +471,16 @@ msgid "" "$ 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" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.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,12 +530,21 @@ 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 "" "The following examples show how to time expressions that contain multiple " -"lines. Here we compare the cost of using :func:`hasattr` vs. :keyword:`try`/:" -"keyword:`except` to test for missing and present object attributes:" +"lines. Here we compare the cost of using :func:`hasattr` " +"vs. :keyword:`try`/:keyword:`except` to test for missing and present object " +"attributes:" msgstr "" "以下の例は、複数行を含んだ式を計測する方法を示しています。ここでは、オブジェ" "クトの存在する属性と存在しない属性に対してテストするために :func:`hasattr` " @@ -521,8 +564,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 +604,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 +639,6 @@ msgstr "" "定義した関数に :mod:`timeit` モジュールがアクセスできるようにするために、 " "import 文の入った *setup* パラメータを渡すことができます::" -#: ../../library/timeit.rst:361 msgid "" "def test():\n" " \"\"\"Stupid test function\"\"\"\n" @@ -570,16 +648,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 +678,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..53b157c6d 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 @@ -31,27 +31,27 @@ msgstr "Tk を用いたグラフィカルユーザーインターフェース" msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " -"programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.ttk` module." +"programmers using the :mod:`tkinter` package, and its extension, " +"the :mod:`tkinter.ttk` module." msgstr "" "Tk/Tcl は長きにわたり Python の不可欠な一部でありつづけています。 Tk/Tcl は頑" "健でプラットホームに依存しないウィンドウ構築ツールキットであり、 Python プロ" "グラマは :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 " -"to consult the Tk documentation, and occasionally the Tcl documentation. :" -"mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python " -"classes." +"to consult the Tk documentation, and occasionally the Tcl " +"documentation. :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..fcadc1320 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 @@ -36,13 +36,13 @@ msgstr "**ソースコード:** :source:`Lib/tkinter/colorchooser.py`" msgid "" "The :mod:`tkinter.colorchooser` module provides the :class:`Chooser` class " "as an interface to the native color picker dialog. ``Chooser`` implements a " -"modal color choosing dialog window. The ``Chooser`` class inherits from the :" -"class:`~tkinter.commondialog.Dialog` class." +"modal color choosing dialog window. The ``Chooser`` class inherits from " +"the :class:`~tkinter.commondialog.Dialog` class." msgstr "" "``Chooser``:mod:`tkinter.colorchooser` モジュールは :class:`Chooser` クラスを" "ネイティブカラー選択ダイアログのインターフェースとして提供します。はモーダル" -"なカラー選択ウィンドウを実装しています。 ``Chooser`` クラスは :class:" -"`~tkinter.commondialog.Dialog` を継承しています。" +"なカラー選択ウィンドウを実装しています。 ``Chooser`` クラス" +"は :class:`~tkinter.commondialog.Dialog` を継承しています。" #: ../../library/tkinter.colorchooser.rst:21 msgid "" 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..22250b01a 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 @@ -37,14 +37,12 @@ msgid "" "The :mod:`tkinter.font` module provides the :class:`Font` class for creating " "and using named fonts." msgstr "" -":mod:`tkinter.font` モジュールは名前付きフォントを作成、使用するための :" -"class:`Font` クラスを提供します。" +":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..1c396100e 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,210 +41,230 @@ 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." +"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 "" -"Ask if operation should be retried. Shows buttons :data:`RETRY` and :data:" -"`CANCEL`. Return ``True`` if the answer is yes and ``False`` otherwise." +"Ask if operation should be retried. Shows buttons :data:`RETRY` " +"and :data:`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`." +"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`." +"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..d659b95de 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,36 +213,57 @@ 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:" -"`Tk` object embeds its own Tcl interpreter instance with Tk loaded into it. " -"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 "" +"that adds custom commands to create and manipulate GUI widgets. " +"Each :class:`Tk` object embeds its own Tcl interpreter instance with Tk " +"loaded into it. 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 "" -"Internally, Tk and Ttk use facilities of the underlying operating system, i." -"e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows." +"Internally, Tk and Ttk use facilities of the underlying operating system, " +"i.e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows." msgstr "" #: ../../library/tkinter.rst:108 @@ -253,11 +287,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 +301,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,27 +371,37 @@ 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:" -"`exec` on the contents of :file:`.{className}.py` and :file:`.{baseName}." -"py`. The path for the profile files is the :envvar:`HOME` environment " -"variable or, if that isn't defined, then :data:`os.curdir`." +":class:`Tk` reads and interprets profile files, named :file:`." +"{className}.tcl` and :file:`.{baseName}.tcl`, into the Tcl interpreter and " +"calls :func:`exec` on the contents of :file:`.{className}.py` and :file:`." +"{baseName}.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 +414,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 "" @@ -381,28 +429,26 @@ msgid "" "interpreter in an environment where one doesn't want to create extraneous " "toplevel windows, or where one cannot (such as Unix/Linux systems without an " "X server). An object created by the :func:`Tcl` object can have a Toplevel " -"window created (and the Tk subsystem initialized) by calling its :meth:" -"`loadtk` method." +"window created (and the Tk subsystem initialized) by calling " +"its :meth:`loadtk` method." msgstr "" ":func:`Tcl` はファクトリ関数で、 :class:`Tk` クラスで生成するオブジェクトとよ" "く似たオブジェクトを生成します。ただし Tk サブシステムを初期化しません。この" "関数は、余分なトップレベルウィンドウを作る必要がなかったり、 (X サーバを持た" "ない Unix/Linux システムなどのように) 作成できない環境において Tcl インタプリ" -"タを駆動したい場合に便利です。 :func:`Tcl` で生成したオブジェクトに対して :" -"meth:`loadtk` メソッドを呼び出せば、トップレベルウィンドウを作成 (して、Tk サ" -"ブシステムを初期化) します。" +"タを駆動したい場合に便利です。 :func:`Tcl` で生成したオブジェクトに対し" +"て :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 +510,7 @@ msgstr "基本的なダイアログと便宜関数 (convenience function) です #: ../../library/tkinter.rst:229 msgid ":mod:`tkinter.ttk`" -msgstr "" +msgstr ":mod:`tkinter.ttk`" #: ../../library/tkinter.rst:230 msgid "" @@ -472,13 +518,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,23 +536,23 @@ msgstr "" #: ../../library/tkinter.rst:245 msgid ":mod:`idlelib`" -msgstr "" +msgstr ":mod:`idlelib`" #: ../../library/tkinter.rst:246 msgid "" -"Python's Integrated Development and Learning Environment (IDLE). Based on :" -"mod:`tkinter`." +"Python's Integrated Development and Learning Environment (IDLE). Based " +"on :mod:`tkinter`." msgstr "" #: ../../library/tkinter.rst:249 msgid ":mod:`tkinter.constants`" -msgstr "" +msgstr ":mod:`tkinter.constants`" #: ../../library/tkinter.rst:250 msgid "" "Symbolic constants that can be used in place of strings when passing various " -"parameters to Tkinter calls. Automatically imported by the main :mod:" -"`tkinter` module." +"parameters to Tkinter calls. Automatically imported by the " +"main :mod:`tkinter` module." msgstr "" #: ../../library/tkinter.rst:254 @@ -532,7 +577,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 +584,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,27 +622,41 @@ 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 "" -"The next line creates a label widget holding a static text string. The :meth:" -"`grid` method is used to specify the relative layout (position) of the label " -"within its containing frame widget, similar to how tables in HTML work." +"The next line creates a label widget holding a static text string. " +"The :meth:`grid` method is used to specify the relative layout (position) of " +"the label within its containing frame widget, similar to how tables in HTML " +"work." msgstr "" #: ../../library/tkinter.rst:309 @@ -600,144 +665,172 @@ 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`." +"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" "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" +"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 +841,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 +882,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,64 +942,74 @@ 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 "" "In the official Tcl/Tk reference documentation, you'll find most operations " "that look like method calls on the man page for a specific widget (e.g., " -"you'll find the :meth:`invoke` method on the `ttk::button `_ man page), while functions that take a " -"widget as a parameter often have their own man page (e.g., `grid `_)." +"you'll find the :meth:`invoke` method on the `ttk::button `_ man page), while functions " +"that take a widget as a parameter often have their own man page (e.g., `grid " +"`_)." msgstr "" #: ../../library/tkinter.rst:483 msgid "" -"You'll find many common options and methods in the `options `_ or `ttk::widget `_ man pages, while others are found in the man " -"page for a specific widget class." +"You'll find many common options and methods in the `options `_ or `ttk::widget `_ man pages, while others are " +"found in the man page for a specific widget class." msgstr "" #: ../../library/tkinter.rst:488 msgid "" -"You'll also find that many Tkinter methods have compound names, e.g., :func:" -"`winfo_x`, :func:`winfo_height`, :func:`winfo_viewable`. You'd find " -"documentation for all of these in the `winfo `_ man page." +"You'll also find that many Tkinter methods have compound names, " +"e.g., :func:`winfo_x`, :func:`winfo_height`, :func:`winfo_viewable`. You'd " +"find documentation for all of these in the `winfo `_ 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, " "independent of any widget. Examples are methods for accessing the clipboard " -"or the system bell. (They happen to be implemented as methods in the base :" -"class:`Widget` class that all Tkinter widgets inherit from)." +"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 +1017,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 +1024,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 "" @@ -923,14 +1043,14 @@ msgstr "" #: ../../library/tkinter.rst:520 msgid "" "Tcl/Tk applications are normally event-driven, meaning that after " -"initialization, the interpreter runs an event loop (i.e. :func:`Tk." -"mainloop`) and responds to events. Because it is single-threaded, event " -"handlers must respond quickly, otherwise they will block other events from " -"being processed. To avoid this, any long-running computations should not run " -"in an event handler, but are either broken into smaller pieces using timers, " -"or run in another thread. This is different from many GUI toolkits where the " -"GUI runs in a completely separate thread from all application code including " -"event handlers." +"initialization, the interpreter runs an event loop " +"(i.e. :func:`Tk.mainloop`) and responds to events. Because it is single-" +"threaded, event handlers must respond quickly, otherwise they will block " +"other events from being processed. To avoid this, any long-running " +"computations should not run in an event handler, but are either broken into " +"smaller pieces using timers, or run in another thread. This is different " +"from many GUI toolkits where the GUI runs in a completely separate thread " +"from all application code including event handlers." msgstr "" #: ../../library/tkinter.rst:529 @@ -940,35 +1060,39 @@ msgid "" "Tcl interpreter will fail." msgstr "" -#: ../../library/tkinter.rst:533 msgid "A number of special cases exist:" -msgstr "" +msgstr "例外的な場合がいくつかあります。" #: ../../library/tkinter.rst:535 msgid "" -"Tcl/Tk libraries can be built so they are not thread-aware. In this case, :" -"mod:`tkinter` calls the library from the originating Python thread, even if " -"this is different than the thread that created the Tcl interpreter. A global " -"lock ensures only one call occurs at a time." +"Tcl/Tk libraries can be built so they are not thread-aware. In this " +"case, :mod:`tkinter` calls the library from the originating Python thread, " +"even if this is different than the thread that created the Tcl interpreter. " +"A global lock ensures only one call occurs at a time." msgstr "" #: ../../library/tkinter.rst:540 msgid "" -"While :mod:`tkinter` allows you to create more than one instance of a :class:" -"`Tk` object (with its own interpreter), all interpreters that are part of " -"the same thread share a common event queue, which gets ugly fast. In " +"While :mod:`tkinter` allows you to create more than one instance of " +"a :class:`Tk` object (with its own interpreter), all interpreters that are " +"part of the same thread share a common event queue, which gets ugly fast. In " "practice, don't create more than one instance of :class:`Tk` at a time. " "Otherwise, it's best to create them in separate threads and ensure you're " "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 +1120,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 +1140,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 "" @@ -1033,8 +1156,8 @@ msgid "" "Note that the man pages list \"STANDARD OPTIONS\" and \"WIDGET SPECIFIC " "OPTIONS\" for each widget. The former is a list of options that are common " "to many widgets, the latter are the options that are idiosyncratic to that " -"particular widget. The Standard Options are documented on the :manpage:" -"`options(3)` man page." +"particular widget. The Standard Options are documented on " +"the :manpage:`options(3)` man page." msgstr "" "man ページには、各ウィジェットの \"STANDARD OPTIONS (標準オプション)\" と " "\"WIDGET SPECIFIC OPTIONS (ウィジェット固有のオプション)\" がリストされている" @@ -1156,11 +1279,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 "" @@ -1340,19 +1464,19 @@ msgstr "" #: ../../library/tkinter.rst:707 msgid "" -"There are many useful subclasses of Variable already defined: :class:" -"`StringVar`, :class:`IntVar`, :class:`DoubleVar`, and :class:`BooleanVar`. " -"To read the current value of such a variable, call the :meth:`get` method on " -"it, and to change its value you call the :meth:`!set` method. If you follow " -"this protocol, the widget will always track the value of the variable, with " -"no further intervention on your part." +"There are many useful subclasses of Variable already " +"defined: :class:`StringVar`, :class:`IntVar`, :class:`DoubleVar`, " +"and :class:`BooleanVar`. To read the current value of such a variable, call " +"the :meth:`get` method on it, and to change its value you call the :meth:`!" +"set` method. If you follow this protocol, the widget will always track the " +"value of the variable, with no further intervention on your part." msgstr "" -"Variable には、 :class:`StringVar`, :class:`IntVar`, :class:`DoubleVar`, :" -"class:`BooleanVar` といった便利なサブクラスがすでにすでに数多く定義されていま" -"す。こうした変数の現在の値を読み出したければ、 :meth:`get` メソッドを呼び出し" -"ます。また、値を変更したければ :meth:`!set` メソッドを呼び出します。このプロ" -"トコルに従っている限り、それ以上なにも手を加えなくてもウィジェットは常に現在" -"値に追従します。" +"Variable に" +"は、 :class:`StringVar`, :class:`IntVar`, :class:`DoubleVar`, :class:`BooleanVar` " +"といった便利なサブクラスがすでにすでに数多く定義されています。こうした変数の" +"現在の値を読み出したければ、 :meth:`get` メソッドを呼び出します。また、値を変" +"更したければ :meth:`!set` メソッドを呼び出します。このプロトコルに従っている" +"限り、それ以上なにも手を加えなくてもウィジェットは常に現在値に追従します。" #: ../../library/tkinter.rst:714 ../../library/tkinter.rst:894 msgid "For example::" @@ -1416,18 +1540,18 @@ msgid "" "To get at the toplevel window that contains a given widget, you can often " "just refer to the widget's master. Of course if the widget has been packed " "inside of a frame, the master won't represent a toplevel window. To get at " -"the toplevel window that contains an arbitrary widget, you can call the :" -"meth:`_root` method. This method begins with an underscore to denote the " -"fact that this function is part of the implementation, and not an interface " -"to Tk functionality." +"the toplevel window that contains an arbitrary widget, you can call " +"the :meth:`_root` method. This method begins with an underscore to denote " +"the fact that this function is part of the implementation, and not an " +"interface to Tk functionality." msgstr "" "あるウィジェットの入っているトップレベルウィンドウを取得したい場合、大抵は単" "にウィジェットのマスタを参照するだけですみます。とはいえ、ウィジェットがフ" "レーム内にパックされている場合、マスタはトップレベルウィンドウではありませ" -"ん。任意のウィジェットの入っているトップレベルウィンドウを知りたければ :meth:" -"`_root` メソッドを呼び出してください。このメソッドはアンダースコアがついてい" -"ますが、これはこの関数が :mod:`Tkinter` の実装の一部であり、Tk の機能に対する" -"インターフェースではないことを示しています。" +"ん。任意のウィジェットの入っているトップレベルウィンドウを知りたけれ" +"ば :meth:`_root` メソッドを呼び出してください。このメソッドはアンダースコアが" +"ついていますが、これはこの関数が :mod:`Tkinter` の実装の一部であり、Tk の機能" +"に対するインターフェースではないことを示しています。" #: ../../library/tkinter.rst:765 msgid "Here are some examples of typical usage::" @@ -1488,7 +1612,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 +1628,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 +1756,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 +1787,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:" @@ -1676,9 +1800,9 @@ msgstr "sequence" #: ../../library/tkinter.rst:879 msgid "" -"is a string that denotes the target kind of event. (See the :manpage:" -"`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" -"reference:`Tcl and the Tk Toolkit (2nd edition)`, for details)." +"is a string that denotes the target kind of event. (See " +"the :manpage:`bind(3tk)` man page, and page 201 of John Ousterhout's " +"book, :title-reference:`Tcl and the Tk Toolkit (2nd edition)`, for details)." msgstr "" #: ../../library/tkinter.rst:883 @@ -1711,13 +1835,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 +1884,8 @@ msgstr "char" msgid "%h" msgstr "%h" -#: ../../library/tkinter.rst:911 msgid "height" -msgstr "高さ" +msgstr "``height``" #: ../../library/tkinter.rst:911 msgid "%E" @@ -1821,9 +1947,8 @@ msgstr "type" msgid "%w" msgstr "%w" -#: ../../library/tkinter.rst:919 msgid "width" -msgstr "幅" +msgstr "``width``" #: ../../library/tkinter.rst:919 msgid "%W" @@ -1920,11 +2045,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 +2068,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 +2084,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,14 +2122,20 @@ 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 " -"subsampling. Add *from_coords* parameter to :class:`!PhotoImage` methods :" -"meth:`!copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and " +"subsampling. Add *from_coords* parameter to :class:`!PhotoImage` " +"methods :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 +2151,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 +2173,6 @@ msgstr "" "ファイルディスクリプタ1つにつき、1つだけハンドラは登録されます。コード例で" "す::" -#: ../../library/tkinter.rst:1011 msgid "" "import tkinter\n" "widget = tkinter.Tk()\n" @@ -2052,6 +2181,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." @@ -2060,20 +2195,20 @@ msgstr "これらの機能は Windows では利用できません。" #: ../../library/tkinter.rst:1020 msgid "" "Since you don't know how many bytes are available for reading, you may not " -"want to use the :class:`~io.BufferedIOBase` or :class:`~io.TextIOBase` :meth:" -"`~io.BufferedIOBase.read` or :meth:`~io.IOBase.readline` methods, since " -"these will insist on reading a predefined number of bytes. For sockets, the :" -"meth:`~socket.socket.recv` or :meth:`~socket.socket.recvfrom` methods will " -"work fine; for other files, use raw reads or ``os.read(file.fileno(), " -"maxbytecount)``." +"want to use the :class:`~io.BufferedIOBase` " +"or :class:`~io.TextIOBase` :meth:`~io.BufferedIOBase.read` " +"or :meth:`~io.IOBase.readline` methods, since these will insist on reading a " +"predefined number of bytes. For sockets, the :meth:`~socket.socket.recv` " +"or :meth:`~socket.socket.recvfrom` methods will work fine; for other files, " +"use raw reads or ``os.read(file.fileno(), maxbytecount)``." msgstr "" "読み込みに使えるバイト数は分からないので、 :class:`~io.BufferedIOBase` クラス" "や :class:`~io.TextIOBase` クラスの :meth:`~io.BufferedIOBase.read` メソッド" "および :meth:`~io.IOBase.readline` メソッドを使おうとしないでください。これら" "は読み込みの際に、あらかじめ決められたバイト数を要求するのです。ソケットに" "は、 :meth:`~socket.socket.recv` や :meth:`~socket.socket.recvfrom` メソッド" -"を使うといいです。その他のファイルには、 raw 読み込みか ``os.read(file." -"fileno(), maxbytecount)`` を使ってください。" +"を使うといいです。その他のファイルには、 raw 読み込みか " +"``os.read(file.fileno(), maxbytecount)`` を使ってください。" #: ../../library/tkinter.rst:1031 msgid "" @@ -2089,9 +2224,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..498873c3c 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 @@ -48,15 +48,15 @@ msgstr "" msgid "" "The text widget and scrollbar are packed together in a :class:`Frame`, and " "the methods of the :class:`Grid` and :class:`Pack` geometry managers are " -"acquired from the :class:`Frame` object. This allows the :class:" -"`ScrolledText` widget to be used directly to achieve most normal geometry " -"management behavior." +"acquired from the :class:`Frame` object. This allows " +"the :class:`ScrolledText` widget to be used directly to achieve most normal " +"geometry management behavior." msgstr "" "テキストウィジェットとスクロールバーは :class:`Frame` の中に一緒にpack\\ さ" -"れ、 :class:`Grid` と :class:`Pack` ジオメトリマネジャのメソッドは\\ :class:" -"`Frame` オブジェクトから得られます。これによって、もっとも標準的なジオメトリ" -"マネジャの振る舞いにするために、直接 :class:`ScrolledText` ウィジェットを使え" -"るようになります。" +"れ、 :class:`Grid` と :class:`Pack` ジオメトリマネジャのメソッドは" +"\\ :class:`Frame` オブジェクトから得られます。これによって、もっとも標準的な" +"ジオメトリマネジャの振る舞いにするために、直接 :class:`ScrolledText` ウィ" +"ジェットを使えるようになります。" #: ../../library/tkinter.scrolledtext.rst:24 msgid "" diff --git a/library/tkinter.tix.po b/library/tkinter.tix.po index 8c5b5d978..826f30998 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 @@ -34,8 +34,8 @@ msgstr "**ソースコード:** :source:`Lib/tkinter/tix.py`" #: ../../library/tkinter.tix.rst:13 msgid "" -"This Tk extension is unmaintained and should not be used in new code. Use :" -"mod:`tkinter.ttk` instead." +"This Tk extension is unmaintained and should not be used in new code. " +"Use :mod:`tkinter.ttk` instead." msgstr "" "この Tk 拡張は保守されておらず、新しいコードでは使うべきではありません。\n" "その代わりに :mod:`tkinter.ttk` を使ってください。" @@ -48,19 +48,19 @@ msgid "" "provides most of the commonly needed widgets that are missing from standard " "Tk: :class:`HList`, :class:`ComboBox`, :class:`Control` (a.k.a. SpinBox) and " "an assortment of scrollable widgets. :mod:`tkinter.tix` also includes many " -"more widgets that are generally useful in a wide range of applications: :" -"class:`NoteBook`, :class:`FileEntry`, :class:`PanedWindow`, etc; there are " -"more than 40 of them." +"more widgets that are generally useful in a wide range of " +"applications: :class:`NoteBook`, :class:`FileEntry`, :class:`PanedWindow`, " +"etc; there are more than 40 of them." msgstr "" ":mod:`tkinter.tix` (Tk Interface Extension) モジュールは豊富な追加ウィジェッ" "トを提供します。標準 Tk ライブラリには多くの有用なウィジェットがありますが、" -"決して完全ではありません。 :mod:`tkinter.tix` ライブラリは、:class:" -"`HList` 、 :class:`ComboBox` 、 :class:`Control` (別名SpinBox) および各種のス" -"クロール可能なウィジェットなど、標準 Tk にはないが、一般的に必要とされるウィ" -"ジェットの大部分を提供します。 :mod:`tkinter.tix` には、:class:" -"`NoteBook` 、 :class:`FileEntry` 、 :class:`PanedWindow` など、一般的に幅広い" -"用途に役に立つたくさんのウィジェットも含まれています。それらは40以上ありま" -"す。" +"決して完全ではありません。 :mod:`tkinter.tix` ライブラリ" +"は、:class:`HList` 、 :class:`ComboBox` 、 :class:`Control` (別名SpinBox) お" +"よび各種のスクロール可能なウィジェットなど、標準 Tk にはないが、一般的に必要" +"とされるウィジェットの大部分を提供します。 :mod:`tkinter.tix` に" +"は、:class:`NoteBook` 、 :class:`FileEntry` 、 :class:`PanedWindow` など、一" +"般的に幅広い用途に役に立つたくさんのウィジェットも含まれています。それらは40" +"以上あります。" #: ../../library/tkinter.tix.rst:29 msgid "" @@ -108,11 +108,11 @@ msgstr "プログラマ用参考資料のオンライン版。" #: ../../library/tkinter.tix.rst:46 msgid "" -"`Tix Development Applications `_" +"`Tix Development Applications `_" msgstr "" -"`Tix Development Applications `_" +"`Tix Development Applications `_" #: ../../library/tkinter.tix.rst:47 msgid "" @@ -122,8 +122,8 @@ msgid "" msgstr "" "Tix と Tkinter プログラムの開発のための Tix アプリケーション。 Tideアプリケー" "ションは Tk または Tkinter に基づいて動作します。また、リモートで Tix/Tk/" -"Tkinter アプリケーションを変更やデバッグするためのインスペクタ :program:" -"`TixInspect` が含まれます。" +"Tkinter アプリケーションを変更やデバッグするためのインスペク" +"タ :program:`TixInspect` が含まれます。" #: ../../library/tkinter.tix.rst:53 msgid "Using Tix" @@ -139,11 +139,11 @@ msgstr "" #: ../../library/tkinter.tix.rst:61 msgid "" -"Classes in the :mod:`tkinter.tix` module subclasses the classes in the :mod:" -"`tkinter`. The former imports the latter, so to use :mod:`tkinter.tix` with " -"Tkinter, all you need to do is to import one module. In general, you can " -"just import :mod:`tkinter.tix`, and replace the toplevel call to :class:" -"`tkinter.Tk` with :class:`tix.Tk`::" +"Classes in the :mod:`tkinter.tix` module subclasses the classes in " +"the :mod:`tkinter`. The former imports the latter, so to " +"use :mod:`tkinter.tix` with Tkinter, all you need to do is to import one " +"module. In general, you can just import :mod:`tkinter.tix`, and replace the " +"toplevel call to :class:`tkinter.Tk` with :class:`tix.Tk`::" msgstr "" ":mod:`tkinter.tix` モジュールのクラスは :mod:`tkinter` モジュールのクラスをサ" "ブクラス化します。前者は後者をインポートするので、モジュールを一つインポート" @@ -167,12 +167,13 @@ msgstr "Tixウィジェット" #: ../../library/tkinter.tix.rst:83 msgid "" -"`Tix `_ introduces over 40 widget classes to the :mod:`tkinter` repertoire." +"`Tix `_ introduces over 40 widget classes to the :mod:`tkinter` " +"repertoire." msgstr "" -"`Tix `_ は40個以上のウィジェットクラスを :mod:`tkinter` のレパートリーに導入し" -"ます。" +"`Tix `_ は40個以上のウィジェットクラスを :mod:`tkinter` のレパート" +"リーに導入します。" #: ../../library/tkinter.tix.rst:88 msgid "Basic Widgets" @@ -185,11 +186,11 @@ msgid "" "moves the cursor inside a widget to which a Balloon widget has been bound, a " "small pop-up window with a descriptive message will be shown on the screen." msgstr "" -"ヘルプを提示するためにウィジェット上にポップアップする `Balloon `_。ユーザがカー" -"ソルをBalloonウィジェットが束縛されているウィジェット内部へ移動させたとき、説" -"明のメッセージが付いた小さなポップアップウィンドウがスクリーン上に表示されま" -"す。" +"ヘルプを提示するためにウィジェット上にポップアップする `Balloon `_。ユーザが" +"カーソルをBalloonウィジェットが束縛されているウィジェット内部へ移動させたと" +"き、説明のメッセージが付いた小さなポップアップウィンドウがスクリーン上に表示" +"されます。" #: ../../library/tkinter.tix.rst:105 msgid "" @@ -258,9 +259,9 @@ msgid "" "tixMeter.htm>`_ widget can be used to show the progress of a background job " "which may take a long time to execute." msgstr "" -"`Meter `_ ウィジェットは実行に時間のかかるバックグラウンド・ジョブの進み具合を表" -"示するために使用できます。" +"`Meter `_ ウィジェットは実行に時間のかかるバックグラウンド・ジョブの進" +"み具合を表示するために使用できます。" #: ../../library/tkinter.tix.rst:174 msgid "" @@ -288,10 +289,10 @@ msgid "" "tixSelect.htm>`_ widget is a container of button subwidgets. It can be used " "to provide radio-box or check-box style of selection options for the user." msgstr "" -"`Select `_ ウィジェットはボタン・サブウィジェットのコンテナです。ユーザに対する選" -"択オプションのラジオボックスまたはチェックボックス形式を提供するために利用す" -"ることができます。" +"`Select `_ ウィジェットはボタン・サブウィジェットのコンテナです。ユーザ" +"に対する選択オプションのラジオボックスまたはチェックボックス形式を提供するた" +"めに利用することができます。" #: ../../library/tkinter.tix.rst:207 msgid "" @@ -409,10 +410,10 @@ msgid "" "entries are indented and connected by branch lines according to their places " "in the hierarchy." msgstr "" -"`HList `_ ウィジェットは階層構造をもつどんなデータ(例えば、ファイルシステムディ" -"レクトリツリー)でも表示するために使用できます。リストエントリは字下げされ、階" -"層のそれぞれの場所に応じて分岐線で接続されます。" +"`HList `_ ウィジェットは階層構造をもつどんなデータ(例えば、ファイルシス" +"テムディレクトリツリー)でも表示するために使用できます。リストエントリは字下げ" +"され、階層のそれぞれの場所に応じて分岐線で接続されます。" #: ../../library/tkinter.tix.rst:319 msgid "" @@ -430,14 +431,15 @@ msgstr "" #: ../../library/tkinter.tix.rst:335 msgid "" -"The `Tree `_ widget can be used to display hierarchical data in a tree form. The " -"user can adjust the view of the tree by opening or closing parts of the tree." +"The `Tree `_ widget can be used to display hierarchical data in a tree " +"form. The user can adjust the view of the tree by opening or closing parts " +"of the tree." msgstr "" -"`Tree `_ ウィジェットは階層的なデータをツリー形式で表示するために使うことができ" -"ます。ユーザはツリーの一部を開いたり閉じたりすることによって、ツリーの見えを" -"調整できます。" +"`Tree `_ ウィジェットは階層的なデータをツリー形式で表示するために使うこ" +"とができます。ユーザはツリーの一部を開いたり閉じたりすることによって、ツリー" +"の見えを調整できます。" #: ../../library/tkinter.tix.rst:347 msgid "Tabular ListBox" @@ -452,12 +454,12 @@ msgid "" "display the list entries in a two dimensional format and (2) you can use " "graphical images as well as multiple colors and fonts for the list entries." msgstr "" -"`TList `_ ウィジェットは、表形式でデータを表示するために使うことができます。 :" -"class:`TList` ウィジェットのリスト・エントリは、Tkのリストボックス・ウィ" -"ジェットのエントリに似ています。主な差は、(1) :class:`TList` ウィジェットはリ" -"スト・エントリを二次元形式で表示でき、(2) リスト・エントリに対して複数の色や" -"フォントだけでなく画像も使うことができるということです。" +"`TList `_ ウィジェットは、表形式でデータを表示するために使うことができ" +"ます。 :class:`TList` ウィジェットのリスト・エントリは、Tkのリストボックス・" +"ウィジェットのエントリに似ています。主な差は、(1) :class:`TList` ウィジェット" +"はリスト・エントリを二次元形式で表示でき、(2) リスト・エントリに対して複数の" +"色やフォントだけでなく画像も使うことができるということです。" #: ../../library/tkinter.tix.rst:375 msgid "Manager Widgets" @@ -484,16 +486,16 @@ msgid "" "widget: it can be used to display many windows in a limited space using a " "notebook metaphor. The notebook is divided into a stack of pages (windows). " "At one time only one of these pages can be shown. The user can navigate " -"through these pages by choosing the name of the desired page in the :attr:" -"`hlist` subwidget." +"through these pages by choosing the name of the desired page in " +"the :attr:`hlist` subwidget." msgstr "" "`ListNoteBook `_ ウィジェットは、 :class:`TixNoteBook` ウィジェットにと" "てもよく似ています。ノートのメタファを使って限られた空間をに多くのウィンドウ" "を表示するために使われます。ノートはたくさんのページ(ウィンドウ)に分けられて" -"います。ある時には、これらのページの一つしか表示できません。ユーザは :attr:" -"`hlist` サブウィジェットの中の望みのページの名前を選択することによって、これ" -"らのページを切り替えることができます。" +"います。ある時には、これらのページの一つしか表示できません。ユーザ" +"は :attr:`hlist` サブウィジェットの中の望みのページの名前を選択することによっ" +"て、これらのページを切り替えることができます。" #: ../../library/tkinter.tix.rst:406 msgid "" @@ -521,9 +523,9 @@ msgstr ":mod:`tkinter.tix` モジュールは次のものを追加します:" #: ../../library/tkinter.tix.rst:432 msgid "" -"`pixmap `_ capabilities to all :mod:`tkinter.tix` and :mod:`tkinter` widgets to " -"create color images from XPM files." +"`pixmap `_ capabilities to all :mod:`tkinter.tix` and :mod:`tkinter` " +"widgets to create color images from XPM files." msgstr "" "全ての :mod:`tkinter.tix` と :mod:`tkinter` ウィジェットに対して XPM ファイル" "からカラー画像を作成する `pixmap `_ image types can be used to create images that consists of multiple " -"horizontal lines; each line is composed of a series of items (texts, " -"bitmaps, images or spaces) arranged from left to right. For example, a " -"compound image can be used to display a bitmap and a text string " +"`Compound `_ image types can be used to create images that consists of " +"multiple horizontal lines; each line is composed of a series of items " +"(texts, bitmaps, images or spaces) arranged from left to right. For example, " +"a compound image can be used to display a bitmap and a text string " "simultaneously in a Tk :class:`Button` widget." msgstr "" -"`Compound `_ 画像タイプは複数の水平方向の線から構成される画像を作成するために使うこ" -"とができます。それぞれの線は左から右に並べられた一連のアイテム(テキスト、ビッ" -"トマップ、画像あるいは空白)から作られます。例えば、Tk の\\ :class:`Button` " -"ウィジェットの中にビットマップとテキスト文字列を同時に表示するためにcompound" -"画像は使うことができます。" +"`Compound `_ 画像タイプは複数の水平方向の線から構成される画像を作成するた" +"めに使うことができます。それぞれの線は左から右に並べられた一連のアイテム(テキ" +"スト、ビットマップ、画像あるいは空白)から作られます。例えば、Tk の" +"\\ :class:`Button` ウィジェットの中にビットマップとテキスト文字列を同時に表示" +"するためにcompound画像は使うことができます。" #: ../../library/tkinter.tix.rst:460 msgid "Miscellaneous Widgets" @@ -571,12 +573,12 @@ msgstr "" #: ../../library/tkinter.tix.rst:479 msgid "" -"The `Form `_ geometry manager based on attachment rules for all Tk widgets." +"The `Form `_ geometry manager based on attachment rules for all Tk widgets." msgstr "" -"すべての Tk ウィジェットに対する接続ルールに基づいた `Form `_ ジオメトリマネ" -"ジャ。" +"すべての Tk ウィジェットに対する接続ルールに基づいた `Form `_ ジオメトリマ" +"ネジャ。" #: ../../library/tkinter.tix.rst:485 msgid "Tix Commands" @@ -590,11 +592,11 @@ msgid "" "manipulated by these methods pertains to the application as a whole, or to a " "screen or display, rather than to a particular window." msgstr "" -"`tixコマンド `_ は :mod:`Tix` の内部状態と :mod:`Tix` アプリケーション・コンテキストの" -"いろいろな要素へのアクセスを提供します。これらのメソッドによって操作される情" -"報の大部分は、特定のウィンドウというよりむしろアプリケーション全体かスクリー" -"ンあるいはディスプレイに関するものです。" +"`tixコマンド `_ は :mod:`Tix` の内部状態と :mod:`Tix` アプリケーション・コンテキス" +"トのいろいろな要素へのアクセスを提供します。これらのメソッドによって操作され" +"る情報の大部分は、特定のウィンドウというよりむしろアプリケーション全体かスク" +"リーンあるいはディスプレイに関するものです。" #: ../../library/tkinter.tix.rst:497 msgid "To view the current settings, the common usage is::" @@ -631,11 +633,12 @@ msgstr "" #: ../../library/tkinter.tix.rst:524 msgid "" "Locates a bitmap file of the name ``name.xpm`` or ``name`` in one of the " -"bitmap directories (see the :meth:`tix_addbitmapdir` method). By using :" -"meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the bitmap " -"files in your application. When successful, it returns the complete pathname " -"of the bitmap file, prefixed with the character ``@``. The returned value " -"can be used to configure the ``bitmap`` option of the Tk and Tix widgets." +"bitmap directories (see the :meth:`tix_addbitmapdir` method). By " +"using :meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the " +"bitmap files in your application. When successful, it returns the complete " +"pathname of the bitmap file, prefixed with the character ``@``. The " +"returned value can be used to configure the ``bitmap`` option of the Tk and " +"Tix widgets." msgstr "" "ビットマップディレクトリの一つの中の ``name.xpm`` または ``name`` と言う名前" "のビットマップファイルの場所を見つけ出します (:meth:`tix_addbitmapdir` メソッ" @@ -649,17 +652,17 @@ msgstr "" msgid "" "Tix maintains a list of directories under which the :meth:`tix_getimage` " "and :meth:`tix_getbitmap` methods will search for image files. The standard " -"bitmap directory is :file:`$TIX_LIBRARY/bitmaps`. The :meth:" -"`tix_addbitmapdir` method adds *directory* into this list. By using this " -"method, the image files of an applications can also be located using the :" -"meth:`tix_getimage` or :meth:`tix_getbitmap` method." +"bitmap directory is :file:`$TIX_LIBRARY/bitmaps`. " +"The :meth:`tix_addbitmapdir` method adds *directory* into this list. By " +"using this method, the image files of an applications can also be located " +"using the :meth:`tix_getimage` or :meth:`tix_getbitmap` method." msgstr "" "Tix は :meth:`tix_getimage` と :meth:`tix_getbitmap` メソッドが画像ファイルを" "検索する検索先ディレクトリのリストを保持しています。標準ビットマップディレク" "トリは :file:`$TIX_LIBRARY/bitmaps` です。 :meth:`tix_addbitmapdir` メソッド" -"は *directory* をこのリストに追加します。そのメソッドを使うことによって、:" -"meth:`tix_getimage` または :meth:`tix_getbitmap` メソッドを使ってアプリケー" -"ションの画像ファイルも見つけることができます。" +"は *directory* をこのリストに追加します。そのメソッドを使うことによっ" +"て、:meth:`tix_getimage` または :meth:`tix_getbitmap` メソッドを使ってアプリ" +"ケーションの画像ファイルも見つけることができます。" #: ../../library/tkinter.tix.rst:544 msgid "" @@ -673,35 +676,35 @@ msgid "" msgstr "" "このアプリケーションからの異なる呼び出しの間で共有される可能性があるファイル" "選択ダイアログを返します。最初に呼ばれた時に、このメソッドはファイル選択ダイ" -"アログ・ウィジェットを作成します。このダイアログはその後のすべての :meth:" -"`tix_filedialog` への呼び出しで返されます。オプションの dlgclass パラメータ" -"は、要求されているファイル選択ダイアログ・ウィジェットの型を指定するために文" -"字列として渡されます。指定可能なオプションは ``tix`` 、 ``FileSelectDialog`` " -"あるいは ``tixExFileSelectDialog`` です。" +"アログ・ウィジェットを作成します。このダイアログはその後のすべて" +"の :meth:`tix_filedialog` への呼び出しで返されます。オプションの dlgclass パ" +"ラメータは、要求されているファイル選択ダイアログ・ウィジェットの型を指定する" +"ために文字列として渡されます。指定可能なオプションは ``tix`` 、 " +"``FileSelectDialog`` あるいは ``tixExFileSelectDialog`` です。" #: ../../library/tkinter.tix.rst:554 msgid "" -"Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` or :" -"file:`name.ppm` in one of the bitmap directories (see the :meth:" -"`tix_addbitmapdir` method above). If more than one file with the same name " -"(but different extensions) exist, then the image type is chosen according to " -"the depth of the X display: xbm images are chosen on monochrome displays and " -"color images are chosen on color displays. By using :meth:`tix_getimage`, " -"you can avoid hard coding the pathnames of the image files in your " -"application. When successful, this method returns the name of the newly " -"created image, which can be used to configure the ``image`` option of the Tk " -"and Tix widgets." +"Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` " +"or :file:`name.ppm` in one of the bitmap directories (see " +"the :meth:`tix_addbitmapdir` method above). If more than one file with the " +"same name (but different extensions) exist, then the image type is chosen " +"according to the depth of the X display: xbm images are chosen on monochrome " +"displays and color images are chosen on color displays. By " +"using :meth:`tix_getimage`, you can avoid hard coding the pathnames of the " +"image files in your application. When successful, this method returns the " +"name of the newly created image, which can be used to configure the " +"``image`` option of the Tk and Tix widgets." msgstr "" "ビットマップディレクトリの一つの中の :file:`name.xpm` 、 :file:`name.xbm` ま" -"たは :file:`name.ppm` という名前の画像ファイルの場所を見つけ出します(上の :" -"meth:`tix_addbitmapdir` メソッドを参照してください)。同じ名前(だが異なる拡張" -"子)のファイルが一つ以上ある場合は、画像のタイプがXディスプレイの深さに応じて" -"選択されます。xbm画像はモノクロディスプレイの場合に選択され、カラー画像はカ" -"ラーディスプレイの場合に選択されます。 :meth:`tix_getimage` を使うことによっ" -"て、アプリケーションに画像ファイルのパス名をハードコーディングすることを避け" -"られます。成功すれば、このメソッドは新たに作成した画像の名前を返し、\\ Tk と " -"Tix ウィジェットの ``image`` オプションを設定するためにそれを使うことができま" -"す。" +"たは :file:`name.ppm` という名前の画像ファイルの場所を見つけ出します(上" +"の :meth:`tix_addbitmapdir` メソッドを参照してください)。同じ名前(だが異なる" +"拡張子)のファイルが一つ以上ある場合は、画像のタイプがXディスプレイの深さに応" +"じて選択されます。xbm画像はモノクロディスプレイの場合に選択され、カラー画像は" +"カラーディスプレイの場合に選択されます。 :meth:`tix_getimage` を使うことに" +"よって、アプリケーションに画像ファイルのパス名をハードコーディングすることを" +"避けられます。成功すれば、このメソッドは新たに作成した画像の名前を返し、\\ " +"Tk と Tix ウィジェットの ``image`` オプションを設定するためにそれを使うことが" +"できます。" #: ../../library/tkinter.tix.rst:567 msgid "Gets the options maintained by the Tix scheme mechanism." @@ -731,8 +734,8 @@ msgstr "" msgid "" "Because of the way Tk handles the X option database, after Tix has been has " "imported and inited, it is not possible to reset the color schemes and font " -"sets using the :meth:`tix_config` method. Instead, the :meth:" -"`tix_resetoptions` method must be used." +"sets using the :meth:`tix_config` method. Instead, " +"the :meth:`tix_resetoptions` method must be used." msgstr "" "Tk が X オプションデータベースを扱う方法のため、Tix がインポートされ初期化さ" "れた後に、カラースキームとフォントセットを :meth:`tix_config` メソッドを使っ" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 9fb005d2d..ffcb271da 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,25 +82,22 @@ 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 "" -"That code causes several :mod:`tkinter.ttk` widgets (:class:`Button`, :class:" -"`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:" -"`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:" -"`Radiobutton`, :class:`Scale` and :class:`Scrollbar`) to automatically " -"replace the Tk widgets." +"That code causes several :mod:`tkinter.ttk` widgets " +"(:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale` " +"and :class:`Scrollbar`) to automatically replace the Tk widgets." msgstr "" -"このように書くと、いくつかの :mod:`tkinter.ttk` ウィジェット (:class:" -"`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:" -"`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :" -"class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`) は自動的に Tk ウィ" -"ジェットを置き換えます。" +"このように書くと、いくつかの :mod:`tkinter.ttk` ウィジェット " +"(:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`) " +"は自動的に Tk ウィジェットを置き換えます。" #: ../../library/tkinter.ttk.rst:49 msgid "" @@ -120,8 +116,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:59 msgid "" -"`Converting existing applications to use Tile widgets `_" +"`Converting existing applications to use Tile widgets `_" msgstr "" #: ../../library/tkinter.ttk.rst:60 @@ -138,21 +134,17 @@ msgstr "Ttk ウィジェット" #: ../../library/tkinter.ttk.rst:67 msgid "" -"Ttk comes with 18 widgets, twelve of which already existed in tkinter: :" -"class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:" -"`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :" -"class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, and :class:" -"`Spinbox`. The other six are new: :class:`Combobox`, :class:`Notebook`, :" -"class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` and :class:" -"`Treeview`. And all them are subclasses of :class:`Widget`." +"Ttk comes with 18 widgets, twelve of which already existed in " +"tkinter: :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, " +"and :class:`Spinbox`. The other six are " +"new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` " +"and :class:`Treeview`. And all them are subclasses of :class:`Widget`." msgstr "" "Ttk には 18 のウィジェットがあり、そのうち 12 は Tkinter に既にあるもので" -"す: :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :" -"class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:" -"`PanedWindow`, :class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, :" -"class:`Spinbox` 。新しい 6 つは次のものです: :class:`Combobox`, :class:" -"`Notebook`, :class:`Progressbar`, :class:`Separator`, :class:`Sizegrip`, :" -"class:`Treeview` 。そして、これらは全て :class:`Widget` の子クラスです。" +"す: :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, :class:`Spinbox` 。" +"新しい 6 つは次のもので" +"す: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, :class:`Separator`, :class:`Sizegrip`, :class:`Treeview` 。" +"そして、これらは全て :class:`Widget` の子クラスです。" #: ../../library/tkinter.ttk.rst:75 msgid "" @@ -166,17 +158,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 +176,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 +431,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 "" @@ -584,9 +579,9 @@ msgid "" "Besides the methods described below, the :class:`ttk.Widget` supports the " "methods :meth:`tkinter.Widget.cget` and :meth:`tkinter.Widget.configure`." msgstr "" -"以下に書かれているメソッドに加えて、 :class:`ttk.Widget` は :meth:`tkinter." -"Widget.cget` メソッドと :meth:`tkinter.Widget.configure` メソッドをサポートし" -"ています。" +"以下に書かれているメソッドに加えて、 :class:`ttk.Widget` " +"は :meth:`tkinter.Widget.cget` メソッドと :meth:`tkinter.Widget.configure` メ" +"ソッドをサポートしています。" #: ../../library/tkinter.ttk.rst:270 msgid "" @@ -642,19 +637,17 @@ msgstr "" #: ../../library/tkinter.ttk.rst:300 msgid "" -"Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" -"meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " -"and :meth:`Widget.state`, and the following inherited from :class:`Entry`: :" -"meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry." -"index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`, " +"Besides the methods inherited " +"from :class:`Widget`: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " +"and :meth:`Widget.state`, and the following inherited " +"from :class:`Entry`: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`, " "it has some other methods, described at :class:`ttk.Combobox`." msgstr "" -":class:`Widget` から継承したメソッド (:meth:`Widget.cget`, :meth:`Widget." -"configure`, :meth:`Widget.identify`, :meth:`Widget.instate`, :meth:`Widget." -"state`) と以下の :class:`Entry` から継承したメソッド (:meth:`Entry.bbox`, :" -"meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:" -"`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`) に加え、このク" -"ラスには :class:`ttk.Combobox` で説明するメソッドがあります。" +":class:`Widget` から継承したメソッド " +"(:meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate`, :meth:`Widget.state`) " +"と以下の :class:`Entry` から継承したメソッド " +"(:meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`) " +"に加え、このクラスには :class:`ttk.Combobox` で説明するメソッドがあります。" #: ../../library/tkinter.ttk.rst:310 ../../library/tkinter.ttk.rst:396 #: ../../library/tkinter.ttk.rst:472 ../../library/tkinter.ttk.rst:662 @@ -694,10 +687,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 +779,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 "" @@ -801,108 +791,117 @@ msgstr "" #: ../../library/tkinter.ttk.rst:388 msgid "" -"Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" -"meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " -"and :meth:`Widget.state`, and the following inherited from :class:`Entry`: :" -"meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry." -"index`, :meth:`Entry.insert`, :meth:`Entry.xview`, it has some other " -"methods, described at :class:`ttk.Spinbox`." +"Besides the methods inherited " +"from :class:`Widget`: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " +"and :meth:`Widget.state`, and the following inherited " +"from :class:`Entry`: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.xview`, " +"it has some other methods, described at :class:`ttk.Spinbox`." msgstr "" -":class:`Widget` から継承したメソッド: :meth:`Widget.cget`, :meth:`Widget." -"configure`, :meth:`Widget.identify`, :meth:`Widget.instate`, :meth:`Widget." -"state` と、以下の :class:`Entry` から継承したメソッド: :meth:`Entry.bbox`, :" -"meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:" -"`Entry.insert`, :meth:`Entry.xview` に加え、このクラスには :class:`ttk." -"Spinbox` で説明するいくつかのメソッドがあります。" +":class:`Widget` から継承したメソッ" +"ド: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate`, :meth:`Widget.state` " +"と、以下の :class:`Entry` から継承したメソッ" +"ド: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.xview` " +"に加え、このクラスには :class:`ttk.Spinbox` で説明するいくつかのメソッドがあ" +"ります。" #: ../../library/tkinter.ttk.rst:405 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 +917,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 +942,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" @@ -1001,8 +998,8 @@ msgstr "タブに表示するテキストを指定します。" #: ../../library/tkinter.ttk.rst:523 msgid "" -"Specifies an image to display in the tab. See the option image described in :" -"class:`Widget`." +"Specifies an image to display in the tab. See the option image described " +"in :class:`Widget`." msgstr "" "タブに表示する画像を指定します。 :class:`Widget` のオプション image の説明を" "参照してください。" @@ -1019,12 +1016,12 @@ msgstr "" #: ../../library/tkinter.ttk.rst:530 msgid "" "Specifies the index (0-based) of a character to underline in the text " -"string. The underlined character is used for mnemonic activation if :meth:" -"`Notebook.enable_traversal` is called." +"string. The underlined character is used for mnemonic activation " +"if :meth:`Notebook.enable_traversal` is called." msgstr "" -"テキスト中の下線を引く文字のインデックス (0 基点) を指定します。 :meth:" -"`Notebook.enable_traversal` が呼ばれていた場合、下線が引かれた文字はショート" -"カットとして使われます。" +"テキスト中の下線を引く文字のインデックス (0 基点) を指定しま" +"す。 :meth:`Notebook.enable_traversal` が呼ばれていた場合、下線が引かれた文字" +"はショートカットとして使われます。" #: ../../library/tkinter.ttk.rst:538 msgid "Tab Identifiers" @@ -1117,12 +1114,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 +1282,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" @@ -1332,9 +1329,9 @@ msgstr "ttk.Progressbar" #: ../../library/tkinter.ttk.rst:705 msgid "" -"Begin autoincrement mode: schedules a recurring timer event that calls :meth:" -"`Progressbar.step` every *interval* milliseconds. If omitted, *interval* " -"defaults to 50 milliseconds." +"Begin autoincrement mode: schedules a recurring timer event that " +"calls :meth:`Progressbar.step` every *interval* milliseconds. If omitted, " +"*interval* defaults to 50 milliseconds." msgstr "" "自動増加モードを開始します: *interval* ミリ秒ごとに :meth:`Progressbar.step` " "を繰り返し呼び出すタイマーイベントを設定します。引数で指定しない場合は、 " @@ -1350,8 +1347,8 @@ msgstr "引数で指定しない場合は、 *amount* はデフォルトで 1.0 #: ../../library/tkinter.ttk.rst:719 msgid "" -"Stop autoincrement mode: cancels any recurring timer event initiated by :" -"meth:`Progressbar.start` for this progress bar." +"Stop autoincrement mode: cancels any recurring timer event initiated " +"by :meth:`Progressbar.start` for this progress bar." msgstr "" "自動増加モードを停止します: このプログレスバーの :meth:`Progressbar.start` で" "開始された繰り返しのタイマーイベントを全てキャンセルします。" @@ -1416,8 +1413,8 @@ msgid "" "will just mask the widget." msgstr "" "macOS では、最上位のウィンドウにはデフォルトで組み込みのサイズグリップが含ま" -"れています。組み込みのグリップが :class:`Sizegrip` を隠してしまうので、 :" -"class:`Sizegrip` を追加しても問題ありません。" +"れています。組み込みのグリップが :class:`Sizegrip` を隠してしまうので、 " +"``Sizegrip`` を追加しても問題ありません。" #: ../../library/tkinter.ttk.rst:766 msgid "Bugs" @@ -1487,12 +1484,13 @@ msgstr "" #: ../../library/tkinter.ttk.rst:795 msgid "" "The Treeview widget supports horizontal and vertical scrolling, according to " -"the options described in `Scrollable Widget Options`_ and the methods :meth:" -"`Treeview.xview` and :meth:`Treeview.yview`." +"the options described in `Scrollable Widget Options`_ and the " +"methods :meth:`Treeview.xview` and :meth:`Treeview.yview`." msgstr "" "ツリービューウィジェットは水平方向と垂直方向のスクロールをサポートしていて、 " -"`Scrollable Widget Options`_ に記述してあるオプションと :meth:`Treeview." -"xview` メソッドおよび :meth:`Treeview.yview` メソッドが使えます。" +"`Scrollable Widget Options`_ に記述してあるオプション" +"と :meth:`Treeview.xview` メソッドおよび :meth:`Treeview.yview` メソッドが使" +"えます。" #: ../../library/tkinter.ttk.rst:810 msgid "columns" @@ -1537,26 +1535,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 +1610,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 +1835,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 +1851,8 @@ msgid "" "cell." msgstr "このカラムでセルに対してテキストをどう配置するかを指定します。" -#: ../../library/tkinter.ttk.rst:994 msgid "*minwidth*: width" -msgstr "" +msgstr "*minwidth*: 幅" #: ../../library/tkinter.ttk.rst:995 msgid "" @@ -1871,9 +1864,8 @@ msgstr "" "ウィジェットのサイズが変更されたりカラムをユーザがドラッグして移動させたりし" "たときに、このオプションで指定した幅より狭くすることはありません。" -#: ../../library/tkinter.ttk.rst:998 msgid "*stretch*: ``True``/``False``" -msgstr "" +msgstr "*stretch*: ``True``/``False``" #: ../../library/tkinter.ttk.rst:999 msgid "" @@ -1883,9 +1875,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 +1892,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 +1907,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 +1939,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 +1963,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 +2082,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 +2146,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." @@ -2271,8 +2254,8 @@ msgid "" "elements making up the widget and how they are arranged, along with dynamic " "and default settings for element options. By default the style name is the " "same as the widget's class name, but it may be overridden by the widget's " -"style option. If you don't know the class name of a widget, use the method :" -"meth:`Misc.winfo_class` (somewidget.winfo_class())." +"style option. If you don't know the class name of a widget, use the " +"method :meth:`Misc.winfo_class` (somewidget.winfo_class())." msgstr "" ":mod:`ttk` のそれぞれのウィジェットにはスタイルが関連付けられていて、それと動" "的もしくはデフォルトで設定される要素のオプションによってウィジェットを構成す" @@ -2318,7 +2301,6 @@ msgstr "" "例えば、全てのデフォルトのボタンをパディングのある平らな見た目にし、背景の色" "を変更するには以下のようにします::" -#: ../../library/tkinter.ttk.rst:1294 msgid "" "from tkinter import ttk\n" "import tkinter\n" @@ -2333,6 +2315,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 +2347,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 +2363,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 +2410,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 +2439,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 +2469,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 +2586,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 +2593,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 +2616,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 +2636,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 +2689,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." @@ -2677,20 +2741,19 @@ msgstr "" msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " -"have the same format as specified by the methods :meth:`Style.configure`, :" -"meth:`Style.map`, :meth:`Style.layout` and :meth:`Style.element_create` " -"respectively." +"have the same format as specified by the " +"methods :meth:`Style.configure`, :meth:`Style.map`, :meth:`Style.layout` " +"and :meth:`Style.element_create` respectively." msgstr "" "*settings* のそれぞれのキーはスタイル名で値はさらに 'configure', 'map', " -"'layout', 'element create' をキーとして持ち、その値はそれぞれ :meth:`Style." -"configure`, :meth:`Style.map`, :meth:`Style.layout`, :meth:`Style." -"element_create` メソッドで指定するのと同じ形式である必要があります。" +"'layout', 'element create' をキーとして持ち、その値はそれぞ" +"れ :meth:`Style.configure`, :meth:`Style.map`, :meth:`Style.layout`, :meth:`Style.element_create` " +"メソッドで指定するのと同じ形式である必要があります。" #: ../../library/tkinter.ttk.rst:1532 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 +2778,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 +2819,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 +2841,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..55be2125e 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,121 @@ msgid "" "sequences." msgstr "" -#: ../../library/token.rst:70 msgid "" -"A generic token value that indicates an :ref:`operator ` or :ref:" -"`delimiter `." +"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." +"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." +"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 +229,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." +"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." +"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." +"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.)" +"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)." +"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..1c318fc4c 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 @@ -46,26 +46,29 @@ msgstr "" #: ../../library/tokenize.rst:19 msgid "" -"To simplify token stream handling, all :ref:`operator ` and :ref:" -"`delimiter ` tokens and :data:`Ellipsis` are returned using the " -"generic :data:`~token.OP` token type. The exact type can be determined by " -"checking the ``exact_type`` property on the :term:`named tuple` returned " -"from :func:`tokenize.tokenize`." +"To simplify token stream handling, all :ref:`operator ` " +"and :ref:`delimiter ` tokens and :data:`Ellipsis` are returned " +"using the generic :data:`~token.OP` token type. The exact type can be " +"determined by checking the ``exact_type`` property on the :term:`named " +"tuple` returned from :func:`tokenize.tokenize`." msgstr "" "トークン・ストリームの扱いをシンプルにするために、全ての :ref:`operator " -"` と :ref:`delimiter ` トークンおよび :data:" -"`Ellipsis` はジェネリックな :data:`~token.OP` トークンタイプとして返されま" -"す。正確な型は :func:`tokenize.tokenize` が返す :term:`named tuple` の " +"` と :ref:`delimiter ` トークンおよ" +"び :data:`Ellipsis` はジェネリックな :data:`~token.OP` トークンタイプとして返" +"されます。正確な型は :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 :" -"func:`ast.parse`). The behavior of the functions in this module is " +"syntactically valid Python code (code that does not raise when parsed " +"using :func:`ast.parse`). The behavior of the functions in this module is " "**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" @@ -78,14 +81,15 @@ msgstr "第一のエントリポイントは :term:`ジェネレータ `_). 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 "" @@ -66,21 +69,21 @@ msgstr "このモジュールは以下の関数を定義しています:" #: ../../library/tomllib.rst:39 msgid "" "Read a TOML file. The first argument should be a readable and binary file " -"object. Return a :class:`dict`. Convert TOML types to Python using this :ref:" -"`conversion table `." +"object. Return a :class:`dict`. Convert TOML types to Python using " +"this :ref:`conversion table `." msgstr "" "TOMLファイルを読み込みます。第1引数には読み込み可能なバイナリのファイルオブ" -"ジェクトを指定します。戻り値は :class:`dict` です。TOMLの型は :ref:" -"`conversion table ` を使用してPythonのデータ型に変換されま" -"す。" +"ジェクトを指定します。戻り値は :class:`dict` です。TOMLの型" +"は :ref:`conversion table ` を使用してPythonのデータ型に変" +"換されます。" #: ../../library/tomllib.rst:43 msgid "" "*parse_float* will be called with the string of every TOML float to be " "decoded. By default, this is equivalent to ``float(num_str)``. This can be " -"used to use another datatype or parser for TOML floats (e.g. :class:`decimal." -"Decimal`). The callable must not return a :class:`dict` or a :class:`list`, " -"else a :exc:`ValueError` is raised." +"used to use another datatype or parser for TOML floats " +"(e.g. :class:`decimal.Decimal`). The callable must not return " +"a :class:`dict` or a :class:`list`, else a :exc:`ValueError` is raised." msgstr "" "*parse_float* は、全てのデコードされる TOML の浮動小数点数文字列に対して呼ば" "れます。デフォルトでは、 ``float(num_str)`` と等価です。これは TOML 浮動小数" @@ -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,17 @@ 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." +"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 +160,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 +180,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 +216,7 @@ msgstr "string" #: ../../library/tomllib.rst:127 msgid "str" -msgstr "str" +msgstr "文字列" #: ../../library/tomllib.rst:129 msgid "integer" @@ -215,11 +232,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,12 +244,12 @@ msgstr "真偽値型(bool)" #: ../../library/tomllib.rst:135 msgid "offset date-time" -msgstr "オフセット付きの日時に日地" +msgstr "オフセット付きの日時" #: ../../library/tomllib.rst:135 msgid "" -"datetime.datetime (``tzinfo`` attribute set to an instance of ``datetime." -"timezone``)" +"datetime.datetime (``tzinfo`` attribute set to an instance of " +"``datetime.timezone``)" msgstr "" "datetime.datetime(``tzinfo`` 属性は ``datetime.timezone`` のインスタンスが設" "定される)" @@ -263,11 +280,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..025a8f3c2 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 "" @@ -100,11 +99,11 @@ msgstr "主要なオプション" #: ../../library/trace.rst:51 msgid "" -"At least one of the following options must be specified when invoking :mod:" -"`trace`. The :option:`--listfuncs <-l>` option is mutually exclusive with " -"the :option:`--trace <-t>` and :option:`--count <-c>` options. When :option:" -"`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :option:" -"`--trace <-t>` are accepted, and vice versa." +"At least one of the following options must be specified when " +"invoking :mod:`trace`. The :option:`--listfuncs <-l>` option is mutually " +"exclusive with the :option:`--trace <-t>` and :option:`--count <-c>` " +"options. When :option:`--listfuncs <-l>` is provided, neither :option:`--" +"count <-c>` nor :option:`--trace <-t>` are accepted, and vice versa." msgstr "" ":mod:`trace` を実行するときには、以下のオプションの少なくとも 1 つを指定しな" "ければいけません。 :option:`--listfuncs <-l>` オプションは、 :option:`--" @@ -120,8 +119,8 @@ msgid "" "C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below." msgstr "" "プログラム完了時に、それぞれの文が何回実行されたかを示す注釈付きリストのファ" -"イルを生成します。下記の :option:`--coverdir <-C>`, :option:`--file <-f>`, :" -"option:`--no-report <-R>` も参照してください。" +"イルを生成します。下記の :option:`--coverdir <-C>`, :option:`--file <-" +"f>`, :option:`--no-report <-R>` も参照してください。" #: ../../library/trace.rst:68 msgid "Display lines as they are executed." @@ -133,9 +132,9 @@ msgstr "プログラム実行の際に実行された関数を表示します。 #: ../../library/trace.rst:76 msgid "" -"Produce an annotated list from an earlier program run that used the :option:" -"`--count <-c>` and :option:`--file <-f>` option. This does not execute any " -"code." +"Produce an annotated list from an earlier program run that used " +"the :option:`--count <-c>` and :option:`--file <-f>` option. This does not " +"execute any code." msgstr "" ":option:`--count <-c>` と :option:`--file <-f>` 引数を使った過去のプログラム" "実行結果から、注釈付きリストのファイルを生成します。コードを実行するわけでは" @@ -159,8 +158,8 @@ msgstr "" #: ../../library/trace.rst:96 msgid "" -"Directory where the report files go. The coverage report for ``package." -"module`` is written to file :file:`{dir}/{package}/{module}.cover`." +"Directory where the report files go. The coverage report for " +"``package.module`` is written to file :file:`{dir}/{package}/{module}.cover`." msgstr "" "レポートファイルを保存するディレクトリを指定します。 ``package.module`` につ" "いてのカバレッジレポートは :file:`{dir}/{package}/{module}.cover` に書き込ま" @@ -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 "" @@ -315,8 +316,8 @@ msgstr "" #: ../../library/trace.rst:199 msgid "" "If *ignore_missing_files* is ``True``, coverage counts for files that no " -"longer exist are silently ignored. Otherwise, a missing file will raise a :" -"exc:`FileNotFoundError`." +"longer exist are silently ignored. Otherwise, a missing file will raise " +"a :exc:`FileNotFoundError`." msgstr "" "*ignore_missing_files* が ``True`` の場合には、すでに存在しないファイルのカバ" "レッジカウントはサイレントに無視されます。そうでなければ、ファイルが見つから" @@ -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..da910d027 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,63 +44,79 @@ 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` " +"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 " -"in the output generated and the ability to store the information necessary " -"for later formatting without holding references to actual exception and " -"traceback objects." +":class:`TracebackException` class and its helper " +"classes :class:`StackSummary` and :class:`FrameSummary`. These offer both " +"more flexibility in the output generated and the ability to store the " +"information necessary 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`." +"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." @@ -127,9 +153,12 @@ msgstr "負の *limit* がサポートされました。" #: ../../library/traceback.rst:81 msgid "" "Print exception information and stack trace entries from :ref:`traceback " -"object ` *tb* to *file*. This differs from :func:" -"`print_tb` in the following ways:" +"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,36 +182,44 @@ 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 "" "The optional *limit* argument has the same meaning as for :func:`print_tb`. " -"If *chain* is true (the default), then chained exceptions (the :attr:" -"`~BaseException.__cause__` or :attr:`~BaseException.__context__` attributes " -"of the exception) will be printed as well, like the interpreter itself does " -"when printing an unhandled exception." +"If *chain* is true (the default), then chained exceptions " +"(the :attr:`~BaseException.__cause__` or :attr:`~BaseException.__context__` " +"attributes 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 +227,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,50 +240,69 @@ 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 "" "Return a :class:`StackSummary` object representing a list of \"pre-" "processed\" stack trace entries extracted from the :ref:`traceback object " "` *tb*. It is useful for alternate formatting of stack " -"traces. The optional *limit* argument has the same meaning as for :func:" -"`print_tb`. A \"pre-processed\" stack trace entry is a :class:" -"`FrameSummary` object containing attributes :attr:`~FrameSummary.filename`, :" -"attr:`~FrameSummary.lineno`, :attr:`~FrameSummary.name`, and :attr:" -"`~FrameSummary.line` representing the information that is usually printed " -"for a stack trace." -msgstr "" +"traces. The optional *limit* argument has the same meaning as " +"for :func:`print_tb`. A \"pre-processed\" stack trace entry is " +"a :class:`FrameSummary` object containing " +"attributes :attr:`~FrameSummary.filename`, :attr:`~FrameSummary.lineno`, :attr:`~FrameSummary.name`, " +"and :attr:`~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 "" "Extract the raw traceback from the current :ref:`stack frame `. The return value has the same format as for :func:`extract_tb`. " -"The optional *f* and *limit* arguments have the same meaning as for :func:" -"`print_stack`." +"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 "" -"Print the list of tuples as returned by :func:`extract_tb` or :func:" -"`extract_stack` as a formatted stack trace to the given file. If *file* is " -"``None``, the output is written to :data:`sys.stderr`." +"Print the list of tuples as returned by :func:`extract_tb` " +"or :func:`extract_stack` as a formatted stack trace to the given file. If " +"*file* is ``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 " -"printing. Each string in the resulting list corresponds to the item with " -"the same index in the argument list. Each string ends in a newline; the " -"strings may contain internal newlines as well, for those items whose source " -"text line is not ``None``." +"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 printing. Each string in the resulting list corresponds to the " +"item with the same index in the argument list. Each string ends in a " +"newline; the 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 +315,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, " +"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 +357,10 @@ msgstr "" "改行で終わり、そのいくつかは内部に改行を含みます。これらの行が連結されて出力" "される場合は、厳密に :func:`print_exception` と同じテキストが出力されます。" -#: ../../library/traceback.rst:222 msgid "" -"This function's behavior and signature were modified to match :func:" -"`print_exception`." -msgstr "" +"This function's behavior and signature were modified to " +"match :func:`print_exception`." +msgstr "動作とシグネチャが :func:`print_exception` に合わせて変更されました。" #: ../../library/traceback.rst:229 msgid "" @@ -315,62 +378,82 @@ 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`." +"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 " -"storing this information by avoiding holding references to :ref:" -"`traceback` and :ref:`frame` objects. In " -"addition, they expose more options to configure the output compared to the " -"module-level functions described above." +"storing this information by avoiding holding references " +"to :ref:`traceback` and :ref:`frame` " +"objects. In 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 +462,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 +469,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,39 +481,44 @@ 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__`." +"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__`." +"A :class:`!TracebackException` of the " +"original :attr:`~BaseException.__context__`." msgstr "" +"元々の :attr:`~BaseException.__context__` の :class:`!TracebackException`。" #: ../../library/traceback.rst:324 msgid "" -"If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" -"class:`!TracebackException` instances representing the nested exceptions. " -"Otherwise it is ``None``." +"If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list " +"of :class:`!TracebackException` instances representing the nested " +"exceptions. Otherwise it is ``None``." msgstr "" #: ../../library/traceback.rst:332 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 +528,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 +539,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 +554,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 +574,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 +590,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 +612,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 +619,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,107 +643,143 @@ 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 " "not have read their lines in yet, making the cost of creating the :class:`!" "StackSummary` cheaper (which may be valuable if it may not actually get " -"formatted). If *capture_locals* is ``True`` the local variables in each :" -"class:`!FrameSummary` are captured as object representations." +"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." +"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 " "optionally have a stringified version of the frame's locals included in it. " -"If *lookup_line* is ``False``, the source code is not looked up until the :" -"class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute accessed " -"(which also happens when casting it to a :class:`tuple`). :attr:" -"`~FrameSummary.line` may be directly provided, and will prevent line lookups " -"happening at all. *locals* is an optional local variable mapping, and if " -"supplied the variable representations are stored in the summary for later " -"display." -msgstr "" +"If *lookup_line* is ``False``, the source code is not looked up until " +"the :class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute " +"accessed (which also happens when casting it to " +"a :class:`tuple`). :attr:`~FrameSummary.line` may be directly provided, and " +"will prevent line lookups happening at all. *locals* is an optional local " +"variable mapping, and if 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*." +"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*." +"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,45 +787,45 @@ 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 "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " -"more complete implementation of the interpreter loop, refer to the :mod:" -"`code` module. ::" +"more complete implementation of the interpreter loop, refer to " +"the :mod:`code` module. ::" msgstr "" "この簡単な例では基本的な read-eval-print ループを実装しています。標準的な " "Python の対話インタープリタループに似ていますが、 Python のものより便利ではあ" "りません。インタープリタループのより完全な実装については、 :mod:`code` モ" "ジュールを参照してください。 ::" -#: ../../library/traceback.rst:578 msgid "" "import sys, traceback\n" "\n" @@ -707,14 +843,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 +896,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" @@ -779,8 +957,8 @@ msgid "" "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 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 " @@ -791,20 +969,66 @@ msgid "" " , 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 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" 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 "" @@ -828,17 +1052,16 @@ msgid "" " ('', 3, 'another_function', 'lumberstack()'),\n" " ('', 7, 'lumberstack', 'print(repr(traceback.extract_stack()))')]\n" "[' File \"\", line 10, in \\n another_function()\\n',\n" -" ' File \"\", line 3, in another_function\\n " -"lumberstack()\\n',\n" -" ' File \"\", line 8, in lumberstack\\n print(repr(traceback." -"format_stack()))\\n']" +" ' File \"\", line 3, in another_function\\n lumberstack()" +"\\n',\n" +" ' File \"\", line 8, in lumberstack\\n " +"print(repr(traceback.format_stack()))\\n']" msgstr "" #: ../../library/traceback.rst:702 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 +1072,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 "" @@ -895,8 +1124,8 @@ msgid "" "IndexError: tuple index out of range\n" "\n" ">>> # capture_locals adds local variables in frames\n" -">>> TracebackException.from_exception(exc, limit=-2, capture_locals=True)." -"print()\n" +">>> TracebackException.from_exception(exc, limit=-2, " +"capture_locals=True).print()\n" "Traceback (most recent call last):\n" " File \"\", line 6, in lumberjack\n" " bright_side_of_life()\n" @@ -950,6 +1179,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..1fceea68a 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 @@ -65,18 +65,18 @@ msgid "" "command line option. The :func:`tracemalloc.start` function can be called at " "runtime to start tracing Python memory allocations." msgstr "" -"Python が割り当てたメモリブロックの大半をトレースするには、 :envvar:" -"`PYTHONTRACEMALLOC` 環境変数を ``1`` に設定して可能な限り早くモジュールを開始" -"させるか、:option:`-X` ``tracemalloc`` コマンドラインオプションを使用してくだ" -"さい。実行時に :func:`tracemalloc.start` を呼んで Python のメモリ割り当てのト" -"レースを開始することが出来ます。" +"Python が割り当てたメモリブロックの大半をトレースするに" +"は、 :envvar:`PYTHONTRACEMALLOC` 環境変数を ``1`` に設定して可能な限り早くモ" +"ジュールを開始させるか、:option:`-X` ``tracemalloc`` コマンドラインオプション" +"を使用してください。実行時に :func:`tracemalloc.start` を呼んで Python のメモ" +"リ割り当てのトレースを開始することが出来ます。" #: ../../library/tracemalloc.rst:27 msgid "" "By default, a trace of an allocated memory block only stores the most recent " -"frame (1 frame). To store 25 frames at startup: set the :envvar:" -"`PYTHONTRACEMALLOC` environment variable to ``25``, or use the :option:`-X` " -"``tracemalloc=25`` command line option." +"frame (1 frame). To store 25 frames at startup: set " +"the :envvar:`PYTHONTRACEMALLOC` environment variable to ``25``, or use " +"the :option:`-X` ``tracemalloc=25`` command line option." msgstr "" "デフォルトでは、割り当てられたメモリブロック1つのトレースは最新1フレームを保" "存します。開始時に25フレームを保存するには、:envvar:`PYTHONTRACEMALLOC` 環境" @@ -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,14 +238,35 @@ 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 "" "We can see that Python has loaded ``8173 KiB`` of module data (bytecode and " "constants), and that this is ``4428 KiB`` more than had been loaded before " -"the tests, when the previous snapshot was taken. Similarly, the :mod:" -"`linecache` module has cached ``940 KiB`` of Python source code to format " -"tracebacks, all of it since the previous snapshot." +"the tests, when the previous snapshot was taken. Similarly, " +"the :mod:`linecache` module has cached ``940 KiB`` of Python source code to " +"format tracebacks, all of it since the previous snapshot." msgstr "" "Python がモジュールデータ ``8173 KiB`` (バイトコードと定数) を読み込み、\n" "前回スナップショットを取ったとき、すなわちテストの前に読み込んだ量より " @@ -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" @@ -462,14 +638,15 @@ msgstr ":func:`stop` を参照してください。" #: ../../library/tracemalloc.rst:309 msgid "" -"Get the traceback where the Python object *obj* was allocated. Return a :" -"class:`Traceback` instance, or ``None`` if the :mod:`tracemalloc` module is " -"not tracing memory allocations or did not trace the allocation of the object." +"Get the traceback where the Python object *obj* was allocated. Return " +"a :class:`Traceback` instance, or ``None`` if the :mod:`tracemalloc` module " +"is not tracing memory allocations or did not trace the allocation of the " +"object." msgstr "" -"Python オブジェクト *obj* が割り当てられたトレースバックを取得します。:class:" -"`Traceback` インスタンスか、:mod:`tracemalloc` モジュールがメモリ割り当てをト" -"レースしていない場合かオブジェクトの割り当てをトレースしていない場合は、" -"``None`` を返します。" +"Python オブジェクト *obj* が割り当てられたトレースバックを取得しま" +"す。:class:`Traceback` インスタンスか、:mod:`tracemalloc` モジュールがメモリ" +"割り当てをトレースしていない場合かオブジェクトの割り当てをトレースしていない" +"場合は、``None`` を返します。" #: ../../library/tracemalloc.rst:314 msgid "See also :func:`gc.get_referrers` and :func:`sys.getsizeof` functions." @@ -494,8 +671,8 @@ msgstr ":func:`start` 関数で上限を設定します。" #: ../../library/tracemalloc.rst:329 msgid "" -"Get the current size and peak size of memory blocks traced by the :mod:" -"`tracemalloc` module as a tuple: ``(current: int, peak: int)``." +"Get the current size and peak size of memory blocks traced by " +"the :mod:`tracemalloc` module as a tuple: ``(current: int, peak: int)``." msgstr "" ":mod:`tracemalloc` モジュールがトレースするメモリブロックの現在のサイズと最大" "時のサイズをタプルとして取得します: ``(current: int, peak: int)``。" @@ -514,13 +691,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." +"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,17 +740,18 @@ 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 "" "Storing more than ``1`` frame is only useful to compute statistics grouped " -"by ``'traceback'`` or to compute cumulative statistics: see the :meth:" -"`Snapshot.compare_to` and :meth:`Snapshot.statistics` methods." +"by ``'traceback'`` or to compute cumulative statistics: see " +"the :meth:`Snapshot.compare_to` and :meth:`Snapshot.statistics` methods." msgstr "" "``1`` より多くのフレームを保存するのは ``'traceback'`` でグループ化された統計" "や累積的な統計を計算する場合にのみ有用です。\n" @@ -579,14 +760,14 @@ msgstr "" #: ../../library/tracemalloc.rst:380 msgid "" -"Storing more frames increases the memory and CPU overhead of the :mod:" -"`tracemalloc` module. Use the :func:`get_tracemalloc_memory` function to " -"measure how much memory is used by the :mod:`tracemalloc` module." +"Storing more frames increases the memory and CPU overhead of " +"the :mod:`tracemalloc` module. Use the :func:`get_tracemalloc_memory` " +"function to measure how much memory is used by the :mod:`tracemalloc` module." msgstr "" "保存するフレーム数を増やすと :mod:`tracemalloc` モジュールのメモリと CPU の" "オーバーヘッドは増加します。\n" -":mod:`tracemalloc` モジュールが使用しているメモリ量を調べるには :func:" -"`get_tracemalloc_memory` 関数を使用してください。" +":mod:`tracemalloc` モジュールが使用しているメモリ量を調べるに" +"は :func:`get_tracemalloc_memory` 関数を使用してください。" #: ../../library/tracemalloc.rst:384 msgid "" @@ -594,9 +775,9 @@ msgid "" "(``PYTHONTRACEMALLOC=NFRAME``) and the :option:`-X` ``tracemalloc=NFRAME`` " "command line option can be used to start tracing at startup." msgstr "" -":envvar:`PYTHONTRACEMALLOC` 環境変数 (``PYTHONTRACEMALLOC=NFRAME``) と :" -"option:`-X` ``tracemalloc=NFRAME`` コマンドラインオプションを使って実行開始時" -"にトレースを始めることが出来ます。" +":envvar:`PYTHONTRACEMALLOC` 環境変数 (``PYTHONTRACEMALLOC=NFRAME``) " +"と :option:`-X` ``tracemalloc=NFRAME`` コマンドラインオプションを使って実行" +"開始時にトレースを始めることが出来ます。" #: ../../library/tracemalloc.rst:388 msgid "" @@ -621,8 +802,8 @@ msgid "" "Call :func:`take_snapshot` function to take a snapshot of traces before " "clearing them." msgstr "" -"トレースが全部クリアされる前にスナップショットを取りたい場合は :func:" -"`take_snapshot` 関数を呼んでください。" +"トレースが全部クリアされる前にスナップショットを取りたい場合" +"は :func:`take_snapshot` 関数を呼んでください。" #: ../../library/tracemalloc.rst:401 msgid "" @@ -642,8 +823,8 @@ msgstr "" #: ../../library/tracemalloc.rst:410 msgid "" -"The snapshot does not include memory blocks allocated before the :mod:" -"`tracemalloc` module started to trace memory allocations." +"The snapshot does not include memory blocks allocated before " +"the :mod:`tracemalloc` module started to trace memory allocations." msgstr "" "スナップショットは :mod:`tracemalloc` モジュールがメモリ割り当てのトレースを" "始める前に割り当てられたメモリブロックを含みません。" @@ -669,29 +850,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,18 +896,17 @@ msgstr "" msgid "Examples:" msgstr "例:" -#: ../../library/tracemalloc.rst:457 msgid "" -"``Filter(True, subprocess.__file__)`` only includes traces of the :mod:" -"`subprocess` module" +"``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 "" -"``Filter(False, tracemalloc.__file__)`` excludes traces of the :mod:" -"`tracemalloc` module" +"``Filter(False, tracemalloc.__file__)`` excludes traces of " +"the :mod:`tracemalloc` module" msgstr "" "``Filter(False, tracemalloc.__file__)`` は :mod:`tracemalloc` モジュールのト" "レースを除外します" @@ -742,29 +924,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`." +"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`." +"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 "" @@ -789,9 +976,9 @@ msgstr "" #: ../../library/tracemalloc.rst:502 msgid "" -"This attribute has no effect if the traceback limit is ``1``. See the :func:" -"`get_traceback_limit` function and :attr:`Snapshot.traceback_limit` " -"attribute." +"This attribute has no effect if the traceback limit is ``1``. See " +"the :func:`get_traceback_limit` function " +"and :attr:`Snapshot.traceback_limit` attribute." msgstr "" "トレースバックの上限が ``1`` の場合この属性の影響はありません。\n" ":func:`get_traceback_limit` 関数と :attr:`Snapshot.traceback_limit` 属性を参" @@ -849,10 +1036,10 @@ msgstr "" #: ../../library/tracemalloc.rst:542 msgid "" -"The result is sorted from the biggest to the smallest by: absolute value of :" -"attr:`StatisticDiff.size_diff`, :attr:`StatisticDiff.size`, absolute value " -"of :attr:`StatisticDiff.count_diff`, :attr:`Statistic.count` and then by :" -"attr:`StatisticDiff.traceback`." +"The result is sorted from the biggest to the smallest by: absolute value " +"of :attr:`StatisticDiff.size_diff`, :attr:`StatisticDiff.size`, absolute " +"value of :attr:`StatisticDiff.count_diff`, :attr:`Statistic.count` and then " +"by :attr:`StatisticDiff.traceback`." msgstr "" "結果は降順でソートされます: キーは :attr:`StatisticDiff.size_diff` の絶対" "値、 :attr:`StatisticDiff.size`、 :attr:`StatisticDiff.count_diff` の絶対" @@ -866,24 +1053,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." @@ -947,11 +1141,13 @@ msgstr "" #: ../../library/tracemalloc.rst:595 msgid "" -"The result is sorted from the biggest to the smallest by: :attr:`Statistic." -"size`, :attr:`Statistic.count` and then by :attr:`Statistic.traceback`." +"The result is sorted from the biggest to the smallest " +"by: :attr:`Statistic.size`, :attr:`Statistic.count` and then " +"by :attr:`Statistic.traceback`." msgstr "" -"結果は降順でソートされます: キーは :attr:`Statistic.size`, :attr:`Statistic." -"count`, :attr:`Statistic.traceback` です。" +"結果は降順でソートされます: キー" +"は :attr:`Statistic.size`, :attr:`Statistic.count`, :attr:`Statistic.traceback` " +"です。" #: ../../library/tracemalloc.rst:602 msgid "" @@ -974,8 +1170,8 @@ msgid "" "The sequence has an undefined order. Use the :meth:`Snapshot.statistics` " "method to get a sorted list of statistics." msgstr "" -"シークェンスの順序は未定義です。統計のソート済みリストを取得するには :meth:" -"`Snapshot.statistics` を使用してください。" +"シークェンスの順序は未定義です。統計のソート済みリストを取得するに" +"は :meth:`Snapshot.statistics` を使用してください。" #: ../../library/tracemalloc.rst:615 msgid "Statistic" @@ -1017,8 +1213,8 @@ msgstr "StatisticDiff" #: ../../library/tracemalloc.rst:644 msgid "" -"Statistic difference on memory allocations between an old and a new :class:" -"`Snapshot` instance." +"Statistic difference on memory allocations between an old and a " +"new :class:`Snapshot` instance." msgstr "新旧 :class:`Snapshot` インスタンスのメモリ割り当ての統計差です。" #: ../../library/tracemalloc.rst:647 @@ -1075,9 +1271,8 @@ msgstr "" msgid "Trace" msgstr "Trace" -#: ../../library/tracemalloc.rst:683 msgid "Trace of a memory block." -msgstr "メモリブロックをトレースします。" +msgstr "メモリブロックのトレース。" #: ../../library/tracemalloc.rst:685 msgid "" @@ -1095,26 +1290,29 @@ 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 "" -"When a snapshot is taken, tracebacks of traces are limited to :func:" -"`get_traceback_limit` frames. See the :func:`take_snapshot` function. The " -"original number of frames of the traceback is stored in the :attr:`Traceback." -"total_nframe` attribute. That allows to know if a traceback has been " -"truncated by the traceback limit." +"When a snapshot is taken, tracebacks of traces are limited " +"to :func:`get_traceback_limit` frames. See the :func:`take_snapshot` " +"function. The original number of frames of the traceback is stored in " +"the :attr:`Traceback.total_nframe` attribute. That allows to know if a " +"traceback has been truncated by the traceback limit." msgstr "" #: ../../library/tracemalloc.rst:726 @@ -1123,23 +1321,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 +1345,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." +"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..d6b6d389b 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." +"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." +"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..8eea3d584 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`" @@ -56,15 +55,15 @@ msgid "" "moves. Give it the command ``turtle.right(25)``, and it rotates in-place 25 " "degrees clockwise." msgstr "" -"x-y 平面の (0, 0) から動き出すロボット亀を想像してみて下さい。 ``turtle." -"forward(15)`` という命令を出すと、その亀が (スクリーン上で!) 15 ピクセル分顔" -"を向けている方向に動き、動きに沿って線を引きます。 ``turtle.left(25)`` という" -"命令を出すと、今度はその場で25度反時計回りに回ります。" +"x-y 平面の (0, 0) から動き出すロボット亀を想像してみて下さい。 " +"``turtle.forward(15)`` という命令を出すと、その亀が (スクリーン上で!) 15 ピク" +"セル分顔を向けている方向に動き、動きに沿って線を引きます。 " +"``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 +91,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 +115,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 +131,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 +163,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 +225,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 +276,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" @@ -315,8 +310,8 @@ msgstr "" #: ../../library/turtle.rst:200 msgid "" "The turtle module makes this possible by exposing all its basic " -"functionality as functions, available with ``from turtle import *``. The :" -"ref:`turtle graphics tutorial ` covers this approach." +"functionality as functions, available with ``from turtle import *``. " +"The :ref:`turtle graphics tutorial ` covers this approach." msgstr "" #: ../../library/turtle.rst:204 @@ -338,14 +333,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 +351,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 +370,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 +389,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 +430,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 +504,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 +1040,6 @@ msgid "" msgstr "" "タートルが頭を向けている方へ、タートルを距離 *distance* だけ前進させます。" -#: ../../library/turtle.rst:485 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -1003,6 +1050,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 +1072,6 @@ msgstr "" "タートルが頭を向けている方と反対方向へ、タートルを距離 *distance* だけ後退さ" "せます。 タートルの向きは変えません。" -#: ../../library/turtle.rst:512 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -1025,6 +1079,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 "" @@ -1032,11 +1091,11 @@ msgid "" "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -"タートルを *angle* 単位だけ右に回します。 (単位のデフォルトは度ですが、 :" -"func:`degrees` と :func:`radians` 関数を使って設定できます。) 角度の向きは" -"タートルのモードによって意味が変わります。 :func:`mode` を参照してください。" +"タートルを *angle* 単位だけ右に回します。 (単位のデフォルトは度です" +"が、 :func:`degrees` と :func:`radians` 関数を使って設定できます。) 角度の向" +"きはタートルのモードによって意味が変わります。 :func:`mode` を参照してくださ" +"い。" -#: ../../library/turtle.rst:537 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1044,6 +1103,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 "" @@ -1051,11 +1115,11 @@ msgid "" "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -"タートルを *angle* 単位だけ左に回します。 (単位のデフォルトは度ですが、 :" -"func:`degrees` と :func:`radians` 関数を使って設定できます。) 角度の向きは" -"タートルのモードによって意味が変わります。 :func:`mode` を参照してください。" +"タートルを *angle* 単位だけ左に回します。 (単位のデフォルトは度です" +"が、 :func:`degrees` と :func:`radians` 関数を使って設定できます。) 角度の向" +"きはタートルのモードによって意味が変わります。 :func:`mode` を参照してくださ" +"い。" -#: ../../library/turtle.rst:562 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1063,6 +1127,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" @@ -1075,11 +1144,11 @@ msgstr "数または ``None``" #: ../../library/turtle.rst:579 msgid "" -"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." -"g. as returned by :func:`pos`)." +"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` " +"(e.g. as returned by :func:`pos`)." msgstr "" -"*y* が ``None`` の場合、 *x* は座標のペアかまたは :class:`Vec2D` (たとえば :" -"func:`pos` で返されます) でなければなりません。" +"*y* が ``None`` の場合、 *x* は座標のペアかまたは :class:`Vec2D` (たとえ" +"ば :func:`pos` で返されます) でなければなりません。" #: ../../library/turtle.rst:582 msgid "" @@ -1119,7 +1188,6 @@ msgid "" "barrier like in goto(x, y)." msgstr "" -#: ../../library/turtle.rst:627 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1134,13 +1202,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 +1227,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 +1245,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 +1299,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 +1316,6 @@ msgstr "" "タートルを原点 -- 座標 (0, 0) -- に移動し、向きを開始方向に設定します (開始方" "向はモードに依って違います。 :func:`mode` を参照してください)。" -#: ../../library/turtle.rst:728 msgid "" ">>> turtle.heading()\n" "90.0\n" @@ -1238,6 +1327,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 +1372,6 @@ msgstr "" "します。この値は与えられなければ自動的に計算されます。また、これを正多角形の" "描画に利用することもできます。" -#: ../../library/turtle.rst:760 msgid "" ">>> turtle.home()\n" ">>> turtle.position()\n" @@ -1292,6 +1389,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 +1421,6 @@ msgstr "" "直径 *size* の丸い点を *color* で指定された色で描きます。 *size* が与えられな" "かった場合、pensize+4 と 2*pensize の大きい方が使われます。" -#: ../../library/turtle.rst:789 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1319,6 +1430,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 +1448,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 +1465,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 +1477,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 +1498,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 +1506,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 +1521,6 @@ msgstr "" "最後の(繰り返すことにより複数の)タートルの動きを取り消します。取り消しできる" "動きの最大数は undobuffer のサイズによって決まります。" -#: ../../library/turtle.rst:860 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1395,6 +1528,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 +1590,6 @@ msgstr "" "注意: *speed* = 0 はアニメーションを無くします。forward/backward ではタートル" "がジャンプし、left/right では瞬時に方向を変えます。" -#: ../../library/turtle.rst:893 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1463,17 +1600,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 +1640,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 +1662,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,22 +1683,32 @@ 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 "" -"Return the turtle's current heading (value depends on the turtle mode, see :" -"func:`mode`)." +"Return the turtle's current heading (value depends on the turtle mode, " +"see :func:`mode`)." msgstr "" -"タートルの現在の向きを返します (返される値はタートルのモードに依存します。 :" -"func:`mode` を参照してください)。" +"タートルの現在の向きを返します (返される値はタートルのモードに依存しま" +"す。 :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 +1718,6 @@ msgstr "" "タートルから与えられた (x,y) あるいはベクトルあるいは渡されたタートルへの距離" "を、タートルのステップを単位として測った値を返します。" -#: ../../library/turtle.rst:992 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1567,10 +1729,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 +1750,6 @@ msgstr "" "角度を計る単位「度」を、円周を何等分するかという値に指定します。デフォルトは" "360等分で通常の意味での度です。" -#: ../../library/turtle.rst:1016 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1596,15 +1765,27 @@ 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 "" -"Set the angle measurement units to radians. Equivalent to ``degrees(2*math." -"pi)``." +"Set the angle measurement units to radians. Equivalent to " +"``degrees(2*math.pi)``." msgstr "" "角度を計る単位をラジアンにします。 ``degrees(2*math.pi)`` と同じ意味です。" -#: ../../library/turtle.rst:1039 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1614,6 +1795,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 +1825,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 +1899,6 @@ msgstr "" "きます。さらに一つ以上の属性をキーワード引数として渡すこともできます。一つの" "文で幾つものペンの属性を設定するのに使えます。" -#: ../../library/turtle.rst:1118 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1728,13 +1915,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 +1943,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 +2016,6 @@ msgstr "" "タートルの形(turtleshape)が多角形の場合、多角形の外側が新しく設定された色で描" "かれます。" -#: ../../library/turtle.rst:1182 msgid "" ">>> colormode()\n" "1.0\n" @@ -1830,6 +2035,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 +2116,6 @@ msgstr "" "タートルの形(turtleshape)が多角形の場合、多角形の内側が新しく設定された色で描" "かれます。" -#: ../../library/turtle.rst:1231 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -1908,6 +2129,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." @@ -1928,8 +2160,8 @@ msgstr "``color()``" #: ../../library/turtle.rst:1255 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " -"specification strings or tuples as returned by :func:`pencolor` and :func:" -"`fillcolor`." +"specification strings or tuples as returned by :func:`pencolor` " +"and :func:`fillcolor`." msgstr "" "現在のペンの色と塗りつぶしの色を :func:`pencolor` および :func:`fillcolor` で" "返される色指定文字列またはタプルのペアで返します。" @@ -1968,7 +2200,6 @@ msgstr "" "タートルの形(turtleshape)が多角形の場合、多角形の内側も外側も新しく設定された" "色で描かれます。" -#: ../../library/turtle.rst:1270 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -1977,6 +2208,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 +2223,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 +2294,6 @@ msgstr "" "タートルの描いたものをスクリーンから消し、タートルを中心に戻して、全ての変数" "をデフォルト値に設定し直します。" -#: ../../library/turtle.rst:1362 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2059,6 +2307,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 "" @@ -2135,8 +2394,8 @@ msgid "" "name of current shape. Shape with *name* must exist in the TurtleScreen's " "shape dictionary. Initially there are the following polygon shapes: " "\"arrow\", \"turtle\", \"circle\", \"square\", \"triangle\", \"classic\". " -"To learn about how to deal with shapes see Screen method :func:" -"`register_shape`." +"To learn about how to deal with shapes see Screen " +"method :func:`register_shape`." msgstr "" "タートルの形を与えられた名前(*name*)の形に設定するか、もしくは名前が与えられ" "なければ現在の形の名前を返します。 *name* という名前の形は TurtleScreen の形" @@ -2145,7 +2404,6 @@ msgstr "" "についての扱いを学ぶには Screen のメソッド :func:`register_shape` を参照して" "下さい。" -#: ../../library/turtle.rst:1455 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2153,6 +2411,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 +2458,6 @@ msgstr "" "``resizemode(\"user\")`` は :func:`shapesize` に引数を渡したときに呼び出され" "ます。" -#: ../../library/turtle.rst:1481 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2203,6 +2465,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 +2492,6 @@ msgstr "" "*stretch_len* は進行方向に沿ったの伸長係数、 *outline* は形のアウトラインの幅" "を決めるものです。" -#: ../../library/turtle.rst:1505 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2237,13 +2503,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 +2523,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 +2537,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 +2551,6 @@ msgstr "" "タートルの形(turtleshape)を現在の傾斜角から角度(*angle*)だけ回転します。この" "ときタートルの進む方向は *変わりません* 。" -#: ../../library/turtle.rst:1547 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2279,14 +2560,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 +2579,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 +2594,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 +2612,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 +2627,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 +2685,6 @@ msgstr "" "``None`` ならば、既存の束縛が取り除かれます。無名タートル、つまり手続き的なや" "り方の例です:" -#: ../../library/turtle.rst:1641 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2385,6 +2692,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 +2706,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 +2718,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 +2745,8 @@ msgstr "" "注意: 全てのマウスムーブイベントのシーケンスに先立ってマウスクリックイベント" "が起こります。" -#: ../../library/turtle.rst:1690 msgid ">>> turtle.ondrag(turtle.goto)" -msgstr "" +msgstr ">>> turtle.ondrag(turtle.goto)" #: ../../library/turtle.rst:1695 msgid "" @@ -2436,19 +2756,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 +2792,6 @@ msgstr "" msgid "Return the last recorded polygon." msgstr "最後に記録された多角形を返します。" -#: ../../library/turtle.rst:1735 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2481,6 +2804,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 +2837,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 +2856,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``" @@ -2540,23 +2879,23 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" "アンドゥバッファを設定または無効化します。 *size* が整数ならばそのサイズの空" -"のアンドゥバッファを用意します。 *size* の値はタートルのアクションを何度 :" -"func:`undo` メソッド/関数で取り消せるかの最大数を与えます。 *size* が " +"のアンドゥバッファを用意します。 *size* の値はタートルのアクションを何" +"度 :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" @@ -2577,8 +2916,8 @@ msgstr "タイプ \"compound\" の空の Shape オブジェクトを作ります #: ../../library/turtle.rst:1828 msgid "" -"Add as many components to this object as desired, using the :meth:`~Shape." -"addcomponent` method." +"Add as many components to this object as desired, using " +"the :meth:`~Shape.addcomponent` method." msgstr "" ":meth:`~Shape.addcomponent` メソッドを使って、好きなだけここにコンポーネント" "を追加します。" @@ -2601,11 +2940,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 +2981,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 +2989,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 +3120,6 @@ msgid "" "distorted." msgstr "**重要なお知らせ**: ユーザー定義座標系では角度が歪むかもしれません。" -#: ../../library/turtle.rst:1974 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2784,6 +3129,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 +3144,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 +3173,6 @@ msgstr "" msgid "Optional argument:" msgstr "オプション引数:" -#: ../../library/turtle.rst:2024 msgid "" ">>> screen.delay()\n" "10\n" @@ -2826,6 +3180,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" @@ -2842,10 +3201,9 @@ msgstr "" "タートルのアニメーションをオン・オフし、描画更新の遅延を設定します。 *n* が与" "えられた場合、通常のスクリーン更新のうち 1/n しか実際に実行されません。 (複雑" "なグラフィックスの描画を加速するのに使えます。) 引数なしで呼び出されたなら、" -"現在保存されている n の値を返します。二つ目の引数は遅延の値を設定します(:" -"func:`delay` も参照)。" +"現在保存されている n の値を返します。二つ目の引数は遅延の値を設定します" +"(:func:`delay` も参照)。" -#: ../../library/turtle.rst:2046 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -2854,6 +3212,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 +3255,6 @@ msgstr "" "できるようにするためには TurtleScreen はフォーカスを持っていないとなりません" "(:func:`listen` を参照)。" -#: ../../library/turtle.rst:2083 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2900,13 +3263,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 +3305,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 +3312,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 +3338,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 +3348,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 +3382,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 +3396,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 +3483,6 @@ msgstr "" "定した後は、色トリプルの *r*, *g*, *b* 値は 0 から *cmode* の範囲になければな" "りません。" -#: ../../library/turtle.rst:2246 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3116,6 +3496,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 +3516,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 +3557,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 +3575,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 +3594,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" @@ -3254,9 +3650,9 @@ msgstr "スクリーン上のマウスクリックに ``bye()`` メソッドを msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " -"switch (no subprocess) is used, this value should be set to ``True`` in :" -"file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the " -"client script." +"switch (no subprocess) is used, this value should be set to ``True`` " +"in :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for " +"the client script." msgstr "" "設定辞書中の \"using_IDLE\" の値が ``False`` (デフォルトです) の場合、さらに" "メインループ(mainloop)に入ります。注意: もし IDLE が ``-n`` スイッチ(サブプロ" @@ -3264,32 +3660,35 @@ 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 "" "Set the size and position of the main window. Default values of arguments " -"are stored in the configuration dictionary and can be changed via a :file:" -"`turtle.cfg` file." +"are stored in the configuration dictionary and can be changed via " +"a :file:`turtle.cfg` file." msgstr "" "メインウィンドウのサイズとポジションを設定します。引数のデフォルト値は設定辞" "書に収められており、 :file:`turtle.cfg` ファイルを通じて変更できます。" @@ -3326,13 +3725,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 +3744,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`" +"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or " +"a :class:`TurtleScreen`" msgstr "" +":class:`!tkinter.Canvas`、:class:`ScrolledCanvas`、また" +"は :class:`TurtleScreen`" #: ../../library/turtle.rst:2444 msgid "" @@ -3366,15 +3767,15 @@ msgstr "" #: ../../library/turtle.rst:2450 msgid "" -"Subclass of RawTurtle, has the same interface but draws on a default :class:" -"`Screen` object created automatically when needed for the first time." +"Subclass of RawTurtle, has the same interface but draws on a " +"default :class:`Screen` object created automatically when needed for the " +"first time." msgstr "" "RawTurtle のサブクラスで同じインターフェイスを持ちますが、最初に必要になった" "とき自動的に作られる :class:`Screen` オブジェクトに描画します。" -#: ../../library/turtle.rst:2456 msgid "a :class:`!tkinter.Canvas`" -msgstr "" +msgstr ":class:`!tkinter.Canvas`" #: ../../library/turtle.rst:2458 msgid "" @@ -3448,8 +3849,8 @@ msgstr "\"compound\"" #: ../../library/turtle.rst:2487 msgid "" -"``None`` (a compound shape has to be constructed using the :meth:" -"`addcomponent` method)" +"``None`` (a compound shape has to be constructed using " +"the :meth:`addcomponent` method)" msgstr "" "``None`` (合成形は :meth:`addcomponent` メソッドを使って作らなければなりませ" "ん)" @@ -3524,37 +3925,49 @@ 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`." +"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 " -"additional methods ` for managing its appearance (including " -"size and title) and behaviour. ``TurtleScreen``'s constructor needs a :class:" -"`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." +":class:`TurtleScreen` is the basic drawing surface for a " +"turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and " +"includes :ref:`some additional methods ` for managing its " +"appearance (including 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 +3975,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 +4059,6 @@ msgid "" "modified form::" msgstr "メソッドに由来する関数のドキュメント文字列は変更された形をとります::" -#: ../../library/turtle.rst:2608 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3672,6 +4091,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 +4219,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 +4241,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:" @@ -3806,8 +4274,8 @@ msgstr "最初の4行は :func:`Screen.setup ` メソッドの引数に #: ../../library/turtle.rst:2712 msgid "" -"Line 5 and 6 correspond to the arguments of the method :func:`Screen." -"screensize `." +"Line 5 and 6 correspond to the arguments of the " +"method :func:`Screen.screensize `." msgstr "" "5行目6行目は :func:`Screen.screensize ` メソッドの引数に当たりま" "す。" @@ -3839,9 +4307,10 @@ msgstr "" #: ../../library/turtle.rst:2721 msgid "" -"If you set e.g. ``language = italian`` the docstringdict :file:" -"`turtle_docstringdict_italian.py` will be loaded at import time (if present " -"on the import path, e.g. in the same directory as :mod:`turtle`)." +"If you set e.g. ``language = italian`` the " +"docstringdict :file:`turtle_docstringdict_italian.py` will be loaded at " +"import time (if present on the import path, e.g. in the same directory " +"as :mod:`turtle`)." msgstr "" "たとえば ``language = italian`` とするとドキュメント文字列辞書" "(docstringdict) として :file:`turtle_docstringdict_italian.py` がインポート時" @@ -3902,30 +4371,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` 。 " +"ソースコードを眺めつつスクリプトを実行できるデモビュ" +"ワー :file:`__main__.py` 。" #: ../../library/turtle.rst:2760 msgid "" @@ -4010,13 +4476,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 +4522,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 +4585,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 +4596,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 +4614,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" @@ -4192,9 +4649,9 @@ msgstr "" #: ../../library/turtle.rst:2849 msgid "" -"The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" -"`begin_fill` and :func:`end_fill` have changed slightly: now every filling " -"process must be completed with an ``end_fill()`` call." +"The method :func:`!Turtle.fill` has been eliminated. The behaviour " +"of :func:`begin_fill` and :func:`end_fill` have changed slightly: now every " +"filling process must be completed with an ``end_fill()`` call." msgstr "" #: ../../library/turtle.rst:2854 @@ -4211,11 +4668,11 @@ msgstr "python 3.0からの変更点" #: ../../library/turtle.rst:2862 msgid "" -"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" -"func:`get_shapepoly` have been added. Thus the full range of regular linear " -"transforms is now available for transforming turtle shapes. :func:" -"`tiltangle` has been enhanced in functionality: it now can be used to get or " -"set the tilt angle." +"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` " +"and :func:`get_shapepoly` have been added. Thus the full range of regular " +"linear transforms is now available for transforming turtle " +"shapes. :func:`tiltangle` has been enhanced in functionality: it now can be " +"used to get or set the tilt angle." msgstr "" #: ../../library/turtle.rst:2868 @@ -4234,7 +4691,7 @@ msgstr "" #: ../../library/turtle.rst:2876 msgid "" -"Two input methods have been added: :func:`Screen.textinput ` and :" -"func:`Screen.numinput `. These pop up input dialogs and return " -"strings and numbers respectively." +"Two input methods have been added: :func:`Screen.textinput ` " +"and :func:`Screen.numinput `. These pop up input dialogs and " +"return strings and numbers respectively." msgstr "" diff --git a/library/types.po b/library/types.po index cadac3e25..ed0ab7f98 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 @@ -47,20 +47,19 @@ msgstr "" #: ../../library/types.rst:14 msgid "" "It also defines names for some object types that are used by the standard " -"Python interpreter, but not exposed as builtins like :class:`int` or :class:" -"`str` are." +"Python interpreter, but not exposed as builtins like :class:`int` " +"or :class:`str` are." msgstr "" -"さらに、標準の Python インタプリタによって使用されているものの、 :class:" -"`int` や :class:`str` のように組み込みとして公開されていないようないくつかの" -"オブジェクト型の名前を定義しています。" +"さらに、標準の Python インタプリタによって使用されているもの" +"の、 :class:`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,41 +146,51 @@ 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:" -"`~object.__mro_entries__` method is replaced with an unpacked result of " -"calling this method. If a *bases* item is an instance of :class:`type`, or " -"it doesn't have an :meth:`!__mro_entries__` method, then it is included in " -"the return tuple unchanged." +"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:`~object.__mro_entries__` method is replaced with an unpacked " +"result of calling this method. If a *bases* item is an instance " +"of :class:`type`, or 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" @@ -254,18 +286,17 @@ msgstr ":data:`None` の型です。" #: ../../library/types.rst:156 msgid "" -"The type of user-defined functions and functions created by :keyword:" -"`lambda` expressions." +"The type of user-defined functions and functions created " +"by :keyword:`lambda` expressions." 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`." +"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__`." +"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,58 +468,61 @@ 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:`Union型の式 ` の型です。" -#: ../../library/types.rst:319 msgid "This is now an alias for :class:`typing.Union`." -msgstr "" +msgstr ":class:`typing.Union` のエイリアスになりました。" #: ../../library/types.rst:323 msgid "" -"The type of traceback objects such as found in ``sys.exception()." -"__traceback__``." +"The type of traceback objects such as found in " +"``sys.exception().__traceback__``." 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." +"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 "" @@ -540,8 +597,8 @@ msgstr "" #: ../../library/types.rst:381 msgid "" -"Return the item of the underlying mapping with key *key*. Raises a :exc:" -"`KeyError` if *key* is not in the underlying mapping." +"Return the item of the underlying mapping with key *key*. Raises " +"a :exc:`KeyError` if *key* is not in the underlying mapping." msgstr "" "元になったマッピングの *key* というキーに対応するアイテムを返します。 *key* " "が存在しなければ、 :exc:`KeyError` が発生します。" @@ -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" @@ -609,31 +663,40 @@ msgid "" "A simple :class:`object` subclass that provides attribute access to its " "namespace, as well as a meaningful repr." msgstr "" -"名前空間への属性アクセスに加えて意味のある repr を提供するための、単純な :" -"class:`object` サブクラスです。" +"名前空間への属性アクセスに加えて意味のある 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 " +":py:class:`SimpleNamespace` objects may be initialized in the same way " +"as :class:`dict`: either with keyword arguments, with a single positional " "argument, or with both. When initialized with keyword arguments, those are " "directly added to the underlying namespace. Alternatively, when initialized " "with a positional argument, the underlying namespace will be updated with " -"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 "" +"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 +713,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 "" @@ -658,23 +735,24 @@ msgid "" "instead." msgstr "" "``SimpleNamespace`` は ``class NS: pass`` を置き換えるものとして有用かもしれ" -"ません。ですが、構造化されたレコード型に対しては、これよりはむしろ :func:" -"`~collections.namedtuple` を使用してください。" +"ません。ですが、構造化されたレコード型に対しては、これよりはむし" +"ろ :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,24 +783,25 @@ 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 " +"This function transforms a :term:`generator` function into " +"a :term:`coroutine function` which returns a generator-based coroutine. The " "generator-based coroutine is still a :term:`generator iterator`, but is also " "considered to be a :term:`coroutine` object and is :term:`awaitable`. " "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..f12adbd40 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`" @@ -67,8 +67,8 @@ msgstr "" msgid "" "The function ``surface_area_of_cube`` takes an argument expected to be an " "instance of :class:`float`, as indicated by the :term:`type hint` " -"``edge_length: float``. The function is expected to return an instance of :" -"class:`str`, as indicated by the ``-> str`` hint." +"``edge_length: float``. The function is expected to return an instance " +"of :class:`str`, as indicated by the ``-> str`` hint." msgstr "" "``surface_area_of_cube`` 関数は、``edge_length: float`` という :term:`type " "hint` で示されているように、引数が :class:`float` のインスタンスであるという" @@ -89,9 +89,9 @@ msgstr "" #: ../../library/typing.rst:42 msgid "" -"New features are frequently added to the ``typing`` module. The :pypi:" -"`typing_extensions` package provides backports of these new features to " -"older versions of Python." +"New features are frequently added to the ``typing`` module. " +"The :pypi:`typing_extensions` package provides backports of these new " +"features to older versions of Python." msgstr "" "``typing`` モジュールには新しい機能が頻繁に追加されます。\n" ":pypi:`typing_extensions` パッケージを使うことで、古い Python バージョンから" @@ -111,11 +111,11 @@ msgstr "型ヒントの簡単な概要 (mypy ドキュメンテーション)" #: ../../library/typing.rst:51 msgid "" -"\"Type System Reference\" section of `the mypy docs `_" +"\"Type System Reference\" section of `the mypy docs `_" msgstr "" -"`mypy ドキュメンテーション `_ の \"Type System Reference\" セクション" +"`mypy ドキュメンテーション `_ の \"Type System Reference\" セクション" #: ../../library/typing.rst:52 msgid "" @@ -147,8 +147,8 @@ msgstr "Python 型システムの仕様" #: ../../library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " -"found at `\"Specification for the Python type system\" `_." +"found at `\"Specification for the Python type system\" `_." msgstr "" #: ../../library/typing.rst:72 @@ -161,9 +161,10 @@ 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 +226,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 +274,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 +301,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 +310,7 @@ msgstr "" "``UserId`` 型の変数も ``int`` の全ての演算が行えますが、その結果は常に " "``int`` 型になります。\n" "この振る舞いにより、 ``int`` が期待されるところに ``UserId`` を渡せますが、不" -"正な方法で ``UserId`` を作ってしまうことを防ぎます。" +"正な方法で ``UserId`` を作ってしまうことを防ぎます。 ::" #: ../../library/typing.rst:147 msgid "" @@ -323,7 +320,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 +327,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 +341,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 +368,6 @@ msgstr "" "しかし、 'derived' である ``NewType`` をもとにした :class:`NewType` は作るこ" "とが出来ます::" -#: ../../library/typing.rst:170 msgid "" "from typing import NewType\n" "\n" @@ -382,6 +375,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 +396,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 +411,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 +437,18 @@ 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`." +"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 +471,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 "" @@ -515,15 +527,14 @@ msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " "functions that have keyword-only parameters. However, these signatures can " -"be expressed by defining a :class:`Protocol` class with a :meth:`~object." -"__call__` method:" +"be expressed by defining a :class:`Protocol` class with " +"a :meth:`~object.__call__` method:" msgstr "" "``Callable`` は可変引数、:ref:`オーバーロード関数 `、キーワード専用" "引数などを含む複雑な型シグネチャを表現することはできません。\n" "しかし、:class:`Protocol` クラスとその :meth:`~object.__call__` メソッドを定" "義すれば表現することができます:" -#: ../../library/typing.rst:256 msgid "" "from collections.abc import Iterable\n" "from typing import Protocol\n" @@ -546,8 +557,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,18 +587,19 @@ 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 "" -"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" -"pep:`612` for more details." +"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " +"See :pep:`612` for more details." msgstr "" "``Callable`` は :class:`ParamSpec` と :data:`Concatenate` をサポートしまし" "た。詳細は :pep:`612` を参照してください。" @@ -608,12 +639,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 +666,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 +687,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 +708,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,28 +725,40 @@ 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 "" ":class:`list` only accepts one type argument, so a type checker would emit " -"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." -"Mapping` only accepts two type arguments: the first indicates the type of " -"the keys, and the second indicates the type of the values." +"an error on the ``y`` assignment above. " +"Similarly, :class:`~collections.abc.Mapping` only accepts two type " +"arguments: the first indicates the type of the keys, and the second " +"indicates the type of the values." msgstr "" ":class:`list` は引数に1つの型のみ受け入れるので、型チェッカーは上記の ``y`` " "への代入でエラーを出力します。同様に、: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. " -"For this reason, tuples are special-cased in Python's typing system. :class:" -"`tuple` accepts *any number* of type arguments::" +"For this reason, tuples are special-cased in Python's typing " +"system. :class:`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 +774,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 +815,50 @@ 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::" +"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 +876,31 @@ 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::" +"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:`型変" +"数 `、およびこれらの型の Union だけです。\n" +"例えば次のようになります。 ::" #: ../../library/typing.rst:433 msgid "" @@ -796,24 +913,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 `." +"``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::" +"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 +939,84 @@ 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] `::" +"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::" +"`). 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 +1028,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::" +"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 +1075,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 +1089,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 +1109,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::" +"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 +1154,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 +1175,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::" +"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 +1201,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 +1221,6 @@ msgstr "" ":class:`Generic` の引数のそれぞれの型変数は別のものでなければなりません。この" "ため次のクラス定義は無効です::" -#: ../../library/typing.rst:595 msgid "" "from typing import TypeVar, Generic\n" "...\n" @@ -1032,56 +1233,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 +1319,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 +1346,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 +1373,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 +1406,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 +1420,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 +1434,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." +":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 +1482,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,29 +1505,42 @@ 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 "" -"Notice that no type checking is performed when assigning a value of type :" -"data:`Any` to a more precise type. For example, the static type checker did " -"not report an error when assigning ``a`` to ``s`` even though ``s`` was " -"declared to be of type :class:`str` and receives an :class:`int` value at " -"runtime!" +"Notice that no type checking is performed when assigning a value of " +"type :data:`Any` to a more precise type. For example, the static type " +"checker did not report an error when assigning ``a`` to ``s`` even though " +"``s`` was declared to be of type :class:`str` and receives an :class:`int` " +"value at runtime!" msgstr "" ":data:`Any` 型の値をより詳細な型に代入する時に型検査が行われないことに注意し" -"てください。例えば、静的型検査器は ``a`` を ``s`` に代入する時、``s`` が :" -"class:`str` 型として宣言されていて実行時に :class:`int` の値を受け取るとして" -"も、エラーを報告しません。" +"てください。例えば、静的型検査器は ``a`` を ``s`` に代入する時、``s`` " +"が :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 +1552,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 "" @@ -1287,9 +1578,9 @@ msgid "" "subtype of every other type." msgstr "" ":data:`Any` の挙動と :class:`object` の挙動を対比しましょう。 :data:`Any` と" -"同様に、すべての型は :class:`object` のサブタイプです。しかしながら、 :data:" -"`Any` と異なり、逆は成り立ちません: :class:`object` はすべての他の型のサブタ" -"イプでは *ありません*。" +"同様に、すべての型は :class:`object` のサブタイプです。しかしなが" +"ら、 :data:`Any` と異なり、逆は成り立ちません: :class:`object` はすべての他の" +"型のサブタイプでは *ありません*。" #: ../../library/typing.rst:765 msgid "" @@ -1323,14 +1614,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,22 +1637,21 @@ 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 " -"class had to be explicitly marked to support them, which is unpythonic and " -"unlike what one would normally do in idiomatic dynamically typed Python " -"code. For example, this conforms to :pep:`484`::" +"This requirement previously also applied to abstract base classes, such " +"as :class:`~collections.abc.Iterable`. The problem with this approach is " +"that a class had to be explicitly marked to support them, which is " +"unpythonic and 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 +1660,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 +1682,6 @@ msgstr "" "これは *structural subtyping (構造的部分型)* (あるいは、静的ダックタイピン" "グ) として知られています::" -#: ../../library/typing.rst:817 msgid "" "from collections.abc import Iterator, Iterable\n" "\n" @@ -1400,6 +1693,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 +1716,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 +1729,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 +1748,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 +1781,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 +1789,23 @@ 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::" +"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 +1817,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." +"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 +1879,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." +":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`::" +"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 +1953,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 +1998,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 +2027,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 +2043,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 +2077,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,21 +2129,40 @@ 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 " -"supports forward references. Note that while :data:`TypeAlias` and :class:" -"`TypeAliasType` serve similar purposes and have similar names, they are " -"distinct and the latter is not the type of the former. Removal of :data:" -"`TypeAlias` is not currently planned, but users are encouraged to migrate " -"to :keyword:`type` statements." -msgstr "" +"supports forward references. Note that while :data:`TypeAlias` " +"and :class:`TypeAliasType` serve similar purposes and have similar names, " +"they are distinct and the latter is not the type of the former. Removal " +"of :data:`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" @@ -1771,66 +2176,62 @@ msgstr "" "これらはアノテーションの型として使用できます。これらは全て ``[]`` を使用した" "添字表記をサポートしますが、それぞれ固有の構文があります。" -#: ../../library/typing.rst:1091 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." -msgstr "" -"ユニオン型; ``Union[X, Y]`` は ``X | Y`` と等価で X または Y を表します。" +msgstr "Union型; ``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 を定義するには、例えば ``Union[int, str]`` または省略形の ``int | " +"str`` を使います。\n" +"省略形の使用を推奨します。\n" +"詳細は次のとおりです:" #: ../../library/typing.rst:1095 msgid "The arguments must be types and there must be at least one." msgstr "引数は型でなければならず、少なくとも一つ必要です。" -#: ../../library/typing.rst:1097 msgid "Unions of unions are flattened, e.g.::" -msgstr "ユニオン型のユニオン型は平滑化されます。例えば::" +msgstr "Union型の Union型は平滑化されます。例えば::" -#: ../../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 "" +"ただし、型エイリアスを介して参照される Union にはこの処理は適用されません。\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 "引数が一つのユニオン型は消えます。例えば::" +msgstr "引数が一つの Union型は消えます。例えば::" -#: ../../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 "ユニオン型を比較するとき引数の順序は無視されます。例えば::" +msgstr "Union型を比較するとき引数の順序は無視されます。例えば::" -#: ../../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``." @@ -1846,15 +2247,13 @@ msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" "明示的に書かれているサブクラスを、実行時に直和型から取り除かなくなりました。" -#: ../../library/typing.rst:1126 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -"ユニオン型は ``X | Y`` のように書けるようになりました。 :ref:`union型の表現 " +"Union型は ``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,22 @@ 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,18 +2329,24 @@ 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 " -"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as " -"the first argument, and returns a callable with a different type signature. " -"In this case, the :class:`ParamSpec` indicates that the returned callable's " -"parameter types are dependent on the parameter types of the callable being " -"passed in::" +"For example, to annotate a decorator ``with_lock`` which provides " +"a :class:`threading.Lock` to the decorated function, ``Concatenate`` can be " +"used to indicate that ``with_lock`` expects a callable which takes in a " +"``Lock`` as the first argument, and returns a callable with a different type " +"signature. In this case, the :class:`ParamSpec` indicates that the returned " +"callable's 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 +2373,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 +2432,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 +2453,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,26 +2525,29 @@ 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 "" -":data:`ClassVar` is not a class itself, and should not be used with :func:" -"`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " -"runtime behavior, but it can be used by third-party type checkers. For " -"example, a type checker might flag the following code as an error::" +":data:`ClassVar` is not a class itself, and should not be used " +"with :func:`isinstance` or :func:`issubclass`. :data:`ClassVar` does not " +"change Python runtime behavior, but it can be used by third-party type " +"checkers. For example, a type checker might flag the following code as an " +"error::" msgstr "" -":data:`ClassVar` はクラスそのものではなく、:func:`isinstance` や :func:" -"`issubclass` で使うべきではありません。\n" +":data:`ClassVar` はクラスそのものではなく、:func:`isinstance` " +"や :func:`issubclass` で使うべきではありません。\n" ":data:`ClassVar` は Python の実行時の挙動を変えませんが、サードパーティの型検" "査器で使えます。\n" "例えば、型チェッカーは次のコードをエラーとするかもしれません::" @@ -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`::" +"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:" +"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,41 +2985,57 @@ 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:" -"`TypeGuard` as its return type to alert static type checkers to this " -"intention. ``TypeIs`` usually has more intuitive behavior than " +"type predicate. Such a function should use ``TypeIs[...]`` " +"or :data:`TypeGuard` as its return type to alert static type checkers to " +"this intention. ``TypeIs`` usually has more intuitive behavior than " "``TypeGuard``, but it cannot be used when the input and output types are " "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``)." +"``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 やプロトコル)、さらには型の Union も指" +"定できます。 ::" -#: ../../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) # Union 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,130 +3595,161 @@ 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:" -"`~annotationlib.Format.VALUE` format, which is equivalent to accessing the :" -"attr:`~TypeVar.__bound__` attribute directly, but the method object can be " -"passed to :func:`annotationlib.call_evaluate_function` to evaluate the value " -"in a different format." +"attribute. When called directly, this method supports only " +"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " +"accessing the :attr:`~TypeVar.__bound__` attribute directly, but the method " +"object can be 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 " -"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " -"accessing the :attr:`~TypeVar.__constraints__` attribute directly, but the " -"method object can be passed to :func:`annotationlib.call_evaluate_function` " -"to evaluate the value in a different format." +"An :term:`evaluate function` corresponding to " +"the :attr:`~TypeVar.__constraints__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~TypeVar.__constraints__` attribute " +"directly, but the 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 :" -"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " -"the :attr:`~TypeVar.__default__` attribute directly, but the method object " -"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " -"the value in a different format." +"An :term:`evaluate function` corresponding to " +"the :attr:`~TypeVar.__default__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~TypeVar.__default__` attribute " +"directly, but the method object 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." +"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 +3757,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 +3792,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 +3817,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 +3875,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 +3918,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,72 +3932,87 @@ 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 :" -"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " -"the :attr:`~TypeVarTuple.__default__` attribute directly, but the method " -"object can be passed to :func:`annotationlib.call_evaluate_function` to " -"evaluate the value in a different format." +"An :term:`evaluate function` corresponding to " +"the :attr:`~TypeVarTuple.__default__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~TypeVarTuple.__default__` attribute " +"directly, but the method 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." +"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 +4021,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,108 +4057,147 @@ 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 "" -"Since ``ParamSpec`` captures both positional and keyword parameters, ``P." -"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " +"Since ``ParamSpec`` captures both positional and keyword parameters, " +"``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " "components. ``P.args`` represents the tuple of positional parameters in a " "given call and should only be used to annotate ``*args``. ``P.kwargs`` " "represents the mapping of keyword parameters to their values in a given " "call, and should be only be used to annotate ``**kwargs``. Both attributes " "require the annotated parameter to be in scope. At runtime, ``P.args`` and " -"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:" -"`ParamSpecKwargs`." +"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` " +"and :class:`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." +"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 :" -"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " -"the :attr:`~ParamSpec.__default__` attribute directly, but the method object " -"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " -"the value in a different format." +"An :term:`evaluate function` corresponding to " +"the :attr:`~ParamSpec.__default__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~ParamSpec.__default__` attribute " +"directly, but the method object 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." +"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 " -"generic types. The ``bound`` argument is also accepted, similar to :class:" -"`TypeVar`. However the actual semantics of these keywords are yet to be " -"decided." +"generic types. The ``bound`` argument is also accepted, similar " +"to :class:`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." +"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 +4206,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 +4265,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,18 +4293,32 @@ 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:" -"`~annotationlib.Format.VALUE` format, which is equivalent to accessing the :" -"attr:`__value__` attribute directly, but the method object can be passed to :" -"func:`annotationlib.call_evaluate_function` to evaluate the value in a " -"different format:" +"attribute. When called directly, this method supports only " +"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " +"accessing the :attr:`__value__` attribute directly, but the method object " +"can be passed to :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 +4333,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 +4388,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 +4417,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 +4448,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 +4457,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 +4492,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 +4527,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`." +"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 +4556,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 +4567,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 +4611,6 @@ msgstr "" "このようなクラスは主に構造的部分型 (静的ダックタイピング) を認識する静的型" "チェッカーが使います。例えば::" -#: ../../library/typing.rst:2486 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3711,34 +4621,44 @@ 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 "" -"See :pep:`544` for more details. Protocol classes decorated with :func:" -"`runtime_checkable` (described later) act as simple-minded runtime protocols " -"that check only the presence of given attributes, ignoring their type " -"signatures. Protocol classes without this decorator cannot be used as the " -"second argument to :func:`isinstance` or :func:`issubclass`." +"See :pep:`544` for more details. Protocol classes decorated " +"with :func:`runtime_checkable` (described later) act as simple-minded " +"runtime protocols that check only the presence of given attributes, ignoring " +"their type signatures. Protocol classes without this decorator cannot be " +"used as the second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" #: ../../library/typing.rst:2501 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,20 +4666,23 @@ 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 "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This allows a simple-minded structural check, very similar to \"one trick " -"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." -"Iterable`. For example::" +"ponies\" in :mod:`collections.abc` such " +"as :class:`~collections.abc.Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2526 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3774,32 +4697,48 @@ msgid "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" msgstr "" +"@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)" -#: ../../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 "" ":func:`!runtime_checkable` will check only the presence of the required " -"methods or attributes, not their type signatures or types. For example, :" -"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` " -"check against :ref:`Callable `. However, the ``ssl." -"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a " -"more informative message, therefore making it impossible to call " -"(instantiate) :class:`ssl.SSLObject`." +"methods or attributes, not their type signatures or types. For " +"example, :class:`ssl.SSLObject` is a class, therefore it passes " +"an :func:`issubclass` check against :ref:`Callable `. " +"However, the ``ssl.SSLObject.__init__`` method exists only to raise " +"a :exc:`TypeError` with a more informative message, therefore making it " +"impossible to call (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,14 +4747,22 @@ 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 "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " -"on :func:`isinstance` checks comparing objects to the protocol. See :ref:" -"`\"What's new in Python 3.12\" ` for more details." +"on :func:`isinstance` checks comparing objects to the protocol. " +"See :ref:`\"What's new in Python 3.12\" ` for more " +"details." msgstr "" #: ../../library/typing.rst:2582 @@ -3837,7 +4784,6 @@ msgstr "" "この期待は実行時にはチェックされず、型チェッカーでのみ強制されます。\n" "使用方法は次の通りです::" -#: ../../library/typing.rst:2591 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3849,26 +4795,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::" +"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 +4839,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 +4869,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 +4898,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 +4936,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 +4977,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 +4998,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,20 +5036,26 @@ 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 "" -"A ``TypedDict`` can be introspected via annotations dicts (see :ref:" -"`annotations-howto` for more information on annotations best practices), :" -"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." +"A ``TypedDict`` can be introspected via annotations dicts " +"(see :ref:`annotations-howto` for more information on annotations best " +"practices), :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 +5068,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 +5088,30 @@ 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, " +"``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 +5122,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 +5135,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 +5154,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." +"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`." +"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 +5259,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 +5326,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 +5372,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 +5398,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 +5425,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)::" +"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 +5483,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." +"Decorator to mark an object as providing :func:`dataclass " +"`-like behavior." msgstr "" +"オブジェクトが :func:`dataclass ` のような振る舞いを提" +"供することを示すデコレータです。" #: ../../library/typing.rst:3007 msgid "" @@ -4416,11 +5517,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 +5531,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 +5552,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,13 +5572,21 @@ 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 "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :func:`@dataclasses.dataclass " +"`. For example, type checkers will assume these " +"classes have ``__init__`` methods that accept ``id`` and ``name``." msgstr "" #: ../../library/typing.rst:3054 @@ -4492,23 +5610,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 +5641,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,56 +5731,64 @@ 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 " "definition. The non-``@overload``-decorated definition, meanwhile, will be " "used at runtime but should be ignored by a type checker. At runtime, " -"calling an ``@overload``-decorated function directly will raise :exc:" -"`NotImplementedError`." +"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 "" +"Union や型変数では表現できない、より正確な型をオーバーロードで記述する例です:" -#: ../../library/typing.rst:3162 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -4668,17 +5802,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`." +"Overloaded functions can now be introspected at runtime " +"using :func:`get_overloads`." msgstr "" +":func:`get_overloads` を使い、実行時にオーバーロードされた関数を調べられるよ" +"うになりました。" #: ../../library/typing.rst:3185 msgid "" @@ -4696,32 +5842,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 +5883,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 +5905,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 +5951,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 +5982,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 +6007,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 +6031,6 @@ msgstr "" "このデコレータは主に、実装がプライベートクラスのインスタンスを返す場合に、型" "スタブファイルに定義されているクラスに対して印を付けるためのものです::" -#: ../../library/typing.rst:3320 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4852,6 +6039,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 +6054,8 @@ msgstr "" "プライベートクラスのインスタンスを返すのは推奨されません。\n" "そのようなクラスは公開クラスにするのが望ましいです。" -#: ../../library/typing.rst:3331 msgid "Introspection helpers" -msgstr "" +msgstr "イントロスペクション用のヘルパー" #: ../../library/typing.rst:3335 msgid "" @@ -4879,7 +6071,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 +6078,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 "" @@ -4911,8 +6107,8 @@ msgstr "" #: ../../library/typing.rst:3356 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` (see :class:" -"`Annotated` for more information)." +"with ``T``, unless *include_extras* is set to ``True`` " +"(see :class:`Annotated` for more information)." msgstr "" #: ../../library/typing.rst:3360 @@ -4924,44 +6120,51 @@ msgstr "" #: ../../library/typing.rst:3365 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such as :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " +"are not valid Python code, this function will raise an exception such " +"as :exc:`NameError`. For example, this can happen with imported :ref:`type " "aliases ` that include forward references, or with names " "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." +"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 +6174,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`` が他のジェネリック型の中に含まれる Union または :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 +6222,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 +6245,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 +6260,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 +6292,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 "" @@ -5091,31 +6325,31 @@ msgstr "" #: ../../library/typing.rst:3508 msgid "" -"Replaces type hints that evaluate to :const:`!None` with :class:`types." -"NoneType`." +"Replaces type hints that evaluate to :const:`!None` " +"with :class:`types.NoneType`." msgstr "" #: ../../library/typing.rst:3510 msgid "" -"Supports the :attr:`~annotationlib.Format.FORWARDREF` and :attr:" -"`~annotationlib.Format.STRING` formats." +"Supports the :attr:`~annotationlib.Format.FORWARDREF` " +"and :attr:`~annotationlib.Format.STRING` formats." msgstr "" #: ../../library/typing.rst:3513 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, and *type_params* parameters. " -"*format* specifies the format of the annotation and is a member of the :" -"class:`annotationlib.Format` enum." +"*format* specifies the format of the annotation and is a member of " +"the :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 +6358,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 +6412,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,48 +6419,63 @@ 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." +"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 "" -":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.dict ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`builtins.dict ` は添字表記 (``[]``) をサポートするようになりま" "した。\n" @@ -5231,45 +6485,47 @@ 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`." +"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 "" -":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.list ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." 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`." +"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 "" -":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.set ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`builtins.set ` は添字表記 (``[]``) をサポートするようになりまし" "た。\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,16 +6540,17 @@ 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." +":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 "" -":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.tuple ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`builtins.tuple ` は添字表記 (``[]``) をサポートするようになり" "ました。\n" @@ -5303,24 +6560,24 @@ 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 "" -":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.type ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`builtins.type ` は添字表記 (``[]``) をサポートするようになりま" "した。\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`." @@ -5328,8 +6585,8 @@ msgstr ":class:`collections.defaultdict` の非推奨なエイリアス。" #: ../../library/typing.rst:3679 msgid "" -":class:`collections.defaultdict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.defaultdict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.defaultdict` は添字表記 (``[]``) をサポートするようになり" "ました。\n" @@ -5341,8 +6598,8 @@ msgstr ":class:`collections.OrderedDict` の非推奨なエイリアス。" #: ../../library/typing.rst:3689 msgid "" -":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.OrderedDict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.OrderedDict` は添字表記 (``[]``) をサポートするようになり" "ました。\n" @@ -5354,8 +6611,8 @@ msgstr ":class:`collections.ChainMap` の非推奨なエイリアス。" #: ../../library/typing.rst:3699 msgid "" -":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.ChainMap` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.ChainMap` は添字表記 (``[]``) をサポートするようになりま" "した。\n" @@ -5367,8 +6624,8 @@ msgstr ":class:`collections.Counter` の非推奨なエイリアス。" #: ../../library/typing.rst:3709 msgid "" -":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.Counter` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.Counter` は添字表記 (``[]``) をサポートするようになりまし" "た。\n" @@ -5380,16 +6637,15 @@ msgstr ":class:`collections.deque` の非推奨なエイリアス。" #: ../../library/typing.rst:3719 msgid "" -":class:`collections.deque` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.deque` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.deque` は添字表記 (``[]``) をサポートするようになりまし" "た。\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 +6653,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 " +"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`." +"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`." @@ -5452,8 +6715,8 @@ msgstr ":class:`collections.abc.Set` の非推奨なエイリアス。" #: ../../library/typing.rst:3775 msgid "" -":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.abc.Set` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Set` は添字表記 (``[]``) をサポートするようになりまし" "た。\n" @@ -5465,8 +6728,8 @@ msgstr ":class:`collections.abc.Collection` の非推奨なエイリアス。" #: ../../library/typing.rst:3785 msgid "" -":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Collection` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Collection` は添字表記 (``[]``) をサポートするように" "なりました。\n" @@ -5478,8 +6741,8 @@ msgstr ":class:`collections.abc.Container` の非推奨なエイリアス。" #: ../../library/typing.rst:3793 msgid "" -":class:`collections.abc.Container` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Container` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Container` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5491,8 +6754,8 @@ msgstr ":class:`collections.abc.ItemsView` の非推奨なエイリアス。" #: ../../library/typing.rst:3801 msgid "" -":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.ItemsView` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5504,8 +6767,8 @@ msgstr ":class:`collections.abc.KeysView` の非推奨なエイリアス。" #: ../../library/typing.rst:3809 msgid "" -":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.KeysView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.KeysView` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5517,8 +6780,8 @@ msgstr ":class:`collections.abc.Mapping` の非推奨なエイリアス。" #: ../../library/typing.rst:3817 msgid "" -":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Mapping` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Mapping` は添字表記 (``[]``) をサポートするようになり" "ました。\n" @@ -5569,8 +6832,8 @@ msgstr ":class:`collections.abc.MutableSet` の非推奨なエイリアス。" #: ../../library/typing.rst:3851 msgid "" -":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.MutableSet` は添字表記 (``[]``) をサポートするように" "なりました。\n" @@ -5582,8 +6845,8 @@ msgstr ":class:`collections.abc.Sequence` の非推奨なエイリアス。" #: ../../library/typing.rst:3859 msgid "" -":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Sequence` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Sequence` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5595,31 +6858,33 @@ msgstr ":class:`collections.abc.ValuesView` の非推奨なエイリアス。" #: ../../library/typing.rst:3867 msgid "" -":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.ValuesView` は添字表記 (``[]``) をサポートするように" "なりました。\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." +"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 "" -":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Coroutine` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5629,12 +6894,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." +"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 +6912,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`." @@ -5681,16 +6947,15 @@ msgstr ":class:`collections.abc.Awaitable` の非推奨なエイリアス。" #: ../../library/typing.rst:3934 msgid "" -":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Awaitable` は添字表記 (``[]``) をサポートするようにな" "りました。\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`." @@ -5698,8 +6963,8 @@ msgstr ":class:`collections.abc.Iterable` の非推奨なエイリアス。" #: ../../library/typing.rst:3947 msgid "" -":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Iterable` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5711,8 +6976,8 @@ msgstr ":class:`collections.abc.Iterator` の非推奨なエイリアス。" #: ../../library/typing.rst:3955 msgid "" -":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Iterator` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5722,16 +6987,18 @@ 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." +"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 "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Callable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Callable` は添字表記 (``[]``) をサポートするようにな" "りました。\n" @@ -5741,24 +7008,26 @@ 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." +"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 "" -":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Generator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Generator` は添字表記 (``[]``) をサポートするようにな" "りました。\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`." @@ -5774,8 +7043,8 @@ msgstr ":class:`collections.abc.Reversible` の非推奨なエイリアス。" #: ../../library/typing.rst:4000 msgid "" -":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Reversible` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Reversible` は添字表記 (``[]``) をサポートするように" "なりました。\n" @@ -5789,21 +7058,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, " +"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 +7085,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, " +"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 +7112,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 +7208,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..03e73e4cc 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 @@ -34,8 +34,8 @@ msgstr ":mod:`!unicodedata` --- Unicode データベース" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 16.0.0 `_." +"in this database is compiled from the `UCD version 16.0.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -67,38 +67,38 @@ msgid "" "raised." msgstr "" "文字 *chr* に付いている名前を、文字列で返します。名前が定義されていない場合に" -"は *default* が返されますが、この引数が与えられていなければ :exc:" -"`ValueError` を発生させます。" +"は *default* が返されますが、この引数が与えられていなけれ" +"ば :exc:`ValueError` を発生させます。" #: ../../library/unicodedata.rst:47 msgid "" "Returns the decimal value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" "文字 *chr* に割り当てられている十進数を、整数で返します。この値が定義されてい" -"ない場合には *default* が返されますが、この引数が与えられていなければ :exc:" -"`ValueError` を発生させます。" +"ない場合には *default* が返されますが、この引数が与えられていなけれ" +"ば :exc:`ValueError` を発生させます。" #: ../../library/unicodedata.rst:54 msgid "" "Returns the digit value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" "文字 *chr* に割り当てられている数値を、整数で返します。この値が定義されていな" -"い場合には *default* が返されますが、この引数が与えられていなければ :exc:" -"`ValueError` を発生させます。" +"い場合には *default* が返されますが、この引数が与えられていなけれ" +"ば :exc:`ValueError` を発生させます。" #: ../../library/unicodedata.rst:61 msgid "" "Returns the numeric value assigned to the character *chr* as float. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" "文字 *chr* に割り当てられている数値を、float で返します。この値が定義されてい" -"ない場合には *default* が返されますが、この引数が与えられていなければ :exc:" -"`ValueError` を発生させます。" +"ない場合には *default* が返されますが、この引数が与えられていなけれ" +"ば :exc:`ValueError` を発生させます。" #: ../../library/unicodedata.rst:68 msgid "Returns the general category assigned to the character *chr* as string." @@ -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..405422386 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 @@ -84,9 +84,9 @@ msgid "" "with the correct arguments." msgstr "" "モックが呼び出されると、その :attr:`~Mock.called` 属性が ``True`` に設定され" -"ます。そして :meth:`~Mock.assert_called_with` や :meth:`~Mock." -"assert_called_once_with` メソッドを使ってそのメソッドが正しい引数で呼び出され" -"たかどうかをチェックできます。" +"ます。そして :meth:`~Mock.assert_called_with` " +"や :meth:`~Mock.assert_called_once_with` メソッドを使ってそのメソッドが正しい" +"引数で呼び出されたかどうかをチェックできます。" #: ../../library/unittest.mock-examples.rst:59 msgid "" @@ -132,13 +132,13 @@ msgstr "" msgid "" "We don't have to do any work to provide the 'close' method on our mock. " "Accessing close creates it. So, if 'close' hasn't already been called then " -"accessing it in the test will create it, but :meth:`~Mock." -"assert_called_with` will raise a failure exception." +"accessing it in the test will create it, " +"but :meth:`~Mock.assert_called_with` will raise a failure exception." msgstr "" "モックに `close` メソッドを持たせるために何か準備する必要はありません。 " "`close` メソッドにアクセスすると自動的にそれが作られます。なので、もし " -"`close` が呼び出されなかったとしてもテスト時に生成されるのですが、 :meth:" -"`~Mock.assert_called_with` が failure 例外を発生させます。" +"`close` が呼び出されなかったとしてもテスト時に生成されるのです" +"が、 :meth:`~Mock.assert_called_with` が failure 例外を発生させます。" #: ../../library/unittest.mock-examples.rst:106 msgid "Mocking Classes" @@ -162,15 +162,14 @@ msgid "" "In the example below we have a function ``some_function`` that instantiates " "``Foo`` and calls a method on it. The call to :func:`patch` replaces the " "class ``Foo`` with a mock. The ``Foo`` instance is the result of calling the " -"mock, so it is configured by modifying the mock :attr:`~Mock." -"return_value`. ::" +"mock, so it is configured by modifying the " +"mock :attr:`~Mock.return_value`. ::" msgstr "" "次の例では、 ``some_function`` という関数が ``Foo`` をインスタンス化し、その " "method を呼び出しています。 :func:`patch` を呼び出すと ``Foo`` クラスをモック" "に置き換えます。 ``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" @@ -203,13 +211,13 @@ msgstr "全ての呼び出しのトラッキング" #: ../../library/unittest.mock-examples.rst:146 msgid "" -"Often you want to track more than a single call to a method. The :attr:" -"`~Mock.mock_calls` attribute records all calls to child attributes of the " -"mock - and also to their children." +"Often you want to track more than a single call to a method. " +"The :attr:`~Mock.mock_calls` attribute records all calls to child attributes " +"of the mock - and also to their children." msgstr "" -"メソッドの複数回の呼び出しをトラックしたいことがあります。 :attr:`~Mock." -"mock_calls` 属性は、そのモックの子属性やさらにその子孫に対する呼び出しすべて" -"を記録しています。" +"メソッドの複数回の呼び出しをトラックしたいことがありま" +"す。 :attr:`~Mock.mock_calls` 属性は、そのモックの子属性やさらにその子孫に対" +"する呼び出しすべてを記録しています。" #: ../../library/unittest.mock-examples.rst:158 msgid "" @@ -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" @@ -332,15 +343,15 @@ msgstr "非同期イテレータをモックする" #: ../../library/unittest.mock-examples.rst:283 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-iterators` through ``__aiter__``. The :attr:`~Mock.return_value` " -"attribute of ``__aiter__`` can be used to set the return values to be used " -"for iteration." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-iterators` through ``__aiter__``. " +"The :attr:`~Mock.return_value` attribute of ``__aiter__`` can be used to set " +"the return values to be used for iteration." msgstr "" -"Python 3.8以降、``AsyncMock`` と ``MagicMock`` は ``__aiter__`` を通じて :" -"ref:`async-iterators` のモックをサポートしています。``__aiter__`` の :attr:" -"`~Mock.return_value` 属性はイテレーションに使用される戻り値を設定するために使" -"用できます。" +"Python 3.8以降、``AsyncMock`` と ``MagicMock`` は ``__aiter__`` を通じ" +"て :ref:`async-iterators` のモックをサポートしています。``__aiter__`` " +"の :attr:`~Mock.return_value` 属性はイテレーションに使用される戻り値を設定す" +"るために使用できます。" #: ../../library/unittest.mock-examples.rst:298 msgid "Mocking asynchronous context manager" @@ -348,10 +359,10 @@ msgstr "非同期コンテキストマネージャをモックする" #: ../../library/unittest.mock-examples.rst:300 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-context-managers` through ``__aenter__`` and ``__aexit__``. By " -"default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances that " -"return an async function." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-context-managers` through ``__aenter__`` and ``__aexit__``. " +"By default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances " +"that return an async function." msgstr "" "Python 3.8以降、``AsyncMock`` と ``MagicMock`` は ``__aenter__`` と " "``__aexit__`` を通じて :ref:`async-context-managers` のモックをサポートしてい" @@ -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,14 +418,20 @@ 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 "" "If you want this smarter matching to also work with method calls on the " "mock, you can use :ref:`auto-speccing `." msgstr "" -"このよりスマートなマッチングをモックのメソッド呼び出しにも適用したい場合は、:" -"ref:`auto-speccing ` を使用します。" +"このよりスマートなマッチングをモックのメソッド呼び出しにも適用したい場合" +"は、:ref:`auto-speccing ` を使用します。" #: ../../library/unittest.mock-examples.rst:358 msgid "" @@ -427,18 +442,20 @@ 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::" +":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 +474,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 +502,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 "" @@ -488,26 +520,25 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:404 msgid "" -"mock provides three convenient decorators for this: :func:`patch`, :func:" -"`patch.object` and :func:`patch.dict`. ``patch`` takes a single string, of " -"the form ``package.module.Class.attribute`` to specify the attribute you are " -"patching. It also optionally takes a value that you want the attribute (or " -"class or whatever) to be replaced with. 'patch.object' takes an object and " -"the name of the attribute you would like patched, plus optionally the value " -"to patch it with." -msgstr "" -"mock はこのために3つの便利なデコレータを提供しています: :func:`patch`, :func:" -"`patch.object`, :func:`patch.dict` です。``patch`` はパッチ対象を指定する " -"``package.module.Class.attribute`` の形式の文字列を引数に取ります。オプション" -"でその属性 (やクラスなど) を置き換えるオブジェクトを渡すことができます。 " -"'patch.object' はオブジェクトとパッチしたい属性名、それにオプションで置き換え" -"るオブジェクトを受け取ります。" +"mock provides three convenient decorators for " +"this: :func:`patch`, :func:`patch.object` and :func:`patch.dict`. ``patch`` " +"takes a single string, of the form ``package.module.Class.attribute`` to " +"specify the attribute you are patching. It also optionally takes a value " +"that you want the attribute (or class or whatever) to be replaced with. " +"'patch.object' takes an object and the name of the attribute you would like " +"patched, plus optionally the value to patch it with." +msgstr "" +"mock はこのために3つの便利なデコレータを提供していま" +"す: :func:`patch`, :func:`patch.object`, :func:`patch.dict` です。``patch`` " +"はパッチ対象を指定する ``package.module.Class.attribute`` の形式の文字列を引" +"数に取ります。オプションでその属性 (やクラスなど) を置き換えるオブジェクトを" +"渡すことができます。 'patch.object' はオブジェクトとパッチしたい属性名、それ" +"にオプションで置き換えるオブジェクトを受け取ります。" #: ../../library/unittest.mock-examples.rst:412 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,14 +555,28 @@ 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 "" -"If you are patching a module (including :mod:`builtins`) then use :func:" -"`patch` instead of :func:`patch.object`:" +"If you are patching a module (including :mod:`builtins`) then " +"use :func:`patch` instead of :func:`patch.object`:" msgstr "" -"モジュール (:mod:`builtins` を含む) をパッチしようとする場合、 :func:`patch." -"object` の代わりに :func:`patch` を使用してください:" +"モジュール (:mod:`builtins` を含む) をパッチしようとする場" +"合、 :func:`patch.object` の代わりに :func:`patch` を使用してください:" #: ../../library/unittest.mock-examples.rst:439 msgid "" @@ -540,7 +585,6 @@ msgstr "" "モジュール名は必要に応じて ``package.module`` のようにドットを含むことができ" "ます::" -#: ../../library/unittest.mock-examples.rst:441 msgid "" ">>> @patch('package.module.ClassName.attribute', sentinel.attribute)\n" "... def test():\n" @@ -549,6 +593,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:" @@ -560,15 +610,14 @@ msgid "" "argument (or :func:`patch.object` with two arguments). The mock will be " "created for you and passed into the test function / method:" msgstr "" -"Mock を使ってパッチしたい場合は、 :func:`patch` を1引数で (または :func:" -"`patch.object` を2引数で) 使うことができます。mock が自動で生成され、テスト関" -"数/メソッドに渡されます:" +"Mock を使ってパッチしたい場合は、 :func:`patch` を1引数で (また" +"は :func:`patch.object` を2引数で) 使うことができます。mock が自動で生成さ" +"れ、テスト関数/メソッドに渡されます:" #: ../../library/unittest.mock-examples.rst:471 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 +628,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,27 +764,31 @@ 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" +"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 "" -"We can do that in a slightly nicer way using the :meth:`~Mock." -"configure_mock` method to directly set the return value for us::" +"We can do that in a slightly nicer way using " +"the :meth:`~Mock.configure_mock` method to directly set the return value for " +"us::" msgstr "" -"これより少し良いやり方として、返り値を直接セットする :meth:`~Mock." -"configure_mock` メソッドを使用して次のようにすることができます::" +"これより少し良いやり方として、返り値を直接セットす" +"る :meth:`~Mock.configure_mock` メソッドを使用して次のようにすることができま" +"す::" #: ../../library/unittest.mock-examples.rst:578 msgid "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" msgstr "" @@ -739,11 +800,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 +820,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" +">>> 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" @@ -775,14 +840,15 @@ msgid "" "In some tests I wanted to mock out a call to :meth:`datetime.date.today` to " "return a known date, but I didn't want to prevent the code under test from " "creating new date objects. Unfortunately :class:`datetime.date` is written " -"in C, and so I couldn't just monkey-patch out the static :meth:`datetime." -"date.today` method." +"in C, and so I couldn't just monkey-patch out the " +"static :meth:`datetime.date.today` method." msgstr "" "テストによっては、 :meth:`datetime.date.today` の呼び出しを既知の date を返す" "ようにモックしたいと思うことがありました。しかし、テスト対象のコードが新しい " -"date オブジェクトを生成するのを妨げたくはありません。不運にも、 :class:" -"`datetime.date` は C で書かれています。したがって、静的な :meth:`datetime." -"date.today` メソッドを単にモンキーパッチすることはできませんでした。" +"date オブジェクトを生成するのを妨げたくはありません。不運に" +"も、 :class:`datetime.date` は C で書かれています。したがって、静的" +"な :meth:`datetime.date.today` メソッドを単にモンキーパッチすることはできませ" +"んでした。" #: ../../library/unittest.mock-examples.rst:608 msgid "" @@ -802,11 +868,11 @@ msgid "" "date. When the mock date class is called a real date will be constructed and " "returned by ``side_effect``. ::" msgstr "" -"ここで、テスト対象のモジュール中の ``date`` クラスをモックするために :func:" -"`patch decorator ` が使用されています。そして、モックの date クラス" -"の :attr:`~Mock.side_effect` 属性は、本物の date を返すラムダ関数にセットされ" -"ます。モックの date クラスが呼ばれる時、 ``side_effect`` によって本物の date " -"が構築されて返されます。::" +"ここで、テスト対象のモジュール中の ``date`` クラスをモックするため" +"に :func:`patch decorator ` が使用されています。そして、モックの date " +"クラスの :attr:`~Mock.side_effect` 属性は、本物の date を返すラムダ関数にセッ" +"トされます。モックの date クラスが呼ばれる時、 ``side_effect`` によって本物" +"の date が構築されて返されます。::" #: ../../library/unittest.mock-examples.rst:618 msgid "" @@ -874,13 +940,13 @@ msgstr "" msgid "" "A generator method / function is called to return the generator object. It " "is the generator object that is then iterated over. The protocol method for " -"iteration is :meth:`~container.__iter__`, so we can mock this using a :class:" -"`MagicMock`." +"iteration is :meth:`~container.__iter__`, so we can mock this using " +"a :class:`MagicMock`." msgstr "" "ジェネレータメソッド/関数はジェネレータオブジェクトを返すために呼び出されま" "す。そしてこのジェネレータオブジェクトが反復処理されます。イテレーションのた" -"めのプロトコルメソッドは :meth:`~container.__iter__` なので、:class:" -"`MagicMock` を使ってこれをモックすることができます。" +"めのプロトコルメソッドは :meth:`~container.__iter__` なの" +"で、:class:`MagicMock` を使ってこれをモックすることができます。" #: ../../library/unittest.mock-examples.rst:653 msgid "" @@ -902,15 +968,14 @@ 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 " -"about them here. A very good introduction to generators and how powerful " -"they are is: `Generator Tricks for Systems Programmers `_." +"There are also generator expressions and more `advanced uses `_ of generators, but we aren't " +"concerned about them here. A very good introduction to generators and how " +"powerful they are is: `Generator Tricks for Systems Programmers `_." msgstr "" -"ジェネレータ式やジェネレータのより`高度な使い方 `_ もありますが、ここではそれらについては触れません。" "ジェネレータとその強力さについての非常に良い紹介記事があります: `Generator " "Tricks for Systems Programmers `_。" @@ -919,7 +984,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 +992,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 +1017,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,20 +1057,31 @@ 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 "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the setUp then tearDown is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the setUp then tearDown is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "この方式を使う場合、必ず ``stop`` メソッドを呼び出してパッチが解除する必要が" "あります。setUp の中で例外が発生した場合 tearDown が呼び出されないので、これ" "は意外に面倒です。 :meth:`unittest.TestCase.addCleanup` を使うと簡単にできま" "す::" -#: ../../library/unittest.mock-examples.rst:731 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -1006,6 +1094,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,26 +1155,27 @@ 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." +"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 "" "Both ``assert_called_with`` and ``assert_called_once_with`` make assertions " "about the *most recent* call. If your mock is going to be called several " -"times, and you want to make assertions about *all* those calls you can use :" -"attr:`~Mock.call_args_list`:" +"times, and you want to make assertions about *all* those calls you can " +"use :attr:`~Mock.call_args_list`:" msgstr "" " ``assert_called_with`` と ``assert_called_once_with`` はどちらも*直近の*呼び" "出しについてアサートを行います。もしモックが何度も呼び出され、その*すべての*" "呼び出しに対してアサートしたい場合には :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 +1183,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 +1198,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 +1218,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 +1269,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 +1291,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,46 +1322,47 @@ 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 "" -"An alternative approach is to create a subclass of :class:`Mock` or :class:" -"`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " -"an example implementation:" +"An alternative approach is to create a subclass of :class:`Mock` " +"or :class:`MagicMock` that copies (using :func:`copy.deepcopy`) the " +"arguments. Here's an example implementation:" msgstr "" -"別の方法としては、( :func:`copy.deepcopy` を使用して)引数をコピーする、 :" -"class:`Mock` や :class:`MagicMock` のサブクラスを作成する方法があります。以下" -"に実装例を示します。" +"別の方法としては、( :func:`copy.deepcopy` を使用して)引数をコピーす" +"る、 :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 +1378,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 +1425,111 @@ 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:" +"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 +1538,27 @@ 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." +"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 +1566,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 +1605,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 +1622,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 +1636,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,41 +1715,62 @@ 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." -"assert_has_calls` method. This takes a list of calls (constructed with the :" -"data:`call` object). If that sequence of calls are in :attr:`~Mock." -"mock_calls` then the assert succeeds." +"sequence of them then an alternative is to use " +"the :meth:`~Mock.assert_has_calls` method. This takes a list of calls " +"(constructed with the :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 +1779,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,18 +1817,32 @@ 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." +"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 " -"useful here, in the form of its equality matcher (`hamcrest.library." -"integration.match_equality `_)." -msgstr "" +"useful here, in the form of its equality matcher " +"(`hamcrest.library.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..f438851c8 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 @@ -62,15 +62,16 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along with :" -"const:`sentinel` for creating unique objects. See the `quick guide`_ for " -"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" -"`patch`." +"module and class level attributes within the scope of a test, along " +"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " +"for some examples of how to use :class:`Mock`, :class:`MagicMock` " +"and :func:`patch`." msgstr "" -"加えて、 mock はテストのスコープ内にあるモジュールやクラスの属性を変更する :" -"func:`patch` デコレータを提供します。さらに、ユニークなオブジェクトの作成に" -"は :const:`sentinel` が利用できます。 :class:`Mock` や :class:" -"`MagicMock` 、 :func:`patch` の利用例は `quick guide`_ を参照してください。" +"加えて、 mock はテストのスコープ内にあるモジュールやクラスの属性を変更す" +"る :func:`patch` デコレータを提供します。さらに、ユニークなオブジェクトの作成" +"には :const:`sentinel` が利用できます。 :class:`Mock` " +"や :class:`MagicMock` 、 :func:`patch` の利用例は `quick guide`_ を参照してく" +"ださい。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -87,6 +88,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 +104,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 +138,6 @@ msgstr "" "はテスト中はモック (または別のオブジェクト) に置換され、テスト終了時に復元さ" "れます::" -#: ../../library/unittest.mock.rst:101 msgid "" ">>> from unittest.mock import patch\n" ">>> @patch('module.ClassName2')\n" @@ -148,6 +152,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 +213,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 "" @@ -274,13 +289,13 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't callable: :class:" -"`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't " +"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` は :class:`Mock` のサブクラスで、すべてのマジックメソッド" "が事前に作成され、利用できます。また、呼び出し不可能なモックを作成する場合に" -"は、呼び出し不能な変種の :class:`NonCallableMock` や :class:" -"`NonCallableMagicMock` があります。" +"は、呼び出し不能な変種の :class:`NonCallableMock` " +"や :class:`NonCallableMagicMock` があります。" #: ../../library/unittest.mock.rst:224 msgid "" @@ -290,8 +305,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` デコレータによって特定のモジュール内のクラスを :class:`Mock` オ" -"ブジェクトで一時的に置換することが簡単にできます。デフォルトでは :func:" -"`patch` は :class:`MagicMock` を作成します。 :func:`patch` に渡す " +"ブジェクトで一時的に置換することが簡単にできます。デフォルトで" +"は :func:`patch` は :class:`MagicMock` を作成します。 :func:`patch` に渡す " "*new_callable* 引数によって、別の :class:`Mock` クラスを指定できます。" #: ../../library/unittest.mock.rst:232 @@ -313,15 +328,18 @@ msgstr "" "*spec*: モックオブジェクトの仕様として働く文字列のリストもしくは存在するオブ" "ジェクト (クラスもしくはインスタンス) を指定します。オブジェクトを渡した場合" "には、 dir 関数によって文字列のリストが生成されます (サポートされない特殊属性" -"や特殊メソッドは除く) 。このリストにない属性にアクセスした際には :exc:" -"`AttributeError` が発生します。" +"や特殊メソッドは除く) 。このリストにない属性にアクセスした際に" +"は :exc:`AttributeError` が発生します。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~object." -"__class__` returns the class of the spec object. This allows mocks to pass :" -"func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) " +"then :attr:`~object.__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 "" @@ -330,21 +348,21 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*: より厳しい *spec* です。こちらを利用した場合、 *spec_set* に渡さ" -"れたオブジェクトに存在しない属性に対し *設定* や取得をしようとした際に :exc:" -"`AttributeError` が発生します。" +"れたオブジェクトに存在しない属性に対し *設定* や取得をしようとした際" +"に :exc:`AttributeError` が発生します。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :" -"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See " +"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." msgstr "" -"*side_effect*: モックが呼び出された際に呼び出される関数を指定します。 :attr:" -"`~Mock.side_effect` 属性を参考にしてください。例外を発生させたり、動的に戻り" -"値を変更する場合に便利です。関数には、モックと同じ引数が渡され、 :data:" -"`DEFAULT` を返さない限りはこの関数の戻り値が使われます。" +"*side_effect*: モックが呼び出された際に呼び出される関数を指定しま" +"す。 :attr:`~Mock.side_effect` 属性を参考にしてください。例外を発生させたり、" +"動的に戻り値を変更する場合に便利です。関数には、モックと同じ引数が渡さ" +"れ、 :data:`DEFAULT` を返さない限りはこの関数の戻り値が使われます。" #: ../../library/unittest.mock.rst:255 msgid "" @@ -376,13 +394,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 " +"*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 "" @@ -390,8 +411,8 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise an :exc:" -"`AttributeError`)." +"to access an attribute that doesn't exist will raise " +"an :exc:`AttributeError`)." msgstr "" "*wraps*: このモックオブジェクトがラップするものです。 *wraps* が ``None`` で" "なければ、このモックを呼び出すと、その呼び出しがラップされたオブジェクトに渡" @@ -407,19 +428,20 @@ 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 "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See the :meth:" -"`configure_mock` method for details." +"used to set attributes on the mock after it is created. See " +"the :meth:`configure_mock` method for details." msgstr "" "モックは、任意のキーワード引数を与えることができます。これらはモックの生成" "後、属性の設定に使われます。詳細は :meth:`configure_mock` を参照してくださ" @@ -433,11 +455,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,21 +474,25 @@ 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." +"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 "" -"assert the mock has been called with the specified calls. The :attr:" -"`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. " +"The :attr:`mock_calls` list is checked for the calls." msgstr "" -"モックが特定の呼び出しで呼ばれたことをアサートします。呼び出しでは :attr:" -"`mock_calls` のリストがチェックされます。" +"モックが特定の呼び出しで呼ばれたことをアサートします。呼び出しで" +"は :attr:`mock_calls` のリストがチェックされます。" #: ../../library/unittest.mock.rst:367 msgid "" @@ -491,7 +518,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 +527,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 +554,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 +577,38 @@ 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." +"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." @@ -571,8 +617,8 @@ msgstr "*spec_set* が真なら、 spec 以外の属性は設定できません #: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" -"attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` " +"and :attr:`mock_calls` attributes of this one." msgstr "" "属性として mock を設定して、その名前と親を入れ替えます。設定されたモックの呼" "び出しは、 :attr:`method_calls` や :attr:`mock_calls` 属性に記録されます。" @@ -601,15 +647,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 +664,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 "" @@ -678,20 +723,19 @@ msgid "" "the :attr:`return_value`)." msgstr "" "関数を渡した場合はモックと同じ引数で呼び出され、 :data:`DEFAULT` を返さない限" -"りはその関数の戻り値が返されます。関数が :data:`DEFAULT` を返した場合は ( :" -"attr:`return_value` によって) モックの通常の値を返します。" +"りはその関数の戻り値が返されます。関数が :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)." +"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 +775,19 @@ 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 `." +":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." @@ -753,13 +798,14 @@ msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare with :attr:" -"`call_args_list`." +"used for conveniently constructing lists of calls to compare " +"with :attr:`call_args_list`." msgstr "" "モックの呼び出しを順に記録したリストです (よって、このリストの長さはモックが" "呼び出された回数と等しくなります)。モックを作成してから一度も呼び出しを行なっ" -"ていない場合は、空のリストが返されます。 :data:`call` オブジェクトは、 :attr:" -"`call_args_list` の比較対象となる呼び出しのリストを作成する際に便利です。" +"ていない場合は、空のリストが返されます。 :data:`call` オブジェクト" +"は、 :attr:`call_args_list` の比較対象となる呼び出しのリストを作成する際に便" +"利です。" #: ../../library/unittest.mock.rst:700 msgid "" @@ -807,26 +853,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:" +":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 "" @@ -834,22 +889,25 @@ msgid "" "same meaning of :class:`Mock`, with the exception of *return_value* and " "*side_effect* which have no meaning on a non-callable mock." msgstr "" -"呼び出しができない :class:`Mock` です。コンストラクタのパラメータは :class:" -"`Mock` と同様ですが、 *return_value* や *side_effect* は意味を持ちません。" +"呼び出しができない :class:`Mock` です。コンストラクタのパラメータ" +"は :class:`Mock` と同様ですが、 *return_value* や *side_effect* は意味を持ち" +"ません。" #: ../../library/unittest.mock.rst:786 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 "" -"The :class:`Mock` classes have support for mocking magic methods. See :ref:" -"`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. " +"See :ref:`magic methods ` for the full details." msgstr "" -":class:`Mock` クラスは、 特殊メソッドをサポートしています。すべての詳細は :" -"ref:`magic methods ` を参照してください。" +":class:`Mock` クラスは、 特殊メソッドをサポートしています。すべての詳細" +"は :ref:`magic methods ` を参照してください。" #: ../../library/unittest.mock.rst:799 msgid "" @@ -872,19 +930,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 +950,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." +"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." @@ -915,11 +978,14 @@ msgstr "" #: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or other :term:" -"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." -"__get__` and :meth:`~object.__set__` methods so you can specify a return " -"value when it is fetched." +"A mock intended to be used as a :class:`property`, or " +"other :term:`descriptor`, on a class. :class:`PropertyMock` " +"provides :meth:`~object.__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 +996,6 @@ msgstr "" "与えないモックの呼び出しに相当します。設定は、 設定する値を伴った呼び出しにな" "ります。::" -#: ../../library/unittest.mock.rst:857 msgid "" ">>> class Foo:\n" "... @property\n" @@ -950,17 +1015,33 @@ 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 "" -"Because of the way mock attributes are stored you can't directly attach a :" -"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " -"type object::" +"Because of the way mock attributes are stored you can't directly attach " +"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " +"mock type object::" msgstr "" ":class:`PropertyMock` を直接モックに取り付ける方法は、モックの属性を保存する" "方法によりうまく動作しません。代わりに、モック型に取り付けてください::" -#: ../../library/unittest.mock.rst:879 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -969,15 +1050,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 +1073,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 +1098,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,146 +1116,167 @@ 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 " -"automatically detect the synchronous functions and set them as :class:" -"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " -"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " -"functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " +"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " +"will automatically detect the synchronous functions and set them " +"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " +"or :class:`MagicMock`) 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." +"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`." +"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`." +"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." +"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`." +"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." +"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`." +"Global default timeout in seconds to create instances " +"of :class:`ThreadingMock`." msgstr "" +":class:`ThreadingMock` のインスタンスを作成するときに使う、秒単位のグローバル" +"なデフォルトのタイムアウトです。" #: ../../library/unittest.mock.rst:1189 msgid "Calling" @@ -1169,62 +1284,72 @@ msgstr "呼び出し" #: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:" -"`~Mock.return_value` attribute. The default return value is a new Mock " -"object; it is created the first time the return value is accessed (either " -"explicitly or by calling the Mock) - but it is stored and the same one " -"returned each time." +"Mock objects are callable. The call will return the value set as " +"the :attr:`~Mock.return_value` attribute. The default return value is a new " +"Mock object; it is created the first time the return value is accessed " +"(either explicitly or by calling the Mock) - but it is stored and the same " +"one returned each time." msgstr "" -"モックオブジェクトは呼び出し可能です。呼び出しの戻り値は :attr:`~Mock." -"return_value` 属性に設定された値です。デフォルトでは新しいモックオブジェクト" -"を返します。この新しいモックは、属性に最初にアクセスした際に作成されます (明" -"示もしくはモックの呼び出しによって)。 そしてそれは保存され、それ以降は同じも" -"のが返されます。" +"モックオブジェクトは呼び出し可能です。呼び出しの戻り値" +"は :attr:`~Mock.return_value` 属性に設定された値です。デフォルトでは新しい" +"モックオブジェクトを返します。この新しいモックは、属性に最初にアクセスした際" +"に作成されます (明示もしくはモックの呼び出しによって)。 そしてそれは保存さ" +"れ、それ以降は同じものが返されます。" #: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes like :attr:" -"`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes " +"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"呼び出しはオブジェクトとして :attr:`~Mock.call_args` や :attr:`~Mock." -"call_args_list` に記録されます。" +"呼び出しはオブジェクトとして :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 "" -"The simplest way to make a mock raise an exception when called is to make :" -"attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to " +"make :attr:`~Mock.side_effect` an exception class or instance:" msgstr "" -"呼び出された際に例外を発生させるモックを作成するためには、 :attr:`~Mock." -"side_effect` を例外クラスかインスタンスにする方法が最もシンプルです:" +"呼び出された際に例外を発生させるモックを作成するために" +"は、 :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 +1366,6 @@ msgstr "" "もしイテレート可能オブジェクトの要素が例外だった場合には、戻り値として返され" "る代わりに例外が発生します::" -#: ../../library/unittest.mock.rst:1290 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1254,6 +1378,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 +1401,24 @@ 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" @@ -1291,21 +1428,24 @@ msgstr "Mock の名前と name 属性" msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to use :meth:`~Mock." -"configure_mock`::" +"creation time. There are two alternatives. One option is to " +"use :meth:`~Mock.configure_mock`::" msgstr "" "\"name\" は :class:`Mock` コンストラクタの引数なので、モックオブジェクトが " "\"name\" 属性を持つことを望む場合、単に生成時にそれを渡すことはできません。2" "つの選択肢があります。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 +1455,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" @@ -1336,30 +1477,29 @@ msgid "" "calls between mocks:" msgstr "" "属性 (もしくは戻り値) に他のモックを設定した場合、このモックは \"子\" になり" -"ます。この子に対する呼び出しは、親の :attr:`~Mock.method_calls` や :attr:" -"`~Mock.mock_calls` に記録されます。これは、子のモックを構成し、親にそのモック" -"を設定する際に有用です。また、親に対して設定したすべての子の呼び出しを記録す" -"るため、それらの間の順番を確認する際にも有用です:" +"ます。この子に対する呼び出しは、親の :attr:`~Mock.method_calls` " +"や :attr:`~Mock.mock_calls` に記録されます。これは、子のモックを構成し、親に" +"そのモックを設定する際に有用です。また、親に対して設定したすべての子の呼び出" +"しを記録するため、それらの間の順番を確認する際にも有用です:" -#: ../../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 "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use the :meth:`~Mock." -"attach_mock` method::" +"attach mocks that have names to a parent you use " +"the :meth:`~Mock.attach_mock` method::" msgstr "" ":func:`patch` を用いて作成したモックには、自動的に名前が与えられます。名前を" "持つモックを設定したい場合には、親に対して :meth:`~Mock.attach_mock` メソッド" "を呼び出します::" -#: ../../library/unittest.mock.rst:1385 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1374,8 +1514,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 +1535,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 +1582,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 +1590,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 "" @@ -1454,11 +1613,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to the :class:" -"`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to " +"the :class:`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 +1627,16 @@ 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." +"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 "" @@ -1483,16 +1646,16 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See the :" -"func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See " +"the :func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "より強力な *spec* の形は *autospec* です。 ``autospec=True`` を指定した場" "合、 mock は置換対象となるオブジェクトから得られる spec で生成されます。 " "mock のすべての属性もまた置換対象となるオブジェクトの属性に応じた spec を持ち" "ます。 mock されたメソッドや関数は引数をチェックし、間違ったシグネチャで呼び" "出された場合は :exc:`TypeError` を発生させます。クラスを置き換える mock の場" -"合、その戻り値 (つまりインスタンス) はそのクラスと同じ spec を持ちます。 :" -"func:`create_autospec` 関数と :ref:`auto-speccing` を参照してください。" +"合、その戻り値 (つまりインスタンス) はそのクラスと同じ spec を持ちま" +"す。 :func:`create_autospec` 関数と :ref:`auto-speccing` を参照してください。" #: ../../library/unittest.mock.rst:1464 msgid "" @@ -1503,7 +1666,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 +1675,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,16 +1692,23 @@ 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 " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with ``patch." -"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" -"`unittest` finds tests. You can specify an alternative prefix by setting " -"``patch.TEST_PREFIX``." -msgstr "" +"finds tests by looking for method names that start with " +"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " +"way :mod:`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 "" @@ -1542,15 +1719,18 @@ msgid "" msgstr "" "patch は with 文を使ってコンテキストマネージャーとして使うこともできます。そ" "の場合パッチは with 文のブロック内でのみ適用されます。 \"as\" を使って、 " -"\"as\" に続いて指定した変数にパッチされたオブジェクトが代入されます。これは :" -"func:`patch` が mock オブジェクトを生成するときに便利です。" +"\"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." +":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 +1748,6 @@ msgstr "" ":func:`patch` を関数デコレータとして利用し、 mock を生成してそれをデコレート" "された関数に渡します::" -#: ../../library/unittest.mock.rst:1503 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1577,12 +1756,18 @@ 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 "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be the :attr:" -"`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be " +"the :attr:`~Mock.return_value` of the mock that will be used." msgstr "" "クラスをパッチするとそのクラスを :class:`MagicMock` の **インスタンス** に置" "き換えます。テスト中のコードからそのクラスがインスタンス化される場合、 mock " @@ -1590,21 +1775,22 @@ msgstr "" #: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock." -"side_effect` to return a new mock each time. Alternatively you can set the " -"*return_value* to be anything you want." +"If the class is instantiated multiple times you could " +"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " +"you can set the *return_value* to be anything you want." msgstr "" "クラスが複数回インスタンス化される場合、 :attr:`~Mock.side_effect` を利用して" "毎回新しい 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 +1803,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 +1822,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 +1830,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 +1847,6 @@ msgstr "" "モックとして生成したい場合に便利です。例えば、 :class:`NonCallableMock` を利" "用したい場合::" -#: ../../library/unittest.mock.rst:1546 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1658,6 +1858,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 +1876,6 @@ msgstr "" "別のユースケースとしては、オブジェクトを :class:`io.StringIO` インスタンスで" "置き換えることがあります::" -#: ../../library/unittest.mock.rst:1557 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1680,6 +1888,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 +1910,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,21 +1918,26 @@ 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 "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock." -"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " -"configured. These aren't syntactically valid to pass in directly as keyword " -"arguments, but a dictionary with these as keys can still be expanded into a :" -"func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like " +"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " +"can also be configured. These aren't syntactically valid to pass in directly " +"as keyword arguments, but a dictionary with these as keys can still be " +"expanded into a :func:`patch` call using ``**``::" msgstr "" -"生成された mock の属性のさらに属性、 :attr:`~Mock.return_value` :attr:`~Mock." -"side_effect` などもセットアップできます。これらはキーワード引数のシンタックス" -"では直接指定できませんが、それらをキーとする辞書を ``**`` を使って :func:" -"`patch` に渡すことができます::" +"生成された mock の属性のさらに属" +"性、 :attr:`~Mock.return_value` :attr:`~Mock.side_effect` などもセットアップ" +"できます。これらはキーワード引数のシンタックスでは直接指定できませんが、それ" +"らをキーとする辞書を ``**`` を使って :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 +1949,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`::" +"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 +1978,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 +2004,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" @@ -1785,9 +2027,9 @@ msgstr "" msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" -"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " -"configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. " +"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " +"for configuring the mock object it creates." msgstr "" ":func:`patch.object` はデコレータ、クラスデコレータ、コンテキストマネージャー" "として利用できます。引数の *new*, *spec*, *create*, *spec_set*, *autospec*, " @@ -1797,11 +2039,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" -"クラスデコレータとして利用する場合、 :func:`patch.object` は ``patch." -"TEST_PREFIX`` にしたがってラップするメソッドを選択します。" +"クラスデコレータとして利用する場合、 :func:`patch.object` は " +"``patch.TEST_PREFIX`` にしたがってラップするメソッドを選択します。" #: ../../library/unittest.mock.rst:1639 msgid "" @@ -1834,12 +2076,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 +2123,36 @@ 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:" +"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 "" @@ -1927,9 +2177,9 @@ msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." -"__iter__` or :meth:`~object.__contains__`." +"to the magic " +"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " +"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." msgstr "" #: ../../library/unittest.mock.rst:1775 @@ -1946,23 +2196,24 @@ 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 "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned when :func:" -"`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned " +"when :func:`patch.multiple` is used as a context manager." msgstr "" -":func:`patch.multiple` に mock を生成させたい場合、キーワード引数の値に :" -"data:`DEFAULT` を指定します。この場合生成されたモックはデコレート対象の関数に" -"キーワード引数として渡され、コンテキストマネージャーとして :func:`patch." -"multiple` が利用された場合は辞書として返します。" +":func:`patch.multiple` に mock を生成させたい場合、キーワード引数の値" +"に :data:`DEFAULT` を指定します。この場合生成されたモックはデコレート対象の関" +"数にキーワード引数として渡され、コンテキストマネージャーとし" +"て :func:`patch.multiple` が利用された場合は辞書として返します。" #: ../../library/unittest.mock.rst:1791 msgid "" @@ -1973,17 +2224,17 @@ msgid "" msgstr "" ":func:`patch.multiple` はデコレータ、クラスデコレータ、コンテキストマネー" "ジャーとして使えます。引数の *spec*, *spec_set*, *create*, *autospec*, " -"*new_callable* は :func:`patch` の引数と同じ意味を持ちます。これらの引数は :" -"func:`patch.multiple` によって適用される *すべての* パッチに対して適用されま" -"す。" +"*new_callable* は :func:`patch` の引数と同じ意味を持ちます。これらの引数" +"は :func:`patch.multiple` によって適用される *すべての* パッチに対して適用さ" +"れます。" #: ../../library/unittest.mock.rst:1796 msgid "" -"When used as a class decorator :func:`patch.multiple` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" -"クラスデコレータとして利用する場合、 :func:`patch.multiple` は ``patch." -"TEST_PREFIX`` にしたがってラップするメソッドを選択します。" +"クラスデコレータとして利用する場合、 :func:`patch.multiple` は " +"``patch.TEST_PREFIX`` にしたがってラップするメソッドを選択します。" #: ../../library/unittest.mock.rst:1799 msgid "" @@ -1992,12 +2243,11 @@ msgid "" "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -":func:`patch.multiple` に mock を生成させたい場合、キーワード引数の値に :" -"data:`DEFAULT` を指定します。:func:`patch.multiple` をデコレータとして使った" -"場合生成されたモックはデコレート対象の関数にキーワード引数として渡されま" -"す。::" +":func:`patch.multiple` に mock を生成させたい場合、キーワード引数の値" +"に :data:`DEFAULT` を指定します。:func:`patch.multiple` をデコレータとして" +"使った場合生成されたモックはデコレート対象の関数にキーワード引数として渡され" +"ます。::" -#: ../../library/unittest.mock.rst:1803 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2009,6 +2259,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 +2279,6 @@ msgstr "" "が、キーワード引数は :func:`patch` によって作られる通常の引数の *後ろ* で受け" "取る必要があります::" -#: ../../library/unittest.mock.rst:1816 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2031,6 +2289,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 +2308,6 @@ msgstr "" "キストマネージャーが返す値は、名前がキーで値が生成された mock となる辞書で" "す::" -#: ../../library/unittest.mock.rst:1828 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2052,25 +2317,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 +2359,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 +2370,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,20 +2405,35 @@ 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 "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "この方式を使う場合、必ず ``stop`` メソッドを呼び出してパッチが解除する必要が" "あります。 ``setUp`` の中で例外が発生した場合 ``tearDown`` が呼び出されないの" "で、これは意外に面倒です。 :meth:`unittest.TestCase.addCleanup` を使うと簡単" "にできます::" -#: ../../library/unittest.mock.rst:1890 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2143,6 +2445,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 "" @@ -2154,8 +2465,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1903 msgid "" -"It is also possible to stop all patches which have been started by using :" -"func:`patch.stopall`." +"It is also possible to stop all patches which have been started by " +"using :func:`patch.stopall`." msgstr "" ":func:`patch.stopall` を利用してすべての start されたパッチを stop することも" "できます。" @@ -2178,7 +2489,6 @@ msgstr "" "モジュール内の任意のビルトインに対してパッチを当てることができます。以下の例" "はビルトインの :func:`ord` を修正します::" -#: ../../library/unittest.mock.rst:1918 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2188,6 +2498,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" @@ -2202,19 +2519,18 @@ msgid "" msgstr "" "すべての patcher はクラスデコレータとして利用できます。この場合、そのクラスの" "すべてのテストメソッドをラップします。 patcher は ``'test'`` で始まる名前のメ" -"ソッドをテストメソッドだと認識します。これはデフォルトで :class:`unittest." -"TestLoader` がテストメソッドを見つける方法と同じです。" +"ソッドをテストメソッドだと認識します。これはデフォルト" +"で :class:`unittest.TestLoader` がテストメソッドを見つける方法と同じです。" #: ../../library/unittest.mock.rst:1937 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting ``patch." -"TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting " +"``patch.TEST_PREFIX``::" msgstr "" -"他の prefix を使う事もできます。その場合、 patcher にその prefix を ``patch." -"TEST_PREFIX`` に設定することで教えることができます::" +"他の prefix を使う事もできます。その場合、 patcher にその prefix を " +"``patch.TEST_PREFIX`` に設定することで教えることができます::" -#: ../../library/unittest.mock.rst:1940 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2234,6 +2550,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 +2626,6 @@ msgstr "" "次のような構造を持ったプロジェクトをテストしようとしていると仮定してくださ" "い::" -#: ../../library/unittest.mock.rst:2002 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2302,16 +2634,29 @@ 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 " -"will have to do when it imports ``SomeClass`` from module a. If we use :func:" -"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " -"module b already has a reference to the *real* ``SomeClass`` and it looks " -"like our patching had no effect." -msgstr "" +"will have to do when it imports ``SomeClass`` from module a. If we " +"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " +"our test; 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,17 +2670,16 @@ msgstr "" "ンポートされた ``SomeClass`` をルックアップしています。なのでパッチは次のよう" "にしなければなりません::" -#: ../../library/unittest.mock.rst:2020 msgid "@patch('b.SomeClass')" -msgstr "" +msgstr "@patch('b.SomeClass')" #: ../../library/unittest.mock.rst:2022 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." -"SomeClass``. Both of these import forms are common. In this case the class " -"we want to patch is being looked up in the module and so we have to patch " -"``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses " +"``a.SomeClass``. Both of these import forms are common. In this case the " +"class we want to patch is being looked up in the module and so we have to " +"patch ``a.SomeClass`` instead::" msgstr "" "ですが、別のシナリオとして、module b が ``from a import SomeClass`` ではなく " "``import a`` をしていて、 ``some_function`` が ``a.SomeClass`` を利用していた" @@ -2343,9 +2687,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" @@ -2356,16 +2699,17 @@ msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ と patch.object_ はどちらも デスクリプタ (クラスメソッド、static メ" "ソッド、プロパティ) を正しく patch できます。デスクリプタに patch する場合、" "インスタンスではなく *class* にパッチする必要があります。これらはまた *幾らか" "の* 属性アクセスをプロキシするオブジェクト、例えば `django の setttings オブ" -"ジェクト `_ に対しても機能します。" +"ジェクト `_ に対して" +"も機能します。" #: ../../library/unittest.mock.rst:2041 msgid "MagicMock and magic method support" @@ -2375,12 +2719,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." +":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 "" @@ -2406,8 +2753,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2080 msgid "" -"One use case for this is for mocking objects used as context managers in a :" -"keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in " +"a :keyword:`with` statement:" msgstr "" "ユースケースの1つは :keyword:`with` 文の中でコンテキストマネージャーとして使" "われるオブジェクトを mock することです。" @@ -2417,14 +2764,14 @@ msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"magic method の呼び出しは :attr:`~Mock.method_calls` に含まれませんが、 :" -"attr:`~Mock.mock_calls` には記録されます。" +"magic method の呼び出しは :attr:`~Mock.method_calls` に含まれません" +"が、 :attr:`~Mock.mock_calls` には記録されます。" #: ../../library/unittest.mock.rst:2097 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise an :exc:" -"`AttributeError`." +"set a magic method that isn't in the spec will raise " +"an :exc:`AttributeError`." msgstr "" "mock を生成するのに *spec* キーワード引数を使った場合、 spec に含まれない " "magic method を設定しようとすると :exc:`AttributeError` が発生します。" @@ -2462,23 +2809,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 +2850,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 "" @@ -2541,18 +2889,20 @@ msgstr "Magic Mock" #: ../../library/unittest.mock.rst:2142 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" -"`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` " +"and :class:`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 系のクラスは2種類あります: :class:`MagicMock` と :class:" -"`NonCallableMagicMock` です。" +"``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 +2955,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 +3023,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::" +"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 +3044,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 +3069,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 +3114,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 +3162,12 @@ msgstr "" "必ず同じオブジェクトが返されます。返されるオブジェクトは、テスト失敗のメッ" "セージがわかりやすくなるように気が利いた repr を持ちます。" -#: ../../library/unittest.mock.rst:2285 msgid "" -"The ``sentinel`` attributes now preserve their identity when they are :mod:" -"`copied ` or :mod:`pickled `." +"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 "" @@ -2828,8 +3183,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2294 msgid "" -"In this example we monkey patch ``method`` to return ``sentinel." -"some_object``:" +"In this example we monkey patch ``method`` to return " +"``sentinel.some_object``:" msgstr "" "次の例では、 ``method`` が ``sentinel.some_object`` を返すようにモンキーパッ" "チしています:" @@ -2840,13 +3195,13 @@ msgstr "DEFAULT" #: ../../library/unittest.mock.rst:2311 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." -"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " -"indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually " +"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " +"to indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` オブジェクトは事前に生成された sentinel (実際には ``sentinel." -"DEFAULT``) オブジェクトです。 :attr:`~Mock.side_effect` 関数が、通常の戻り値" -"を使うことを示すために使います。" +":data:`DEFAULT` オブジェクトは事前に生成された sentinel (実際には " +"``sentinel.DEFAULT``) オブジェクトです。 :attr:`~Mock.side_effect` 関数が、通" +"常の戻り値を使うことを示すために使います。" #: ../../library/unittest.mock.rst:2317 msgid "call" @@ -2855,14 +3210,15 @@ msgstr "call" #: ../../library/unittest.mock.rst:2321 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." -"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " +"and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -":func:`call` は :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:" -"`~Mock.mock_calls`, :attr:`~Mock.method_calls` と比較してより簡単に assert で" -"きるようにするためのヘルパーオブジェクトです。 :func:`call` は :meth:`~Mock." -"assert_has_calls` と組み合わせて使うこともできます。" +":func:`call` " +"は :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls`, :attr:`~Mock.method_calls` " +"と比較してより簡単に assert できるようにするためのヘルパーオブジェクトで" +"す。 :func:`call` は :meth:`~Mock.assert_has_calls` と組み合わせて使うことも" +"できます。" #: ../../library/unittest.mock.rst:2334 msgid "" @@ -2897,23 +3253,25 @@ msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." -"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " -"to get at the individual arguments they contain." +"the ``call`` objects that are in " +"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " +"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " +"individual arguments they contain." msgstr "" "``call`` オブジェクトは、どう構築されたかによって、 (位置引数、キーワード引" "数) のタプルか、 (名前、位置引数、キーワード引数) のタプルになります。自分で " -"call オブジェクトを構築するときはこれを意識する必要はありませんが、 :attr:" -"`Mock.call_args`, :attr:`Mock.call_args_list`, :attr:`Mock.mock_calls` 属性の" -"中の ``call`` オブジェクトを解析して個々の引数を解析することができます。" +"call オブジェクトを構築するときはこれを意識する必要はありません" +"が、 :attr:`Mock.call_args`, :attr:`Mock.call_args_list`, :attr:`Mock.mock_calls` " +"属性の中の ``call`` オブジェクトを解析して個々の引数を解析することができま" +"す。" #: ../../library/unittest.mock.rst:2367 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." -"call_args_list` are two-tuples of (positional args, keyword args) whereas " -"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " -"construct yourself, are three-tuples of (name, positional args, keyword " -"args)." +"The ``call`` objects in :attr:`Mock.call_args` " +"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " +"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " +"ones you construct yourself, are three-tuples of (name, positional args, " +"keyword args)." msgstr "" ":attr:`Mock.call_args` と :attr:`Mock.call_args_list` の中の ``call`` オブ" "ジェクトは (位置引数, キーワード引数) のタプルで、 :attr:`Mock.mock_calls` の" @@ -2981,8 +3339,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2427 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" -"`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing " +"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" ":func:`create_autospec` や、 :func:`patch` の *autospec* 引数で autospec を使" "うサンプルは :ref:`auto-speccing` を参照してください。" @@ -3011,28 +3369,29 @@ msgstr "" #: ../../library/unittest.mock.rst:2447 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with` will then succeed no matter what was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` " +"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " +"was passed in." msgstr "" "特定の引数を無視するために、 *すべて* と等しくなるオブジェクトを使うことがで" -"きます。そうすると、 :meth:`~Mock.assert_called_with` と :meth:`~Mock." -"assert_called_once_with` は、実際の引数が何であったかに関わらず成功します。" +"きます。そうすると、 :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`:" +":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 +3399,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" @@ -3050,8 +3414,8 @@ msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set ``mock." -"FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set " +"``mock.FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` は mock オブジェクトが :func:`dir` に何を返すかを制御する" "ためのモジュールレベル変数です。デフォルトは ``True`` で、以下に示すフィルタ" @@ -3072,7 +3436,6 @@ msgstr "" "て(もちろん *autospec* でも)生成された場合、元のオブジェクトのすべての属性" "が、まだアクセスされていなかったとしても、表示されます。" -#: ../../library/unittest.mock.rst:2493 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3092,6 +3455,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 +3487,6 @@ msgstr "" "の動作が嫌な場合は、モジュールレベルの :data:`FILTER_DIR` スイッチを設定する" "ことでフィルターを切ることができます。" -#: ../../library/unittest.mock.rst:2520 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3121,13 +3500,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,36 +3544,52 @@ 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 " -"handle to return. Calls to those methods will take data from *read_data* " -"until it is depleted. The mock of these methods is pretty simplistic: every " -"time the *mock* is called, the *read_data* is rewound to the start. If you " -"need more control over the data that you are feeding to the tested code you " -"will need to customize this mock for yourself. When that is insufficient, " -"one of the in-memory filesystem packages on `PyPI `_ can " -"offer a realistic filesystem for testing." -msgstr "" +"*read_data* is a string for " +"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " +"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " +"Calls to those methods will take data from *read_data* until it is " +"depleted. The mock of these methods is pretty simplistic: every time the " +"*mock* is called, the *read_data* is rewound to the start. If you need more " +"control over the data that you are feeding to the tested code you will need " +"to customize this mock for yourself. When that is insufficient, 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 +3599,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)." +"*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 +3624,6 @@ msgstr "" "コンテキストマネージャーを :class:`MagicMock` でモックするのは一般的かつ面倒" "なので、ヘルパー関数を用意しています。::" -#: ../../library/unittest.mock.rst:2587 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3228,12 +3639,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,20 +3665,31 @@ 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 " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise a :exc:" -"`TypeError` if they are called incorrectly." +"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 +3697,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 +3704,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 "" @@ -3313,8 +3755,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2661 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" -"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` " +"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3335,7 +3777,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 +3786,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::" +"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 +3820,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 +3850,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 "" @@ -3406,13 +3869,12 @@ msgstr "" #: ../../library/unittest.mock.rst:2712 msgid "" -"As well as using *autospec* through :func:`patch` there is a :func:" -"`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is " +"a :func:`create_autospec` for creating autospecced mocks directly:" 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 +3885,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 +3919,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 +3938,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 +3966,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 +3973,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 +4021,6 @@ msgstr "" "替オブジェクトを利用することが必要です。 :func:`patch` はこれをサポートしてい" "て、 *autospec* 引数に代替オブジェクトを渡すことができます::" -#: ../../library/unittest.mock.rst:2804 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3551,6 +4034,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 +4057,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,84 +4087,99 @@ 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 " -"altogether. If any two are set, the one with the higher precedence will " -"return the value. Regardless of the order of which was set first, the order " -"of precedence remains unchanged." +"If all three are set, mock will return the value " +"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " +"wrapped object altogether. If any two are set, the one with the higher " +"precedence will 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`." +"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`." +"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..5d2b0564b 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 @@ -96,20 +96,20 @@ msgid "" "base class, :class:`TestCase`, which may be used to create new test cases." msgstr "" "テストケース (:dfn:`test case`) はテストの独立した単位で、各入力に対する結果" -"をチェックします。テストケースを作成する場合は、 :mod:`unittest` が提供する :" -"class:`TestCase` クラスを基底クラスとして利用することができます。" +"をチェックします。テストケースを作成する場合は、 :mod:`unittest` が提供す" +"る :class:`TestCase` クラスを基底クラスとして利用することができます。" #: ../../library/unittest.rst:39 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" @@ -138,11 +138,11 @@ msgstr "" #: ../../library/unittest.rst:54 msgid "" -"`Simple Smalltalk Testing: With Patterns `_" +"`Simple Smalltalk Testing: With Patterns `_" msgstr "" -"`Simple Smalltalk Testing: With Patterns `_" +"`Simple Smalltalk Testing: With Patterns `_" #: ../../library/unittest.rst:55 msgid "" @@ -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,22 +280,25 @@ msgid "" "``test``. This naming convention informs the test runner about which " "methods represent tests." msgstr "" +"テストケースは、 :class:`unittest.TestCase` のサブクラスとして作成します。メ" +"ソッド名が ``test`` で始まる三つのメソッドがテストです。テストランナーはこの" +"命名規約によってテストを行うメソッドを検索します。" #: ../../library/unittest.rst:117 msgid "" "The crux of each test is a call to :meth:`~TestCase.assertEqual` to check " -"for an expected result; :meth:`~TestCase.assertTrue` or :meth:`~TestCase." -"assertFalse` to verify a condition; or :meth:`~TestCase.assertRaises` to " -"verify that a specific exception gets raised. These methods are used " -"instead of the :keyword:`assert` statement so the test runner can accumulate " -"all test results and produce a report." -msgstr "" -"これらのテスト内では、予定の結果が得られていることを確かめるために :meth:" -"`~TestCase.assertEqual` を、条件のチェックに :meth:`~TestCase.assertTrue` " -"や :meth:`~TestCase.assertFalse` を、例外が発生する事を確認するために :meth:" -"`~TestCase.assertRaises` をそれぞれ呼び出しています。 :keyword:`assert` 文の" -"代わりにこれらのメソッドを使用すると、テストランナーでテスト結果を集計してレ" -"ポートを作成する事ができます。" +"for an expected result; :meth:`~TestCase.assertTrue` " +"or :meth:`~TestCase.assertFalse` to verify a condition; " +"or :meth:`~TestCase.assertRaises` to verify that a specific exception gets " +"raised. These methods are used instead of the :keyword:`assert` statement " +"so the test runner can accumulate all test results and produce a report." +msgstr "" +"これらのテスト内では、予定の結果が得られていることを確かめるため" +"に :meth:`~TestCase.assertEqual` を、条件のチェック" +"に :meth:`~TestCase.assertTrue` や :meth:`~TestCase.assertFalse` を、例外が発" +"生する事を確認するために :meth:`~TestCase.assertRaises` をそれぞれ呼び出して" +"います。 :keyword:`assert` 文の代わりにこれらのメソッドを使用すると、テストラ" +"ンナーでテスト結果を集計してレポートを作成する事ができます。" #: ../../library/unittest.rst:124 msgid "" @@ -307,17 +329,21 @@ msgid "" "\n" "OK" msgstr "" +"...\n" +"----------------------------------------------------------------------\n" +"Ran 3 tests in 0.000s\n" +"\n" +"OK" #: ../../library/unittest.rst:138 msgid "" -"Passing the ``-v`` option to your test script will instruct :func:`unittest." -"main` to enable a higher level of verbosity, and produce the following " -"output::" +"Passing the ``-v`` option to your test script will " +"instruct :func:`unittest.main` to enable a higher level of verbosity, and " +"produce the following output::" 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 "" @@ -505,20 +542,21 @@ msgstr "" #: ../../library/unittest.rst:242 msgid "" "For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``, " -"``bar_tests.SomeTest.test_foo``, but not ``bar_tests.FooTest." -"test_something``." +"``bar_tests.SomeTest.test_foo``, but not " +"``bar_tests.FooTest.test_something``." msgstr "" -"たとえば、 ``-k foo`` は ``foo_tests.SomeTest.test_something``, ``bar_tests." -"SomeTest.test_foo`` にマッチし、 ``bar_tests.FooTest.test_something`` はマッ" -"チしません。" +"たとえば、 ``-k foo`` は ``foo_tests.SomeTest.test_something``, " +"``bar_tests.SomeTest.test_foo`` にマッチし、 " +"``bar_tests.FooTest.test_something`` はマッチしません。" #: ../../library/unittest.rst:247 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,20 +586,18 @@ 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 :" -"ref:`packages ` importable from the top-level directory of the " -"project (this means that their filenames must be valid :ref:`identifiers " +"discovery, all of the test files must be :ref:`modules ` " +"or :ref:`packages ` importable from the top-level directory of " +"the 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." +"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" @@ -711,10 +759,10 @@ msgstr "テストコードの構成" #: ../../library/unittest.rst:367 msgid "" "The basic building blocks of unit testing are :dfn:`test cases` --- single " -"scenarios that must be set up and checked for correctness. In :mod:" -"`unittest`, test cases are represented by :class:`unittest.TestCase` " -"instances. To make your own test cases you must write subclasses of :class:" -"`TestCase` or use :class:`FunctionTestCase`." +"scenarios that must be set up and checked for correctness. " +"In :mod:`unittest`, test cases are represented by :class:`unittest.TestCase` " +"instances. To make your own test cases you must write subclasses " +"of :class:`TestCase` or use :class:`FunctionTestCase`." msgstr "" "ユニットテストの基本的な構成要素は、 :dfn:`テストケース` --- 設定され正しさの" "ためにチェックされるべき単独のシナリオ --- です。\n" @@ -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,21 +815,25 @@ 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 "" "Tests can be numerous, and their set-up can be repetitive. Luckily, we can " -"factor out set-up code by implementing a method called :meth:`~TestCase." -"setUp`, which the testing framework will automatically call for every single " -"test we run::" +"factor out set-up code by implementing a method " +"called :meth:`~TestCase.setUp`, which the testing framework will " +"automatically call for every single test we run::" msgstr "" "テストは多くなり、それらの設定は繰り返しになるかもしれません。\n" "幸いにも、:meth:`~TestCase.setUp` メソッドを実装することで設定コードをくくり" "出すことができます。\n" -"テストフレームワークは実行するテストごとに自動的に :meth:`~TestCase.setUp` を" -"呼びます::" +"テストフレームワークは実行するテストごとに自動的に ``setUp()`` を呼びます::" -#: ../../library/unittest.rst:399 msgid "" "import unittest\n" "\n" @@ -793,6 +850,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 +890,6 @@ msgstr "" "同様に、テストメソッド実行後に片付けをする :meth:`~TestCase.tearDown` メソッ" "ドを提供出来ます::" -#: ../../library/unittest.rst:426 msgid "" "import unittest\n" "\n" @@ -830,6 +900,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 "" @@ -843,25 +921,26 @@ msgstr "" msgid "" "Such a working environment for the testing code is called a :dfn:`test " "fixture`. A new TestCase instance is created as a unique test fixture used " -"to execute each individual test method. Thus :meth:`~TestCase.setUp`, :meth:" -"`~TestCase.tearDown`, and :meth:`~TestCase.__init__` will be called once per " -"test." +"to execute each individual test method. " +"Thus :meth:`~TestCase.setUp`, :meth:`~TestCase.tearDown`, " +"and :meth:`~TestCase.__init__` will be called once per test." msgstr "" "そのようなテストコードのための作業環境は :dfn:`テストフィクスチャ (test " "fixture)` と呼ばれます。\n" "新しい TestCase インスタンスはある単一のテストフィクスチャとして作成され、" "個々のテストメソッドを実行するのに使われます。\n" -"従って、 :meth:`~TestCase.setUp`, :meth:`~TestCase.tearDown`, :meth:" -"`~TestCase.__init__` は1回のテストにつき1回だけ呼び出されます。" +"従っ" +"て、 :meth:`~TestCase.setUp`, :meth:`~TestCase.tearDown`, :meth:`~TestCase.__init__` " +"は1回のテストにつき1回だけ呼び出されます。" #: ../../library/unittest.rst:444 msgid "" "It is recommended that you use TestCase implementations to group tests " "together according to the features they test. :mod:`unittest` provides a " -"mechanism for this: the :dfn:`test suite`, represented by :mod:`unittest`'s :" -"class:`TestSuite` class. In most cases, calling :func:`unittest.main` will " -"do the right thing and collect all the module's test cases for you and " -"execute them." +"mechanism for this: the :dfn:`test suite`, represented " +"by :mod:`unittest`'s :class:`TestSuite` class. In most cases, " +"calling :func:`unittest.main` will do the right thing and collect all the " +"module's test cases for you and execute them." msgstr "" "テストケースの実装では、テストする機能に従ってテストをまとめるのをお勧めしま" "す。\n" @@ -878,7 +957,6 @@ msgstr "" "しかし、テストスイートの構築をカスタマイズしたい場合、自分ですることができま" "す::" -#: ../../library/unittest.rst:454 msgid "" "def suite():\n" " suite = unittest.TestSuite()\n" @@ -890,6 +968,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 "" @@ -899,9 +986,9 @@ msgid "" "as :file:`test_widget.py`:" msgstr "" "テストケースやテストコードの定義を (:file:`widget.py` のような) テスト対象" -"コードと同じモジュールに置くことが出来ますが、テストコードを (:file:" -"`test_widget.py` のような) 独立したモジュールに置くのには以下のような利点があ" -"ります:" +"コードと同じモジュールに置くことが出来ますが、テストコードを " +"(:file:`test_widget.py` のような) 独立したモジュールに置くのには以下のような" +"利点があります:" #: ../../library/unittest.rst:469 msgid "The test module can be run standalone from the command line." @@ -924,9 +1011,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 +1055,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 +1074,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 "" @@ -1000,21 +1091,22 @@ msgid "" "subclasses will make future test refactorings infinitely easier." msgstr "" ":class:`FunctionTestCase` を使って既存のテストを :mod:`unittest` ベースのテス" -"ト体系に変換することができますが、この方法は推奨されません。時間を掛けて :" -"class:`TestCase` のサブクラスに書き直した方が将来的なテストのリファクタリング" -"が限りなく易しくなります。" +"ト体系に変換することができますが、この方法は推奨されません。時間を掛け" +"て :class:`TestCase` のサブクラスに書き直した方が将来的なテストのリファクタリ" +"ングが限りなく易しくなります。" #: ../../library/unittest.rst:520 msgid "" -"In some cases, the existing tests may have been written using the :mod:" -"`doctest` module. If so, :mod:`doctest` provides a :class:`DocTestSuite` " -"class that can automatically build :class:`unittest.TestSuite` instances " -"from the existing :mod:`doctest`\\ -based tests." +"In some cases, the existing tests may have been written using " +"the :mod:`doctest` module. If so, :mod:`doctest` provides " +"a :class:`DocTestSuite` class that can automatically " +"build :class:`unittest.TestSuite` instances from the " +"existing :mod:`doctest`\\ -based tests." msgstr "" "既存のテストが :mod:`doctest` を使って書かれている場合もあるでしょう。その場" "合、 :mod:`doctest` は :class:`DocTestSuite` クラスを提供します。このクラス" -"は、既存の :mod:`doctest`\\ ベースのテストから、自動的に :class:`unittest." -"TestSuite` のインスタンスを作成します。" +"は、既存の :mod:`doctest`\\ ベースのテストから、自動的" +"に :class:`unittest.TestSuite` のインスタンスを作成します。" #: ../../library/unittest.rst:529 msgid "Skipping tests and expected failures" @@ -1034,10 +1126,10 @@ msgstr "" #: ../../library/unittest.rst:538 msgid "" -"Skipping a test is simply a matter of using the :func:`skip` :term:" -"`decorator` or one of its conditional variants, calling :meth:`TestCase." -"skipTest` within a :meth:`~TestCase.setUp` or test method, or raising :exc:" -"`SkipTest` directly." +"Skipping a test is simply a matter of using " +"the :func:`skip` :term:`decorator` or one of its conditional variants, " +"calling :meth:`TestCase.skipTest` within a :meth:`~TestCase.setUp` or test " +"method, or raising :exc:`SkipTest` directly." msgstr "" "テストをスキップするには、 :func:`skip` :term:`デコレータ ` かその" "条件付きバージョンの一つを使うか、:meth:`~TestCase.setUp` やテストメソッドの" @@ -1048,7 +1140,6 @@ msgstr "" msgid "Basic skipping looks like this::" msgstr "基本的なスキップは以下のようになります::" -#: ../../library/unittest.rst:544 msgid "" "class MyTestCase(unittest.TestCase):\n" "\n" @@ -1074,6 +1165,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 +1210,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 +1237,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 +1258,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 +1292,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 +1315,19 @@ 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." +"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 +1347,6 @@ msgstr "" msgid "For example, the following test::" msgstr "例えば以下のテストは::" -#: ../../library/unittest.rst:652 msgid "" "class NumbersTest(unittest.TestCase):\n" "\n" @@ -1238,12 +1358,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 +1403,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 +1442,6 @@ msgstr "" "サブテスト無しの場合、最初の失敗で実行は停止し、``i`` の値が表示されないため" "エラーの原因を突き止めるのは困難になります::" -#: ../../library/unittest.rst:698 msgid "" "======================================================================\n" "FAIL: test_even (__main__.NumbersTest.test_even)\n" @@ -1295,6 +1451,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 +1507,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" @@ -1365,9 +1527,9 @@ msgstr "はじめのグループ (テスト実行) に含まれるメソッド #: ../../library/unittest.rst:748 msgid "" "Method called to prepare the test fixture. This is called immediately " -"before calling the test method; other than :exc:`AssertionError` or :exc:" -"`SkipTest`, any exception raised by this method will be considered an error " -"rather than a test failure. The default implementation does nothing." +"before calling the test method; other than :exc:`AssertionError` " +"or :exc:`SkipTest`, any exception raised by this method will be considered " +"an error rather than a test failure. The default implementation does nothing." msgstr "" "テストフィクスチャの準備のために呼び出されるメソッドです。テストメソッドの直" "前に呼び出されます。このメソッドで :exc:`AssertionError` や :exc:`SkipTest` " @@ -1379,8 +1541,8 @@ msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called even if the test method raised an " "exception, so the implementation in subclasses may need to be particularly " -"careful about checking internal state. Any exception, other than :exc:" -"`AssertionError` or :exc:`SkipTest`, raised by this method will be " +"careful about checking internal state. Any exception, other " +"than :exc:`AssertionError` or :exc:`SkipTest`, raised by this method will be " "considered an additional error rather than a test failure (thus increasing " "the total number of reported errors). This method will only be called if " "the :meth:`setUp` succeeds, regardless of the outcome of the test method. " @@ -1407,12 +1569,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 +1592,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 "" @@ -1443,8 +1609,8 @@ msgid "" "used. The result object is returned to :meth:`run`'s caller." msgstr "" "テストを実行し、テスト結果を *result* に指定された :class:`TestResult` オブ" -"ジェクトにまとめます。 *result* が省略されるか ``None`` が渡された場合、 (:" -"meth:`defaultTestResult` メソッドを呼んで) 一時的な結果オブジェクトを生成" +"ジェクトにまとめます。 *result* が省略されるか ``None`` が渡された場合、 " +"(:meth:`defaultTestResult` メソッドを呼んで) 一時的な結果オブジェクトを生成" "し、使用します。 結果オブジェクトは :meth:`run` の呼び出し元に返されます。" #: ../../library/unittest.rst:805 @@ -1459,27 +1625,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 +1809,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,25 +1824,25 @@ 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 "" "All the assert methods accept a *msg* argument that, if specified, is used " "as the error message on failure (see also :data:`longMessage`). Note that " -"the *msg* keyword argument can be passed to :meth:`assertRaises`, :meth:" -"`assertRaisesRegex`, :meth:`assertWarns`, :meth:`assertWarnsRegex` only when " -"they are used as a context manager." +"the *msg* keyword argument can be passed " +"to :meth:`assertRaises`, :meth:`assertRaisesRegex`, :meth:`assertWarns`, :meth:`assertWarnsRegex` " +"only when they are used as a context manager." msgstr "" "全てのアサートメソッドは *msg* 引数を受け取り、指定された場合、失敗時のエラー" "メッセージとして使われます。 (:data:`longMessage` も参照してください)。 " -"*msg* キーワード引数は :meth:`assertRaises` 、 :meth:`assertRaisesRegex` 、 :" -"meth:`assertWarns` 、 :meth:`assertWarnsRegex` には、そのメソッドをコンテキス" -"トマネージャとして使った場合にのみ使えます。" +"*msg* キーワード引数" +"は :meth:`assertRaises` 、 :meth:`assertRaisesRegex` 、 :meth:`assertWarns` 、 :meth:`assertWarnsRegex` " +"には、そのメソッドをコンテキストマネージャとして使った場合にのみ使えます。" #: ../../library/unittest.rst:901 msgid "" @@ -1687,7 +1852,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 +1860,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." @@ -1766,15 +1931,20 @@ msgid "" msgstr "" "*obj* が *cls* のインスタンスであること (あるいはそうでないこと) をテストしま" "す (この *cls* は、 :func:`isinstance` が扱うことのできる、クラスもしくはクラ" -"スのタプルである必要があります)。正確な型をチェックするためには、 :func:" -"`assertIs(type(obj), cls) ` を使用してください。" +"スのタプルである必要があります)。正確な型をチェックするために" +"は、 :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 "" @@ -1794,11 +1964,11 @@ msgstr "``fun(*args, **kwds)`` が *exc* を送出する" #: ../../library/unittest.rst:989 msgid "" -":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" +":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) " +"`" msgstr "" -":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" +":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) " +"`" #: ../../library/unittest.rst:989 msgid "``fun(*args, **kwds)`` raises *exc* and the message matches regex *r*" @@ -1816,11 +1986,11 @@ msgstr "``fun(*args, **kwds)`` が *warn* を送出する" #: ../../library/unittest.rst:995 msgid "" -":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) `" +":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) " +"`" msgstr "" -":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) `" +":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) " +"`" #: ../../library/unittest.rst:995 msgid "``fun(*args, **kwds)`` raises *warn* and the message matches regex *r*" @@ -1832,9 +2002,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 +2013,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" @@ -1859,17 +2026,18 @@ msgstr "3.10" #: ../../library/unittest.rst:1008 msgid "" "Test that an exception is raised when *callable* is called with any " -"positional or keyword arguments that are also passed to :meth:" -"`assertRaises`. The test passes if *exception* is raised, is an error if " -"another exception is raised, or fails if no exception is raised. To catch " -"any of a group of exceptions, a tuple containing the exception classes may " -"be passed as *exception*." -msgstr "" -"*callable* を呼び出した時に例外が発生することをテストします。 :meth:" -"`assertRaises` で指定した位置パラメータとキーワードパラメータを該当メソッドに" -"渡します。 *exception* が送出された場合、テストは成功です。また、他の例外が投" -"げられた場合はエラー、例外が送出されなかった場合は失敗になります。複数の例外" -"をキャッチする場合には、例外クラスのタプルを *exception* に指定してください。" +"positional or keyword arguments that are also passed " +"to :meth:`assertRaises`. The test passes if *exception* is raised, is an " +"error if another exception is raised, or fails if no exception is raised. To " +"catch any of a group of exceptions, a tuple containing the exception classes " +"may be passed as *exception*." +msgstr "" +"*callable* を呼び出した時に例外が発生することをテストしま" +"す。 :meth:`assertRaises` で指定した位置パラメータとキーワードパラメータを該" +"当メソッドに渡します。 *exception* が送出された場合、テストは成功です。また、" +"他の例外が投げられた場合はエラー、例外が送出されなかった場合は失敗になりま" +"す。複数の例外をキャッチする場合には、例外クラスのタプルを *exception* に指定" +"してください。" #: ../../library/unittest.rst:1015 msgid "" @@ -1881,11 +2049,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 "" @@ -1897,14 +2066,13 @@ msgstr "" #: ../../library/unittest.rst:1025 msgid "" -"The context manager will store the caught exception object in its :attr:" -"`exception` attribute. This can be useful if the intention is to perform " -"additional checks on the exception raised::" +"The context manager will store the caught exception object in " +"its :attr:`exception` attribute. This can be useful if the intention is to " +"perform additional checks on the exception raised::" msgstr "" "このコンテキストマネージャは :attr:`exception` で指定されたオブジェクトを格納" "します。これにより、例外発生時の詳細な確認をおこなうことができます::" -#: ../../library/unittest.rst:1029 msgid "" "with self.assertRaises(SomeException) as cm:\n" " do_something()\n" @@ -1912,6 +2080,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." @@ -1933,29 +2106,31 @@ msgstr "" msgid "" "Like :meth:`assertRaises` but also tests that *regex* matches on the string " "representation of the raised exception. *regex* may be a regular expression " -"object or a string containing a regular expression suitable for use by :func:" -"`re.search`. Examples::" +"object or a string containing a regular expression suitable for use " +"by :func:`re.search`. Examples::" msgstr "" ":meth:`assertRaises` と同等ですが、例外の文字列表現が *regex* にマッチするこ" "ともテストします。 *regex* は正規表現オブジェクトか、 :func:`re.search` が扱" "える正規表現が書かれた文字列である必要があります。例えば以下のようになりま" "す::" -#: ../../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``." @@ -1968,16 +2143,16 @@ msgstr ":meth:`assertRaisesRegex` にリネームされました。" #: ../../library/unittest.rst:1074 msgid "" "Test that a warning is triggered when *callable* is called with any " -"positional or keyword arguments that are also passed to :meth:" -"`assertWarns`. The test passes if *warning* is triggered and fails if it " -"isn't. Any exception is an error. To catch any of a group of warnings, a " -"tuple containing the warning classes may be passed as *warnings*." +"positional or keyword arguments that are also passed " +"to :meth:`assertWarns`. The test passes if *warning* is triggered and fails " +"if it isn't. Any exception is an error. To catch any of a group of " +"warnings, a tuple containing the warning classes may be passed as *warnings*." msgstr "" -"*callable* を呼び出した時に警告が発生することをテストします。 :meth:" -"`assertWarns` で指定した位置パラメータとキーワードパラメータを該当メソッドに" -"渡します。 *warning* が発生した場合にテストが成功し、そうでなければ失敗になり" -"ます。例外が送出された場合はエラーになります。複数の警告を捕捉する場合には、" -"警告クラスのタプルを *warnings* に指定してください。" +"*callable* を呼び出した時に警告が発生することをテストしま" +"す。 :meth:`assertWarns` で指定した位置パラメータとキーワードパラメータを該当" +"メソッドに渡します。 *warning* が発生した場合にテストが成功し、そうでなければ" +"失敗になります。例外が送出された場合はエラーになります。複数の警告を捕捉する" +"場合には、警告クラスのタプルを *warnings* に指定してください。" #: ../../library/unittest.rst:1081 msgid "" @@ -1989,11 +2164,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 "" @@ -2005,17 +2181,17 @@ msgstr "" #: ../../library/unittest.rst:1091 msgid "" -"The context manager will store the caught warning object in its :attr:" -"`warning` attribute, and the source line which triggered the warnings in " -"the :attr:`filename` and :attr:`lineno` attributes. This can be useful if " -"the intention is to perform additional checks on the warning caught::" +"The context manager will store the caught warning object in " +"its :attr:`warning` attribute, and the source line which triggered the " +"warnings in the :attr:`filename` and :attr:`lineno` attributes. This can be " +"useful if the intention is to perform additional checks on the warning " +"caught::" msgstr "" "このコンテキストマネージャは、捕捉した警告オブジェクトを :attr:`warning` 属性" "に、警告が発生したソース行を :attr:`filename` 属性と :attr:`lineno` 属性に格" "納します。これは警告発生時に捕捉された警告に対して追加の確認を行いたい場合に" "便利です::" -#: ../../library/unittest.rst:1097 msgid "" "with self.assertWarns(SomeWarning) as cm:\n" " do_something()\n" @@ -2023,6 +2199,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 "" @@ -2034,25 +2215,28 @@ msgstr "このメソッドは呼び出されたときに警告フィルタを無 msgid "" "Like :meth:`assertWarns` but also tests that *regex* matches on the message " "of the triggered warning. *regex* may be a regular expression object or a " -"string containing a regular expression suitable for use by :func:`re." -"search`. Example::" +"string containing a regular expression suitable for use " +"by :func:`re.search`. Example::" msgstr "" ":meth:`assertWarns` と同等ですが、警告メッセージが *regex* にマッチすることも" "テストします。 *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 +2246,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 " +"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 +2263,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 +2303,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,18 +2310,24 @@ 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 "" -"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." +"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." msgstr "" "*logger* が与えられた場合、 :class:`logging.Logger` オブジェクトもしくはロ" "ガーの名前である :class:`str` であるべきです。\n" @@ -2225,72 +2420,71 @@ 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 "" "Test that *first* and *second* are approximately (or not approximately) " "equal by computing the difference, rounding to the given number of decimal " "*places* (default 7), and comparing to zero. Note that these methods round " -"the values to the given number of *decimal places* (i.e. like the :func:" -"`round` function) and not *significant digits*." +"the values to the given number of *decimal places* (i.e. like " +"the :func:`round` function) and not *significant digits*." msgstr "" "*first* と *second* が近似的に等しい (等しくない) ことをテストします。これ" "は、*places* (デフォルト7) で指定した小数位で丸めた差分をゼロと比較することで" "行われます。これらのメソッドは (: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`." @@ -2343,8 +2537,8 @@ msgstr "``assertRegexpMatches`` という名前で追加されました。" #: ../../library/unittest.rst:1293 msgid "" -"The method ``assertRegexpMatches()`` has been renamed to :meth:`." -"assertRegex`." +"The method ``assertRegexpMatches()`` has been renamed " +"to :meth:`.assertRegex`." msgstr "" "メソッド ``assertRegexpMatches()`` は :meth:`.assertRegex` にリネームされまし" "た。" @@ -2353,43 +2547,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 "" @@ -2400,33 +2599,34 @@ msgid "" msgstr "" ":meth:`assertEqual` メソッドは、同じ型のオブジェクトの等価性確認のために、型" "ごとに特有のメソッドにディスパッチします。これらのメソッドは、ほとんどの組み" -"込み型用のメソッドは既に実装されています。さらに、 :meth:" -"`addTypeEqualityFunc` を使う事で新たなメソッドを登録することができます:" +"込み型用のメソッドは既に実装されています。さら" +"に、 :meth:`addTypeEqualityFunc` を使う事で新たなメソッドを登録することができ" +"ます:" #: ../../library/unittest.rst:1352 msgid "" "Registers a type-specific method called by :meth:`assertEqual` to check if " "two objects of exactly the same *typeobj* (not subclasses) compare equal. " "*function* must take two positional arguments and a third msg=None keyword " -"argument just as :meth:`assertEqual` does. It must raise :data:`self." -"failureException(msg) ` when inequality between the first " -"two parameters is detected -- possibly providing useful information and " -"explaining the inequalities in details in the error message." +"argument just as :meth:`assertEqual` does. It must " +"raise :data:`self.failureException(msg) ` when inequality " +"between the first two parameters is detected -- possibly providing useful " +"information and explaining the inequalities in details in the error message." msgstr "" ":meth:`assertEqual` で呼び出される型特有のメソッドを登録します。登録するメ" "ソッドは、比較する2つのオブジェクトの型が厳密に *typeobj* と同じ (サブクラス" -"でもいけません) の場合に等価性を確認します。 *function* は :meth:" -"`assertEqual` と同様に、2つの位置引数と、3番目に msg=None のキーワード引数を" -"取れる必要があります。このメソッドは、始めの2つに指定したパラメータ間の差分を" -"検出した時に :data:`self.failureException(msg) ` の例外を投" -"げる必要があります。この例外を投げる際は、出来る限り、エラーの内容が分かる有" -"用な情報と差分の詳細をエラーメッセージに含めてください。" +"でもいけません) の場合に等価性を確認します。 *function* " +"は :meth:`assertEqual` と同様に、2つの位置引数と、3番目に msg=None のキーワー" +"ド引数を取れる必要があります。このメソッドは、始めの2つに指定したパラメータ間" +"の差分を検出した時に :data:`self.failureException(msg) ` の" +"例外を投げる必要があります。この例外を投げる際は、出来る限り、エラーの内容が" +"分かる有用な情報と差分の詳細をエラーメッセージに含めてください。" #: ../../library/unittest.rst:1363 msgid "" -"The list of type-specific methods automatically used by :meth:`~TestCase." -"assertEqual` are summarized in the following table. Note that it's usually " -"not necessary to invoke these methods directly." +"The list of type-specific methods automatically used " +"by :meth:`~TestCase.assertEqual` are summarized in the following table. " +"Note that it's usually not necessary to invoke these methods directly." msgstr "" ":meth:`~TestCase.assertEqual` が自動的に呼び出す型特有のメソッドの概要を以下" "の表示に記載しています。これらのメソッドは通常は直接呼び出す必要がないことに" @@ -2513,20 +2713,21 @@ msgid "" "This method is not called directly by :meth:`assertEqual`, but it's used to " "implement :meth:`assertListEqual` and :meth:`assertTupleEqual`." msgstr "" -"このメソッドは直接 :meth:`assertEqual` からは呼ばれませんが、 :meth:" -"`assertListEqual` と :meth:`assertTupleEqual` の実装で使われています。" +"このメソッドは直接 :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 "" @@ -2540,8 +2741,8 @@ msgstr "" #: ../../library/unittest.rst:1433 msgid "" -"Fails if either of *first* or *second* does not have a :meth:`set." -"difference` method." +"Fails if either of *first* or *second* does not have " +"a :meth:`set.difference` method." msgstr "" "*first* or *second* のいずれかに :meth:`set.difference` が無い場合にはテスト" "は失敗します。" @@ -2574,12 +2775,12 @@ msgid "" "This class attribute gives the exception raised by the test method. If a " "test framework needs to use a specialized exception, possibly to carry " "additional information, it must subclass this exception in order to \"play " -"fair\" with the framework. The initial value of this attribute is :exc:" -"`AssertionError`." +"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 "" @@ -2615,8 +2816,8 @@ msgid "" "This attribute controls the maximum length of diffs output by assert methods " "that report diffs on failure. It defaults to 80*8 characters. Assert methods " "affected by this attribute are :meth:`assertSequenceEqual` (including all " -"the sequence comparison methods that delegate to it), :meth:" -"`assertDictEqual` and :meth:`assertMultiLineEqual`." +"the sequence comparison methods that delegate to " +"it), :meth:`assertDictEqual` and :meth:`assertMultiLineEqual`." msgstr "" "この属性は、アサーションメソッドが失敗をレポートする時に表示する差分の長さを" "コントロールします。デフォルトは 80*8 文字です。この属性が影響するメソッド" @@ -2638,8 +2839,8 @@ msgstr "" #: ../../library/unittest.rst:1508 msgid "" -"Return the number of tests represented by this test object. For :class:" -"`TestCase` instances, this will always be ``1``." +"Return the number of tests represented by this test object. " +"For :class:`TestCase` instances, this will always be ``1``." msgstr "" "テストオブジェクトに含まれるテストの数を返します。 :class:`TestCase` インスタ" "ンスは常に ``1`` を返します。" @@ -2650,26 +2851,25 @@ msgid "" "test case class (if no other result instance is provided to the :meth:`run` " "method)." msgstr "" -"このテストケースクラスで使われるテスト結果クラスのインスタンスを (もし :meth:" -"`run` メソッドに他の結果インスタンスが提供されないならば) 返します。" +"このテストケースクラスで使われるテスト結果クラスのインスタンスを (も" +"し :meth:`run` メソッドに他の結果インスタンスが提供されないならば) 返します。" #: ../../library/unittest.rst:1518 msgid "" -"For :class:`TestCase` instances, this will always be an instance of :class:" -"`TestResult`; subclasses of :class:`TestCase` should override this as " -"necessary." +"For :class:`TestCase` instances, this will always be an instance " +"of :class:`TestResult`; subclasses of :class:`TestCase` should override this " +"as necessary." msgstr "" ":class:`TestCase` インスタンスに対しては、いつも :class:`TestResult` のインス" "タンスですので、 :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 "" @@ -2684,8 +2884,8 @@ msgstr "" msgid "" "In 3.1 this was changed to add the test name to the short description even " "in the presence of a docstring. This caused compatibility issues with " -"unittest extensions and adding the test name was moved to the :class:" -"`TextTestResult` in Python 3.2." +"unittest extensions and adding the test name was moved to " +"the :class:`TextTestResult` in Python 3.2." msgstr "" "3.1で docstring があったとしても、返される短い説明文字列にテスト名が付けられ" "るようになりました。\n" @@ -2713,26 +2913,30 @@ 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." +"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 "" -"This method is called unconditionally after :meth:`tearDown`, or after :meth:" -"`setUp` if :meth:`setUp` raises an exception." +"This method is called unconditionally after :meth:`tearDown`, or " +"after :meth:`setUp` if :meth:`setUp` raises an exception." msgstr "" "このメソッドは、 :meth:`tearDown` の後、もしくは、 :meth:`setUp` が例外を投げ" "た場合は :meth:`setUp` の後に、無条件で呼ばれます。" #: ../../library/unittest.rst:1572 msgid "" -"It is responsible for calling all the cleanup functions added by :meth:" -"`addCleanup`. If you need cleanup functions to be called *prior* to :meth:" -"`tearDown` then you can call :meth:`doCleanups` yourself." +"It is responsible for calling all the cleanup functions added " +"by :meth:`addCleanup`. If you need cleanup functions to be called *prior* " +"to :meth:`tearDown` then you can call :meth:`doCleanups` yourself." msgstr "" "このメソッドは、 :meth:`addCleanup` で追加された関数を呼び出す責務を担いま" "す。もし、クリーンアップ関数を :meth:`tearDown` より前に呼び出す必要がある場" @@ -2756,9 +2960,9 @@ msgid "" msgstr "" ":meth:`tearDownClass` の後に呼び出される関数を追加します。この関数はリソース" "のクリーンアップのために使用します。追加された関数は、追加された順と逆の順番" -"で呼び出されます(:abbr:`LIFO (last-in, first-out)`)。 :meth:" -"`addClassCleanup` に渡された引数とキーワード引数が追加された関数にも渡されま" -"す。" +"で呼び出されます(:abbr:`LIFO (last-in, first-" +"out)`)。 :meth:`addClassCleanup` に渡された引数とキーワード引数が追加された" +"関数にも渡されます。" #: ../../library/unittest.rst:1591 msgid "" @@ -2768,27 +2972,31 @@ 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." +"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 "" -"This method is called unconditionally after :meth:`tearDownClass`, or after :" -"meth:`setUpClass` if :meth:`setUpClass` raises an exception." +"This method is called unconditionally after :meth:`tearDownClass`, or " +"after :meth:`setUpClass` if :meth:`setUpClass` raises an exception." msgstr "" "このメソッドは、 :meth:`tearDownClass` の後、もしくは、 :meth:`setUpClass` が" "例外を投げた場合は :meth:`setUpClass` の後に、無条件で呼ばれます。" #: ../../library/unittest.rst:1612 msgid "" -"It is responsible for calling all the cleanup functions added by :meth:" -"`addClassCleanup`. If you need cleanup functions to be called *prior* to :" -"meth:`tearDownClass` then you can call :meth:`doClassCleanups` yourself." +"It is responsible for calling all the cleanup functions added " +"by :meth:`addClassCleanup`. If you need cleanup functions to be called " +"*prior* to :meth:`tearDownClass` then you can call :meth:`doClassCleanups` " +"yourself." msgstr "" "このメソッドは、 :meth:`addClassCleanup` で追加された関数を呼び出す責務を担い" "ます。もし、クリーンアップ関数を :meth:`tearDownClass` より前に呼び出す必要が" @@ -2810,25 +3018,27 @@ 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 "" -"Method called to prepare the test fixture. This is called after :meth:" -"`setUp`. This is called immediately before calling the test method; other " -"than :exc:`AssertionError` or :exc:`SkipTest`, any exception raised by this " -"method will be considered an error rather than a test failure. The default " -"implementation does nothing." +"Method called to prepare the test fixture. This is called " +"after :meth:`setUp`. This is called immediately before calling the test " +"method; other than :exc:`AssertionError` or :exc:`SkipTest`, any exception " +"raised by this method will be considered an error rather than a test " +"failure. The default implementation does nothing." msgstr "" -"テストフィクスチャを用意するために呼び出されるメソッドです。これは :meth:" -"`setUp`. の後に呼び出されます。これはテストメソッドを呼び出す直前に呼び出され" -"ます。:exc:`AssertionError` と :exc:`SkipTest` を除いて、このメソッドのによっ" -"て送出されたあらゆる例外はテストの失敗ではなくエラーとみなされます。デフォル" -"トの実装では何もしません。" +"テストフィクスチャを用意するために呼び出されるメソッドです。これ" +"は :meth:`setUp`. の後に呼び出されます。これはテストメソッドを呼び出す直前に" +"呼び出されます。:exc:`AssertionError` と :exc:`SkipTest` を除いて、このメソッ" +"ドのによって送出されたあらゆる例外はテストの失敗ではなくエラーとみなされま" +"す。デフォルトの実装では何もしません。" #: ../../library/unittest.rst:1650 msgid "" @@ -2856,33 +3066,35 @@ 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." +"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 "" -"Sets up a new event loop to run the test, collecting the result into the :" -"class:`TestResult` object passed as *result*. If *result* is omitted or " -"``None``, a temporary result object is created (by calling the :meth:" -"`defaultTestResult` method) and used. The result object is returned to :meth:" -"`run`'s caller. At the end of the test all the tasks in the event loop are " -"cancelled." +"Sets up a new event loop to run the test, collecting the result into " +"the :class:`TestResult` object passed as *result*. If *result* is omitted " +"or ``None``, a temporary result object is created (by calling " +"the :meth:`defaultTestResult` method) and used. The result object is " +"returned to :meth:`run`'s caller. At the end of the test all the tasks in " +"the event loop are cancelled." msgstr "" "テストを実行するための新しいイベントループを作成し、 *result* として渡され" "た :class:`TestResult` オブジェクトに結果を収集します。*result* が省略された" -"場合や ``None`` の場合は、一時的なresultオブジェクトが(:meth:" -"`defaultTestResult` メソッドの呼び出しによって)作成され、使用されます。この" -"resultオブジェクトは :meth:`run` の呼び出し元に返されます。テスト終了時には、" -"イベントループ内のすべてのタスクがキャンセルされます。" +"場合や ``None`` の場合は、一時的なresultオブジェクトが" +"(:meth:`defaultTestResult` メソッドの呼び出しによって)作成され、使用されま" +"す。このresultオブジェクトは :meth:`run` の呼び出し元に返されます。テスト終了" +"時には、イベントループ内のすべてのタスクがキャンセルされます。" -#: ../../library/unittest.rst:1685 msgid "An example illustrating the order::" -msgstr "順番を示す例です:" +msgstr "実行順序を示す例です。 ::" #: ../../library/unittest.rst:1687 msgid "" @@ -2903,8 +3115,8 @@ msgid "" "\n" " async def test_response(self):\n" " events.append(\"test_response\")\n" -" response = await self._async_connection.get(\"https://example." -"com\")\n" +" response = await self._async_connection.get(\"https://" +"example.com\")\n" " self.assertEqual(response.status_code, 200)\n" " self.addAsyncCleanup(self.on_cleanup)\n" "\n" @@ -2937,13 +3149,13 @@ msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " "which test code can use to check and report errors. This is used to create " -"test cases using legacy test code, allowing it to be integrated into a :mod:" -"`unittest`-based test framework." +"test cases using legacy test code, allowing it to be integrated into " +"a :mod:`unittest`-based test framework." msgstr "" "このクラスでは :class:`TestCase` インターフェースの内、テストランナーがテスト" "を実行するためのインターフェースだけを実装しており、テスト結果のチェックやレ" -"ポートに関するメソッドは実装していません。既存のテストコードを :mod:" -"`unittest` によるテストフレームワークに組み込むために使用します。" +"ポートに関するメソッドは実装していません。既存のテストコード" +"を :mod:`unittest` によるテストフレームワークに組み込むために使用します。" #: ../../library/unittest.rst:1736 msgid "Grouping tests" @@ -2961,18 +3173,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 +3189,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." @@ -2993,19 +3203,19 @@ msgstr "" #: ../../library/unittest.rst:1762 msgid "" -"Add all the tests from an iterable of :class:`TestCase` and :class:" -"`TestSuite` instances to this test suite." +"Add all the tests from an iterable of :class:`TestCase` " +"and :class:`TestSuite` instances to this test suite." msgstr "" -"イテラブル *tests* に含まれる全ての :class:`TestCase` 又は :class:" -"`TestSuite` のインスタンスをスイートに追加します。" +"イテラブル *tests* に含まれる全ての :class:`TestCase` 又" +"は :class:`TestSuite` のインスタンスをスイートに追加します。" #: ../../library/unittest.rst:1765 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -"このメソッドは *tests* 上のイテレーションをしながらそれぞれの要素に :meth:" -"`addTest` を呼び出すのと等価です。" +"このメソッドは *tests* 上のイテレーションをしながらそれぞれの要素" +"に :meth:`addTest` を呼び出すのと等価です。" #: ../../library/unittest.rst:1768 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" @@ -3015,8 +3225,9 @@ msgstr "" #: ../../library/unittest.rst:1773 msgid "" "Run the tests associated with this suite, collecting the result into the " -"test result object passed as *result*. Note that unlike :meth:`TestCase." -"run`, :meth:`TestSuite.run` requires the result object to be passed in." +"test result object passed as *result*. Note that " +"unlike :meth:`TestCase.run`, :meth:`TestSuite.run` requires the result " +"object to be passed in." msgstr "" "スイート内のテストを実行し、結果を *result* で指定した結果オブジェクトに収集" "します。 :meth:`TestCase.run` と異なり、 :meth:`TestSuite.run` では必ず結果オ" @@ -3058,12 +3269,15 @@ msgid "" "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" +"以前のバージョンでは :class:`TestSuite` はイテレータではなく、直接テストにア" +"クセスしていました。そのため、 :meth:`!__iter__` をオーバーラードしてもテスト" +"にアクセスできませんでした。" #: ../../library/unittest.rst:1809 msgid "" -"In earlier versions the :class:`TestSuite` held references to each :class:" -"`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " -"by overriding :meth:`TestSuite._removeTestAtIndex`." +"In earlier versions the :class:`TestSuite` held references to " +"each :class:`TestCase` after :meth:`TestSuite.run`. Subclasses can restore " +"that behavior by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" "以前のバージョンでは、 :meth:`TestSuite.run` の実行後は :class:`TestSuite` が" "各 :class:`TestCase` への参照を保持していました。\n" @@ -3086,21 +3300,20 @@ msgstr "テストのロードと起動" msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " -"the :mod:`unittest` module provides an instance that can be shared as :data:" -"`unittest.defaultTestLoader`. Using a subclass or instance, however, allows " -"customization of some configurable properties." +"the :mod:`unittest` module provides an instance that can be shared " +"as :data:`unittest.defaultTestLoader`. Using a subclass or instance, " +"however, allows customization of some configurable properties." msgstr "" ":class:`TestLoader` クラスはクラスとモジュールからテストスイートを生成しま" -"す。通常、このクラスのインスタンスを明示的に生成する必要はありません。 :mod:" -"`unittest` モジュールの :data:`unittest.defaultTestLoader` を共用インスタンス" -"として使用することができます。 しかし、このクラスのサブクラスやインスタンス" -"で、属性をカスタマイズすることができます。" +"す。通常、このクラスのインスタンスを明示的に生成する必要はありませ" +"ん。 :mod:`unittest` モジュールの :data:`unittest.defaultTestLoader` を共用イ" +"ンスタンスとして使用することができます。 しかし、このクラスのサブクラスやイン" +"スタンスで、属性をカスタマイズすることができます。" #: ../../library/unittest.rst:1829 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 +3323,8 @@ msgstr "" "テストの読み込み中に起きた致命的でないエラーのリストです。\n" "どの時点でもローダーからリセットされることはありません。\n" "致命的なエラーは適切なメソッドが例外を送出して、呼び出し元に通知します。\n" -"致命的でないエラーも、実行したときのエラーを総合テストが通知してくれます。" +"致命的でないエラーについても、実行すると元のエラーを送出するテストが生成さ" +"れ、エラーが通知されます。" #: ../../library/unittest.rst:1843 msgid ":class:`TestLoader` objects have the following methods:" @@ -3118,19 +3332,19 @@ msgstr ":class:`TestLoader` のオブジェクトには以下のメソッドが #: ../../library/unittest.rst:1848 msgid "" -"Return a suite of all test cases contained in the :class:`TestCase`\\ -" -"derived :class:`testCaseClass`." +"Return a suite of all test cases contained in the :class:`TestCase`\\ " +"-derived :class:`testCaseClass`." msgstr "" ":class:`TestCase` の派生クラス :class:`testCaseClass` に含まれる全テストケー" "スのスイートを返します。" #: ../../library/unittest.rst:1851 msgid "" -"A test case instance is created for each method named by :meth:" -"`getTestCaseNames`. By default these are the method names beginning with " -"``test``. If :meth:`getTestCaseNames` returns no methods, but the :meth:" -"`runTest` method is implemented, a single test case is created for that " -"method instead." +"A test case instance is created for each method named " +"by :meth:`getTestCaseNames`. By default these are the method names beginning " +"with ``test``. If :meth:`getTestCaseNames` returns no methods, but " +"the :meth:`runTest` method is implemented, a single test case is created for " +"that method instead." msgstr "" ":meth:`getTestCaseNames` で指定されたメソッドに対し、テストケースインスタンス" "が作成されます。\n" @@ -3149,7 +3363,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 +3370,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 +3394,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." @@ -3196,12 +3408,12 @@ msgstr "文字列で指定される全テストケースを含むスイートを #: ../../library/unittest.rst:1893 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " -"module, a test case class, a test method within a test case class, a :class:" -"`TestSuite` instance, or a callable object which returns a :class:`TestCase` " -"or :class:`TestSuite` instance. These checks are applied in the order " -"listed here; that is, a method on a possible test case class will be picked " -"up as \"a test method within a test case class\", rather than \"a callable " -"object\"." +"module, a test case class, a test method within a test case class, " +"a :class:`TestSuite` instance, or a callable object which returns " +"a :class:`TestCase` or :class:`TestSuite` instance. These checks are " +"applied in the order listed here; that is, a method on a possible test case " +"class will be picked up as \"a test method within a test case class\", " +"rather than \"a callable object\"." msgstr "" "*name* には \"ドット修飾名\" でモジュールかテストケースクラス、テストケースク" "ラス内のメソッド、 :class:`TestSuite` インスタンスまたは :class:`TestCase` " @@ -3212,25 +3424,25 @@ msgstr "" #: ../../library/unittest.rst:1901 msgid "" -"For example, if you have a module :mod:`SampleTests` containing a :class:" -"`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " -"(:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the specifier " -"``'SampleTests.SampleTestCase'`` would cause this method to return a suite " -"which will run all three test methods. Using the specifier ``'SampleTests." -"SampleTestCase.test_two'`` would cause it to return a test suite which will " -"run only the :meth:`test_two` test method. The specifier can refer to " -"modules and packages which have not been imported; they will be imported as " -"a side-effect." -msgstr "" -"例えば :mod:`SampleTests` モジュールに :class:`TestCase` から派生した :class:" -"`SampleTestCase` クラスがあり、 :class:`SampleTestCase` にはテストメソッド :" -"meth:`test_one` ・ :meth:`test_two` ・ :meth:`test_three` があるとします。こ" -"の場合、 *name* に ``'SampleTests.SampleTestCase'`` と指定すると、 :class:" -"`SampleTestCase` の三つのテストメソッドを実行するテストスイートが作成されま" -"す。 ``'SampleTests.SampleTestCase.test_two'`` と指定すれば、 :meth:" -"`test_two` だけを実行するテストスイートが作成されます。インポートされていない" -"モジュールやパッケージ名を含んだ名前を指定した場合は自動的にインポートされま" -"す。" +"For example, if you have a module :mod:`SampleTests` containing " +"a :class:`TestCase`\\ -derived class :class:`SampleTestCase` with three test " +"methods (:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the " +"specifier ``'SampleTests.SampleTestCase'`` would cause this method to return " +"a suite which will run all three test methods. Using the specifier " +"``'SampleTests.SampleTestCase.test_two'`` would cause it to return a test " +"suite which will run only the :meth:`test_two` test method. The specifier " +"can refer to modules and packages which have not been imported; they will be " +"imported as a side-effect." +msgstr "" +"例えば :mod:`SampleTests` モジュールに :class:`TestCase` から派生し" +"た :class:`SampleTestCase` クラスがあり、 :class:`SampleTestCase` にはテスト" +"メソッド :meth:`test_one` ・ :meth:`test_two` ・ :meth:`test_three` があると" +"します。この場合、 *name* に ``'SampleTests.SampleTestCase'`` と指定する" +"と、 :class:`SampleTestCase` の三つのテストメソッドを実行するテストスイートが" +"作成されます。 ``'SampleTests.SampleTestCase.test_two'`` と指定すれ" +"ば、 :meth:`test_two` だけを実行するテストスイートが作成されます。インポート" +"されていないモジュールやパッケージ名を含んだ名前を指定した場合は自動的にイン" +"ポートされます。" #: ../../library/unittest.rst:1911 msgid "The method optionally resolves *name* relative to the given *module*." @@ -3284,6 +3496,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 +3529,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,27 +3590,30 @@ 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 "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -"以下の属性は、サブクラス化またはインスタンスの属性値を変更して :class:" -"`TestLoader` をカスタマイズする場合に使用します:" +"以下の属性は、サブクラス化またはインスタンスの属性値を変更し" +"て :class:`TestLoader` をカスタマイズする場合に使用します:" #: ../../library/unittest.rst:2004 msgid "" @@ -3406,25 +3627,29 @@ 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." +"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 "" "Callable object that constructs a test suite from a list of tests. No " -"methods on the resulting object are needed. The default value is the :class:" -"`TestSuite` class." +"methods on the resulting object are needed. The default value is " +"the :class:`TestSuite` class." msgstr "" "テストのリストからテストスイートを構築する呼び出し可能オブジェクト。メソッド" "を持つ必要はありません。デフォルト値は :class:`TestSuite` です。" #: ../../library/unittest.rst:2023 ../../library/unittest.rst:2036 msgid "This affects all the ``loadTestsFrom*`` methods." -msgstr "" +msgstr "この値は全ての ``loadTestsFrom*`` メソッドに影響を与えます。" #: ../../library/unittest.rst:2027 msgid "" @@ -3459,8 +3684,8 @@ msgstr "" #: ../../library/unittest.rst:2046 msgid "" -"A :class:`TestResult` object stores the results of a set of tests. The :" -"class:`TestCase` and :class:`TestSuite` classes ensure that results are " +"A :class:`TestResult` object stores the results of a set of tests. " +"The :class:`TestCase` and :class:`TestSuite` classes ensure that results are " "properly recorded; test authors do not need to worry about recording the " "outcome of tests." msgstr "" @@ -3470,10 +3695,10 @@ msgstr "" #: ../../library/unittest.rst:2051 msgid "" -"Testing frameworks built on top of :mod:`unittest` may want access to the :" -"class:`TestResult` object generated by running a set of tests for reporting " -"purposes; a :class:`TestResult` instance is returned by the :meth:" -"`TestRunner.run` method for this purpose." +"Testing frameworks built on top of :mod:`unittest` may want access to " +"the :class:`TestResult` object generated by running a set of tests for " +"reporting purposes; a :class:`TestResult` instance is returned by " +"the :meth:`TestRunner.run` method for this purpose." msgstr "" ":mod:`unittest` を利用したテストフレームワークでは、 :meth:`TestRunner.run` " "が返す :class:`TestResult` インスタンスを参照し、テスト結果をレポートします。" @@ -3502,6 +3727,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 +3757,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 " @@ -3552,11 +3781,12 @@ msgid "" "if the test fails or errors. Any output is also attached to the failure / " "error message." msgstr "" -"``True`` が設定されると、 ``sys.stdout`` と ``sys.stderr`` は、 :meth:" -"`startTest` から :meth:`stopTest` が呼ばれるまでの間バッファリングされます。" +"``True`` が設定されると、 ``sys.stdout`` と ``sys.stderr`` " +"は、 :meth:`startTest` から :meth:`stopTest` が呼ばれるまでの間バッファリング" +"されます。\n" "実際に、結果が ``sys.stdout`` と ``sys.stderr`` に出力されるのは、テストが失" -"敗するかエラーが発生した時になります。表示の際には、全ての失敗 / エラーメッ" -"セージが表示されます。" +"敗するかエラーが発生した時になります。\n" +"出力は失敗やエラーのメッセージにも添付されます。" #: ../../library/unittest.rst:2116 msgid "" @@ -3583,15 +3813,15 @@ msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -":func:`expectedFailure` デコレ-タでマークされたテストに :attr:" -"`unexpectedSuccesses` があった場合 ``False`` を返します。" +":func:`expectedFailure` デコレ-タでマークされたテスト" +"に :attr:`unexpectedSuccesses` があった場合 ``False`` を返します。" #: ../../library/unittest.rst:2138 msgid "" "This method can be called to signal that the set of tests being run should " -"be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" -"`TestRunner` objects should respect this flag and return without running any " -"additional tests." +"be aborted by setting the :attr:`shouldStop` attribute to " +"``True``. :class:`TestRunner` objects should respect this flag and return " +"without running any additional tests." msgstr "" "このメソッドを呼び出して :class:`TestResult` の :attr:`shouldStop` 属性に " "``True`` をセットすることで、実行中のテストは中断しなければならないというシグ" @@ -3605,10 +3835,10 @@ msgid "" "keyboard. Interactive tools which provide :class:`TestRunner` " "implementations can use this in a similar manner." msgstr "" -"たとえばこの機能は、ユーザのキーボード割り込みを受け取って :class:" -"`TextTestRunner` クラスがテストフレームワークを停止させるのに使えます。 :" -"class:`TestRunner` の実装を提供する対話的なツールでも同じように使用することが" -"できます。" +"たとえばこの機能は、ユーザのキーボード割り込みを受け取っ" +"て :class:`TextTestRunner` クラスがテストフレームワークを停止させるのに使えま" +"す。 :class:`TestRunner` の実装を提供する対話的なツールでも同じように使用する" +"ことができます。" #: ../../library/unittest.rst:2148 msgid "" @@ -3654,17 +3884,17 @@ msgid "" "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -"デフォルトの実装では、タプル、 ``(test, formatted_err)`` をインスタンスの :" -"attr:`errors` 属性に追加します。ここで、 *formatted_err* は、 *err* から導出" -"される、整形されたトレースバックです。" +"デフォルトの実装では、タプル、 ``(test, formatted_err)`` をインスタンス" +"の :attr:`errors` 属性に追加します。ここで、 *formatted_err* は、 *err* から" +"導出される、整形されたトレースバックです。" #: ../../library/unittest.rst:2190 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -"テストケース *test* が失敗した場合に呼び出されます。 *err* は :func:`sys." -"exc_info` が返すタプル ``(type, value, traceback)`` です。" +"テストケース *test* が失敗した場合に呼び出されます。 *err* " +"は :func:`sys.exc_info` が返すタプル ``(type, value, traceback)`` です。" #: ../../library/unittest.rst:2193 msgid "" @@ -3672,9 +3902,9 @@ msgid "" "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -"デフォルトの実装では、タプル、 ``(test, formatted_err)`` をインスタンスの :" -"attr:`failures` 属性に追加します。ここで、 *formatted_err* は、 *err* から導" -"出される、整形されたトレースバックです。" +"デフォルトの実装では、タプル、 ``(test, formatted_err)`` をインスタンス" +"の :attr:`failures` 属性に追加します。ここで、 *formatted_err* は、 *err* か" +"ら導出される、整形されたトレースバックです。" #: ../../library/unittest.rst:2200 msgid "Called when the test case *test* succeeds." @@ -3697,13 +3927,13 @@ msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -"デフォルトの実装では、 ``(test, reason)`` のタプルをインスタンスの :attr:" -"`skipped` 属性に追加します。" +"デフォルトの実装では、 ``(test, reason)`` のタプルをインスタンス" +"の :attr:`skipped` 属性に追加します。" #: ../../library/unittest.rst:2216 msgid "" -"Called when the test case *test* fails or errors, but was marked with the :" -"func:`expectedFailure` decorator." +"Called when the test case *test* fails or errors, but was marked with " +"the :func:`expectedFailure` decorator." msgstr "" ":func:`expectedFailure` のデコレータでマークされた *test* が失敗またはエラー" "の時に呼び出されます。" @@ -3714,9 +3944,9 @@ msgid "" "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -"デフォルトの実装では ``(test, formatted_err)`` のタプルをインスタンスの :" -"attr:`expectedFailures` に追加します。ここで *formatted_err* は *err* から派" -"生した整形されたトレースバックです。" +"デフォルトの実装では ``(test, formatted_err)`` のタプルをインスタンス" +"の :attr:`expectedFailures` に追加します。ここで *formatted_err* は *err* か" +"ら派生した整形されたトレースバックです。" #: ../../library/unittest.rst:2226 msgid "" @@ -3728,8 +3958,8 @@ msgstr "" #: ../../library/unittest.rst:2229 msgid "" -"The default implementation appends the test to the instance's :attr:" -"`unexpectedSuccesses` attribute." +"The default implementation appends the test to the " +"instance's :attr:`unexpectedSuccesses` attribute." msgstr "" "デフォルトの実装ではテストをインスタンスの :attr:`unexpectedSuccesses` 属性に" "追加します。" @@ -3745,15 +3975,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)``." +"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 +3992,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 " +"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 "" @@ -3786,9 +4018,9 @@ msgid "" "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -":class:`TestLoader` のインスタンスで、共用することが目的です。 :class:" -"`TestLoader` をカスタマイズする必要がなければ、新しい :class:`TestLoader` オ" -"ブジェクトを作らずにこのインスタンスを使用します。" +":class:`TestLoader` のインスタンスで、共用することが目的で" +"す。 :class:`TestLoader` をカスタマイズする必要がなければ、新しい " +"``TestLoader`` オブジェクトを作らずにこのインスタンスを使用します。" #: ../../library/unittest.rst:2277 msgid "" @@ -3812,33 +4044,33 @@ msgstr "" #: ../../library/unittest.rst:2284 msgid "" -"By default this runner shows :exc:`DeprecationWarning`, :exc:" -"`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " -"even if they are :ref:`ignored by default `. This behavior " -"can be overridden using Python's :option:`!-Wd` or :option:`!-Wa` options " -"(see :ref:`Warning control `) and leaving *warnings* to " -"``None``." +"By default this runner " +"shows :exc:`DeprecationWarning`, :exc:`PendingDeprecationWarning`, :exc:`ResourceWarning` " +"and :exc:`ImportWarning` even if they are :ref:`ignored by default `. This behavior can be overridden using Python's :option:`!-Wd` " +"or :option:`!-Wa` options (see :ref:`Warning control `) " +"and leaving *warnings* to ``None``." msgstr "" #: ../../library/unittest.rst:2292 msgid "Added the *warnings* parameter." -msgstr "" +msgstr "*warnings* 引数が追加されました。" #: ../../library/unittest.rst:2295 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -"インポート時でなくインスタンス化時にデフォルトのストリームが :data:`sys." -"stderr` に設定されます。" +"インポート時でなくインスタンス化時にデフォルトのストリーム" +"が :data:`sys.stderr` に設定されます。" #: ../../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 "" @@ -3859,20 +4091,19 @@ msgid "" msgstr "" "``_makeResult()`` は、 ``TextTestRunner`` のコンストラクタで ``resultclass`` " "引数として渡されたクラスもしくはコーラブルオブジェクトをインスタンス化しま" -"す。 ``resultclass`` が指定されていない場合には、デフォルトで :class:" -"`TextTestResult` が使用されます。結果のクラスは以下の引数が渡されインスタンス" -"化されます::" +"す。 ``resultclass`` が指定されていない場合には、デフォルト" +"で :class:`TextTestResult` が使用されます。結果のクラスは以下の引数が渡されイ" +"ンスタンス化されます::" -#: ../../library/unittest.rst:2316 msgid "stream, descriptions, verbosity" -msgstr "" +msgstr "stream, descriptions, verbosity" #: ../../library/unittest.rst:2320 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " -"method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" -"`TestResult` is created by calling :func:`_makeResult` and the test(s) are " -"run and the results printed to stdout." +"method takes a :class:`TestSuite` or :class:`TestCase` instance. " +"A :class:`TestResult` is created by calling :func:`_makeResult` and the " +"test(s) are run and the results printed to stdout." msgstr "" "このメソッドは ``TextTestRunner`` へのメインの公開インターフェースです。\n" "このメソッドは :class:`TestSuite` インスタンスあるいは :class:`TestCase` イン" @@ -3891,11 +4122,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 +4135,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 +4164,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 +4194,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 +4209,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 " @@ -3981,16 +4218,17 @@ msgid "" msgstr "" "*warnings* 引数では、テストの実行中に使うべき :ref:`警告フィルタ ` を指定します。\n" -"この引数が指定されない場合には、 :option:`!-W` オプションが :program:" -"`python` に渡されていなければ ``None`` のまま (:ref:`警告の制御 ` を参照してください) で、そうでなければ ``'default'`` が設定されま" -"す。" +"この引数が指定されない場合には、 :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." @@ -4026,15 +4264,14 @@ msgstr "" #: ../../library/unittest.rst:2403 msgid "" -"If a test module defines ``load_tests`` it will be called by :meth:" -"`TestLoader.loadTestsFromModule` with the following arguments::" +"If a test module defines ``load_tests`` it will be called " +"by :meth:`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -"テストモジュールが ``load_tests`` を定義していると、それが :meth:`TestLoader." -"loadTestsFromModule` から呼ばれます。引数は以下です::" +"テストモジュールが ``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 "" @@ -4064,13 +4301,12 @@ msgstr "" #: ../../library/unittest.rst:2419 msgid "" -"A typical ``load_tests`` function that loads tests from a specific set of :" -"class:`TestCase` classes may look like::" +"A typical ``load_tests`` function that loads tests from a specific set " +"of :class:`TestCase` classes may look like::" msgstr "" "特定の :class:`TestCase` クラスのセットからテストをロードする典型的な " "``load_tests`` 関数は、このようになります::" -#: ../../library/unittest.rst:2422 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -4081,15 +4317,24 @@ 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 "" "If discovery is started in a directory containing a package, either from the " -"command line or by calling :meth:`TestLoader.discover`, then the package :" -"file:`__init__.py` will be checked for ``load_tests``. If that function " -"does not exist, discovery will recurse into the package as though it were " -"just another directory. Otherwise, discovery of the package's tests will be " -"left up to ``load_tests`` which is called with the following arguments::" +"command line or by calling :meth:`TestLoader.discover`, then the " +"package :file:`__init__.py` will be checked for ``load_tests``. If that " +"function does not exist, discovery will recurse into the package as though " +"it were just another directory. Otherwise, discovery of the package's tests " +"will be left up to ``load_tests`` which is called with the following " +"arguments::" msgstr "" "コマンドラインからでも :meth:`TestLoader.discover` の呼び出しでも、パッケージ" "を含むディレクトリで検索を始めた場合、そのパッケージの :file:`__init__.py` を" @@ -4102,8 +4347,8 @@ msgstr "" #: ../../library/unittest.rst:2440 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " -"package. (``standard_tests`` will only contain tests collected from :file:" -"`__init__.py`.)" +"package. (``standard_tests`` will only contain tests collected " +"from :file:`__init__.py`.)" msgstr "" "これはパッケージ内のすべてのテストを表す :class:`TestSuite` を返すべきです。 " "(``standard_tests`` には、 :file:`__init__.py` から収集されたテストのみが含ま" @@ -4119,7 +4364,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 +4372,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 "" @@ -4145,14 +4396,14 @@ msgstr "クラスとモジュールのフィクスチャ" msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " -"from the previous class (if there is one) is called, followed by :meth:" -"`setUpClass` from the new class." +"from the previous class (if there is one) is called, followed " +"by :meth:`setUpClass` from the new class." msgstr "" "クラスレベルとモジュールレベルのフィクスチャが :class:`TestSuite` に実装され" "ました。\n" -"テストスイートが新しいクラスのテストを始める時、以前のクラス (あれば)の :" -"meth:`tearDownClass` を呼び出し、その後に新しいクラスの :meth:`setUpClass` を" -"呼び出します。" +"テストスイートが新しいクラスのテストを始める時、以前のクラス (あれば)" +"の :meth:`tearDownClass` を呼び出し、その後に新しいクラス" +"の :meth:`setUpClass` を呼び出します。" #: ../../library/unittest.rst:2469 msgid "" @@ -4231,7 +4482,6 @@ msgstr "setUpClass と tearDownClass" msgid "These must be implemented as class methods::" msgstr "これらはクラスメソッドとして実装されなければなりません::" -#: ../../library/unittest.rst:2503 msgid "" "import unittest\n" "\n" @@ -4244,12 +4494,22 @@ 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 "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " -"then you must call up to them yourself. The implementations in :class:" -"`TestCase` are empty." +"then you must call up to them yourself. The implementations " +"in :class:`TestCase` are empty." msgstr "" "基底クラスの ``setUpClass`` および ``tearDownClass`` を使いたいなら、それらを" "自分で呼び出さなければなりません。 :class:`TestCase` の実装は空です。" @@ -4258,9 +4518,9 @@ msgstr "" msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " -"not have ``setUpClass`` or ``tearDownClass`` run. If the exception is a :exc:" -"`SkipTest` exception then the class will be reported as having been skipped " -"instead of as an error." +"not have ``setUpClass`` or ``tearDownClass`` run. If the exception is " +"a :exc:`SkipTest` exception then the class will be reported as having been " +"skipped instead of as an error." msgstr "" "``setUpClass`` の中で例外が送出されたら、クラス内のテストは実行されず、 " "``tearDownClass`` も実行されません。スキップされたクラスは ``setUpClass`` も " @@ -4275,7 +4535,6 @@ msgstr "setUpModule と tearDownModule" msgid "These should be implemented as functions::" msgstr "これらは関数として実装されなければなりません::" -#: ../../library/unittest.rst:2530 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -4283,6 +4542,11 @@ msgid "" "def tearDownModule():\n" " closeConnection()" msgstr "" +"def setUpModule():\n" +" createConnection()\n" +"\n" +"def tearDownModule():\n" +" closeConnection()" #: ../../library/unittest.rst:2536 msgid "" @@ -4295,27 +4559,26 @@ 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 "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " "order to the order they are added (:abbr:`LIFO (last-in, first-out)`). They " -"are called with any arguments and keyword arguments passed into :meth:" -"`addModuleCleanup` when they are added." +"are called with any arguments and keyword arguments passed " +"into :meth:`addModuleCleanup` when they are added." msgstr "" ":func:`tearDownModule` の後に呼び出される関数を追加します。この関数はリソース" "のクリーンアップのために使用します。追加された関数は、追加された順と逆の順番" -"で呼び出されます(:abbr:`LIFO (last-in, first-out)`)。 :meth:" -"`addModuleCleanup` に渡された引数とキーワード引数が追加された関数にも渡されま" -"す。" +"で呼び出されます(:abbr:`LIFO (last-in, first-" +"out)`)。 :meth:`addModuleCleanup` に渡された引数とキーワード引数が追加された" +"関数にも渡されます。" #: ../../library/unittest.rst:2553 msgid "" @@ -4325,13 +4588,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." +"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 "" @@ -4343,9 +4609,10 @@ msgstr "" #: ../../library/unittest.rst:2574 msgid "" -"It is responsible for calling all the cleanup functions added by :func:" -"`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" -"func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." +"It is responsible for calling all the cleanup functions added " +"by :func:`addModuleCleanup`. If you need cleanup functions to be called " +"*prior* to :func:`tearDownModule` then you can call :func:`doModuleCleanups` " +"yourself." msgstr "" "このメソッドは、 :func:`addModuleCleanup` で追加された関数を呼び出す責務を担" "います。もし、クリーンアップ関数を :func:`tearDownModule` より前に呼び出す必" @@ -4372,26 +4639,34 @@ 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 " -"``unittest`` handler is called but *isn't* the installed :const:`signal." -"SIGINT` handler, i.e. it has been replaced by the system under test and " -"delegated to, then it calls the default handler. This will normally be the " -"expected behavior by code that replaces an installed handler and delegates " -"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` デ" -"コレータが使えます。" +"``unittest`` handler is called but *isn't* the " +"installed :const:`signal.SIGINT` handler, i.e. it has been replaced by the " +"system under test and delegated to, then it calls the default handler. This " +"will normally be the expected behavior by code that replaces an installed " +"handler and delegates 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` ハンド" +"ラを登録するコードやテストとの互換性を保つように動作します。\n" +"``unittest`` のハンドラが呼び出されたとき、その時点で登録されてい" +"る :const:`signal.SIGINT` ハンドラが自身で *なければ*、デフォルトのハンドラを" +"呼び出します。\n" +"これは、テスト対象のシステムがハンドラを置き換え、元のハンドラに処理を委譲し" +"た場合に当たります。\n" +"通常、登録済みのハンドラを置き換えて元のハンドラに委譲するコードが期待するの" +"は、この動作です。\n" +"個々のテストで ``unittest`` の control-c 処理を無効にする必要がある場合" +"は、:func:`removeHandler` デコレータを使えます。" #: ../../library/unittest.rst:2606 msgid "" @@ -4408,8 +4683,8 @@ msgid "" "have :meth:`~TestResult.stop` called." msgstr "" "control-c ハンドラをインストールします。(主にユーザが control-c を押したこと" -"により) :const:`signal.SIGINT` が受け取られると、登録した結果すべてに :meth:" -"`~TestResult.stop` が呼び出されます。" +"により) :const:`signal.SIGINT` が受け取られると、登録した結果すべて" +"に :meth:`~TestResult.stop` が呼び出されます。" #: ../../library/unittest.rst:2618 msgid "" @@ -4432,27 +4707,28 @@ msgstr "" #: ../../library/unittest.rst:2629 msgid "" -"Remove a registered result. Once a result has been removed then :meth:" -"`~TestResult.stop` will no longer be called on that result object in " -"response to a control-c." +"Remove a registered result. Once a result has been removed " +"then :meth:`~TestResult.stop` will no longer be called on that result object " +"in response to a control-c." msgstr "" "登録された結果を削除します。一旦結果が削除されると、control-c が押された際に" "その結果オブジェクトに対して :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..bf8dfc16d 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 @@ -34,8 +34,8 @@ msgstr "**ソースコード:** :source:`Lib/urllib/error.py`" #: ../../library/urllib.error.rst:14 msgid "" "The :mod:`urllib.error` module defines the exception classes for exceptions " -"raised by :mod:`urllib.request`. The base exception class is :exc:" -"`URLError`." +"raised by :mod:`urllib.request`. The base exception class " +"is :exc:`URLError`." msgstr "" ":mod:`urllib.error` は :mod:`urllib.request` によって投げられる例外を定義して" "います。基底クラスは :exc:`URLError` です。" @@ -59,25 +59,25 @@ 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." +"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." @@ -86,8 +86,8 @@ msgstr "リクエスト URL を含みます。 *filename* 属性のエイリア #: ../../library/urllib.error.rst:49 msgid "" "An HTTP status code as defined in :rfc:`2616`. This numeric value " -"corresponds to a value found in the dictionary of codes as found in :attr:" -"`http.server.BaseHTTPRequestHandler.responses`." +"corresponds to a value found in the dictionary of codes as found " +"in :attr:`http.server.BaseHTTPRequestHandler.responses`." msgstr "" ":rfc:`2616` に定義されているHTTPステータスコード。\n" "この数値型の値は、 :attr:`http.server.BaseHTTPRequestHandler.responses` の辞" @@ -103,8 +103,8 @@ msgstr "" #: ../../library/urllib.error.rst:60 msgid "" -"The HTTP response headers for the HTTP request that caused the :exc:" -"`HTTPError`. An alias for *hdrs* attribute." +"The HTTP response headers for the HTTP request that caused " +"the :exc:`HTTPError`. An alias for *hdrs* attribute." msgstr "" ":exc:`HTTPError` の原因となった HTTP リクエストの HTTP レスポンスヘッダ。 " "*hdrs* 属性のエイリアスです。" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 3d3e34798..931ff11e6 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" @@ -101,9 +116,9 @@ msgstr "" #: ../../library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " -"This corresponds to the general structure of a URL: ``scheme://netloc/path;" -"parameters?query#fragment``. Each tuple item is a string, possibly empty. " -"The components are not broken up into smaller parts (for example, the " +"This corresponds to the general structure of a URL: ``scheme://netloc/" +"path;parameters?query#fragment``. Each tuple item is a string, possibly " +"empty. The components are not broken up into smaller parts (for example, the " "network location is a single string), and % escapes are not expanded. The " "delimiters as shown above are not part of the result, except for a leading " "slash in the *path* component, which is retained if present. For example:" @@ -156,8 +171,8 @@ msgstr "" msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -352,32 +367,35 @@ msgid "" "invalid port is specified in the URL. See section :ref:`urlparse-result-" "object` for more information on the result object." msgstr "" -"URL中で不正なポートが指定されている場合、 :attr:`port` 属性を読みだすと、:" -"exc:`ValueError` を送出します。結果オブジェクトのより詳しい情報は :ref:" -"`urlparse-result-object` 節を参照してください。" +"URL中で不正なポートが指定されている場合、 :attr:`port` 属性を読みだす" +"と、:exc:`ValueError` を送出します。結果オブジェクトのより詳しい情報" +"は :ref:`urlparse-result-object` 節を参照してください。" #: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:340 msgid "" -"Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" -"`ValueError`." +"Unmatched square brackets in the :attr:`netloc` attribute will raise " +"a :exc:`ValueError`." 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 "" "As is the case with all named tuples, the subclass has a few additional " -"methods and attributes that are particularly useful. One such method is :" -"meth:`_replace`. The :meth:`_replace` method will return a new ParseResult " -"object replacing specified fields with new values." +"methods and attributes that are particularly useful. One such method " +"is :meth:`_replace`. The :meth:`_replace` method will return a new " +"ParseResult object replacing specified fields with new values." msgstr "" #: ../../library/urllib.parse.rst:163 @@ -385,12 +403,12 @@ msgid "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" msgstr "" @@ -404,33 +422,36 @@ 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 "" -"Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" -"const:`None`." +"Out-of-range port numbers now raise :exc:`ValueError`, instead of " +"returning :const:`None`." msgstr "" -"範囲外のポート番号を指定すると、 :const:`None` を返す代わりに、:exc:" -"`ValueError` を送出するようになりました。" +"範囲外のポート番号を指定すると、 :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 "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a dictionary. " -"The dictionary keys are the unique query variable names and the values are " -"lists of values for each name." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"dictionary. The dictionary keys are the unique query variable names and the " +"values are lists of values for each name." msgstr "" "文字列引数として渡されたクエリ文字列 (:mimetype:`application/x-www-form-" "urlencoded` 型のデータ) を解析します。解析されたデータを辞書として返します。" @@ -463,25 +484,28 @@ msgstr "" #: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:263 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " -"percent-encoded sequences into Unicode characters, as accepted by the :meth:" -"`bytes.decode` method." +"percent-encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" "任意のパラメータ *encoding* および *errors* はパーセントエンコードされたシー" -"ケンスを Unicode 文字にデコードする方法を指定します。これは :meth:`bytes." -"decode` メソッドに渡されます。" +"ケンスを 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,25 +523,31 @@ 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 "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a list of name, " -"value pairs." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"list of name, value pairs." msgstr "" "文字列引数として渡されたクエリ文字列 (:mimetype:`application/x-www-form-" "urlencoded` 型のデータ) を解析します。解析されたデータは名前と値のペアからな" @@ -528,8 +558,8 @@ msgid "" "Use the :func:`urllib.parse.urlencode` function to convert such lists of " "pairs into query strings." msgstr "" -"ペアのリストからクエリ文字列を生成する場合には :func:`urllib.parse." -"urlencode` 関数を使用します。" +"ペアのリストからクエリ文字列を生成する場合に" +"は :func:`urllib.parse.urlencode` 関数を使用します。" #: ../../library/urllib.parse.rst:292 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 "" @@ -622,8 +652,8 @@ msgstr "" #: ../../library/urllib.parse.rst:393 msgid "" -"The *allow_fragments* argument has the same meaning and default as for :func:" -"`urlparse`." +"The *allow_fragments* argument has the same meaning and default as " +"for :func:`urlparse`." msgstr "" "*allow_fragments* 引数は :func:`urlparse` における引数と同じ意味とデフォルト" "を持ちます。" @@ -643,16 +673,19 @@ 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 "" "If you do not want that behavior, preprocess the *url* with :func:`urlsplit` " "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -"もしこの動作が望みのものでない場合は、 *url* を :func:`urlsplit` と :func:" -"`urlunsplit` で先に処理して、 *scheme* と *netloc* を削除してください。" +"もしこの動作が望みのものでない場合は、 *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 +693,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 +737,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." +"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 +758,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 +772,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 +779,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 +795,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" @@ -758,20 +815,20 @@ msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " "quoted and encoded URLs as sequences of ASCII bytes. Accordingly, the URL " -"parsing functions in this module all operate on :class:`bytes` and :class:" -"`bytearray` objects in addition to :class:`str` objects." +"parsing functions in this module all operate on :class:`bytes` " +"and :class:`bytearray` objects in addition to :class:`str` objects." msgstr "" "URL を解析する関数は元々文字列のみ操作するよう設計されていました。実際のとこ" "ろ、それは URL が正しくクオートされエンコードされた ASCII バイト列を操作でき" -"た方が有用でした。結果的にこのモジュールの URL 解析関数はすべて :class:" -"`bytes` および :class:`bytearray` オブジェクトに加えて :class:`str` オブジェ" -"クトでも処理するようになりました。" +"た方が有用でした。結果的にこのモジュールの URL 解析関数はすべ" +"て :class:`bytes` および :class:`bytearray` オブジェクトに加え" +"て :class:`str` オブジェクトでも処理するようになりました。" #: ../../library/urllib.parse.rst:496 msgid "" -"If :class:`str` data is passed in, the result will also contain only :class:" -"`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " -"result will contain only :class:`bytes` data." +"If :class:`str` data is passed in, the result will also contain " +"only :class:`str` data. If :class:`bytes` or :class:`bytearray` data is " +"passed in, the result will contain only :class:`bytes` data." msgstr "" ":class:`str` データが渡された場合、戻り値は :class:`str` データのみを含んだも" "のになります。:class:`bytes` あるいは :class:`bytearray` が渡された場合、戻り" @@ -779,35 +836,36 @@ msgstr "" #: ../../library/urllib.parse.rst:500 msgid "" -"Attempting to mix :class:`str` data with :class:`bytes` or :class:" -"`bytearray` in a single function call will result in a :exc:`TypeError` " -"being raised, while attempting to pass in non-ASCII byte values will " -"trigger :exc:`UnicodeDecodeError`." +"Attempting to mix :class:`str` data with :class:`bytes` " +"or :class:`bytearray` in a single function call will result in " +"a :exc:`TypeError` being raised, while attempting to pass in non-ASCII byte " +"values will trigger :exc:`UnicodeDecodeError`." msgstr "" "単一の関数を呼び出す時に :class:`bytes` または :class:`bytearray` が混在し" "た :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 " -"an :meth:`encode` method (when the result contains :class:`str` data) or a :" -"meth:`decode` method (when the result contains :class:`bytes` data). The " -"signatures of these methods match those of the corresponding :class:`str` " -"and :class:`bytes` methods (except that the default encoding is ``'ascii'`` " -"rather than ``'utf-8'``). Each produces a value of a corresponding type that " -"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` データのどちらかに対応した型を生成します。" +msgid "" +"To support easier conversion of result objects between :class:`str` " +"and :class:`bytes`, all return values from URL parsing functions provide " +"either an :meth:`encode` method (when the result contains :class:`str` data) " +"or a :meth:`decode` method (when the result contains :class:`bytes` data). " +"The signatures of these methods match those of the " +"corresponding :class:`str` and :class:`bytes` methods (except that the " +"default encoding is ``'ascii'`` rather than ``'utf-8'``). Each produces a " +"value of a corresponding type that contains either :class:`bytes` data " +"(for :meth:`encode` methods) or :class:`str` data (for :meth:`decode` " +"methods)." +msgstr "" +"結果オブジェクトを :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 "" @@ -841,9 +899,9 @@ msgstr "構造化された解析結果" #: ../../library/urllib.parse.rst:534 msgid "" -"The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" -"`urldefrag` functions are subclasses of the :class:`tuple` type. These " -"subclasses add the attributes listed in the documentation for those " +"The result objects from the :func:`urlparse`, :func:`urlsplit` " +"and :func:`urldefrag` functions are subclasses of the :class:`tuple` type. " +"These subclasses add the attributes listed in the documentation for those " "functions, the encoding and decoding support described in the previous " "section, as well as an additional method:" msgstr "" @@ -870,15 +928,16 @@ msgid "" "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -":func:`urldefrag` の戻り値では、空のフラグメント識別子のみ削除されます。:" -"func:`urlsplit` および :func:`urlparse` の戻り値では、このメソッドが返す URL " -"には説明されているすべての変更が加えられます。" +":func:`urldefrag` の戻り値では、空のフラグメント識別子のみ削除されま" +"す。: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 +947,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 +976,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 +1015,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 +1022,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 +1036,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 "" @@ -988,35 +1049,40 @@ msgid "" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " "defaults to ``'utf-8'``. *errors* defaults to ``'strict'``, meaning " "unsupported characters raise a :class:`UnicodeEncodeError`. *encoding* and " -"*errors* must not be supplied if *string* is a :class:`bytes`, or a :class:" -"`TypeError` is raised." +"*errors* must not be supplied if *string* is a :class:`bytes`, or " +"a :class:`TypeError` is raised." msgstr "" "任意のパラメータ *encoding* と *errors* は :meth:`str.encode` で受け付けられ" "る非 ASCII 文字への対処法を指定します。*encoding* のデフォルトは " "``'utf-8'``、*errors* のデフォルトは ``'strict'`` で、非サポート文字がある" "と :class:`UnicodeEncodeError` を送出します。*string* が :class:`bytes` の場" -"合 *encoding* と *errors* を指定してはいけません。指定すると :class:" -"`TypeError` が送出されます。" +"合 *encoding* と *errors* を指定してはいけません。指定する" +"と :class:`TypeError` が送出されます。" #: ../../library/urllib.parse.rst:647 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -"``quote(string, safe, encoding, errors)`` は ``quote_from_bytes(string." -"encode(encoding, errors), safe)`` と等価であることに留意してください。" +"``quote(string, safe, encoding, errors)`` は " +"``quote_from_bytes(string.encode(encoding, errors), safe)`` と等価であること" +"に留意してください。" #: ../../library/urllib.parse.rst:650 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'``." @@ -1025,8 +1091,8 @@ msgstr "" #: ../../library/urllib.parse.rst:665 msgid "" -"Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" -"`str`, and does not perform string-to-bytes encoding." +"Like :func:`quote`, but accepts a :class:`bytes` object rather than " +"a :class:`str`, and does not perform string-to-bytes encoding." msgstr "" ":func:`quote` と似ていますが、:class:`str` ではなく :class:`bytes` オブジェク" "トを取り、文字列からバイト列へのエンコードを行いません。" @@ -1039,9 +1105,13 @@ msgstr "例: ``quote_from_bytes(b'a&\\xef')`` は ``'a%26%EF'`` を返します msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" -"encoded sequences into Unicode characters, as accepted by the :meth:`bytes." -"decode` method." +"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 +1125,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 +1147,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 "" @@ -1102,12 +1174,12 @@ msgid "" "operation with the :func:`~urllib.request.urlopen` function, then it should " "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -"マッピング型オブジェクトまたは 2 個の要素からなるタプルのシーケンス (:class:" -"`str` か :class:`bytes` オブジェクトが含まれているかもしれません) を、パーセ" -"ントエンコードされた ASCII 文字列に変換します。戻り値の文字列が :func:" -"`~urllib.request.urlopen` 関数での POST 操作の *data* で使用される場合はバイ" -"ト列にエンコードしなければなりません。そうでない場合は :exc:`TypeError` が送" -"出されます。" +"マッピング型オブジェクトまたは 2 個の要素からなるタプルのシーケンス " +"(:class:`str` か :class:`bytes` オブジェクトが含まれているかもしれません) " +"を、パーセントエンコードされた ASCII 文字列に変換します。戻り値の文字列" +"が :func:`~urllib.request.urlopen` 関数での POST 操作の *data* で使用される場" +"合はバイト列にエンコードしなければなりません。そうでない場合" +"は :exc:`TypeError` が送出されます。" #: ../../library/urllib.parse.rst:726 msgid "" @@ -1150,34 +1222,33 @@ 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 "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -"このエンコード処理の逆を行うには、このモジュールで提供されている :func:" -"`parse_qs` と :func:`parse_qsl` を使用して、クエリ文字列を Python データ構造" -"に変換できます。" +"このエンコード処理の逆を行うには、このモジュールで提供されてい" +"る :func:`parse_qs` と :func:`parse_qsl` を使用して、クエリ文字列を Python " +"データ構造に変換できます。" #: ../../library/urllib.parse.rst:751 msgid "" -"Refer to :ref:`urllib examples ` to find out how the :func:" -"`urllib.parse.urlencode` method can be used for generating the query string " -"of a URL or data for a POST request." +"Refer to :ref:`urllib examples ` to find out how " +"the :func:`urllib.parse.urlencode` method can be used for generating the " +"query string of a URL or data for a POST request." msgstr "" -"POST リクエストのデータ、あるいは URL クエリ文字列を生成するために、 :func:" -"`urllib.parse.urlencode` メソッドをどのように使えばよいかを見るには、:ref:" -"`urllib の使用例 ` を参照してください。" +"POST リクエストのデータ、あるいは URL クエリ文字列を生成するため" +"に、 :func:`urllib.parse.urlencode` メソッドをどのように使えばよいかを見るに" +"は、:ref:`urllib の使用例 ` を参照してください。" #: ../../library/urllib.parse.rst:755 msgid "*query* supports bytes and string objects." @@ -1185,17 +1256,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..71e1ff72f 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,35 +54,40 @@ 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 "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/urllib.request.rst:34 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 "" @@ -116,18 +120,18 @@ msgstr "" #: ../../library/urllib.request.rst:54 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " -"describing the various SSL options. See :class:`~http.client." -"HTTPSConnection` for more details." +"describing the various SSL options. " +"See :class:`~http.client.HTTPSConnection` for more details." msgstr "" -"*context* を指定する場合は、様々な SSL オプションを記述する :class:`ssl." -"SSLContext` インスタンスでなければなりません。\n" +"*context* を指定する場合は、様々な SSL オプションを記述す" +"る :class:`ssl.SSLContext` インスタンスでなければなりません。\n" "詳細は :class:`~http.client.HTTPSConnection` を参照してください。" #: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " -"manager` and has the properties *url*, *headers*, and *status*. See :class:" -"`urllib.response.addinfourl` for more detail on these properties." +"manager` and has the properties *url*, *headers*, and *status*. " +"See :class:`urllib.response.addinfourl` for more detail on these properties." msgstr "" "この関数は常にプロパティ *url*、 *headers*、および *status* を持ち、 :term:`" "コンテキストマネージャ ` として動作するオブジェクトを返しま" @@ -136,25 +140,27 @@ msgstr "" #: ../../library/urllib.request.rst:62 msgid "" -"For HTTP and HTTPS URLs, this function returns a :class:`http.client." -"HTTPResponse` object slightly modified. In addition to the three new methods " -"above, the msg attribute contains the same information as the :attr:`~http." -"client.HTTPResponse.reason` attribute --- the reason phrase returned by " -"server --- instead of the response headers as it is specified in the " -"documentation for :class:`~http.client.HTTPResponse`." +"For HTTP and HTTPS URLs, this function returns " +"a :class:`http.client.HTTPResponse` object slightly modified. In addition to " +"the three new methods above, the msg attribute contains the same information " +"as the :attr:`~http.client.HTTPResponse.reason` attribute --- the reason " +"phrase returned by server --- instead of the response headers as it is " +"specified in the documentation for :class:`~http.client.HTTPResponse`." msgstr "" -"HTTP および HTTPS URL の場合、この関数は、わずかに修正された :class:`http." -"client.HTTPResponse` オブジェクトを返します。上記の3つの新しいメソッドに加え" -"て、 msg 属性が :class:`~http.client.HTTPResponse` のドキュメンテーションで指" -"定されているレスポンスヘッダーの代わりに :attr:`~http.client.HTTPResponse." -"reason` 属性 --- サーバーから返された reason フレーズ --- と同じ情報を含んで" -"います。" +"HTTP および HTTPS URL の場合、この関数は、わずかに修正され" +"た :class:`http.client.HTTPResponse` オブジェクトを返します。上記の3つの新し" +"いメソッドに加えて、 msg 属性が :class:`~http.client.HTTPResponse` のドキュメ" +"ンテーションで指定されているレスポンスヘッダーの代わり" +"に :attr:`~http.client.HTTPResponse.reason` 属性 --- サーバーから返された " +"reason フレーズ --- と同じ情報を含んでいます。" #: ../../library/urllib.request.rst:70 msgid "" -"For FTP, file, and data URLs, this function returns a :class:`urllib." -"response.addinfourl` object." +"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." @@ -163,41 +169,47 @@ msgstr "プロトコルエラー発生時は :exc:`~urllib.error.URLError` を #: ../../library/urllib.request.rst:75 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " -"the default installed global :class:`OpenerDirector` uses :class:" -"`UnknownHandler` to ensure this never happens)." +"the default installed global :class:`OpenerDirector` " +"uses :class:`UnknownHandler` to ensure this never happens)." msgstr "" "どのハンドラもリクエストを処理しなかった場合には ``None`` を返すことがあるの" -"で注意してください (デフォルトでインストールされる グローバルハンドラの :" -"class:`OpenerDirector` は、 :class:`UnknownHandler` を使って上記の問題が起き" -"ないようにしています)。" +"で注意してください (デフォルトでインストールされる グローバルハンドラ" +"の :class:`OpenerDirector` は、 :class:`UnknownHandler` を使って上記の問題が" +"起きないようにしています)。" #: ../../library/urllib.request.rst:79 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " -"environment variable like :envvar:`!http_proxy` is set), :class:" -"`ProxyHandler` is default installed and makes sure the requests are handled " -"through the proxy." +"environment variable like :envvar:`!http_proxy` is " +"set), :class:`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 "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " "``urllib2.urlopen``. Proxy handling, which was done by passing a dictionary " -"parameter to ``urllib.urlopen``, can be obtained by using :class:" -"`ProxyHandler` objects." +"parameter to ``urllib.urlopen``, can be obtained by " +"using :class:`ProxyHandler` objects." msgstr "" -"Python 2.6 以前のレガシーな ``urllib.urlopen`` 関数は廃止されました。:func:" -"`urllib.request.urlopen` が過去の ``urllib2.urlopen`` に相当します。``urllib." -"urlopen`` において辞書型オブジェクトで渡していたプロキシの扱いは、:class:" -"`ProxyHandler` オブジェクトを使用して取得できます。" +"Python 2.6 以前のレガシーな ``urllib.urlopen`` 関数は廃止されまし" +"た。:func:`urllib.request.urlopen` が過去の ``urllib2.urlopen`` に相当しま" +"す。``urllib.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." +"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." @@ -205,9 +217,11 @@ msgstr "*cafile* および *capath* が追加されました。" #: ../../library/urllib.request.rst:99 msgid "" -"HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." -"HAS_SNI` is true)." +"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,36 +235,41 @@ 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`." +"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 "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " -"opener; otherwise, simply call :meth:`OpenerDirector.open` instead of :func:" -"`~urllib.request.urlopen`. The code does not check for a real :class:" -"`OpenerDirector`, and any class with the appropriate interface will work." +"opener; otherwise, simply call :meth:`OpenerDirector.open` instead " +"of :func:`~urllib.request.urlopen`. The code does not check for a " +"real :class:`OpenerDirector`, and any class with the appropriate interface " +"will work." msgstr "" "指定された :class:`OpenerDirector` のインスタンスを、デフォルトで利用されるグ" "ローバルの opener としてインストールします。 opener のインストールは、 " -"urlopen にその opener を使って欲しいとき以外必要ありません。普段は単に :func:" -"`~urllib.request.urlopen` の代わりに :meth:`OpenerDirector.open` を利用してく" -"ださい。この関数は引数が本当に :class:`OpenerDirector` のインスタンスであるか" -"どうかはチェックしません。適切なインターフェースを持った任意のクラスを利用す" -"ることができます。" +"urlopen にその opener を使って欲しいとき以外必要ありません。普段は単" +"に :func:`~urllib.request.urlopen` の代わりに :meth:`OpenerDirector.open` を" +"利用してください。この関数は引数が本当に :class:`OpenerDirector` のインスタン" +"スであるかどうかはチェックしません。適切なインターフェースを持った任意のクラ" +"スを利用することができます。" -#: ../../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`, " @@ -258,21 +277,18 @@ msgid "" "call the constructor without any parameters). Instances of the following " "classes will be in front of the *handler*\\s, unless the *handler*\\s " "contain them, instances of them or subclasses of them: :class:`ProxyHandler` " -"(if proxy settings are detected), :class:`UnknownHandler`, :class:" -"`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" -"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" -"`HTTPErrorProcessor`." +"(if proxy settings are " +"detected), :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:`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 +307,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." +"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." +"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 +383,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 +460,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,27 +475,38 @@ 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 "" -"For an HTTP POST request method, *data* should be a buffer in the standard :" -"mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." -"parse.urlencode` function takes a mapping or sequence of 2-tuples and " -"returns an ASCII string in this format. It should be encoded to bytes before " -"being used as the *data* parameter." +"For an HTTP POST request method, *data* should be a buffer in the " +"standard :mimetype:`application/x-www-form-urlencoded` format. " +"The :func:`urllib.parse.urlencode` function takes a mapping or sequence of 2-" +"tuples and returns an ASCII string in this format. It should be encoded to " +"bytes before being used as the *data* parameter." msgstr "" "HTTP POST リクエストメソッドでは *data* は標準の :mimetype:`application/x-" -"www-form-urlencoded` 形式のバッファーでなければなりません。 :func:`urllib." -"parse.urlencode` 関数は、マップ型あるいは 2 タプルのシーケンスを取り、この形" -"式の ASCII 文字列を返します。これは *data* パラメーターとして使用される前に " -"bytes 型にエンコードされなければなりません。" +"www-form-urlencoded` 形式のバッファーでなければなりませ" +"ん。 :func:`urllib.parse.urlencode` 関数は、マップ型あるいは 2 タプルのシーケ" +"ンスを取り、この形式の ASCII 文字列を返します。これは *data* パラメーターとし" +"て使用される前に bytes 型にエンコードされなければなりません。" #: ../../library/urllib.request.rst:262 msgid "" -"*headers* should be a dictionary, and will be treated as if :meth:" -"`add_header` was called with each key and value as arguments. This is often " -"used to \"spoof\" the ``User-Agent`` header value, which is used by a " -"browser to identify itself -- some HTTP servers only allow requests coming " +"*headers* should be a dictionary, and will be treated as " +"if :meth:`add_header` was called with each key and value as arguments. This " +"is often used to \"spoof\" the ``User-Agent`` header value, which is used by " +"a browser to identify itself -- some HTTP servers only allow requests coming " "from common browsers as opposed to scripts. For example, Mozilla Firefox may " "identify itself as ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " "Firefox/2.0.0.11\"``, while :mod:`urllib`'s default user agent string is " @@ -468,17 +519,19 @@ msgstr "" "\" するために用いられます。これは一部の HTTP サーバーが、スクリプトからのアク" "セスを禁止するために一般的なブラウザーの ``User-Agent`` ヘッダーしか許可しな" "いためです。例えば、 Mozilla Firefox は ``User-Agent`` に ``\"Mozilla/5.0 " -"(X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11\"`` のように設定し、 :" -"mod:`urllib` はデフォルトで ``\"Python-urllib/2.6\"`` (Python 2.6の場合) と設" -"定します。headersのすべてのキーはキャメルケースで送信されます。" +"(X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11\"`` のように設定" +"し、 :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 "" @@ -491,11 +544,11 @@ msgstr "" #: ../../library/urllib.request.rst:281 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " -"defined by :rfc:`2965`. It defaults to ``http.cookiejar." -"request_host(self)``. This is the host name or IP address of the original " -"request that was initiated by the user. For example, if the request is for " -"an image in an HTML document, this should be the request-host of the request " -"for the page containing the image." +"defined by :rfc:`2965`. It defaults to " +"``http.cookiejar.request_host(self)``. This is the host name or IP address " +"of the original request that was initiated by the user. For example, if the " +"request is for an image in an HTML document, this should be the request-host " +"of the request for the page containing the image." msgstr "" "*origin_req_host* は、 :rfc:`2965` で定義されている元のトランザクションにおけ" "るリクエストホスト (request-host of the origin transaction) です。デフォルト" @@ -522,14 +575,19 @@ msgstr "" #: ../../library/urllib.request.rst:296 msgid "" "*method* should be a string that indicates the HTTP request method that will " -"be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" -"`~Request.method` attribute and is used by :meth:`get_method`. The default " -"is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " -"indicate a different default method by setting the :attr:`~Request.method` " -"attribute in the class itself." +"be used (e.g. ``'HEAD'``). If provided, its value is stored in " +"the :attr:`~Request.method` attribute and is used by :meth:`get_method`. The " +"default is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. " +"Subclasses may 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 +596,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 +612,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 "" @@ -655,18 +720,18 @@ msgid "" "BasicAuth handler to determine when to send authentication credentials " "immediately instead of waiting for a ``401`` response first." msgstr "" -"``uri -> is_authenticated`` マッピングのデータベースも持つ :class:" -"`HTTPPasswordMgrWithDefaultRealm` のバリエーションです。最初に ``401`` レスポ" -"ンスを待つのではなく直ちに認証情報を送るときの条件を判断するために、 " -"BasicAuth ハンドラによって使われます。" +"``uri -> is_authenticated`` マッピングのデータベースも持" +"つ :class:`HTTPPasswordMgrWithDefaultRealm` のバリエーションです。最初に " +"``401`` レスポンスを待つのではなく直ちに認証情報を送るときの条件を判断するた" +"めに、 BasicAuth ハンドラによって使われます。" #: ../../library/urllib.request.rst:397 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be " -"supported. If *passwd_mgr* also provides ``is_authenticated`` and " +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported. If *passwd_mgr* also provides ``is_authenticated`` and " "``update_authenticated`` methods (see :ref:`http-password-mgr-with-prior-" "auth`), then the handler will use the ``is_authenticated`` result for a " "given URI to determine whether or not to send authentication credentials " @@ -679,20 +744,20 @@ msgid "" "will automatically include the authentication credentials." msgstr "" "これは、リモートホストとプロキシの両方に対して HTTP 認証を行うことを助ける " -"mixin クラスです。 *password_mgr* は、もし与えられたら :class:" -"`HTTPPasswordMgr` と互換性のあるオブジェクトでなければなりません; サポートす" -"べきインターフェースに関する情報は :ref:`http-password-mgr` 節を参照してくだ" -"さい。もし *passwd_mgr* が ``is_authenticated`` と ``update_authenticated`` " -"メソッドも提供するなら (:ref:`http-password-mgr-with-prior-auth` を参照)、ハ" -"ンドラは与えられた URI に対する ``is_authenticated`` の結果を用いてリクエスト" -"において認証情報を送るかどうかを決定します。もし ``is_authenticated`` がその " -"URI に対して ``True`` を返すなら、認証情報が送られます。 " -"``is_authenticated`` が ``False`` なら認証情報は送られません。そして、もし " -"``401`` レスポンスを受け取ったら、認証情報を付けて改めてリクエストが送信され" -"ます。もし認証が成功したら、それ以降その URI またはその親 URI に対して行われ" -"るリクエストが認証情報を自動的に含むように、 URI に対して " -"``is_authenticated`` を ``True`` に設定するために ``update_authenticated`` が" -"呼ばれます。" +"mixin クラスです。 *password_mgr* は、もし与えられた" +"ら :class:`HTTPPasswordMgr` と互換性のあるオブジェクトでなければなりません; " +"サポートすべきインターフェースに関する情報は :ref:`http-password-mgr` 節を参" +"照してください。もし *passwd_mgr* が ``is_authenticated`` と " +"``update_authenticated`` メソッドも提供するなら (:ref:`http-password-mgr-" +"with-prior-auth` を参照)、ハンドラは与えられた URI に対する " +"``is_authenticated`` の結果を用いてリクエストにおいて認証情報を送るかどうかを" +"決定します。もし ``is_authenticated`` がその URI に対して ``True`` を返すな" +"ら、認証情報が送られます。 ``is_authenticated`` が ``False`` なら認証情報は送" +"られません。そして、もし ``401`` レスポンスを受け取ったら、認証情報を付けて改" +"めてリクエストが送信されます。もし認証が成功したら、それ以降その URI またはそ" +"の親 URI に対して行われるリクエストが認証情報を自動的に含むように、 URI に対" +"して ``is_authenticated`` を ``True`` に設定するために " +"``update_authenticated`` が呼ばれます。" #: ../../library/urllib.request.rst:414 msgid "Added ``is_authenticated`` support." @@ -706,11 +771,11 @@ msgid "" "be supported. HTTPBasicAuthHandler will raise a :exc:`ValueError` when " "presented with a wrong Authentication scheme." msgstr "" -"遠隔ホストとの間での認証を扱います。 *password_mgr* を与える場合、 :class:" -"`HTTPPasswordMgr` と互換性がなければなりません; 互換性のためにサポートしなけ" -"ればならないインターフェースについての情報はセクション :ref:`http-password-" -"mgr` を参照してください。HTTPBasicAuthHandler は、間違った認証スキーマが与え" -"られると :exc:`ValueError` を送出します。" +"遠隔ホストとの間での認証を扱います。 *password_mgr* を与える場" +"合、 :class:`HTTPPasswordMgr` と互換性がなければなりません; 互換性のためにサ" +"ポートしなければならないインターフェースについての情報はセクショ" +"ン :ref:`http-password-mgr` を参照してください。HTTPBasicAuthHandler は、間" +"違った認証スキーマが与えられると :exc:`ValueError` を送出します。" #: ../../library/urllib.request.rst:429 ../../library/urllib.request.rst:466 msgid "" @@ -719,27 +784,27 @@ msgid "" "section :ref:`http-password-mgr` for information on the interface that must " "be supported." msgstr "" -"プロキシとの間での認証を扱います。 *password_mgr* を与える場合、 :class:" -"`HTTPPasswordMgr` と互換性が なければなりません; 互換性のためにサポートしな" -"ければならないインターフェースについての情報はセクション :ref:`http-password-" -"mgr` を参照してください。" +"プロキシとの間での認証を扱います。 *password_mgr* を与える場" +"合、 :class:`HTTPPasswordMgr` と互換性が なければなりません; 互換性のために" +"サポートしなければならないインターフェースについての情報はセクショ" +"ン :ref:`http-password-mgr` を参照してください。" #: ../../library/urllib.request.rst:437 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be supported." +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported." msgstr "" "このクラスはHTTP 認証を補助するための混ぜ込みクラス (mixin class) です。遠隔" -"ホストとプロキシの両方に対応しています。 *password_mgr* を与える場合、 :" -"class:`HTTPPasswordMgr` と互換性がなければなりません; 互換性のためにサポート" -"しなければならないインターフェースについての情報はセクション :ref:`http-" -"password-mgr` を参照してください。" +"ホストとプロキシの両方に対応しています。 *password_mgr* を与える場" +"合、 :class:`HTTPPasswordMgr` と互換性がなければなりません; 互換性のためにサ" +"ポートしなければならないインターフェースについての情報はセクショ" +"ン :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 "" @@ -753,13 +818,14 @@ msgid "" "a :exc:`ValueError` when presented with an authentication scheme other than " "Digest or Basic." msgstr "" -"リモートホストとの認証を扱います。*password_mgr* を与える場合、:class:" -"`HTTPPasswordMgr` と互換性のあるものでなければなりません。サポートしなければ" -"ならないインターフェースについての情報は :ref:`http-password-mgr` 節を参照し" -"てください。Digest 認証ハンドラーと Basic 認証ハンドラーの両方が追加された場" -"合、常に Digest 認証を先に試みます。Digest 認証が 40x のレスポンスを再び返す" -"と、Basic 認証ハンドラーに送信されます。このハンドラーメソッドは、Digest およ" -"び Basic 以外の認証スキームが存在する場合は :exc:`ValueError` を送出します。" +"リモートホストとの認証を扱います。*password_mgr* を与える場" +"合、:class:`HTTPPasswordMgr` と互換性のあるものでなければなりません。サポート" +"しなければならないインターフェースについての情報は :ref:`http-password-mgr` " +"節を参照してください。Digest 認証ハンドラーと Basic 認証ハンドラーの両方が追" +"加された場合、常に Digest 認証を先に試みます。Digest 認証が 40x のレスポンス" +"を再び返すと、Basic 認証ハンドラーに送信されます。このハンドラーメソッドは、" +"Digest および Basic 以外の認証スキームが存在する場合は :exc:`ValueError` を送" +"出します。" #: ../../library/urllib.request.rst:459 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." @@ -775,8 +841,8 @@ msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -"HTTPS で URL を開きます。*context* および *check_hostname* は :class:`http." -"client.HTTPSConnection` のものと同じ意味です。" +"HTTPS で URL を開きます。*context* および *check_hostname* " +"は :class:`http.client.HTTPSConnection` のものと同じ意味です。" #: ../../library/urllib.request.rst:482 msgid "*context* and *check_hostname* were added." @@ -829,9 +895,9 @@ msgstr "コンストラクターに渡されたオリジナルの URL です。" #: ../../library/urllib.request.rst:532 msgid "" -"Request.full_url is a property with setter, getter and a deleter. Getting :" -"attr:`~Request.full_url` returns the original request URL with the fragment, " -"if it was present." +"Request.full_url is a property with setter, getter and a deleter. " +"Getting :attr:`~Request.full_url` returns the original request URL with the " +"fragment, if it was present." msgstr "" "Request.full_url は、 setter, getter, deleter を持つプロパティです。もし存在" "すれば、 :attr:`~Request.full_url` はオリジナルのリクエスト URL フラグメント" @@ -877,8 +943,8 @@ msgstr "" #: ../../library/urllib.request.rst:564 msgid "" -"boolean, indicates whether the request is unverifiable as defined by :rfc:" -"`2965`." +"boolean, indicates whether the request is unverifiable as defined " +"by :rfc:`2965`." msgstr "" "リクエストが :rfc:`2965` で定義された証明不能 (unverifiable) であるかどうかを" "示す論理値です。" @@ -894,8 +960,8 @@ msgid "" "argument." msgstr "" "HTTP リクエストで使うメソッドです。\n" -"デフォルト値は :const:`None` で、このときは使うメソッドを :meth:`~Request." -"get_method` が通常の方法で決定するということになります。\n" +"デフォルト値は :const:`None` で、このときは使うメソッド" +"を :meth:`~Request.get_method` が通常の方法で決定するということになります。\n" "この値を設定する (従って :meth:`~Request.get_method` のデフォルトの決定を上書" "きする) 方法は、 :class:`Request` サブクラスでのクラスレベルの設定処理でデ" "フォルト値を提供するか、 :class:`Request` のコンストラクタの *method* 引数へ" @@ -911,10 +977,10 @@ msgstr "" #: ../../library/urllib.request.rst:586 msgid "" -"Return a string indicating the HTTP request method. If :attr:`Request." -"method` is not ``None``, return its value, otherwise return ``'GET'`` if :" -"attr:`Request.data` is ``None``, or ``'POST'`` if it's not. This is only " -"meaningful for HTTP requests." +"Return a string indicating the HTTP request method. " +"If :attr:`Request.method` is not ``None``, return its value, otherwise " +"return ``'GET'`` if :attr:`Request.data` is ``None``, or ``'POST'`` if it's " +"not. This is only meaningful for HTTP requests." msgstr "" "HTTP リクエストメソッドを示す文字列を返します。:attr:`Request.method` が " "``None`` でなければその値を返します。そうでない場合、:attr:`Request.data` が " @@ -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,22 +1082,30 @@ 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 " "errors are a special case). Note that, in the following, *protocol* should " -"be replaced with the actual protocol to handle, for example :meth:" -"`http_response` would be the HTTP protocol response handler. Also *type* " -"should be replaced with the actual HTTP code, for example :meth:" -"`http_error_404` would handle HTTP 404 errors." +"be replaced with the actual protocol to handle, for " +"example :meth:`http_response` would be the HTTP protocol response handler. " +"Also *type* 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,52 +1198,65 @@ 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 "" +"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 "" -"In fact, the above algorithm is first tried for methods named :meth:" -"`~BaseHandler.default_open`. If all such methods return :const:`None`, the " -"algorithm is repeated for methods named like :meth:`!_open`. If " -"all such methods return :const:`None`, the algorithm is repeated for methods " +"In fact, the above algorithm is first tried for methods " +"named :meth:`~BaseHandler.default_open`. If all such methods " +"return :const:`None`, the algorithm is repeated for methods named " +"like :meth:`!_open`. If 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." +"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` " +"and :meth:`~OpenerDirector.error` methods." msgstr "" -"これらのメソッドの実装には、親となる :class:`OpenerDirector` インスタンスの :" -"meth:`~OpenDirector.open` や :meth:`~OpenDirector.error` といったメソッド呼び" -"出しが入る場合があるので注意してください。" +"これらのメソッドの実装には、親となる :class:`OpenerDirector` インスタンス" +"の :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,20 +1280,22 @@ 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 "" "The convention has been adopted that subclasses defining :meth:`!" -"_request` or :meth:`!_response` methods are named :class:" -"`!\\*Processor`; all others are named :class:`!\\*Handler`." +"_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,15 +1313,22 @@ 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 " -"return value of the :meth:`~OpenerDirector.open` method of :class:" -"`OpenerDirector`, or ``None``. It should raise :exc:`~urllib.error." -"URLError`, unless a truly exceptional thing happens (for example, :exc:" -"`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." +"This method, if implemented, will be called by the " +"parent :class:`OpenerDirector`. It should return a file-like object as " +"described in the return value of the :meth:`~OpenerDirector.open` method " +"of :class:`OpenerDirector`, or ``None``. It should " +"raise :exc:`~urllib.error.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." @@ -1239,10 +1346,12 @@ msgstr "" #: ../../library/urllib.request.rst:810 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`~BaseHandler.default_open`." +"This method, if defined, will be called by the " +"parent :class:`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 "" @@ -1256,9 +1365,9 @@ msgstr "" #: ../../library/urllib.request.rst:820 msgid "" -"This method, if implemented, will be called by the :attr:`parent` :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`default_open`." +"This method, if implemented, will be called by " +"the :attr:`parent` :class:`OpenerDirector`. Return values should be the " +"same as for :meth:`default_open`." msgstr "" "このメソッドが定義されていた場合、 :attr:`parent` :class:`OpenerDirector` か" "ら呼び出されます。戻り値は :meth:`default_open` と同じでなければなりません。" @@ -1267,9 +1376,9 @@ msgstr "" msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " -"HTTP errors. It will be called automatically by the :class:" -"`OpenerDirector` getting the error, and should not normally be called in " -"other circumstances." +"HTTP errors. It will be called automatically by " +"the :class:`OpenerDirector` getting the error, and should not normally be " +"called in other circumstances." msgstr "" "このメソッドは :class:`BaseHandler` では定義されて *いません* 。しかしその他" "の処理されなかった HTTP エラーを処理する機能をもたせたいなら、サブクラスで定" @@ -1290,8 +1399,8 @@ msgstr "" #: ../../library/urllib.request.rst:837 msgid "" -"Return values and exceptions raised should be the same as those of :func:" -"`urlopen`." +"Return values and exceptions raised should be the same as those " +"of :func:`urlopen`." msgstr "" "返される値および送出される例外は :func:`urlopen` と同じものでなければなりませ" "ん。" @@ -1315,9 +1424,11 @@ msgstr "" #: ../../library/urllib.request.rst:850 msgid "" -"Arguments, return values and exceptions raised should be the same as for :" -"meth:`~BaseHandler.http_error_default`." +"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 "" @@ -1330,30 +1441,29 @@ msgstr "" #: ../../library/urllib.request.rst:861 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. The return value " -"should be a :class:`Request` object." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. The " +"return value should be a :class:`Request` object." msgstr "" "このメソッドが定義されていると、親となる :class:`OpenerDirector` から呼び出さ" -"れます。その際、 *req* は :class:`Request` オブジェクトになります。戻り値は :" -"class:`Request` オブジェクトでなければなりません。" +"れます。その際、 *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 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " -"be an object implementing the same interface as the return value of :func:" -"`urlopen`. The return value should implement the same interface as the " -"return value of :func:`urlopen`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. " +"*response* will be an object implementing the same interface as the return " +"value of :func:`urlopen`. The return value should implement the same " +"interface as the return value of :func:`urlopen`." msgstr "" "このメソッドが定義されていると、親となる :class:`OpenerDirector` から呼び出さ" "れます。その際、 *req* は :class:`Request` オブジェクトになります。 " @@ -1365,16 +1475,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,25 +1491,38 @@ 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\\*` " "methods when a redirection is received from the server. If a redirection " "should take place, return a new :class:`Request` to allow :meth:`!" -"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, raise :" -"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 "" +"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, " +"raise :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 "" -"The default implementation of this method does not strictly follow :rfc:" -"`2616`, which says that 301 and 302 responses to ``POST`` requests must not " -"be automatically redirected without confirmation by the user. In reality, " -"browsers do allow automatic redirection of these responses, changing the " -"POST to a ``GET``, and the default implementation reproduces this behavior." +"The default implementation of this method does not strictly " +"follow :rfc:`2616`, which says that 301 and 302 responses to ``POST`` " +"requests must not be automatically redirected without confirmation by the " +"user. In reality, browsers do allow automatic redirection of these " +"responses, changing the POST to a ``GET``, and the default implementation " +"reproduces this behavior." msgstr "" "このメソッドのデフォルトの実装は、 :rfc:`2616` に厳密に従ったものではありませ" "ん。 :rfc:`2616` では、 ``POST`` リクエストに対する 301 および 302 応答が、" @@ -1416,8 +1538,8 @@ msgid "" "response." msgstr "" "``Location:`` か ``URI:`` のURL にリダイレクトします。このメソッドは HTTP に" -"おける 'moved permanently' レスポンスを取得した際に 親オブジェクトとなる :" -"class:`OpenerDirector` によって呼び出されます。" +"おける 'moved permanently' レスポンスを取得した際に 親オブジェクトとな" +"る :class:`OpenerDirector` によって呼び出されます。" #: ../../library/urllib.request.rst:923 msgid "" @@ -1433,19 +1555,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 +1598,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" @@ -1479,11 +1611,11 @@ msgstr "HTTPPasswordMgr オブジェクト" #: ../../library/urllib.request.rst:980 msgid "" -"These methods are available on :class:`HTTPPasswordMgr` and :class:" -"`HTTPPasswordMgrWithDefaultRealm` objects." +"These methods are available on :class:`HTTPPasswordMgr` " +"and :class:`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -"以下のメソッドは :class:`HTTPPasswordMgr` および :class:" -"`HTTPPasswordMgrWithDefaultRealm` オブジェクトで利用できます。" +"以下のメソッドは :class:`HTTPPasswordMgr` およ" +"び :class:`HTTPPasswordMgrWithDefaultRealm` オブジェクトで利用できます。" #: ../../library/urllib.request.rst:986 msgid "" @@ -1519,22 +1651,20 @@ 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 "" -"*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." -"add_password`. *is_authenticated* sets the initial value of the " -"``is_authenticated`` flag for the given URI or list of URIs. If " -"*is_authenticated* is specified as ``True``, *realm* is ignored." +"*realm*, *uri*, *user*, *passwd* are as " +"for :meth:`HTTPPasswordMgr.add_password`. *is_authenticated* sets the " +"initial value of the ``is_authenticated`` flag for the given URI or list of " +"URIs. If *is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" "*realm*, *uri*, *user*, *passwd* は :meth:`HTTPPasswordMgr.add_password` のも" "のと同じです。\n" @@ -1548,11 +1678,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 "" @@ -1568,8 +1697,8 @@ msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " "information about the realm is included in the request, *host* specifies the " -"URL and path to authenticate for, *req* should be the (failed) :class:" -"`Request` object, and *headers* should be the error headers." +"URL and path to authenticate for, *req* should be the " +"(failed) :class:`Request` object, and *headers* should be the error headers." msgstr "" "ユーザ名/パスワードを取得し、再度サーバへのリクエストを試みることで、サーバ" "からの認証リクエストを処理します。 *authreq* はリクエストにおいて レルムに関" @@ -1586,9 +1715,9 @@ msgid "" msgstr "" "*host* は、オーソリティ (例 ``\"python.org\"``) か、オーソリティコンポーネン" "トを含む URL (例 ``\"http://python.org\"``) です。どちらの場合も、オーソリ" -"ティはユーザ情報コンポーネントを含んではいけません (なので、 ``\"python." -"org\"`` や ``\"python.org:80\"`` は正しく、 ``\"joe:password@python.org\"`` " -"は不正です) 。" +"ティはユーザ情報コンポーネントを含んではいけません (なので、 " +"``\"python.org\"`` や ``\"python.org:80\"`` は正しく、 " +"``\"joe:password@python.org\"`` は不正です) 。" #: ../../library/urllib.request.rst:1060 msgid "HTTPBasicAuthHandler Objects" @@ -1615,9 +1744,9 @@ msgid "" "should be the error headers." msgstr "" "*authreq* はリクエストにおいてレルムに関する情報が含まれているヘッダーの名" -"前、 *host* は認証を行う対象のホスト名、 *req* は (失敗した) :class:" -"`Request` オブジェクト、そして *headers* はエラーヘッダーでなくてはなりませ" -"ん。" +"前、 *host* は認証を行う対象のホスト名、 *req* は (失敗し" +"た) :class:`Request` オブジェクト、そして *headers* はエラーヘッダーでなくて" +"はなりません。" #: ../../library/urllib.request.rst:1096 msgid "HTTPDigestAuthHandler Objects" @@ -1633,9 +1762,11 @@ msgstr "HTTPHandler オブジェクト" #: ../../library/urllib.request.rst:1123 msgid "" -"Send an HTTP request, which can be either GET or POST, depending on ``req." -"data``." +"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" @@ -1643,9 +1774,11 @@ msgstr "HTTPSHandler オブジェクト" #: ../../library/urllib.request.rst:1135 msgid "" -"Send an HTTPS request, which can be either GET or POST, depending on ``req." -"data``." +"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 +1797,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 +1812,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" @@ -1731,9 +1872,13 @@ msgstr "エラーコード 200 の場合、レスポンスオブジェクトを msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " -"Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." -"error.HTTPError` if no other handler handles the error." +"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 +1903,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 +1931,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 "" @@ -1816,9 +1969,11 @@ msgstr "" #: ../../library/urllib.request.rst:1275 msgid "" -"It is also possible to achieve the same result without using the :term:" -"`context manager` approach::" +"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 +2000,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 +2009,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 +2046,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,15 +2073,32 @@ 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 "" -":func:`build_opener` provides many handlers by default, including a :class:" -"`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " -"variables named ``_proxy``, where ```` is the URL scheme " -"involved. For example, the :envvar:`!http_proxy` environment variable is " -"read to obtain the HTTP proxy's URL." +":func:`build_opener` provides many handlers by default, including " +"a :class:`ProxyHandler`. By default, :class:`ProxyHandler` uses the " +"environment variables named ``_proxy``, where ```` is the " +"URL scheme 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,10 +2110,9 @@ msgstr "" "したプロキシ URL を使うようにし、 :class:`ProxyBasicAuthHandler` でプロキシ認" "証サポートを追加します。 ::" -#: ../../library/urllib.request.rst:1343 msgid "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." -"com:3128/'})\n" +"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" @@ -1935,6 +2121,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 +2160,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,17 +2167,23 @@ 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 "" -"Also, remember that a few standard headers (:mailheader:`Content-Length`, :" -"mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" -"`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." +"Also, remember that a few standard headers (:mailheader:`Content-" +"Length`, :mailheader:`Content-Type` and :mailheader:`Host`) are added when " +"the :class:`Request` is passed to :func:`urlopen` " +"(or :meth:`OpenerDirector.open`)." msgstr "" "また、 :class:`Request` が :func:`urlopen` (や :meth:`OpenerDirector.open`)に" -"渡される際には、いくつかの標準ヘッダー (:mailheader:`Content-Length`, :" -"mailheader:`Content-Type` および :mailheader:`Host`) も追加されることを忘れな" -"いでください。" +"渡される際には、いくつかの標準ヘッダー (:mailheader:`Content-" +"Length`, :mailheader:`Content-Type` および :mailheader:`Host`) も追加されるこ" +"とを忘れないでください。" #: ../../library/urllib.request.rst:1381 msgid "" @@ -2038,8 +2238,8 @@ msgstr "" msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" -">>> opener = urllib.request.build_opener(urllib.request." -"ProxyHandler(proxies))\n" +">>> opener = " +"urllib.request.build_opener(urllib.request.ProxyHandler(proxies))\n" ">>> with opener.open(\"http://www.python.org\") as f:\n" "... f.read().decode('utf-8')\n" "..." @@ -2066,27 +2266,32 @@ 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 "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " "Return a tuple ``(filename, headers)`` where *filename* is the local file " -"name under which the object can be found, and *headers* is whatever the :" -"meth:`!info` method of the object returned by :func:`urlopen` returned (for " -"a remote object). Exceptions are the same as for :func:`urlopen`." +"name under which the object can be found, and *headers* is whatever " +"the :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 +2302,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::" @@ -2105,8 +2319,8 @@ msgstr "以下は最も一般的な使用例です::" #: ../../library/urllib.request.rst:1449 msgid "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://python." -"org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://" +"python.org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" msgstr "" @@ -2115,15 +2329,15 @@ msgstr "" msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must be a bytes object in standard :" -"mimetype:`application/x-www-form-urlencoded` format; see the :func:`urllib." -"parse.urlencode` function." +"type is ``GET``). The *data* argument must be a bytes object in " +"standard :mimetype:`application/x-www-form-urlencoded` format; see " +"the :func:`urllib.parse.urlencode` function." msgstr "" "*url* が :file:`http:` スキーム識別子を使用していた場合、任意の引数 *data* " "は ``POST`` リクエストの指定に使用される場合があります (通常のリクエストタイ" "プは ``GET`` です)。引数 *data* は標準 :mimetype:`application/x-www-form-" -"urlencoded` 形式のバイトオブジェクトでなければなりません。 :func:`urllib." -"parse.urlencode` 関数を参照してください。" +"urlencoded` 形式のバイトオブジェクトでなければなりませ" +"ん。 :func:`urllib.parse.urlencode` 関数を参照してください。" #: ../../library/urllib.request.rst:1460 msgid "" @@ -2132,6 +2346,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 +2366,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 "" @@ -2225,9 +2445,9 @@ msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " "text or (for example) HTML. The HTTP protocol provides type information in " -"the reply header, which can be inspected by looking at the :mailheader:" -"`Content-Type` header. If the returned data is HTML, you can use the " -"module :mod:`html.parser` to parse it." +"the reply header, which can be inspected by looking at " +"the :mailheader:`Content-Type` header. If the returned data is HTML, you " +"can use the module :mod:`html.parser` to parse it." msgstr "" ":func:`urlopen` あるいは :func:`urlretrieve` が返すデータはサーバーから返され" "た生データです。これは (画像のような) バイナリ、プレーンテキスト、あるいは " @@ -2252,6 +2472,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" @@ -2261,15 +2492,15 @@ msgstr ":mod:`urllib.response` --- urllib で使用するレスポンスクラ msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " -"Functions defined by this module are used internally by the :mod:`urllib." -"request` module. The typical response object is a :class:`urllib.response." -"addinfourl` instance:" +"Functions defined by this module are used internally by " +"the :mod:`urllib.request` module. The typical response object is " +"a :class:`urllib.response.addinfourl` instance:" msgstr "" ":mod:`urllib.response` モジュールは、``read()`` および ``readline()`` を含む " "最小限のファイルライクインターフェースを定義する関数およびクラスを定義してい" "ます。このモジュールで定義された関数は、:mod:`urllib.request` モジュール内で" -"使用されます。代表的なレスポンスオブジェクトは :class:`urllib.response." -"addinfourl` インスタンスです。" +"使用されます。代表的なレスポンスオブジェクト" +"は :class:`urllib.response.addinfourl` インスタンスです。" #: ../../library/urllib.request.rst:1551 msgid "" @@ -2281,8 +2512,8 @@ msgstr "" #: ../../library/urllib.request.rst:1555 msgid "" -"Returns the headers of the response in the form of an :class:`~email.message." -"EmailMessage` instance." +"Returns the headers of the response in the form of " +"an :class:`~email.message.EmailMessage` instance." msgstr "" #: ../../library/urllib.request.rst:1561 diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 001a5b950..e07f5748d 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 @@ -45,17 +45,16 @@ msgid "" msgstr "" "このモジュールでは単一のクラス、 :class:`RobotFileParser` を提供します。この" "クラスは、特定のユーザエージェントが :file:`robots.txt` ファイルを公開してい" -"る Web サイトのある URL を取得可能かどうかの質問に答えます。 :file:`robots." -"txt` ファイルの構造に関する詳細は http://www.robotstxt.org/orig.html を参照し" -"てください。" +"る Web サイトのある URL を取得可能かどうかの質問に答えま" +"す。 :file:`robots.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*." +"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..73d83f4d4 100644 --- a/library/uu.po +++ b/library/uu.po @@ -12,25 +12,28 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..3a49866f4 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -18,43 +18,48 @@ 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 " "corresponding to a specific UUID version as specified in :rfc:`9562` (which " -"supersedes :rfc:`4122`), for example, :func:`uuid1` for UUID version 1, :" -"func:`uuid3` for UUID version 3, and so on. Note that UUID version 2 is " +"supersedes :rfc:`4122`), for example, :func:`uuid1` for UUID version " +"1, :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 "" -"If all you want is a unique ID, you should probably call :func:`uuid1` or :" -"func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " +"If all you want is a unique ID, you should probably call :func:`uuid1` " +"or :func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " "creates a UUID containing the computer's network address. :func:`uuid4` " "creates a random UUID." msgstr "" -"もしユニークな ID が必要なだけであれば、おそらく :func:`uuid1` か :func:" -"`uuid4` を呼び出せば良いでしょう。 :func:`uuid1` はコンピュータのネットワーク" -"アドレスを含む UUID を生成するためにプライバシーを侵害するかもしれない点に注" -"意してください。 :func:`uuid4` はランダムな UUID を生成します。" +"もしユニークな ID が必要なだけであれば、おそらく :func:`uuid1` " +"か :func:`uuid4` を呼び出せば良いでしょう。 :func:`uuid1` はコンピュータの" +"ネットワークアドレスを含む 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,31 +118,44 @@ 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 "" -"Comparison of UUID objects are made by way of comparing their :attr:`UUID." -"int` attributes. Comparison with a non-UUID object raises a :exc:" -"`TypeError`." +"Comparison of UUID objects are made by way of comparing " +"their :attr:`UUID.int` attributes. Comparison with a non-UUID object raises " +"a :exc:`TypeError`." 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,43 +236,41 @@ 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 "" "The UUID variant, which determines the internal layout of the UUID. This " -"will be one of the constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :" -"const:`RESERVED_MICROSOFT`, or :const:`RESERVED_FUTURE`." +"will be one of the " +"constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, " +"or :const:`RESERVED_FUTURE`." msgstr "" -"UUID の内部レイアウトを決定する UUID の variant。これは定数 :const:" -"`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, :const:" -"`RESERVED_FUTURE` のいずれかです。" +"UUID の内部レイアウトを決定する UUID の variant。これは定" +"数 :const:`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`)." +"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 +282,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 "" @@ -306,8 +336,8 @@ msgstr "" #: ../../library/uuid.rst:223 msgid "" -"Generate a UUID from a sequence number and the current time according to :" -"rfc:`9562`. This is an alternative to :func:`uuid1` to improve database " +"Generate a UUID from a sequence number and the current time according " +"to :rfc:`9562`. This is an alternative to :func:`uuid1` to improve database " "locality." msgstr "" @@ -318,30 +348,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 +426,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`." +"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 +447,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 +481,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 +496,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." +"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." +"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 +588,8 @@ msgid "" "datetime.datetime(...)" msgstr "" -#: ../../library/uuid.rst:452 msgid "Command-Line Example" -msgstr "" +msgstr "コマンドラインでの使用例" #: ../../library/uuid.rst:454 msgid "" @@ -556,7 +597,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 +610,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..5d2e044cb 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,37 +115,39 @@ 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 "" "This creates the target directory (including parent directories as needed) " "and places a :file:`pyvenv.cfg` file in it with a ``home`` key pointing to " -"the Python installation from which the command was run. It also creates a :" -"file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy or " -"symlink of the Python executable (as appropriate for the platform or " +"the Python installation from which the command was run. It also creates " +"a :file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy " +"or symlink of the Python executable (as appropriate for the platform or " "arguments used at environment creation time). It also creates a :file:`lib/" "pythonX.Y/site-packages` subdirectory (on Windows, this is :file:`Lib\\site-" "packages`). If an existing directory is specified, it will be re-used." @@ -148,19 +158,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 +224,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 +236,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 "" @@ -258,8 +273,8 @@ msgid "" "script by setting the execution policy for the user. You can do this by " "issuing the following PowerShell command:" msgstr "" -"Microsoft Windows では、ユーザー向けの実行ポリシーを設定して ``Activate." -"ps1`` スクリプトが使えるようにする必要があるかもしれません。\n" +"Microsoft Windows では、ユーザー向けの実行ポリシーを設定して " +"``Activate.ps1`` スクリプトが使えるようにする必要があるかもしれません。\n" "この設定は次の PowerShell コマンドでできます:" #: ../../library/venv.rst:170 @@ -282,14 +297,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 "" @@ -306,20 +323,21 @@ msgstr "仮想環境のしくみ" #: ../../library/venv.rst:194 msgid "" -"When a Python interpreter is running from a virtual environment, :data:`sys." -"prefix` and :data:`sys.exec_prefix` point to the directories of the virtual " -"environment, whereas :data:`sys.base_prefix` and :data:`sys." -"base_exec_prefix` point to those of the base Python used to create the " -"environment. It is sufficient to check ``sys.prefix != sys.base_prefix`` to " -"determine if the current interpreter is running from a virtual environment." +"When a Python interpreter is running from a virtual " +"environment, :data:`sys.prefix` and :data:`sys.exec_prefix` point to the " +"directories of the virtual environment, whereas :data:`sys.base_prefix` " +"and :data:`sys.base_exec_prefix` point to those of the base Python used to " +"create the environment. It is sufficient to check ``sys.prefix != " +"sys.base_prefix`` to determine if the current interpreter is running from a " +"virtual environment." msgstr "" -"Python インタプリタが仮想環境で実行しているとき、:data:`sys.prefix` と :data:" -"`sys.exec_prefix` は仮想環境のディレクトリを指し示し、 :data:`sys." -"base_prefix` と :data:`sys.base_exec_prefix` は仮想環境の作成に使われたベー" -"ス Python のディレクトリを指し示します。``sys.prefix != sys.base_prefix`` を" -"調べれば、現在のインタプリタが仮想環境で実行しているかを判定できます。" +"Python インタプリタが仮想環境で実行しているとき、:data:`sys.prefix` " +"と :data:`sys.exec_prefix` は仮想環境のディレクトリを指し示" +"し、 :data:`sys.base_prefix` と :data:`sys.base_exec_prefix` は仮想環境の作成" +"に使われたベース 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 +347,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 +397,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`" @@ -425,14 +450,23 @@ msgstr "" #: ../../library/venv.rst:241 msgid "" "In order to achieve this, scripts installed into virtual environments have a " -"\"shebang\" line which points to the environment's Python interpreter, :samp:" -"`#!/{}/bin/python`. This means that the script will run with " -"that interpreter regardless of the value of :envvar:`PATH`. On Windows, " -"\"shebang\" line processing is supported if you have the :ref:`launcher` " -"installed. Thus, double-clicking an installed script in a Windows Explorer " -"window should run it with the correct interpreter without the environment " -"needing to be activated or on the :envvar:`PATH`." -msgstr "" +"\"shebang\" line which points to the environment's Python " +"interpreter, :samp:`#!/{}/bin/python`. This means that the " +"script will run with that interpreter regardless of the value " +"of :envvar:`PATH`. On Windows, \"shebang\" line processing is supported if " +"you have the :ref:`launcher` installed. Thus, double-clicking an installed " +"script in a Windows Explorer 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 "" @@ -493,12 +527,12 @@ msgstr "API" msgid "" "The high-level method described above makes use of a simple API which " "provides mechanisms for third-party virtual environment creators to " -"customize environment creation according to their needs, the :class:" -"`EnvBuilder` class." +"customize environment creation according to their needs, " +"the :class:`EnvBuilder` class." msgstr "" "上述の高水準のメソッドは、サードパーティの仮想環境の作成者が環境の作成を必要" -"に応じてカスタマイズするための機構を提供する簡素な API を利用します。それが :" -"class:`EnvBuilder` クラスです。" +"に応じてカスタマイズするための機構を提供する簡素な API を利用します。それ" +"が :class:`EnvBuilder` クラスです。" #: ../../library/venv.rst:291 msgid "" @@ -513,18 +547,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 +572,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 +582,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 +592,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 +630,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 +655,6 @@ msgstr "" ":class:`EnvBuilder` クラスの ``create`` メソッドは、サブクラスのカスタマイズ" "に使えるフックを説明します::" -#: ../../library/venv.rst:349 msgid "" "def create(self, env_dir):\n" " \"\"\"\n" @@ -614,16 +668,27 @@ 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 "" -"Each of the methods :meth:`ensure_directories`, :meth:" -"`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" -"meth:`post_setup` can be overridden." +"Each of the " +"methods :meth:`ensure_directories`, :meth:`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` " +"and :meth:`post_setup` can be overridden." msgstr "" -"メソッド :meth:`ensure_directories`, :meth:`create_configuration`, :meth:" -"`setup_python`, :meth:`setup_scripts`, :meth:`post_setup` はそれぞれオーバー" -"ライドできます。" +"メソッ" +"ド :meth:`ensure_directories`, :meth:`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts`, :meth:`post_setup` " +"はそれぞれオーバーライドできます。" #: ../../library/venv.rst:367 msgid "" @@ -636,17 +701,18 @@ msgid "" msgstr "" "仮想環境のディレクトリとすべての必要なサブディレクトリのうちまだ存在しないも" "のを作成し、コンテキストオブジェクトを返します。このコンテキストオブジェクト" -"は他のメソッドで使うために(パスなどの)属性を保持しているだけです。もし :" -"class:`EnvBuilder` が ``clear=True`` の引数で作成された場合、仮想環境のディレ" -"クトリの中身は消去され、すべての必要なサブディレクトリが再作成されます。" +"は他のメソッドで使うために(パスなどの)属性を保持しているだけです。も" +"し :class:`EnvBuilder` が ``clear=True`` の引数で作成された場合、仮想環境の" +"ディレクトリの中身は消去され、すべての必要なサブディレクトリが再作成されま" +"す。" #: ../../library/venv.rst:374 msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" msgstr "" -"返されるコンテキストオブジェクトは以下の属性を持った :class:`types." -"SimpleNamespace` です:" +"返されるコンテキストオブジェクトは以下の属性を持っ" +"た :class:`types.SimpleNamespace` です:" #: ../../library/venv.rst:377 msgid "" @@ -708,8 +774,8 @@ msgstr "" #: ../../library/venv.rst:400 msgid "" "``env_exe`` - The name of the Python interpreter in the virtual environment. " -"Used for ``__VENV_PYTHON__`` in activation scripts (see :meth:" -"`install_scripts`)." +"Used for ``__VENV_PYTHON__`` in activation scripts " +"(see :meth:`install_scripts`)." msgstr "" "``env_exe`` - 仮想環境の中の Python インタプリタの名前。アクティベートスクリ" "プトの中の ``__VENV_PYTHON__`` で使われます(:meth:`install_scripts` を参照し" @@ -763,16 +829,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 +853,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 +869,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 +918,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 +943,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:" @@ -881,24 +954,24 @@ msgid "" "Create an :class:`EnvBuilder` with the given keyword arguments, and call " "its :meth:`~EnvBuilder.create` method with the *env_dir* argument." msgstr "" -":class:`EnvBuilder` を指定されたキーワード引数を使って作成し、その :meth:" -"`~EnvBuilder.create` メソッドに *env_dir* 引数を渡して実行します。" +":class:`EnvBuilder` を指定されたキーワード引数を使って作成し、そ" +"の :meth:`~EnvBuilder.create` メソッドに *env_dir* 引数を渡して実行します。" #: ../../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``" @@ -976,8 +1049,8 @@ msgid "" " \"\"\"\n" " Read lines from a subprocess' output stream and either pass to a " "progress\n" -" callable (if specified) or write progress information to sys." -"stderr.\n" +" callable (if specified) or write progress information to " +"sys.stderr.\n" " \"\"\"\n" " progress = self.progress\n" " while True:\n" @@ -1038,8 +1111,8 @@ msgid "" " url = \"https://bootstrap.pypa.io/ez_setup.py\"\n" " self.install_script(context, 'setuptools', url)\n" " # clear up the setuptools archive which gets downloaded\n" -" pred = lambda o: o.startswith('setuptools-') and o.endswith('.tar." -"gz')\n" +" pred = lambda o: o.startswith('setuptools-') and " +"o.endswith('.tar.gz')\n" " files = filter(pred, os.listdir(context.bin_path))\n" " for f in files:\n" " f = os.path.join(context.bin_path, f)\n" diff --git a/library/warnings.po b/library/warnings.po index 077ff3b14..9cd8a198e 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 @@ -51,8 +51,8 @@ msgstr "" #: ../../library/warnings.rst:18 msgid "" "Python programmers issue warnings by calling the :func:`warn` function " -"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; see :ref:" -"`exceptionhandling` for details)." +"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; " +"see :ref:`exceptionhandling` for details)." msgstr "" "Python プログラマは、このモジュールの :func:`warn` 関数を使って警告を発するこ" "とができます。(C 言語のプログラマは :c:func:`PyErr_WarnEx` を使います; 詳細" @@ -62,8 +62,8 @@ msgstr "" msgid "" "Warning messages are normally written to :data:`sys.stderr`, but their " "disposition can be changed flexibly, from ignoring all warnings to turning " -"them into exceptions. The disposition of warnings can vary based on the :" -"ref:`warning category `, the text of the warning " +"them into exceptions. The disposition of warnings can vary based on " +"the :ref:`warning category `, the text of the warning " "message, and the source location where it is issued. Repetitions of a " "particular warning for the same source location are typically suppressed." msgstr "" @@ -87,11 +87,11 @@ msgstr "" #: ../../library/warnings.rst:33 msgid "" -"The determination whether to issue a warning message is controlled by the :" -"ref:`warning filter `, which is a sequence of matching rules " -"and actions. Rules can be added to the filter by calling :func:" -"`filterwarnings` and reset to its default state by calling :func:" -"`resetwarnings`." +"The determination whether to issue a warning message is controlled by " +"the :ref:`warning filter `, which is a sequence of matching " +"rules and actions. Rules can be added to the filter by " +"calling :func:`filterwarnings` and reset to its default state by " +"calling :func:`resetwarnings`." msgstr "" "警告メッセージを出力するかどうかの決定は、 :ref:`警告フィルタ ` によって制御されます。警告フィルタは一致規則 (matching rule)と動作か" @@ -107,9 +107,9 @@ msgid "" "use by custom implementations." msgstr "" "警告メッセージの印字は :func:`showwarning` を呼び出して行うことができ、この関" -"数は上書きすることができます; この関数の標準の実装では、 :func:" -"`formatwarning` を呼び出して警告メッセージを書式化しますが、この関数について" -"も自作の実装を使うことができます。" +"数は上書きすることができます; この関数の標準の実装で" +"は、 :func:`formatwarning` を呼び出して警告メッセージを書式化しますが、この関" +"数についても自作の実装を使うことができます。" #: ../../library/warnings.rst:44 msgid "" @@ -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\"``" @@ -389,19 +392,19 @@ msgstr "" #: ../../library/warnings.rst:158 msgid "" "*message* is a string containing a regular expression that the start of the " -"warning message must match, case-insensitively. In :option:`-W` and :envvar:" -"`PYTHONWARNINGS`, *message* is a literal string that the start of the " -"warning message must contain (case-insensitively), ignoring any whitespace " -"at the start or end of *message*." +"warning message must match, case-insensitively. In :option:`-W` " +"and :envvar:`PYTHONWARNINGS`, *message* is a literal string that the start " +"of the warning message must contain (case-insensitively), ignoring any " +"whitespace 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,34 +483,39 @@ 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:" -"`PYTHONWARNINGS`), the individual filters are separated by commas and the " -"filters listed later take precedence over those listed before them (as " -"they're applied left-to-right, and the most recently applied filters take " -"precedence over earlier ones)." +"filter`. When listing multiple filters on a single line (as " +"for :envvar:`PYTHONWARNINGS`), the individual filters are separated by " +"commas and the filters listed later take precedence over those listed before " +"them (as 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" @@ -527,17 +547,17 @@ msgid "" "by the :option:`-W` command-line option, the :envvar:`PYTHONWARNINGS` " "environment variable and calls to :func:`filterwarnings`." msgstr "" -"デフォルトで、 Python はいくつかの警告フィルタをインストールします。これは :" -"option:`-W` コマンドラインオプション、:envvar:`PYTHONWARNINGS` 環境変数また" -"は :func:`filterwarnings` の呼び出しでオーバーライドできます。" +"デフォルトで、 Python はいくつかの警告フィルタをインストールします。これ" +"は :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,49 +565,60 @@ 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 "" -":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" -"`PendingDeprecationWarning`." +":exc:`DeprecationWarning` is now ignored by default in addition " +"to :exc:`PendingDeprecationWarning`." 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 " -"running tests or otherwise working on the application. The :data:`sys." -"warnoptions` attribute used to pass filter configurations to the interpreter " -"can be used as a marker to indicate whether or not warnings should be " -"disabled::" +"running tests or otherwise working on the application. " +"The :data:`sys.warnoptions` attribute used to pass filter configurations to " +"the interpreter 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 "" @@ -852,8 +955,8 @@ msgstr "" #: ../../library/warnings.rst:464 ../../library/warnings.rst:490 msgid "" -"*source*, if supplied, is the destroyed object which emitted a :exc:" -"`ResourceWarning`." +"*source*, if supplied, is the destroyed object which emitted " +"a :exc:`ResourceWarning`." msgstr "" "*source* 引数が与えられた場合、これは :exc:`ResourceWarning` を発生させた破壊" "されたオブジェクトです。" @@ -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 "" @@ -907,10 +1009,10 @@ msgid "" "Write a warning to a file. The default implementation calls " "``formatwarning(message, category, filename, lineno, line)`` and writes the " "resulting string to *file*, which defaults to :data:`sys.stderr`. You may " -"replace this function with any callable by assigning to ``warnings." -"showwarning``. *line* is a line of source code to be included in the warning " -"message; if *line* is not supplied, :func:`showwarning` will try to read the " -"line specified by *filename* and *lineno*." +"replace this function with any callable by assigning to " +"``warnings.showwarning``. *line* is a line of source code to be included in " +"the warning message; if *line* is not supplied, :func:`showwarning` will try " +"to read the line specified by *filename* and *lineno*." msgstr "" "警告をファイルに書き込みます。標準の実装では、 ``formatwarning(message, " "category, filename, lineno, line)`` を呼び出し、返された文字列を *file* に書" @@ -924,14 +1026,14 @@ msgstr "" msgid "" "Format a warning the standard way. This returns a string which may contain " "embedded newlines and ends in a newline. *line* is a line of source code to " -"be included in the warning message; if *line* is not supplied, :func:" -"`formatwarning` will try to read the line specified by *filename* and " -"*lineno*." +"be included in the warning message; if *line* is not " +"supplied, :func:`formatwarning` will try to read the line specified by " +"*filename* and *lineno*." msgstr "" "警告を通常の方法で書式化します。返される文字列内には改行が埋め込まれている可" "能性があり、かつ文字列は改行で終端されています。 *line* は警告メッセージに含" -"まれるソースコードの1行です。 *line* が渡されない場合、 :func:" -"`formatwarning` は *filename* と *lineno* から行の取得を試みます。" +"まれるソースコードの1行です。 *line* が渡されない場" +"合、 :func:`formatwarning` は *filename* と *lineno* から行の取得を試みます。" #: ../../library/warnings.rst:519 msgid "" @@ -955,10 +1057,10 @@ msgstr "" #: ../../library/warnings.rst:531 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " -"`. The meaning of the function parameters is as for :func:" -"`filterwarnings`, but regular expressions are not needed as the filter " -"inserted always matches any message in any module as long as the category " -"and line number match." +"`. The meaning of the function parameters is as " +"for :func:`filterwarnings`, but regular expressions are not needed as the " +"filter inserted always matches any message in any module as long as the " +"category and line number match." msgstr "" "単純なエントリを :ref:`警告フィルタ仕様 ` のリストに挿入しま" "す。引数の意味は :func:`filterwarnings` と同じですが、この関数により挿入され" @@ -972,26 +1074,28 @@ msgid "" "options and calls to :func:`simplefilter`." msgstr "" "警告フィルタをリセットします。これにより、 :option:`-W` コマンドラインオプ" -"ションによるもの :func:`simplefilter` 呼び出しによるものを含め、 :func:" -"`filterwarnings` の呼び出しによる影響はすべて無効化されます。" +"ションによるもの :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,19 +1141,28 @@ 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 "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " -"overload, the decorator must be after the :func:`@overload ` decorator for the attribute to exist on the overload as returned " -"by :func:`typing.get_overloads`." +"overload, the decorator must be after the :func:`@overload " +"` decorator for the attribute to exist on the overload as " +"returned 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" @@ -1043,20 +1171,21 @@ msgstr "利用可能なコンテキストマネージャー" #: ../../library/warnings.rst:600 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " -"and the :func:`showwarning` function. If the *record* argument is :const:" -"`False` (the default) the context manager returns :class:`None` on entry. If " -"*record* is :const:`True`, a list is returned that is progressively " -"populated with objects as seen by a custom :func:`showwarning` function " -"(which also suppresses output to ``sys.stdout``). Each object in the list " -"has attributes with the same names as the arguments to :func:`showwarning`." +"and the :func:`showwarning` function. If the *record* argument " +"is :const:`False` (the default) the context manager returns :class:`None` on " +"entry. If *record* is :const:`True`, a list is returned that is " +"progressively populated with objects as seen by a custom :func:`showwarning` " +"function (which also suppresses output to ``sys.stdout``). Each object in " +"the list has attributes with the same names as the arguments " +"to :func:`showwarning`." msgstr "" "警告フィルタと :func:`showwarning` 関数をコピーし、終了時に復元するコンテキス" "トマネージャーです。 *record* 引数が :const:`False` (デフォルト値)だった場" -"合、コンテキスト開始時には :const:`None` を返します。もし *record* が :const:" -"`True` だった場合、リストを返します。このリストにはカスタムの :func:" -"`showwarning` 関数(この関数は同時に ``sys.stdout`` への出力を抑制します)に" -"よってオブジェクトが継続的に追加されます。リストの中の各オブジェクトは、 :" -"func:`showwarning` 関数の引数と同じ名前の属性を持っています。" +"合、コンテキスト開始時には :const:`None` を返します。もし *record* " +"が :const:`True` だった場合、リストを返します。このリストにはカスタム" +"の :func:`showwarning` 関数(この関数は同時に ``sys.stdout`` への出力を抑制し" +"ます)によってオブジェクトが継続的に追加されます。リストの中の各オブジェクト" +"は、 :func:`showwarning` 関数の引数と同じ名前の属性を持っています。" #: ../../library/warnings.rst:609 msgid "" @@ -1064,50 +1193,58 @@ msgid "" "returned when you import :mod:`warnings` whose filter will be protected. " "This argument exists primarily for testing the :mod:`warnings` module itself." msgstr "" -"*module* 引数は、保護したいフィルタを持つモジュールを取ります。 :mod:" -"`warnings` を import して得られるモジュールの代わりに利用されます。この引数" -"は、主に :mod:`warnings` モジュール自体をテストする目的で追加されました。" +"*module* 引数は、保護したいフィルタを持つモジュールを取りま" +"す。 :mod:`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 "" - -#: ../../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 " -"manager behaves in a concurrent-safe fashion and otherwise not. Concurrent-" -"safe means that it is both thread-safe and safe to use within :ref:`asyncio " -"coroutines ` and tasks. Being thread-safe means that behavior is " -"predictable in a multi-threaded program. The flag defaults to true for free-" -"threaded builds and false otherwise." -msgstr "" +msgstr "コンテキストマネージャーの並行処理の安全性" + +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 manager behaves in a concurrent-safe fashion and otherwise not. " +"Concurrent-safe means that it is both thread-safe and safe to use " +"within :ref:`asyncio coroutines ` and tasks. Being thread-safe " +"means that behavior is 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 "" -"If the :data:`~sys.flags.context_aware_warnings` flag is false, then :class:" -"`catch_warnings` will modify the global attributes of the :mod:`warnings` " -"module. This is not safe if used within a concurrent program (using " -"multiple threads or using asyncio coroutines). For example, if two or more " -"threads use the :class:`catch_warnings` class at the same time, the behavior " -"is undefined." +"If the :data:`~sys.flags.context_aware_warnings` flag is false, " +"then :class:`catch_warnings` will modify the global attributes of " +"the :mod:`warnings` module. This is not safe if used within a concurrent " +"program (using multiple threads or using asyncio coroutines). For example, " +"if two or more threads use the :class:`catch_warnings` class at the same " +"time, the behavior is undefined." msgstr "" #: ../../library/warnings.rst:653 @@ -1119,13 +1256,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,32 +1276,46 @@ 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." +"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." -"thread_inherit_context` flag to true. That flag causes threads created by :" -"class:`threading.Thread` to start with a copy of the context variables from " -"the thread starting it. When true, the context established by :class:" -"`catch_warnings` in one thread will also apply to new threads started by " -"it. If false, new threads will start with an empty warnings context " -"variable, meaning that any filtering that was established by a :class:" -"`catch_warnings` context manager will no longer be active." -msgstr "" +"warnings module will also want to set " +"the :data:`~sys.flags.thread_inherit_context` flag to true. That flag " +"causes threads created by :class:`threading.Thread` to start with a copy of " +"the context variables from the thread starting it. When true, the context " +"established by :class:`catch_warnings` in one thread will also apply to new " +"threads started by it. If false, new threads will start with an empty " +"warnings context 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..36942f650 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." +"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,38 +233,46 @@ 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 " "streams, the *nframes* value must be accurate when the first frame data is " -"written. An accurate *nframes* value can be achieved either by calling :" -"meth:`setnframes` or :meth:`setparams` with the number of frames that will " -"be written before :meth:`close` is called and then using :meth:" -"`writeframesraw` to write the frame data, or by calling :meth:`writeframes` " -"with all of the frame data to be written. In the latter case :meth:" -"`writeframes` will calculate the number of frames in the data and set " -"*nframes* accordingly before writing the frame data." +"written. An accurate *nframes* value can be achieved either by " +"calling :meth:`setnframes` or :meth:`setparams` with the number of frames " +"that will be written before :meth:`close` is called and then " +"using :meth:`writeframesraw` to write the frame data, or by " +"calling :meth:`writeframes` with all of the frame data to be written. In " +"the latter case :meth:`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 "" -"Make sure *nframes* is correct, and close the file if it was opened by :mod:" -"`wave`. This method is called upon object collection. It will raise an " -"exception if the output stream is not seekable and *nframes* does not match " -"the number of frames actually written." +"Make sure *nframes* is correct, and close the file if it was opened " +"by :mod:`wave`. This method is called upon object collection. It will " +"raise an exception if the output stream is not seekable and *nframes* does " +"not match the number of frames actually written." msgstr "" "*nframes* が正しいか確認して、ファイルが :mod:`wave` によって開かれていた場合" "は閉じます。このメソッドはオブジェクトがガベージコレクションされるときに呼び" @@ -310,11 +323,12 @@ msgstr "" #: ../../library/wave.rst:238 msgid "" -"Return current position in the file, with the same disclaimer for the :meth:" -"`Wave_read.tell` and :meth:`Wave_read.setpos` methods." +"Return current position in the file, with the same disclaimer for " +"the :meth:`Wave_read.tell` and :meth:`Wave_read.setpos` methods." msgstr "" -"ファイルの中の現在位置を返します。 :meth:`Wave_read.tell` と :meth:" -"`Wave_read.setpos` メソッドでお断りしたことがこのメソッドにも当てはまります。" +"ファイルの中の現在位置を返します。 :meth:`Wave_read.tell` " +"と :meth:`Wave_read.setpos` メソッドでお断りしたことがこのメソッドにも当ては" +"まります。" #: ../../library/wave.rst:244 msgid "Write audio frames, without correcting *nframes*." @@ -324,22 +338,21 @@ 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 "" -"Note that it is invalid to set any parameters after calling :meth:" -"`writeframes` or :meth:`writeframesraw`, and any attempt to do so will " -"raise :exc:`wave.Error`." +"Note that it is invalid to set any parameters after " +"calling :meth:`writeframes` or :meth:`writeframesraw`, and any attempt to do " +"so will raise :exc:`wave.Error`." msgstr "" ":meth:`writeframes` や :meth:`writeframesraw` メソッドを呼び出したあとで、ど" "んなパラメータを設定しようとしても不正となることに注意して下さい。そうする" diff --git a/library/weakref.po b/library/weakref.po index 8bf50cf1f..2c8382e88 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 @@ -37,8 +37,8 @@ msgid "" "The :mod:`weakref` module allows the Python programmer to create :dfn:`weak " "references` to objects." msgstr "" -":mod:`weakref` モジュールは、Pythonプログラマがオブジェクトへの弱参照 (:dfn:" -"`weak refarence`)を作成できるようにします。" +":mod:`weakref` モジュールは、Pythonプログラマがオブジェクトへの弱参照 " +"(:dfn:`weak refarence`)を作成できるようにします。" #: ../../library/weakref.rst:24 msgid "" @@ -51,11 +51,11 @@ msgstr "" #: ../../library/weakref.rst:27 msgid "" "A weak reference to an object is not enough to keep the object alive: when " -"the only remaining references to a referent are weak references, :term:" -"`garbage collection` is free to destroy the referent and reuse its memory " -"for something else. However, until the object is actually destroyed the " -"weak reference may return the object even if there are no strong references " -"to it." +"the only remaining references to a referent are weak " +"references, :term:`garbage collection` is free to destroy the referent and " +"reuse its memory for something else. However, until the object is actually " +"destroyed the weak reference may return the object even if there are no " +"strong references to it." msgstr "" "オブジェクトへの弱参照があることは、そのオブジェクトを生かしておくのには不十" "分です。リファレントへの参照が弱参照しか残っていない場合、 :term:`garbage " @@ -78,42 +78,42 @@ msgid "" "For example, if you have a number of large binary image objects, you may " "wish to associate a name with each. If you used a Python dictionary to map " "names to images, or images to names, the image objects would remain alive " -"just because they appeared as values or keys in the dictionaries. The :" -"class:`WeakKeyDictionary` and :class:`WeakValueDictionary` classes supplied " -"by the :mod:`weakref` module are an alternative, using weak references to " -"construct mappings that don't keep objects alive solely because they appear " -"in the mapping objects. If, for example, an image object is a value in a :" -"class:`WeakValueDictionary`, then when the last remaining references to that " -"image object are the weak references held by weak mappings, garbage " -"collection can reclaim the object, and its corresponding entries in weak " -"mappings are simply deleted." +"just because they appeared as values or keys in the dictionaries. " +"The :class:`WeakKeyDictionary` and :class:`WeakValueDictionary` classes " +"supplied by the :mod:`weakref` module are an alternative, using weak " +"references to construct mappings that don't keep objects alive solely " +"because they appear in the mapping objects. If, for example, an image " +"object is a value in a :class:`WeakValueDictionary`, then when the last " +"remaining references to that image object are the weak references held by " +"weak mappings, garbage collection can reclaim the object, and its " +"corresponding entries in weak mappings are simply deleted." msgstr "" "例えば、巨大なバイナリ画像のオブジェクトがたくさんあり、それぞれに名前を関連" "付けたいとします。 Python の辞書型を使って名前を画像に対応付けたり画像を名前" "に対応付けたりすると、画像オブジェクトは辞書内のキーや値に使われているため存" -"続しつづけることになります。 :mod:`weakref` モジュールが提供している :class:" -"`WeakKeyDictionary` や :class:`WeakValueDictionary` クラスはその代用で、対応" -"付けを構築するのに弱参照を使い、キャッシュやマッピングに存在するという理由だ" -"けでオブジェクトを存続させないようにします。例えば、もしある画像オブジェクト" -"が :class:`WeakValueDictionary` の値になっていた場合、最後に残った画像オブ" -"ジェクトへの参照を弱参照マッピングが保持していれば、ガーベジコレクションはこ" -"のオブジェクトを再利用でき、画像オブジェクトに対する弱参照内の対応付けは削除" -"されます。" +"続しつづけることになります。 :mod:`weakref` モジュールが提供してい" +"る :class:`WeakKeyDictionary` や :class:`WeakValueDictionary` クラスはその代" +"用で、対応付けを構築するのに弱参照を使い、キャッシュやマッピングに存在すると" +"いう理由だけでオブジェクトを存続させないようにします。例えば、もしある画像オ" +"ブジェクトが :class:`WeakValueDictionary` の値になっていた場合、最後に残った" +"画像オブジェクトへの参照を弱参照マッピングが保持していれば、ガーベジコレク" +"ションはこのオブジェクトを再利用でき、画像オブジェクトに対する弱参照内の対応" +"付けは削除されます。" #: ../../library/weakref.rst:50 msgid "" ":class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak " "references in their implementation, setting up callback functions on the " "weak references that notify the weak dictionaries when a key or value has " -"been reclaimed by garbage collection. :class:`WeakSet` implements the :" -"class:`set` interface, but keeps weak references to its elements, just like " -"a :class:`WeakKeyDictionary` does." +"been reclaimed by garbage collection. :class:`WeakSet` implements " +"the :class:`set` interface, but keeps weak references to its elements, just " +"like a :class:`WeakKeyDictionary` does." msgstr "" ":class:`WeakKeyDictionary` と :class:`WeakValueDictionary` はその実装に弱参照" "を使用しており、キーや値がガーベジコレクションによって回収されたことを弱参照" -"辞書に通知するコールバック関数を設定しています。 :class:`WeakSet` は :class:" -"`set` インターフェースを実装していますが、 :class:`WeakKeyDictionary` のよう" -"に要素への弱参照を持ちます。" +"辞書に通知するコールバック関数を設定しています。 :class:`WeakSet` " +"は :class:`set` インターフェースを実装しています" +"が、 :class:`WeakKeyDictionary` のように要素への弱参照を持ちます。" #: ../../library/weakref.rst:57 msgid "" @@ -131,17 +131,16 @@ msgstr "" #: ../../library/weakref.rst:63 msgid "" -"Most programs should find that using one of these weak container types or :" -"class:`finalize` is all they need -- it's not usually necessary to create " -"your own weak references directly. The low-level machinery is exposed by " -"the :mod:`weakref` module for the benefit of advanced uses." +"Most programs should find that using one of these weak container types " +"or :class:`finalize` is all they need -- it's not usually necessary to " +"create your own weak references directly. The low-level machinery is " +"exposed by the :mod:`weakref` module for the benefit of advanced uses." msgstr "" "ほとんどのプログラムでは弱参照コンテナまたは :class:`finalize` のどれかを使え" "ば必要なものは揃うはずです。通常は直接自前の弱参照を作成する必要はありませ" "ん。低レベルな機構は、より進んだ使い方をするために :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 "" @@ -187,8 +190,8 @@ msgstr "" #: ../../library/weakref.rst:90 msgid "" -"Extension types can easily be made to support weak references; see :ref:" -"`weakref-support`." +"Extension types can easily be made to support weak references; " +"see :ref:`weakref-support`." msgstr "" "拡張型は、簡単に弱参照をサポートできます。詳細については、 :ref:`weakref-" "support` を参照してください。" @@ -201,23 +204,26 @@ 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 " -"referent is no longer alive, calling the reference object will cause :const:" -"`None` to be returned. If *callback* is provided and not :const:`None`, and " -"the returned weakref object is still alive, the callback will be called when " -"the object is about to be finalized; the weak reference object will be " -"passed as the only parameter to the callback; the referent will no longer be " -"available." -msgstr "" -"*object* への弱参照を返します。リファレントがまだ生きているならば、元のオブ" -"ジェクトは参照オブジェクトの呼び出しで取り出せす。リファレントがもはや生きて" -"いないならば、参照オブジェクトを呼び出したときに :const:`None` を返します。 " -"*callback* に :const:`None` 以外の値を与えた場合、オブジェクトをまさに後始末" -"処理しようとするときに呼び出します。このとき弱参照オブジェクトは *callback* " -"の唯一のパラメタとして渡されます。リファレントはもはや利用できません。" +"referent is no longer alive, calling the reference object will " +"cause :const:`None` to be returned. If *callback* is provided and " +"not :const:`None`, and the returned weakref object is still alive, the " +"callback will be called when the object is about to be finalized; the weak " +"reference object will be passed as the only parameter to the callback; the " +"referent will no longer be available." +msgstr "" +"*object* への弱参照を返します。\n" +"リファレントがまだ生きていれば、参照オブジェクトを呼び出すことで元のオブジェ" +"クトを取り出せます。\n" +"リファレントが生きていなければ、参照オブジェクトを呼び出すと :const:`None` が" +"返ります。\n" +"*callback* に :const:`None` 以外の値が指定され、返された弱参照オブジェクトが" +"まだ生きている場合、リファレントの後始末処理の直前にコールバックが呼び出され" +"ます。\n" +"コールバックには弱参照オブジェクトが唯一の引数として渡されますが、その時点で" +"リファレントは利用できません。" #: ../../library/weakref.rst:108 msgid "" @@ -229,26 +235,28 @@ 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 "" "Weak references are :term:`hashable` if the *object* is hashable. They will " -"maintain their hash value even after the *object* was deleted. If :func:" -"`hash` is called the first time only after the *object* was deleted, the " -"call will raise :exc:`TypeError`." +"maintain their hash value even after the *object* was deleted. " +"If :func:`hash` is called the first time only after the *object* was " +"deleted, the call will raise :exc:`TypeError`." msgstr "" "*object* が :term:`ハッシュ可能 ` ならば、弱参照はハッシュ可能で" "す。それらは *object* が削除された後でもそれらのハッシュ値を保持します。 " "*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 "" @@ -288,8 +296,8 @@ msgid "" "whether *object* is callable. Proxy objects are not :term:`hashable` " "regardless of the referent; this avoids a number of problems related to " "their fundamentally mutable nature, and prevents their use as dictionary " -"keys. *callback* is the same as the parameter of the same name to the :func:" -"`ref` function." +"keys. *callback* is the same as the parameter of the same name to " +"the :func:`ref` function." msgstr "" "弱参照を使う *object* へのプロキシを返します。弱参照オブジェクトを明示的な参" "照外しをしながら利用する代わりに、多くのケースでプロキシを利用することができ" @@ -297,22 +305,24 @@ msgstr "" "``ProxyType`` または ``CallableProxyType`` のどちらかの型を持ちます。プロキシ" "オブジェクトはリファレントに関係なく :term:`ハッシュ可能 ` ではあり" "ません。これによって、それらの基本的な変更可能という性質による多くの問題を避" -"けています。そして、辞書のキーとしての利用を妨げます。 *callback* は :func:" -"`ref` 関数の同じ名前のパラメータと同じものです。(--- 訳注: リファレントが変更" -"不能型であっても、プロキシはリファレントが消えるという状態の変更があるため" -"に、変更可能型です。---)" +"けています。そして、辞書のキーとしての利用を妨げます。 *callback* " +"は :func:`ref` 関数の同じ名前のパラメータと同じものです。(--- 訳注: リファレ" +"ントが変更不能型であっても、プロキシはリファレントが消えるという状態の変更が" +"あるために、変更可能型です。---)" -#: ../../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,13 @@ 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 +452,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 +459,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 +484,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,48 +532,60 @@ 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." +"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 "" -"When the program exits, each remaining live finalizer is called unless its :" -"attr:`atexit` attribute has been set to false. They are called in reverse " -"order of creation." +"When the program exits, each remaining live finalizer is called unless " +"its :attr:`atexit` attribute has been set to false. They are called in " +"reverse order of creation." msgstr "" -"プログラムが終了するとき、生き残ったそれぞれのファイナライザは、自身の :attr:" -"`atexit` 属性が偽に設定されるまで呼び出され続けます。\n" +"プログラムが終了するとき、生き残ったそれぞれのファイナライザは、自身" +"の :attr:`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 " +"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 +599,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,20 +648,22 @@ 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:" +"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 "" -"If the referent no longer exists, calling the reference object returns :" -"const:`None`:" +"If the referent no longer exists, calling the reference object " +"returns :const:`None`:" msgstr "" -"リファレントがもはや存在しないならば、参照オブジェクトの呼び出しは :const:" -"`None` を返します:" +"リファレントがもはや存在しないならば、参照オブジェクトの呼び出し" +"は :const:`None` を返します:" #: ../../library/weakref.rst:387 msgid "" @@ -619,7 +675,6 @@ msgstr "" "None`` を用いて行われます。通常、参照オブジェクトを使う必要があるアプリケー" "ションコードはこのパターンに従います::" -#: ../../library/weakref.rst:391 msgid "" "# r is a weak reference object\n" "o = r()\n" @@ -630,6 +685,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 "" @@ -639,20 +702,20 @@ msgid "" "safe in threaded applications as well as single-threaded applications." msgstr "" "\"生存性(liveness)\"のテストを分割すると、スレッド化されたアプリケーションに" -"おいて競合状態を作り出します。 (訳注:``if r() is not None: r()." -"do_something()`` では、2度目のr()がNoneを返す可能性があります) 弱参照が呼び出" -"される前に、他のスレッドは弱参照が無効になる原因となり得ます。上で示したイ" -"ディオムは、シングルスレッドのアプリケーションと同じくマルチスレッド化された" -"アプリケーションにおいても安全です。" +"おいて競合状態を作り出します。 (訳注:``if r() is not None: " +"r().do_something()`` では、2度目のr()がNoneを返す可能性があります) 弱参照が呼" +"び出される前に、他のスレッドは弱参照が無効になる原因となり得ます。上で示した" +"イディオムは、シングルスレッドのアプリケーションと同じくマルチスレッド化され" +"たアプリケーションにおいても安全です。" #: ../../library/weakref.rst:405 msgid "" "Specialized versions of :class:`ref` objects can be created through " -"subclassing. This is used in the implementation of the :class:" -"`WeakValueDictionary` to reduce the memory overhead for each entry in the " -"mapping. This may be most useful to associate additional information with a " -"reference, but could also be used to insert additional processing on calls " -"to retrieve the referent." +"subclassing. This is used in the implementation of " +"the :class:`WeakValueDictionary` to reduce the memory overhead for each " +"entry in the mapping. This may be most useful to associate additional " +"information with a reference, but could also be used to insert additional " +"processing on calls to retrieve the referent." msgstr "" "サブクラス化を行えば、 :class:`ref` オブジェクトの特殊なバージョンを作成でき" "ます。これは :class:`WeakValueDictionary` の実装で使われており、マップ内の各" @@ -660,17 +723,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 +752,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 +799,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 +832,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 +857,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 +880,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 +911,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 +935,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,33 +964,55 @@ 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 "" "import weakref, sys\n" "def unloading_module():\n" " # implicit reference to the module globals from the function body\n" "weakref.finalize(sys.modules[__name__], unloading_module)" msgstr "" +"import weakref, sys\n" +"def unloading_module():\n" +" # 関数本体からモジュールのグローバル変数への暗黙の参照\n" +"weakref.finalize(sys.modules[__name__], unloading_module)" -#: ../../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..340cb07e7 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 "" @@ -212,31 +216,31 @@ msgstr "" #: ../../library/webbrowser.rst:127 msgid "" -"Register the browser type *name*. Once a browser type is registered, the :" -"func:`get` function can return a controller for that browser type. If " +"Register the browser type *name*. Once a browser type is registered, " +"the :func:`get` function can return a controller for that browser type. If " "*instance* is not provided, or is ``None``, *constructor* will be called " "without parameters to create an instance when needed. If *instance* is " "provided, *constructor* will never be called, and may be ``None``." msgstr "" -"ブラウザの種類 *name* を登録します。ブラウザの種類が登録されたら、 :func:" -"`get` でそのブラウザのコントローラーを呼び出すことができます。 *instance* が" -"指定されなかったり、 ``None`` なら、インスタンスが必要な時には *constructor* " -"がパラメータなしに呼び出されて作られます。 *instance* が指定されたら、 " -"*constructor* は呼び出されないので、 ``None`` でかまいません。" +"ブラウザの種類 *name* を登録します。ブラウザの種類が登録された" +"ら、 :func:`get` でそのブラウザのコントローラーを呼び出すことができます。 " +"*instance* が指定されなかったり、 ``None`` なら、インスタンスが必要な時には " +"*constructor* がパラメータなしに呼び出されて作られます。 *instance* が指定さ" +"れたら、 *constructor* は呼び出されないので、 ``None`` でかまいません。" #: ../../library/webbrowser.rst:133 msgid "" -"Setting *preferred* to ``True`` makes this browser a preferred result for a :" -"func:`get` call with no argument. Otherwise, this entry point is only " -"useful if you plan to either set the :envvar:`BROWSER` variable or call :" -"func:`get` with a nonempty argument matching the name of a handler you " +"Setting *preferred* to ``True`` makes this browser a preferred result for " +"a :func:`get` call with no argument. Otherwise, this entry point is only " +"useful if you plan to either set the :envvar:`BROWSER` variable or " +"call :func:`get` with a nonempty argument matching the name of a handler you " "declare." msgstr "" "*preferred* を ``True`` に設定すると、 :func:`get` の引数無しの呼び出しの結果" "が優先的にこのブラウザになります。\n" -"そうでない場合は、この関数は、変数 :envvar:`BROWSER` を設定するか、 :func:" -"`get` を空文字列ではない、宣言したハンドラの名前と一致する引数とともに呼び出" -"すときにだけ、役に立ちます。" +"そうでない場合は、この関数は、変数 :envvar:`BROWSER` を設定する" +"か、 :func:`get` を空文字列ではない、宣言したハンドラの名前と一致する引数とと" +"もに呼び出すときにだけ、役に立ちます。" #: ../../library/webbrowser.rst:139 msgid "*preferred* keyword-only parameter was added." @@ -431,14 +435,14 @@ msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " "detecting KDE would be nice; the :envvar:`!KDEDIR` variable is not " -"sufficient. Note also that the name \"kfm\" is used even when using the :" -"program:`konqueror` command with KDE 2 --- the implementation selects the " -"best strategy for running Konqueror." +"sufficient. Note also that the name \"kfm\" is used even when using " +"the :program:`konqueror` command with KDE 2 --- the implementation selects " +"the best strategy for running Konqueror." msgstr "" "\"Konqueror\" は Unix の KDE デスクトップ環境のファイルマネージャで、 KDE が" "動作している時にだけ意味を持ちます。何か信頼できる方法で KDE を検出するのがい" -"いでしょう; 変数 :envvar:`!KDEDIR` では十分ではありません。また、 KDE 2 で :" -"program:`konqueror` コマンドを使うときにも、 \"kfm\" が使われます --- " +"いでしょう; 変数 :envvar:`!KDEDIR` では十分ではありません。また、 KDE 2 " +"で :program:`konqueror` コマンドを使うときにも、 \"kfm\" が使われます --- " "Konqueror を動作させるのに最も良い方法が実装によって選択されます。" #: ../../library/webbrowser.rst:198 @@ -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." @@ -523,8 +534,8 @@ msgstr "" #: ../../library/webbrowser.rst:256 msgid "" "Open *url* in a new window of the browser handled by this controller, if " -"possible, otherwise, open *url* in the only browser window. Alias :func:" -"`open_new`." +"possible, otherwise, open *url* in the only browser window. " +"Alias :func:`open_new`." msgstr "" "可能であれば、このコントローラーでハンドルされたブラウザの新しいウィンドウで " "*url* を開きますが、そうでない場合はブラウザのただ1つのウィンドウで *url* を" 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..f8a7bb347 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 @@ -97,19 +97,18 @@ msgstr "*key* は、事前に定義された接続先のハンドルです。" #: ../../library/winreg.rst:53 ../../library/winreg.rst:77 #: ../../library/winreg.rst:109 msgid "" -"The return value is the handle of the opened key. If the function fails, an :" -"exc:`OSError` exception is raised." +"The return value is the handle of the opened key. If the function fails, " +"an :exc:`OSError` exception is raised." 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 "" @@ -185,8 +181,8 @@ msgstr "" #: ../../library/winreg.rst:100 msgid "" "*access* is an integer that specifies an access mask that describes the " -"desired security access for the key. Default is :const:`KEY_WRITE`. See :" -"ref:`Access Rights ` for other allowed values." +"desired security access for the key. Default is :const:`KEY_WRITE`. " +"See :ref:`Access Rights ` for other allowed values." msgstr "" "*access* は、 key に対して想定されるセキュリティアクセスを示すアクセスマスク" "を指定する整数です。デフォルトは :const:`KEY_WRITE` です。その他の利用可能な" @@ -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`` を送出します。 " +"引数 ``key``, ``value`` を指定して :ref:`監査イベント ` " +"``winreg.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`` を送出します。 " +"引数 ``key``, ``index`` を指定して :ref:`監査イベント ` " +"``winreg.EnumKey`` を送出します。" #: ../../library/winreg.rst:209 msgid "Enumerates values of an open registry key, returning a tuple." @@ -361,35 +354,34 @@ 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`` を送出します。 " +"引数 ``key``, ``index`` を指定して :ref:`監査イベント ` " +"``winreg.EnumValue`` を送出します。" #: ../../library/winreg.rst:247 msgid "" -"Expands environment variable placeholders ``%NAME%`` in strings like :const:" -"`REG_EXPAND_SZ`::" +"Expands environment variable placeholders ``%NAME%`` in strings " +"like :const:`REG_EXPAND_SZ`::" 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``." +"Raises an :ref:`auditing event ` " +"``winreg.ExpandEnvironmentStrings`` with argument ``str``." msgstr "" -"引数 ``str`` を指定して :ref:`監査イベント ` ``winreg." -"ExpandEnvironmentStrings`` を送出します。 " +"引数 ``str`` を指定して :ref:`監査イベント ` " +"``winreg.ExpandEnvironmentStrings`` を送出します。" #: ../../library/winreg.rst:258 msgid "Writes all the attributes of a key to the registry." @@ -399,11 +391,11 @@ msgstr "キーのすべての属性をレジストリに書き込みます。" msgid "" "It is not necessary to call :func:`FlushKey` to change a key. Registry " "changes are flushed to disk by the registry using its lazy flusher. " -"Registry changes are also flushed to disk at system shutdown. Unlike :func:" -"`CloseKey`, the :func:`FlushKey` method returns only when all the data has " -"been written to the registry. An application should only call :func:" -"`FlushKey` if it requires absolute certainty that registry changes are on " -"disk." +"Registry changes are also flushed to disk at system shutdown. " +"Unlike :func:`CloseKey`, the :func:`FlushKey` method returns only when all " +"the data has been written to the registry. An application should only " +"call :func:`FlushKey` if it requires absolute certainty that registry " +"changes are on disk." msgstr "" "キーを変更するために :func:`FlushKey` を呼ぶ必要はありません。レジストリの変" "更は怠惰なフラッシュ機構 (lazy flusher) を使ってフラッシュされます。また、シ" @@ -433,8 +425,8 @@ msgid "" "*key* is a handle returned by :func:`ConnectRegistry` or one of the " "constants :const:`HKEY_USERS` or :const:`HKEY_LOCAL_MACHINE`." msgstr "" -"*key* は :func:`ConnectRegistry` が返したハンドルか、定数 :const:" -"`HKEY_USERS` と :const:`HKEY_LOCAL_MACHINE` のどちらかです。" +"*key* は :func:`ConnectRegistry` が返したハンドルか、定" +"数 :const:`HKEY_USERS` と :const:`HKEY_LOCAL_MACHINE` のどちらかです。" #: ../../library/winreg.rst:284 msgid "*sub_key* is a string that identifies the subkey to load." @@ -451,30 +443,32 @@ 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." +"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 "" @@ -497,8 +491,8 @@ msgstr "" #: ../../library/winreg.rst:314 msgid "" "*access* is an integer that specifies an access mask that describes the " -"desired security access for the key. Default is :const:`KEY_READ`. See :" -"ref:`Access Rights ` for other allowed values." +"desired security access for the key. Default is :const:`KEY_READ`. " +"See :ref:`Access Rights ` for other allowed values." msgstr "" "*access* は、 key に対して想定されるセキュリティアクセスを示すアクセスマスク" "を指定する整数です。デフォルトは :const:`KEY_READ` です。その他の利用可能な値" @@ -512,13 +506,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 +537,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`` を送出します。 " +"引数 ``key`` を指定して :ref:`監査イベント ` " +"``winreg.QueryInfoKey`` を送出します。" #: ../../library/winreg.rst:361 msgid "Retrieves the unnamed value for a key, as a string." @@ -571,21 +563,20 @@ msgstr "" msgid "" "Values in the registry have name, type, and data components. This method " "retrieves the data for a key's first value that has a ``NULL`` name. But the " -"underlying API call doesn't return the type, so always use :func:" -"`QueryValueEx` if possible." +"underlying API call doesn't return the type, so always " +"use :func:`QueryValueEx` if possible." msgstr "" "レジストリ中の値は名前、型、およびデータから構成されています。このメソッドは" "あるキーのデータ中で、名前 ``NULL`` をもつ最初の値を取得します。しかし背後の" -"API 呼び出しは型情報を返しません。なので、可能ならいつでも :func:" -"`QueryValueEx` を使うべきです。" +"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 "" @@ -609,8 +600,8 @@ msgstr "レジストリ要素の値。" #: ../../library/winreg.rst:395 msgid "" -"An integer giving the registry type for this value (see table in docs for :" -"meth:`SetValueEx`)" +"An integer giving the registry type for this value (see table in docs " +"for :meth:`SetValueEx`)" msgstr "" "この値のレジストリ型を表す整数。 (:meth:`SetValueEx` のドキュメント内のテーブ" "ルを参照してください。)" @@ -619,18 +610,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 +629,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." @@ -665,8 +662,8 @@ msgstr "*sub_key* は値が関連付けられているサブキーの名前を #: ../../library/winreg.rst:437 msgid "" "*type* is an integer that specifies the type of the data. Currently this " -"must be :const:`REG_SZ`, meaning only strings are supported. Use the :func:" -"`SetValueEx` function for support for other data types." +"must be :const:`REG_SZ`, meaning only strings are supported. Use " +"the :func:`SetValueEx` function for support for other data types." msgstr "" "*type* はデータの型を指定する整数です。現状では、この値は :const:`REG_SZ` で" "なければならず、これは文字列だけがサポートされていることを示します。他のデー" @@ -695,19 +692,18 @@ msgstr "" #: ../../library/winreg.rst:450 msgid "" -"The key identified by the *key* parameter must have been opened with :const:" -"`KEY_SET_VALUE` access." +"The key identified by the *key* parameter must have been opened " +"with :const:`KEY_SET_VALUE` access." 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 +768,12 @@ msgstr "" "ん。あるキーのリフレクションを無効にしても、そのキーのサブキーのリフレクショ" "ンには全く影響しません。" -#: ../../library/winreg.rst:501 msgid "" "Raises an :ref:`auditing event ` ``winreg.DisableReflectionKey`` " "with argument ``key``." msgstr "" -"引数 ``key`` を指定して :ref:`監査イベント ` ``winreg." -"DisableReflectionKey`` を送出します。 " +"引数 ``key`` を指定して :ref:`監査イベント ` " +"``winreg.DisableReflectionKey`` を送出します。" #: ../../library/winreg.rst:506 msgid "Restores registry reflection for the specified disabled key." @@ -792,13 +787,12 @@ msgid "" msgstr "" "あるキーのリフレクションを再開しても、その全てのサブキーには影響しません。" -#: ../../library/winreg.rst:516 msgid "" "Raises an :ref:`auditing event ` ``winreg.EnableReflectionKey`` " "with argument ``key``." msgstr "" -"引数 ``key`` を指定して :ref:`監査イベント ` ``winreg." -"EnableReflectionKey`` を送出します。 " +"引数 ``key`` を指定して :ref:`監査イベント ` " +"``winreg.EnableReflectionKey`` を送出します。" #: ../../library/winreg.rst:521 msgid "Determines the reflection state for the specified key." @@ -808,13 +802,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`` を送出します。 " +"引数 ``key`` を指定して :ref:`監査イベント ` " +"``winreg.QueryReflectionKey`` を送出します。" #: ../../library/winreg.rst:537 msgid "Constants" @@ -887,9 +880,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" @@ -897,39 +889,35 @@ msgstr "アクセス権限" #: ../../library/winreg.rst:595 msgid "" -"For more information, see `Registry Key Security and Access `__." +"For more information, see `Registry Key Security and Access `__." msgstr "" -"より詳しい情報については、 `Registry Key Security and Access `__ を参照してくださ" -"い。" +"より詳しい情報については、 `Registry Key Security and Access `__ を参照してく" +"ださい。" -#: ../../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." +"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`, :" -"const:`KEY_CREATE_SUB_KEY`, :const:`KEY_ENUMERATE_SUB_KEYS`, :const:" -"`KEY_NOTIFY`, :const:`KEY_CREATE_LINK`) アクセス権限の組み合わせ。" +"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` " +"のアクセス権限の組み合わせ。" -#: ../../library/winreg.rst:607 msgid "" -"Combines the STANDARD_RIGHTS_WRITE, :const:`KEY_SET_VALUE`, and :const:" -"`KEY_CREATE_SUB_KEY` access rights." +"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." +"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`." @@ -1073,8 +1061,9 @@ msgstr "レジストリハンドルオブジェクト" #: ../../library/winreg.rst:739 msgid "" "This object wraps a Windows HKEY object, automatically closing it when the " -"object is destroyed. To guarantee cleanup, you can call either the :meth:" -"`~PyHKEY.Close` method on the object, or the :func:`CloseKey` function." +"object is destroyed. To guarantee cleanup, you can call either " +"the :meth:`~PyHKEY.Close` method on the object, or the :func:`CloseKey` " +"function." msgstr "" "このオブジェクトは Windows の HKEY オブジェクトをラップし、オブジェクトが破壊" "されたときに自動的にハンドルを閉じます。オブジェクトの :meth:`~PyHKEY.Close` " @@ -1095,16 +1084,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 "" @@ -1125,16 +1116,16 @@ msgstr "" #: ../../library/winreg.rst:759 msgid "" -"Handle objects can be converted to an integer (e.g., using the built-in :" -"func:`int` function), in which case the underlying Windows handle value is " -"returned. You can also use the :meth:`~PyHKEY.Detach` method to return the " -"integer handle, and also disconnect the Windows handle from the handle " +"Handle objects can be converted to an integer (e.g., using the built-" +"in :func:`int` function), in which case the underlying Windows handle value " +"is returned. You can also use the :meth:`~PyHKEY.Detach` method to return " +"the integer handle, and also disconnect the Windows handle from the handle " "object." msgstr "" "ハンドルオブジェクトは (例えば組み込みの :func:`int` 関数を使って) 整数に変換" -"することができます。この場合、背後の Windows ハンドル値が返されます、また、 :" -"meth:`~PyHKEY.Detach` メソッドを使って整数のハンドル値を返させると同時に、ハ" -"ンドルオブジェクトから Windows ハンドルを切り離すこともできます。" +"することができます。この場合、背後の Windows ハンドル値が返されます、ま" +"た、 :meth:`~PyHKEY.Detach` メソッドを使って整数のハンドル値を返させると同時" +"に、ハンドルオブジェクトから Windows ハンドルを切り離すこともできます。" #: ../../library/winreg.rst:767 msgid "Closes the underlying Windows handle." @@ -1167,27 +1158,29 @@ 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 "" -"The HKEY object implements :meth:`~object.__enter__` and :meth:`~object." -"__exit__` and thus supports the context protocol for the :keyword:`with` " -"statement::" +"The HKEY object implements :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` and thus supports the context protocol for " +"the :keyword:`with` statement::" msgstr "" "HKEY オブジェクトは :meth:`~object.__enter__`, :meth:`~object.__exit__` メ" "ソッドを実装していて、 :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 +1193,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..53cdb0f89 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 @@ -58,16 +58,16 @@ msgid "" "a :term:`bytes-like object`, or ``None``. Its interpretation depends on the " "value of *flags*, which can be a bitwise ORed combination of the constants " "described below. If the *sound* parameter is ``None``, any currently playing " -"waveform sound is stopped. If the system indicates an error, :exc:" -"`RuntimeError` is raised." +"waveform sound is stopped. If the system indicates an " +"error, :exc:`RuntimeError` is raised." msgstr "" "プラットフォームの API から関数 :c:func:`!PlaySound` を呼び出します。引数 " "*sound* はファイル名、システム音エイリアス、音声データの :term:`bytes-like オ" "ブジェクト `、または ``None`` をとり得ます。 *sound* の解" "釈は *flags* の値に依存します。この値は以下に述べる定数をビット単位OR して組" "み合わせたものになります。 *sound* 引数が ``None`` だった場合、現在再生中の" -"Wave形式サウンドの再生を停止します。システムのエラーが発生した場合、例外 :" -"exc:`RuntimeError` が送出されます。" +"Wave形式サウンドの再生を停止します。システムのエラーが発生した場合、例" +"外 :exc:`RuntimeError` が送出されます。" #: ../../library/winsound.rst:38 msgid "" @@ -90,8 +90,8 @@ msgstr "" #: ../../library/winsound.rst:49 msgid "" -"The *sound* parameter is the name of a WAV file. Do not use with :const:" -"`SND_ALIAS`." +"The *sound* parameter is the name of a WAV file. Do not use " +"with :const:`SND_ALIAS`." msgstr "" "*sound* パラメタが WAV ファイル名であることを示します。 :const:`SND_ALIAS` と" "同時に使ってはいけません。" @@ -99,15 +99,15 @@ msgstr "" #: ../../library/winsound.rst:55 msgid "" "The *sound* parameter is a sound association name from the registry. If the " -"registry contains no such name, play the system default sound unless :const:" -"`SND_NODEFAULT` is also specified. If no default sound is registered, raise :" -"exc:`RuntimeError`. Do not use with :const:`SND_FILENAME`." +"registry contains no such name, play the system default sound " +"unless :const:`SND_NODEFAULT` is also specified. If no default sound is " +"registered, raise :exc:`RuntimeError`. Do not use with :const:`SND_FILENAME`." msgstr "" "引数 *sound* はレジストリにある音声データに関連付けられた名前であることを示し" "ます。指定した名前がレジストリ上にない場合、定数 :const:`SND_NODEFAULT` が同" "時に指定されていない限り、システム標準の音声データが再生されます。標準の音声" -"データが登録されていない場合、例外 :exc:`RuntimeError` が送出されます。 :" -"const:`SND_FILENAME` と同時に使ってはいけません。" +"データが登録されていない場合、例外 :exc:`RuntimeError` が送出されま" +"す。 :const:`SND_FILENAME` と同時に使ってはいけません。" #: ../../library/winsound.rst:60 msgid "" @@ -169,7 +169,6 @@ msgstr "Question" msgid "For example::" msgstr "例えば::" -#: ../../library/winsound.rst:79 msgid "" "import winsound\n" "# Play Windows exit sound.\n" @@ -179,15 +178,22 @@ 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 "" "Play the sound repeatedly. The :const:`SND_ASYNC` flag must also be used to " "avoid blocking. Cannot be used with :const:`SND_MEMORY`." msgstr "" -"音声データを繰り返し再生します。システムがブロックしないようにするため、 :" -"const:`SND_ASYNC` フラグを同時に使わなくてはなりません。 :const:`SND_MEMORY` " -"と同時に使うことはできません。" +"音声データを繰り返し再生します。システムがブロックしないようにするた" +"め、 :const:`SND_ASYNC` フラグを同時に使わなくてはなりませ" +"ん。 :const:`SND_MEMORY` と同時に使うことはできません。" #: ../../library/winsound.rst:96 msgid "" @@ -201,12 +207,12 @@ msgstr "" #: ../../library/winsound.rst:101 msgid "" "This module does not support playing from a memory image asynchronously, so " -"a combination of this flag and :const:`SND_ASYNC` will raise :exc:" -"`RuntimeError`." +"a combination of this flag and :const:`SND_ASYNC` will " +"raise :exc:`RuntimeError`." msgstr "" "このモジュールはメモリ上のイメージを非同期に再生する機能をサポートしていませ" -"ん。従って、このフラグと :const:`SND_ASYNC` を組み合わせると例外 :exc:" -"`RuntimeError` が送出されます。" +"ん。従って、このフラグと :const:`SND_ASYNC` を組み合わせると例" +"外 :exc:`RuntimeError` が送出されます。" #: ../../library/winsound.rst:107 msgid "Stop playing all instances of the specified sound." @@ -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..25e0347d1 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 @@ -93,8 +93,9 @@ msgid "" "environments. A WSGI environment is a dictionary containing HTTP request " "variables as described in :pep:`3333`. All of the functions taking an " "*environ* parameter expect a WSGI-compliant dictionary to be supplied; " -"please see :pep:`3333` for a detailed specification and :data:`~wsgiref." -"types.WSGIEnvironment` for a type alias that can be used in type annotations." +"please see :pep:`3333` for a detailed specification " +"and :data:`~wsgiref.types.WSGIEnvironment` for a type alias that can be used " +"in type annotations." msgstr "" "このモジュールは WSGI 環境で使う様々なユーティリティ関数を提供します。 WSGI " "環境は :pep:`3333` で記述されているような HTTP リクエスト変数を含む辞書です。" @@ -145,9 +146,9 @@ msgid "" "``QUERY_STRING`` variables are ignored. The result is the base URI of the " "application object addressed by the request." msgstr "" -"``PATH_INFO`` と ``QUERY_STRING`` 変数が無視されることを除けば :func:" -"`request_uri` に似ています。結果はリクエストによって指定されたアプリケーショ" -"ンオブジェクトのベース URI です。" +"``PATH_INFO`` と ``QUERY_STRING`` 変数が無視されることを除け" +"ば :func:`request_uri` に似ています。結果はリクエストによって指定されたアプリ" +"ケーションオブジェクトのベース URI です。" #: ../../library/wsgiref.rst:83 msgid "" @@ -173,11 +174,11 @@ msgid "" "routine modifies the passed-in environment to make it suitable for invoking " "another WSGI application that is located at the target URI. For example, if " "there is a WSGI application at ``/foo``, and the request URI path is ``/foo/" -"bar/baz``, and the WSGI application at ``/foo`` calls :func:" -"`shift_path_info`, it will receive the string \"bar\", and the environment " -"will be updated to be suitable for passing to a WSGI application at ``/foo/" -"bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/foo/bar``, " -"and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." +"bar/baz``, and the WSGI application at ``/foo`` " +"calls :func:`shift_path_info`, it will receive the string \"bar\", and the " +"environment will be updated to be suitable for passing to a WSGI application " +"at ``/foo/bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/" +"foo/bar``, and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." msgstr "" "典型的なこのルーチンの使い方はリクエスト URI のそれぞれの要素の処理で、例えば" "パスを一連の辞書のキーとして取り扱う場合です。このルーチンは、渡された環境" @@ -213,9 +214,9 @@ msgstr "*environ* をテスト用に自明なデフォルト値で更新しま msgid "" "This routine adds various parameters required for WSGI, including " "``HTTP_HOST``, ``SERVER_NAME``, ``SERVER_PORT``, ``REQUEST_METHOD``, " -"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined ``wsgi." -"*`` variables. It only supplies default values, and does not replace any " -"existing settings for these variables." +"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined " +"``wsgi.*`` variables. It only supplies default values, and does not replace " +"any existing settings for these variables." msgstr "" "このルーチンは WSGI に必要な様々なパラメータを追加します。そのようなパラメー" "タとして ``HTTP_HOST`` 、 ``SERVER_NAME`` 、 ``SERVER_PORT`` 、 " @@ -234,13 +235,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 +264,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 "" @@ -286,26 +307,26 @@ msgid "" "used to convert a file-like object to an :term:`iterator`. The resulting " "objects are :term:`iterable`\\ s. As the object is iterated over, the " "optional *blksize* parameter will be repeatedly passed to the *filelike* " -"object's :meth:`read` method to obtain bytestrings to yield. When :meth:" -"`read` returns an empty bytestring, iteration is ended and is not resumable." +"object's :meth:`read` method to obtain bytestrings to yield. " +"When :meth:`read` returns an empty bytestring, iteration is ended and is not " +"resumable." msgstr "" #: ../../library/wsgiref.rst:167 msgid "" "If *filelike* has a :meth:`close` method, the returned object will also have " -"a :meth:`close` method, and it will invoke the *filelike* object's :meth:" -"`close` method when called." +"a :meth:`close` method, and it will invoke the *filelike* " +"object's :meth:`close` method when called." msgstr "" -"*filelike* に :meth:`close` メソッドがある場合、返されたオブジェクトも :meth:" -"`close` メソッドを持ち、これが呼ばれた場合には *filelike* オブジェクトの :" -"meth:`close` メソッドを呼び出します。" +"*filelike* に :meth:`close` メソッドがある場合、返されたオブジェクト" +"も :meth:`close` メソッドを持ち、これが呼ばれた場合には *filelike* オブジェク" +"トの :meth:`close` メソッドを呼び出します。" #: ../../library/wsgiref.rst:171 ../../library/wsgiref.rst:294 #: ../../library/wsgiref.rst:429 msgid "Example usage::" msgstr "使用例::" -#: ../../library/wsgiref.rst:173 msgid "" "from io import StringIO\n" "from wsgiref.util import FileWrapper\n" @@ -317,6 +338,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,18 +374,24 @@ 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:" -"`~dict.setdefault`, :meth:`~object.__delitem__` and :meth:`~object." -"__contains__`. For each of these methods, the key is the header name " -"(treated case-insensitively), and the value is the first value associated " -"with that header name. Setting a header deletes any existing values for " -"that header, then adds a new value at the end of the wrapped header list. " -"Headers' existing order is generally maintained, with new headers added to " -"the end of the wrapped list." -msgstr "" +":class:`Headers` objects support typical mapping operations " +"including :meth:`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:`~dict.setdefault`, :meth:`~object.__delitem__` " +"and :meth:`~object.__contains__`. For each of these methods, the key is the " +"header name (treated case-insensitively), and the value is the first value " +"associated with that header name. Setting a header deletes any existing " +"values for that header, then adds a new value at the end of the wrapped " +"header list. 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 "" @@ -371,20 +407,21 @@ msgstr "" #: ../../library/wsgiref.rst:219 msgid "" -":class:`Headers` objects also support :meth:`keys`, :meth:`values`, and :" -"meth:`items` methods. The lists returned by :meth:`keys` and :meth:`items` " -"can include the same key more than once if there is a multi-valued header. " -"The ``len()`` of a :class:`Headers` object is the same as the length of its :" -"meth:`items`, which is the same as the length of the wrapped header list. " -"In fact, the :meth:`items` method just returns a copy of the wrapped header " -"list." -msgstr "" -":class:`Headers` オブジェクトは :meth:`keys` 、 :meth:`values` 、 :meth:" -"`items` メソッドもサポートします。複数の値を持つヘッダがある場合には、 :meth:" -"`keys` と :meth:`items` で返されるリストは同じキーを一つ以上含むことがありま" -"す。 :class:`Headers` オブジェクトの ``len()`` は、その :meth:`items` の長さ" -"と同じであり、ラップされたヘッダリストの長さと同じです。実際、 :meth:`items` " -"メソッドは単にラップされたヘッダリストのコピーを返しているだけです。" +":class:`Headers` objects also support :meth:`keys`, :meth:`values`, " +"and :meth:`items` methods. The lists returned by :meth:`keys` " +"and :meth:`items` can include the same key more than once if there is a " +"multi-valued header. The ``len()`` of a :class:`Headers` object is the same " +"as the length of its :meth:`items`, which is the same as the length of the " +"wrapped header list. In fact, the :meth:`items` method just returns a copy " +"of the wrapped header list." +msgstr "" +":class:`Headers` オブジェクト" +"は :meth:`keys` 、 :meth:`values` 、 :meth:`items` メソッドもサポートします。" +"複数の値を持つヘッダがある場合には、 :meth:`keys` と :meth:`items` で返される" +"リストは同じキーを一つ以上含むことがあります。 :class:`Headers` オブジェクト" +"の ``len()`` は、その :meth:`items` の長さと同じであり、ラップされたヘッダリ" +"ストの長さと同じです。実際、 :meth:`items` メソッドは単にラップされたヘッダリ" +"ストのコピーを返しているだけです。" #: ../../library/wsgiref.rst:226 msgid "" @@ -402,9 +439,10 @@ msgstr "" #: ../../library/wsgiref.rst:232 msgid "" -"In addition to their mapping interface and formatting features, :class:" -"`Headers` objects also have the following methods for querying and adding " -"multi-valued headers, and for adding headers with MIME parameters:" +"In addition to their mapping interface and formatting " +"features, :class:`Headers` objects also have the following methods for " +"querying and adding multi-valued headers, and for adding headers with MIME " +"parameters:" msgstr "" "これらのマッピングインターフェースと整形機能に加えて、 :class:`Headers` オブ" "ジェクトは複数の値を持つヘッダの取得と追加、MIME パラメータでヘッダを追加する" @@ -434,7 +472,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 +482,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." @@ -481,31 +520,30 @@ msgid "" "application on a given host and port. If you want to serve multiple " "applications on a single host and port, you should create a WSGI application " "that parses ``PATH_INFO`` to select which application to invoke for each " -"request. (E.g., using the :func:`shift_path_info` function from :mod:" -"`wsgiref.util`.)" +"request. (E.g., using the :func:`shift_path_info` function " +"from :mod:`wsgiref.util`.)" msgstr "" -"このモジュールは WSGI アプリケーションを提供するシンプルな HTTP サーバです (:" -"mod:`http.server` がベースです)。個々のサーバインスタンスは単一の WSGI アプリ" -"ケーションを、特定のホストとポート上で提供します。もし一つのホストとポート上" -"で複数のアプリケーションを提供したいならば、 ``PATH_INFO`` をパースして個々の" -"リクエストでどのアプリケーションを呼び出すか選択するような WSGI アプリケー" -"ションを作る必要があります。(例えば、 :mod:`wsgiref.util` から :func:" -"`shift_path_info` を利用します。)" +"このモジュールは WSGI アプリケーションを提供するシンプルな HTTP サーバです " +"(:mod:`http.server` がベースです)。個々のサーバインスタンスは単一の WSGI アプ" +"リケーションを、特定のホストとポート上で提供します。もし一つのホストとポート" +"上で複数のアプリケーションを提供したいならば、 ``PATH_INFO`` をパースして個々" +"のリクエストでどのアプリケーションを呼び出すか選択するような WSGI アプリケー" +"ションを作る必要があります。(例えば、 :mod:`wsgiref.util` か" +"ら :func:`shift_path_info` を利用します。)" #: ../../library/wsgiref.rst:289 msgid "" "Create a new WSGI server listening on *host* and *port*, accepting " "connections for *app*. The return value is an instance of the supplied " "*server_class*, and will process requests using the specified " -"*handler_class*. *app* must be a WSGI application object, as defined by :" -"pep:`3333`." +"*handler_class*. *app* must be a WSGI application object, as defined " +"by :pep:`3333`." msgstr "" "*host* と *port* 上で待機し、 *app* へのコネクションを受け付ける WSGI サーバ" "を作成します。戻り値は与えられた *server_class* のインスタンスで、指定された " "*handler_class* を使ってリクエストを処理します。 *app* は :pep:`3333` で定義" "されるところの WSGI アプリケーションでなければいけません。" -#: ../../library/wsgiref.rst:296 msgid "" "from wsgiref.simple_server import make_server, demo_app\n" "\n" @@ -518,6 +556,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,26 +581,29 @@ 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 "" -"Create a :class:`WSGIServer` instance. *server_address* should be a ``(host," -"port)`` tuple, and *RequestHandlerClass* should be the subclass of :class:" -"`http.server.BaseHTTPRequestHandler` that will be used to process requests." +"Create a :class:`WSGIServer` instance. *server_address* should be a " +"``(host,port)`` tuple, and *RequestHandlerClass* should be the subclass " +"of :class:`http.server.BaseHTTPRequestHandler` that will be used to process " +"requests." msgstr "" -":class:`WSGIServer` インスタンスを作成します。 *server_address* は ``(host," -"port)`` のタプル、そして *RequestHandlerClass* はリクエストの処理に使われる :" -"class:`http.server.BaseHTTPRequestHandler` のサブクラスでなければいけません。" +":class:`WSGIServer` インスタンスを作成します。 *server_address* は " +"``(host,port)`` のタプル、そして *RequestHandlerClass* はリクエストの処理に使" +"われる :class:`http.server.BaseHTTPRequestHandler` のサブクラスでなければいけ" +"ません。" #: ../../library/wsgiref.rst:326 msgid "" -"You do not normally need to call this constructor, as the :func:" -"`make_server` function can handle all the details for you." +"You do not normally need to call this constructor, as " +"the :func:`make_server` function can handle all the details for you." msgstr "" ":func:`make_server` が細かい調整をやってくれるので、通常はこのコンストラクタ" "を呼ぶ必要はありません。" @@ -576,37 +627,38 @@ msgstr "" "呼び出し可能 (callable) な *application* をリクエストを受け取る WSGI アプリ" "ケーションとして設定します。" -#: ../../library/wsgiref.rst:342 msgid "Returns the currently set application callable." msgstr "" +"現在設定されているアプリケーションの呼び出し可能オブジェクトを返します。" #: ../../library/wsgiref.rst:344 msgid "" -"Normally, however, you do not need to use these additional methods, as :meth:" -"`set_app` is normally called by :func:`make_server`, and the :meth:`get_app` " -"exists mainly for the benefit of request handler instances." +"Normally, however, you do not need to use these additional methods, " +"as :meth:`set_app` is normally called by :func:`make_server`, and " +"the :meth:`get_app` exists mainly for the benefit of request handler " +"instances." msgstr "" -"しかしながら、通常はこれらの追加されたメソッドを使う必要はありません。 :meth:" -"`set_app` は普通は :func:`make_server` によって呼ばれ、 :meth:`get_app` は主" -"にリクエストハンドラインスタンスの便宜上存在するからです。" +"しかしながら、通常はこれらの追加されたメソッドを使う必要はありませ" +"ん。 :meth:`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)." +"*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 "" "You do not need to create instances of this class directly; they are " "automatically created as needed by :class:`WSGIServer` objects. You can, " -"however, subclass this class and supply it as a *handler_class* to the :func:" -"`make_server` function. Some possibly relevant methods for overriding in " -"subclasses:" +"however, subclass this class and supply it as a *handler_class* to " +"the :func:`make_server` function. Some possibly relevant methods for " +"overriding in subclasses:" msgstr "" "このクラスのインスタンスを直接生成する必要はありません; これらは必要に応じ" "て :class:`WSGIServer` オブジェクトによって自動的に生成されます。しかしなが" @@ -637,15 +689,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" @@ -654,10 +705,10 @@ msgstr ":mod:`wsgiref.validate` --- WSGI 準拠チェッカー" #: ../../library/wsgiref.rst:392 msgid "" "When creating new WSGI application objects, frameworks, servers, or " -"middleware, it can be useful to validate the new code's conformance using :" -"mod:`wsgiref.validate`. This module provides a function that creates WSGI " -"application objects that validate communications between a WSGI server or " -"gateway and a WSGI application object, to check both sides for protocol " +"middleware, it can be useful to validate the new code's conformance " +"using :mod:`wsgiref.validate`. This module provides a function that creates " +"WSGI application objects that validate communications between a WSGI server " +"or gateway and a WSGI application object, to check both sides for protocol " "conformance." msgstr "" "WSGI アプリケーションのオブジェクト、フレームワーク、サーバまたはミドルウェア" @@ -684,8 +735,8 @@ msgid "" "This module is based on the :mod:`paste.lint` module from Ian Bicking's " "\"Python Paste\" library." msgstr "" -"このモジュールは lan Bicking の \"Python Paste\" ライブラリの :mod:`paste." -"lint` モジュールをベースにしています。" +"このモジュールは lan Bicking の \"Python Paste\" ライブラリ" +"の :mod:`paste.lint` モジュールをベースにしています。" #: ../../library/wsgiref.rst:410 msgid "" @@ -713,8 +764,8 @@ msgstr "" "し、このエラーがどう扱われるかはサーバ依存であることに注意してください。例え" "ば、 :mod:`wsgiref.simple_server` とその他 :mod:`wsgiref.handlers` ベースの" "サーバ(エラー処理メソッドが他のことをするようにオーバライドしていないもの)" -"は単純にエラーが発生したというメッセージとトレースバックのダンプを ``sys." -"stderr`` やその他のエラーストリームに出力します。" +"は単純にエラーが発生したというメッセージとトレースバックのダンプを " +"``sys.stderr`` やその他のエラーストリームに出力します。" #: ../../library/wsgiref.rst:422 msgid "" @@ -786,15 +837,15 @@ msgstr "" #: ../../library/wsgiref.rst:473 msgid "" -"This class is a subclass of :class:`BaseCGIHandler` that sets ``wsgi." -"run_once`` to true, ``wsgi.multithread`` to false, and ``wsgi.multiprocess`` " -"to true, and always uses :mod:`sys` and :mod:`os` to obtain the necessary " -"CGI streams and environment." +"This class is a subclass of :class:`BaseCGIHandler` that sets " +"``wsgi.run_once`` to true, ``wsgi.multithread`` to false, and " +"``wsgi.multiprocess`` to true, and always uses :mod:`sys` and :mod:`os` to " +"obtain the necessary CGI streams and environment." msgstr "" -"このクラスは :class:`BaseCGIHandler` のサブクラスで、これは ``wsgi." -"run_once`` を true、 ``wsgi.multithread`` を false、そして ``wsgi." -"multiprocess`` を true にセットし、常に :mod:`sys` と :mod:`os` を、必要な " -"CGI ストリームと環境を取得するために使用します。" +"このクラスは :class:`BaseCGIHandler` のサブクラスで、これは " +"``wsgi.run_once`` を true、 ``wsgi.multithread`` を false、そして " +"``wsgi.multiprocess`` を true にセットし、常に :mod:`sys` と :mod:`os` を、必" +"要な CGI ストリームと環境を取得するために使用します。" #: ../../library/wsgiref.rst:481 msgid "" @@ -806,14 +857,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,22 +876,34 @@ 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." +"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 "" -"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and :mod:" -"`os` modules, the CGI environment and I/O streams are specified explicitly. " -"The *multithread* and *multiprocess* values are used to set the ``wsgi." -"multithread`` and ``wsgi.multiprocess`` flags for any applications run by " -"the handler instance." +"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` " +"and :mod:`os` modules, the CGI environment and I/O streams are specified " +"explicitly. The *multithread* and *multiprocess* values are used to set the " +"``wsgi.multithread`` and ``wsgi.multiprocess`` flags for any applications " +"run by the handler instance." msgstr "" ":class:`CGIHandler` に似ていますが、 :mod:`sys` と :mod:`os` モジュールを使う" "代わりに CGI 環境と I/O ストリームを明示的に指定します。 *multithread* と " @@ -866,25 +931,35 @@ msgid "" "probably want to subclass this instead of :class:`BaseCGIHandler`." msgstr "" ":class:`BaseCGIHandler` と似ていますが、HTTP の本サーバと使うためにデザインさ" -"れています。もしあなたが HTTP サーバ実装を書いている場合、おそらく :class:" -"`BaseCGIHandler` ではなくこのクラスをサブクラス化するとよいでしょう。" +"れています。もしあなたが 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`, :" -"meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, and :meth:" -"`~BaseHandler._flush` methods to support explicitly setting the environment " -"and streams via the constructor. The supplied environment and streams are " -"stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:" -"`environ` attributes." -msgstr "" +"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, " +"and :meth:`~BaseHandler._flush` methods to support explicitly setting the " +"environment and streams via the constructor. The supplied environment and " +"streams are 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 +1017,23 @@ 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 "" @@ -967,8 +1046,8 @@ msgid "" "Here are some other methods and attributes you may wish to override. This " "list is only a summary, however, and does not include every method that can " "be overridden. You should consult the docstrings and source code for " -"additional information before attempting to create a customized :class:" -"`BaseHandler` subclass." +"additional information before attempting to create a " +"customized :class:`BaseHandler` subclass." msgstr "" "オーバーライドされることの多いメソッド及び属性を以下に挙げます。しかし、この" "リストは単にサマリであり、オーバーライド可能なすべてのメソッドは含んでいませ" @@ -1012,10 +1091,10 @@ msgstr "" #: ../../library/wsgiref.rst:623 msgid "" "The default environment variables to be included in every request's WSGI " -"environment. By default, this is a copy of ``os.environ`` at the time that :" -"mod:`wsgiref.handlers` was imported, but subclasses can either create their " -"own at the class or instance level. Note that the dictionary should be " -"considered read-only, since the default value is shared between multiple " +"environment. By default, this is a copy of ``os.environ`` at the time " +"that :mod:`wsgiref.handlers` was imported, but subclasses can either create " +"their own at the class or instance level. Note that the dictionary should " +"be considered read-only, since the default value is shared between multiple " "classes and instances." msgstr "" "すべてのリクエストの WSGI 環境に含まれるデフォルトの環境変数。デフォルトで" @@ -1034,9 +1113,9 @@ msgid "" msgstr "" ":attr:`origin_server` 属性が設定されている場合、この属性の値がデフォルトの " "``SERVER_SOFTWARE`` WSGI 環境変数の設定や HTTP レスポンス中のデフォルトの " -"``Server:`` ヘッダの設定に使われます。これは (:class:`BaseCGIHandler` や :" -"class:`CGIHandler` のような) HTTP オリジンサーバでないハンドラでは無視されま" -"す。" +"``Server:`` ヘッダの設定に使われます。これは (:class:`BaseCGIHandler` " +"や :class:`CGIHandler` のような) HTTP オリジンサーバでないハンドラでは無視さ" +"れます。" #: ../../library/wsgiref.rst:639 msgid "" @@ -1049,13 +1128,14 @@ msgstr "" #: ../../library/wsgiref.rst:645 msgid "" "Return the URL scheme being used for the current request. The default " -"implementation uses the :func:`guess_scheme` function from :mod:`wsgiref." -"util` to guess whether the scheme should be \"http\" or \"https\", based on " -"the current request's :attr:`environ` variables." +"implementation uses the :func:`guess_scheme` function " +"from :mod:`wsgiref.util` to guess whether the scheme should be \"http\" or " +"\"https\", based on the current request's :attr:`environ` variables." msgstr "" -"現在のリクエストで使われている URL スキームを返します。デフォルト実装は :mod:" -"`wsgiref.util` の :func:`guess_scheme` を使い、現在のリクエストの :attr:" -"`environ` 変数に基づいてスキームが\"http\" か \"https\" かを推測します。" +"現在のリクエストで使われている URL スキームを返します。デフォルト実装" +"は :mod:`wsgiref.util` の :func:`guess_scheme` を使い、現在のリクエスト" +"の :attr:`environ` 変数に基づいてスキームが\"http\" か \"https\" かを推測しま" +"す。" #: ../../library/wsgiref.rst:653 msgid "" @@ -1067,11 +1147,11 @@ msgid "" "attribute is a true value and the :attr:`server_software` attribute is set." msgstr "" ":attr:`environ` 属性を、フル実装 (fully populated) の WSGI 環境に設定します。" -"デフォルトの実装は、上記すべてのメソッドと属性、加えて :meth:`get_stdin` 、 :" -"meth:`get_stderr` 、 :meth:`add_cgi_vars` メソッドと :attr:" -"`wsgi_file_wrapper` 属性を利用します。これは、キーが存在せず、 :attr:" -"`origin_server` 属性が true 値で :attr:`server_software` 属性も設定されている" -"場合に ``SERVER_SOFTWARE`` を挿入します。" +"デフォルトの実装は、上記すべてのメソッドと属性、加え" +"て :meth:`get_stdin` 、 :meth:`get_stderr` 、 :meth:`add_cgi_vars` メソッド" +"と :attr:`wsgi_file_wrapper` 属性を利用します。これは、キーが存在せ" +"ず、 :attr:`origin_server` 属性が true 値で :attr:`server_software` 属性も設" +"定されている場合に ``SERVER_SOFTWARE`` を挿入します。" #: ../../library/wsgiref.rst:660 msgid "Methods and attributes for customizing exception handling:" @@ -1095,8 +1175,8 @@ msgstr "" #: ../../library/wsgiref.rst:674 msgid "" -"The maximum number of frames to include in tracebacks output by the default :" -"meth:`log_exception` method. If ``None``, all frames are included." +"The maximum number of frames to include in tracebacks output by the " +"default :meth:`log_exception` method. If ``None``, all frames are included." msgstr "" "デフォルトの :meth:`log_exception` メソッドで出力されるトレースバック出力に含" "まれる最大のフレーム数です。 ``None`` ならば、すべてのフレームが含まれます。" @@ -1110,7 +1190,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,16 +1197,23 @@ 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 "" -"The default implementation just uses the :attr:`error_status`, :attr:" -"`error_headers`, and :attr:`error_body` attributes to generate an output " -"page. Subclasses can override this to produce more dynamic error output." +"The default implementation just uses " +"the :attr:`error_status`, :attr:`error_headers`, and :attr:`error_body` " +"attributes to generate an output page. Subclasses can override this to " +"produce more dynamic error output." msgstr "" -"デフォルト実装は単に :attr:`error_status` 、 :attr:`error_headers` 、 :attr:" -"`error_body` 属性を出力ページの生成に使います。サブクラスではこれをオーバーラ" -"イドしてもっと動的なエラー出力をすることができます。" +"デフォルト実装は単" +"に :attr:`error_status` 、 :attr:`error_headers` 、 :attr:`error_body` 属性を" +"出力ページの生成に使います。サブクラスではこれをオーバーライドしてもっと動的" +"なエラー出力をすることができます。" #: ../../library/wsgiref.rst:693 msgid "" @@ -1178,12 +1264,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." +"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 "" @@ -1221,8 +1309,8 @@ msgid "" "This attribute's default value is true in :class:`BaseHandler`, but false " "in :class:`BaseCGIHandler` and :class:`CGIHandler`." msgstr "" -"この属性のデフォルト値は :class:`BaseHandler` では true ですが、 :class:" -"`BaseCGIHandler` と :class:`CGIHandler` では false です。" +"この属性のデフォルト値は :class:`BaseHandler` では true です" +"が、 :class:`BaseCGIHandler` と :class:`CGIHandler` では false です。" #: ../../library/wsgiref.rst:754 msgid "" @@ -1233,80 +1321,97 @@ 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 :" -"class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " +"unicode\" strings, returning a new dictionary. This function is used " +"by :class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " "``os.environ``, which is not necessarily WSGI-compliant on all platforms and " "web servers using Python 3 -- specifically, ones where the OS's actual " "environment is Unicode (i.e. Windows), or ones where the environment is " "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`." +"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 +1439,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..4fc709388 100644 --- a/library/xdrlib.po +++ b/library/xdrlib.po @@ -12,25 +12,28 @@ 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 "" -"This module is no longer part of the Python standard library. It was :ref:" -"`removed in Python 3.13 ` after being deprecated in " -"Python 3.11. The removal was decided in :pep:`594`." +"This module is no longer part of the Python standard library. It " +"was :ref:`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..acfcc608a 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 @@ -39,8 +39,8 @@ msgid "" ":mod:`xml.dom.minidom` is a minimal implementation of the Document Object " "Model interface, with an API similar to that in other languages. It is " "intended to be simpler than the full DOM and also significantly smaller. " -"Users who are not already proficient with the DOM should consider using the :" -"mod:`xml.etree.ElementTree` module for their XML processing instead." +"Users who are not already proficient with the DOM should consider using " +"the :mod:`xml.etree.ElementTree` module for their XML processing instead." msgstr "" ":mod:`xml.dom.minidom` は、 Document Object Model インターフェースの最小の実" "装です。他言語の実装と似た API を持ちます。このモジュールは、完全な DOM に比" @@ -60,13 +60,12 @@ msgstr "" #: ../../library/xml.dom.minidom.rst:29 msgid "" -"DOM applications typically start by parsing some XML into a DOM. With :mod:" -"`xml.dom.minidom`, this is done through the parse functions::" +"DOM applications typically start by parsing some XML into a DOM. " +"With :mod:`xml.dom.minidom`, this is done through the parse functions::" 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 "" @@ -110,8 +118,8 @@ msgstr "" #: ../../library/xml.dom.minidom.rst:58 msgid "" "Return a :class:`Document` that represents the *string*. This method creates " -"an :class:`io.StringIO` object for the string and passes that on to :func:" -"`parse`." +"an :class:`io.StringIO` object for the string and passes that on " +"to :func:`parse`." msgstr "" "*string* を表わす :class:`Document` を返します。このメソッドは、文字列に対す" "る :class:`io.StringIO` オブジェクトを作成し、それを :func:`parse` に渡しま" @@ -145,18 +153,17 @@ msgstr "" #: ../../library/xml.dom.minidom.rst:71 msgid "" "You can also create a :class:`Document` by calling a method on a \"DOM " -"Implementation\" object. You can get this object either by calling the :" -"func:`getDOMImplementation` function in the :mod:`xml.dom` package or the :" -"mod:`xml.dom.minidom` module. Once you have a :class:`Document`, you can " -"add child nodes to it to populate the DOM::" +"Implementation\" object. You can get this object either by calling " +"the :func:`getDOMImplementation` function in the :mod:`xml.dom` package or " +"the :mod:`xml.dom.minidom` module. Once you have a :class:`Document`, you " +"can add child nodes to it to populate the DOM::" msgstr "" "\"DOM 実装\" オブジェクトのメソッドを呼び出して :class:`Document` を生成する" -"こともできます。このオブジェクトは、 :mod:`xml.dom` パッケージ、または :mod:" -"`xml.dom.minidom` モジュールの :func:`getDOMImplementation` 関数を呼び出して" -"取得できます。 :class:`Document` を取得したら、DOM を構成するために子ノードを" -"追加していくことができます::" +"こともできます。このオブジェクトは、 :mod:`xml.dom` パッケージ、また" +"は :mod:`xml.dom.minidom` モジュールの :func:`getDOMImplementation` 関数を呼" +"び出して取得できます。 :class:`Document` を取得したら、DOM を構成するために子" +"ノードを追加していくことができます::" -#: ../../library/xml.dom.minidom.rst:77 msgid "" "from xml.dom.minidom import getDOMImplementation\n" "\n" @@ -167,42 +174,51 @@ 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 " -"in the DOM specification. The main property of the document object is the :" -"attr:`documentElement` property. It gives you the main element in the XML " -"document: the one that holds all others. Here is an example program::" +"in the DOM specification. The main property of the document object is " +"the :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 "" -"When you are finished with a DOM tree, you may optionally call the :meth:" -"`unlink` method to encourage early cleanup of the now-unneeded objects. :" -"meth:`unlink` is an :mod:`xml.dom.minidom`\\ -specific extension to the DOM " -"API that renders the node and its descendants essentially useless. " -"Otherwise, Python's garbage collector will eventually take care of the " -"objects in the tree." +"When you are finished with a DOM tree, you may optionally call " +"the :meth:`unlink` method to encourage early cleanup of the now-unneeded " +"objects. :meth:`unlink` is an :mod:`xml.dom.minidom`\\ -specific extension " +"to the DOM API that renders the node and its descendants essentially " +"useless. Otherwise, Python's garbage collector will eventually take care of " +"the objects in the tree." msgstr "" "DOM ツリーを使い終えたとき、 :meth:`unlink` メソッドを呼び出して不要になった" -"オブジェクトが早く片付けられるように働きかけることができます。 :meth:" -"`unlink` は、 DOM API に対する :mod:`xml.dom.minidom` 特有の拡張で、ノードと" -"その下位ノードを本質的に無意味なものとします。このメソッドを呼び出さなくて" -"も、 Python のガベージコレクタがいつかはツリーのオブジェクトを後片付けしま" -"す。" +"オブジェクトが早く片付けられるように働きかけることができま" +"す。 :meth:`unlink` は、 DOM API に対する :mod:`xml.dom.minidom` 特有の拡張" +"で、ノードとその下位ノードを本質的に無意味なものとします。このメソッドを呼び" +"出さなくても、 Python のガベージコレクタがいつかはツリーのオブジェクトを後片" +"付けします。" #: ../../library/xml.dom.minidom.rst:104 msgid "" @@ -222,9 +238,9 @@ msgstr "DOM オブジェクト" #: ../../library/xml.dom.minidom.rst:113 msgid "" -"The definition of the DOM API for Python is given as part of the :mod:`xml." -"dom` module documentation. This section lists the differences between the " -"API and :mod:`xml.dom.minidom`." +"The definition of the DOM API for Python is given as part of " +"the :mod:`xml.dom` module documentation. This section lists the differences " +"between the API and :mod:`xml.dom.minidom`." msgstr "" "Python の DOM API 定義は :mod:`xml.dom` モジュールドキュメントの一部として与" "えられています。この節では、 :mod:`xml.dom` の API と :mod:`xml.dom.minidom` " @@ -250,18 +266,19 @@ msgstr "" #: ../../library/xml.dom.minidom.rst:127 msgid "" "You can avoid calling this method explicitly by using the :keyword:`with` " -"statement. The following code will automatically unlink *dom* when the :" -"keyword:`!with` block is exited::" +"statement. The following code will automatically unlink *dom* when " +"the :keyword:`!with` block is exited::" msgstr "" ":keyword:`with` ステートメントを使用することで、このメソッドを明示的に呼ばな" "いようにできます。 :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 @@ -360,8 +376,8 @@ msgstr "" #: ../../library/xml.dom.minidom.rst:190 msgid "" -"The *encoding* argument behaves like the corresponding argument of :meth:" -"`toxml`." +"The *encoding* argument behaves like the corresponding argument " +"of :meth:`toxml`." msgstr "*encoding* 引数は :meth:`toxml` の対応する引数と同様に振る舞います。" #: ../../library/xml.dom.minidom.rst:195 @@ -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" @@ -482,10 +561,10 @@ msgid "" "operations." msgstr "" "インターフェースはインスタンスオブジェクトを介してアクセスされます。アプリ" -"ケーション自身から、クラスをインスタンス化してはなりません; :class:" -"`Document` オブジェクト上で利用可能な生成関数 (creator function) を使わなけれ" -"ばなりません。派生インターフェースでは基底インターフェースの全ての演算 (およ" -"び属性) に加え、新たな演算をサポートします。" +"ケーション自身から、クラスをインスタンス化してはなりませ" +"ん; :class:`Document` オブジェクト上で利用可能な生成関数 (creator function) " +"を使わなければなりません。派生インターフェースでは基底インターフェースの全て" +"の演算 (および属性) に加え、新たな演算をサポートします。" #: ../../library/xml.dom.minidom.rst:229 msgid "" @@ -505,9 +584,10 @@ msgid "" "``readonly`` attributes must not be changed; this is not enforced at runtime." msgstr "" "IDL 属性はインスタンス属性に対応付けられます。OMG IDL 言語における Python へ" -"の対応付けとの互換性のために、属性 ``foo`` はアクセサメソッド :meth:" -"`_get_foo` および :meth:`_set_foo` でもアクセスできます。 ``readonly`` 属性は" -"変更してはなりません; とはいえ、これは実行時には強制されません。" +"の対応付けとの互換性のために、属性 ``foo`` はアクセサメソッ" +"ド :meth:`_get_foo` および :meth:`_set_foo` でもアクセスできます。 " +"``readonly`` 属性は変更してはなりません; とはいえ、これは実行時には強制されま" +"せん。" #: ../../library/xml.dom.minidom.rst:238 msgid "" @@ -524,10 +604,10 @@ msgid "" "of type ``DOMString`` may also be ``None`` where allowed to have the IDL " "``null`` value by the DOM specification from the W3C." msgstr "" -"``DOMString`` 型は Python 文字列型に対応付けられます。 :mod:`xml.dom." -"minidom` ではバイト列か文字列のどちらかに対応づけられますが、通常文字列を生成" -"します。 ``DOMString`` 型の値は、W3C の DOM 仕様で、IDL ``null`` 値になっても" -"よいとされている場所では ``None`` になることもあります。" +"``DOMString`` 型は Python 文字列型に対応付けられま" +"す。 :mod:`xml.dom.minidom` ではバイト列か文字列のどちらかに対応づけられます" +"が、通常文字列を生成します。 ``DOMString`` 型の値は、W3C の DOM 仕様で、IDL " +"``null`` 値になってもよいとされている場所では ``None`` になることもあります。" #: ../../library/xml.dom.minidom.rst:246 msgid "" @@ -535,19 +615,19 @@ msgid "" "``xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE``); they must not be " "changed." msgstr "" -"``const`` 宣言を行うと、 (``xml.dom.minidom.Node." -"PROCESSING_INSTRUCTION_NODE`` のように) 対応するスコープ内の変数に対応付けを" -"行います; これらは変更してはなりません。" +"``const`` 宣言を行うと、 " +"(``xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE`` のように) 対応するス" +"コープ内の変数に対応付けを行います; これらは変更してはなりません。" #: ../../library/xml.dom.minidom.rst:249 msgid "" "``DOMException`` is currently not supported in :mod:`xml.dom.minidom`. " -"Instead, :mod:`xml.dom.minidom` uses standard Python exceptions such as :exc:" -"`TypeError` and :exc:`AttributeError`." +"Instead, :mod:`xml.dom.minidom` uses standard Python exceptions such " +"as :exc:`TypeError` and :exc:`AttributeError`." msgstr "" "``DOMException`` は現状では :mod:`xml.dom.minidom` でサポートされていません。" -"その代わり、 :mod:`xml.dom.minidom` は、 :exc:`TypeError` や :exc:" -"`AttributeError` といった標準の Python 例外を使います。" +"その代わり、 :mod:`xml.dom.minidom` は、 :exc:`TypeError` " +"や :exc:`AttributeError` といった標準の Python 例外を使います。" #: ../../library/xml.dom.minidom.rst:253 msgid "" @@ -600,6 +680,7 @@ msgid "" msgstr "" "XML 出力に含まれるエンコード名は適切な規格に従っていなければなりません。例え" "ば \"UTF-8\" は有効ですが、 \"UTF8\" は XML 文書の宣言では有効ではありませ" -"ん。後者はエンコード名として Python に認められるとしてもです。https://www.w3." -"org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl と https://www.iana.org/" -"assignments/character-sets/character-sets.xhtml を参照してください。" +"ん。後者はエンコード名として Python に認められるとしてもです。https://" +"www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl と https://" +"www.iana.org/assignments/character-sets/character-sets.xhtml を参照してくださ" +"い。" diff --git a/library/xml.dom.po b/library/xml.dom.po index 2e3d1f673..653dd78e7 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 @@ -110,12 +111,12 @@ msgstr "" "ベル 2 では限定的な改良だけが行われました: レベル 2 では :class:`Document` を" "生成するメソッドを提供する :class:`DOMImplementation` オブジェクトクラスがあ" "りますが、実装に依存しない方法で XML リーダ(reader)/パーザ(parser)/文書ビル" -"ダ (Document builder) にアクセスする方法はありません。また、既存の :class:" -"`Document` オブジェクトなしにこれらのメソッドにアクセスするような、よく定義さ" -"れた方法もありません。 Python では、各々の DOM 実装で :func:" -"`getDOMImplementation` が定義されているはずです。 DOM レベル 3 ではロード" -"(Load)/ストア(Store) 仕様が追加され、リーダのインターフェースにを定義していま" -"すが、Python 標準ライブラリではまだ利用することができません。" +"ダ (Document builder) にアクセスする方法はありません。また、既存" +"の :class:`Document` オブジェクトなしにこれらのメソッドにアクセスするような、" +"よく定義された方法もありません。 Python では、各々の DOM 実装" +"で :func:`getDOMImplementation` が定義されているはずです。 DOM レベル 3 では" +"ロード(Load)/ストア(Store) 仕様が追加され、リーダのインターフェースにを定義し" +"ていますが、Python 標準ライブラリではまだ利用することができません。" #: ../../library/xml.dom.rst:56 msgid "" @@ -146,11 +147,11 @@ msgstr "" #: ../../library/xml.dom.rst:70 msgid "" -"`Document Object Model (DOM) Level 2 Specification `_" +"`Document Object Model (DOM) Level 2 Specification `_" msgstr "" -"`Document Object Model (DOM) Level 2 Specification `_" +"`Document Object Model (DOM) Level 2 Specification `_" #: ../../library/xml.dom.rst:71 msgid "The W3C recommendation upon which the Python DOM API is based." @@ -229,8 +230,8 @@ msgstr "" "*name* が与えられない場合、利用可能な実装を調べて、指定された機能 (feature) " "セットを持つものを探します。実装が見つからなければ :exc:`ImportError` を送出" "します。 *features* のリストは ``(feature, version)`` のペアからなるシーケン" -"スで、利用可能な :class:`DOMImplementation` オブジェクトの :meth:" -"`hasFeature` メソッドに渡されます。" +"スで、利用可能な :class:`DOMImplementation` オブジェクト" +"の :meth:`hasFeature` メソッドに渡されます。" #: ../../library/xml.dom.rst:109 msgid "Some convenience constants are also provided:" @@ -279,8 +280,8 @@ msgid "" "exception classes. The :class:`Node` class provided by this module does not " "implement any of the methods or attributes defined by the DOM specification; " "concrete DOM implementations must provide those. The :class:`Node` class " -"provided as part of this module does provide the constants used for the :" -"attr:`nodeType` attribute on concrete :class:`Node` objects; they are " +"provided as part of this module does provide the constants used for " +"the :attr:`nodeType` attribute on concrete :class:`Node` objects; they are " "located within the class rather than at the module level to conform with the " "DOM specifications." msgstr "" @@ -288,9 +289,9 @@ msgstr "" "が収められています。このモジュールで提供されている :class:`Node` クラスは " "DOM 仕様で定義されているメソッドや属性は何ら実装していません; これらは具体的" "な DOM 実装において提供しなければなりません。このモジュールの一部として提供さ" -"れている :class:`Node` クラスでは、具体的な :class:`Node` オブジェクトの :" -"attr:`nodeType` 属性として使う定数を提供しています; これらの定数は、DOM 仕様" -"に適合するため、クラスではなくモジュールのレベルに配置されています。" +"れている :class:`Node` クラスでは、具体的な :class:`Node` オブジェクト" +"の :attr:`nodeType` 属性として使う定数を提供しています; これらの定数は、DOM " +"仕様に適合するため、クラスではなくモジュールのレベルに配置されています。" #: ../../library/xml.dom.rst:153 msgid "Objects in the DOM" @@ -461,14 +462,15 @@ msgstr "DOMImplementation オブジェクト" msgid "" "The :class:`DOMImplementation` interface provides a way for applications to " "determine the availability of particular features in the DOM they are using. " -"DOM Level 2 added the ability to create new :class:`Document` and :class:" -"`DocumentType` objects using the :class:`DOMImplementation` as well." +"DOM Level 2 added the ability to create new :class:`Document` " +"and :class:`DocumentType` objects using the :class:`DOMImplementation` as " +"well." msgstr "" ":class:`DOMImplementation` インターフェースは、利用している DOM 実装において" "特定の機能が利用可能かどうかを決定するための方法をアプリケーションに提供しま" -"す。DOM レベル 2 では、 :class:`DOMImplementation` を使って新たな :class:" -"`Document` オブジェクトや :class:`DocumentType` オブジェクトを生成する機能も" -"追加しています。" +"す。DOM レベル 2 では、 :class:`DOMImplementation` を使って新た" +"な :class:`Document` オブジェクトや :class:`DocumentType` オブジェクトを生成" +"する機能も追加しています。" #: ../../library/xml.dom.rst:213 msgid "" @@ -478,22 +480,21 @@ 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*. " -"The *doctype* must be a :class:`DocumentType` object created by :meth:" -"`createDocumentType`, or ``None``. In the Python DOM API, the first two " -"arguments can also be ``None`` in order to indicate that no :class:`Element` " -"child is to be created." +"Return a new :class:`Document` object (the root of the DOM), with a " +"child :class:`Element` object having the given *namespaceUri* and " +"*qualifiedName*. The *doctype* must be a :class:`DocumentType` object " +"created by :meth:`createDocumentType`, or ``None``. In the Python DOM API, " +"the first two 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 "" @@ -517,17 +518,12 @@ msgstr "XML 文書の全ての構成要素は :class:`Node` のサブクラス #: ../../library/xml.dom.rst:244 msgid "" "An integer representing the node type. Symbolic constants for the types are " -"on the :class:`Node` object: :const:`ELEMENT_NODE`, :const:" -"`ATTRIBUTE_NODE`, :const:`TEXT_NODE`, :const:`CDATA_SECTION_NODE`, :const:" -"`ENTITY_NODE`, :const:`PROCESSING_INSTRUCTION_NODE`, :const:`COMMENT_NODE`, :" -"const:`DOCUMENT_NODE`, :const:`DOCUMENT_TYPE_NODE`, :const:`NOTATION_NODE`. " +"on the :class:`Node` " +"object: :const:`ELEMENT_NODE`, :const:`ATTRIBUTE_NODE`, :const:`TEXT_NODE`, :const:`CDATA_SECTION_NODE`, :const:`ENTITY_NODE`, :const:`PROCESSING_INSTRUCTION_NODE`, :const:`COMMENT_NODE`, :const:`DOCUMENT_NODE`, :const:`DOCUMENT_TYPE_NODE`, :const:`NOTATION_NODE`. " "This is a read-only attribute." msgstr "" -"ノード (node) の型を表現する整数値です。型に対応する以下のシンボル定数: :" -"const:`ELEMENT_NODE` 、 :const:`ATTRIBUTE_NODE` 、 :const:`TEXT_NODE` 、 :" -"const:`CDATA_SECTION_NODE` 、 :const:`ENTITY_NODE` 、 :const:" -"`PROCESSING_INSTRUCTION_NODE` 、 :const:`COMMENT_NODE` 、 :const:" -"`DOCUMENT_NODE` 、 :const:`DOCUMENT_TYPE_NODE` 、 :const:`NOTATION_NODE` 、" +"ノード (node) の型を表現する整数値です。型に対応する以下のシンボル定" +"数: :const:`ELEMENT_NODE` 、 :const:`ATTRIBUTE_NODE` 、 :const:`TEXT_NODE` 、 :const:`CDATA_SECTION_NODE` 、 :const:`ENTITY_NODE` 、 :const:`PROCESSING_INSTRUCTION_NODE` 、 :const:`COMMENT_NODE` 、 :const:`DOCUMENT_NODE` 、 :const:`DOCUMENT_TYPE_NODE` 、 :const:`NOTATION_NODE` 、" "が :class:`Node` オブジェクトで定義されています。読み出し専用の属性です。" #: ../../library/xml.dom.rst:254 @@ -572,13 +568,14 @@ msgstr "" #: ../../library/xml.dom.rst:280 msgid "" -"The node that immediately follows this one with the same parent. See also :" -"attr:`previousSibling`. If this is the last child of the parent, this " +"The node that immediately follows this one with the same parent. See " +"also :attr:`previousSibling`. If this is the last child of the parent, this " "attribute will be ``None``. This is a read-only attribute." msgstr "" -"このノードと同じ親ノードを持ち、直後にくるノードです。例えば、 :attr:" -"`previousSibling` も参照してください。このノードが親ノードにおける末尾の子" -"ノードである場合、属性値は ``None`` になります。読み出し専用の属性です。" +"このノードと同じ親ノードを持ち、直後にくるノードです。例え" +"ば、 :attr:`previousSibling` も参照してください。このノードが親ノードにおける" +"末尾の子ノードである場合、属性値は ``None`` になります。読み出し専用の属性で" +"す。" #: ../../library/xml.dom.rst:287 msgid "" @@ -608,8 +605,8 @@ msgid "" "The part of the :attr:`tagName` following the colon if there is one, else " "the entire :attr:`tagName`. The value is a string." msgstr "" -":attr:`tagName` にコロンがあれば、コロン以降の部分に、なければ :attr:" -"`tagName` 全体になります。値は文字列です。" +":attr:`tagName` にコロンがあれば、コロン以降の部分に、なけれ" +"ば :attr:`tagName` 全体になります。値は文字列です。" #: ../../library/xml.dom.rst:310 msgid "" @@ -631,16 +628,16 @@ msgstr "" msgid "" "This has a different meaning for each node type; see the DOM specification " "for details. You can always get the information you would get here from " -"another property such as the :attr:`tagName` property for elements or the :" -"attr:`name` property for attributes. For all node types, the value of this " -"attribute will be either a string or ``None``. This is a read-only " +"another property such as the :attr:`tagName` property for elements or " +"the :attr:`name` property for attributes. For all node types, the value of " +"this attribute will be either a string or ``None``. This is a read-only " "attribute." msgstr "" "この属性はノード型ごとに異なる意味を持ちます。その詳細は DOM 仕様を参照してく" -"ださい。この属性で得られることになる情報は、全てのノード型では :attr:" -"`tagName` 、属性では :attr:`name` プロパティといったように、常に他のプロパ" -"ティで得ることができます。全てのノード型で、この属性の値は文字列か ``None`` " -"になります。読み出し専用の属性です。" +"ださい。この属性で得られることになる情報は、全てのノード型で" +"は :attr:`tagName` 、属性では :attr:`name` プロパティといったように、常に他の" +"プロパティで得ることができます。全てのノード型で、この属性の値は文字列か " +"``None`` になります。読み出し専用の属性です。" #: ../../library/xml.dom.rst:331 msgid "" @@ -660,15 +657,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 "" @@ -706,9 +702,10 @@ msgstr "" #: ../../library/xml.dom.rst:377 msgid "" -"Remove a child node. *oldChild* must be a child of this node; if not, :exc:" -"`ValueError` is raised. *oldChild* is returned on success. If *oldChild* " -"will not be used further, its :meth:`unlink` method should be called." +"Remove a child node. *oldChild* must be a child of this node; if " +"not, :exc:`ValueError` is raised. *oldChild* is returned on success. If " +"*oldChild* will not be used further, its :meth:`unlink` method should be " +"called." msgstr "" "子ノードを削除します。 *oldChild* はこのノードの子ノードでなければなりませ" "ん。そうでない場合、 :exc:`ValueError` が送出されます。成功した場合 " @@ -726,9 +723,9 @@ msgstr "" #: ../../library/xml.dom.rst:390 msgid "" -"Join adjacent text nodes so that all stretches of text are stored as single :" -"class:`Text` instances. This simplifies processing text from a DOM tree for " -"many applications." +"Join adjacent text nodes so that all stretches of text are stored as " +"single :class:`Text` instances. This simplifies processing text from a DOM " +"tree for many applications." msgstr "" "一続きのテキスト全体を一個の :class:`Text` インスタンスとして保存するために隣" "接するテキストノードを結合します。これにより、多くのアプリケーションで DOM ツ" @@ -750,17 +747,18 @@ msgstr "NodeList オブジェクト" msgid "" "A :class:`NodeList` represents a sequence of nodes. These objects are used " "in two ways in the DOM Core recommendation: an :class:`Element` object " -"provides one as its list of child nodes, and the :meth:" -"`getElementsByTagName` and :meth:`getElementsByTagNameNS` methods of :class:" -"`Node` return objects with this interface to represent query results." +"provides one as its list of child nodes, and " +"the :meth:`getElementsByTagName` and :meth:`getElementsByTagNameNS` methods " +"of :class:`Node` return objects with this interface to represent query " +"results." msgstr "" ":class:`NodeList` はノードのシーケンスを表現します。\n" "これらのオブジェクトは DOM コア勧告 (DOM Core recommendation) において、二通" "りに使われています: :class:`Element` オブジェクトでは、子ノードのリストを提供" "するのに :class:`NodeList` を利用します。\n" -"また、このインターフェースにおける :class:`Node` の :meth:" -"`getElementsByTagName` および :meth:`getElementsByTagNameNS` メソッドは、クエ" -"リに対する結果を表現するのに :class:`NodeList` を利用します。" +"また、このインターフェースにおける :class:`Node` " +"の :meth:`getElementsByTagName` および :meth:`getElementsByTagNameNS` メソッ" +"ドは、クエリに対する結果を表現するのに :class:`NodeList` を利用します。" #: ../../library/xml.dom.rst:412 msgid "" @@ -787,27 +785,27 @@ msgstr "シーケンス中のノードの数です。" msgid "" "In addition, the Python DOM interface requires that some additional support " "is provided to allow :class:`NodeList` objects to be used as Python " -"sequences. All :class:`NodeList` implementations must include support for :" -"meth:`~object.__len__` and :meth:`~object.__getitem__`; this allows " +"sequences. All :class:`NodeList` implementations must include support " +"for :meth:`~object.__len__` and :meth:`~object.__getitem__`; this allows " "iteration over the :class:`NodeList` in :keyword:`for` statements and proper " "support for the :func:`len` built-in function." msgstr "" "この他に、Python の DOM インターフェースでは、 :class:`NodeList` オブジェクト" "を Python のシーケンスとして使えるようにするサポートが追加されていることが必" -"要です。 :class:`NodeList` の実装では、全て :meth:`~object.__len__` と :" -"meth:`~object.__getitem__` をサポートしなければなりません; このサポートによ" -"り、 :keyword:`for` 文内で :class:`NodeList` にわたる繰り返しと、組み込み関" -"数 :func:`len` の適切なサポートができるようになります。" +"要です。 :class:`NodeList` の実装では、全て :meth:`~object.__len__` " +"と :meth:`~object.__getitem__` をサポートしなければなりません; このサポートに" +"より、 :keyword:`for` 文内で :class:`NodeList` にわたる繰り返しと、組み込み" +"関数 :func:`len` の適切なサポートができるようになります。" #: ../../library/xml.dom.rst:435 msgid "" -"If a DOM implementation supports modification of the document, the :class:" -"`NodeList` implementation must also support the :meth:`~object.__setitem__` " -"and :meth:`~object.__delitem__` methods." +"If a DOM implementation supports modification of the document, " +"the :class:`NodeList` implementation must also support " +"the :meth:`~object.__setitem__` and :meth:`~object.__delitem__` methods." msgstr "" -"DOM 実装が文書の変更をサポートしている場合、 :class:`NodeList` の実装でも :" -"meth:`~object.__setitem__` および :meth:`~object.__delitem__` メソッドをサ" -"ポートしなければなりません。" +"DOM 実装が文書の変更をサポートしている場合、 :class:`NodeList` の実装で" +"も :meth:`~object.__setitem__` および :meth:`~object.__delitem__` メソッドを" +"サポートしなければなりません。" #: ../../library/xml.dom.rst:443 msgid "DocumentType Objects" @@ -817,19 +815,19 @@ msgstr "DocumentType オブジェクト" msgid "" "Information about the notations and entities declared by a document " "(including the external subset if the parser uses it and can provide the " -"information) is available from a :class:`DocumentType` object. The :class:" -"`DocumentType` for a document is available from the :class:`Document` " -"object's :attr:`doctype` attribute; if there is no ``DOCTYPE`` declaration " -"for the document, the document's :attr:`doctype` attribute will be set to " -"``None`` instead of an instance of this interface." +"information) is available from a :class:`DocumentType` object. " +"The :class:`DocumentType` for a document is available from " +"the :class:`Document` object's :attr:`doctype` attribute; if there is no " +"``DOCTYPE`` declaration for the document, the document's :attr:`doctype` " +"attribute will be set to ``None`` instead of an instance of this interface." msgstr "" "文書で宣言されている記法 (notation) やエンティティ (entity) に関する (外部サ" "ブセット(external subset) がパーザから利用でき、情報を提供できる場合にはそれ" "も含めた) 情報は、 :class:`DocumentType` オブジェクトから手に入れることができ" -"ます。文書の :class:`DocumentType` は、 :class:`Document` オブジェクトの :" -"attr:`doctype` 属性で入手することができます; 文書の ``DOCTYPE`` 宣言がない場" -"合、文書の :attr:`doctype` 属性は、このインターフェースを持つインスタンスの代" -"わりに ``None`` に設定されます。" +"ます。文書の :class:`DocumentType` は、 :class:`Document` オブジェクト" +"の :attr:`doctype` 属性で入手することができます; 文書の ``DOCTYPE`` 宣言がな" +"い場合、文書の :attr:`doctype` 属性は、このインターフェースを持つインスタンス" +"の代わりに ``None`` に設定されます。" #: ../../library/xml.dom.rst:453 msgid "" @@ -909,8 +907,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." @@ -930,8 +928,8 @@ msgstr "" msgid "" "Create and return a new element with a namespace. The *tagName* may have a " "prefix. The element is not inserted into the document when it is created. " -"You need to explicitly insert it with one of the other methods such as :meth:" -"`insertBefore` or :meth:`appendChild`." +"You need to explicitly insert it with one of the other methods such " +"as :meth:`insertBefore` or :meth:`appendChild`." msgstr "" "名前空間を伴う新たな要素ノードを生成して返します。 *tagName* には接頭辞 " "(prefix) があってもかまいません。要素は、生成された時点では文書内に挿入されま" @@ -971,13 +969,14 @@ msgstr "" #: ../../library/xml.dom.rst:553 msgid "" "Create and return an attribute node. This method does not associate the " -"attribute node with any particular element. You must use :meth:" -"`setAttributeNode` on the appropriate :class:`Element` object to use the " -"newly created attribute instance." +"attribute node with any particular element. You must " +"use :meth:`setAttributeNode` on the appropriate :class:`Element` object to " +"use the newly created attribute instance." msgstr "" "属性ノードを生成して返します。このメソッドは属性ノードを特定の要素に関連づけ" -"ることはしません。新たに生成された属性インスタンスを使うには、適切な :class:" -"`Element` オブジェクトの :meth:`setAttributeNode` を使わなければなりません。" +"ることはしません。新たに生成された属性インスタンスを使うには、適切" +"な :class:`Element` オブジェクトの :meth:`setAttributeNode` を使わなければな" +"りません。" #: ../../library/xml.dom.rst:561 msgid "" @@ -989,9 +988,9 @@ msgid "" msgstr "" "名前空間を伴う新たな属性ノードを生成して返します。 *tagName* には接頭辞 " "(prefix) があってもかまいません。このメソッドは属性ノードを特定の要素に関連づ" -"けることはしません。新たに生成された属性インスタンスを使うには、適切な :" -"class:`Element` オブジェクトの :meth:`setAttributeNode` を使わなければなりま" -"せん。" +"けることはしません。新たに生成された属性インスタンスを使うには、適切" +"な :class:`Element` オブジェクトの :meth:`setAttributeNode` を使わなければな" +"りません。" #: ../../library/xml.dom.rst:569 msgid "" @@ -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 "" @@ -1080,8 +1079,8 @@ msgstr "" #: ../../library/xml.dom.rst:641 msgid "" -"Remove an attribute by name. If there is no matching attribute, a :exc:" -"`NotFoundErr` is raised." +"Remove an attribute by name. If there is no matching attribute, " +"a :exc:`NotFoundErr` is raised." msgstr "" "名前で指定された属性を削除します。該当する属性がない場合、:exc:`NotFoundErr` " "が送出されます。" @@ -1111,8 +1110,8 @@ msgstr "文字列を使って属性値を設定します。" msgid "" "Add a new attribute node to the element, replacing an existing attribute if " "necessary if the :attr:`name` attribute matches. If a replacement occurs, " -"the old attribute node will be returned. If *newAttr* is already in use, :" -"exc:`InuseAttributeErr` will be raised." +"the old attribute node will be returned. If *newAttr* is already in " +"use, :exc:`InuseAttributeErr` will be raised." msgstr "" "新たな属性ノードを要素に追加します。 :attr:`name` 属性が既存の属性に一致した" "場合、必要に応じて属性を置換します。置換が行われると古い属性ノードが返されま" @@ -1126,10 +1125,10 @@ msgid "" "match. If a replacement occurs, the old attribute node will be returned. If " "*newAttr* is already in use, :exc:`InuseAttributeErr` will be raised." msgstr "" -"新たな属性ノードを要素に追加します。 :attr:`namespaceURI` および :attr:" -"`localName` 属性が既存の属性に一致した場合、必要に応じて属性を置き換えます。" -"置換が生じると、古い属性ノードが返されます。 *newAttr* がすでに使われていれ" -"ば、 :exc:`InuseAttributeErr` が送出されます。" +"新たな属性ノードを要素に追加します。 :attr:`namespaceURI` およ" +"び :attr:`localName` 属性が既存の属性に一致した場合、必要に応じて属性を置き換" +"えます。置換が生じると、古い属性ノードが返されます。 *newAttr* がすでに使われ" +"ていれば、 :exc:`InuseAttributeErr` が送出されます。" #: ../../library/xml.dom.rst:680 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 "" @@ -1171,8 +1170,8 @@ msgstr "名前にコロンがあればコロン以前の部分に、なければ #: ../../library/xml.dom.rst:713 msgid "" -"The text value of the attribute. This is a synonym for the :attr:" -"`nodeValue` attribute." +"The text value of the attribute. This is a synonym for " +"the :attr:`nodeValue` attribute." msgstr "その要素の text value. これは :attr:`nodeValue` 属性の別名です。" #: ../../library/xml.dom.rst:720 @@ -1195,8 +1194,8 @@ msgid "" "attribute." msgstr "" "特定のインデクスを持つ属性を返します。属性の並び方は任意ですが、 DOM 文書が生" -"成されている間は一定になります。各要素は属性ノードです。属性値はノードの :" -"attr:`value` 属性で取得してください。" +"成されている間は一定になります。各要素は属性ノードです。属性値はノード" +"の :attr:`value` 属性で取得してください。" #: ../../library/xml.dom.rst:736 msgid "" @@ -1218,8 +1217,8 @@ msgid "" ":class:`Comment` represents a comment in the XML document. It is a subclass " "of :class:`Node`, but cannot have child nodes." msgstr "" -":class:`Comment` は XML 文書中のコメントを表現します。 :class:`Comment` は :" -"class:`Node` のサブクラスですが、子ノードを持つことはありません。" +":class:`Comment` は XML 文書中のコメントを表現します。 :class:`Comment` " +"は :class:`Node` のサブクラスですが、子ノードを持つことはありません。" #: ../../library/xml.dom.rst:752 msgid "" @@ -1239,15 +1238,15 @@ msgstr "Text オブジェクトおよび CDATASection オブジェクト" msgid "" "The :class:`Text` interface represents text in the XML document. If the " "parser and DOM implementation support the DOM's XML extension, portions of " -"the text enclosed in CDATA marked sections are stored in :class:" -"`CDATASection` objects. These two interfaces are identical, but provide " -"different values for the :attr:`nodeType` attribute." +"the text enclosed in CDATA marked sections are stored " +"in :class:`CDATASection` objects. These two interfaces are identical, but " +"provide different values for the :attr:`nodeType` attribute." msgstr "" ":class:`Text` インターフェースは XML 文書内のテキストを表現します。パーザおよ" "び DOM 実装が DOM の XML 拡張をサポートしている場合、 CDATA でマークされた区" "域 (section) に入れられている部分テキストは :class:`CDATASection` オブジェク" -"トに記憶されます。これら二つのインターフェースは同一のものですが、 :attr:" -"`nodeType` 属性が異なります。" +"トに記憶されます。これら二つのインターフェースは同一のものです" +"が、 :attr:`nodeType` 属性が異なります。" #: ../../library/xml.dom.rst:768 msgid "" @@ -1306,11 +1305,11 @@ msgstr "例外" #: ../../library/xml.dom.rst:811 msgid "" -"The DOM Level 2 recommendation defines a single exception, :exc:" -"`DOMException`, and a number of constants that allow applications to " -"determine what sort of error occurred. :exc:`DOMException` instances carry " -"a :attr:`code` attribute that provides the appropriate value for the " -"specific exception." +"The DOM Level 2 recommendation defines a single " +"exception, :exc:`DOMException`, and a number of constants that allow " +"applications to determine what sort of error occurred. :exc:`DOMException` " +"instances carry a :attr:`code` attribute that provides the appropriate value " +"for the specific exception." msgstr "" "DOM レベル 2 勧告では、単一の例外 :exc:`DOMException` と、どの種のエラーが発" "生したかをアプリケーションが決定できるようにする多くの定数を定義していま" @@ -1322,8 +1321,8 @@ msgid "" "The Python DOM interface provides the constants, but also expands the set of " "exceptions so that a specific exception exists for each of the exception " "codes defined by the DOM. The implementations must raise the appropriate " -"specific exception, each of which carries the appropriate value for the :" -"attr:`code` attribute." +"specific exception, each of which carries the appropriate value for " +"the :attr:`code` attribute." msgstr "" "Python DOM インターフェースでは、上記の定数を提供していますが、同時に一連の例" "外を拡張して、DOM で定義されている各例外コードに対して特定の例外が存在するよ" @@ -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,28 +1673,30 @@ 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 "" -"yields three accessor functions: a \"get\" method for :attr:`someValue` (:" -"meth:`_get_someValue`), and \"get\" and \"set\" methods for :attr:" -"`anotherValue` (:meth:`_get_anotherValue` and :meth:`_set_anotherValue`). " -"The mapping, in particular, does not require that the IDL attributes are " -"accessible as normal Python attributes: ``object.someValue`` is *not* " -"required to work, and may raise an :exc:`AttributeError`." -msgstr "" -"は、三つのアクセサ関数: :attr:`someValue` に対する \"get\" メソッド (:meth:" -"`_get_someValue`)、そして :attr:`anotherValue` に対する \"get\" および " -"\"set\" メソッド (:meth:`_get_anotherValue` および :meth:" -"`_set_anotherValue`) を生成します。とりわけ、対応付けでは、IDL 属性が通常の " -"Python 属性としてアクセス可能であることは必須ではありません: ``object." -"someValue`` が動作することは必須 *ではなく* 、 :exc:`AttributeError` を送出し" -"てもかまいません。" +"yields three accessor functions: a \"get\" method for :attr:`someValue` " +"(:meth:`_get_someValue`), and \"get\" and \"set\" methods " +"for :attr:`anotherValue` (:meth:`_get_anotherValue` " +"and :meth:`_set_anotherValue`). The mapping, in particular, does not " +"require that the IDL attributes are accessible as normal Python attributes: " +"``object.someValue`` is *not* required to work, and may raise " +"an :exc:`AttributeError`." +msgstr "" +"は、三つのアクセサ関数: :attr:`someValue` に対する \"get\" メソッド " +"(:meth:`_get_someValue`)、そして :attr:`anotherValue` に対する \"get\" およ" +"び \"set\" メソッド (:meth:`_get_anotherValue` およ" +"び :meth:`_set_anotherValue`) を生成します。とりわけ、対応付けでは、IDL 属性" +"が通常の Python 属性としてアクセス可能であることは必須ではありません: " +"``object.someValue`` が動作することは必須 *ではなく" +"* 、 :exc:`AttributeError` を送出してもかまいません。" #: ../../library/xml.dom.rst:1015 msgid "" @@ -1735,9 +1735,9 @@ msgstr "" #: ../../library/xml.dom.rst:1029 msgid "" "The IDL definitions do not fully embody the requirements of the W3C DOM API, " -"such as the notion of certain objects, such as the return value of :meth:" -"`getElementsByTagName`, being \"live\". The Python DOM API does not require " -"implementations to enforce such requirements." +"such as the notion of certain objects, such as the return value " +"of :meth:`getElementsByTagName`, being \"live\". The Python DOM API does " +"not require implementations to enforce such requirements." msgstr "" "このIDLでの定義はW3C DOM APIの全ての要件を実装しているわけではありません。例" "えば、一部のオブジェクトの概念や :meth:`getElementsByTagName` が \"live\" で" diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index b33cd0b48..3ac5b06ba 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:" @@ -137,13 +150,14 @@ msgstr ":data:`IGNORABLE_WHITESPACE`" #: ../../library/xml.dom.pulldom.rst:65 msgid "" -"``node`` is an object of type :class:`xml.dom.minidom.Document`, :class:`xml." -"dom.minidom.Element` or :class:`xml.dom.minidom.Text`." +"``node`` is an object of " +"type :class:`xml.dom.minidom.Document`, :class:`xml.dom.minidom.Element` " +"or :class:`xml.dom.minidom.Text`." msgstr "" -"``node`` は型 :class:`xml.dom.minidom.Document`、 :class:`xml.dom.minidom." -"Element` または :class:`xml.dom.minidom.Text` のオブジェクトです。" +"``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 " @@ -151,15 +165,18 @@ msgid "" "consider hierarchical issues such as recursive searching of the document " "nodes, although if the context of elements were important, one would either " "need to maintain some context-related state (i.e. remembering where one is " -"in the document at any given point) or to make use of the :func:" -"`DOMEventStream.expandNode` method and switch to DOM-related processing." +"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`." @@ -216,17 +233,19 @@ msgstr ":meth:`~object.__getitem__` メソッドのサポートは削除され #: ../../library/xml.dom.pulldom.rst:122 msgid "" -"Return a tuple containing *event* and the current *node* as :class:`xml.dom." -"minidom.Document` if event equals :data:`START_DOCUMENT`, :class:`xml.dom." -"minidom.Element` if event equals :data:`START_ELEMENT` or :data:" -"`END_ELEMENT` or :class:`xml.dom.minidom.Text` if event equals :data:" -"`CHARACTERS`. The current node does not contain information about its " -"children, unless :func:`expandNode` is called." +"Return a tuple containing *event* and the current *node* " +"as :class:`xml.dom.minidom.Document` if event " +"equals :data:`START_DOCUMENT`, :class:`xml.dom.minidom.Element` if event " +"equals :data:`START_ELEMENT` or :data:`END_ELEMENT` " +"or :class:`xml.dom.minidom.Text` if event equals :data:`CHARACTERS`. The " +"current node does not contain information about its children, " +"unless :func:`expandNode` is called." msgstr "" -"event が :data:`START_DOCUMENT` の場合は *event* と :class:`xml.dom.minidom." -"Document` としての現在の *node* からなるタプルを、\n" -":data:`START_ELEMENT` か :data:`END_ELEMENT` の場合は :class:`xml.dom." -"minidom.Element` を、\n" +"event が :data:`START_DOCUMENT` の場合は *event* " +"と :class:`xml.dom.minidom.Document` としての現在の *node* からなるタプル" +"を、\n" +":data:`START_ELEMENT` か :data:`END_ELEMENT` の場合" +"は :class:`xml.dom.minidom.Element` を、\n" ":data:`CHARACTERS` の場合は :class:`xml.dom.minidom.Text` を返します。\n" ":func:`expandNode` が呼ばれない限り、現在のノードは子ノードの情報を持ちませ" "ん。 " @@ -235,7 +254,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 +269,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..422ea8afb 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 @@ -82,12 +82,12 @@ msgstr "XML 木構造と要素" #: ../../library/xml.etree.elementtree.rst:39 msgid "" "XML is an inherently hierarchical data format, and the most natural way to " -"represent it is with a tree. ``ET`` has two classes for this purpose - :" -"class:`ElementTree` represents the whole XML document as a tree, and :class:" -"`Element` represents a single node in this tree. Interactions with the " -"whole document (reading and writing to/from files) are usually done on the :" -"class:`ElementTree` level. Interactions with a single XML element and its " -"sub-elements are done on the :class:`Element` level." +"represent it is with a tree. ``ET`` has two classes for this purpose " +"- :class:`ElementTree` represents the whole XML document as a tree, " +"and :class:`Element` represents a single node in this tree. Interactions " +"with the whole document (reading and writing to/from files) are usually done " +"on the :class:`ElementTree` level. Interactions with a single XML element " +"and its sub-elements are done on the :class:`Element` level." msgstr "" "XML は本質的に階層データ形式で、木構造で表すのが最も自然な方法です。``ET`` は" "この目的のために 2 つのクラス - XML 文書全体を木で表す :class:`ElementTree` " @@ -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,56 +133,82 @@ 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 "" -":func:`fromstring` parses XML from a string directly into an :class:" -"`Element`, which is the root element of the parsed tree. Other parsing " -"functions may create an :class:`ElementTree`. Check the documentation to be " -"sure." +":func:`fromstring` parses XML from a string directly into " +"an :class:`Element`, which is the root element of the parsed tree. Other " +"parsing functions may create an :class:`ElementTree`. Check the " +"documentation to be sure." msgstr "" -":func:`fromstring` は XML を文字列から :class:`Element` に直接パースします。:" -"class:`Element` はパースされた木のルート要素です。他のパース関数は :class:" -"`ElementTree` を作成するかもしれません。ドキュメントをきちんと確認してくださ" -"い。" +":func:`fromstring` は XML を文字列から :class:`Element` に直接パースします。 " +"``Element`` はパースされた木のルート要素です。他のパース関数" +"は :class:`ElementTree` を作成するかもしれません。ドキュメントをきちんと確認" +"してください。" #: ../../library/xml.etree.elementtree.rst:94 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 "" @@ -218,9 +252,9 @@ msgstr "" "在、このモジュールは入力中のいかなる XML コメント、処理命令、ドキュメントタイ" "プ宣言も読み飛ばします。しかし、XML テキストからのパースではなく、このモ" "ジュールの API を使用して構築された木には、コメントや処理命令を含むことがで" -"き、それらは XML 出力の生成時に含まれます。ドキュメントタイプ宣言は、 :class:" -"`XMLParser` コンストラクタにカスタムの :class:`TreeBuilder` インスタンスを渡" -"すことで、アクセスすることができます。" +"き、それらは XML 出力の生成時に含まれます。ドキュメントタイプ宣言" +"は、 :class:`XMLParser` コンストラクタにカスタムの :class:`TreeBuilder` イン" +"スタンスを渡すことで、アクセスすることができます。" #: ../../library/xml.etree.elementtree.rst:132 msgid "Pull API for non-blocking parsing" @@ -229,9 +263,9 @@ msgstr "非ブロックパースのためのプル API" #: ../../library/xml.etree.elementtree.rst:134 msgid "" "Most parsing functions provided by this module require the whole document to " -"be read at once before returning any result. It is possible to use an :" -"class:`XMLParser` and feed data into it incrementally, but it is a push API " -"that calls methods on a callback target, which is too low-level and " +"be read at once before returning any result. It is possible to use " +"an :class:`XMLParser` and feed data into it incrementally, but it is a push " +"API that calls methods on a callback target, which is too low-level and " "inconvenient for most needs. Sometimes what the user really wants is to be " "able to parse XML incrementally, without blocking operations, while enjoying " "the convenience of fully constructed :class:`Element` objects." @@ -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." +"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 "" @@ -336,12 +389,11 @@ msgid "" "child with a particular tag, and :attr:`Element.text` accesses the element's " "text content. :meth:`Element.get` accesses the element's attributes::" msgstr "" -":meth:`Element.findall` はタグで現在の要素の直接の子要素のみ検索します。 :" -"meth:`Element.find` は特定のタグで *最初の* 子要素を検索し、 :attr:`Element." -"text` は要素のテキストコンテンツにアクセスします。 :meth:`Element.get` は要素" -"の属性にアクセスします::" +":meth:`Element.findall` はタグで現在の要素の直接の子要素のみ検索しま" +"す。 :meth:`Element.find` は特定のタグで *最初の* 子要素を検索" +"し、 :attr:`Element.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 "" @@ -380,10 +440,10 @@ msgid "" "attributes (:meth:`Element.set` method), as well as adding new children (for " "example with :meth:`Element.append`)." msgstr "" -":class:`Element` オブジェクトを作成すると、そのフィールドの直接変更 (:attr:" -"`Element.text` など) や、属性の追加および変更 (:meth:`Element.set` メソッ" -"ド)、あるいは新しい子ノードの追加 (例えば :meth:`Element.append` など) によっ" -"てそれを操作できます。" +":class:`Element` オブジェクトを作成すると、そのフィールドの直接変更 " +"(:attr:`Element.text` など) や、属性の追加および変更 (:meth:`Element.set` メ" +"ソッド)、あるいは新しい子ノードの追加 (例えば :meth:`Element.append` など) に" +"よってそれを操作できます。" #: ../../library/xml.etree.elementtree.rst:218 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" @@ -511,11 +627,11 @@ msgstr "名前空間のある XML の解析" #: ../../library/xml.etree.elementtree.rst:309 msgid "" "If the XML input has `namespaces `__, tags and attributes with prefixes in the form ``prefix:" -"sometag`` get expanded to ``{uri}sometag`` where the *prefix* is replaced by " -"the full *URI*. Also, if there is a `default namespace `__, that full URI gets prepended to all of the non-" -"prefixed tags." +"XML_namespace>`__, tags and attributes with prefixes in the form " +"``prefix:sometag`` get expanded to ``{uri}sometag`` where the *prefix* is " +"replaced by the full *URI*. Also, if there is a `default namespace `__, that full URI gets prepended to all " +"of the non-prefixed tags." msgstr "" "XML 入力が `名前空間 `__ を持っ" "ている場合、 ``prefix:sometag`` の形式で修飾されたタグと属性が、その " @@ -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 "" "One way to search and explore this XML example is to manually add the URI to " -"every tag or attribute in the xpath of a :meth:`~Element.find` or :meth:" -"`~Element.findall`::" +"every tag or attribute in the xpath of a :meth:`~Element.find` " +"or :meth:`~Element.findall`::" msgstr "" -"この XML の例を、検索し、渡り歩くためのひとつの方法としては、 :meth:" -"`~Element.find` や :meth:`~Element.findall` に渡す xpath で全てのタグや属性に" -"手作業で URI を付けてまわる手があります::" +"この XML の例を、検索し、渡り歩くためのひとつの方法として" +"は、 :meth:`~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" @@ -611,14 +759,15 @@ msgstr "XPath サポート" #: ../../library/xml.etree.elementtree.rst:377 msgid "" -"This module provides limited support for `XPath expressions `_ for locating elements in a tree. The goal is to support a " -"small subset of the abbreviated syntax; a full XPath engine is outside the " -"scope of the module." +"This module provides limited support for `XPath expressions `_ for locating elements in a tree. The goal is to " +"support a small subset of the abbreviated syntax; a full XPath engine is " +"outside the scope of the module." msgstr "" -"このモジュールは木構造内の要素の位置決めのための `XPath 式 `_ を限定的にサポートしています。その目指すところは短縮構文のほ" -"んの一部だけのサポートであり、XPath エンジンのフルセットは想定していません。" +"このモジュールは木構造内の要素の位置決めのための `XPath 式 `_ を限定的にサポートしています。その目指すところは短縮構" +"文のほんの一部だけのサポートであり、XPath エンジンのフルセットは想定していま" +"せん。" #: ../../library/xml.etree.elementtree.rst:383 #: ../../library/xml.etree.elementtree.rst:782 @@ -628,8 +777,8 @@ msgstr "使用例" #: ../../library/xml.etree.elementtree.rst:385 msgid "" "Here's an example that demonstrates some of the XPath capabilities of the " -"module. We'll be using the ``countrydata`` XML document from the :ref:" -"`Parsing XML ` section::" +"module. We'll be using the ``countrydata`` XML document from " +"the :ref:`Parsing XML ` section::" msgstr "" "以下はこのモジュールの XPath 機能の一部を紹介する例です。:ref:`XML の解析 " "` 節から XML 文書 ``countrydata`` を使用します::" @@ -657,17 +806,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 +836,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 +844,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 +924,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 +950,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 +982,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 +1027,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 +1037,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 +1049,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 +1071,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}\"" +"*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 "" @@ -973,8 +1143,8 @@ msgstr "" msgid "" "Note that :class:`XMLParser` skips over comments in the input instead of " "creating comment objects for them. An :class:`ElementTree` will only contain " -"comment nodes if they have been inserted into to the tree using one of the :" -"class:`Element` methods." +"comment nodes if they have been inserted into to the tree using one of " +"the :class:`Element` methods." msgstr "" ":class:`XMLParser` は、入力に含まれるコメントを読み飛ばし、コメントオブジェク" "トは作成しません。:class:`ElementTree` は、:class:`Element` メソッドの 1 つを" @@ -1005,18 +1175,20 @@ msgid "" "The :func:`dump` function now preserves the attribute order specified by the " "user." msgstr "" +":func:`dump` 関数はユーザーが指定した属性の順序を保持するようになりました。" #: ../../library/xml.etree.elementtree.rst:584 msgid "" "Parses an XML section from a string constant. Same as :func:`XML`. *text* " "is a string containing XML data. *parser* is an optional parser instance. " -"If not given, the standard :class:`XMLParser` parser is used. Returns an :" -"class:`Element` instance." +"If not given, the standard :class:`XMLParser` parser is used. Returns " +"an :class:`Element` instance." msgstr "" "文字列定数で与えられた XML 断片を解析します。 :func:`XML` と同じです。 " "*text* には XML データを含む文字列を指定します。 *parser* はオプションで、" -"パーザのインスタンスを指定します。指定されなかった場合、標準の :class:" -"`XMLParser` パーザを使用します。 :class:`Element` インスタンスを返します。" +"パーザのインスタンスを指定します。指定されなかった場合、標準" +"の :class:`XMLParser` パーザを使用します。 :class:`Element` インスタンスを返" +"します。" #: ../../library/xml.etree.elementtree.rst:592 msgid "" @@ -1031,7 +1203,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 +1211,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,16 +1284,15 @@ 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 "" "Parses an XML section into an element tree. *source* is a filename or file " "object containing XML data. *parser* is an optional parser instance. If " -"not given, the standard :class:`XMLParser` parser is used. Returns an :" -"class:`ElementTree` instance." +"not given, the standard :class:`XMLParser` parser is used. Returns " +"an :class:`ElementTree` instance." msgstr "" "XML 断片を解析して要素の木にします。 *source* には XML データを含むファイル名" "またはファイルオブジェクトを指定します。 *parser* はオプションでパーザインス" @@ -1176,7 +1353,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 +1363,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_declaration*, *default_namespace*, *short_empty_elements* は、 :meth:" -"`ElementTree.write` での意味と同じ意味を持ちます。 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` での意味と同じ意味を持ちます。\n" +"XML データを含んだ (オプションで) エンコードされた文字列を返します。" #: ../../library/xml.etree.elementtree.rst:718 #: ../../library/xml.etree.elementtree.rst:745 @@ -1202,18 +1380,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 " @@ -1223,19 +1399,22 @@ msgid "" "``\"xml\"``). *xml_declaration*, *default_namespace* and " "*short_empty_elements* has the same meaning as in :meth:`ElementTree.write`. " "Returns a list of (optionally) encoded strings containing the XML data. It " -"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)`` となること以外、特定の順序" -"になる保証はありません。" +"does not guarantee any specific sequence, except that " +"``b\"\".join(tostringlist(element)) == tostring(element)``." +msgstr "" +"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 "" @@ -1249,71 +1428,83 @@ msgstr "" msgid "" "Parses an XML section from a string constant. This function can be used to " "embed \"XML literals\" in Python code. *text* is a string containing XML " -"data. *parser* is an optional parser instance. If not given, the standard :" -"class:`XMLParser` parser is used. Returns an :class:`Element` instance." +"data. *parser* is an optional parser instance. If not given, the " +"standard :class:`XMLParser` parser is used. Returns an :class:`Element` " +"instance." msgstr "" "文字列定数で与えられた XML 断片を解析します。この関数は Python コードに " "\"XML リテラル\" を埋め込むのに使えます。 *text* には XML データを含む文字列" "を指定します。 *parser* はオプションで、パーザのインスタンスを指定します。指" -"定されなかった場合、標準の :class:`XMLParser` パーザを使用します。 :class:" -"`Element` インスタンスを返します。" +"定されなかった場合、標準の :class:`XMLParser` パーザを使用しま" +"す。 :class:`Element` インスタンスを返します。" #: ../../library/xml.etree.elementtree.rst:766 msgid "" "Parses an XML section from a string constant, and also returns a dictionary " "which maps from element id:s to elements. *text* is a string containing XML " -"data. *parser* is an optional parser instance. If not given, the standard :" -"class:`XMLParser` parser is used. Returns a tuple containing an :class:" -"`Element` instance and a dictionary." +"data. *parser* is an optional parser instance. If not given, the " +"standard :class:`XMLParser` parser is used. Returns a tuple containing " +"an :class:`Element` instance and a dictionary." msgstr "" "文字列定数で与えられた XML 断片を解析し、要素 ID と要素を対応付ける辞書を返し" "ます。 *text* には XMLデータを含んだ文字列を指定します。 *parser* はオプショ" -"ンで、パーザのインスタンスを指定します。指定されなかった場合、標準の :class:" -"`XMLParser` パーザを使用します。 :class:`Element` のインスタンスと辞書のタプ" -"ルを返します。" +"ンで、パーザのインスタンスを指定します。指定されなかった場合、標準" +"の :class:`XMLParser` パーザを使用します。 :class:`Element` のインスタンスと" +"辞書のタプルを返します。" #: ../../library/xml.etree.elementtree.rst:776 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 " +"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 "" -"To process this file, load it as usual, and pass the root element to the :" -"mod:`xml.etree.ElementTree` module:" +"To process this file, load it as usual, and pass the root element to " +"the :mod:`xml.etree.ElementTree` module:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:797 msgid "" "from xml.etree import ElementTree, ElementInclude\n" "\n" @@ -1322,51 +1513,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 +1586,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 +1597,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 +1664,8 @@ msgstr "" "し、 *tail* 属性は要素の終了タグと次のタグまでのテキストか、あるいは " "``None`` を保持します。このような XML データ" -#: ../../library/xml.etree.elementtree.rst:907 msgid "1234" -msgstr "" +msgstr "1234" #: ../../library/xml.etree.elementtree.rst:911 msgid "" @@ -1532,19 +1751,19 @@ msgstr "以下のメソッドは要素の子要素 (副要素) に対して動 #: ../../library/xml.etree.elementtree.rst:967 msgid "" "Adds the element *subelement* to the end of this element's internal list of " -"subelements. Raises :exc:`TypeError` if *subelement* is not an :class:" -"`Element`." +"subelements. Raises :exc:`TypeError` if *subelement* is not " +"an :class:`Element`." 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 +1771,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 +1786,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,14 +1803,23 @@ 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 "" -"Inserts *subelement* at the given position in this element. Raises :exc:" -"`TypeError` if *subelement* is not an :class:`Element`." +"Inserts *subelement* at the given position in this element. " +"Raises :exc:`TypeError` if *subelement* is not an :class:`Element`." msgstr "" -"要素内の指定された位置に *subelement* を挿入します。*subelement* が :class:" -"`Element` でない場合、:exc:`TypeError` を送出します。" +"要素内の指定された位置に *subelement* を挿入します。*subelement* " +"が :class:`Element` でない場合、:exc:`TypeError` を送出します。" #: ../../library/xml.etree.elementtree.rst:1017 msgid "" @@ -1635,22 +1875,25 @@ msgstr "" #: ../../library/xml.etree.elementtree.rst:1057 msgid "" ":class:`Element` objects also support the following sequence type methods " -"for working with subelements: :meth:`~object.__delitem__`, :meth:`~object." -"__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." +"for working with " +"subelements: :meth:`~object.__delitem__`, :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." msgstr "" ":class:`Element` オブジェクトは以下のシーケンス型のメソッドを、サブ要素を操作" -"するためにサポートします: :meth:`~object.__delitem__`, :meth:`~object." -"__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." +"するためにサポートしま" +"す: :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 +1903,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,19 +1921,27 @@ 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 `_ explicitly excludes the attribute order from conveying " "information. Code should be prepared to deal with any ordering on input. In " "cases where deterministic XML output is required, e.g. for cryptographic " -"signing or test data sets, canonical serialisation is available with the :" -"func:`canonicalize` function." +"signing or test data sets, canonical serialisation is available with " +"the :func:`canonicalize` function." msgstr "" +"`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 +1950,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 +1966,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" @@ -1777,13 +2045,12 @@ msgid "" msgstr "" "外部の XML 断片をこの要素木に入れます。*source* にはファイル名か :term:`ファ" "イルオブジェクト ` を指定します。*parser* はオプションで、パーザ" -"インスタンスを指定します。パーザが指定されない場合、標準の :class:" -"`XMLParser` パーザが使用されます。断片の根要素を返します。" +"インスタンスを指定します。パーザが指定されない場合、標準" +"の :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 " +"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 " "encoding (default is US-ASCII). *xml_declaration* controls if an XML " "declaration should be added to the file. Use ``False`` for never, ``True`` " "for always, ``None`` for only if not US-ASCII or UTF-8 or Unicode (default " @@ -1795,7 +2062,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 +2073,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 "" @@ -1820,25 +2087,23 @@ msgid "" "object`; make sure you do not try to write a string to a binary stream and " "vice versa." msgstr "" -"出力は引数 *encoding* によって、文字列 (:class:`str`) かバイト列 (:class:" -"`bytes`) になります。*encoding* が ``\"unicode\"`` の場合、出力は文字列にな" -"り、それ以外ではバイト列になります。*file* が :term:`ファイルオブジェクト " -"` の場合、型が衝突する場合があります。文字列をバイト列ファイルへ" -"書き込んだり、その逆を行わないよう注意してください。" +"出力は引数 *encoding* によって、文字列 (:class:`str`) かバイト列 " +"(:class:`bytes`) になります。*encoding* が ``\"unicode\"`` の場合、出力は文字" +"列になり、それ以外ではバイト列になります。*file* が :term:`ファイルオブジェク" +"ト ` の場合、型が衝突する場合があります。文字列をバイト列ファイ" +"ルへ書き込んだり、その逆を行わないよう注意してください。" -#: ../../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 +2115,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 +2131,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 +2147,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" @@ -1885,8 +2172,8 @@ msgid "" "to get proper namespace handling on output. *text_or_uri* is a string " "containing the QName value, in the form {uri}local, or, if the tag argument " "is given, the URI part of a QName. If *tag* is given, the first argument is " -"interpreted as a URI, and this argument is interpreted as a local name. :" -"class:`QName` instances are opaque." +"interpreted as a URI, and this argument is interpreted as a local " +"name. :class:`QName` instances are opaque." msgstr "" "QName ラッパーです。\n" "このクラスは QName 属性値をラップし、出力時に適切な名前空間の扱いを得るために" @@ -1913,14 +2200,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,14 +2217,20 @@ 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 "" "Flushes the builder buffers, and returns the toplevel document element. " "Returns an :class:`Element` instance." msgstr "" -"ビルダのバッファをフラッシュし、最上位の文書要素を返します。戻り値は :class:" -"`Element` インスタンスになります。" +"ビルダのバッファをフラッシュし、最上位の文書要素を返します。戻り値" +"は :class:`Element` インスタンスになります。" #: ../../library/xml.etree.elementtree.rst:1286 msgid "" @@ -1961,17 +2255,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 +2277,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 "" @@ -2020,27 +2321,28 @@ msgstr "XMLParser オブジェクト" #: ../../library/xml.etree.elementtree.rst:1368 msgid "" -"This class is the low-level building block of the module. It uses :mod:`xml." -"parsers.expat` for efficient, event-based parsing of XML. It can be fed XML " -"data incrementally with the :meth:`feed` method, and parsing events are " -"translated to a push API - by invoking callbacks on the *target* object. If " -"*target* is omitted, the standard :class:`TreeBuilder` is used. If " -"*encoding* [1]_ is given, the value overrides the encoding specified in the " -"XML file." +"This class is the low-level building block of the module. It " +"uses :mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It " +"can be fed XML data incrementally with the :meth:`feed` method, and parsing " +"events are translated to a push API - by invoking callbacks on the *target* " +"object. If *target* is omitted, the standard :class:`TreeBuilder` is used. " +"If *encoding* [1]_ is given, the value overrides the encoding specified in " +"the XML file." msgstr "" "このクラスは、このモジュールの構成要素のうち、低水準のものです。効率的でイベ" -"ントベースのXMLパースのため、:mod:`xml.parsers.expat` を使用します。:meth:" -"`feed` メソッドで XML データをインクリメンタルに受け取り、*target* オブジェク" -"トのコールバックを呼び出すことで、パースイベントをプッシュ API に変換します。" -"*target* が省略された場合、標準の :class:`TreeBuilder` が使用されます。 " -"*encoding* [1]_ が指定された場合、このあたいは XML ファイル内で指定されたエン" -"コーディングを上書きします。" +"ントベースのXMLパースのため、:mod:`xml.parsers.expat` を使用しま" +"す。:meth:`feed` メソッドで XML データをインクリメンタルに受け取り、*target* " +"オブジェクトのコールバックを呼び出すことで、パースイベントをプッシュ API に変" +"換します。*target* が省略された場合、標準の :class:`TreeBuilder` が使用されま" +"す。 *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,26 +2358,32 @@ 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 " "implementation of :meth:`flush` temporarily disables reparse deferral with " "Expat (if currently enabled) and triggers a reparse. Disabling reparse " -"deferral has security consequences; please see :meth:`xml.parsers.expat." -"xmlparser.SetReparseDeferralEnabled` for details." -msgstr "" +"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 msgid "" "Note that :meth:`flush` has been backported to some prior releases of " -"CPython as a security fix. Check for availability of :meth:`flush` using :" -"func:`hasattr` if used in code running across a variety of Python versions." +"CPython as a security fix. Check for availability of :meth:`flush` " +"using :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 +2393,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 +2435,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" @@ -2143,11 +2482,11 @@ msgid "" "ns\"`` (the \"ns\" events are used to get detailed namespace information). " "If *events* is omitted, only ``\"end\"`` events are reported." msgstr "" -"非ブロックアプリケーションに適したプルパーザです。入力側の API は :class:" -"`XMLParser` のものと似ていますが、コールバックターゲットに呼び出しをプッシュ" -"するのではなく、 :class:`XMLPullParser` はパースイベントの内部リストを収集" -"し、ユーザーがそこから読み出すことができます。*events* は、呼び出し元に報告す" -"るイベントのシーケンスです。サポートされているイベントは、文字列の " +"非ブロックアプリケーションに適したプルパーザです。入力側の API " +"は :class:`XMLParser` のものと似ていますが、コールバックターゲットに呼び出し" +"をプッシュするのではなく、 :class:`XMLPullParser` はパースイベントの内部リス" +"トを収集し、ユーザーがそこから読み出すことができます。*events* は、呼び出し元" +"に報告するイベントのシーケンスです。サポートされているイベントは、文字列の " "``\"start\"``, ``\"end\"``, ``\"comment\"``, ``\"pi\"``, ``\"start-ns\"``, " "``\"end-ns\"`` (\"ns\" イベントは、名前空間の詳細情報の取得に使用) です。" "*events* が省略された場合、 ``\"end\"`` イベントのみが報告されます。" @@ -2156,19 +2495,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`." +"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 +2514,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 +2549,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 +2556,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" @@ -2238,8 +2579,8 @@ msgstr "" #: ../../library/xml.etree.elementtree.rst:1542 msgid "" -"A numeric error code from the expat parser. See the documentation of :mod:" -"`xml.parsers.expat` for the list of error codes and their meanings." +"A numeric error code from the expat parser. See the documentation " +"of :mod:`xml.parsers.expat` for the list of error codes and their meanings." msgstr "" "expat パーザからの数値エラーコードです。エラーコードの一覧とそれらの意味につ" "いては、:mod:`xml.parsers.expat` のドキュメントを参照してください。" @@ -2262,5 +2603,6 @@ msgid "" msgstr "" "XML 出力に含まれるエンコーディング文字列は適切な規格に従っていなければなりま" "せん。例えば、\"UTF-8\" は有効ですが、\"UTF8\" はそうではありません。https://" -"www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl と https://www.iana." -"org/assignments/character-sets/character-sets.xhtml を参照してください。" +"www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl と https://" +"www.iana.org/assignments/character-sets/character-sets.xhtml を参照してくださ" +"い。" diff --git a/library/xml.po b/library/xml.po index fd2417457..94ca3bdbf 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 @@ -42,8 +42,8 @@ msgstr "" #: ../../library/xml.rst:20 msgid "" "The XML modules are not secure against erroneous or maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see the :ref:" -"`xml-vulnerabilities` and :ref:`defusedxml-package` sections." +"data. If you need to parse untrusted or unauthenticated data see " +"the :ref:`xml-vulnerabilities` and :ref:`defusedxml-package` sections." msgstr "" "XML モジュール群は不正なデータや悪意を持って作成されたデータに対して安全では" "ありません。信頼できないデータをパースする必要がある場合は :ref:`xml-" @@ -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)" @@ -208,14 +207,14 @@ msgstr "**脆弱** (6)" msgid "" "Expat 2.4.1 and newer is not vulnerable to the \"billion laughs\" and " "\"quadratic blowup\" vulnerabilities. Items still listed as vulnerable due " -"to potential reliance on system-provided libraries. Check :const:`!pyexpat." -"EXPAT_VERSION`." +"to potential reliance on system-provided libraries. Check :const:`!" +"pyexpat.EXPAT_VERSION`." msgstr "" #: ../../library/xml.rst:78 msgid "" -":mod:`xml.etree.ElementTree` doesn't expand external entities and raises a :" -"exc:`~xml.etree.ElementTree.ParseError` when an entity occurs." +":mod:`xml.etree.ElementTree` doesn't expand external entities and raises " +"a :exc:`~xml.etree.ElementTree.ParseError` when an entity occurs." msgstr "" #: ../../library/xml.rst:80 @@ -242,8 +241,8 @@ msgstr "" msgid "" "Expat 2.6.0 and newer is not vulnerable to denial of service through " "quadratic runtime caused by parsing large tokens. Items still listed as " -"vulnerable due to potential reliance on system-provided libraries. Check :" -"const:`!pyexpat.EXPAT_VERSION`." +"vulnerable due to potential reliance on system-provided libraries. " +"Check :const:`!pyexpat.EXPAT_VERSION`." msgstr "" #: ../../library/xml.rst:92 @@ -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`." +"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..3dc3478c8 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 "" @@ -346,8 +344,9 @@ msgid "" "The SAX parser will invoke this method only once, before any other methods " "in this interface or in DTDHandler (except for :meth:`setDocumentLocator`)." msgstr "" -"SAX パーサはこのインターフェースやDTDHandler のどのメソッド (:meth:" -"`setDocumentLocator` を除く) よりも先にこのメソッドを一度だけ呼び出します。" +"SAX パーサはこのインターフェースやDTDHandler のどのメソッド " +"(:meth:`setDocumentLocator` を除く) よりも先にこのメソッドを一度だけ呼び出し" +"ます。" #: ../../library/xml.sax.handler.rst:203 msgid "Receive notification of the end of a document." @@ -379,7 +378,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,26 +385,26 @@ 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 "" "Note that :meth:`startPrefixMapping` and :meth:`endPrefixMapping` events are " -"not guaranteed to be properly nested relative to each-other: all :meth:" -"`startPrefixMapping` events will occur before the corresponding :meth:" -"`startElement` event, and all :meth:`endPrefixMapping` events will occur " -"after the corresponding :meth:`endElement` event, but their order is not " -"guaranteed." +"not guaranteed to be properly nested relative to each-other: " +"all :meth:`startPrefixMapping` events will occur before the " +"corresponding :meth:`startElement` event, and all :meth:`endPrefixMapping` " +"events will occur after the corresponding :meth:`endElement` event, but " +"their order is not guaranteed." msgstr "" ":meth:`startPrefixMapping` と :meth:`endPrefixMapping` イベントは相互に正しい" -"入れ子関係になることが保証されていないので注意が必要です。すべての :meth:" -"`startPrefixMapping` は対応する :meth:`startElement` の前に発生し、 :meth:" -"`endPrefixMapping` イベントは対応する :meth:`endElement` の後で発生しますが、" -"その順序は保証されていません。" +"入れ子関係になることが保証されていないので注意が必要です。すべて" +"の :meth:`startPrefixMapping` は対応する :meth:`startElement` の前に発生" +"し、 :meth:`endPrefixMapping` イベントは対応する :meth:`endElement` の後で発" +"生しますが、その順序は保証されていません。" #: ../../library/xml.sax.handler.rst:238 msgid "End the scope of a prefix-URI mapping." @@ -415,12 +413,12 @@ msgstr "接頭辞と URI の関連付けのスコープを終了します。" #: ../../library/xml.sax.handler.rst:240 msgid "" "See :meth:`startPrefixMapping` for details. This event will always occur " -"after the corresponding :meth:`endElement` event, but the order of :meth:" -"`endPrefixMapping` events is not otherwise guaranteed." +"after the corresponding :meth:`endElement` event, but the order " +"of :meth:`endPrefixMapping` events is not otherwise guaranteed." msgstr "" "詳しくは :meth:`startPrefixMapping` を参照してください。このイベントは常に対" -"応する :meth:`endElement` の後で発生しますが、複数の :meth:" -"`endPrefixMapping` イベントの順序は特に保証されません。" +"応する :meth:`endElement` の後で発生しますが、複数" +"の :meth:`endPrefixMapping` イベントの順序は特に保証されません。" #: ../../library/xml.sax.handler.rst:247 msgid "Signals the start of an element in non-namespace mode." @@ -429,16 +427,16 @@ msgstr "非名前空間モードでの要素の開始を通知します。" #: ../../library/xml.sax.handler.rst:249 msgid "" "The *name* parameter contains the raw XML 1.0 name of the element type as a " -"string and the *attrs* parameter holds an object of the :class:`~xml.sax." -"xmlreader.Attributes` interface (see :ref:`attributes-objects`) containing " -"the attributes of the element. The object passed as *attrs* may be re-used " -"by the parser; holding on to a reference to it is not a reliable way to keep " -"a copy of the attributes. To keep a copy of the attributes, use the :meth:" -"`copy` method of the *attrs* object." +"string and the *attrs* parameter holds an object of " +"the :class:`~xml.sax.xmlreader.Attributes` interface (see :ref:`attributes-" +"objects`) containing the attributes of the element. The object passed as " +"*attrs* may be re-used by the parser; holding on to a reference to it is not " +"a reliable way to keep a copy of the attributes. To keep a copy of the " +"attributes, use the :meth:`copy` method of the *attrs* object." msgstr "" "*name* 引数は要素型の生の XML 1.0 名を文字列として持ち、*attrs* 引数は要素の" -"属性を持つ :class:`~xml.sax.xmlreader.Attributes` インターフェイス (:ref:" -"`attributes-objects` を参照) のオブジェクトを保持します。 \n" +"属性を持つ :class:`~xml.sax.xmlreader.Attributes` インターフェイス " +"(:ref:`attributes-objects` を参照) のオブジェクトを保持します。 \n" "*attrs* ととして渡されたオブジェクトはパーサに再利用されるかもしれません。\n" "そのため、それへの参照を確保するのは属性のコピーを保持する確実な方法ではあり" "ません。\n" @@ -464,9 +462,9 @@ msgstr "名前空間モードでの要素の開始を通知します。" msgid "" "The *name* parameter contains the name of the element type as a ``(uri, " "localname)`` tuple, the *qname* parameter contains the raw XML 1.0 name used " -"in the source document, and the *attrs* parameter holds an instance of the :" -"class:`~xml.sax.xmlreader.AttributesNS` interface (see :ref:`attributes-ns-" -"objects`) containing the attributes of the element. If no namespace is " +"in the source document, and the *attrs* parameter holds an instance of " +"the :class:`~xml.sax.xmlreader.AttributesNS` interface (see :ref:`attributes-" +"ns-objects`) containing the attributes of the element. If no namespace is " "associated with the element, the *uri* component of *name* will be " "``None``. The object passed as *attrs* may be re-used by the parser; " "holding on to a reference to it is not a reliable way to keep a copy of the " @@ -474,9 +472,9 @@ msgid "" "of the *attrs* object." msgstr "" "*name* 引数は要素型の名前を ``(uri, localname)`` というタプルとして持ち、" -"*qname* 引数は元の文書で使われている生の XML 1.0 名を持ち、要素の属性を持つ :" -"class:`~xml.sax.xmlreader.AttributesNS` インターフェイス (:ref:`attributes-" -"ns-objects` を参照) のインスタンスを保持します。\n" +"*qname* 引数は元の文書で使われている生の XML 1.0 名を持ち、要素の属性を持" +"つ :class:`~xml.sax.xmlreader.AttributesNS` インターフェイス " +"(:ref:`attributes-ns-objects` を参照) のインスタンスを保持します。\n" "名前空間が要素に関連付けられていない場合、*name* の *uri* 要素は ``None`` で" "す。\n" "*attrs* ととして渡されたオブジェクトはパーサに再利用されるかもしれません。\n" @@ -634,21 +632,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 +656,17 @@ 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 +674,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 +699,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 +714,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..caaa27655 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,22 +52,22 @@ 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 " "remote files or loaded local files from the file system for DTD and " -"entities. The feature can be enabled again with method :meth:`~xml.sax." -"xmlreader.XMLReader.setFeature` on the parser object and argument :data:" -"`~xml.sax.handler.feature_external_ges`." +"entities. The feature can be enabled again with " +"method :meth:`~xml.sax.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:" @@ -78,14 +77,14 @@ msgstr "その関数群は以下の通りです:" msgid "" "Create and return a SAX :class:`~xml.sax.xmlreader.XMLReader` object. The " "first parser found will be used. If *parser_list* is provided, it must be " -"an iterable of strings which name modules that have a function named :func:" -"`create_parser`. Modules listed in *parser_list* will be used before " -"modules in the default list of parsers." +"an iterable of strings which name modules that have a function " +"named :func:`create_parser`. Modules listed in *parser_list* will be used " +"before modules in the default list of parsers." msgstr "" "SAX :class:`~xml.sax.xmlreader.XMLReader` オブジェクトを生成し、返します。最" -"初に見つかったパーサーが使用されます。*parser_list* を与える場合、それは :" -"func:`create_parser` という名前の関数をもつモジュール名のイテラブルでなければ" -"なりません。\n" +"初に見つかったパーサーが使用されます。*parser_list* を与える場合、それ" +"は :func:`create_parser` という名前の関数をもつモジュール名のイテラブルでなけ" +"ればなりません。\n" "*parser_list* に列挙されているモジュールは、パーサーのデフォルトリストにある" "モジュールよりも先に使われます。" @@ -105,12 +104,12 @@ msgid "" msgstr "" "SAX パーサを生成し、そのパーサをドキュメントの解析に使用します。" "*filename_or_stream* として与えられるドキュメントは、ファイル名でもファイルオ" -"ブジェクトでもかまいません。 *handler* 引数は SAX :class:`~handler." -"ContentHandler` のインスタントである必要があります。*error_handler* が与えら" -"れる場合は、 SAX :class:`~handler.ErrorHandler` のインスタンスである必要があ" -"ります。この引数を省略した場合、全ての例外に対して :exc:`SAXParseException` " -"が発生します。 戻り値はありません。すべての操作は渡される *handler* によって" -"行われなければなりません。" +"ブジェクトでもかまいません。 *handler* 引数は " +"SAX :class:`~handler.ContentHandler` のインスタントである必要があります。" +"*error_handler* が与えられる場合は、 SAX :class:`~handler.ErrorHandler` のイ" +"ンスタンスである必要があります。この引数を省略した場合、全ての例外に対し" +"て :exc:`SAXParseException` が発生します。 戻り値はありません。すべての操作は" +"渡される *handler* によって行われなければなりません。" #: ../../library/xml.sax.rst:64 msgid "" @@ -157,27 +156,26 @@ msgid "" "instantiated by the application itself. Since Python does not have an " "explicit notion of interface, they are formally introduced as classes, but " "applications may use implementations which do not inherit from the provided " -"classes. The :class:`~xml.sax.xmlreader.InputSource`, :class:`~xml.sax." -"xmlreader.Locator`, :class:`~xml.sax.xmlreader.Attributes`, :class:`~xml.sax." -"xmlreader.AttributesNS`, and :class:`~xml.sax.xmlreader.XMLReader` " -"interfaces are defined in the module :mod:`xml.sax.xmlreader`. The handler " -"interfaces are defined in :mod:`xml.sax.handler`. For convenience, :class:" -"`~xml.sax.xmlreader.InputSource` (which is often instantiated directly) and " -"the handler classes are also available from :mod:`xml.sax`. These " -"interfaces are described below." +"classes. " +"The :class:`~xml.sax.xmlreader.InputSource`, :class:`~xml.sax.xmlreader.Locator`, :class:`~xml.sax.xmlreader.Attributes`, :class:`~xml.sax.xmlreader.AttributesNS`, " +"and :class:`~xml.sax.xmlreader.XMLReader` interfaces are defined in the " +"module :mod:`xml.sax.xmlreader`. The handler interfaces are defined " +"in :mod:`xml.sax.handler`. For " +"convenience, :class:`~xml.sax.xmlreader.InputSource` (which is often " +"instantiated directly) and the handler classes are also available " +"from :mod:`xml.sax`. These interfaces are described below." msgstr "" "これらのオブジェクトでは、インターフェースだけが関係します。通常、これらはア" "プリケーション自体によってはインスタンス化されません。 Python は明示的なイン" "ターフェースの概念を持たないので、インターフェースはクラスとして導入されまし" "た。しかし、アプリケーションは、提供されたクラスを継承せずに実装してもかまい" -"ません。インターフェース :class:`~xml.sax.xmlreader.InputSource`, :class:" -"`~xml.sax.xmlreader.Locator`, :class:`~xml.sax.xmlreader.Attributes`, :class:" -"`~xml.sax.xmlreader.AttributesNS`, :class:`~xml.sax.xmlreader.XMLReader` は" -"モジュール :mod:`xml.sax.xmlreader` で定義されています。ハンドラインター" -"フェースは :mod:`xml.sax.handler` で定義されています。利便性のため、 :class:" -"`~xml.sax.xmlreader.InputSource` (よく直接インスタンス化されるクラス) とハン" -"ドラクラスは :mod:`xml.sax` からもアクセスできます。これらのインターフェース" -"について下記で説明します。" +"ません。インターフェー" +"ス :class:`~xml.sax.xmlreader.InputSource`, :class:`~xml.sax.xmlreader.Locator`, :class:`~xml.sax.xmlreader.Attributes`, :class:`~xml.sax.xmlreader.AttributesNS`, :class:`~xml.sax.xmlreader.XMLReader` " +"はモジュール :mod:`xml.sax.xmlreader` で定義されています。ハンドラインター" +"フェースは :mod:`xml.sax.handler` で定義されています。利便性のた" +"め、 :class:`~xml.sax.xmlreader.InputSource` (よく直接インスタンス化されるク" +"ラス) とハンドラクラスは :mod:`xml.sax` からもアクセスできます。これらのイン" +"ターフェースについて下記で説明します。" #: ../../library/xml.sax.rst:95 msgid "" @@ -190,17 +188,17 @@ msgid "" "Encapsulate an XML error or warning. This class can contain basic error or " "warning information from either the XML parser or the application: it can be " "subclassed to provide additional functionality or to add localization. Note " -"that although the handlers defined in the :class:`~xml.sax.handler." -"ErrorHandler` interface receive instances of this exception, it is not " -"required to actually raise the exception --- it is also useful as a " -"container for information." +"that although the handlers defined in " +"the :class:`~xml.sax.handler.ErrorHandler` interface receive instances of " +"this exception, it is not required to actually raise the exception --- it is " +"also useful as a container for information." msgstr "" "XML エラーと警告をカプセル化します。このクラスには XML パーサとアプリケーショ" "ンで発生するエラーおよび警告の基本的な情報を持たせることができます。また機能" -"追加や地域化のためにサブクラス化することも可能です。なお :class:`~xml.sax." -"handler.ErrorHandler` で定義されているハンドラがこの例外のインスタンスを受け" -"取ることに注意してください。実際に例外を発生させることは必須でなく、情報のコ" -"ンテナとして利用されることもあるからです。" +"追加や地域化のためにサブクラス化することも可能です。な" +"お :class:`~xml.sax.handler.ErrorHandler` で定義されているハンドラがこの例外" +"のインスタンスを受け取ることに注意してください。実際に例外を発生させることは" +"必須でなく、情報のコンテナとして利用されることもあるからです。" #: ../../library/xml.sax.rst:109 msgid "" @@ -220,38 +218,43 @@ msgstr "このクラスはSAX 例外の基底クラスになります。" #: ../../library/xml.sax.rst:118 msgid "" "Subclass of :exc:`SAXException` raised on parse errors. Instances of this " -"class are passed to the methods of the SAX :class:`~xml.sax.handler." -"ErrorHandler` interface to provide information about the parse error. This " -"class supports the SAX :class:`~xml.sax.xmlreader.Locator` interface as well " -"as the :class:`SAXException` interface." +"class are passed to the methods of the " +"SAX :class:`~xml.sax.handler.ErrorHandler` interface to provide information " +"about the parse error. This class supports the " +"SAX :class:`~xml.sax.xmlreader.Locator` interface as well as " +"the :class:`SAXException` interface." msgstr "" "パースエラー時に発生する :exc:`SAXException` のサブクラスです。パースエラーに" -"関する情報として、このクラスのインスタンスが SAX :class:`~xml.sax.handler." -"ErrorHandler` インターフェースのメソッドに渡されます。このクラスは :class:" -"`SAXException` 同様 SAX :class:`~xml.sax.xmlreader.Locator` インターフェース" -"もサポートしています。" +"関する情報として、このクラスのインスタンスが " +"SAX :class:`~xml.sax.handler.ErrorHandler` インターフェースのメソッドに渡され" +"ます。このクラスは :class:`SAXException` 同様 " +"SAX :class:`~xml.sax.xmlreader.Locator` インターフェースもサポートしていま" +"す。" #: ../../library/xml.sax.rst:128 msgid "" -"Subclass of :exc:`SAXException` raised when a SAX :class:`~xml.sax.xmlreader." -"XMLReader` is confronted with an unrecognized feature or property. SAX " -"applications and extensions may use this class for similar purposes." +"Subclass of :exc:`SAXException` raised when a " +"SAX :class:`~xml.sax.xmlreader.XMLReader` is confronted with an unrecognized " +"feature or property. SAX applications and extensions may use this class for " +"similar purposes." msgstr "" "SAX :class:`~xml.sax.xmlreader.XMLReader` が認識できない機能やプロパティに遭" "遇したとき発生させる :exc:`SAXException` のサブクラスです。 SAX アプリケー" "ションや拡張モジュールにおいて同様の目的にこのクラスを利用することもできま" "す。" -#: ../../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." +"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..c3aff1606 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,40 +49,39 @@ 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 " -"normally not read the entire file, but read it in chunks as well; still :" -"meth:`parse` won't return until the entire document is processed. So these " -"interfaces should be used if the blocking behaviour of :meth:`parse` is not " -"desirable." +"normally not read the entire file, but read it in chunks as well; " +"still :meth:`parse` won't return until the entire document is processed. So " +"these 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 "" @@ -126,11 +125,12 @@ msgstr "" #: ../../library/xml.sax.reader.rst:63 msgid "" -"Applications will create objects of this class for use in the :meth:" -"`XMLReader.parse` method and for returning from EntityResolver.resolveEntity." +"Applications will create objects of this class for use in " +"the :meth:`XMLReader.parse` method and for returning from " +"EntityResolver.resolveEntity." msgstr "" -"アプリケーションは :meth:`XMLReader.parse` メソッドでの使用や EntityResolver." -"resolveEntity の戻り値としてこのオブジェトを作成します。" +"アプリケーションは :meth:`XMLReader.parse` メソッドでの使用や " +"EntityResolver.resolveEntity の戻り値としてこのオブジェトを作成します。" #: ../../library/xml.sax.reader.rst:67 msgid "" @@ -142,38 +142,41 @@ 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 " +"This is an implementation of the :class:`Attributes` interface (see " +"section :ref:`attributes-objects`). This is a dictionary-like object which " "represents the element attributes in a :meth:`startElement` call. In " "addition to the most useful dictionary operations, it supports a number of " "other methods as described by the interface. Objects of this class should be " "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 " +"Namespace-aware variant of :class:`AttributesImpl`, which will be passed " +"to :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but " "understands attribute names as two-tuples of *namespaceURI* and *localname*. " "In addition, it provides a number of methods expecting qualified names as " -"they appear in the original document. This class implements the :class:" -"`AttributesNS` interface (see section :ref:`attributes-ns-objects`)." -msgstr "" -":class:`AttributesImpl` を名前空間認識型に改良したクラスで、 :meth:" -"`startElementNS` に渡されます。 :class:`AttributesImpl` の派生クラスですが、 " -"*namespaceURI* と *localname* の2要素のタプルを解釈します。さらに、元の文書に" -"出てくる修飾名を返す多くのメソッドを提供します。このクラスは :class:" -"`AttributesNS` インターフェース (:ref:`attributes-ns-objects` 参照) の実装で" -"す。" +"they appear in the original document. This class implements " +"the :class:`AttributesNS` interface (see section :ref:`attributes-ns-" +"objects`)." +msgstr "" +":class:`AttributesImpl` を名前空間認識型に改良したクラス" +"で、 :meth:`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 +186,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 +194,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." @@ -213,40 +216,41 @@ msgstr "現在の :class:`~xml.sax.handler.ContentHandler` を返します。" #: ../../library/xml.sax.reader.rst:124 msgid "" -"Set the current :class:`~xml.sax.handler.ContentHandler`. If no :class:" -"`~xml.sax.handler.ContentHandler` is set, content events will be discarded." +"Set the current :class:`~xml.sax.handler.ContentHandler`. If " +"no :class:`~xml.sax.handler.ContentHandler` is set, content events will be " +"discarded." msgstr "" -"現在の :class:`~xml.sax.handler.ContentHandler` を設定します。 :class:`~xml." -"sax.handler.ContentHandler` が設定されていない場合、内容イベントは破棄されま" -"す。" +"現在の :class:`~xml.sax.handler.ContentHandler` を設定しま" +"す。 :class:`~xml.sax.handler.ContentHandler` が設定されていない場合、内容イ" +"ベントは破棄されます。" #: ../../library/xml.sax.reader.rst:131 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." +"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." +"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`." @@ -282,20 +286,21 @@ msgid "" "recognized, :exc:`SAXNotRecognizedException` is raised. The well-known " "featurenames are listed in the module :mod:`xml.sax.handler`." msgstr "" -"機能 *featurename* の現在の設定を返します。その機能が認識できないときは、 :" -"exc:`SAXNotRecognizedException` を送出します。有名な機能名はモジュール :mod:" -"`xml.sax.handler` に列挙されています。" +"機能 *featurename* の現在の設定を返します。その機能が認識できないとき" +"は、 :exc:`SAXNotRecognizedException` を送出します。有名な機能名はモジュー" +"ル :mod:`xml.sax.handler` に列挙されています。" #: ../../library/xml.sax.reader.rst:183 msgid "" -"Set the *featurename* to *value*. If the feature is not recognized, :exc:" -"`SAXNotRecognizedException` is raised. If the feature or its setting is not " -"supported by the parser, *SAXNotSupportedException* is raised." +"Set the *featurename* to *value*. If the feature is not " +"recognized, :exc:`SAXNotRecognizedException` is raised. If the feature or " +"its setting is not supported by the parser, *SAXNotSupportedException* is " +"raised." msgstr "" "機能名 *featurename* に値 *value* を設定します。その機能が認識できないとき" "は、 :exc:`SAXNotRecognizedException` を送出します。また、パーサが指定された" -"機能や設定をサポートしていないときは、 :exc:`SAXNotSupportedException` を送出" -"します。" +"機能や設定をサポートしていないときは、 ``SAXNotSupportedException`` を送出し" +"ます。" #: ../../library/xml.sax.reader.rst:190 msgid "" @@ -303,20 +308,21 @@ msgid "" "not recognized, a :exc:`SAXNotRecognizedException` is raised. The well-known " "propertynames are listed in the module :mod:`xml.sax.handler`." msgstr "" -"属性名 *propertyname* の現在の値を返します。その属性が認識できないときは、 :" -"exc:`SAXNotRecognizedException` を送出します。有名な属性名はモジュール :mod:" -"`xml.sax.handler` に列挙されています。" +"属性名 *propertyname* の現在の値を返します。その属性が認識できないとき" +"は、 :exc:`SAXNotRecognizedException` を送出します。有名な属性名はモジュー" +"ル :mod:`xml.sax.handler` に列挙されています。" #: ../../library/xml.sax.reader.rst:197 msgid "" -"Set the *propertyname* to *value*. If the property is not recognized, :exc:" -"`SAXNotRecognizedException` is raised. If the property or its setting is not " -"supported by the parser, *SAXNotSupportedException* is raised." +"Set the *propertyname* to *value*. If the property is not " +"recognized, :exc:`SAXNotRecognizedException` is raised. If the property or " +"its setting is not supported by the parser, *SAXNotSupportedException* is " +"raised." msgstr "" "属性名 *propertyname* に値 *value* を設定します。その機能が認識できないとき" "は、 :exc:`SAXNotRecognizedException` を送出します。また、パーサが指定された" -"機能や設定をサポートしていないときは、 :exc:`SAXNotSupportedException` を送出" -"します。" +"機能や設定をサポートしていないときは、 ``SAXNotSupportedException`` を送出し" +"ます。" #: ../../library/xml.sax.reader.rst:205 msgid "IncrementalParser Objects" @@ -333,24 +339,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" @@ -410,8 +416,8 @@ msgstr "" #: ../../library/xml.sax.reader.rst:290 msgid "" -"The encoding attribute of the :class:`InputSource` is ignored if the :class:" -"`InputSource` also contains a character stream." +"The encoding attribute of the :class:`InputSource` is ignored if " +"the :class:`InputSource` also contains a character stream." msgstr "" ":class:`InputSource` も文字ストリームを含んでいた場合、:class:`InputSource` " "のエンコーディング属性は無視されます。" @@ -424,14 +430,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 "" @@ -477,17 +484,15 @@ msgstr ":class:`Attributes` インターフェース" #: ../../library/xml.sax.reader.rst:336 msgid "" ":class:`Attributes` objects implement a portion of the :term:`mapping " -"protocol `, including the methods :meth:`~collections.abc.Mapping." -"copy`, :meth:`~collections.abc.Mapping.get`, :meth:`~object.__contains__`, :" -"meth:`~collections.abc.Mapping.items`, :meth:`~collections.abc.Mapping." -"keys`, and :meth:`~collections.abc.Mapping.values`. The following methods " -"are also provided:" -msgstr "" -":class:`Attributes` オブジェクトは :meth:`~collections.abc.Mapping.copy`、:" -"meth:`~collections.abc.Mapping.get`、:meth:`~object.__contains__`、:meth:" -"`~collections.abc.Mapping.items`、:meth:`~collections.abc.Mapping.keys`、:" -"meth:`~collections.abc.Mapping.values` を含む :term:`マッピングプロトコル " -"` の一部を実装しています。以下のメソッドも提供されています:" +"protocol `, including the " +"methods :meth:`~collections.abc.Mapping.copy`, :meth:`~collections.abc.Mapping.get`, :meth:`~object.__contains__`, :meth:`~collections.abc.Mapping.items`, :meth:`~collections.abc.Mapping.keys`, " +"and :meth:`~collections.abc.Mapping.values`. The following methods are also " +"provided:" +msgstr "" +":class:`Attributes` オブジェクト" +"は :meth:`~collections.abc.Mapping.copy`、:meth:`~collections.abc.Mapping.get`、:meth:`~object.__contains__`、:meth:`~collections.abc.Mapping.items`、:meth:`~collections.abc.Mapping.keys`、:meth:`~collections.abc.Mapping.values` " +"を含む :term:`マッピングプロトコル ` の一部を実装しています。以下の" +"メソッドも提供されています:" #: ../../library/xml.sax.reader.rst:346 msgid "Return the number of attributes." @@ -516,10 +521,10 @@ msgid "" "section :ref:`attributes-objects`). All methods supported by that interface " "are also available on :class:`AttributesNS` objects." msgstr "" -"このインターフェースは :class:`Attributes` インターフェース (:ref:" -"`attributes-objects` 参照) のサブタイプです。 Attributes インターフェースがサ" -"ポートしているすべてのメソッドは :class:`AttributesNS` オブジェクトでも利用可" -"能です。" +"このインターフェースは :class:`Attributes` インターフェース " +"(:ref:`attributes-objects` 参照) のサブタイプです。 Attributes インターフェー" +"スがサポートしているすべてのメソッドは :class:`AttributesNS` オブジェクトでも" +"利用可能です。" #: ../../library/xml.sax.reader.rst:376 msgid "The following methods are also available:" diff --git a/library/xml.sax.utils.po b/library/xml.sax.utils.po index a657c7e29..667eea9ae 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 "" @@ -120,8 +121,8 @@ msgstr "" #: ../../library/xml.sax.utils.rst:64 msgid "" "This class implements the :class:`~xml.sax.handler.ContentHandler` interface " -"by writing SAX events back into an XML document. In other words, using an :" -"class:`XMLGenerator` as the content handler will reproduce the original " +"by writing SAX events back into an XML document. In other words, using " +"an :class:`XMLGenerator` as the content handler will reproduce the original " "document being parsed. *out* should be a file-like object which will default " "to *sys.stdout*. *encoding* is the encoding of the output stream which " "defaults to ``'iso-8859-1'``. *short_empty_elements* controls the formatting " @@ -129,8 +130,9 @@ msgid "" "emitted as a pair of start/end tags, if set to ``True`` they are emitted as " "a single self-closed tag." msgstr "" -"このクラスは SAX イベントを XML 文書に書き戻すことで :class:`~xml.sax." -"handler.ContentHandler` インターフェースを実装しています。\n" +"このクラスは SAX イベントを XML 文書に書き戻すこと" +"で :class:`~xml.sax.handler.ContentHandler` インターフェースを実装していま" +"す。\n" "つまり、 :class:`XMLGenerator` をコンテントハンドラとして用いることで、パース" "している元々の文書を複製することが出来ます。\n" "*out* にはファイル様オブジェクトでなければなりません。\n" @@ -148,11 +150,12 @@ msgstr "*short_empty_elements* 引数を追加しました。" #: ../../library/xml.sax.utils.rst:80 msgid "" -"This class is designed to sit between an :class:`~xml.sax.xmlreader." -"XMLReader` and the client application's event handlers. By default, it does " -"nothing but pass requests up to the reader and events on to the handlers " -"unmodified, but subclasses can override specific methods to modify the event " -"stream or the configuration requests as they pass through." +"This class is designed to sit between " +"an :class:`~xml.sax.xmlreader.XMLReader` and the client application's event " +"handlers. By default, it does nothing but pass requests up to the reader " +"and events on to the handlers unmodified, but subclasses can override " +"specific methods to modify the event stream or the configuration requests as " +"they pass through." msgstr "" "このクラスは :class:`~xml.sax.xmlreader.XMLReader` とクライアント・アプリケー" "ションのイベント・ハンドラとの間に位置するものとして設計されています。デフォ" @@ -160,17 +163,17 @@ 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 " "reading. The input source can be given as a string, a file-like object, or " "an :class:`~xml.sax.xmlreader.InputSource` object; parsers will use this " -"function to implement the polymorphic *source* argument to their :meth:`~xml." -"sax.xmlreader.XMLReader.parse` method." +"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..d39a9371c 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,19 +66,17 @@ msgstr "" "HTTPS URI の場合、 :mod:`xmlrpc.client` は必要な証明書検証とホスト名チェック" "を全てデフォルトで行います。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは 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,29 +94,49 @@ 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 " "XML; the default behaviour is for ``None`` to raise a :exc:`TypeError`. This " "is a commonly used extension to the XML-RPC specification, but isn't " "supported by all clients and servers; see `http://ontosys.com/xml-rpc/" -"extensions.php `_ for a description. The *use_builtin_types* " -"flag can be used to cause date/time values to be presented as :class:" -"`datetime.datetime` objects and binary data to be presented as :class:" -"`bytes` objects; this flag is false by default. :class:`datetime.datetime`, :" -"class:`bytes` and :class:`bytearray` objects may be passed to calls. The " -"*headers* parameter is an optional sequence of HTTP headers to send with " -"each request, expressed as a sequence of 2-tuples representing the header " -"name and value. (e.g. ``[('Header-Name', 'value')]``). If an HTTPS URL is " -"provided, *context* may be :class:`ssl.SSLContext` and configures the SSL " -"settings of the underlying HTTPS connection. The obsolete *use_datetime* " -"flag is similar to *use_builtin_types* but it applies only to date/time " -"values." -msgstr "" +"extensions.php `_ for a description. The " +"*use_builtin_types* flag can be used to cause date/time values to be " +"presented as :class:`datetime.datetime` objects and binary data to be " +"presented as :class:`bytes` objects; this flag is false by " +"default. :class:`datetime.datetime`, :class:`bytes` and :class:`bytearray` " +"objects may be passed to calls. The *headers* parameter is an optional " +"sequence of HTTP headers to send with each request, expressed as a sequence " +"of 2-tuples representing the header name and value. (e.g. ``[('Header-Name', " +"'value')]``). If an HTTPS URL is provided, *context* may " +"be :class:`ssl.SSLContext` and configures the SSL settings of the underlying " +"HTTPS connection. The obsolete *use_datetime* 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." @@ -131,11 +149,11 @@ msgstr "*headers* 引数が追加されました。" #: ../../library/xmlrpc.client.rst:75 msgid "" "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP " -"Basic Authentication: ``http://user:pass@host:port/path``. The ``user:" -"pass`` portion will be base64-encoded as an HTTP 'Authorization' header, and " -"sent to the remote server as part of the connection process when invoking an " -"XML-RPC method. You only need to use this if the remote server requires a " -"Basic Authentication user and password." +"Basic Authentication: ``http://user:pass@host:port/path``. The " +"``user:pass`` portion will be base64-encoded as an HTTP 'Authorization' " +"header, and sent to the remote server as part of the connection process when " +"invoking an XML-RPC method. You only need to use this if the remote server " +"requires a Basic Authentication user and password." msgstr "" "HTTP及びHTTPS通信の両方で、 ``http://user:pass@host:port/path`` のようなHTTP" "基本認証のための拡張URL構文をサポートしています。 ``user:pass`` はbase64でエ" @@ -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``" @@ -216,22 +236,22 @@ msgid "" ":class:`list` or :class:`tuple` containing conformable elements. Arrays are " "returned as :class:`lists `." msgstr "" -"適合する要素を持つ :class:`list` または :class:`tuple`。array は :class:" -"`list` として返します。" +"適合する要素を持つ :class:`list` または :class:`tuple`。array " +"は :class:`list` として返します。" #: ../../library/xmlrpc.client.rst:113 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." +"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 "" @@ -298,8 +320,9 @@ msgid "" "allowed in XML, such as the control characters with ASCII values between 0 " "and 31 (except, of course, tab, newline and carriage return); failing to do " "this will result in an XML-RPC request that isn't well-formed XML. If you " -"have to pass arbitrary bytes via XML-RPC, use :class:`bytes` or :class:" -"`bytearray` classes or the :class:`Binary` wrapper class described below." +"have to pass arbitrary bytes via XML-RPC, use :class:`bytes` " +"or :class:`bytearray` classes or the :class:`Binary` wrapper class described " +"below." msgstr "" "文字列を渡す場合、 ``<``, ``>``, ``&`` などのXMLで特殊な意味を持つ文字は自動" "的にエスケープされます。しかし、ASCII値0〜31の制御文字(もちろん、タブ'TAB',改" @@ -320,7 +343,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 +350,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 +370,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 +408,13 @@ 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 +465,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 +499,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 +521,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 +538,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." @@ -511,14 +552,15 @@ msgid "" "Write the XML-RPC encoding of this :class:`DateTime` item to the *out* " "stream object." msgstr "" -"出力ストリームオブジェクト *out* に、XML-RPCエンコーディングの :class:" -"`DateTime` 値を出力します。" +"出力ストリームオブジェクト *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 "" @@ -559,8 +601,8 @@ msgid "" "primary access to the content of a :class:`Binary` object is provided by an " "attribute:" msgstr "" -"このクラスは、バイト列データ(NULを含む)で初期化することができます。 :class:" -"`Binary` の内容は、属性で参照します:" +"このクラスは、バイト列データ(NULを含む)で初期化することができま" +"す。 :class:`Binary` の内容は、属性で参照します:" #: ../../library/xmlrpc.client.rst:317 msgid "" @@ -604,11 +646,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." +"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 +659,6 @@ msgid "" "XMLRPC::" msgstr "バイナリオブジェクトの使用例です。 XML-RPCごしに画像を転送します。 ::" -#: ../../library/xmlrpc.client.rst:344 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "import xmlrpc.client\n" @@ -631,12 +673,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 +697,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" @@ -670,10 +728,9 @@ msgid "" "In the following example we're going to intentionally cause a :exc:`Fault` " "by returning a complex type object. The server code::" msgstr "" -"以下のサンプルでは、複素数型のオブジェクトを返そうとして、故意に :exc:" -"`Fault` を起こしています。 ::" +"以下のサンプルでは、複素数型のオブジェクトを返そうとして、故意" +"に :exc:`Fault` を起こしています。 ::" -#: ../../library/xmlrpc.client.rst:388 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "\n" @@ -688,8 +745,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 +768,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,21 +804,19 @@ 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 "" -"In the following example we're going to intentionally cause a :exc:" -"`ProtocolError` by providing an invalid URI::" +"In the following example we're going to intentionally cause " +"a :exc:`ProtocolError` by providing an invalid URI::" msgstr "" "次の例では、不適切な URI を利用して、故意に :exc:`ProtocolError` を発生させて" "います::" -#: ../../library/xmlrpc.client.rst:450 msgid "" "import xmlrpc.client\n" "\n" @@ -758,6 +832,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" @@ -785,16 +872,15 @@ msgstr "" "には最終的に呼び出しを行う対象を指定します。作成した MultiCall オブジェクトを" "使って呼び出しを行うと、即座に ``None`` を返し、呼び出したい手続き名とパラメ" "タを :class:`MultiCall` オブジェクトに保存するだけに留まります。オブジェクト" -"自体を呼び出すと、それまでに保存しておいたすべての呼び出しを単一の ``system." -"multicall`` リクエストの形で伝送します。呼び出し結果は :term:`ジェネレータ " -"` になります。このジェネレータにわたってイテレーションを行うと、" -"個々の呼び出し結果を返します。" +"自体を呼び出すと、それまでに保存しておいたすべての呼び出しを単一の " +"``system.multicall`` リクエストの形で伝送します。呼び出し結果は :term:`ジェネ" +"レータ ` になります。このジェネレータにわたってイテレーションを行" +"うと、個々の呼び出し結果を返します。" #: ../../library/xmlrpc.client.rst:481 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 +906,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 +943,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 +1009,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 +1023,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 +1044,6 @@ msgstr "" "XML-RPC サーバに HTTP プロキシを経由して接続する場合、カスタムトランスポート" "を定義する必要があります。以下に例を示します::" -#: ../../library/xmlrpc.client.rst:576 msgid "" "import http.client\n" "import xmlrpc.client\n" @@ -937,6 +1066,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" @@ -956,6 +1105,6 @@ msgid "" "`_." msgstr "" -"このアプローチは `a discussion on xmlrpc.com `_ にて最初に著されました。" +"このアプローチは `a discussion on xmlrpc.com `_ に" +"て最初に著されました。" 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..689c4a11a 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 @@ -36,14 +36,14 @@ msgstr "**ソースコード:** :source:`Lib/xmlrpc/server.py`" #: ../../library/xmlrpc.server.rst:14 msgid "" "The :mod:`xmlrpc.server` module provides a basic server framework for XML-" -"RPC servers written in Python. Servers can either be free standing, using :" -"class:`SimpleXMLRPCServer`, or embedded in a CGI environment, using :class:" -"`CGIXMLRPCRequestHandler`." +"RPC servers written in Python. Servers can either be free standing, " +"using :class:`SimpleXMLRPCServer`, or embedded in a CGI environment, " +"using :class:`CGIXMLRPCRequestHandler`." msgstr "" ":mod:`xmlrpc.server` モジュールはPythonで記述された基本的なXML-RPC サーバーフ" -"レームワークを提供します。サーバーはスタンドアロンであるか、 :class:" -"`SimpleXMLRPCServer` を使うか、 :class:`CGIXMLRPCRequestHandler` を使って " -"CGI 環境に組み込まれるかの、いずれかです。" +"レームワークを提供します。サーバーはスタンドアロンである" +"か、 :class:`SimpleXMLRPCServer` を使うか、 :class:`CGIXMLRPCRequestHandler` " +"を使って CGI 環境に組み込まれるかの、いずれかです。" #: ../../library/xmlrpc.server.rst:22 msgid "" @@ -55,36 +55,35 @@ msgstr "" "ありません。信頼できないデータや認証されていないデータを解析する必要がある場" "合は、 :ref:`xml-vulnerabilities` を参照してください。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは 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 " "*requestHandler* parameter should be a factory for request handler " "instances; it defaults to :class:`SimpleXMLRPCRequestHandler`. The *addr* " -"and *requestHandler* parameters are passed to the :class:`socketserver." -"TCPServer` constructor. If *logRequests* is true (the default), requests " -"will be logged; setting this parameter to false will turn off logging. The " -"*allow_none* and *encoding* parameters are passed on to :mod:`xmlrpc.client` " -"and control the XML-RPC responses that will be returned from the server. The " -"*bind_and_activate* parameter controls whether :meth:`server_bind` and :meth:" -"`server_activate` are called immediately by the constructor; it defaults to " -"true. Setting it to false allows code to manipulate the " -"*allow_reuse_address* class variable before the address is bound. The " -"*use_builtin_types* parameter is passed to the :func:`~xmlrpc.client.loads` " -"function and controls which types are processed when date/times values or " -"binary data are received; it defaults to false." +"and *requestHandler* parameters are passed to " +"the :class:`socketserver.TCPServer` constructor. If *logRequests* is true " +"(the default), requests will be logged; setting this parameter to false will " +"turn off logging. The *allow_none* and *encoding* parameters are passed on " +"to :mod:`xmlrpc.client` and control the XML-RPC responses that will be " +"returned from the server. The *bind_and_activate* parameter controls " +"whether :meth:`server_bind` and :meth:`server_activate` are called " +"immediately by the constructor; it defaults to true. Setting it to false " +"allows code to manipulate the *allow_reuse_address* class variable before " +"the address is bound. The *use_builtin_types* parameter is passed to " +"the :func:`~xmlrpc.client.loads` function and controls which types are " +"processed when date/times values or binary data are received; it defaults to " +"false." msgstr "" "サーバーインスタンスを新たに作成します。\n" "このクラスは XML-RPC プロトコルで呼ばれる関数の登録のためのメソッドを提供しま" @@ -98,10 +97,11 @@ msgstr "" "この引数を偽にするとはログは記録されません。\n" "引数 *allow_none* と *encoding* は :mod:`xmlrpc.client` に渡され、サーバーが" "返す XML-RPC 応答を制御します。\n" -"*bind_and_activate* 引数はコンストラクタが直ちに :meth:`server_bind` と :" -"meth:`server_activate` を呼ぶかどうかを制御します。デフォルトでは真です。\n" +"*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" "この引数は日付/時刻の値やバイナリデータを受け取ったときにどの型が処理されるか" "を制御します。デフォルトでは偽です。" @@ -143,9 +143,9 @@ msgstr "SimpleXMLRPCServer オブジェクト" #: ../../library/xmlrpc.server.rst:78 msgid "" -"The :class:`SimpleXMLRPCServer` class is based on :class:`socketserver." -"TCPServer` and provides a means of creating simple, stand alone XML-RPC " -"servers." +"The :class:`SimpleXMLRPCServer` class is based " +"on :class:`socketserver.TCPServer` and provides a means of creating simple, " +"stand alone XML-RPC servers." msgstr "" ":class:`SimpleXMLRPCServer` クラスは :class:`socketserver.TCPServer` のサブク" "ラスで、基本的なスタンドアロンの XML-RPC サーバーを作成する手段を提供します。" @@ -153,9 +153,10 @@ msgstr "" #: ../../library/xmlrpc.server.rst:85 ../../library/xmlrpc.server.rst:299 msgid "" "Register a function that can respond to XML-RPC requests. If *name* is " -"given, it will be the method name associated with *function*, otherwise :" -"attr:`function.__name__` will be used. *name* is a string, and may contain " -"characters not legal in Python identifiers, including the period character." +"given, it will be the method name associated with *function*, " +"otherwise :attr:`function.__name__` will be used. *name* is a string, and " +"may contain characters not legal in Python identifiers, including the period " +"character." msgstr "" "XML-RPC リクエストに応答可能な関数を登録します。引数 *name* が与えられた場合" "は、それが関数 *function* に関連付けられたメソッド名となります。そうでない場" @@ -171,8 +172,8 @@ msgid "" msgstr "" "このメソッドはデコレーターとしても使用することができます。デコレーターとして" "使用するときは、 *name* は関数を *name* で登録するキーワード引数としてのみ渡" -"すことができます。 *name* が与えられていないときは、 :attr:`function." -"__name__` が使用されます。" +"すことができます。 *name* が与えられていないとき" +"は、 :attr:`function.__name__` が使用されます。" #: ../../library/xmlrpc.server.rst:94 ../../library/xmlrpc.server.rst:308 msgid ":meth:`register_function` can be used as a decorator." @@ -181,9 +182,9 @@ msgstr ":meth:`register_function` はデコレーターとして使用できま #: ../../library/xmlrpc.server.rst:100 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:" -"`_dispatch` method, it is called with the requested method name and the " -"parameters from the request. Its API is ``def _dispatch(self, method, " +"registered using :meth:`register_function`. If *instance* contains " +"a :meth:`_dispatch` method, it is called with the requested method name and " +"the parameters from the request. Its API is ``def _dispatch(self, method, " "params)`` (note that *params* does not represent a variable argument list). " "If it calls an underlying function to perform its task, that function is " "called as ``func(*params)``, expanding the parameter list. The return value " @@ -201,8 +202,8 @@ msgstr "" "タスクを実行するのに下層の関数を呼び出す場合、その関数は ``func(*params)`` の" "ように引数リストを展開して呼び出されます。\n" ":meth:`_dispatch` の返り値は結果としてクライアントに返されます。\n" -"*instance* に :meth:`_dispatch` メソッドがない場合、リクエストされたメソッド" -"名にマッチする属性を検索します。" +"*instance* に ``_dispatch()`` メソッドがない場合、リクエストされたメソッド名" +"にマッチする属性を検索します。" #: ../../library/xmlrpc.server.rst:111 msgid "" @@ -236,8 +237,8 @@ msgid "" "Registers the XML-RPC introspection functions ``system.listMethods``, " "``system.methodHelp`` and ``system.methodSignature``." msgstr "" -"XML-RPC のイントロスペクション関数、 ``system.listMethods`` 、 ``system." -"methodHelp`` 、 ``system.methodSignature`` を登録します。" +"XML-RPC のイントロスペクション関数、 ``system.listMethods`` 、 " +"``system.methodHelp`` 、 ``system.methodSignature`` を登録します。" #: ../../library/xmlrpc.server.rst:133 msgid "Registers the XML-RPC multicall function system.multicall." @@ -264,7 +265,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 +298,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 +339,6 @@ msgstr "" "以下のクライアントコードは上のサーバーで使えるようになったメソッドを呼び出し" "ます::" -#: ../../library/xmlrpc.server.rst:185 msgid "" "import xmlrpc.client\n" "\n" @@ -319,16 +350,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 +397,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 +474,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 +485,6 @@ msgstr "" "上記のサーバとやりとりするクライアントは ``Lib/xmlrpc/client.py`` にありま" "す::" -#: ../../library/xmlrpc.server.rst:268 msgid "" "server = ServerProxy(\"http://localhost:8000\")\n" "\n" @@ -439,6 +503,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 +526,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,13 +541,12 @@ 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:" -"`_dispatch` method, it is called with the requested method name and the " -"parameters from the request; the return value is returned to the client as " -"the result. If instance does not have a :meth:`_dispatch` method, it is " +"registered using :meth:`register_function`. If instance contains " +"a :meth:`_dispatch` method, it is called with the requested method name and " +"the parameters from the request; the return value is returned to the client " +"as the result. If instance does not have a :meth:`_dispatch` method, it is " "searched for an attribute matching the name of the requested method; if the " "requested method name contains periods, each component of the method name " "is searched for individually, with the effect that a simple hierarchical " @@ -482,10 +560,10 @@ msgstr "" "*instance* に :meth:`_dispatch` メソッドがあった場合、リクエストされたメソッ" "ド名と引数で :meth:`_dispatch` を呼び出します。\n" "返り値は結果としてクライアントに返されます。\n" -"*instance* に :meth:`_dispatch` メソッドがなかった場合、リクエストされたメ" -"ソッド名にマッチする属性を検索します。\n" -"リクエストされたメソッド名がピリオドを含む場合、モジュール名の各要素が個々に" -"検索され、簡単な階層的検索が実行されます。\n" +"*instance* に ``_dispatch()`` メソッドがなかった場合、リクエストされたメソッ" +"ド名にマッチする属性を検索します。\n" +"リクエストされたメソッド名がピリオドを含む場合、メソッド名の各要素が個々に検" +"索され、簡単な階層的検索が実行されます。\n" "その検索で発見された値をリクエストの引数で呼び出し、クライアントに返り値を返" "します。" @@ -494,8 +572,8 @@ msgid "" "Register the XML-RPC introspection functions ``system.listMethods``, " "``system.methodHelp`` and ``system.methodSignature``." msgstr "" -"XML-RPC のイントロスペクション関数、 ``system.listMethods`` 、 ``system." -"methodHelp`` 、 ``system.methodSignature`` を登録します。" +"XML-RPC のイントロスペクション関数、 ``system.listMethods`` 、 " +"``system.methodHelp`` 、 ``system.methodSignature`` を登録します。" #: ../../library/xmlrpc.server.rst:334 msgid "Register the XML-RPC multicall function ``system.multicall``." @@ -515,7 +593,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/xmlrpc.server.rst:344 msgid "" "class MyFuncs:\n" " def mul(self, x, y):\n" @@ -529,33 +606,42 @@ 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`." +"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 "" -"Create a new server instance. All parameters have the same meaning as for :" -"class:`SimpleXMLRPCServer`; *requestHandler* defaults to :class:" -"`DocXMLRPCRequestHandler`." +"Create a new server instance. All parameters have the same meaning as " +"for :class:`SimpleXMLRPCServer`; *requestHandler* defaults " +"to :class:`DocXMLRPCRequestHandler`." msgstr "" -"サーバ・インスタンスを新たに生成します。全ての引数の意味は :class:" -"`SimpleXMLRPCServer` のものと同じですが、 *requestHandler* のデフォルトは :" -"class:`DocXMLRPCRequestHandler` になっています。" +"サーバ・インスタンスを新たに生成します。全ての引数の意味" +"は :class:`SimpleXMLRPCServer` のものと同じですが、 *requestHandler* のデフォ" +"ルトは :class:`DocXMLRPCRequestHandler` になっています。" #: ../../library/xmlrpc.server.rst:380 msgid "Create a new instance to handle XML-RPC requests in a CGI environment." @@ -569,9 +655,9 @@ msgid "" "parameter is honored." msgstr "" "リクエスト・ハンドラのインスタンスを新たに生成します。このリクエスト・ハンド" -"ラは XML-RPC POST 要求とドキュメントの GET 要求をサポートし、 :class:" -"`DocXMLRPCServer` コンストラクタに与えられた引数 *logRequests* を優先するため" -"にロギングを変更します。" +"ラは XML-RPC POST 要求とドキュメントの GET 要求をサポート" +"し、 :class:`DocXMLRPCServer` コンストラクタに与えられた引数 *logRequests* を" +"優先するためにロギングを変更します。" #: ../../library/xmlrpc.server.rst:394 msgid "DocXMLRPCServer Objects" @@ -579,11 +665,11 @@ msgstr "DocXMLRPCServer オブジェクト" #: ../../library/xmlrpc.server.rst:396 msgid "" -"The :class:`DocXMLRPCServer` class is derived from :class:" -"`SimpleXMLRPCServer` and provides a means of creating self-documenting, " -"stand alone XML-RPC servers. HTTP POST requests are handled as XML-RPC " -"method calls. HTTP GET requests are handled by generating pydoc-style HTML " -"documentation. This allows a server to provide its own web-based " +"The :class:`DocXMLRPCServer` class is derived " +"from :class:`SimpleXMLRPCServer` and provides a means of creating self-" +"documenting, stand alone XML-RPC servers. HTTP POST requests are handled as " +"XML-RPC method calls. HTTP GET requests are handled by generating pydoc-" +"style HTML documentation. This allows a server to provide its own web-based " "documentation." msgstr "" ":class:`DocXMLRPCServer` は :class:`SimpleXMLRPCServer` の派生クラスで、自己" @@ -623,11 +709,12 @@ msgstr "DocCGIXMLRPCRequestHandler" #: ../../library/xmlrpc.server.rst:424 msgid "" -"The :class:`DocCGIXMLRPCRequestHandler` class is derived from :class:" -"`CGIXMLRPCRequestHandler` and provides a means of creating self-documenting, " -"XML-RPC CGI scripts. HTTP POST requests are handled as XML-RPC method calls. " -"HTTP GET requests are handled by generating pydoc-style HTML documentation. " -"This allows a server to provide its own web-based documentation." +"The :class:`DocCGIXMLRPCRequestHandler` class is derived " +"from :class:`CGIXMLRPCRequestHandler` and provides a means of creating self-" +"documenting, XML-RPC CGI scripts. HTTP POST requests are handled as XML-RPC " +"method calls. HTTP GET requests are handled by generating pydoc-style HTML " +"documentation. This allows a server to provide its own web-based " +"documentation." msgstr "" ":class:`DocCGIXMLRPCRequestHandler` は :class:`CGIXMLRPCRequestHandler` の派" "生クラスで、自己文書化する XML-RPC CGI スクリプトの作成手段を提供します。\n" diff --git a/library/zipapp.po b/library/zipapp.po index e80d0a859..56f2bca13 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 @@ -58,61 +58,59 @@ msgid "" "code. When run, the archive will execute the ``main`` function from the " "module ``myapp`` in the archive." msgstr "" -"実行可能なアーカイブを Python コードを含むディレクトリから作成する為に :ref:" -"`zipapp-command-line-interface` をどのように利用することができるかを以下に例" -"示します。アーカイブは実行時にアーカイブ内の ``myapp`` モジュールから " -"``main`` 関数を実行します。" +"実行可能なアーカイブを Python コードを含むディレクトリから作成する為" +"に :ref:`zipapp-command-line-interface` をどのように利用することができるかを" +"以下に例示します。アーカイブは実行時にアーカイブ内の ``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." +"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,39 +382,41 @@ 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 " -"there is a risk when overwriting a file in place that an error will result " -"in the loss of the original file. This code does not protect against such " -"errors, but production code should do so. Also, this method will only work " -"if the archive fits in memory::" +"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 there is a risk when overwriting a file in place that an error " +"will result in the loss of the original file. This code does not protect " +"against such 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..ac16a8a1a 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 @@ -89,14 +89,14 @@ msgid "" "The class for reading and writing ZIP files. See section :ref:`zipfile-" "objects` for constructor details." msgstr "" -"ZIP ファイルの読み書きのためのクラスです。コンストラクタの詳細については、:" -"ref:`zipfile-objects` 節を参照してください。" +"ZIP ファイルの読み書きのためのクラスです。コンストラクタの詳細について" +"は、:ref:`zipfile-objects` 節を参照してください。" #: ../../library/zipfile.rst:58 msgid "" -"Class that implements a subset of the interface provided by :class:`pathlib." -"Path`, including the full :class:`importlib.resources.abc.Traversable` " -"interface." +"Class that implements a subset of the interface provided " +"by :class:`pathlib.Path`, including the " +"full :class:`importlib.resources.abc.Traversable` interface." msgstr "" ":class:`pathlib.Path` インターフェースの一部を実装したクラスです。\n" ":class:`importlib.resources.abc.Traversable` インターフェースは完全に実装して" @@ -114,34 +114,36 @@ msgid "" "module will not need to create these, but only use those created by this " "module. *filename* should be the full name of the archive member, and " "*date_time* should be a tuple containing six fields which describe the time " -"of the last modification to the file; the fields are described in section :" -"ref:`zipinfo-objects`." +"of the last modification to the file; the fields are described in " +"section :ref:`zipinfo-objects`." msgstr "" "アーカイブ内の 1 個のメンバの情報を取得するために使うクラスです。このクラスの" -"インスタンスは :class:`ZipFile` オブジェクトの :meth:`.getinfo` および :meth:" -"`.infolist` メソッドによって返されます。ほとんどの :mod:`zipfile` モジュール" -"の利用者はこのクラスのインスタンスを作成する必要はなく、このモジュールによっ" -"て作成されたものを使用できます。*filename* はアーカイブメンバのフルネームでな" -"ければならず、*date_time* はファイルが最後に変更された日時を表す 6 個のフィー" -"ルドのタプルでなければなりません; フィールドは :ref:`zipinfo-objects` 節で説" -"明されています。" +"インスタンスは :class:`ZipFile` オブジェクトの :meth:`.getinfo` およ" +"び :meth:`.infolist` メソッドによって返されます。ほとんどの :mod:`zipfile` モ" +"ジュールの利用者はこのクラスのインスタンスを作成する必要はなく、このモジュー" +"ルによって作成されたものを使用できます。*filename* はアーカイブメンバのフル" +"ネームでなければならず、*date_time* はファイルが最後に変更された日時を表す 6 " +"個のフィールドのタプルでなければなりません; フィールドは :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 "" @@ -173,15 +175,15 @@ msgstr "" #: ../../library/zipfile.rst:120 msgid "" -"The numeric constant for the BZIP2 compression method. This requires the :" -"mod:`bz2` module." +"The numeric constant for the BZIP2 compression method. This requires " +"the :mod:`bz2` module." msgstr "" "BZIP2 圧縮方法を表す数値定数です。これには :mod:`bz2` モジュールが必要です。" #: ../../library/zipfile.rst:127 msgid "" -"The numeric constant for the LZMA compression method. This requires the :" -"mod:`lzma` module." +"The numeric constant for the LZMA compression method. This requires " +"the :mod:`lzma` module." msgstr "" "LZMA 圧縮方法を表す数値定数です。これには :mod:`lzma` モジュールが必要です。" @@ -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" @@ -267,11 +267,12 @@ msgstr "" msgid "" "*compression* is the ZIP compression method to use when writing the archive, " "and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` " -"or :const:`ZIP_LZMA`; unrecognized values will cause :exc:" -"`NotImplementedError` to be raised. If :const:`ZIP_DEFLATED`, :const:" -"`ZIP_BZIP2` or :const:`ZIP_LZMA` is specified but the corresponding module (:" -"mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, :exc:`RuntimeError` " -"is raised. The default is :const:`ZIP_STORED`." +"or :const:`ZIP_LZMA`; unrecognized values will " +"cause :exc:`NotImplementedError` to be raised. " +"If :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` or :const:`ZIP_LZMA` is " +"specified but the corresponding module (:mod:`zlib`, :mod:`bz2` " +"or :mod:`lzma`) is not available, :exc:`RuntimeError` is raised. The default " +"is :const:`ZIP_STORED`." msgstr "" #: ../../library/zipfile.rst:185 @@ -285,33 +286,38 @@ msgstr "" #: ../../library/zipfile.rst:190 msgid "" "The *compresslevel* parameter controls the compression level to use when " -"writing files to the archive. When using :const:`ZIP_STORED` or :const:" -"`ZIP_LZMA` it has no effect. When using :const:`ZIP_DEFLATED` integers ``0`` " -"through ``9`` are accepted (see :class:`zlib ` for more " -"information). When using :const:`ZIP_BZIP2` integers ``1`` through ``9`` are " -"accepted (see :class:`bz2 ` for more information)." +"writing files to the archive. When using :const:`ZIP_STORED` " +"or :const:`ZIP_LZMA` it has no effect. When using :const:`ZIP_DEFLATED` " +"integers ``0`` through ``9`` are accepted (see :class:`zlib " +"` for more information). When using :const:`ZIP_BZIP2` " +"integers ``1`` through ``9`` are 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 "" -"If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then :meth:" -"`closed ` without adding any files to the archive, the appropriate " -"ZIP structures for an empty archive will be written to the file." +"If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and " +"then :meth:`closed ` without adding any files to the archive, the " +"appropriate ZIP structures for an empty archive will be written to the file." msgstr "" "ファイルがモード ``'w'``、 ``'x'`` または ``'a'`` で作成され、その後そのアー" "カイブにファイルを追加することなく :meth:`クローズ ` された場合、空の" @@ -327,11 +333,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 +346,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 +354,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 +374,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 +396,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,55 +439,71 @@ 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. " "The *mode* parameter, if included, must be ``'r'`` (the default) or " -"``'w'``. *pwd* is the password used to decrypt encrypted ZIP files as a :" -"class:`bytes` object." -msgstr "" +"``'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 "" -":meth:`~ZipFile.open` is also a context manager and therefore supports the :" -"keyword:`with` statement::" +":meth:`~ZipFile.open` is also a context manager and therefore supports " +"the :keyword:`with` statement::" 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." -"IOBase.readline`, :meth:`~io.IOBase.readlines`, :meth:`~io.IOBase.seek`, :" -"meth:`~io.IOBase.tell`, :meth:`~container.__iter__`, :meth:`~iterator." -"__next__`. These objects can operate independently of the ZipFile." +"provides the following " +"methods: :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__`. " +"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`." +"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 "" @@ -579,24 +635,27 @@ msgstr "" "信頼できないソースからきた Zip ファイルを、事前に中身をチェックせずに展開して" "はいけません。ファイルを *path* の外側に作成することができるからです。例え" "ば、 ``\"/\"`` で始まる絶対パスを持ったメンバーや、 2 つのドット ``\"..\"`` " -"を持つファイル名などの場合です。このモジュールはそれを避けようとします。 :" -"meth:`extract` の注釈を参照してください。" +"を持つファイル名などの場合です。このモジュールはそれを避けようとしま" +"す。 :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." +"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 "" @@ -605,31 +664,37 @@ msgid "" "open for read or append. *pwd* is the password used for encrypted files as " "a :class:`bytes` object and, if specified, overrides the default password " "set with :meth:`setpassword`. Calling :meth:`read` on a ZipFile that uses a " -"compression method other than :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :" -"const:`ZIP_BZIP2` or :const:`ZIP_LZMA` will raise a :exc:" -"`NotImplementedError`. An error will also be raised if the corresponding " -"compression module is not available." +"compression method other " +"than :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` " +"or :const:`ZIP_LZMA` will raise a :exc:`NotImplementedError`. An error will " +"also be raised if the corresponding 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)." +"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,129 +899,136 @@ 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 "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " -"Positional and keyword arguments are passed through to :class:`io." -"TextIOWrapper` when opened as text and ignored otherwise. ``pwd`` is the " -"``pwd`` parameter to :meth:`ZipFile.open`." +"Positional and keyword arguments are passed through " +"to :class:`io.TextIOWrapper` when opened as text and ignored otherwise. " +"``pwd`` is the ``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." +"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." +"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" @@ -931,15 +1036,14 @@ msgstr "PyZipFile オブジェクト" #: ../../library/zipfile.rst:691 msgid "" -"The :class:`PyZipFile` constructor takes the same parameters as the :class:" -"`ZipFile` constructor, and one additional parameter, *optimize*." +"The :class:`PyZipFile` constructor takes the same parameters as " +"the :class:`ZipFile` constructor, and one additional parameter, *optimize*." 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 +1052,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,24 +1077,32 @@ 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 " "information). If *pathname* is a file that does not end with :file:`.py`, " "a :exc:`RuntimeError` will be raised. If it is a directory, and the " "directory is not a package directory, then all the files :file:`\\*.pyc` are " -"added at the top level. If the directory is a package directory, then all :" -"file:`\\*.pyc` are added under the package name as a file path, and if any " -"subdirectories are package directories, all of these are added recursively " -"in sorted order." -msgstr "" +"added at the top level. If the directory is a package directory, then " +"all :file:`\\*.pyc` are added under the package name as a file path, and if " +"any 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 +1112,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 +1136,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 +1143,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" @@ -1055,41 +1170,45 @@ msgid "" "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -":class:`ZipInfo` クラスのインスタンスは、:class:`ZipFile` オブジェクトの :" -"meth:`.getinfo` および :meth:`.infolist` メソッドによって返されます。各オブ" -"ジェクトは ZIP アーカイブ内の 1 個のメンバに関する情報を格納します。" +":class:`ZipInfo` クラスのインスタンスは、:class:`ZipFile` オブジェクト" +"の :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 +1218,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 +1299,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 +1311,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,46 +1370,42 @@ 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:" +"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 "" -"If you want to extract a ZIP archive into the specified directory, use the :" -"option:`-e` option:" +"If you want to extract a ZIP archive into the specified directory, use " +"the :option:`-e` option:" 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 +1427,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`." +"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..f8dc4ee48 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 @@ -35,17 +35,17 @@ msgstr "**ソースコード:** :source:`Lib/zipimport.py`" #: ../../library/zipimport.rst:13 msgid "" -"This module adds the ability to import Python modules (:file:`\\*.py`, :file:" -"`\\*.pyc`) and packages from ZIP-format archives. It is usually not needed " -"to use the :mod:`zipimport` module explicitly; it is automatically used by " -"the built-in :keyword:`import` mechanism for :data:`sys.path` items that are " -"paths to ZIP archives." +"This module adds the ability to import Python modules " +"(:file:`\\*.py`, :file:`\\*.pyc`) and packages from ZIP-format archives. It " +"is usually not needed to use the :mod:`zipimport` module explicitly; it is " +"automatically used by the built-in :keyword:`import` mechanism " +"for :data:`sys.path` items that are paths to ZIP archives." msgstr "" "このモジュールは、 Python モジュール (:file:`\\*.py`, :file:`\\*.pyc`) やパッ" -"ケージを ZIP 形式のアーカイブから import できるようにします。通常、 :mod:" -"`zipimport` を明示的に使う必要はありません; 組み込みの :keyword:`import` " -"は、 :data:`sys.path` の要素が ZIP アーカイブへのパスを指している場合にこのモ" -"ジュールを自動的に使います。" +"ケージを ZIP 形式のアーカイブから import できるようにします。通" +"常、 :mod:`zipimport` を明示的に使う必要はありません; 組み込み" +"の :keyword:`import` は、 :data:`sys.path` の要素が ZIP アーカイブへのパスを" +"指している場合にこのモジュールを自動的に使います。" #: ../../library/zipimport.rst:19 msgid "" @@ -61,30 +61,29 @@ msgstr "" "ジュールを使うと、 :data:`sys.path` の要素に ZIP ファイルアーカイブを示す文字" "列を使えるようになります。ZIP アーカイブにはサブディレクトリ構造を含めること" "ができ、パッケージの import をサポートさせたり、アーカイブ内のパスを指定して" -"サブディレクトリ下から import を行わせたりできます。例えば、 :file:`example." -"zip/lib/` のように指定すると、アーカイブ中の :file:`lib/` サブディレクトリ下" -"だけから import を行います。" +"サブディレクトリ下から import を行わせたりできます。例え" +"ば、 :file:`example.zip/lib/` のように指定すると、アーカイブ中の :file:`lib/" +"` サブディレクトリ下だけから import を行います。" #: ../../library/zipimport.rst:26 msgid "" "Any files may be present in the ZIP archive, but importers are only invoked " -"for :file:`.py` and :file:`.pyc` files. ZIP import of dynamic modules (:" -"file:`.pyd`, :file:`.so`) is disallowed. Note that if an archive only " +"for :file:`.py` and :file:`.pyc` files. ZIP import of dynamic modules " +"(:file:`.pyd`, :file:`.so`) is disallowed. Note that if an archive only " "contains :file:`.py` files, Python will not attempt to modify the archive by " "adding the corresponding :file:`.pyc` file, meaning that if a ZIP archive " "doesn't contain :file:`.pyc` files, importing may be rather slow." msgstr "" -"ZIP アーカイブ内にはどんなファイルを置いてもかまいませんが、インポートは :" -"file:`.py` および :file:`.pyc` ファイルにのみ呼び出されます。動的モジュール " -"(:file:`.pyd`, :file:`.so`) の ZIP インポートは行えません。アーカイブ内に :" -"file:`.py` ファイルしかない場合、 Python は対応する :file:`.pyc` ファイルを追" -"加してアーカイブを変更しようとはしません。つまり、 ZIP アーカイブ内に :file:" -"`.pyc` がない場合は、インポートが多少遅くなるかもしれないので注意してくださ" -"い。" - -#: ../../library/zipimport.rst:33 +"ZIP アーカイブ内にはどんなファイルを置いてもかまいませんが、インポート" +"は :file:`.py` および :file:`.pyc` ファイルにのみ呼び出されます。動的モジュー" +"ル (:file:`.pyd`, :file:`.so`) の ZIP インポートは行えません。アーカイブ内" +"に :file:`.py` ファイルしかない場合、 Python は対応する :file:`.pyc` ファイル" +"を追加してアーカイブを変更しようとはしません。つまり、 ZIP アーカイブ内" +"に :file:`.pyc` がない場合は、インポートが多少遅くなるかもしれないので注意し" +"てください。" + msgid "ZIP64 is supported" -msgstr "" +msgstr "ZIP64 をサポートしました。" #: ../../library/zipimport.rst:36 msgid "Previously, ZIP archives with an archive comment were not supported." @@ -116,8 +115,8 @@ msgstr ":pep:`273` - Zip アーカイブからモジュールをインポート msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described in :pep:" -"`302`." +"written by Just van Rossum that uses the import hooks described " +"in :pep:`302`." msgstr "" "このモジュールの実装も行った、James C. Ahlstrom による PEP です。Python 2.3 " "は :pep:`273` の仕様に従っていますが、Just van Rossum の書いた import フック" @@ -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:" @@ -138,8 +137,8 @@ msgstr "このモジュールでは例外を一つ定義しています:" #: ../../library/zipimport.rst:59 msgid "" -"Exception raised by zipimporter objects. It's a subclass of :exc:" -"`ImportError`, so it can be caught as :exc:`ImportError`, too." +"Exception raised by zipimporter objects. It's a subclass " +"of :exc:`ImportError`, so it can be caught as :exc:`ImportError`, too." msgstr "" "zipimporter オブジェクトが送出する例外です。 :exc:`ImportError` のサブクラス" "なので、 :exc:`ImportError` としても捕捉できます。" @@ -156,35 +155,38 @@ msgstr ":class:`zipimporter` は ZIP ファイルを import するためのク msgid "" "Create a new zipimporter instance. *archivepath* must be a path to a ZIP " "file, or to a specific path within a ZIP file. For example, an " -"*archivepath* of :file:`foo/bar.zip/lib` will look for modules in the :file:" -"`lib` directory inside the ZIP file :file:`foo/bar.zip` (provided that it " -"exists)." +"*archivepath* of :file:`foo/bar.zip/lib` will look for modules in " +"the :file:`lib` directory inside the ZIP file :file:`foo/bar.zip` (provided " +"that it exists)." msgstr "" "新たな zipimporter インスタンスを生成します。 *archivepath* は ZIP ファイルへ" "のパスまたは ZIP ファイル中の特定のパスへのパスでなければなりません。たとえ" -"ば、 :file:`foo/bar.zip/lib` という *archivepath* の場合、 :file:`foo/bar." -"zip` という ZIP ファイルの中の :file:`lib` ディレクトリにあるモジュールを (存" -"在するものとして) 検索します。" +"ば、 :file:`foo/bar.zip/lib` という *archivepath* の場合、 :file:`foo/" +"bar.zip` という ZIP ファイルの中の :file:`lib` ディレクトリにあるモジュール" +"を (存在するものとして) 検索します。" #: ../../library/zipimport.rst:77 msgid "" ":exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid " "ZIP archive." msgstr "" -"*archivepath* が有効な ZIP アーカイブを指していない場合、 :exc:" -"`ZipImportError` を送出します。" +"*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." +"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`." @@ -222,8 +224,8 @@ msgid "" "imported. Raise :exc:`ZipImportError` if the module couldn't be imported." msgstr "" "指定されたモジュールが import された場合、そのモジュールに設定した " -"``__file__`` の値を返します。モジュールがインポートできなかった場合、 :exc:" -"`ZipImportError` を送出します。" +"``__file__`` の値を返します。モジュールがインポートできなかった場" +"合、 :exc:`ZipImportError` を送出します。" #: ../../library/zipimport.rst:133 msgid "" @@ -237,8 +239,8 @@ msgstr "" #: ../../library/zipimport.rst:141 msgid "" -"Return ``True`` if the module specified by *fullname* is a package. Raise :" -"exc:`ZipImportError` if the module couldn't be found." +"Return ``True`` if the module specified by *fullname* is a package. " +"Raise :exc:`ZipImportError` if the module couldn't be found." msgstr "" "*fullname* で指定されたモジュールがパッケージの場合 ``True`` を返します。モ" "ジュールを見つけられない場合 :exc:`ZipImportError` を送出します。" @@ -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 "" @@ -279,12 +282,12 @@ msgstr "" #: ../../library/zipimport.rst:176 msgid "" "The :attr:`archive` and :attr:`prefix` attributes, when combined with a " -"slash, equal the original *archivepath* argument given to the :class:" -"`zipimporter` constructor." +"slash, equal the original *archivepath* argument given to " +"the :class:`zipimporter` constructor." msgstr "" -"スラッシュでつなげると、:attr:`archive` と :attr:`prefix` 属性は :class:" -"`zipimporter` コンストラクタに渡された元々の *archivepath* 引数と等しくなりま" -"す。" +"スラッシュでつなげると、:attr:`archive` と :attr:`prefix` 属性" +"は :class:`zipimporter` コンストラクタに渡された元々の *archivepath* 引数と等" +"しくなります。" #: ../../library/zipimport.rst:184 msgid "Examples" @@ -292,11 +295,11 @@ msgstr "使用例" #: ../../library/zipimport.rst:186 msgid "" -"Here is an example that imports a module from a ZIP archive - note that the :" -"mod:`zipimport` module is not explicitly used." +"Here is an example that imports a module from a ZIP archive - note that " +"the :mod:`zipimport` module is not explicitly used." msgstr "" -"モジュールを ZIP アーカイブから import する例を以下に示します - :mod:" -"`zipimport` モジュールが明示的に使われていないことに注意してください。" +"モジュールを ZIP アーカイブから import する例を以下に示します " +"- :mod:`zipimport` モジュールが明示的に使われていないことに注意してください。" #: ../../library/zipimport.rst:189 msgid "" diff --git a/library/zlib.po b/library/zlib.po index 9c0f9c16f..1c61da283 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 "" @@ -204,13 +209,13 @@ msgstr "" #: ../../library/zlib.rst:108 msgid "" -"*strategy* is used to tune the compression algorithm. Possible values are :" -"const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, :" -"const:`Z_RLE` (zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2)." +"*strategy* is used to tune the compression algorithm. Possible values " +"are :const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, :const:`Z_RLE` " +"(zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2)." msgstr "" -"*strategy* は圧縮アルゴリズムの調整に使用されます。指定可能な値は、 :const:" -"`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, :const:" -"`Z_RLE` (zlib 1.2.0.1) および :const:`Z_FIXED` (zlib 1.2.2.2) です。" +"*strategy* は圧縮アルゴリズムの調整に使用されます。指定可能な値" +"は、 :const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, :const:`Z_RLE` " +"(zlib 1.2.0.1) および :const:`Z_FIXED` (zlib 1.2.2.2) です。" #: ../../library/zlib.rst:112 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 "" @@ -350,9 +373,9 @@ msgid "" "modify its contents between the call to :func:`decompressobj` and the first " "call to the decompressor's ``decompress()`` method." msgstr "" -"*zdict* が (:class:`bytearray` のような) 変更可能オブジェクトの場合、:func:" -"`decompressobj` の呼び出しとデコンプレッサの ``decompress()`` メソッドの最初" -"の呼び出しの間に辞書の内容を変更してはいけません。" +"*zdict* が (:class:`bytearray` のような) 変更可能オブジェクトの場" +"合、:func:`decompressobj` の呼び出しとデコンプレッサの ``decompress()`` メ" +"ソッドの最初の呼び出しの間に辞書の内容を変更してはいけません。" #: ../../library/zlib.rst:204 msgid "Added the *zdict* parameter." @@ -362,41 +385,40 @@ 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 "" "All pending input is processed, and a bytes object containing the remaining " -"compressed output is returned. *mode* can be selected from the constants :" -"const:`Z_NO_FLUSH`, :const:`Z_PARTIAL_FLUSH`, :const:`Z_SYNC_FLUSH`, :const:" -"`Z_FULL_FLUSH`, :const:`Z_BLOCK` (zlib 1.2.3.4), or :const:`Z_FINISH`, " -"defaulting to :const:`Z_FINISH`. Except :const:`Z_FINISH`, all constants " -"allow compressing further bytestrings of data, while :const:`Z_FINISH` " -"finishes the compressed stream and prevents compressing any more data. " -"After calling :meth:`flush` with *mode* set to :const:`Z_FINISH`, the :meth:" -"`compress` method cannot be called again; the only realistic action is to " -"delete the object." +"compressed output is returned. *mode* can be selected from the " +"constants :const:`Z_NO_FLUSH`, :const:`Z_PARTIAL_FLUSH`, :const:`Z_SYNC_FLUSH`, :const:`Z_FULL_FLUSH`, :const:`Z_BLOCK` " +"(zlib 1.2.3.4), or :const:`Z_FINISH`, defaulting to :const:`Z_FINISH`. " +"Except :const:`Z_FINISH`, all constants allow compressing further " +"bytestrings of data, while :const:`Z_FINISH` finishes the compressed stream " +"and prevents compressing any more data. After calling :meth:`flush` with " +"*mode* set to :const:`Z_FINISH`, the :meth:`compress` method cannot be " +"called again; the only realistic action is to delete the object." msgstr "" "未処理の全入力データが処理され、この未処理部分を圧縮したデータを含むバイト列" -"オブジェクトが返されます。*mode* は定数 :const:`Z_NO_FLUSH`、:const:" -"`Z_PARTIAL_FLUSH`、:const:`Z_SYNC_FLUSH`、:const:`Z_FULL_FLUSH`、:const:" -"`Z_BLOCK` (zlib 1.2.3.4)、または :const:`Z_FINISH` のいずれかをとり、デフォル" -"ト値は :const:`Z_FINISH` です。:const:`Z_FINISH` を除く全ての定数はこれ以後に" -"もデータバイト文字列を圧縮できるモードです。一方、:const:`Z_FINISH` は圧縮ス" -"トリームを閉じ、これ以後のデータの圧縮を停止します。*mode* に :const:" -"`Z_FINISH` を指定して :meth:`flush` メソッドを呼び出した後は、:meth:" -"`compress` メソッドを再び呼ぶべきではありません。唯一の現実的な操作はこのオブ" -"ジェクトを削除することだけです。" +"オブジェクトが返されます。*mode* は定" +"数 :const:`Z_NO_FLUSH`、:const:`Z_PARTIAL_FLUSH`、:const:`Z_SYNC_FLUSH`、:const:`Z_FULL_FLUSH`、:const:`Z_BLOCK` " +"(zlib 1.2.3.4)、または :const:`Z_FINISH` のいずれかをとり、デフォルト値" +"は :const:`Z_FINISH` です。:const:`Z_FINISH` を除く全ての定数はこれ以後にも" +"データバイト文字列を圧縮できるモードです。一方、:const:`Z_FINISH` は圧縮スト" +"リームを閉じ、これ以後のデータの圧縮を停止します。*mode* " +"に :const:`Z_FINISH` を指定して :meth:`flush` メソッドを呼び出した後" +"は、:meth:`compress` メソッドを再び呼ぶべきではありません。唯一の現実的な操作" +"はこのオブジェクトを削除することだけです。" #: ../../library/zlib.rst:234 msgid "" @@ -406,11 +428,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:" @@ -430,17 +453,18 @@ msgstr "" #: ../../library/zlib.rst:256 msgid "" -"A bytes object that contains any data that was not consumed by the last :" -"meth:`decompress` call because it exceeded the limit for the uncompressed " -"data buffer. This data has not yet been seen by the zlib machinery, so you " -"must feed it (possibly with further data concatenated to it) back to a " -"subsequent :meth:`decompress` method call in order to get correct output." +"A bytes object that contains any data that was not consumed by the " +"last :meth:`decompress` call because it exceeded the limit for the " +"uncompressed data buffer. This data has not yet been seen by the zlib " +"machinery, so you must feed it (possibly with further data concatenated to " +"it) back to a subsequent :meth:`decompress` method call in order to get " +"correct output." msgstr "" -"展開されたデータを収めるバッファの長さ制限を超えたために、直近の :meth:" -"`decompress` 呼び出しで処理しきれなかったデータを含むバイト列オブジェクトで" -"す。このデータはまだ zlib 側からは見えていないので、正しい展開出力を得るには" -"以降の :meth:`decompress` メソッド呼び出しに (場合によっては後続のデータが追" -"加された) データを差し戻さなければなりません。" +"展開されたデータを収めるバッファの長さ制限を超えたために、直近" +"の :meth:`decompress` 呼び出しで処理しきれなかったデータを含むバイト列オブ" +"ジェクトです。このデータはまだ zlib 側からは見えていないので、正しい展開出力" +"を得るには以降の :meth:`decompress` メソッド呼び出しに (場合によっては後続の" +"データが追加された) データを差し戻さなければなりません。" #: ../../library/zlib.rst:265 msgid "" @@ -456,18 +480,19 @@ 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 " -"concatenated to the output produced by any preceding calls to the :meth:" -"`decompress` method. Some of the input data may be preserved in internal " -"buffers for later processing." +"concatenated to the output produced by any preceding calls to " +"the :meth:`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 "" @@ -476,8 +501,8 @@ msgid "" "compressed input can be processed; and unconsumed data will be stored in the " "attribute :attr:`unconsumed_tail`. This bytestring must be passed to a " "subsequent call to :meth:`decompress` if decompression is to continue. If " -"*max_length* is zero then the whole input is decompressed, and :attr:" -"`unconsumed_tail` is empty." +"*max_length* is zero then the whole input is decompressed, " +"and :attr:`unconsumed_tail` is empty." msgstr "" "オプションパラメータ *max_length* が非ゼロの場合、返される展開データの長さが " "*max_length* 以下に制限されます。このことは入力した圧縮データの全てが処理され" @@ -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." +"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." +"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..861b29dc2 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 @@ -56,8 +56,8 @@ msgid "" "Provides the :class:`~datetime.time` and :class:`~datetime.datetime` types " "with which the :class:`ZoneInfo` class is designed to be used." msgstr "" -":class:`ZoneInfo` クラスを使用するように設計されたデータ型 :class:`~datetime." -"time` と :class:`~datetime.datetime` を提供します。" +":class:`ZoneInfo` クラスを使用するように設計されたデータ" +"型 :class:`~datetime.time` と :class:`~datetime.datetime` を提供します。" #: ../../library/zoneinfo.rst:28 msgid "Package :pypi:`tzdata`" @@ -71,34 +71,33 @@ msgstr "" "CPythonコアデベロッパーによってメンテナンスされているファーストパーティーの" "パッケージ。タイムゾーンデータを供給し、PyPIで配布されている。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" -"`wasm-availability` を見てください。" +"このモジュールは WebAssembly では動作しないか、利用不可です。詳しく" +"は、:ref:`wasm-availability` を見てください。" #: ../../library/zoneinfo.rst:35 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``, " -"either via the constructor, the :meth:`datetime.replace ` method or :meth:`datetime.astimezone `::" +":class:`ZoneInfo` is a concrete implementation of " +"the :class:`datetime.tzinfo` abstract base class, and is intended to be " +"attached to ``tzinfo``, either via the constructor, " +"the :meth:`datetime.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\" " @@ -229,29 +243,38 @@ msgid "" "those building Python from source who know where their system time zone data " "is deployed may change the default time zone path by specifying the compile-" "time option ``TZPATH`` (or, more likely, the :option:`configure flag --with-" -"tzpath <--with-tzpath>`), which should be a string delimited by :data:`os." -"pathsep`." +"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." +"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,31 +284,40 @@ 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, " -"though it is reasonable to use it in test functions that require the use of " -"a specific time zone path (or require disabling access to the system time " -"zones)." +"The TZ search path can also be configured at runtime using " +"the :func:`reset_tzpath` function. This is generally not an advisable " +"operation, though it is reasonable to use it in test functions that require " +"the use of 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,53 +325,60 @@ 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 "" -"If no file matching ``key`` is found, the constructor will raise :exc:" -"`ZoneInfoNotFoundError`." +"If no file matching ``key`` is found, the constructor will " +"raise :exc:`ZoneInfoNotFoundError`." msgstr "" -"``key`` に一致するファイルが見つからない場合、コンストラクタは :exc:" -"`ZoneInfoNotFoundError` を送出します。" +"``key`` に一致するファイルが見つからない場合、コンストラクタ" +"は :exc:`ZoneInfoNotFoundError` を送出します。" #: ../../library/zoneinfo.rst:196 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 " +"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__`." +"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)::" +"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." +"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``." +"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`." +"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`." +"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..854077dc6 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 `." +"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." +"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/. ::" +"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,22 +1418,49 @@ 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 " -"the same name by David M. Gay, currently available from https://web.archive." -"org/web/20220517033456/http://www.netlib.org/fp/dtoa.c. The original file, " -"as retrieved on March 16, 2009, contains the following copyright and " -"licensing notice::" -msgstr "" +"the same name by David M. Gay, currently available from https://" +"web.archive.org/web/20220517033456/http://www.netlib.org/fp/dtoa.c. The " +"original file, 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,42 @@ 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 +2035,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 +2107,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 +2177,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 +2245,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 +2314,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 +2345,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 " +"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 +2406,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 +2481,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..e71d37550 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 @@ -50,10 +50,10 @@ msgstr "" msgid "" "The :keyword:`if`, :keyword:`while` and :keyword:`for` statements implement " "traditional control flow constructs. :keyword:`try` specifies exception " -"handlers and/or cleanup code for a group of statements, while the :keyword:" -"`with` statement allows the execution of initialization and finalization " -"code around a block of code. Function and class definitions are also " -"syntactically compound statements." +"handlers and/or cleanup code for a group of statements, while " +"the :keyword:`with` statement allows the execution of initialization and " +"finalization code around a block of code. Function and class definitions " +"are also syntactically compound statements." msgstr "" ":keyword:`if` 、 :keyword:`while` 、および :keyword:`for` 文は、伝統的な制御" "フロー構成を実現します。 :keyword:`try` は例外処理および/または一連の文に対す" @@ -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:" @@ -111,8 +109,8 @@ msgid "" "Note that statements always end in a ``NEWLINE`` possibly followed by a " "``DEDENT``. Also note that optional continuation clauses always begin with " "a keyword that cannot start a statement, thus there are no ambiguities (the " -"'dangling :keyword:`else`' problem is solved in Python by requiring nested :" -"keyword:`if` statements to be indented)." +"'dangling :keyword:`else`' problem is solved in Python by requiring " +"nested :keyword:`if` statements to be indented)." msgstr "" "なお、文は常に ``NEWLINE`` か、その後に ``DEDENT`` が続いたもので終了します。" "また、オプションの継続節は必ず、文を開始できない予約語で始まるので、曖昧さは" @@ -145,9 +143,9 @@ msgid "" "is executed." msgstr "" ":keyword:`if` 文は、式を一つ一つ評価してゆき、真になるまで続けて、真になった" -"節のスイートだけを選択します (真: true と偽: false の定義については、 :ref:" -"`booleans` 節を参照してください); 次に、選択したスイートを実行します (そし" -"て、 :keyword:`if` 文の他の部分は、実行や評価をされません)。全ての式が偽に" +"節のスイートだけを選択します (真: true と偽: false の定義について" +"は、 :ref:`booleans` 節を参照してください); 次に、選択したスイートを実行しま" +"す (そして、 ``if`` 文の他の部分は、実行や評価をされません)。全ての式が偽に" "なった場合、 :keyword:`else` 節があれば、そのスイートが実行されます。" #: ../../reference/compound_stmts.rst:109 @@ -168,16 +166,16 @@ 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 "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and goes back to testing the expression." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and goes back to testing the expression." msgstr "" "最初のスイート内で :keyword:`break` 文が実行されると、 :keyword:`!else` 節の" "スイートを実行することなくループを終了します。 :keyword:`continue` 文が最初の" @@ -202,19 +200,20 @@ msgid "" "The :token:`~python-grammar:starred_expression_list` expression is evaluated " "once; it should yield an :term:`iterable` object. An :term:`iterator` is " "created for that iterable. The first item provided by the iterator is then " -"assigned to the target list using the standard rules for assignments (see :" -"ref:`assignment`), and the suite is executed. This repeats for each item " -"provided by the iterator. When the iterator is exhausted, the suite in the :" -"keyword:`!else` clause, if present, is executed, and the loop terminates." +"assigned to the target list using the standard rules for assignments " +"(see :ref:`assignment`), and the suite is executed. This repeats for each " +"item provided by the iterator. When the iterator is exhausted, the suite in " +"the :keyword:`!else` clause, if present, is executed, and the loop " +"terminates." msgstr "" #: ../../reference/compound_stmts.rst:173 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and continues with the next item, or with the :keyword:`!else` clause if " -"there is no next item." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and continues with the next item, or with the :keyword:`!else` " +"clause if there is no next item." msgstr "" "最初のスイートの中で :keyword:`break` 文が実行されると、 :keyword:`!else` 節" "のスイートを実行することなくループを終了します。\n" @@ -231,7 +230,6 @@ msgstr "" "for ループはターゲットリスト内の変数への代入を行います。\n" "これにより、for ループ内も含めて、それ以前の全ての代入は上書きされます::" -#: ../../reference/compound_stmts.rst:183 msgid "" "for i in range(10):\n" " print(i)\n" @@ -239,6 +237,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 "" @@ -249,9 +252,9 @@ msgid "" "yields 0, 1, and then 2." msgstr "" "ループが終了してもターゲットリスト内の名前は削除されませんが、イテラブルが空" -"の場合には、ループでの代入は全く行われません。ヒント: 組み込み型 :func:" -"`range` は、 整数の不変算術列を表します。例えば、 ``range(3)`` を反復すると" -"0、1そして2の順に結果を返します。" +"の場合には、ループでの代入は全く行われません。ヒント: 組み込み" +"型 :func:`range` は、 整数の不変算術列を表します。例えば、 ``range(3)`` を反" +"復すると0、1そして2の順に結果を返します。" #: ../../reference/compound_stmts.rst:198 msgid "Starred elements are now allowed in the expression list." @@ -273,24 +276,26 @@ msgstr "" #: ../../reference/compound_stmts.rst:231 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information on using the :keyword:`raise` statement to " -"generate exceptions may be found in section :ref:`raise`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information on using the :keyword:`raise` " +"statement to generate exceptions may be found in section :ref:`raise`." msgstr "" -"例外に関するその他の情報は :ref:`exceptions` 節にあります。また、 :keyword:" -"`raise` 文の使用による例外の生成に関する情報は、 :ref:`raise` 節にあります。" +"例外に関するその他の情報は :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 +305,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 +324,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,30 +349,30 @@ msgid "" "the exception)." msgstr "" ":keyword:`!except` 節のヘッダにある式を値評価するときに例外が発生すると、元々" -"のハンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在" -"の :keyword:`except` 節の外側のコードや呼び出しスタックに対して行います (:" -"keyword:`try` 文全体が例外を発行したかのように扱われます)。" +"のハンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在の " +"``except`` 節の外側のコードや呼び出しスタックに対して行います " +"(:keyword:`try` 文全体が例外を発行したかのように扱われます)。" #: ../../reference/compound_stmts.rst:270 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " -"assigned to the target specified after the :keyword:`!as` keyword in that :" -"keyword:`!except` clause, if present, and the :keyword:`!except` clause's " -"suite is executed. All :keyword:`!except` clauses must have an executable " -"block. When the end of this block is reached, execution continues normally " -"after the entire :keyword:`try` statement. (This means that if two nested " -"handlers exist for the same exception, and the exception occurs in the :" -"keyword:`!try` clause of the inner handler, the outer handler will not " +"assigned to the target specified after the :keyword:`!as` keyword in " +"that :keyword:`!except` clause, if present, and the :keyword:`!except` " +"clause's suite is executed. All :keyword:`!except` clauses must have an " +"executable block. When the end of this block is reached, execution continues " +"normally after the entire :keyword:`try` statement. (This means that if two " +"nested handlers exist for the same exception, and the exception occurs in " +"the :keyword:`!try` clause of the inner handler, the outer handler will not " "handle the exception.)" msgstr "" "対応する :keyword:`!except` 節が見つかると、:keyword:`!except` 節のスイートが" "実行されます。その際、 :keyword:`!as` キーワードが :keyword:`!except` 節に存" -"在すれば、その後で指定されているターゲットに例外が代入されます。全ての :" -"keyword:`!except` 節は実行可能なブロックを持っていなければなりません。このブ" -"ロックの末尾に到達すると、通常は :keyword:`try` 文全体の直後から実行を継続し" -"ます。(このことは、ネストされた二つの例外ハンドラが同じ例外に対して存在し、内" -"側のハンドラ内の :keyword:`!try` 節で例外が発生した場合、外側のハンドラはその" -"例外を処理しないことを意味します。)" +"在すれば、その後で指定されているターゲットに例外が代入されます。全て" +"の :keyword:`!except` 節は実行可能なブロックを持っていなければなりません。こ" +"のブロックの末尾に到達すると、通常は :keyword:`try` 文全体の直後から実行を継" +"続します。(このことは、ネストされた二つの例外ハンドラが同じ例外に対して存在" +"し、内側のハンドラ内の :keyword:`!try` 節で例外が発生した場合、外側のハンドラ" +"はその例外を処理しないことを意味します。)" #: ../../reference/compound_stmts.rst:281 msgid "" @@ -363,17 +382,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 +400,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 +434,6 @@ msgstr "" "例外ハンドラを抜けると、 :mod:`sys` モジュールに格納されている例外の値が、一" "つ前の値に戻ります::" -#: ../../reference/compound_stmts.rst:311 msgid "" ">>> print(sys.exception())\n" "None\n" @@ -430,6 +453,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" @@ -437,15 +477,15 @@ msgstr ":keyword:`!except*` 節" #: ../../reference/compound_stmts.rst:338 msgid "" -"The :keyword:`!except*` clause(s) are used for handling :exc:" -"`ExceptionGroup`\\s. The exception type for matching is interpreted as in " -"the case of :keyword:`except`, but in the case of exception groups we can " -"have partial matches when the type matches some of the exceptions in the " -"group. This means that multiple :keyword:`!except*` clauses can execute, " -"each handling part of the exception group. Each clause executes at most once " -"and handles an exception group of all matching exceptions. Each exception " -"in the group is handled by at most one :keyword:`!except*` clause, the first " -"that matches it. ::" +"The :keyword:`!except*` clause(s) are used for " +"handling :exc:`ExceptionGroup`\\s. The exception type for matching is " +"interpreted as in the case of :keyword:`except`, but in the case of " +"exception groups we can have partial matches when the type matches some of " +"the exceptions in the group. This means that multiple :keyword:`!except*` " +"clauses can execute, each handling part of the exception group. Each clause " +"executes at most once and handles an exception group of all matching " +"exceptions. Each exception in the group is handled by at most " +"one :keyword:`!except*` clause, the first that matches it. ::" msgstr "" #: ../../reference/compound_stmts.rst:348 @@ -503,8 +543,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:387 msgid "" "It is not possible to mix :keyword:`except` and :keyword:`!except*` in the " -"same :keyword:`try`. :keyword:`break`, :keyword:`continue` and :keyword:" -"`return` cannot appear in an :keyword:`!except*` clause." +"same :keyword:`try`. :keyword:`break`, :keyword:`continue` " +"and :keyword:`return` cannot appear in an :keyword:`!except*` clause." msgstr "" #: ../../reference/compound_stmts.rst:402 @@ -514,10 +554,10 @@ msgstr ":keyword:`!else` 節" #: ../../reference/compound_stmts.rst:404 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " -"the :keyword:`try` suite, no exception was raised, and no :keyword:" -"`return`, :keyword:`continue`, or :keyword:`break` statement was executed. " -"Exceptions in the :keyword:`!else` clause are not handled by the preceding :" -"keyword:`except` clauses." +"the :keyword:`try` suite, no exception was raised, and " +"no :keyword:`return`, :keyword:`continue`, or :keyword:`break` statement was " +"executed. Exceptions in the :keyword:`!else` clause are not handled by the " +"preceding :keyword:`except` clauses." msgstr "" "オプションの :keyword:`!else` 節は、コントロールフローが :keyword:`try` ス" "イートを抜け、例外が送出されず、 :keyword:`return` 文、 :keyword:`continue` " @@ -531,19 +571,18 @@ msgstr ":keyword:`!finally` 節" #: ../../reference/compound_stmts.rst:418 msgid "" -"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" -"keyword:`try` clause is executed, including any :keyword:`except` and :" -"keyword:`else` clauses. If an exception occurs in any of the clauses and is " -"not handled, the exception is temporarily saved. The :keyword:`!finally` " -"clause is executed. If there is a saved exception it is re-raised at the " -"end of the :keyword:`!finally` clause. If the :keyword:`!finally` clause " -"raises another exception, the saved exception is set as the context of the " -"new exception. If the :keyword:`!finally` clause executes a :keyword:" -"`return`, :keyword:`break` or :keyword:`continue` statement, the saved " -"exception is discarded. For example, this function returns 42." +"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. " +"The :keyword:`try` clause is executed, including any :keyword:`except` " +"and :keyword:`else` clauses. If an exception occurs in any of the clauses " +"and is not handled, the exception is temporarily saved. The :keyword:`!" +"finally` clause is executed. If there is a saved exception it is re-raised " +"at the end of the :keyword:`!finally` clause. If the :keyword:`!finally` " +"clause raises another exception, the saved exception is set as the context " +"of the new exception. If the :keyword:`!finally` clause executes " +"a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " +"saved exception is discarded. For example, this function returns 42." msgstr "" -#: ../../reference/compound_stmts.rst:429 msgid "" "def f():\n" " try:\n" @@ -551,6 +590,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 +611,11 @@ msgid "" "finally` statement, the :keyword:`!finally` clause is also executed 'on the " "way out.'" msgstr "" -":keyword:`try`...\\ :keyword:`!finally` 文の :keyword:`try` スイート内で :" -"keyword:`return` 、 :keyword:`break` 、または :keyword:`continue` 文が実行さ" -"れた場合、 :keyword:`!finally` 節も、この文を '抜け出る途中に' 実行されます。" +":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 +623,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 +635,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." +"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`)." +"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" @@ -612,14 +665,14 @@ msgstr ":keyword:`!with` 文" msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " -"This allows common :keyword:`try`...\\ :keyword:`except`...\\ :keyword:" -"`finally` usage patterns to be encapsulated for convenient reuse." +"This allows common :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" ":keyword:`with` 文は、ブロックの実行を、コンテキストマネージャによって定義さ" "れたメソッドでラップするために使われます (:ref:`context-managers` セクション" -"を参照してください)。これにより、よくある :keyword:`try`...\\ :keyword:" -"`except`...\\ :keyword:`finally` 利用パターンをカプセル化して便利に再利用する" -"ことができます。" +"を参照してください)。これにより、よくある :keyword:`try`..." +"\\ :keyword:`except`...\\ :keyword:`finally` 利用パターンをカプセル化して便利" +"に再利用することができます。" #: ../../reference/compound_stmts.rst:495 msgid "" @@ -630,8 +683,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:497 msgid "" -"The context expression (the expression given in the :token:`~python-grammar:" -"with_item`) is evaluated to obtain a context manager." +"The context expression (the expression given in the :token:`~python-" +"grammar:with_item`) is evaluated to obtain a context manager." msgstr "" "コンテキスト式 (:token:`~python-grammar:with_item` で与えられた式) を評価する" "ことで、コンテキストマネージャを取得します。" @@ -659,16 +712,16 @@ msgid "" "If a target was included in the :keyword:`with` statement, the return value " "from :meth:`~object.__enter__` is assigned to it." msgstr "" -":keyword:`with` 文にターゲットが含まれていたら、それに :meth:`~object." -"__enter__` からの戻り値が代入されます。" +":keyword:`with` 文にターゲットが含まれていたら、それ" +"に :meth:`~object.__enter__` からの戻り値が代入されます。" #: ../../reference/compound_stmts.rst:511 msgid "" -"The :keyword:`with` statement guarantees that if the :meth:`~object." -"__enter__` method returns without an error, then :meth:`~object.__exit__` " -"will always be called. Thus, if an error occurs during the assignment to the " -"target list, it will be treated the same as an error occurring within the " -"suite would be. See step 7 below." +"The :keyword:`with` statement guarantees that if " +"the :meth:`~object.__enter__` method returns without an error, " +"then :meth:`~object.__exit__` will always be called. Thus, if an error " +"occurs during the assignment to the target list, it will be treated the same " +"as an error occurring within the suite would be. See step 7 below." msgstr "" ":keyword:`with` 文は、 :meth:`~object.__enter__` メソッドがエラーなく終了した" "場合には :meth:`~object.__exit__` が常に呼ばれることを保証します。ですので、" @@ -684,20 +737,20 @@ msgstr "スイートが実行されます。" msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " -"passed as arguments to :meth:`~object.__exit__`. Otherwise, three :const:" -"`None` arguments are supplied." +"passed as arguments to :meth:`~object.__exit__`. Otherwise, " +"three :const:`None` arguments are supplied." msgstr "" "コンテキストマネージャの :meth:`~object.__exit__` メソッドが呼ばれます。ス" -"イートが例外によって終了されたのなら、その例外の型、値、トレースバックが :" -"meth:`~object.__exit__` に引数として渡されます。そうでなければ、 3 つの :" -"const:`None` 引数が与えられます。" +"イートが例外によって終了されたのなら、その例外の型、値、トレースバック" +"が :meth:`~object.__exit__` に引数として渡されます。そうでなければ、 3 つ" +"の :const:`None` 引数が与えられます。" #: ../../reference/compound_stmts.rst:524 msgid "" -"If the suite was exited due to an exception, and the return value from the :" -"meth:`~object.__exit__` method was false, the exception is reraised. If the " -"return value was true, the exception is suppressed, and execution continues " -"with the statement following the :keyword:`with` statement." +"If the suite was exited due to an exception, and the return value from " +"the :meth:`~object.__exit__` method was false, the exception is reraised. " +"If the return value was true, the exception is suppressed, and execution " +"continues with the statement following the :keyword:`with` statement." msgstr "" "スイートが例外により終了され、 :meth:`~object.__exit__` メソッドからの戻り値" "が偽(false)ならば、例外が再送出されます。この戻り値が真(true)ならば例外は" @@ -709,9 +762,9 @@ msgid "" "value from :meth:`~object.__exit__` is ignored, and execution proceeds at " "the normal location for the kind of exit that was taken." msgstr "" -"もしそのスイートが例外でない何らかの理由で終了した場合、その :meth:`~object." -"__exit__` からの戻り値は無視されて、実行は発生した終了の種類に応じた通常の位" -"置から継続します。" +"もしそのスイートが例外でない何らかの理由で終了した場合、そ" +"の :meth:`~object.__exit__` からの戻り値は無視されて、実行は発生した終了の種" +"類に応じた通常の位置から継続します。" #: ../../reference/compound_stmts.rst:533 #: ../../reference/compound_stmts.rst:1550 @@ -719,11 +772,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 @@ -753,24 +807,27 @@ msgstr "" #: ../../reference/compound_stmts.rst:557 msgid "" -"With more than one item, the context managers are processed as if multiple :" -"keyword:`with` statements were nested::" +"With more than one item, the context managers are processed as if " +"multiple :keyword:`with` statements were nested::" 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 +838,6 @@ msgstr "" "できます。\n" "例::" -#: ../../reference/compound_stmts.rst:572 msgid "" "with (\n" " A() as a,\n" @@ -789,6 +845,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 +1021,6 @@ msgstr "" msgid "A sample match statement::" msgstr "簡単な match 文の例::" -#: ../../reference/compound_stmts.rst:680 msgid "" ">>> flag = False\n" ">>> match (100, 200):\n" @@ -975,6 +1035,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 "" @@ -1227,8 +1299,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:853 msgid "" -"The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" -"`standard Python grammar <./grammar>`. Triple-quoted strings are " +"The rule ``strings`` and the token ``NUMBER`` are defined in " +"the :doc:`standard Python grammar <./grammar>`. Triple-quoted strings are " "supported. Raw strings and byte strings are supported. :ref:`f-strings` " "are not supported." msgstr "" @@ -1243,8 +1315,8 @@ msgid "" "for expressing :ref:`complex numbers `; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -"``signed_number '+' NUMBER`` と ``signed_number '-' NUMBER`` という構文は :" -"ref:`複素数 ` を表現するためのものです。\n" +"``signed_number '+' NUMBER`` と ``signed_number '-' NUMBER`` という構文" +"は :ref:`複素数 ` を表現するためのものです。\n" "そのため、左側には実数、右側には虚数を書く必要があります。\n" "例: ``3 + 4j`` 。" @@ -1272,8 +1344,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:876 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " -"expresses). It is instead treated as a :token:`~python-grammar:" -"wildcard_pattern`." +"expresses). It is instead treated as a :token:`~python-" +"grammar:wildcard_pattern`." msgstr "" "アンダースコア一文字の ``_`` はキャプチャパターンではありません (``!'_'`` が" "表しているのはこの条件です) 。\n" @@ -1361,8 +1433,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:925 msgid "" -"In simple terms ``NAME1.NAME2`` will succeed only if `` == NAME1." -"NAME2``" +"In simple terms ``NAME1.NAME2`` will succeed only if `` == " +"NAME1.NAME2``" msgstr "" "簡単に言うと、 ``NAME1.NAME2`` は `` == NAME1.NAME2`` であるときのみ" "成功します。" @@ -1383,116 +1455,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 +1594,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,80 +1609,95 @@ 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 "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " -"in the mapping, and not created on-the-fly via :meth:`__missing__` or :meth:" -"`~object.__getitem__`." +"in the mapping, and not created on-the-fly via :meth:`__missing__` " +"or :meth:`~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 +1711,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`." +"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." +"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." +"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." +"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 +1853,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 +1904,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 +1938,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" @@ -1829,8 +1947,8 @@ msgstr "関数定義" #: ../../reference/compound_stmts.rst:1215 msgid "" -"A function definition defines a user-defined function object (see section :" -"ref:`types`):" +"A function definition defines a user-defined function object (see " +"section :ref:`types`):" msgstr "" "関数定義は、ユーザ定義関数オブジェクトを定義します (:ref:`types` 節参照):" @@ -1871,23 +1989,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 +2018,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." +"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 +2036,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 +2086,6 @@ msgstr "" "``None`` を使い、この値を関数本体の中で明示的にテストします。例えば以下のよう" "にします::" -#: ../../reference/compound_stmts.rst:1305 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1967,21 +2093,26 @@ 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 "" -"Function call semantics are described in more detail in section :ref:" -"`calls`. A function call always assigns values to all parameters mentioned " -"in the parameter list, either from positional arguments, from keyword " -"arguments, or from default values. If the form \"``*identifier``\" is " -"present, it is initialized to a tuple receiving any excess positional " -"parameters, defaulting to the empty tuple. If the form \"``**identifier``\" " -"is present, it is initialized to a new ordered mapping receiving any excess " -"keyword arguments, defaulting to a new empty mapping of the same type. " -"Parameters after \"``*``\" or \"``*identifier``\" are keyword-only " -"parameters and may only be passed by keyword arguments. Parameters before " -"\"``/``\" are positional-only parameters and may only be passed by " -"positional arguments." +"Function call semantics are described in more detail in " +"section :ref:`calls`. A function call always assigns values to all " +"parameters mentioned in the parameter list, either from positional " +"arguments, from keyword arguments, or from default values. If the form " +"\"``*identifier``\" is present, it is initialized to a tuple receiving any " +"excess positional parameters, defaulting to the empty tuple. If the form " +"\"``**identifier``\" is present, it is initialized to a new ordered mapping " +"receiving any excess keyword arguments, defaulting to a new empty mapping of " +"the same type. Parameters after \"``*``\" or \"``*identifier``\" are " +"keyword-only parameters and may only be passed by keyword arguments. " +"Parameters before \"``/``\" are positional-only parameters and may only be " +"passed by positional arguments." msgstr "" "関数呼び出しの意味付けに関する詳細は、 :ref:`calls` 節で述べられています。\n" "関数呼び出しを行うと、パラメタリストに記述された全てのパラメタに、位置引数、" @@ -1997,13 +2128,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,32 +2146,43 @@ 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, " "described in section :ref:`lambda`. Note that the lambda expression is " "merely a shorthand for a simplified function definition; a function defined " "in a \":keyword:`def`\" statement can be passed around or assigned to " -"another name just like a function defined by a lambda expression. The \":" -"keyword:`!def`\" form is actually more powerful since it allows the " +"another name just like a function defined by a lambda expression. The " +"\":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 +2217,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 +2234,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,32 +2265,34 @@ 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 "" -"The class's suite is then executed in a new execution frame (see :ref:" -"`naming`), using a newly created local namespace and the original global " -"namespace. (Usually, the suite contains mostly function definitions.) When " -"the class's suite finishes execution, its execution frame is discarded but " -"its local namespace is saved. [#]_ A class object is then created using the " -"inheritance list for the base classes and the saved local namespace for the " -"attribute dictionary. The class name is bound to this class object in the " -"original local namespace." +"The class's suite is then executed in a new execution frame " +"(see :ref:`naming`), using a newly created local namespace and the original " +"global namespace. (Usually, the suite contains mostly function " +"definitions.) When the class's suite finishes execution, its execution " +"frame is discarded but its local namespace is saved. [#]_ A class object is " +"then created using the inheritance list for the base classes and the saved " +"local namespace for the attribute dictionary. The class name is bound to " +"this class object in the original local namespace." msgstr "" "次にクラスのスイートが、新たな実行フレーム (:ref:`naming` を参照してくださ" "い) 内で、新たに作られたローカル名前空間と元々のグローバル名前空間を使って実" @@ -2159,13 +2302,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 +2326,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,21 +2350,29 @@ 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." +"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 " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" -"`generic-classes` for more." +"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 +2427,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 +2458,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 +2496,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 +2555,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 +2610,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::" +":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 +2641,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 +2677,52 @@ 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." +"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 +2733,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 +2752,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 +2777,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 +2810,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,43 +2830,58 @@ 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 " "liberty is taken in the translation: the syntax does not go through " -"attribute access on the :mod:`typing` module, but creates an instance of :" -"data:`typing.TypeVar` directly.)" +"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::" +"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 +2902,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 +2946,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." +"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 +2984,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 +2993,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 +3031,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 "" @@ -2817,11 +3085,10 @@ msgid "" "this is not enforced by the language, and in general annotations may contain " "arbitrary expressions. The presence of annotations does not change the " "runtime semantics of the code, except if some mechanism is used that " -"introspects and uses the annotations (such as :mod:`dataclasses` or :func:" -"`functools.singledispatch`)." +"introspects and uses the annotations (such as :mod:`dataclasses` " +"or :func:`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,29 +3096,45 @@ 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`). " -"When it is used, introspection tools like :func:`annotationlib." -"get_annotations` and :func:`typing.get_type_hints` are less likely to be " -"able to resolve annotations at runtime." +"When it is used, introspection tools " +"like :func:`annotationlib.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" @@ -2859,16 +3142,16 @@ msgstr "脚注" #: ../../reference/compound_stmts.rst:1910 msgid "" -"The exception is propagated to the invocation stack unless there is a :" -"keyword:`finally` clause which happens to raise another exception. That new " -"exception causes the old one to be lost." +"The exception is propagated to the invocation stack unless there is " +"a :keyword:`finally` clause which happens to raise another exception. That " +"new exception causes the old one to be lost." 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 +3162,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 +3189,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." +"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 +3267,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 +3321,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 +3395,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 +3413,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 +3425,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 +3434,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 +3507,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 +3581,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..7038106c0 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,27 +144,38 @@ 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 " "is garbage-collected, but since garbage collection is not guaranteed to " "happen, such objects also provide an explicit way to release the external " "resource, usually a :meth:`!close` method. Programs are strongly recommended " -"to explicitly close such objects. The :keyword:`try`...\\ :keyword:" -"`finally` statement and the :keyword:`with` statement provide convenient " -"ways to do this." -msgstr "" +"to explicitly close such objects. The :keyword:`try`..." +"\\ :keyword:`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." +"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" @@ -314,8 +348,8 @@ msgstr "" #: ../../reference/datamodel.rst:207 msgid "" -"The string representations of the numeric classes, computed by :meth:" -"`~object.__repr__` and :meth:`~object.__str__`, have the following " +"The string representations of the numeric classes, computed " +"by :meth:`~object.__repr__` and :meth:`~object.__str__`, have the following " "properties:" msgstr "" ":meth:`~object.__repr__` と :meth:`~object.__str__` から計算された数値クラス" @@ -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 "" @@ -515,19 +565,19 @@ msgid "" "The built-in function :func:`ord` converts a code point from its string form " "to an integer in the range ``0 - 10FFFF``; :func:`chr` converts an integer " "in the range ``0 - 10FFFF`` to the corresponding length ``1`` string " -"object. :meth:`str.encode` can be used to convert a :class:`str` to :class:" -"`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " -"to achieve the opposite." +"object. :meth:`str.encode` can be used to convert a :class:`str` " +"to :class:`bytes` using the given text encoding, and :meth:`bytes.decode` " +"can be used to achieve the opposite." msgstr "" "文字列はUnicodeコードポイントを表現する値の配列です。文字列中のどのコードポイ" -"ントも ``U+0000 - U+10FFFF`` の範囲で表現されることができます。Pythonは :c:" -"expr:`char` 型を持ちません。代わりに、文字列中のどのコードポイントも長さ " -"''1'' の文字列オブジェクトとして表現することができます。組み込み関数 :func:" -"`ord` は文字列形式を ``U+0000 - U+10FFFF`` の範囲の整数に変換します。また、組" -"み込み関数 :func:`chr` は ``0 - 10FFFF`` の範囲の整数を対応する長さ ``1`` の" -"文字列に変換します。:meth:`str.encode` はテキストエンコーディングを使うこと" -"で :class:`str` を :class:`bytes` に変換するために使うことができます。また、:" -"meth:`bytes.decode` によりその逆が実行することができます。" +"ントも ``U+0000 - U+10FFFF`` の範囲で表現されることができます。Python" +"は :c:expr:`char` 型を持ちません。代わりに、文字列中のどのコードポイントも長" +"さ ''1'' の文字列オブジェクトとして表現することができます。組み込み関" +"数 :func:`ord` は文字列形式を ``U+0000 - U+10FFFF`` の範囲の整数に変換しま" +"す。また、組み込み関数 :func:`chr` は ``0 - 10FFFF`` の範囲の整数を対応する長" +"さ ``1`` の文字列に変換します。:meth:`str.encode` はテキストエンコーディング" +"を使うことで :class:`str` を :class:`bytes` に変換するために使うことができま" +"す。また、:meth:`bytes.decode` によりその逆が実行することができます。" #: ../../reference/datamodel.rst:365 msgid "Tuples" @@ -558,8 +608,8 @@ msgid "" "A bytes object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " "``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " -"bytes objects. Also, bytes objects can be decoded to strings via the :meth:" -"`~bytes.decode` method." +"bytes objects. Also, bytes objects can be decoded to strings via " +"the :meth:`~bytes.decode` method." msgstr "" #: ../../reference/datamodel.rst:389 @@ -569,18 +619,19 @@ msgstr "変更可能なシーケンス型 (mutable sequence)" #: ../../reference/datamodel.rst:398 msgid "" "Mutable sequences can be changed after they are created. The subscription " -"and slicing notations can be used as the target of assignment and :keyword:" -"`del` (delete) statements." +"and slicing notations can be used as the target of assignment " +"and :keyword:`del` (delete) statements." 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:" @@ -608,8 +659,8 @@ msgstr "バイト配列" #: ../../reference/datamodel.rst:421 msgid "" -"A bytearray object is a mutable array. They are created by the built-in :" -"func:`bytearray` constructor. Aside from being mutable (and hence " +"A bytearray object is a mutable array. They are created by the built-" +"in :func:`bytearray` constructor. Aside from being mutable (and hence " "unhashable), byte arrays otherwise provide the same interface and " "functionality as immutable :class:`bytes` objects." msgstr "" @@ -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:" @@ -660,11 +710,11 @@ msgstr "集合型" #: ../../reference/datamodel.rst:452 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " -"constructor and can be modified afterwards by several methods, such as :meth:" -"`~set.add`." +"constructor and can be modified afterwards by several methods, such " +"as :meth:`~set.add`." msgstr "" -"可変な集合型です。組み込みの :func:`set` コンストラクタで作成され、後から :" -"meth:`~set.add` などのいくつかのメソッドで更新できます。" +"可変な集合型です。組み込みの :func:`set` コンストラクタで作成され、後か" +"ら :meth:`~set.add` などのいくつかのメソッドで更新できます。" #: ../../reference/datamodel.rst:457 msgid "Frozen sets" @@ -672,9 +722,10 @@ msgstr "Frozen set 型" #: ../../reference/datamodel.rst:460 msgid "" -"These represent an immutable set. They are created by the built-in :func:" -"`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " -"it can be used again as an element of another set, or as a dictionary key." +"These represent an immutable set. They are created by the built-" +"in :func:`frozenset` constructor. As a frozenset is immutable " +"and :term:`hashable`, it can be used again as an element of another set, or " +"as a dictionary key." msgstr "" "不変な集合型です。組み込みの :func:`frozenset` コンストラクタによって作成され" "ます。 frozenset は不変で :term:`ハッシュ可能 ` なので、別の集合型" @@ -707,7 +758,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 +768,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 +788,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 +803,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" @@ -768,8 +818,8 @@ msgstr "呼び出し可能型 (callable type)" #: ../../reference/datamodel.rst:528 msgid "" -"These are the types to which the function call operation (see section :ref:" -"`calls`) can be applied:" +"These are the types to which the function call operation (see " +"section :ref:`calls`) can be applied:" msgstr "関数呼び出し操作 (:ref:`calls` 参照) を行うことができる型です:" #: ../../reference/datamodel.rst:535 @@ -782,14 +832,12 @@ msgid "" "section :ref:`function`). It should be called with an argument list " "containing the same number of items as the function's formal parameter list." msgstr "" -"ユーザ定義関数オブジェクトは、関数定義を行うことで生成されます (:ref:" -"`function` 参照)。関数は、仮引数 (formal parameter) リストと同じ数の要素が" -"入った引数リストとともに呼び出されます。" +"ユーザ定義関数オブジェクトは、関数定義を行うことで生成されます " +"(:ref:`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 +849,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." +"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 +875,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 +887,19 @@ msgstr "" "関数のドキュメンテーション文字列です。ドキュメンテーションがない場合は " "``None`` になります。" -#: ../../reference/datamodel.rst:601 msgid "" -"The function's name. See also: :attr:`__name__ attributes `." +"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 +909,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 `." +"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__`." +"``'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`." +"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 `." +"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 `." +"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)." +"its :ref:`code object ` (accessible via " +"the :attr:`~function.__code__` attribute)." msgstr "" +"関数の定義に関する追加情報は、その :ref:`コードオブジェクト ` " +"(:attr:`~function.__code__` 属性でアクセス可能) から取得できます。" #: ../../reference/datamodel.rst:673 msgid "Instance methods" @@ -942,94 +1009,122 @@ 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 " +"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__ `)" +"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 "" - -#: ../../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 " -"instances, its :attr:`~method.__self__` attribute is the instance, and the " -"method object is said to be *bound*. The new method's :attr:`~method." -"__func__` attribute is the original function object." -msgstr "" +"defined :ref:`function object ` or " +"a :class:`classmethod` object." +msgstr "" +"クラスの属性を (そのクラスのインスタンスを通じて取得する場合も含めて) 取得す" +"るとき、属性がユーザー定義の :ref:`関数オブジェクト ` ま" +"たは :class:`classmethod` オブジェクトであれば、ユーザー定義メソッドオブジェ" +"クトが作成される場合があります。" + +msgid "" +"When an instance method object is created by retrieving a user-" +"defined :ref:`function object ` from a class via one of " +"its instances, its :attr:`~method.__self__` attribute is the instance, and " +"the 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." +"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." -"__self__`) in front of the argument list. For instance, when :class:`!C` is " -"a class which contains a definition for a function :meth:`!f`, and ``x`` is " -"an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." -"f(x, 1)``." +"When an instance method object is called, the underlying function " +"(:attr:`~method.__func__`) is called, inserting the class instance " +"(:attr:`~method.__self__`) in front of the argument list. For instance, " +"when :class:`!C` is a class which contains a definition for a " +"function :meth:`!f`, and ``x`` is 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 " -"actually be the class itself, so that calling either ``x.f(1)`` or ``C." -"f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " +"actually be the class itself, so that calling either ``x.f(1)`` or " +"``C.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" @@ -1037,43 +1132,42 @@ msgstr "ジェネレータ関数 (generator function)" #: ../../reference/datamodel.rst:761 msgid "" -"A function or method which uses the :keyword:`yield` statement (see section :" -"ref:`yield`) is called a :dfn:`generator function`. Such a function, when " -"called, always returns an :term:`iterator` object which can be used to " -"execute the body of the function: calling the iterator's :meth:`iterator." -"__next__` method will cause the function to execute until it provides a " -"value using the :keyword:`!yield` statement. When the function executes a :" -"keyword:`return` statement or falls off the end, a :exc:`StopIteration` " -"exception is raised and the iterator will have reached the end of the set of " -"values to be returned." -msgstr "" -":keyword:`yield` 文 (:ref:`yield` の節を参照) を使う関数もしくはメソッドは :" -"dfn:`ジェネレータ関数` と呼ばれます。\n" -"そのような関数が呼び出されたときは常に、関数の本体を実行するのに使える :term:" -"`イテレータ ` オブジェクトを返します:\n" +"A function or method which uses the :keyword:`yield` statement (see " +"section :ref:`yield`) is called a :dfn:`generator function`. Such a " +"function, when called, always returns an :term:`iterator` object which can " +"be used to execute the body of the function: calling the " +"iterator's :meth:`iterator.__next__` method will cause the function to " +"execute until it provides a value using the :keyword:`!yield` statement. " +"When the function executes a :keyword:`return` statement or falls off the " +"end, a :exc:`StopIteration` exception is raised and the iterator will have " +"reached the end of the set of values to be returned." +msgstr "" +":keyword:`yield` 文 (:ref:`yield` の節を参照) を使う関数もしくはメソッド" +"は :dfn:`ジェネレータ関数` と呼ばれます。\n" +"そのような関数が呼び出されたときは常に、関数の本体を実行するのに使え" +"る :term:`イテレータ ` オブジェクトを返します:\n" "イテレータの :meth:`iterator.__next__` メソッドを呼び出すと、 :keyword:`!" "yield` 文を使って値が提供されるまで関数を実行します。\n" -"関数の :keyword:`return` 文を実行するか終端に達したときは、 :exc:" -"`StopIteration` 例外が送出され、イテレータが返すべき値の最後まで到達していま" -"す。" +"関数の :keyword:`return` 文を実行するか終端に達したとき" +"は、 :exc:`StopIteration` 例外が送出され、イテレータが返すべき値の最後まで到" +"達しています。" #: ../../reference/datamodel.rst:773 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:" -"`coroutine` object. It may contain :keyword:`await` expressions, as well " -"as :keyword:`async with` and :keyword:`async for` statements. See also the :" -"ref:`coroutine-objects` section." +"a :dfn:`coroutine function`. Such a function, when called, returns " +"a :term:`coroutine` object. It may contain :keyword:`await` expressions, as " +"well as :keyword:`async with` and :keyword:`async for` statements. See also " +"the :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" +"コルーチン関数は :keyword:`async with` や :keyword:`async for` 文だけでな" +"く :keyword:`await` 式を持つことが出来ます。\n" ":ref:`coroutine-objects` を参照してください。" #: ../../reference/datamodel.rst:786 @@ -1095,83 +1189,104 @@ 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 " -"execute until it provides a value using the :keyword:`yield` expression. " -"When the function executes an empty :keyword:`return` statement or falls off " -"the end, a :exc:`StopAsyncIteration` exception is raised and the " -"asynchronous iterator will have reached the end of the set of values to be " -"yielded." +"Calling the asynchronous iterator's :meth:`aiterator.__anext__ " +"` method will return an :term:`awaitable` which when " +"awaited will execute until it provides a value using the :keyword:`yield` " +"expression. When the function executes an empty :keyword:`return` statement " +"or falls off the end, a :exc:`StopAsyncIteration` exception is raised and " +"the asynchronous iterator will have reached the end of the set of values to " +"be 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 " "argument. An example of a built-in method is ``alist.append()``, assuming " -"*alist* is a list object. In this case, the special read-only attribute :" -"attr:`!__self__` is set to the object denoted by *alist*. (The attribute has " -"the same semantics as it does with :attr:`other instance methods `.)" -msgstr "" +"*alist* is a list object. In this case, the special read-only " +"attribute :attr:`!__self__` is set to the object denoted by *alist*. (The " +"attribute has 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 " -"override :meth:`~object.__new__`. The arguments of the call are passed to :" -"meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " +"override :meth:`~object.__new__`. The arguments of the call are passed " +"to :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" @@ -1179,8 +1294,8 @@ msgstr "クラスのインスタンス" #: ../../reference/datamodel.rst:864 msgid "" -"Instances of arbitrary classes can be made callable by defining a :meth:" -"`~object.__call__` method in their class." +"Instances of arbitrary classes can be made callable by defining " +"a :meth:`~object.__call__` method in their class." msgstr "" "任意のクラスのインスタンスは、クラスで :meth:`~object.__call__` メソッドを定" "義することで呼び出し可能になります。" @@ -1189,34 +1304,42 @@ 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:" -"`import` statement, or by calling functions such as :func:`importlib." -"import_module` and built-in :func:`__import__`. A module object has a " -"namespace implemented by a :class:`dictionary ` object (this is the " -"dictionary referenced by the :attr:`~function.__globals__` attribute of " -"functions defined in the module). Attribute references are translated to " -"lookups in this dictionary, e.g., ``m.x`` is equivalent to ``m." -"__dict__[\"x\"]``. A module object does not contain the code object used to " -"initialize the module (since it isn't needed once the initialization is " -"done)." -msgstr "" +"the :ref:`import system ` as invoked either by " +"the :keyword:`import` statement, or by calling functions such " +"as :func:`importlib.import_module` and built-in :func:`__import__`. A " +"module object has a namespace implemented by a :class:`dictionary ` " +"object (this is the dictionary referenced by " +"the :attr:`~function.__globals__` attribute of functions defined in the " +"module). Attribute references are translated to lookups in this dictionary, " +"e.g., ``m.x`` is equivalent to ``m.__dict__[\"x\"]``. A module object does " +"not contain the code object used to 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 "" "Attribute assignment updates the module's namespace dictionary, e.g., ``m.x " "= 1`` is equivalent to ``m.__dict__[\"x\"] = 1``." msgstr "" -"属性の代入を行うと、モジュールの名前空間辞書の内容を更新します。例えば、 ``m." -"x = 1`` は ``m.__dict__[\"x\"] = 1`` と同じです。" +"属性の代入を行うと、モジュールの名前空間辞書の内容を更新します。例えば、 " +"``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 +1347,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 +1362,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 +1376,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,44 +1392,59 @@ 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 `." +"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 " -"should be set to the name of the module's package (which can be equal to :" -"attr:`module.__name__` if the module itself is a package). See :pep:`366` " -"for further details." +"should be set to the name of the module's package (which can be equal " +"to :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 +1452,61 @@ 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." +"` 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." +"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 `." +"__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 +1514,72 @@ 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." +"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__`." +"` 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__`." +"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 "" @@ -1425,18 +1611,18 @@ msgstr "" #: ../../reference/datamodel.rst:1069 msgid "" "Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " -"set. However, that scenario is quite atypical. Ultimately, the :term:" -"`loader` is what makes use of the module spec provided by the :term:`finder` " -"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " -"loader can load from a cached module but otherwise does not load from a " -"file, that atypical scenario may be appropriate." +"set. However, that scenario is quite atypical. Ultimately, " +"the :term:`loader` is what makes use of the module spec provided by " +"the :term:`finder` (from which :attr:`!__file__` and :attr:`!__cached__` are " +"derived). So if a loader can load from a cached module but otherwise does " +"not load from a file, that atypical scenario may be appropriate." msgstr "" #: ../../reference/datamodel.rst:1076 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.cached " -"` instead of :attr:`!module." -"__cached__`." +"` instead of :attr:`!" +"module.__cached__`." msgstr "" #: ../../reference/datamodel.rst:1080 @@ -1447,49 +1633,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 `." +"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`." +"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,31 +1701,47 @@ 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. " -"Class attribute references are translated to lookups in this dictionary, e." -"g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although there are a " -"number of hooks which allow for other means of locating attributes). When " -"the attribute name is not found there, the attribute search continues in the " -"base classes. This search of the base classes uses the C3 method resolution " -"order which behaves correctly even in the presence of 'diamond' inheritance " -"structures where there are multiple inheritance paths leading back to a " -"common ancestor. Additional details on the C3 MRO used by Python can be " -"found at :ref:`python_2.3_mro`." -msgstr "" +"Custom class types are typically created by class definitions (see " +"section :ref:`class`). A class has a namespace implemented by a dictionary " +"object. Class attribute references are translated to lookups in this " +"dictionary, e.g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although " +"there are a number of hooks which allow for other means of locating " +"attributes). When the attribute name is not found there, the attribute " +"search continues in the base classes. This search of the base classes uses " +"the C3 method resolution order which behaves correctly even in the presence " +"of 'diamond' inheritance structures where there are multiple inheritance " +"paths leading back to a 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 :" -"attr:`~method.__self__` attribute is :class:`!C`. When it would yield a :" -"class:`staticmethod` object, it is transformed into the object wrapped by " +"class method object, it is transformed into an instance method object " +"whose :attr:`~method.__self__` attribute is :class:`!C`. When it would yield " +"a :class:`staticmethod` object, it is transformed into the object wrapped by " "the static method object. See section :ref:`descriptors` for another way in " "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,78 +1759,92 @@ 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 `." +"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 `." +"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 "" "For best practices on working with :attr:`~object.__annotations__`, please " -"see :mod:`annotationlib`. Where possible, use :func:`annotationlib." -"get_annotations` instead of accessing this attribute directly." +"see :mod:`annotationlib`. Where possible, " +"use :func:`annotationlib.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 `." +"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 `." +"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 +1853,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 +1898,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 " @@ -1684,21 +1910,37 @@ msgid "" "\"Classes\". See section :ref:`descriptors` for another way in which " "attributes of a class retrieved via its instances may differ from the " "objects actually stored in the class's :attr:`~object.__dict__`. If no " -"class attribute is found, and the object's class has a :meth:`~object." -"__getattr__` method, that is called to satisfy the lookup." -msgstr "" +"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 "" "Attribute assignments and deletions update the instance's dictionary, never " -"a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" -"meth:`~object.__delattr__` method, this is called instead of updating the " -"instance dictionary directly." +"a class's dictionary. If the class has a :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` method, this is called instead of updating " +"the instance dictionary directly." msgstr "" "属性の代入や削除を行うと、インスタンスの辞書を更新しますが、クラスの辞書を更" -"新することはありません。クラスで :meth:`~object.__setattr__` や :meth:" -"`~object.__delattr__` メソッドが定義されている場合、直接インスタンスの辞書を" -"更新する代わりにこれらのメソッドが呼び出されます。" +"新することはありません。クラスで :meth:`~object.__setattr__` " +"や :meth:`~object.__delattr__` メソッドが定義されている場合、直接インスタンス" +"の辞書を更新する代わりにこれらのメソッドが呼び出されます。" #: ../../reference/datamodel.rst:1331 msgid "" @@ -1713,12 +1955,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)" @@ -1728,15 +1973,15 @@ msgstr "I/O オブジェクト (ファイルオブジェクトの別名)" msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " -"also :func:`os.popen`, :func:`os.fdopen`, and the :meth:`~socket.socket." -"makefile` method of socket objects (and perhaps by other functions or " -"methods provided by extension modules)." +"also :func:`os.popen`, :func:`os.fdopen`, and " +"the :meth:`~socket.socket.makefile` method of socket objects (and perhaps by " +"other functions or methods provided by extension modules)." msgstr "" ":term:`file object` は開かれたファイルを表します。ファイルオブジェクトを作る" -"ための様々なショートカットがあります: :func:`open` 組み込み関数、 :func:`os." -"popen` 、 :func:`os.fdopen` 、ソケットオブジェクトの :meth:`~socket.socket." -"makefile` メソッド (あるいは拡張モジュールから提供される他の関数やメソッ" -"ド) 。" +"ための様々なショートカットがあります: :func:`open` 組み込み関" +"数、 :func:`os.popen` 、 :func:`os.fdopen` 、ソケットオブジェクト" +"の :meth:`~socket.socket.makefile` メソッド (あるいは拡張モジュールから提供さ" +"れる他の関数やメソッド) 。" #: ../../reference/datamodel.rst:1374 msgid "" @@ -1747,8 +1992,9 @@ msgid "" msgstr "" "オブジェクト ``sys.stdin`` 、 ``sys.stdout`` および ``sys.stderr`` は、インタ" "プリタの標準入力、標準出力、および標準エラー出力ストリームに対応するファイル" -"オブジェクトに初期化されます。これらはすべてテキストモードで開かれ、 :class:" -"`io.TextIOBase` 抽象クラスによって定義されたインターフェースに従います。" +"オブジェクトに初期化されます。これらはすべてテキストモードで開か" +"れ、 :class:`io.TextIOBase` 抽象クラスによって定義されたインターフェースに従" +"います。" #: ../../reference/datamodel.rst:1382 msgid "Internal types" @@ -1770,14 +2016,15 @@ msgstr "コードオブジェクト" #: ../../reference/datamodel.rst:1400 msgid "" -"Code objects represent *byte-compiled* executable Python code, or :term:" -"`bytecode`. The difference between a code object and a function object is " -"that the function object contains an explicit reference to the function's " -"globals (the module in which it was defined), while a code object contains " -"no context; also the default argument values are stored in the function " -"object, not in the code object (because they represent values calculated at " -"run-time). Unlike function objects, code objects are immutable and contain " -"no references (directly or indirectly) to mutable objects." +"Code objects represent *byte-compiled* executable Python code, " +"or :term:`bytecode`. The difference between a code object and a function " +"object is that the function object contains an explicit reference to the " +"function's globals (the module in which it was defined), while a code object " +"contains no context; also the default argument values are stored in the " +"function object, not in the code object (because they represent values " +"calculated at run-time). Unlike function objects, code objects are " +"immutable and contain no references (directly or indirectly) to mutable " +"objects." msgstr "" "コードオブジェクトは *バイトコンパイルされた (byte-compiled)* 実行可能な " "Python コード、別名 :term:`バイトコード ` を表現します。コードオブ" @@ -1789,88 +2036,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,96 +2128,110 @@ 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 " "arbitrary number of positional arguments; bit ``0x08`` is set if the " "function uses the ``**keywords`` syntax to accept arbitrary keyword " -"arguments; bit ``0x20`` is set if the function is a generator. See :ref:" -"`inspect-module-co-flags` for details on the semantics of each flags that " -"might be present." +"arguments; bit ``0x20`` is set if the function is a generator. " +"See :ref:`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`." +"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." +"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 +2240,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`:" +"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" +"``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`." +"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\"``." +"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 `)" +"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,97 +2444,120 @@ 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 " "inserted in front of the current traceback. When an exception handler is " -"entered, the stack trace is made available to the program. (See section :ref:" -"`try`.) It is accessible as the third item of the tuple returned by :func:" -"`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " -"the caught exception." +"entered, the stack trace is made available to the program. (See " +"section :ref:`try`.) It is accessible as the third item of the tuple " +"returned by :func:`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`." +"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\"``." +"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" @@ -2262,9 +2574,9 @@ msgstr "" #: ../../reference/datamodel.rst:1818 msgid "" -"Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" -"`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " -"each is ``None`` if omitted. These attributes can have any type." +"Special read-only attributes: :attr:`~slice.start` is the lower " +"bound; :attr:`~slice.stop` is the upper bound; :attr:`~slice.step` is the " +"step value; each is ``None`` if omitted. These attributes can have any type." msgstr "" "読み出し専用の特殊属性: :attr:`~slice.start` は下限です; :attr:`~slice.stop` " "は上限です; :attr:`~slice.step` はステップの値です; それぞれ省略された場合は " @@ -2310,22 +2622,28 @@ msgstr "" "ソッドをクラスやクラスインスタンスから取得すると、実際に返されるオブジェクト" "はラップされたオブジェクトになり、それ以上は変換の対象にはなりません。静的メ" "ソッドオブジェクトは通常呼び出し可能なオブジェクトをラップしますが、静的オブ" -"ジェクト自体は呼び出し可能です。静的オブジェクトは組み込みコンストラクタ :" -"func:`staticmethod` で生成されます。" +"ジェクト自体は呼び出し可能です。静的オブジェクトは組み込みコンストラク" +"タ :func:`staticmethod` で生成されます。" #: ../../reference/datamodel.rst:1847 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 " "classes and class instances. The behaviour of class method objects upon such " "retrieval is described above, under :ref:`\"instance methods\" `. Class method objects are created by the built-in :func:" -"`classmethod` constructor." +"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" @@ -2337,30 +2655,30 @@ msgid "" "(such as arithmetic operations or subscripting and slicing) by defining " "methods with special names. This is Python's approach to :dfn:`operator " "overloading`, allowing classes to define their own behavior with respect to " -"language operators. For instance, if a class defines a method named :meth:" -"`~object.__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` " -"is roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " -"mentioned, attempts to execute an operation raise an exception when no " -"appropriate method is defined (typically :exc:`AttributeError` or :exc:" -"`TypeError`)." +"language operators. For instance, if a class defines a method " +"named :meth:`~object.__getitem__`, and ``x`` is an instance of this class, " +"then ``x[i]`` is roughly equivalent to ``type(x).__getitem__(x, i)``. " +"Except where mentioned, attempts to execute an operation raise an exception " +"when no appropriate method is defined (typically :exc:`AttributeError` " +"or :exc:`TypeError`)." msgstr "" "クラスは、特殊な名前のメソッドを定義して、特殊な構文 (算術演算や添え字表記、" "スライス表記など) による特定の演算を実装できます。これは、Python の演算子オー" "バロード (:dfn:`operator overloading`) へのアプローチです。これにより、クラス" -"は言語の演算子に対する独自の振る舞いを定義できます。例えば、あるクラスが :" -"meth:`~object.__getitem__` という名前のメソッドを定義しており、 ``x`` がこの" -"クラスのインスタンスであるとすると、 ``x[i]`` は ``type(x).__getitem__(x, " -"i)`` とほぼ等価です。特に注釈のない限り、適切なメソッドが定義されていないと" -"き、このような演算を試みると例外 (たいていは :exc:`AttributeError` か :exc:" -"`TypeError`) が送出されます。" +"は言語の演算子に対する独自の振る舞いを定義できます。例えば、あるクラス" +"が :meth:`~object.__getitem__` という名前のメソッドを定義しており、 ``x`` が" +"このクラスのインスタンスであるとすると、 ``x[i]`` は " +"``type(x).__getitem__(x, i)`` とほぼ等価です。特に注釈のない限り、適切なメ" +"ソッドが定義されていないとき、このような演算を試みると例外 (たいてい" +"は :exc:`AttributeError` か :exc:`TypeError`) が送出されます。" #: ../../reference/datamodel.rst:1876 msgid "" "Setting a special method to ``None`` indicates that the corresponding " -"operation is not available. For example, if a class sets :meth:`~object." -"__iter__` to ``None``, the class is not iterable, so calling :func:`iter` on " -"its instances will raise a :exc:`TypeError` (without falling back to :meth:" -"`~object.__getitem__`). [#]_" +"operation is not available. For example, if a class " +"sets :meth:`~object.__iter__` to ``None``, the class is not iterable, so " +"calling :func:`iter` on its instances will raise a :exc:`TypeError` (without " +"falling back to :meth:`~object.__getitem__`). [#]_" msgstr "" "特殊メソッドに ``None`` を設定することは、それに対応する演算が利用できないこ" "とを意味します。\n" @@ -2381,14 +2699,13 @@ msgstr "" "組み込み型をエミュレートするクラスを実装するときは、模範とされるオブジェクト" "にとって意味がある範囲に実装をとどめるのが重要です。例えば、あるシーケンスは" "個々の要素の取得はきちんと動くかもしれませんが、スライスの展開が意味をなさな" -"いかもしれません。 (W3C のドキュメントオブジェクトモデルにある :class:`~xml." -"dom.NodeList` インターフェースがその一例です。)" +"いかもしれません。 (W3C のドキュメントオブジェクトモデルにあ" +"る :class:`~xml.dom.NodeList` インターフェースがその一例です。)" #: ../../reference/datamodel.rst:1893 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 +2714,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 "" @@ -2411,10 +2731,10 @@ msgid "" "with appropriate arguments and then modifying the newly created instance as " "necessary before returning it." msgstr "" -"典型的な実装では、クラスの新たなインスタンスを生成するときには ``super()." -"__new__(cls[, ...])`` に適切な引数を指定してスーパクラスの :meth:`__new__` メ" -"ソッドを呼び出し、新たに生成されたインスタンスに必要な変更を加えてから返しま" -"す。" +"典型的な実装では、クラスの新たなインスタンスを生成するときには " +"``super().__new__(cls[, ...])`` に適切な引数を指定してスーパクラス" +"の :meth:`__new__` メソッドを呼び出し、新たに生成されたインスタンスに必要な変" +"更を加えてから返します。" #: ../../reference/datamodel.rst:1911 msgid "" @@ -2435,8 +2755,8 @@ msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -":meth:`__new__` が *cls* のインスタンスを返さない場合、インスタンスの :meth:" -"`__init__` メソッドは呼び出されません。" +":meth:`__new__` が *cls* のインスタンスを返さない場合、インスタンス" +"の :meth:`__init__` メソッドは呼び出されません。" #: ../../reference/datamodel.rst:1919 msgid "" @@ -2461,9 +2781,9 @@ msgstr "" "インスタンスが (:meth:`__new__` によって) 生成された後、それが呼び出し元に返" "される前に呼び出されます。引数はクラスのコンストラクタ式に渡したものです。基" "底クラスとその派生クラスがともに :meth:`__init__` メソッドを持つ場合、派生ク" -"ラスの :meth:`__init__` メソッドは基底クラスの :meth:`__init__` メソッドを明" -"示的に呼び出して、インスタンスの基底クラス部分が適切に初期化されること保証し" -"なければなりません。例えば、 ``super().__init__([args...])`` 。" +"ラスの :meth:`__init__` メソッドは基底クラスの ``__init__()`` メソッドを明示" +"的に呼び出して、インスタンスの基底クラス部分が適切に初期化されること保証しな" +"ければなりません。例えば、 ``super().__init__([args...])`` 。" #: ../../reference/datamodel.rst:1935 msgid "" @@ -2472,25 +2792,25 @@ msgid "" "it), no non-``None`` value may be returned by :meth:`__init__`; doing so " "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -":meth:`__new__` と :meth:`__init__` は連携してオブジェクトを構成する (:meth:" -"`__new__` が作成し、 :meth:`__init__` がそれをカスタマイズする) ので、 :meth:" -"`__init__` から非 ``None`` 値を返してはいけません; そうしてしまうと、実行時" -"に :exc:`TypeError` が送出されてしまいます。" +":meth:`__new__` と :meth:`__init__` は連携してオブジェクトを構成する " +"(:meth:`__new__` が作成し、 :meth:`__init__` がそれをカスタマイズする) の" +"で、 :meth:`__init__` から非 ``None`` 値を返してはいけません; そうしてしまう" +"と、実行時に :exc:`TypeError` が送出されてしまいます。" #: ../../reference/datamodel.rst:1948 msgid "" "Called when the instance is about to be destroyed. This is also called a " -"finalizer or (improperly) a destructor. If a base class has a :meth:" -"`__del__` method, the derived class's :meth:`__del__` method, if any, must " -"explicitly call it to ensure proper deletion of the base class part of the " -"instance." +"finalizer or (improperly) a destructor. If a base class has " +"a :meth:`__del__` method, the derived class's :meth:`__del__` method, if " +"any, must explicitly call it to ensure proper deletion of the base class " +"part of the instance." msgstr "" "インスタンスが破棄されるときに呼び出されます。\n" "これはファイナライザや (適切ではありませんが) デストラクタとも呼ばれます。\n" -"基底クラスが :meth:`__del__` メソッドを持っている場合は、派生クラスの :meth:" -"`__del__` メソッドは何であれ、基底クラスの :meth:`__del__` メソッドを明示的" -"に呼び出して、インスタンスの基底クラス部分をきちんと確実に削除しなければなり" -"ません。" +"基底クラスが :meth:`__del__` メソッドを持っている場合は、派生クラス" +"の :meth:`__del__` メソッドは何であれ、基底クラスの ``__del__()`` メソッドを" +"明示的に呼び出して、インスタンスの基底クラス部分をきちんと確実に削除しなけれ" +"ばなりません。" #: ../../reference/datamodel.rst:1954 msgid "" @@ -2508,13 +2828,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 +2849,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 +2858,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." @@ -2555,8 +2883,8 @@ msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " "lock or invoke any other blocking resource, it may deadlock as the resource " -"may already be taken by the code that gets interrupted to execute :meth:" -"`__del__`." +"may already be taken by the code that gets interrupted to " +"execute :meth:`__del__`." msgstr "" ":meth:`__del__` は、任意のコードが実行されているときに、任意のスレッドから呼" "び出せます。\n" @@ -2590,33 +2918,39 @@ msgid "" "like a valid Python expression that could be used to recreate an object with " "the same value (given an appropriate environment). If this is not possible, " "a string of the form ``<...some useful description...>`` should be returned. " -"The return value must be a string object. If a class defines :meth:" -"`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is also used when " -"an \"informal\" string representation of instances of that class is required." +"The return value must be a string object. If a class " +"defines :meth:`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is " +"also used when an \"informal\" string representation of instances of that " +"class is required." msgstr "" ":func:`repr` 組み込み関数によって呼び出され、オブジェクトを表す「公式の " "(official)」文字列を計算します。可能なら、これは (適切な環境が与えられれば) " "同じ値のオブジェクトを再生成するのに使える、有効な Python 式のようなものであ" "るべきです。できないなら、 ``<...some useful description...>`` 形式の文字列が" -"返されるべきです。戻り値は文字列オブジェクトでなければなりません。クラスが :" -"meth:`__repr__` を定義していて :meth:`__str__` は定義していなければ、そのクラ" -"スのインスタンスの「非公式の (informal)」文字列表現が要求されたときにも :" -"meth:`__repr__` が使われます。" +"返されるべきです。戻り値は文字列オブジェクトでなければなりません。クラス" +"が :meth:`__repr__` を定義していて :meth:`__str__` は定義していなければ、その" +"クラスのインスタンスの「非公式の (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 "" @@ -2633,15 +2967,18 @@ msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -"組み込み型 :class:`object` によって定義されたデフォルト実装は、 :meth:" -"`object.__repr__` を呼び出します。" +"組み込み型 :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." +"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,19 +3009,21 @@ 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 "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -"空でない文字列が渡された場合 ``object`` 自身の __format__ メソッドは :exc:" -"`TypeError` を送出します。" +"空でない文字列が渡された場合 ``object`` 自身の __format__ メソッド" +"は :exc:`TypeError` を送出します。" #: ../../reference/datamodel.rst:2085 msgid "" @@ -2697,18 +3036,17 @@ msgstr "" #: ../../reference/datamodel.rst:2101 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " -"between operator symbols and method names is as follows: ``xy`` calls ``x.__gt__(y)``, and ``x>=y`` " -"calls ``x.__ge__(y)``." +"between operator symbols and method names is as follows: ``xy`` calls " +"``x.__gt__(y)``, and ``x>=y`` calls ``x.__ge__(y)``." msgstr "" "これらはいわゆる \"拡張比較 (rich comparison)\" メソッドです。演算子シンボル" "とメソッド名の対応は以下の通りです: ``xy`` は ``x." -"__gt__(y)`` を呼び出します; ``x>=y`` は ``x.__ge__(y)`` を呼び出します。" +"を呼び出します; ``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,123 +3056,144 @@ 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 "" -"By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" -"data:`NotImplemented` in the case of a false comparison: ``True if x is y " -"else NotImplemented``. For :meth:`__ne__`, by default it delegates to :meth:" -"`__eq__` and inverts the result unless it is :data:`!NotImplemented`. There " -"are no other implied relationships among the comparison operators or default " -"implementations; for example, the truth of ``(x` オブジェクトを作るときの重要な注意点について、 :" -"meth:`__hash__` のドキュメント内に書かれているので参照してください。" +"ハッシュ可能 ` オブジェクトを作るときの重要な注意点につい" +"て、 :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); " -"rather, :meth:`__lt__` and :meth:`__gt__` are each other's reflection, :meth:" -"`__le__` and :meth:`__ge__` are each other's reflection, and :meth:`__eq__` " -"and :meth:`__ne__` are their own reflection. If the operands are of " -"different types, and the right operand's type is a direct or indirect " -"subclass of the left operand's type, the reflected method of the right " -"operand has priority, otherwise the left operand's method has priority. " -"Virtual subclassing is not considered." -msgstr "" - -#: ../../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 "" +"rather, :meth:`__lt__` and :meth:`__gt__` are each other's " +"reflection, :meth:`__le__` and :meth:`__ge__` are each other's reflection, " +"and :meth:`__eq__` and :meth:`__ne__` are their own reflection. If the " +"operands are of different types, and the right operand's type is a direct or " +"indirect subclass of the left operand's type, the reflected method of the " +"right 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" +"仮想サブクラスの関係は考慮されません。" + +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 "" "Called by built-in function :func:`hash` and for operations on members of " -"hashed collections including :class:`set`, :class:`frozenset`, and :class:" -"`dict`. The ``__hash__()`` method should return an integer. The only " -"required property is that objects which compare equal have the same hash " -"value; it is advised to mix together the hash values of the components of " -"the object that also play a part in comparison of objects by packing them " +"hashed collections including :class:`set`, :class:`frozenset`, " +"and :class:`dict`. The ``__hash__()`` method should return an integer. The " +"only required property is that objects which compare equal have the same " +"hash value; it is advised to mix together the hash values of the components " +"of the object that also play a part in comparison of objects by packing them " "into a tuple and hashing the tuple. Example::" msgstr "" -"組み込みの :func:`hash` 関数や、 :class:`set`, :class:`frozenset`, :class:" -"`dict` のようなハッシュを使ったコレクション型の要素に対する操作から呼び出され" -"ます。\n" +"組み込みの :func:`hash` 関数" +"や、 :class:`set`, :class:`frozenset`, :class:`dict` のようなハッシュを使った" +"コレクション型の要素に対する操作から呼び出されます。\n" "``__hash__()`` メソッドは整数を返さなければなりません。\n" "このメソッドに必要な性質は、比較結果が等しいオブジェクトは同じハッシュ値を持" "つということです;\n" "オブジェクトを比較するときでも利用される要素をタプルに詰めてハッシュ値を計算" "することで、それぞれの要素のハッシュ値を混合することをおすすめします。" -#: ../../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 "" -":func:`hash` truncates the value returned from an object's custom :meth:" -"`__hash__` method to the size of a :c:type:`Py_ssize_t`. This is typically " -"8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an object's :" -"meth:`__hash__` must interoperate on builds of different bit sizes, be sure " -"to check the width on all supported builds. An easy way to do this is with " -"``python -c \"import sys; print(sys.hash_info.width)\"``." +":func:`hash` truncates the value returned from an object's " +"custom :meth:`__hash__` method to the size of a :c:type:`Py_ssize_t`. This " +"is typically 8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an " +"object's :meth:`__hash__` must interoperate on builds of different bit " +"sizes, be sure to check the width on all supported builds. An easy way to " +"do this is with ``python -c \"import sys; print(sys.hash_info.width)\"``." msgstr "" -":func:`hash` はオブジェクト独自の :meth:`__hash__` メソッドが返す値を :c:" -"type:`Py_ssize_t` のサイズに切り詰めます。\n" +":func:`hash` はオブジェクト独自の :meth:`__hash__` メソッドが返す値" +"を :c:type:`Py_ssize_t` のサイズに切り詰めます。\n" "これは 64-bit でビルドされていると 8 バイトで、 32-bit でビルドされていると " "4 バイトです。\n" "オブジェクトの :meth:`__hash__` が異なる bit サイズのビルドでも可搬性が必要で" "ある場合は、必ず全てのサポートするビルドの bit 幅をチェックしてください。\n" -"そうする簡単な方法は ``python -c \"import sys; print(sys.hash_info." -"width)\"`` を実行することです。" +"そうする簡単な方法は ``python -c \"import sys; print(sys.hash_info.width)" +"\"`` を実行することです。" #: ../../reference/datamodel.rst:2174 msgid "" -"If a class does not define an :meth:`__eq__` method it should not define a :" -"meth:`__hash__` operation either; if it defines :meth:`__eq__` but not :meth:" -"`__hash__`, its instances will not be usable as items in hashable " -"collections. If a class defines mutable objects and implements an :meth:" -"`__eq__` method, it should not implement :meth:`__hash__`, since the " -"implementation of :term:`hashable` collections requires that a key's hash " -"value is immutable (if the object's hash value changes, it will be in the " -"wrong hash bucket)." +"If a class does not define an :meth:`__eq__` method it should not define " +"a :meth:`__hash__` operation either; if it defines :meth:`__eq__` but " +"not :meth:`__hash__`, its instances will not be usable as items in hashable " +"collections. If a class defines mutable objects and implements " +"an :meth:`__eq__` method, it should not implement :meth:`__hash__`, since " +"the implementation of :term:`hashable` collections requires that a key's " +"hash value is immutable (if the object's hash value changes, it will be in " +"the wrong hash bucket)." msgstr "" "クラスが :meth:`__eq__` メソッドを定義していないなら、 :meth:`__hash__` メ" -"ソッドも定義してはなりません; クラスが :meth:`__eq__` を定義していても :meth:" -"`__hash__` を定義していないなら、そのインスタンスはハッシュ可能コレクションの" -"要素として使えません。クラスがミュータブルなオブジェクトを定義しており、 :" -"meth:`__eq__` メソッドを実装しているなら、 :meth:`__hash__` を定義してはなり" -"ません。これは、:term:`ハッシュ可能 ` コレクションの実装において" -"キーのハッシュ値がイミュータブルであることが要求されているからです (オブジェ" -"クトのハッシュ値が変化すると、誤ったハッシュバケツ: hash bucket に入ってしま" -"います)。" +"ソッドも定義してはなりません; クラスが :meth:`__eq__` を定義していて" +"も :meth:`__hash__` を定義していないなら、そのインスタンスはハッシュ可能コレ" +"クションの要素として使えません。クラスがミュータブルなオブジェクトを定義して" +"おり、 :meth:`__eq__` メソッドを実装しているなら、 :meth:`__hash__` を定義し" +"てはなりません。これは、:term:`ハッシュ可能 ` コレクションの実装に" +"おいてキーのハッシュ値がイミュータブルであることが要求されているからです (オ" +"ブジェクトのハッシュ値が変化すると、誤ったハッシュバケツ: 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,15 +3201,20 @@ 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 "" "A class that overrides :meth:`__eq__` and does not define :meth:`__hash__` " -"will have its :meth:`__hash__` implicitly set to ``None``. When the :meth:" -"`__hash__` method of a class is ``None``, instances of the class will raise " -"an appropriate :exc:`TypeError` when a program attempts to retrieve their " -"hash value, and will also be correctly identified as unhashable when " -"checking ``isinstance(obj, collections.abc.Hashable)``." +"will have its :meth:`__hash__` implicitly set to ``None``. When " +"the :meth:`__hash__` method of a class is ``None``, instances of the class " +"will raise an appropriate :exc:`TypeError` when a program attempts to " +"retrieve their hash value, and will also be correctly identified as " +"unhashable when checking ``isinstance(obj, collections.abc.Hashable)``." msgstr "" ":meth:`__eq__` をオーバーライドしていて :meth:`__hash__` を定義していないクラ" "スでは、 :meth:`__hash__` は暗黙的に ``None`` に設定されます。\n" @@ -2873,8 +3237,8 @@ msgstr "" msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " -"class which defines its own :meth:`__hash__` that explicitly raises a :exc:" -"`TypeError` would be incorrectly identified as hashable by an " +"class which defines its own :meth:`__hash__` that explicitly raises " +"a :exc:`TypeError` would be incorrectly identified as hashable by an " "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" ":meth:`__eq__` をオーバーライドしていないクラスがハッシュサポートを抑制したい" @@ -2919,15 +3283,20 @@ 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 " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " -"is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " -"class itself), all its instances are considered true." +"is considered true if its result is nonzero. If a class defines " +"neither :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,31 +3312,47 @@ 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 " "*name* is not an instance attribute or an attribute in the class tree for " -"``self``; or :meth:`__get__` of a *name* property raises :exc:" -"`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception. The :class:" -"`object` class itself does not provide this method." -msgstr "" - -#: ../../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 :" -"meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " -"efficiency reasons and because otherwise :meth:`__getattr__` would have no " -"way to access other attributes of the instance. Note that at least for " -"instance variables, you can take total control by not inserting any values " -"in the instance attribute dictionary (but instead inserting them in another " -"object). See the :meth:`__getattribute__` method below for a way to " +"``self``; or :meth:`__get__` of a *name* property " +"raises :exc:`AttributeError`). This method should either return the " +"(computed) 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` クラス自身はこのメソッドを提供しません。" + +msgid "" +"Note that if the attribute is found through the normal " +"mechanism, :meth:`__getattr__` is not called. (This is an intentional " +"asymmetry between :meth:`__getattr__` and :meth:`__setattr__`.) This is done " +"both for efficiency reasons and because otherwise :meth:`__getattr__` would " +"have no way to access other attributes of the instance. Note that at least " +"for instance variables, you can take total control by not inserting any " +"values in the instance attribute dictionary (but instead inserting them in " +"another 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 +3364,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 "" @@ -3016,22 +3404,21 @@ msgstr "" #: ../../reference/datamodel.rst:2303 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " -"call the base class method with the same name, for example, ``object." -"__setattr__(self, name, value)``." +"call the base class method with the same name, for example, " +"``object.__setattr__(self, name, value)``." msgstr "" ":meth:`__setattr__` の中でインスタンス属性への代入が必要なら、基底クラスのこ" -"れと同じ名前のメソッドを呼び出さなければなりません。例えば、 ``object." -"__setattr__(self, name, value)`` とします。" +"れと同じ名前のメソッドを呼び出さなければなりません。例えば、 " +"``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 +3430,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" @@ -3068,26 +3455,30 @@ msgid "" "access to module attributes. The ``__getattr__`` function at the module " "level should accept one argument which is the name of an attribute and " "return the computed value or raise an :exc:`AttributeError`. If an attribute " -"is not found on a module object through the normal lookup, i.e. :meth:" -"`object.__getattribute__`, then ``__getattr__`` is searched in the module " -"``__dict__`` before raising an :exc:`AttributeError`. If found, it is called " -"with the attribute name and the result is returned." +"is not found on a module object through the normal lookup, " +"i.e. :meth:`object.__getattribute__`, then ``__getattr__`` is searched in " +"the module ``__dict__`` before raising an :exc:`AttributeError`. If found, " +"it is called with the attribute name and the result is returned." msgstr "" "特殊な名前の ``__getattr__`` と ``__dir__`` も、モジュール属性へのアクセスを" "カスタマイズするのに使えます。\n" "モジュールレベルの ``__getattr__`` 関数は属性名である 1 引数を受け取り、計算" "した値を返すか :exc:`AttributeError` を送出します。\n" -"属性がモジュールオブジェクトから、通常の検索、つまり :meth:`object." -"__getattribute__` で見付からなかった場合は、 :exc:`AttributeError` を送出する" -"前に、モジュールの ``__dict__`` から ``__getattr__`` が検索されます。\n" +"属性がモジュールオブジェクトから、通常の検索、つま" +"り :meth:`object.__getattribute__` で見付からなかった場合" +"は、 :exc:`AttributeError` を送出する前に、モジュールの ``__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 "" @@ -3096,11 +3487,10 @@ msgid "" "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" "より細かい粒度でのモジュールの動作 (属性やプロパティの設定など) のカスタマイ" -"ズのために、モジュールオブジェクトの ``__class__`` 属性に :class:`types." -"ModuleType` のサブクラスが設定できます。\n" +"ズのために、モジュールオブジェクトの ``__class__`` 属性" +"に :class:`types.ModuleType` のサブクラスが設定できます。\n" "例えば次のようになります::" -#: ../../reference/datamodel.rst:2357 msgid "" "import sys\n" "from types import ModuleType\n" @@ -3115,18 +3505,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 +3549,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 +3558,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,15 +3573,17 @@ 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 "" -"This method should return the computed attribute value or raise an :exc:" -"`AttributeError` exception." +"This method should return the computed attribute value or raise " +"an :exc:`AttributeError` exception." msgstr "" "このメソッドは、算出された属性値を返すか、 :exc:`AttributeError` 例外を送出し" "ます。" @@ -3220,13 +3628,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 +3644,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" @@ -3245,16 +3660,17 @@ msgstr "デスクリプタの呼び出し" msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " -"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, and :meth:" -"`~object.__delete__`. If any of those methods are defined for an object, it " -"is said to be a descriptor." +"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"object, it is said to be a descriptor." msgstr "" "一般にデスクリプタとは、特殊な \"束縛に関する動作 (binding behaviour)\" をも" "つオブジェクト属性のことです。デスクリプタは、デスクリプタプロトコル " -"(descriptor protocol) のメソッド: :meth:`~object.__get__`, :meth:`~object." -"__set__`, および :meth:`~object.__delete__` を使って、属性アクセスをオーバー" -"ライドしているものです。これらのメソッドのいずれかがオブジェクトに対して定義" -"されている場合、オブジェクトはデスクリプタであるといいます。" +"(descriptor protocol) のメソッ" +"ド: :meth:`~object.__get__`, :meth:`~object.__set__`, およ" +"び :meth:`~object.__delete__` を使って、属性アクセスをオーバーライドしている" +"ものです。これらのメソッドのいずれかがオブジェクトに対して定義されている場" +"合、オブジェクトはデスクリプタであるといいます。" #: ../../reference/datamodel.rst:2456 msgid "" @@ -3312,8 +3728,8 @@ msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -"オブジェクトインスタンスへ束縛すると、``a.x`` は呼び出し ``type(a)." -"__dict__['x'].__get__(a, type(a))`` に変換されます。" +"オブジェクトインスタンスへ束縛すると、``a.x`` は呼び出し " +"``type(a).__dict__['x'].__get__(a, type(a))`` に変換されます。" #: ../../reference/datamodel.rst:2477 msgid "Class Binding" @@ -3321,8 +3737,8 @@ msgstr "クラス束縛 (Class Binding)" #: ../../reference/datamodel.rst:2478 msgid "" -"If binding to a class, ``A.x`` is transformed into the call: ``A." -"__dict__['x'].__get__(None, A)``." +"If binding to a class, ``A.x`` is transformed into the call: " +"``A.__dict__['x'].__get__(None, A)``." msgstr "" "クラスへ束縛すると、``A.x`` は呼び出し ``A.__dict__['x'].__get__(None, A)`` " "に変換されます。" @@ -3331,24 +3747,23 @@ 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." +"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 " -"combination of :meth:`~object.__get__`, :meth:`~object.__set__` and :meth:" -"`~object.__delete__`. If it does not define :meth:`!__get__`, then " -"accessing the attribute will return the descriptor object itself unless " +"combination of :meth:`~object.__get__`, :meth:`~object.__set__` " +"and :meth:`~object.__delete__`. If it does not define :meth:`!__get__`, " +"then accessing the attribute will return the descriptor object itself unless " "there is a value in the object's instance dictionary. If the descriptor " "defines :meth:`!__set__` and/or :meth:`!__delete__`, it is a data " "descriptor; if it defines neither, it is a non-data descriptor. Normally, " @@ -3359,6 +3774,20 @@ 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 "" @@ -3393,8 +3822,8 @@ msgid "" "explicitly declared in *__slots__* or available in a parent.)" msgstr "" "*__slots__* を使うと、(プロパティのように) データメンバを明示的に宣言し、 (明" -"示的に *__slots__* で宣言しているか親クラスに存在しているかでない限り) :attr:" -"`~object.__dict__` や *__weakref__* を作成しないようにできます。" +"示的に *__slots__* で宣言しているか親クラスに存在しているかでない限" +"り) :attr:`~object.__dict__` や *__weakref__* を作成しないようにできます。" #: ../../reference/datamodel.rst:2553 msgid "" @@ -3409,26 +3838,25 @@ msgstr "" msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " -"for the declared variables and prevents the automatic creation of :attr:" -"`~object.__dict__` and *__weakref__* for each instance." +"for the declared variables and prevents the automatic creation " +"of :attr:`~object.__dict__` and *__weakref__* for each instance." msgstr "" "このクラス変数には、インスタンスが用いる変数名を表す、文字列、イテラブル、ま" "たは文字列のシーケンスを代入できます。*__slots__* は、各インスタンスに対して" "宣言された変数に必要な記憶領域を確保し、:attr:`~object.__dict__` と " "*__weakref__* が自動的に生成されないようにします。" -#: ../../reference/datamodel.rst:2567 msgid "Notes on using *__slots__*:" -msgstr "" +msgstr "*__slots__* を使う際の注意点。" #: ../../reference/datamodel.rst:2569 msgid "" -"When inheriting from a class without *__slots__*, the :attr:`~object." -"__dict__` and *__weakref__* attribute of the instances will always be " -"accessible." +"When inheriting from a class without *__slots__*, " +"the :attr:`~object.__dict__` and *__weakref__* attribute of the instances " +"will always be accessible." msgstr "" -"*__slots__* を持たないクラスから継承するとき、インスタンスの :attr:`~object." -"__dict__` 属性と *__weakref__* 属性は常に利用可能です。" +"*__slots__* を持たないクラスから継承するとき、インスタンス" +"の :attr:`~object.__dict__` 属性と *__weakref__* 属性は常に利用可能です。" #: ../../reference/datamodel.rst:2573 msgid "" @@ -3468,7 +3896,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 +3903,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 "" @@ -3495,27 +3928,33 @@ msgstr "" msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " -"` such as :class:`int`, :class:`bytes`, and :class:" -"`tuple`." +"` such as :class:`int`, :class:`bytes`, " +"and :class:`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`." +"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 "" @@ -3545,19 +3984,20 @@ msgstr "クラス生成をカスタマイズする" #: ../../reference/datamodel.rst:2634 msgid "" -"Whenever a class inherits from another class, :meth:`~object." -"__init_subclass__` is called on the parent class. This way, it is possible " -"to write classes which change the behavior of subclasses. This is closely " -"related to class decorators, but where class decorators only affect the " -"specific class they're applied to, ``__init_subclass__`` solely applies to " -"future subclasses of the class defining the method." -msgstr "" -"クラスが他のクラスを継承するときに必ず、親クラスの :meth:`~object." -"__init_subclass__` が呼び出されます。これを利用すると、サブクラスの挙動を変更" -"するクラスを書くことができます。これは、クラスデコレータととても良く似ていま" -"すが、クラスデコレータが、それが適用された特定のクラスにのみに影響するのに対" -"して、 ``__init_subclass__`` は、もっぱら、このメソッドを定義したクラスの将来" -"のサブクラスに適用されます。" +"Whenever a class inherits from another " +"class, :meth:`~object.__init_subclass__` is called on the parent class. This " +"way, it is possible to write classes which change the behavior of " +"subclasses. This is closely related to class decorators, but where class " +"decorators only affect the specific class they're applied to, " +"``__init_subclass__`` solely applies to future subclasses of the class " +"defining the method." +msgstr "" +"クラスが他のクラスを継承するときに必ず、親クラス" +"の :meth:`~object.__init_subclass__` が呼び出されます。これを利用すると、サブ" +"クラスの挙動を変更するクラスを書くことができます。これは、クラスデコレータと" +"とても良く似ていますが、クラスデコレータが、それが適用された特定のクラスにの" +"みに影響するのに対して、 ``__init_subclass__`` は、もっぱら、このメソッドを定" +"義したクラスの将来のサブクラスに適用されます。" #: ../../reference/datamodel.rst:2643 msgid "" @@ -3569,15 +4009,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 +4030,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 +4064,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::" +"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 +4095,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 +4133,6 @@ msgstr "" "次の例で ``MyClass`` と ``MySubclass`` は両方とも ``Meta`` のインスタンスで" "す::" -#: ../../reference/datamodel.rst:2720 msgid "" "class Meta(type):\n" " pass\n" @@ -3687,6 +4143,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,43 +4188,46 @@ 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 " -"an :meth:`!__mro_entries__` method is found, the base is substituted with " -"the result of a call to :meth:`!__mro_entries__` when creating the class. " -"The method is called with the original bases tuple passed to the *bases* " -"parameter, and must return a tuple of classes that will be used instead of " -"the base. The returned tuple may be empty: in these cases, the original base " -"is ignored." -msgstr "" +"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 an :meth:`!__mro_entries__` method is found, the base is " +"substituted with the result of a call to :meth:`!__mro_entries__` when " +"creating the class. The method is called with the original bases tuple " +"passed to the *bases* parameter, and must return a tuple of classes that " +"will be used instead of 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__`." +"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" @@ -3779,8 +4246,8 @@ msgstr "" #: ../../reference/datamodel.rst:2776 msgid "" -"if an explicit metaclass is given and it is *not* an instance of :func:" -"`type`, then it is used directly as the metaclass;" +"if an explicit metaclass is given and it is *not* an instance " +"of :func:`type`, then it is used directly as the metaclass;" msgstr "" "明示的なメタクラスが与えられていて、それが :func:`type` のインスタンス *では" "ない* 場合、それをメタクラスとして直接使います;" @@ -3812,7 +4279,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 +4289,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 "" @@ -3898,20 +4365,19 @@ msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " "created by the compiler if any methods in a class body refer to either " -"``__class__`` or ``super``. This allows the zero argument form of :func:" -"`super` to correctly identify the class being defined based on lexical " -"scoping, while the class or instance that was used to make the current call " -"is identified based on the first argument passed to the method." +"``__class__`` or ``super``. This allows the zero argument form " +"of :func:`super` to correctly identify the class being defined based on " +"lexical scoping, while the class or instance that was used to make the " +"current call is identified based on the first argument passed to the method." msgstr "" "このクラスオブジェクトは、 :func:`super` の無引数形式によって参照されるもので" "す。 ``__class__`` は、クラス本体中のメソッドが ``__class__`` または " "``super`` のいずれかを参照している場合に、コンパイラによって作成される暗黙の" "クロージャー参照です。これは、メソッドに渡された最初の引数に基づいて現在の呼" -"び出しを行うために使用されるクラスまたはインスタンスが識別される一方、 :func:" -"`super` の無引数形式がレキシカルスコープに基づいて定義されているクラスを正確" -"に識別することを可能にします。" +"び出しを行うために使用されるクラスまたはインスタンスが識別される一" +"方、 :func:`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 +4385,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,29 +4401,27 @@ 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 "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -"新しいクラスのメソッド解決順序ですぐ上に位置する親クラスで :meth:`~object." -"__init_subclass__` フックが呼び出されます。" +"新しいクラスのメソッド解決順序ですぐ上に位置する親クラス" +"で :meth:`~object.__init_subclass__` フックが呼び出されます。" #: ../../reference/datamodel.rst:2874 msgid "" @@ -3969,13 +4433,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,14 +4469,13 @@ msgstr "" "動プロパティ生成、プロキシ、フレームワーク、そして自動リソースロック/同期と" "いったものがあります。" -#: ../../reference/datamodel.rst:2899 msgid "Customizing instance and subclass checks" -msgstr "インスタンスのカスタマイズとサブクラスチェック" +msgstr "インスタンス判定とサブクラス判定のカスタマイズ" #: ../../reference/datamodel.rst:2901 msgid "" -"The following methods are used to override the default behavior of the :func:" -"`isinstance` and :func:`issubclass` built-in functions." +"The following methods are used to override the default behavior of " +"the :func:`isinstance` and :func:`issubclass` built-in functions." msgstr "" "以下のメソッドは組み込み関数 :func:`isinstance` と :func:`issubclass` のデ" "フォルトの動作を上書きするのに利用します。" @@ -4044,64 +4511,69 @@ 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:" -"`~type.__subclasscheck__`, with motivation for this functionality in the " -"context of adding Abstract Base Classes (see the :mod:`abc` module) to the " -"language." +"Includes the specification for customizing :func:`isinstance` " +"and :func:`issubclass` behavior through :meth:`~type.__instancecheck__` " +"and :meth:`~type.__subclasscheck__`, with motivation for this functionality " +"in the 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`" +":ref:`Generics`, :ref:`user-defined generics` " +"and :class:`typing.Generic`" msgstr "" +":ref:`Generics`、:ref:`ユーザー定義ジェネリック型 `、:class:`typing.Generic`" #: ../../reference/datamodel.rst:2955 msgid "" @@ -4111,11 +4583,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 "" @@ -4128,43 +4601,50 @@ msgstr "" #: ../../reference/datamodel.rst:2966 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " -"method. As such, there is no need for it to be decorated with :func:" -"`@classmethod` when it is defined." +"method. As such, there is no need for it to be decorated " +"with :func:`@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 " -"standard library class that already implements :meth:`~object." -"__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " -"own implementation of ``__class_getitem__()``." +"standard library class that already " +"implements :meth:`~object.__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 +4653,24 @@ 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::" +"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,18 +4695,44 @@ 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 " -"the :class:`type` class as their metaclass. :class:`type` does not define :" -"meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``, " -"``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." -"__class_getitem__` being called::" +"the :class:`type` class as their metaclass. :class:`type` does not " +"define :meth:`~object.__getitem__`, meaning that expressions such as " +"``list[int]``, ``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 +4746,27 @@ 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::" +"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 +4793,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__`" +"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" @@ -4290,65 +4824,79 @@ msgstr "コンテナをエミュレートする" msgid "" "The following methods can be defined to implement container objects. None of " "them are provided by the :class:`object` class itself. Containers usually " -"are :term:`sequences ` (such as :class:`lists ` or :class:" -"`tuples `) or :term:`mappings ` (like :term:`dictionaries " -"`), but can represent other containers as well. The first set " -"of methods is used either to emulate a sequence or to emulate a mapping; the " -"difference is that for a sequence, the allowable keys should be the integers " -"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" -"class:`slice` objects, which define a range of items. It is also " -"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" -"values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" -"meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " -"similar to those for Python's standard :class:`dictionary ` objects. " -"The :mod:`collections.abc` module provides a :class:`~collections.abc." -"MutableMapping` :term:`abstract base class` to help create those methods " -"from a base set of :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. Mutable " -"sequences should provide methods :meth:`!append`, :meth:`!count`, :meth:`!" -"index`, :meth:`!extend`, :meth:`!insert`, :meth:`!pop`, :meth:`!remove`, :" -"meth:`!reverse` and :meth:`!sort`, like Python standard :class:`list` " -"objects. Finally, sequence types should implement addition (meaning " -"concatenation) and multiplication (meaning repetition) by defining the " -"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object." -"__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:" -"`~object.__imul__` described below; they should not define other numerical " -"operators. It is recommended that both mappings and sequences implement " -"the :meth:`~object.__contains__` method to allow efficient use of the ``in`` " -"operator; for mappings, ``in`` should search the mapping's keys; for " -"sequences, it should search through the values. It is further recommended " -"that both mappings and sequences implement the :meth:`~object.__iter__` " -"method to allow efficient iteration through the container; for mappings, :" -"meth:`!__iter__` should iterate through the object's keys; for sequences, it " -"should iterate through the values." -msgstr "" - -#: ../../reference/datamodel.rst:3141 +"are :term:`sequences ` (such as :class:`lists ` " +"or :class:`tuples `) or :term:`mappings ` " +"(like :term:`dictionaries `), but can represent other containers " +"as well. The first set of methods is used either to emulate a sequence or " +"to emulate a mapping; the difference is that for a sequence, the allowable " +"keys should be the integers *k* for which ``0 <= k < N`` where *N* is the " +"length of the sequence, or :class:`slice` objects, which define a range of " +"items. It is also recommended that mappings provide the methods :meth:`!" +"keys`, :meth:`!values`, :meth:`!items`, :meth:`!get`, :meth:`!" +"clear`, :meth:`!setdefault`, :meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, " +"and :meth:`!update` behaving similar to those for Python's " +"standard :class:`dictionary ` objects. The :mod:`collections.abc` " +"module provides a :class:`~collections.abc.MutableMapping` :term:`abstract " +"base class` to help create those methods from a base set " +"of :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. Mutable sequences should provide methods :meth:`!" +"append`, :meth:`!count`, :meth:`!index`, :meth:`!extend`, :meth:`!" +"insert`, :meth:`!pop`, :meth:`!remove`, :meth:`!reverse` and :meth:`!sort`, " +"like Python standard :class:`list` objects. Finally, sequence types should " +"implement addition (meaning concatenation) and multiplication (meaning " +"repetition) by defining the " +"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` " +"and :meth:`~object.__imul__` described below; they should not define other " +"numerical operators. It is recommended that both mappings and sequences " +"implement the :meth:`~object.__contains__` method to allow efficient use of " +"the ``in`` operator; for mappings, ``in`` should search the mapping's keys; " +"for sequences, it should search through the values. It is further " +"recommended that both mappings and sequences implement " +"the :meth:`~object.__iter__` method to allow efficient iteration through the " +"container; for mappings, :meth:`!__iter__` should iterate through the " +"object's keys; for sequences, it should iterate through the values." +msgstr "" + 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:" -"`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" -"OverflowError` by truth value testing, an object must define a :meth:" -"`~object.__bool__` method." +"length is larger than :data:`!sys.maxsize` some features (such " +"as :func:`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" +"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). " -"The length must be an integer ``>=`` 0. The return value may also be :data:" -"`NotImplemented`, which is treated the same as if the ``__length_hint__`` " -"method didn't exist at all. This method is purely an optimization and is " -"never required for correctness." -msgstr "" +"The length must be an integer ``>=`` 0. The return value may also " +"be :data:`NotImplemented`, which is treated the same as if the " +"``__length_hint__`` 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 +4905,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``." @@ -4376,13 +4922,13 @@ msgstr "以下も同様です。存在しないスライスの要素は ``None`` #: ../../reference/datamodel.rst:3184 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " -"the accepted keys should be integers. Optionally, they may support :class:" -"`slice` objects as well. Negative index support is also optional. If *key* " -"is of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a " -"value outside the set of indexes for the sequence (after any special " -"interpretation of negative values), :exc:`IndexError` should be raised. For :" -"term:`mapping` types, if *key* is missing (not in the container), :exc:" -"`KeyError` should be raised." +"the accepted keys should be integers. Optionally, they may " +"support :class:`slice` objects as well. Negative index support is also " +"optional. If *key* is of an inappropriate type, :exc:`TypeError` may be " +"raised; if *key* is a value outside the set of indexes for the sequence " +"(after any special interpretation of negative values), :exc:`IndexError` " +"should be raised. For :term:`mapping` types, if *key* is missing (not in the " +"container), :exc:`KeyError` should be raised." msgstr "" #: ../../reference/datamodel.rst:3196 @@ -4396,33 +4942,34 @@ msgstr "" #: ../../reference/datamodel.rst:3201 msgid "" -"When :ref:`subscripting` a *class*, the special class method :" -"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " -"See :ref:`classgetitem-versus-getitem` for more details." +"When :ref:`subscripting` a *class*, the special class " +"method :meth:`~object.__class_getitem__` may be called instead of " +"``__getitem__()``. See :ref:`classgetitem-versus-getitem` for more details." msgstr "" #: ../../reference/datamodel.rst:3209 msgid "" -"Called to implement assignment to ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support changes to the values for keys, or if new keys can be added, or for " -"sequences if elements can be replaced. The same exceptions should be raised " -"for improper *key* values as for the :meth:`__getitem__` method." -msgstr "" -"``self[key]`` に対する代入を実装するために呼び出されます。 :meth:" -"`__getitem__` と同じ注意事項があてはまります。このメソッドを実装できるのは、" -"あるキーに対する値の変更をサポートしているか、新たなキーを追加できるような" -"マップの場合と、ある要素を置き換えることができるシーケンスの場合だけです。不" -"正な *key* に対しては、 :meth:`__getitem__` メソッドと同様の例外の送出を行わ" -"なければなりません。" +"Called to implement assignment to ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support changes to the values for keys, or if new keys can be " +"added, or for sequences if elements can be replaced. The same exceptions " +"should be raised for improper *key* values as for the :meth:`__getitem__` " +"method." +msgstr "" +"``self[key]`` に対する代入を実装するために呼び出されま" +"す。 :meth:`__getitem__` と同じ注意事項があてはまります。このメソッドを実装で" +"きるのは、あるキーに対する値の変更をサポートしているか、新たなキーを追加でき" +"るようなマップの場合と、ある要素を置き換えることができるシーケンスの場合だけ" +"です。不正な *key* に対しては、 :meth:`__getitem__` メソッドと同様の例外の送" +"出を行わなければなりません。" #: ../../reference/datamodel.rst:3218 msgid "" -"Called to implement deletion of ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support removal of keys, or for sequences if elements can be removed from " -"the sequence. The same exceptions should be raised for improper *key* " -"values as for the :meth:`__getitem__` method." +"Called to implement deletion of ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support removal of keys, or for sequences if elements can be " +"removed from the sequence. The same exceptions should be raised for " +"improper *key* values as for the :meth:`__getitem__` method." msgstr "" "``self[key]`` の削除を実装するために呼び出されます。 :meth:`__getitem__` と同" "じ注意事項があてはまります。このメソッドを実装できるのは、キーの削除をサポー" @@ -4464,16 +5011,16 @@ msgstr "" #: ../../reference/datamodel.rst:3245 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " -"built-in will fall back to using the sequence protocol (:meth:`__len__` and :" -"meth:`__getitem__`). Objects that support the sequence protocol should only " -"provide :meth:`__reversed__` if they can provide an implementation that is " -"more efficient than the one provided by :func:`reversed`." +"built-in will fall back to using the sequence protocol (:meth:`__len__` " +"and :meth:`__getitem__`). Objects that support the sequence protocol should " +"only provide :meth:`__reversed__` if they can provide an implementation that " +"is more efficient than the one provided by :func:`reversed`." msgstr "" ":meth:`__reversed__` メソッドが定義されていない場合、 :func:`reversed` 組込み" "関数は sequence プロトコル (:meth:`__len__` と :meth:`__getitem__`) を使った" "方法にフォールバックします。 sequence プロトコルをサポートしたオブジェクト" -"は、 :func:`reversed` よりも効率のいい実装を提供できる場合にのみ :meth:" -"`__reversed__` を定義するべきです。" +"は、 :func:`reversed` よりも効率のいい実装を提供できる場合にの" +"み :meth:`__reversed__` を定義するべきです。" #: ../../reference/datamodel.rst:3252 msgid "" @@ -4526,55 +5073,78 @@ msgstr "" "(非整数の数値に対するビット単位演算など) は、未定義のままにしておかなければな" "りません。" -#: ../../reference/datamodel.rst:3300 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For instance, to " -"evaluate the expression ``x + y``, where *x* is an instance of a class that " -"has an :meth:`__add__` method, ``type(x).__add__(x, y)`` is called. The :" -"meth:`__divmod__` method should be the equivalent to using :meth:" -"`__floordiv__` and :meth:`__mod__`; it should not be related to :meth:" -"`__truediv__`. Note that :meth:`__pow__` 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:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``). For instance, to evaluate the expression ``x + y``, where *x* is an " +"instance of a class that has an :meth:`__add__` method, ``type(x).__add__(x, " +"y)`` is called. The :meth:`__divmod__` method should be the equivalent to " +"using :meth:`__floordiv__` and :meth:`__mod__`; it should not be related " +"to :meth:`__truediv__`. Note that :meth:`__pow__` 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:`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:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with reflected (swapped) " -"operands. These functions are only called if the operands are of different " -"types, when the left operand does not support the corresponding operation " -"[#]_, or the right operand's class is derived from the left operand's class. " -"[#]_ For instance, to evaluate the expression ``x - y``, where *y* is an " -"instance of a class that has an :meth:`__rsub__` method, ``type(y)." -"__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`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``) with reflected (swapped) operands. These functions are only called if " +"the operands are of different types, when the left operand does not support " +"the corresponding operation [#]_, or the right operand's class is derived " +"from the left operand's class. [#]_ For instance, to evaluate the expression " +"``x - y``, where *y* is an instance of a class that has an :meth:`__rsub__` " +"method, ``type(y).__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 +5152,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 " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -4596,27 +5165,41 @@ msgid "" "but does not have to be, *self*). If a specific method is not defined, or " "if that method returns :data:`NotImplemented`, the augmented assignment " "falls back to the normal methods. For instance, if *x* is an instance of a " -"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = x." -"__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if ``x.__iadd__(y)`` " -"returns :data:`!NotImplemented`, ``x.__add__(y)`` and ``y.__radd__(x)`` are " -"considered, as with the evaluation of ``x + y``. In certain situations, " -"augmented assignment can result in unexpected errors (see :ref:`faq-" -"augmented-assignment-tuple-error`), but this behavior is in fact part of the " -"data model." -msgstr "" +"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = " +"x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if " +"``x.__iadd__(y)`` returns :data:`!NotImplemented`, ``x.__add__(y)`` and " +"``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In " +"certain situations, augmented assignment can result in unexpected errors " +"(see :ref:`faq-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 "" -"Called to implement the unary arithmetic operations (``-``, ``+``, :func:" -"`abs` and ``~``)." +"Called to implement the unary arithmetic operations (``-``, " +"``+``, :func:`abs` and ``~``)." msgstr "" "呼び出して単項算術演算 (``-``, ``+``, :func:`abs` および ``~``) を実装しま" "す。" #: ../../reference/datamodel.rst:3413 msgid "" -"Called to implement the built-in functions :func:`complex`, :func:`int` and :" -"func:`float`. Should return a value of the appropriate type." +"Called to implement the built-in functions :func:`complex`, :func:`int` " +"and :func:`float`. Should return a value of the appropriate type." msgstr "" "組み込み関数の :func:`complex`, :func:`int`, :func:`float` の実装から呼び出さ" "れます。\n" @@ -4632,8 +5215,8 @@ msgid "" msgstr "" "呼び出して :func:`operator.index` を実装します。\n" "Python が数値オブジェクトを整数オブジェクトに損失なく変換する必要がある場合 " -"(たとえばスライシングや、組み込みの :func:`bin` 、 :func:`hex` 、 :func:" -"`oct` 関数) は常に呼び出されます。\n" +"(たとえばスライシングや、組み込み" +"の :func:`bin` 、 :func:`hex` 、 :func:`oct` 関数) は常に呼び出されます。\n" "このメソッドがあるとその数値オブジェクトが整数型であることが示唆されます。\n" "整数を返さなければなりません。" @@ -4644,8 +5227,8 @@ msgid "" "and :func:`complex` fall back to :meth:`__index__`." msgstr "" "もし :meth:`__int__`, :meth:`__float__`, :meth:`__complex__` が定義されていな" -"い場合、組み込み関数の :func:`int`, :func:`float`, :func:`complex` は :meth:" -"`__index__` にフォールバックします。" +"い場合、組み込み関数の :func:`int`, :func:`float`, :func:`complex` " +"は :meth:`__index__` にフォールバックします。" #: ../../reference/datamodel.rst:3438 msgid "" @@ -4655,16 +5238,18 @@ msgid "" "return the value of the object truncated to an :class:`~numbers.Integral` " "(typically an :class:`int`)." msgstr "" -"組み込み関数の :func:`round` と :mod:`math` モジュール関数の :func:`~math." -"trunc`, :func:`~math.floor`, :func:`~math.ceil` の実装から呼び出されます。\n" +"組み込み関数の :func:`round` と :mod:`math` モジュール関数" +"の :func:`~math.trunc`, :func:`~math.floor`, :func:`~math.ceil` の実装から呼" +"び出されます。\n" "*ndigits* が :meth:`!__round__` に渡されない限りは、これらの全てのメソッド" "は :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 +5271,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 +5307,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 +5351,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 +5358,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 "" @@ -4783,8 +5369,8 @@ msgid "" "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " "MyClass(left=x, center=y)``. Note that the number of arguments in the " "pattern must be smaller than or equal to the number of elements in " -"*__match_args__*; if it is larger, the pattern match attempt will raise a :" -"exc:`TypeError`." +"*__match_args__*; if it is larger, the pattern match attempt will raise " +"a :exc:`TypeError`." msgstr "" "例えば、もし ``MyClass.__match_args__`` に ``(\"left\", \"center\", " "\"right\")`` が定義されていた場合、 ``case MyClass(x, y)`` は ``case " @@ -4800,126 +5386,148 @@ 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 " -"the kind of buffer requested, affecting for example whether the returned " -"buffer is read-only or writable. :class:`inspect.BufferFlags` provides a " -"convenient way to interpret the flags. The method must return a :class:" -"`memoryview` object." +"Called when a buffer is requested from *self* (for example, by " +"the :class:`memoryview` constructor). The *flags* argument is an integer " +"representing the kind of buffer requested, affecting for example whether the " +"returned buffer is read-only or writable. :class:`inspect.BufferFlags` " +"provides a 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 "" -"Called when a buffer is no longer needed. The *buffer* argument is a :class:" -"`memoryview` object that was previously returned by :meth:`~object." -"__buffer__`. The method must release any resources associated with the " -"buffer. This method should return ``None``. Buffer objects that do not need " -"to perform any cleanup are not required to implement this method." +"Called when a buffer is no longer needed. The *buffer* argument is " +"a :class:`memoryview` object that was previously returned " +"by :meth:`~object.__buffer__`. The method must release any resources " +"associated with the buffer. This method should return ``None``. Buffer " +"objects that do not need 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." +"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 +5544,6 @@ msgstr "" "ス辞書ではなく、オブジェクトの型で定義されているときにのみ正しく動作すること" "が保証されます。この動作のため、以下のコードは例外を送出します::" -#: ../../reference/datamodel.rst:3627 msgid "" ">>> class C:\n" "... pass\n" @@ -4948,6 +5555,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 "" @@ -4957,13 +5573,12 @@ msgid "" "of these methods used the conventional lookup process, they would fail when " "invoked on the type object itself::" msgstr "" -"この動作の背景となる理由は、 :meth:`~object.__hash__` と :meth:`~object." -"__repr__` といった type オブジェクトを含むすべてのオブジェクトで定義されてい" -"る特殊メソッドにあります。これらのメソッドの暗黙の検索が通常の検索プロセスを" -"使った場合、 type オブジェクト自体に対して実行されたときに失敗してしまいま" -"す::" +"この動作の背景となる理由は、 :meth:`~object.__hash__` " +"と :meth:`~object.__repr__` といった type オブジェクトを含むすべてのオブジェ" +"クトで定義されている特殊メソッドにあります。これらのメソッドの暗黙の検索が通" +"常の検索プロセスを使った場合、 type オブジェクト自体に対して実行されたときに" +"失敗してしまいます::" -#: ../../reference/datamodel.rst:3644 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4972,6 +5587,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,25 +5604,27 @@ 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 "" "In addition to bypassing any instance attributes in the interest of " -"correctness, implicit special method lookup generally also bypasses the :" -"meth:`~object.__getattribute__` method even of the object's metaclass::" +"correctness, implicit special method lookup generally also bypasses " +"the :meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" "正確性のためにインスタンス属性をスキップするのに加えて、特殊メソッド検索はオ" "ブジェクトのメタクラスを含めて、 :meth:`~object.__getattribute__` メソッドも" "バイパスします::" -#: ../../reference/datamodel.rst:3664 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -5025,6 +5648,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 "" @@ -5049,9 +5693,9 @@ msgstr "待機可能オブジェクト (Awaitable Object)" #: ../../reference/datamodel.rst:3703 msgid "" -"An :term:`awaitable` object generally implements an :meth:`~object." -"__await__` method. :term:`Coroutine objects ` returned from :" -"keyword:`async def` functions are awaitable." +"An :term:`awaitable` object generally implements " +"an :meth:`~object.__await__` method. :term:`Coroutine objects ` " +"returned from :keyword:`async def` functions are awaitable." msgstr "" ":term:`awaitable` オブジェクトは一般的には :meth:`~object.__await__` メソッド" "が実装されています。 :keyword:`async def` 関数が返す :term:`Coroutineオブジェ" @@ -5060,28 +5704,36 @@ msgstr "" #: ../../reference/datamodel.rst:3709 msgid "" "The :term:`generator iterator` objects returned from generators decorated " -"with :func:`types.coroutine` are also awaitable, but they do not implement :" -"meth:`~object.__await__`." +"with :func:`types.coroutine` are also awaitable, but they do not " +"implement :meth:`~object.__await__`." msgstr "" ":func:`types.coroutine` デコレータでデコレータが付けられたジェネレータから返" -"される :term:`generator iterator` オブジェクトも待機可能ですが、 :meth:" -"`~object.__await__` は実装されていません。" +"される :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." +"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." +"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." @@ -5097,18 +5749,19 @@ msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " "and iterating over the result. When the coroutine has finished executing " -"and returns, the iterator raises :exc:`StopIteration`, and the exception's :" -"attr:`~StopIteration.value` attribute holds the return value. If the " -"coroutine raises an exception, it is propagated by the iterator. Coroutines " -"should not directly raise unhandled :exc:`StopIteration` exceptions." +"and returns, the iterator raises :exc:`StopIteration`, and the " +"exception's :attr:`~StopIteration.value` attribute holds the return value. " +"If the coroutine raises an exception, it is propagated by the iterator. " +"Coroutines should not directly raise unhandled :exc:`StopIteration` " +"exceptions." msgstr "" ":term:`Coroutineオブジェクト ` は :term:`awaitable` オブジェクトで" "す。:meth:`~object.__await__` を呼び出し、その返り値に対し反復処理をすること" "でコルーチンの実行を制御できます。コルーチンの実行が完了し制御を戻したとき、" -"イテレータは :exc:`StopIteration` を送出し、その例外の :attr:`~StopIteration." -"value` 属性に返り値を持たせます。コルーチンが例外を送出した場合は、イテレータ" -"により伝搬されます。コルーチンから :exc:`StopIteration` 例外を外に送出すべき" -"ではありません。" +"イテレータは :exc:`StopIteration` を送出し、その例外" +"の :attr:`~StopIteration.value` 属性に返り値を持たせます。コルーチンが例外を" +"送出した場合は、イテレータにより伝搬されます。コルーチンか" +"ら :exc:`StopIteration` 例外を外に送出すべきではありません。" #: ../../reference/datamodel.rst:3747 msgid "" @@ -5126,40 +5779,47 @@ 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." -"__await__`. If *value* is not ``None``, this method delegates to the :meth:" -"`~generator.send` method of the iterator that caused the coroutine to " -"suspend. The result (return value, :exc:`StopIteration`, or other " -"exception) is the same as when iterating over the :meth:`!__await__` return " -"value, described above." -msgstr "" +"is equivalent to advancing the iterator returned " +"by :meth:`~object.__await__`. If *value* is not ``None``, this method " +"delegates to the :meth:`~generator.send` method of the iterator that caused " +"the coroutine to suspend. The result (return value, :exc:`StopIteration`, " +"or other 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 " "coroutine to suspend, if it has such a method. Otherwise, the exception is " -"raised at the suspension point. The result (return value, :exc:" -"`StopIteration`, or other exception) is the same as when iterating over the :" -"meth:`~object.__await__` return value, described above. If the exception is " -"not caught in the coroutine, it propagates back to the caller." +"raised at the suspension point. The result (return " +"value, :exc:`StopIteration`, or other exception) is the same as when " +"iterating over the :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 "" @@ -5171,8 +5831,9 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" "コルーチンが自分自身の後片付けをし終了します。\n" -"コルーチンが一時停止している場合は、コルーチンを一時停止させたイテレータに :" -"meth:`~generator.close` メソッドがあれば、まずはそれに処理を委任します。\n" +"コルーチンが一時停止している場合は、コルーチンを一時停止させたイテレータ" +"に :meth:`~generator.close` メソッドがあれば、まずはそれに処理を委任しま" +"す。\n" "そして一時停止した地点から :exc:`GeneratorExit` が送出され、ただちにコルーチ" "ンが自分自身の後片付けを行います。\n" "最後に、実行が開始されていなかった場合でも、コルーチンに実行が完了した印を付" @@ -5202,9 +5863,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 +5882,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 +5896,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 "" @@ -5250,8 +5921,8 @@ msgstr "" #: ../../reference/datamodel.rst:3839 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " -"asynchronous iterator object. Returning anything else will result in a :exc:" -"`TypeError` error." +"asynchronous iterator object. Returning anything else will result in " +"a :exc:`TypeError` error." msgstr "" "Python 3.7 からは、 :meth:`~object.__aiter__` は非同期イテレータオブジェクト" "を返さなければなりません。\n" @@ -5276,23 +5947,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 +5973,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,36 +5994,45 @@ msgstr "" "* 。これは、正しく扱われなかった場合にとても奇妙な動作を引き起こすので、一般" "的には良い考えではありません。" -#: ../../reference/datamodel.rst:3884 msgid "" -"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." -"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " -"handling for this. Others will still raise a :exc:`TypeError`, but may do so " -"by relying on the behavior that ``None`` is not callable." +"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object.__reversed__`, :meth:`~object.__contains__`, :meth:`~object.__class_getitem__` " +"and :meth:`~os.PathLike.__fspath__` methods have special 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 +6421,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 +6495,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 +6519,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 +6569,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 +6660,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 +6718,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 +6757,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 +6803,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 +6874,8 @@ msgstr "コンストラクタ" msgid "destructor" msgstr "デストラクタ" -#: ../../reference/datamodel.rst:1943 msgid "finalizer" -msgstr "" +msgstr "ファイナライザ" #: ../../reference/datamodel.rst:1943 msgid "del" @@ -6258,17 +6925,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 +6942,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..616070543 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 @@ -42,9 +42,9 @@ msgid "" "the interpreter or specified as a command line argument to the interpreter) " "is a code block. A script command (a command specified on the interpreter " "command line with the :option:`-c` option) is a code block. A module run as " -"a top level script (as module ``__main__``) from the command line using a :" -"option:`-m` argument is also a code block. The string argument passed to the " -"built-in functions :func:`eval` and :func:`exec` is a code block." +"a top level script (as module ``__main__``) from the command line using " +"a :option:`-m` argument is also a code block. The string argument passed to " +"the built-in functions :func:`eval` and :func:`exec` is a code block." msgstr "" "Python プログラムはコードブロックから構成されます。\n" "ブロック (:dfn:`block`) は、一つのまとまりとして実行される Python プログラム" @@ -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,20 @@ 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" @@ -216,15 +216,14 @@ msgid "" "When a name is not found at all, a :exc:`NameError` exception is raised. If " "the current scope is a function scope, and the name refers to a local " "variable that has not yet been bound to a value at the point where the name " -"is used, an :exc:`UnboundLocalError` exception is raised. :exc:" -"`UnboundLocalError` is a subclass of :exc:`NameError`." +"is used, an :exc:`UnboundLocalError` exception is " +"raised. :exc:`UnboundLocalError` is a subclass of :exc:`NameError`." msgstr "" "名前が全く見付からなかったときは、 :exc:`NameError` 例外が送出されます。\n" "現在のスコープが関数のもので、名前が使われる場所でローカル変数がまだ値に束縛" "されていない場合、 :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 +234,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 "" @@ -249,11 +252,12 @@ msgid "" "names specified in the statement refer to the bindings of those names in the " "top-level namespace. Names are resolved in the top-level namespace by " "searching the global namespace, i.e. the namespace of the module containing " -"the code block, and the builtins namespace, the namespace of the module :mod:" -"`builtins`. The global namespace is searched first. If the names are not " -"found there, the builtins namespace is searched next. If the names are also " -"not found in the builtins namespace, new variables are created in the global " -"namespace. The global statement must precede all uses of the listed names." +"the code block, and the builtins namespace, the namespace of the " +"module :mod:`builtins`. The global namespace is searched first. If the " +"names are not found there, the builtins namespace is searched next. If the " +"names are also not found in the builtins namespace, new variables are " +"created in the global namespace. The global statement must precede all uses " +"of the listed names." msgstr "" #: ../../reference/executionmodel.rst:146 @@ -267,14 +271,19 @@ 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:" -"`SyntaxError` is raised at compile time if the given name does not exist in " -"any enclosing function scope. :ref:`Type parameters ` cannot be " -"rebound with the :keyword:`!nonlocal` statement." -msgstr "" +"previously bound variables in the nearest enclosing function " +"scope. :exc:`SyntaxError` is raised at compile time if the given name does " +"not exist in 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 +294,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 +307,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 +340,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 `)." +"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 +406,67 @@ 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.)" +"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." +"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`." +"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 +477,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 +503,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 +538,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" @@ -498,14 +561,14 @@ msgstr "組み込みと制限付きの実行" #: ../../reference/executionmodel.rst:303 msgid "" "Users should not touch ``__builtins__``; it is strictly an implementation " -"detail. Users wanting to override values in the builtins namespace should :" -"keyword:`import` the :mod:`builtins` module and modify its attributes " -"appropriately." +"detail. Users wanting to override values in the builtins namespace " +"should :keyword:`import` the :mod:`builtins` module and modify its " +"attributes appropriately." msgstr "" "ユーザは ``__builtins__`` に触れるべきではありません; これは厳密に実装の詳細" -"です。組み込みの名前空間の中の値をオーバーライドしたいユーザは、 :mod:" -"`builtins` モジュールを :keyword:`import` して、その属性を適切に変更するべき" -"です。" +"です。組み込みの名前空間の中の値をオーバーライドしたいユーザ" +"は、 :mod:`builtins` モジュールを :keyword:`import` して、その属性を適切に変" +"更するべきです。" #: ../../reference/executionmodel.rst:308 msgid "" @@ -514,8 +577,8 @@ msgid "" "namespace; this should be a dictionary or a module (in the latter case the " "module's dictionary is used). By default, when in the :mod:`__main__` " "module, ``__builtins__`` is the built-in module :mod:`builtins`; when in any " -"other module, ``__builtins__`` is an alias for the dictionary of the :mod:" -"`builtins` module itself." +"other module, ``__builtins__`` is an alias for the dictionary of " +"the :mod:`builtins` module itself." msgstr "" "あるコードブロックの実行に関連する組み込み名前空間は、実際にはコードブロック" "のグローバル名前空間から名前 ``__builtins__`` を検索することで見つかります; " @@ -537,7 +600,6 @@ msgstr "" "自由変数の名前解決はコンパイル時でなく実行時に行われます。つまり、以下のコー" "ドは42を出力します::" -#: ../../reference/executionmodel.rst:325 msgid "" "i = 10\n" "def f():\n" @@ -545,16 +607,21 @@ msgid "" "i = 42\n" "f()" msgstr "" +"i = 10\n" +"def f():\n" +" print(i)\n" +"i = 42\n" +"f()" #: ../../reference/executionmodel.rst:333 msgid "" "The :func:`eval` and :func:`exec` functions do not have access to the full " "environment for resolving names. Names may be resolved in the local and " "global namespaces of the caller. Free variables are not resolved in the " -"nearest enclosing namespace, but in the global namespace. [#]_ The :func:" -"`exec` and :func:`eval` functions have optional arguments to override the " -"global and local namespace. If only one namespace is specified, it is used " -"for both." +"nearest enclosing namespace, but in the global namespace. [#]_ " +"The :func:`exec` and :func:`eval` functions have optional arguments to " +"override the global and local namespace. If only one namespace is " +"specified, it is used for both." msgstr "" ":func:`eval` と :func:`exec` 関数は、名前の解決に、現在の環境の全てを使えるわ" "けではありません。名前は呼び出し側のローカルやグローバル名前空間で解決できま" @@ -586,38 +653,36 @@ msgid "" "The Python interpreter raises an exception when it detects a run-time error " "(such as division by zero). A Python program can also explicitly raise an " "exception with the :keyword:`raise` statement. Exception handlers are " -"specified with the :keyword:`try` ... :keyword:`except` statement. The :" -"keyword:`finally` clause of such a statement can be used to specify cleanup " -"code which does not handle the exception, but is executed whether an " +"specified with the :keyword:`try` ... :keyword:`except` statement. " +"The :keyword:`finally` clause of such a statement can be used to specify " +"cleanup code which does not handle the exception, but is executed whether an " "exception occurred or not in the preceding code." msgstr "" "Python インタプリタは、ランタイムエラー (ゼロ除算など) が検出されると例外を送" "出します。Python プログラムから、 :keyword:`raise` 文を使って明示的に例外を送" -"出することもできます。例外ハンドラ (exception handler) は、 :keyword:" -"`try` ... :keyword:`except` 文で指定することができます。 :keyword:`try` 文" -"の :keyword:`finally` 節を使うとクリーンアップコード (cleanup code) を指定で" -"きます。このコードは例外は処理しませんが、先行するコードブロックで例外が起き" -"ても起きなくても実行されます。" +"出することもできます。例外ハンドラ (exception handler) " +"は、 :keyword:`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 "" "When an exception is not handled at all, the interpreter terminates " "execution of the program, or returns to its interactive main loop. In " -"either case, it prints a stack traceback, except when the exception is :exc:" -"`SystemExit`." +"either case, it prints a stack traceback, except when the exception " +"is :exc:`SystemExit`." msgstr "" "例外が全く処理されないとき、インタプリタはプログラムの実行を終了させるか、対" "話メインループに処理を戻します。\n" @@ -633,10 +698,10 @@ msgid "" "additional information about the exceptional condition." msgstr "" "例外は、クラスインスタンスによって識別されます。 :keyword:`except` 節はインス" -"タンスのクラスにもとづいて選択されます: これはインスタンスのクラスか、その :" -"term:`非仮想基底クラス ` を参照します。このインスタンス" -"はハンドラによって受け取られ、例外条件に関する追加情報を伝えることができま" -"す。" +"タンスのクラスにもとづいて選択されます: これはインスタンスのクラスか、そ" +"の :term:`非仮想基底クラス ` を参照します。このインスタ" +"ンスはハンドラによって受け取られ、例外条件に関する追加情報を伝えることができ" +"ます。" #: ../../reference/executionmodel.rst:393 msgid "" @@ -652,11 +717,11 @@ msgstr "" #: ../../reference/executionmodel.rst:397 msgid "" -"See also the description of the :keyword:`try` statement in section :ref:" -"`try` and :keyword:`raise` statement in section :ref:`raise`." +"See also the description of the :keyword:`try` statement in " +"section :ref:`try` and :keyword:`raise` statement in section :ref:`raise`." msgstr "" -":keyword:`try` 文については、 :ref:`try` 節、 :keyword:`raise` 文については :" -"ref:`raise` 節も参照してください。" +":keyword:`try` 文については、 :ref:`try` 節、 :keyword:`raise` 文について" +"は :ref:`raise` 節も参照してください。" #: ../../reference/executionmodel.rst:402 msgid "Footnotes" @@ -710,9 +775,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..52f0c4207 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." @@ -117,9 +117,9 @@ msgstr "識別子 (identifier、または名前 (name))" #: ../../reference/expressions.rst:69 msgid "" -"An identifier occurring as an atom is a name. See section :ref:" -"`identifiers` for lexical definition and section :ref:`naming` for " -"documentation of naming and binding." +"An identifier occurring as an atom is a name. See " +"section :ref:`identifiers` for lexical definition and section :ref:`naming` " +"for documentation of naming and binding." msgstr "" "アトムの形になっている識別子 (identifier) は名前 (name) です。字句定義につい" "ては :ref:`identifiers` 節を、名前付けや束縛については :ref:`naming` 節を参照" @@ -128,83 +128,93 @@ msgstr "" #: ../../reference/expressions.rst:75 msgid "" "When the name is bound to an object, evaluation of the atom yields that " -"object. When a name is not bound, an attempt to evaluate it raises a :exc:" -"`NameError` exception." +"object. When a name is not bound, an attempt to evaluate it raises " +"a :exc:`NameError` exception." msgstr "" "名前があるオブジェクトに束縛されている場合、名前 atom を評価するとそのオブ" -"ジェクトになります。名前が束縛されていない場合、 atom を評価しようとすると :" -"exc:`NameError` 例外を送出します。" +"ジェクトになります。名前が束縛されていない場合、 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" @@ -298,8 +308,8 @@ msgstr "コンテナの内容を明示的に列挙する" #: ../../reference/expressions.rst:202 msgid "" -"they are computed via a set of looping and filtering instructions, called a :" -"dfn:`comprehension`." +"they are computed via a set of looping and filtering instructions, called " +"a :dfn:`comprehension`." msgstr "" ":dfn:`内包表記 (comprehension)` と呼ばれる、ループ処理とフィルター処理の組み" "合わせを用いた計算結果" @@ -310,9 +320,9 @@ msgstr "内包表記の共通の構文要素は次の通りです:" #: ../../reference/expressions.rst:218 msgid "" -"The comprehension consists of a single expression followed by at least one :" -"keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!if` " -"clauses. In this case, the elements of the new container are those that " +"The comprehension consists of a single expression followed by at least " +"one :keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!" +"if` clauses. In this case, the elements of the new container are those that " "would be produced by considering each of the :keyword:`!for` or :keyword:`!" "if` clauses a block, nesting from left to right, and evaluating the " "expression to produce an element each time the innermost block is reached." @@ -365,8 +375,8 @@ msgstr "" msgid "" "Since Python 3.6, in an :keyword:`async def` function, an :keyword:`!async " "for` clause may be used to iterate over a :term:`asynchronous iterator`. A " -"comprehension in an :keyword:`!async def` function may consist of either a :" -"keyword:`!for` or :keyword:`!async for` clause following the leading " +"comprehension in an :keyword:`!async def` function may consist of either " +"a :keyword:`!for` or :keyword:`!async for` clause following the leading " "expression, may contain additional :keyword:`!for` or :keyword:`!async for` " "clauses, and may also use :keyword:`await` expressions." msgstr "" @@ -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" @@ -506,11 +517,11 @@ msgstr "" #: ../../reference/expressions.rst:374 msgid "" -"Restrictions on the types of the key values are listed earlier in section :" -"ref:`types`. (To summarize, the key type should be :term:`hashable`, which " -"excludes all mutable objects.) Clashes between duplicate keys are not " -"detected; the last value (textually rightmost in the display) stored for a " -"given key value prevails." +"Restrictions on the types of the key values are listed earlier in " +"section :ref:`types`. (To summarize, the key type should " +"be :term:`hashable`, which excludes all mutable objects.) Clashes between " +"duplicate keys are not detected; the last value (textually rightmost in the " +"display) stored for a given key value prevails." msgstr "" #: ../../reference/expressions.rst:380 @@ -546,16 +557,16 @@ msgstr "" #: ../../reference/expressions.rst:406 msgid "" -"Variables used in the generator expression are evaluated lazily when the :" -"meth:`~generator.__next__` method is called for the generator object (in the " -"same fashion as normal generators). However, the iterable expression in the " -"leftmost :keyword:`!for` clause is immediately evaluated, so that an error " -"produced by it will be emitted at the point where the generator expression " -"is defined, rather than at the point where the first value is retrieved. " -"Subsequent :keyword:`!for` clauses and any filter condition in the leftmost :" -"keyword:`!for` clause cannot be evaluated in the enclosing scope as they may " -"depend on the values obtained from the leftmost iterable. For example: " -"``(x*y for x in range(10) for y in range(x, x+10))``." +"Variables used in the generator expression are evaluated lazily when " +"the :meth:`~generator.__next__` method is called for the generator object " +"(in the same fashion as normal generators). However, the iterable " +"expression in the leftmost :keyword:`!for` clause is immediately evaluated, " +"so that an error produced by it will be emitted at the point where the " +"generator expression is defined, rather than at the point where the first " +"value is retrieved. Subsequent :keyword:`!for` clauses and any filter " +"condition in the leftmost :keyword:`!for` clause cannot be evaluated in the " +"enclosing scope as they may depend on the values obtained from the leftmost " +"iterable. For example: ``(x*y for x in range(10) for y in range(x, x+10))``." msgstr "" "ジェネレータ式の中で使われている変数は、 (通常のジェネレータと同じように) そ" "のジェネレータオブジェクトに対して :meth:`~generator.__next__` メソッドが呼ば" @@ -573,8 +584,8 @@ msgid "" "The parentheses can be omitted on calls with only one argument. See " "section :ref:`calls` for details." msgstr "" -"関数の唯一の引数として渡す場合には、丸括弧を省略できます。詳しくは :ref:" -"`calls` 節を参照してください。" +"関数の唯一の引数として渡す場合には、丸括弧を省略できます。詳しく" +"は :ref:`calls` 節を参照してください。" #: ../../reference/expressions.rst:420 msgid "" @@ -587,11 +598,11 @@ msgstr "" #: ../../reference/expressions.rst:424 msgid "" -"If a generator expression contains either :keyword:`!async for` clauses or :" -"keyword:`await` expressions it is called an :dfn:`asynchronous generator " +"If a generator expression contains either :keyword:`!async for` clauses " +"or :keyword:`await` expressions it is called an :dfn:`asynchronous generator " "expression`. An asynchronous generator expression returns a new " -"asynchronous generator object, which is an asynchronous iterator (see :ref:" -"`async-iterators`)." +"asynchronous generator object, which is an asynchronous iterator " +"(see :ref:`async-iterators`)." msgstr "" "ジェネレータ式が :keyword:`!async for` 節あるいは :keyword:`await` 式を含んで" "いる場合、それは :dfn:`非同期ジェネレータ式` と呼ばれます。\n" @@ -621,19 +632,18 @@ msgid "" "The yield expression is used when defining a :term:`generator` function or " "an :term:`asynchronous generator` function and thus can only be used in the " "body of a function definition. Using a yield expression in a function's " -"body causes that function to be a generator function, and using it in an :" -"keyword:`async def` function's body causes that coroutine function to be an " -"asynchronous generator function. For example::" +"body causes that function to be a generator function, and using it in " +"an :keyword:`async def` function's body causes that coroutine function to be " +"an asynchronous generator function. For example::" msgstr "" "yield 式は :term:`ジェネレータ ` 関数や :term:`非同期ジェネレータ " "` 関数を定義するときに使われます。従って、関数定義の" "本体でのみ使えます。\n" -"関数の本体で yield 式 を使用するとその関数はジェネレータ関数になり、 :" -"keyword:`async def` 関数の本体で使用するとそのコルーチン関数は非同期ジェネ" -"レータ関数になります。\n" +"関数の本体で yield 式 を使用するとその関数はジェネレータ関数にな" +"り、 :keyword:`async def` 関数の本体で使用するとそのコルーチン関数は非同期" +"ジェネレータ関数になります。\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,28 +683,42 @@ 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 " "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " -"where it is suspended again, returning the value of :token:`~python-grammar:" -"yield_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:yield_list` is omitted. By suspended, we mean that all local state " -"is retained, including the current bindings of local variables, the " -"instruction pointer, the internal evaluation stack, and the state of any " -"exception handling. When the execution is resumed by calling one of the " -"generator's methods, the function can proceed exactly as if the yield " -"expression were just another external call. The value of the yield " +"where it is suspended again, returning the value of :token:`~python-" +"grammar:yield_list` to the generator's caller, or ``None`` " +"if :token:`~python-grammar:yield_list` is omitted. By suspended, we mean " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by calling " +"one of the generator's methods, the function can proceed exactly as if the " +"yield expression were just another external call. The value of the yield " "expression after resuming depends on the method which resumed the " -"execution. If :meth:`~generator.__next__` is used (typically via either a :" -"keyword:`for` or the :func:`next` builtin) then the result is :const:" -"`None`. Otherwise, if :meth:`~generator.send` is used, then the result will " -"be the value passed in to that method." -msgstr "" +"execution. If :meth:`~generator.__next__` is used (typically via either " +"a :keyword:`for` or the :func:`next` builtin) then the result " +"is :const:`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,50 +726,52 @@ 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 "" "Yield expressions are allowed anywhere in a :keyword:`try` construct. If " "the generator is not resumed before it is finalized (by reaching a zero " -"reference count or by being garbage collected), the generator-iterator's :" -"meth:`~generator.close` method will be called, allowing any pending :keyword:" -"`finally` clauses to execute." +"reference count or by being garbage collected), the generator-" +"iterator's :meth:`~generator.close` method will be called, allowing any " +"pending :keyword:`finally` clauses to execute." msgstr "" "yield 式は :keyword:`try` 構造内で使用できます。ジェネレータの (参照カウント" "がゼロに達するか、ガベージコレクションによる) 完了前に再開されない場合、ジェ" -"ネレータ-イテレータの :meth:`~generator.close` メソッドが呼ばれ、:keyword:" -"`finally` 節が実行されます。" +"ネレータ-イテレータの :meth:`~generator.close` メソッドが呼ば" +"れ、:keyword:`finally` 節が実行されます。" #: ../../reference/expressions.rst:518 msgid "" "When ``yield from `` is used, the supplied expression must be an " "iterable. The values produced by iterating that iterable are passed directly " -"to the caller of the current generator's methods. Any values passed in with :" -"meth:`~generator.send` and any exceptions passed in with :meth:`~generator." -"throw` are passed to the underlying iterator if it has the appropriate " -"methods. If this is not the case, then :meth:`~generator.send` will raise :" -"exc:`AttributeError` or :exc:`TypeError`, while :meth:`~generator.throw` " -"will just raise the passed in exception immediately." +"to the caller of the current generator's methods. Any values passed in " +"with :meth:`~generator.send` and any exceptions passed in " +"with :meth:`~generator.throw` are passed to the underlying iterator if it " +"has the appropriate methods. If this is not the case, " +"then :meth:`~generator.send` will raise :exc:`AttributeError` " +"or :exc:`TypeError`, while :meth:`~generator.throw` will just raise the " +"passed in exception immediately." msgstr "" "``yield from `` を使用した場合、与えられた式はイテラブルでなければなり" "ません。そのイテラブルをイテレートすることで生成された値は現在のジェネレータ" "のメソッドの呼び出し元へ直接渡されます。:meth:`~generator.send` で渡されたあ" "らゆる値と :meth:`~generator.throw` で渡されたあらゆる例外は根底のイテレータ" -"に適切なメソッドがあれば渡されます。適切なメソッドがない場合、:meth:" -"`~generator.send` は :exc:`AttributeError` か :exc:`TypeError` を、:meth:" -"`~generator.throw` は渡された例外を即座に送出します。" +"に適切なメソッドがあれば渡されます。適切なメソッドがない場" +"合、:meth:`~generator.send` は :exc:`AttributeError` か :exc:`TypeError` " +"を、:meth:`~generator.throw` は渡された例外を即座に送出します。" #: ../../reference/expressions.rst:527 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " -"the yield expression. It can be either set explicitly when raising :exc:" -"`StopIteration`, or automatically when the subiterator is a generator (by " -"returning a value from the subgenerator)." +"the yield expression. It can be either set explicitly when " +"raising :exc:`StopIteration`, or automatically when the subiterator is a " +"generator (by returning a value from the subgenerator)." msgstr "" "根底のイテレータの完了時、引き起こされた :exc:`StopIteration` インスタンス" "の :attr:`~StopIteration.value` 属性はその yield 式の値となります。\n" @@ -792,8 +822,8 @@ msgid "" "The proposal to introduce the :token:`~python-grammar:yield_from` syntax, " "making delegation to subgenerators easy." msgstr "" -"サブジェネレータの委譲を簡単にするための、 :token:`~python-grammar:" -"yield_from` 構文の導入提案。" +"サブジェネレータの委譲を簡単にするための、 :token:`~python-" +"grammar:yield_from` 構文の導入提案。" #: ../../reference/expressions.rst:552 msgid ":pep:`525` - Asynchronous Generators" @@ -823,19 +853,19 @@ msgid "" "Note that calling any of the generator methods below when the generator is " "already executing raises a :exc:`ValueError` exception." msgstr "" -"以下のジェネレータメソッドの呼び出しは、ジェネレータが既に実行中の場合 :exc:" -"`ValueError` 例外を送出する点に注意してください。" +"以下のジェネレータメソッドの呼び出しは、ジェネレータが既に実行中の場" +"合 :exc:`ValueError` 例外を送出する点に注意してください。" #: ../../reference/expressions.rst:573 msgid "" "Starts the execution of a generator function or resumes it at the last " -"executed yield expression. When a generator function is resumed with a :" -"meth:`~generator.__next__` method, the current yield expression always " +"executed yield expression. When a generator function is resumed with " +"a :meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " -"expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " -"caller. If the generator exits without yielding another value, a :exc:" -"`StopIteration` exception is raised." +"expression, where the generator is suspended again, and the value of " +"the :token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " +"caller. If the generator exits without yielding another value, " +"a :exc:`StopIteration` exception is raised." msgstr "" #: ../../reference/expressions.rst:582 @@ -858,10 +888,10 @@ msgid "" msgstr "" "ジェネレータ関数の内部へ値を \"送り\"、実行を再開します。引数の *value* はそ" "の時点の yield 式の結果になります。 :meth:`send` メソッドは次にジェネレータが" -"生成した値を返し、ジェネレータが次の値を生成することなく終了すると :exc:" -"`StopIteration` を送出します。 :meth:`send` が呼び出されてジェネレータが開始" -"するときは、値を受け取る yield 式が存在しないので、 :const:`None` を引数とし" -"て呼び出さなければなりません。" +"生成した値を返し、ジェネレータが次の値を生成することなく終了する" +"と :exc:`StopIteration` を送出します。 :meth:`send` が呼び出されてジェネレー" +"タが開始するときは、値を受け取る yield 式が存在しないので、 :const:`None` を" +"引数として呼び出さなければなりません。" #: ../../reference/expressions.rst:600 msgid "" @@ -872,9 +902,9 @@ msgid "" "a different exception, then that exception propagates to the caller." msgstr "" "ジェネレータが中断した位置で例外を発生させて、そのジェネレータ関数が生成する" -"次の値を返します。ジェネレータが値を生成することなく終了すると :exc:" -"`StopIteration` が発生します。ジェネレータ関数が渡された例外を捕捉しない、も" -"しくは違う例外を発生させるなら、その例外は呼び出し元へ伝搬されます。" +"次の値を返します。ジェネレータが値を生成することなく終了する" +"と :exc:`StopIteration` が発生します。ジェネレータ関数が渡された例外を捕捉し" +"ない、もしくは違う例外を発生させるなら、その例外は呼び出し元へ伝搬されます。" #: ../../reference/expressions.rst:606 msgid "" @@ -882,7 +912,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 +921,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 "" @@ -908,14 +947,14 @@ msgid "" "exception), :meth:`close` returns :const:`None`. If the generator yields a " "value, a :exc:`RuntimeError` is raised. If the generator raises any other " "exception, it is propagated to the caller. If the generator has already " -"exited due to an exception or normal exit, :meth:`close` returns :const:" -"`None` and has no other effect." +"exited due to an exception or normal exit, :meth:`close` " +"returns :const:`None` and has no other effect." msgstr "" #: ../../reference/expressions.rst:640 msgid "" -"If a generator returns a value upon being closed, the value is returned by :" -"meth:`close`." +"If a generator returns a value upon being closed, the value is returned " +"by :meth:`close`." msgstr "" #: ../../reference/expressions.rst:646 @@ -972,9 +1011,9 @@ msgstr "非同期ジェネレータ関数 (asynchronous generator function)" #: ../../reference/expressions.rst:683 msgid "" -"The presence of a yield expression in a function or method defined using :" -"keyword:`async def` further defines the function as an :term:`asynchronous " -"generator` function." +"The presence of a yield expression in a function or method defined " +"using :keyword:`async def` further defines the function as " +"an :term:`asynchronous generator` function." msgstr "" ":keyword:`async def` を使用して定義された関数やメソッドに yield 式があると、" "その関数は :term:`非同期ジェネレータ ` 関数として定義" @@ -986,8 +1025,8 @@ msgid "" "asynchronous iterator known as an asynchronous generator object. That object " "then controls the execution of the generator function. An asynchronous " "generator object is typically used in an :keyword:`async for` statement in a " -"coroutine function analogously to how a generator object would be used in a :" -"keyword:`for` statement." +"coroutine function analogously to how a generator object would be used in " +"a :keyword:`for` statement." msgstr "" "非同期ジェネレータ関数が呼び出されると、非同期ジェネレータオブジェクトと呼ば" "れる非同期イテレータが返されます。\n" @@ -996,25 +1035,35 @@ 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. " -"At that time, the execution proceeds to the first yield expression, where it " -"is suspended again, returning the value of :token:`~python-grammar:" -"yield_list` to the awaiting coroutine. As with a generator, suspension means " -"that all local state is retained, including the current bindings of local " -"variables, the instruction pointer, the internal evaluation stack, and the " -"state of any exception handling. When the execution is resumed by awaiting " -"on the next object returned by the asynchronous generator's methods, the " -"function can proceed exactly as if the yield expression were just another " -"external call. The value of the yield expression after resuming depends on " -"the method which resumed the execution. If :meth:`~agen.__anext__` is used " -"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 "" +"Calling one of the asynchronous generator's methods returns " +"an :term:`awaitable` object, and the execution starts when this object is " +"awaited on. At that time, the execution proceeds to the first yield " +"expression, where it is suspended again, returning the value " +"of :token:`~python-grammar:yield_list` to the awaiting coroutine. As with a " +"generator, suspension means that all local state is retained, including the " +"current bindings of local variables, the instruction pointer, the internal " +"evaluation stack, and the state of any exception handling. When the " +"execution is resumed by awaiting on the next object returned by the " +"asynchronous generator's methods, the function can proceed exactly as if the " +"yield expression were just another external call. The value of the yield " +"expression after resuming depends on the method which resumed the " +"execution. If :meth:`~agen.__anext__` is used 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 +1074,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,27 +1097,28 @@ 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 "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" "iterator and presumably calls :meth:`~agen.aclose` and executes the " -"coroutine. This *finalizer* may be registered by calling :func:`sys." -"set_asyncgen_hooks`. When first iterated over, an asynchronous generator-" -"iterator will store the registered *finalizer* to be called upon " -"finalization. For a reference example of a *finalizer* method see the " -"implementation of ``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/" -"asyncio/base_events.py`." +"coroutine. This *finalizer* may be registered by " +"calling :func:`sys.set_asyncgen_hooks`. When first iterated over, an " +"asynchronous generator-iterator will store the registered *finalizer* to be " +"called upon finalization. For a reference example of a *finalizer* method " +"see the implementation of ``asyncio.Loop.shutdown_asyncgens`` " +"in :source:`Lib/asyncio/base_events.py`." msgstr "" #: ../../reference/expressions.rst:739 @@ -1092,9 +1151,9 @@ msgid "" "expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " -"yielding another value, the awaitable instead raises a :exc:" -"`StopAsyncIteration` exception, signalling that the asynchronous iteration " -"has completed." +"yielding another value, the awaitable instead raises " +"a :exc:`StopAsyncIteration` exception, signalling that the asynchronous " +"iteration has completed." msgstr "" #: ../../reference/expressions.rst:769 @@ -1110,24 +1169,24 @@ msgid "" "generator, this \"sends\" a value into the asynchronous generator function, " "and the *value* argument becomes the result of the current yield expression. " "The awaitable returned by the :meth:`asend` method will return the next " -"value yielded by the generator as the value of the raised :exc:" -"`StopIteration`, or raises :exc:`StopAsyncIteration` if the asynchronous " -"generator exits without yielding another value. When :meth:`asend` is " -"called to start the asynchronous generator, it must be called with :const:" -"`None` as the argument, because there is no yield expression that could " -"receive the value." +"value yielded by the generator as the value of the " +"raised :exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the " +"asynchronous generator exits without yielding another value. " +"When :meth:`asend` is called to start the asynchronous generator, it must be " +"called with :const:`None` as the argument, because there is no yield " +"expression that could receive the value." msgstr "" #: ../../reference/expressions.rst:792 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " -"yielded by the generator function as the value of the raised :exc:" -"`StopIteration` exception. If the asynchronous generator exits without " -"yielding another value, a :exc:`StopAsyncIteration` exception is raised by " -"the awaitable. If the generator function does not catch the passed-in " -"exception, or raises a different exception, then when the awaitable is run " -"that exception propagates to the caller of the awaitable." +"yielded by the generator function as the value of the " +"raised :exc:`StopIteration` exception. If the asynchronous generator exits " +"without yielding another value, a :exc:`StopAsyncIteration` exception is " +"raised by the awaitable. If the generator function does not catch the passed-" +"in exception, or raises a different exception, then when the awaitable is " +"run that exception propagates to the caller of the awaitable." msgstr "" #: ../../reference/expressions.rst:813 @@ -1166,7 +1225,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 +1232,33 @@ 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." +"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" @@ -1196,9 +1267,9 @@ msgstr "添字表記 (subscription)" #: ../../reference/expressions.rst:892 msgid "" "The subscription of an instance of a :ref:`container class ` " -"will generally select an element from the container. The subscription of a :" -"term:`generic class ` will generally return a :ref:" -"`GenericAlias ` object." +"will generally select an element from the container. The subscription of " +"a :term:`generic class ` will generally return " +"a :ref:`GenericAlias ` object." msgstr "" #: ../../reference/expressions.rst:900 @@ -1210,18 +1281,19 @@ msgstr "" #: ../../reference/expressions.rst:903 msgid "" "The primary must evaluate to an object that supports subscription. An object " -"may support subscription through defining one or both of :meth:`~object." -"__getitem__` and :meth:`~object.__class_getitem__`. When the primary is " -"subscripted, the evaluated result of the expression list will be passed to " -"one of these methods. For more details on when ``__class_getitem__`` is " -"called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." +"may support subscription through defining one or both " +"of :meth:`~object.__getitem__` and :meth:`~object.__class_getitem__`. When " +"the primary is subscripted, the evaluated result of the expression list will " +"be passed to one of these methods. For more details on when " +"``__class_getitem__`` is called instead of ``__getitem__``, " +"see :ref:`classgetitem-versus-getitem`." msgstr "" #: ../../reference/expressions.rst:910 msgid "" "If the expression list contains at least one comma, or if any of the " -"expressions are starred, the expression list will evaluate to a :class:" -"`tuple` containing the items of the expression list. Otherwise, the " +"expressions are starred, the expression list will evaluate to " +"a :class:`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" @@ -1253,26 +1325,26 @@ msgstr "" msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " -"following section). Examples of builtin sequence classes include the :class:" -"`str`, :class:`list` and :class:`tuple` classes." +"following section). Examples of builtin sequence classes include " +"the :class:`str`, :class:`list` and :class:`tuple` classes." msgstr "" "シーケンス。プライマリが :term:`シーケンス ` であれば、式リストの評" "価結果は :class:`int` または :class:`slice` (以下の節で論じます) でなければな" -"りません。組み込みのシーケンスクラスの例には :class:`str`、:class:`list`、:" -"class:`tuple` クラスが含まれます。" +"りません。組み込みのシーケンスクラスの例に" +"は :class:`str`、:class:`list`、:class:`tuple` クラスが含まれます。" #: ../../reference/expressions.rst:930 msgid "" -"The formal syntax makes no special provision for negative indices in :term:" -"`sequences `. However, built-in sequences all provide a :meth:" -"`~object.__getitem__` method that interprets negative indices by adding the " -"length of the sequence to the index so that, for example, ``x[-1]`` selects " -"the last item of ``x``. The resulting value must be a nonnegative integer " -"less than the number of items in the sequence, and the subscription selects " -"the item whose index is that value (counting from zero). Since the support " -"for negative indices and slicing occurs in the object's :meth:`~object." -"__getitem__` method, subclasses overriding this method will need to " -"explicitly add that support." +"The formal syntax makes no special provision for negative indices " +"in :term:`sequences `. However, built-in sequences all provide " +"a :meth:`~object.__getitem__` method that interprets negative indices by " +"adding the length of the sequence to the index so that, for example, " +"``x[-1]`` selects the last item of ``x``. The resulting value must be a " +"nonnegative integer less than the number of items in the sequence, and the " +"subscription selects the item whose index is that value (counting from " +"zero). Since the support for negative indices and slicing occurs in the " +"object's :meth:`~object.__getitem__` method, subclasses overriding this " +"method will need to explicitly add that support." msgstr "" #: ../../reference/expressions.rst:944 @@ -1295,9 +1367,9 @@ msgid "" "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" "スライス表記はシーケンスオブジェクト (文字列、タプルまたはリスト) におけるあ" -"る範囲の要素を選択します。スライス表記は式として用いたり、代入や :keyword:" -"`del` 文の対象として用いたりできます。スライス表記の構文は以下のようになりま" -"す:" +"る範囲の要素を選択します。スライス表記は式として用いたり、代入" +"や :keyword:`del` 文の対象として用いたりできます。スライス表記の構文は以下の" +"ようになります:" #: ../../reference/expressions.rst:979 msgid "" @@ -1323,10 +1395,10 @@ msgid "" "the slice items; otherwise, the conversion of the lone slice item is the " "key. The conversion of a slice item that is an expression is that " "expression. The conversion of a proper slice is a slice object (see " -"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` and :" -"attr:`~slice.step` attributes are the values of the expressions given as " -"lower bound, upper bound and stride, respectively, substituting ``None`` for " -"missing expressions." +"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` " +"and :attr:`~slice.step` attributes are the values of the expressions given " +"as lower bound, upper bound and stride, respectively, substituting ``None`` " +"for missing expressions." msgstr "" #: ../../reference/expressions.rst:1015 @@ -1338,9 +1410,9 @@ msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -"呼び出しは、呼び出し可能オブジェクト (例えば :term:`function`) を :term:" -"`arguments ` の系列とともに呼び出します。系列は空の系列であってもか" -"まいません:" +"呼び出しは、呼び出し可能オブジェクト (例えば :term:`function`) " +"を :term:`arguments ` の系列とともに呼び出します。系列は空の系列で" +"あってもかまいません:" #: ../../reference/expressions.rst:1034 msgid "" @@ -1350,7 +1422,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 +1430,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,36 +1458,37 @@ 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 " "documentation, and which therefore cannot be supplied by keyword. In " -"CPython, this is the case for functions implemented in C that use :c:func:" -"`PyArg_ParseTuple` to parse their arguments." +"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 "" @@ -1426,8 +1505,8 @@ msgstr "" #: ../../reference/expressions.rst:1080 msgid "" -"If any keyword argument does not correspond to a formal parameter name, a :" -"exc:`TypeError` exception is raised, unless a formal parameter using the " +"If any keyword argument does not correspond to a formal parameter name, " +"a :exc:`TypeError` exception is raised, unless a formal parameter using the " "syntax ``**identifier`` is present; in this case, that formal parameter " "receives a dictionary containing the excess keyword arguments (using the " "keywords as keys and the argument values as corresponding values), or a " @@ -1503,7 +1582,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 +1592,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 +1638,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 +1647,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 +1693,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 +1725,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 "" @@ -1668,18 +1760,20 @@ msgstr "" #: ../../reference/expressions.rst:1249 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " -"Raising a negative number to a fractional power results in a :class:" -"`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" +"Raising a negative number to a fractional power results in " +"a :class:`complex` number. (In earlier versions it raised " +"a :exc:`ValueError`.)" msgstr "" "``0.0`` を負の数でべき乗すると :exc:`ZeroDivisionError` を送出します。負の数" "を小数でべき乗した結果は複素数 (: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,31 +1783,37 @@ 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." +"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 "" -"In all three cases, if the argument does not have the proper type, a :exc:" -"`TypeError` exception is raised." +"In all three cases, if the argument does not have the proper type, " +"a :exc:`TypeError` exception is raised." msgstr "" "上記の三つはいずれも、引数が正しい型でない場合には :exc:`TypeError` 例外が送" "出されます。" @@ -1744,18 +1844,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 +1866,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." +"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 +1888,17 @@ 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." +"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 +1936,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." +"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 +1960,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 +1973,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 +1989,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." +"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 +2023,37 @@ 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." +"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." +"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." +"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 +2070,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 +2104,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 +2149,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 "" @@ -2087,10 +2216,10 @@ msgid "" "involved, they compare mathematically (algorithmically) correct without loss " "of precision." msgstr "" -"いくつかの組み込みの数値型 (:ref:`typesnumeric`) と標準ライブラリの型 :class:" -"`fractions.Fraction` および :class:`decimal.Decimal` は、これらの型の範囲で異" -"なる型とも比較できますが、複素数では順序比較がサポートされていないという制限" -"があります。\n" +"いくつかの組み込みの数値型 (:ref:`typesnumeric`) と標準ライブラリの" +"型 :class:`fractions.Fraction` および :class:`decimal.Decimal` は、これらの型" +"の範囲で異なる型とも比較できますが、複素数では順序比較がサポートされていない" +"という制限があります。\n" "関わる型の制限の範囲内では、精度のロス無しに数学的に (アルゴリズム的に) 正し" "い比較が行われます。" @@ -2110,12 +2239,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 "" @@ -2130,8 +2261,8 @@ msgstr "" #: ../../reference/expressions.rst:1611 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " -"numerical Unicode code points (the result of the built-in function :func:" -"`ord`) of their characters. [#]_" +"numerical Unicode code points (the result of the built-in " +"function :func:`ord`) of their characters. [#]_" msgstr "" "文字列 (:class:`str` のインスタンス) の比較は、文字の Unicode のコードポイン" "トの数としての値 (組み込み関数 :func:`ord` の返り値) を使った辞書式順序で行わ" @@ -2155,13 +2286,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 "" @@ -2222,9 +2356,9 @@ msgid "" "Those relations do not define total orderings (for example, the two sets " "``{1,2}`` and ``{2,3}`` are not equal, nor subsets of one another, nor " "supersets of one another). Accordingly, sets are not appropriate arguments " -"for functions which depend on total ordering (for example, :func:`min`, :" -"func:`max`, and :func:`sorted` produce undefined results given a list of " -"sets as inputs)." +"for functions which depend on total ordering (for " +"example, :func:`min`, :func:`max`, and :func:`sorted` produce undefined " +"results given a list of sets as inputs)." msgstr "" "集合には、部分集合あるいは上位集合かどうかを基準とする順序比較が定義されてい" "ます。\n" @@ -2329,8 +2463,8 @@ msgstr "``x > y`` と ``not x <= y`` (全順序の場合)" #: ../../reference/expressions.rst:1698 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " -"sequences, but not to sets or mappings). See also the :func:`~functools." -"total_ordering` decorator." +"sequences, but not to sets or mappings). See also " +"the :func:`~functools.total_ordering` decorator." msgstr "" "最後の2式は全順序コレクションに当てはまります (たとえばシーケンスには当てはま" "りますが、集合やマッピングには当てはまりません)。\n" @@ -2362,10 +2496,11 @@ msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " "otherwise. ``x not in s`` returns the negation of ``x in s``. All built-in " -"sequences and set types support this as well as dictionary, for which :" -"keyword:`!in` tests whether the dictionary has a given key. For container " -"types such as list, tuple, set, frozenset, dict, or collections.deque, the " -"expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." +"sequences and set types support this as well as dictionary, for " +"which :keyword:`!in` tests whether the dictionary has a given key. For " +"container types such as list, tuple, set, frozenset, dict, or " +"collections.deque, the expression ``x in y`` is equivalent to ``any(x is e " +"or x == e for e in y)``." msgstr "" "演算子 :keyword:`in` および :keyword:`not in` は所属関係を調べます。\n" "``x in s`` の評価は、 *x* が *s* の要素であれば ``True`` となり、そうでなけれ" @@ -2388,14 +2523,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,15 +2539,28 @@ msgid "" "while iterating over ``y``. If an exception is raised during the iteration, " "it is as if :keyword:`in` raised that exception." msgstr "" - -#: ../../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-" -"negative integer index *i* such that ``x is y[i] or x == y[i]``, and no " -"lower integer index raises the :exc:`IndexError` exception. (If any other " -"exception is raised, 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` がその例外を送出したのと" +"同じになります。" + +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-negative integer index *i* such that ``x is y[i] or x == " +"y[i]``, and no 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,22 +2585,27 @@ 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: " "``False``, ``None``, numeric zero of all types, and empty strings and " "containers (including strings, tuples, lists, dictionaries, sets and " "frozensets). All other values are interpreted as true. User-defined " -"objects can customize their truth value by providing a :meth:`~object." -"__bool__` method." +"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 +2652,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`." +"\"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 +2690,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 +2742,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 +2762,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,31 +2790,36 @@ 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 " +"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 " "trailing comma doesn't create a tuple, but rather yields the value of that " "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 +2828,6 @@ msgid "" msgstr "" "以下に示す実行文の各行での評価順序は、添え字の数字順序と同じになります::" -#: ../../reference/expressions.rst:1983 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2671,6 +2836,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 +3036,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 +3046,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 "" @@ -2910,9 +3081,9 @@ msgid "" "LETTER C), followed by a :dfn:`combining character` at code position U+0327 " "(COMBINING CEDILLA)." msgstr "" -"Unicode 標準では、 :dfn:`コードポイント (code point)` (例えば、U+0041) と :" -"dfn:`抽象文字 (abstract character)` (例えば、\"LATIN CAPITAL LETTER A\") を区" -"別します。\n" +"Unicode 標準では、 :dfn:`コードポイント (code point)` (例えば、U+0041) " +"と :dfn:`抽象文字 (abstract character)` (例えば、\"LATIN CAPITAL LETTER A\") " +"を区別します。\n" "Unicode のほとんどの抽象文字は 1 つのコードポイントだけを使って表現されます" "が、複数のコードポイントの列を使っても表現できる抽象文字もたくさんありま" "す。\n" @@ -3015,9 +3186,8 @@ msgstr "例外" msgid "NameError" msgstr "NameError" -#: ../../reference/expressions.rst:81 msgid "mangling" -msgstr "難号化" +msgstr "マングリング" #: ../../reference/expressions.rst:81 msgid "private" @@ -3064,9 +3234,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 +3266,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 +3294,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 +3308,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 +3324,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 +3383,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 +3398,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 +3420,8 @@ msgstr "参照" msgid ". (dot)" msgstr ". (ドット)" -#: ../../reference/expressions.rst:845 msgid "attribute reference" -msgstr "" +msgstr "属性参照" #: ../../reference/expressions.rst:854 msgid "AttributeError" @@ -3343,9 +3495,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 +3556,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 +3625,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 +3807,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 +3831,8 @@ msgstr "条件" msgid "ternary" msgstr "三項" -#: ../../reference/expressions.rst:1872 msgid "conditional expression" -msgstr "" +msgstr "条件式" #: ../../reference/expressions.rst:1872 msgid "else" @@ -3708,17 +3850,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..12cf4c8f3 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 "" @@ -432,10 +430,10 @@ msgid "" " | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" " | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" "slash_with_default[SlashWithDefault*]:\n" -" | a=param_no_default* b=param_with_default+ '/' " -"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=param_no_default* b=param_with_default+ '/' " -"&')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' ',' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' &')' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "star_etc[StarEtc*]:\n" " | invalid_star_etc\n" @@ -473,22 +471,22 @@ msgid "" "param_no_default_star_annotation[arg_ty]:\n" " | a=param_star_annotation ',' tc=TYPE_COMMENT? " "{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" -" | a=param_star_annotation tc=TYPE_COMMENT? " -"&')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? &')' " +"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" "param_with_default[NameDefaultPair*]:\n" " | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " "a, c, tc) }\n" -" | a=param c=default tc=TYPE_COMMENT? " -"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? &')' " +"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" "param_maybe_default[NameDefaultPair*]:\n" " | a=param c=default? ',' tc=TYPE_COMMENT? " "{ _PyPegen_name_default_pair(p, a, c, tc) }\n" -" | a=param c=default? tc=TYPE_COMMENT? " -"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? &')' " +"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" "param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " "EXTRA) }\n" -"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." -"Name.id, b, NULL, EXTRA) }\n" +"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a-" +">v.Name.id, b, NULL, EXTRA) }\n" "annotation[expr_ty]: ':' a=expression { a }\n" "star_annotation[expr_ty]: ':' a=star_expression { a }\n" "default[expr_ty]: '=' a=expression { a } | invalid_default\n" @@ -703,8 +701,8 @@ msgid "" " | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }\n" "\n" "capture_pattern[pattern_ty]:\n" -" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name." -"id, EXTRA) }\n" +" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target-" +">v.Name.id, EXTRA) }\n" "\n" "pattern_capture_target[expr_ty]:\n" " | !\"_\" name=NAME !('.' | '(' | '=') {\n" @@ -728,10 +726,10 @@ msgid "" " | '(' pattern=pattern ')' { pattern }\n" "\n" "sequence_pattern[pattern_ty]:\n" -" | '[' patterns=maybe_sequence_pattern? " -"']' { _PyAST_MatchSequence(patterns, EXTRA) }\n" -" | '(' patterns=open_sequence_pattern? " -"')' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '[' patterns=maybe_sequence_pattern? ']' " +"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? ')' " +"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" "\n" "open_sequence_pattern[asdl_seq*]:\n" " | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" @@ -831,15 +829,15 @@ msgid "" " CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " "are\", t) }\n" "\n" -"type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','." -"type_param+ [','] { a }\n" +"type_param_seq[asdl_type_param_seq*]: " +"a[asdl_type_param_seq*]=','.type_param+ [','] { a }\n" "\n" "type_param[type_param_ty] (memo):\n" " | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" ">v.Name.id, b, c, EXTRA) }\n" " | invalid_type_param\n" -" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v." -"Name.id, b, EXTRA) }\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a-" +">v.Name.id, b, EXTRA) }\n" " | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, " "EXTRA) }\n" "\n" @@ -884,8 +882,8 @@ msgid "" " | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" " | expression\n" "\n" -"star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','." -"star_named_expression+ [','] { a }\n" +"star_named_expressions[asdl_expr_seq*]: " +"a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }\n" "\n" "star_named_expression[expr_ty]:\n" " | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" @@ -1103,10 +1101,10 @@ msgid "" " | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" "\n" "lambda_slash_with_default[SlashWithDefault*]:\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " -"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " -"&':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' " +"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "lambda_star_etc[StarEtc*]:\n" " | invalid_lambda_star_etc\n" @@ -1255,8 +1253,8 @@ msgid "" " | invalid_comprehension\n" "\n" "genexp[expr_ty]:\n" -" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses " -"')' { _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' " +"{ _PyAST_GeneratorExp(a, b, EXTRA) }\n" " | invalid_comprehension\n" "\n" "dictcomp[expr_ty]:\n" @@ -1296,15 +1294,15 @@ msgid "" "kwarg_or_starred[KeywordOrStarred*]:\n" " | invalid_kwarg\n" " | a=NAME '=' b=expression {\n" -" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." -"Name.id, b, EXTRA)), 1) }\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a-" +">v.Name.id, b, EXTRA)), 1) }\n" " | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }\n" "\n" "kwarg_or_double_starred[KeywordOrStarred*]:\n" " | invalid_kwarg\n" " | a=NAME '=' b=expression {\n" -" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." -"Name.id, b, EXTRA)), 1) }\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a-" +">v.Name.id, b, EXTRA)), 1) }\n" " | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, " "_PyAST_keyword(NULL, a, EXTRA)), 1) }\n" "\n" @@ -1336,8 +1334,8 @@ msgid "" " | target_with_star_atom\n" "\n" "target_with_star_atom[expr_ty] (memo):\n" -" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Store, EXTRA) }\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b-" +">v.Name.id, Store, EXTRA) }\n" " | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " "Store, EXTRA) }\n" " | star_atom\n" @@ -1355,14 +1353,14 @@ msgid "" " | '(' a=single_target ')' { a }\n" "\n" "single_subscript_attribute_target[expr_ty]:\n" -" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Store, EXTRA) }\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b-" +">v.Name.id, Store, EXTRA) }\n" " | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " "Store, EXTRA) }\n" "\n" "t_primary[expr_ty]:\n" -" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Load, EXTRA) }\n" +" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b-" +">v.Name.id, Load, EXTRA) }\n" " | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, " "Load, EXTRA) }\n" " | a=t_primary b=genexp &t_lookahead {\n" @@ -1383,8 +1381,8 @@ msgid "" "del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }\n" "\n" "del_target[expr_ty] (memo):\n" -" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." -"id, Del, EXTRA) }\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b-" +">v.Name.id, Del, EXTRA) }\n" " | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " "Del, EXTRA) }\n" " | del_t_atom\n" @@ -1433,8 +1431,9 @@ msgid "" "# From here on, there are rules for invalid syntax with specialised error " "messages\n" "invalid_arguments:\n" -" | ((','.(starred_expression | ( assignment_expression | expression !':" -"=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starred_expression !'=')+ {\n" +" | ((','.(starred_expression | ( assignment_expression | " +"expression !':=') !'=')+ ',' kwargs) | kwargs) a=',' ','." +"(starred_expression !'=')+ {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"iterable argument unpacking " "follows keyword argument unpacking\") }\n" " | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] " @@ -1556,9 +1555,9 @@ msgid "" "annotation\") }\n" " | (star_targets '=')* a=star_expressions '=' {\n" " RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" -" | (star_targets '=')* a=yield_expr " -"'=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression " -"not possible\") }\n" +" | (star_targets '=')* a=yield_expr '=' " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " +"possible\") }\n" " | a=star_expressions augassign annotated_rhs {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" " a,\n" @@ -1619,8 +1618,8 @@ msgid "" "comment\") }\n" " | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (param_no_default | ',') param_maybe_default* " -"a='*' (param_no_default | ',') {\n" +" | '*' (param_no_default | ',') param_maybe_default* a='*' " +"(param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_kwds:\n" @@ -1663,8 +1662,8 @@ msgid "" "must follow bare *\") }\n" " | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* " -"a='*' (lambda_param_no_default | ',') {\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' " +"(lambda_param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_lambda_kwds:\n" diff --git a/reference/import.po b/reference/import.po index feb4a6aef..ebfbfb4b9 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 @@ -34,15 +34,15 @@ msgid "" "Python code in one :term:`module` gains access to the code in another module " "by the process of :term:`importing` it. The :keyword:`import` statement is " "the most common way of invoking the import machinery, but it is not the only " -"way. Functions such as :func:`importlib.import_module` and built-in :func:" -"`__import__` can also be used to invoke the import machinery." +"way. Functions such as :func:`importlib.import_module` and built-" +"in :func:`__import__` can also be used to invoke the import machinery." msgstr "" "ある 1 つの :term:`module` にある Python コードから他のモジュールを :term:`イ" "ンポート ` することで、そこにあるコードへアクセスできるようになり" "ます。 :keyword:`import` 文はインポート機構を動かす最も一般的な方法ですが、そ" -"れが唯一の方法ではありません。 :func:`importlib.import_module` や組み込みの :" -"func:`__import__` といった関数を使っても、インポート機構を動かすことができま" -"す。" +"れが唯一の方法ではありません。 :func:`importlib.import_module` や組み込み" +"の :func:`__import__` といった関数を使っても、インポート機構を動かすことがで" +"きます。" #: ../../reference/import.rst:16 msgid "" @@ -51,8 +51,8 @@ msgid "" "local scope. The search operation of the :keyword:`!import` statement is " "defined as a call to the :func:`__import__` function, with the appropriate " "arguments. The return value of :func:`__import__` is used to perform the " -"name binding operation of the :keyword:`!import` statement. See the :" -"keyword:`!import` statement for the exact details of that name binding " +"name binding operation of the :keyword:`!import` statement. See " +"the :keyword:`!import` statement for the exact details of that name binding " "operation." msgstr "" ":keyword:`import` 文は 2 つの処理を連続して行っています; ある名前のモジュール" @@ -71,22 +71,23 @@ msgid "" "performs a name binding operation." msgstr "" ":func:`__import__` を直接呼び出すとモジュールの検索のみが行われ、見つかった場" -"合、モジュールの作成処理が行われます。親パッケージのインポートや (:data:`sys." -"modules` を含む) 様々なキャッシュの更新などの副作用は起きるかもしれません" -"が、 :keyword:`import` 文のみが名前束縛処理を行います。" +"合、モジュールの作成処理が行われます。親パッケージのインポートや " +"(:data:`sys.modules` を含む) 様々なキャッシュの更新などの副作用は起きるかもし" +"れませんが、 :keyword:`import` 文のみが名前束縛処理を行います。" #: ../../reference/import.rst:31 msgid "" -"When an :keyword:`import` statement is executed, the standard builtin :func:" -"`__import__` function is called. Other mechanisms for invoking the import " -"system (such as :func:`importlib.import_module`) may choose to bypass :func:" -"`__import__` and use their own solutions to implement import semantics." +"When an :keyword:`import` statement is executed, the standard " +"builtin :func:`__import__` function is called. Other mechanisms for invoking " +"the import system (such as :func:`importlib.import_module`) may choose to " +"bypass :func:`__import__` and use their own solutions to implement import " +"semantics." msgstr "" -":keyword:`import` 文が実行されるときには、標準の組み込み関数 :func:" -"`__import__` が呼ばれます。インポートシステムを呼び出すその他の (:func:" -"`importlib.import_module` 関数のような) メカニズムは、:func:`__import__` の" -"呼び出しをバイパスして独自のインポート・セマンティクスを実装している可能性が" -"あります。" +":keyword:`import` 文が実行されるときには、標準の組み込み関" +"数 :func:`__import__` が呼ばれます。インポートシステムを呼び出すその他の " +"(:func:`importlib.import_module` 関数のような) メカニズム" +"は、:func:`__import__` の呼び出しをバイパスして独自のインポート・セマンティク" +"スを実装している可能性があります。" #: ../../reference/import.rst:36 msgid "" @@ -106,15 +107,15 @@ msgstr "" #: ../../reference/import.rst:43 msgid "" -"The import system has been updated to fully implement the second phase of :" -"pep:`302`. There is no longer any implicit import machinery - the full " +"The import system has been updated to fully implement the second phase " +"of :pep:`302`. There is no longer any implicit import machinery - the full " "import system is exposed through :data:`sys.meta_path`. In addition, native " "namespace package support has been implemented (see :pep:`420`)." msgstr "" "インポートシステムが :pep:`302` の第 2 フェーズの完全な実装へ更新されました。" -"もはや暗黙的なインポート機構はありません - インポート機構全体は :data:`sys." -"meta_path` を通して公開されています。加えて、ネイティブの名前空間パッケージの" -"サポートは実装されています (:pep:`420` を参照) 。" +"もはや暗黙的なインポート機構はありません - インポート機構全体" +"は :data:`sys.meta_path` を通して公開されています。加えて、ネイティブの名前空" +"間パッケージのサポートは実装されています (:pep:`420` を参照) 。" #: ../../reference/import.rst:51 msgid ":mod:`importlib`" @@ -147,8 +148,8 @@ msgid "" msgstr "" "Python にはモジュールオブジェクトの種類は 1 種類しかなく、 Python 、 C 、それ" "以外のもののどれで実装されているかに関係なく、すべてのモジュールはこの種類に" -"なります。モジュールの組織化を助け、名前階層を提供するために、 Python には :" -"term:`パッケージ ` という概念があります。" +"なります。モジュールの組織化を助け、名前階層を提供するために、 Python に" +"は :term:`パッケージ ` という概念があります。" #: ../../reference/import.rst:72 msgid "" @@ -188,10 +189,10 @@ msgid "" "called :mod:`email.mime.text`." msgstr "" "すべてのモジュールは名前を持ちます。Python の属性アクセスの文法と同様に、サブ" -"パッケージの名前は親パッケージ名とドット記号で区切られます。したがって、:mod:" -"`email` という名前のパッケージや、それが含む :mod:`email.mime` という名前のサ" -"ブパッケージ、さらにそれに含まれる :mod:`email.mime.text` と言う名前のモ" -"ジュールを考えることができます。" +"パッケージの名前は親パッケージ名とドット記号で区切られます。したがっ" +"て、:mod:`email` という名前のパッケージや、それが含む :mod:`email.mime` とい" +"う名前のサブパッケージ、さらにそれに含まれる :mod:`email.mime.text` と言う名" +"前のモジュールを考えることができます。" #: ../../reference/import.rst:93 msgid "Regular packages" @@ -203,11 +204,11 @@ msgid "" "package>` and :term:`namespace packages `. Regular " "packages are traditional packages as they existed in Python 3.2 and earlier. " "A regular package is typically implemented as a directory containing an " -"``__init__.py`` file. When a regular package is imported, this ``__init__." -"py`` file is implicitly executed, and the objects it defines are bound to " -"names in the package's namespace. The ``__init__.py`` file can contain the " -"same Python code that any other module can contain, and Python will add some " -"additional attributes to the module when it is imported." +"``__init__.py`` file. When a regular package is imported, this " +"``__init__.py`` file is implicitly executed, and the objects it defines are " +"bound to names in the package's namespace. The ``__init__.py`` file can " +"contain the same Python code that any other module can contain, and Python " +"will add some additional attributes to the module when it is imported." msgstr "" "Python では、 :term:`通常のパッケージ ` と :term:`名前空間" "パッケージ ` の 2 種類のパッケージが定義されています。通常" @@ -227,7 +228,6 @@ msgstr "" "例えば、以下のようなファイルシステム配置は、3 つのサブパッケージを持つ最上位" "の ``parent`` パッケージを定義します::" -#: ../../reference/import.rst:111 msgid "" "parent/\n" " __init__.py\n" @@ -238,6 +238,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 "" @@ -247,15 +255,14 @@ msgid "" "__init__.py`` respectively." msgstr "" "``parent.one`` をインポートすると暗黙的に ``parent/__init__.py`` と ``parent/" -"one/__init__.py`` が実行されます。その後に ``parent.two`` もしくは ``parent." -"three`` をインポートすると、それぞれ ``parent/two/__init__.py`` や ``parent/" -"three/__init__.py`` が実行されます。" +"one/__init__.py`` が実行されます。その後に ``parent.two`` もしくは " +"``parent.three`` をインポートすると、それぞれ ``parent/two/__init__.py`` や " +"``parent/three/__init__.py`` が実行されます。" #: ../../reference/import.rst:129 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 +272,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 "" @@ -329,15 +336,15 @@ msgstr "" msgid "" "This name will be used in various phases of the import search, and it may be " "the dotted path to a submodule, e.g. ``foo.bar.baz``. In this case, Python " -"first tries to import ``foo``, then ``foo.bar``, and finally ``foo.bar." -"baz``. If any of the intermediate imports fail, a :exc:`ModuleNotFoundError` " -"is raised." +"first tries to import ``foo``, then ``foo.bar``, and finally " +"``foo.bar.baz``. If any of the intermediate imports fail, " +"a :exc:`ModuleNotFoundError` is raised." msgstr "" -"この名前はインポート検索の様々なフェーズで使われ、これは例えば ``foo.bar." -"baz`` のようなドットで区切られたサブモジュールへのパスだったりします。この場" -"合、 Python は最初に ``foo`` を、次に ``foo.bar`` 、そして最後に ``foo.bar." -"baz`` をインポートしようとします。中間のいずれかのインポートに失敗した場合" -"は、 :exc:`ModuleNotFoundError` が送出されます。" +"この名前はインポート検索の様々なフェーズで使われ、これは例えば " +"``foo.bar.baz`` のようなドットで区切られたサブモジュールへのパスだったりしま" +"す。この場合、 Python は最初に ``foo`` を、次に ``foo.bar`` 、そして最後に " +"``foo.bar.baz`` をインポートしようとします。中間のいずれかのインポートに失敗" +"した場合は、 :exc:`ModuleNotFoundError` が送出されます。" #: ../../reference/import.rst:175 msgid "The module cache" @@ -354,17 +361,18 @@ msgid "" msgstr "" "インポート検索で最初に調べる場所は :data:`sys.modules` です。このマッピング" "は、中間のパスを含む、これまでにインポートされたすべてのモジュールのキャッ" -"シュを提供します。なので ``foo.bar.baz`` がインポート済みの場合、 :data:`sys." -"modules` は ``foo`` 、 ``foo.bar`` 、 ``foo.bar.baz`` のエントリーを含みま" -"す。それぞれのキーはその値として対応するモジュールオブジェクトを持ちます。" +"シュを提供します。なので ``foo.bar.baz`` がインポート済みの場" +"合、 :data:`sys.modules` は ``foo`` 、 ``foo.bar`` 、 ``foo.bar.baz`` のエン" +"トリーを含みます。それぞれのキーはその値として対応するモジュールオブジェクト" +"を持ちます。" #: ../../reference/import.rst:187 msgid "" "During import, the module name is looked up in :data:`sys.modules` and if " "present, the associated value is the module satisfying the import, and the " -"process completes. However, if the value is ``None``, then a :exc:" -"`ModuleNotFoundError` is raised. If the module name is missing, Python will " -"continue searching for the module." +"process completes. However, if the value is ``None``, then " +"a :exc:`ModuleNotFoundError` is raised. If the module name is missing, " +"Python will continue searching for the module." msgstr "" "インポートではモジュール名は :data:`sys.modules` から探され、存在した場合は、" "対応する値がインポートされるべきモジュールであり、この処理は完了します。しか" @@ -377,8 +385,8 @@ msgid "" "associated module (as other modules may hold references to it), but it will " "invalidate the cache entry for the named module, causing Python to search " "anew for the named module upon its next import. The key can also be assigned " -"to ``None``, forcing the next import of the module to result in a :exc:" -"`ModuleNotFoundError`." +"to ``None``, forcing the next import of the module to result in " +"a :exc:`ModuleNotFoundError`." msgstr "" ":data:`sys.modules` は書き込み可能です。キーの削除は対応するモジュールを破壊" "しない (他のモジュールがそのモジュールへの参照を持っている) かもしれません" @@ -391,9 +399,9 @@ msgstr "" msgid "" "Beware though, as if you keep a reference to the module object, invalidate " "its cache entry in :data:`sys.modules`, and then re-import the named module, " -"the two module objects will *not* be the same. By contrast, :func:`importlib." -"reload` will reuse the *same* module object, and simply reinitialise the " -"module contents by rerunning the module's code." +"the two module objects will *not* be the same. By " +"contrast, :func:`importlib.reload` will reuse the *same* module object, and " +"simply reinitialise the module contents by rerunning the module's code." msgstr "" "たとえモジュールオブジェクトへの参照を保持しておいて、 :data:`sys.modules` に" "キャッシュされたエントリーを無効にし、その指定したモジュールを再インポートし" @@ -410,12 +418,12 @@ msgstr "ファインダーとローダー" msgid "" "If the named module is not found in :data:`sys.modules`, then Python's " "import protocol is invoked to find and load the module. This protocol " -"consists of two conceptual objects, :term:`finders ` and :term:" -"`loaders `. A finder's job is to determine whether it can find the " -"named module using whatever strategy it knows about. Objects that implement " -"both of these interfaces are referred to as :term:`importers ` - " -"they return themselves when they find that they can load the requested " -"module." +"consists of two conceptual objects, :term:`finders ` " +"and :term:`loaders `. A finder's job is to determine whether it can " +"find the named module using whatever strategy it knows about. Objects that " +"implement both of these interfaces are referred to as :term:`importers " +"` - they return themselves when they find that they can load the " +"requested module." msgstr "" ":data:`sys.modules` に指定されたモジュールが見つからなかった場合は、 Python " "のインポートプロトコルが起動され、モジュールを見つけロードします。このプロト" @@ -437,13 +445,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 "" @@ -515,31 +523,40 @@ msgstr "" #: ../../reference/import.rst:269 msgid "" -"Import path hooks are called as part of :data:`sys.path` (or ``package." -"__path__``) processing, at the point where their associated path item is " -"encountered. Import path hooks are registered by adding new callables to :" -"data:`sys.path_hooks` as described below." +"Import path hooks are called as part of :data:`sys.path` (or " +"``package.__path__``) processing, at the point where their associated path " +"item is encountered. Import path hooks are registered by adding new " +"callables to :data:`sys.path_hooks` as described below." msgstr "" "インポートパスフックは、 :data:`sys.path` (もしくは ``package.__path__``) の" "処理の一部として、対応するパス要素を取り扱うところで呼び出されます。インポー" -"トパスフックは以下で解説するように、新しい呼び出し可能オブジェクトを :data:" -"`sys.path_hooks` に追加することで登録されます。" +"トパスフックは以下で解説するように、新しい呼び出し可能オブジェクト" +"を :data:`sys.path_hooks` に追加することで登録されます。" #: ../../reference/import.rst:276 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 " "objects. These finders are queried in order to see if they know how to " -"handle the named module. Meta path finders must implement a method called :" -"meth:`~importlib.abc.MetaPathFinder.find_spec` which takes three arguments: " -"a name, an import path, and (optionally) a target module. The meta path " -"finder can use any strategy it wants to determine whether it can handle the " -"named module or not." -msgstr "" +"handle the named module. Meta path finders must implement a method " +"called :meth:`~importlib.abc.MetaPathFinder.find_spec` which takes three " +"arguments: a name, an import path, and (optionally) a target module. The " +"meta path 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 +573,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 +585,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 "" @@ -577,19 +604,20 @@ msgid "" "importing ``foo.bar.baz`` will first perform a top level import, calling " "``mpf.find_spec(\"foo\", None, None)`` on each meta path finder (``mpf``). " "After ``foo`` has been imported, ``foo.bar`` will be imported by traversing " -"the meta path a second time, calling ``mpf.find_spec(\"foo.bar\", foo." -"__path__, None)``. Once ``foo.bar`` has been imported, the final traversal " -"will call ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)``." +"the meta path a second time, calling ``mpf.find_spec(\"foo.bar\", " +"foo.__path__, None)``. Once ``foo.bar`` has been imported, the final " +"traversal will call ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, " +"None)``." msgstr "" "メタパスは、1 回のインポート要求で複数回走査される可能性があります。例えば、" -"関係するモジュールがどれもまだキャッシュされていないとしたときに ``foo.bar." -"baz`` をインポートすると、最初は各メタパス・ファインダー (``mpf``) に対して " -"``mpf.find_spec(\"foo\", None, None)`` を呼び出して、最上位のインポート処理を" -"行います。``foo`` がインポートされた後に、``mpf.find_spec(\"foo.bar\", foo." -"__path__, None)`` を呼び出していく 2 回目のメタパスの走査が行われ、``foo." -"bar`` がインポートされます。``foo.bar`` のインポートまで行われたら、最後の走" -"査で ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)`` を呼び出して" -"いきます。" +"関係するモジュールがどれもまだキャッシュされていないとしたときに " +"``foo.bar.baz`` をインポートすると、最初は各メタパス・ファインダー (``mpf``) " +"に対して ``mpf.find_spec(\"foo\", None, None)`` を呼び出して、最上位のイン" +"ポート処理を行います。``foo`` がインポートされた後に、" +"``mpf.find_spec(\"foo.bar\", foo.__path__, None)`` を呼び出していく 2 回目の" +"メタパスの走査が行われ、``foo.bar`` がインポートされます。``foo.bar`` のイン" +"ポートまで行われたら、最後の走査で ``mpf.find_spec(\"foo.bar.baz\", " +"foo.bar.__path__, None)`` を呼び出していきます。" #: ../../reference/import.rst:318 msgid "" @@ -601,39 +629,44 @@ 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 " "will continue to work without change, the import machinery will try it only " -"if the finder does not implement :meth:`~importlib.abc.MetaPathFinder." -"find_spec`." +"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`." +"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." +":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" @@ -687,8 +720,8 @@ msgstr "以下の詳細に注意してください:" #: ../../reference/import.rst:381 msgid "" -"If there is an existing module object with the given name in :data:`sys." -"modules`, import will have already returned it." +"If there is an existing module object with the given name " +"in :data:`sys.modules`, import will have already returned it." msgstr "" ":data:`sys.modules` の中に与えられた名前を持つ既存のモジュールオブジェクトが" "あるなら、 import は既にそれを返しているでしょう。" @@ -710,10 +743,10 @@ msgstr "" #: ../../reference/import.rst:390 msgid "" "If loading fails, the failing module -- and only the failing module -- gets " -"removed from :data:`sys.modules`. Any module already in the :data:`sys." -"modules` cache, and any module that was successfully loaded as a side-" -"effect, must remain in the cache. This contrasts with reloading where even " -"the failing module is left in :data:`sys.modules`." +"removed from :data:`sys.modules`. Any module already in " +"the :data:`sys.modules` cache, and any module that was successfully loaded " +"as a side-effect, must remain in the cache. This contrasts with reloading " +"where even the failing module is left in :data:`sys.modules`." msgstr "" "ロード処理に失敗した場合、その失敗したモジュールは -- そして、そのモジュール" "だけが -- :data:`sys.modules` から取り除かれます。 :data:`sys.modules` キャッ" @@ -753,11 +786,11 @@ msgstr "" #: ../../reference/import.rst:408 msgid "" "The import system has taken over the boilerplate responsibilities of " -"loaders. These were previously performed by the :meth:`importlib.abc.Loader." -"load_module` method." +"loaders. These were previously performed by " +"the :meth:`importlib.abc.Loader.load_module` method." msgstr "" -"インポートシステムはローダーの定型的な責任を引き継ぎました。これらは以前は :" -"meth:`importlib.abc.Loader.load_module` メソッドによって実行されました。" +"インポートシステムはローダーの定型的な責任を引き継ぎました。これらは以前" +"は :meth:`importlib.abc.Loader.load_module` メソッドによって実行されました。" #: ../../reference/import.rst:414 msgid "Loaders" @@ -772,8 +805,9 @@ msgid "" msgstr "" "モジュールローダーは、ロードの重要な機能であるモジュール実行機能を提供しま" "す。インポート機構は、実行しようとするモジュールオブジェクトを単一の引数とし" -"て :meth:`importlib.abc.Loader.exec_module` メソッドを呼び出します。 :meth:" -"`importlib.abc.Loader.exec_module` から返された任意の値は無視されます。" +"て :meth:`importlib.abc.Loader.exec_module` メソッドを呼び出しま" +"す。 :meth:`importlib.abc.Loader.exec_module` から返された任意の値は無視され" +"ます。" #: ../../reference/import.rst:421 msgid "Loaders must satisfy the following requirements:" @@ -789,25 +823,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." +"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 "" @@ -831,13 +864,13 @@ msgstr "ローダーの :meth:`~importlib.abc.Loader.create_module` メソッド #: ../../reference/import.rst:445 msgid "" -"The :meth:`~importlib.abc.Loader.load_module` method was replaced by :meth:" -"`~importlib.abc.Loader.exec_module` and the import machinery assumed all the " -"boilerplate responsibilities of loading." +"The :meth:`~importlib.abc.Loader.load_module` method was replaced " +"by :meth:`~importlib.abc.Loader.exec_module` and the import machinery " +"assumed all the boilerplate responsibilities of loading." msgstr "" -":meth:`~importlib.abc.Loader.load_module` メソッドは :meth:`~importlib.abc." -"Loader.exec_module` によって置き換えられ、インポート機構がロードのすべての定" -"型的な処理を引き受けました。" +":meth:`~importlib.abc.Loader.load_module` メソッド" +"は :meth:`~importlib.abc.Loader.exec_module` によって置き換えられ、インポート" +"機構がロードのすべての定型的な処理を引き受けました。" #: ../../reference/import.rst:450 msgid "" @@ -863,17 +896,17 @@ msgstr "" #: ../../reference/import.rst:459 msgid "" -"If there is an existing module object with the given name in :data:`sys." -"modules`, the loader must use that existing module. (Otherwise, :func:" -"`importlib.reload` will not work correctly.) If the named module does not " -"exist in :data:`sys.modules`, the loader must create a new module object and " -"add it to :data:`sys.modules`." +"If there is an existing module object with the given name " +"in :data:`sys.modules`, the loader must use that existing module. " +"(Otherwise, :func:`importlib.reload` will not work correctly.) If the named " +"module does not exist in :data:`sys.modules`, the loader must create a new " +"module object and add it to :data:`sys.modules`." msgstr "" ":data:`sys.modules` に与えられた名前のモジュールが存在している場合、ローダー" -"はその既存のモジュールを使わなければいけません。 (そうしないと :func:" -"`importlib.reload` は正しく動かないでしょう。) 指定されたモジュールが :data:" -"`sys.modules` に存在しない場合、ローダーは新しいモジュールオブジェクトを作成" -"し、 :data:`sys.modules` に追加しなければいけません。" +"はその既存のモジュールを使わなければいけません。 (そうしない" +"と :func:`importlib.reload` は正しく動かないでしょう。) 指定されたモジュール" +"が :data:`sys.modules` に存在しない場合、ローダーは新しいモジュールオブジェク" +"トを作成し、 :data:`sys.modules` に追加しなければいけません。" #: ../../reference/import.rst:465 msgid "" @@ -886,9 +919,9 @@ msgstr "" #: ../../reference/import.rst:469 msgid "" -"If loading fails, the loader must remove any modules it has inserted into :" -"data:`sys.modules`, but it must remove **only** the failing module(s), and " -"only if the loader itself has loaded the module(s) explicitly." +"If loading fails, the loader must remove any modules it has inserted " +"into :data:`sys.modules`, but it must remove **only** the failing module(s), " +"and only if the loader itself has loaded the module(s) explicitly." msgstr "" "ロード処理に失敗した場合、ローダーは :data:`sys.modules` に追加したモジュール" "を取り除かなければいけませんが、それはロードに失敗したモジュール **のみ** " @@ -936,20 +969,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 +993,6 @@ msgstr "" "このとき、以下を実行することにより ``spam`` モジュールの中に ``foo`` と " "``Foo`` に束縛された名前が置かれます::" -#: ../../reference/import.rst:506 msgid "" ">>> import spam\n" ">>> spam.foo\n" @@ -967,24 +1000,28 @@ msgid "" ">>> spam.Foo\n" "" msgstr "" +">>> import spam\n" +">>> spam.foo\n" +"\n" +">>> spam.Foo\n" +"" #: ../../reference/import.rst:512 msgid "" "Given Python's familiar name binding rules this might seem surprising, but " "it's actually a fundamental feature of the import system. The invariant " -"holding is that if you have ``sys.modules['spam']`` and ``sys.modules['spam." -"foo']`` (as you would after the above import), the latter must appear as the " -"``foo`` attribute of the former." +"holding is that if you have ``sys.modules['spam']`` and " +"``sys.modules['spam.foo']`` (as you would after the above import), the " +"latter must appear as the ``foo`` attribute of the former." msgstr "" "Python の慣れ親しんだ名前束縛ルールからするとこれは驚きかもしれませんが、それ" "は実際インポートシステムの基本的な機能です。不変に保たなければならないのは " -"(上記のインポートの後などで) ``sys.modules['spam']`` と ``sys.modules['spam." -"foo']`` が存在する場合、後者が前者の ``foo`` 属性として存在しなければならない" -"ということです。" +"(上記のインポートの後などで) ``sys.modules['spam']`` と " +"``sys.modules['spam.foo']`` が存在する場合、後者が前者の ``foo`` 属性として存" +"在しなければならないということです。" -#: ../../reference/import.rst:521 msgid "Module specs" -msgstr "" +msgstr "モジュール仕様" #: ../../reference/import.rst:523 msgid "" @@ -1012,57 +1049,80 @@ 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 `." +"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`." +"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 :" -"data:`sys.path`, i.e. providing a list of locations to search for modules " -"during import. However, :attr:`!__path__` is typically much more constrained " -"than :data:`!sys.path`." +"subpackages. Within the import machinery, it functions much the same " +"as :data:`sys.path`, i.e. providing a list of locations to search for " +"modules 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 " -"packages were implemented prior to :pep:`420`. With the adoption of :pep:" -"`420`, namespace packages no longer need to supply ``__init__.py`` files " -"containing only :attr:`!__path__` manipulation code; the import machinery " -"automatically sets :attr:`!__path__` correctly for the namespace package." +"A package's ``__init__.py`` file may set or alter the " +"package's :attr:`~module.__path__` attribute, and this was typically the way " +"namespace packages were implemented prior to :pep:`420`. With the adoption " +"of :pep:`420`, namespace packages no longer need to supply ``__init__.py`` " +"files 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" @@ -1083,16 +1143,16 @@ msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " "system will craft a default repr using whatever information is available on " -"the module. It will try to use the ``module.__name__``, ``module." -"__file__``, and ``module.__loader__`` as input into the repr, with defaults " -"for whatever information is missing." +"the module. It will try to use the ``module.__name__``, " +"``module.__file__``, and ``module.__loader__`` as input into the repr, with " +"defaults for whatever information is missing." msgstr "" "もしモジュールが仕様 (``__spec__``) を持っていれば、インポート機構はそこから " "repr を生成しようとします。もしそれが失敗するか、または仕様が存在しなければ、" "インポートシステムはモジュールで入手可能なあらゆる情報を使ってデフォルトの " -"repr を構築します。それは ``module.__name__``, ``module.__file__``, ``module." -"__loader__`` を (足りない情報についてはデフォルト値を使って補いながら) repr " -"への入力として使おうと試みます。" +"repr を構築します。それは ``module.__name__``, ``module.__file__``, " +"``module.__loader__`` を (足りない情報についてはデフォルト値を使って補いなが" +"ら) repr への入力として使おうと試みます。" #: ../../reference/import.rst:588 msgid "Here are the exact rules used:" @@ -1128,18 +1188,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,26 +1209,46 @@ 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 " -"hash-based ``.pyc`` files: checked and unchecked. For checked hash-based ``." -"pyc`` files, Python validates the cache file by hashing the source file and " -"comparing the resulting hash with the hash in the cache file. If a checked " -"hash-based cache file is found to be invalid, Python regenerates it and " -"writes a new checked hash-based cache file. For unchecked hash-based ``." -"pyc`` files, Python simply assumes the cache file is valid if it exists. " -"Hash-based ``.pyc`` files validation behavior may be overridden with the :" -"option:`--check-hash-based-pycs` flag." -msgstr "" +"hash-based ``.pyc`` files: checked and unchecked. For checked hash-based " +"``.pyc`` files, Python validates the cache file by hashing the source file " +"and comparing the resulting hash with the hash in the cache file. If a " +"checked hash-based cache file is found to be invalid, Python regenerates it " +"and writes a new checked hash-based cache file. For unchecked hash-based " +"``.pyc`` files, Python simply assumes the cache file is valid if it exists. " +"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" @@ -1176,10 +1257,10 @@ msgstr "パスベース・ファインダー" #: ../../reference/import.rst:641 msgid "" "As mentioned previously, Python comes with several default meta path " -"finders. One of these, called the :term:`path based finder` (:class:" -"`~importlib.machinery.PathFinder`), searches an :term:`import path`, which " -"contains a list of :term:`path entries `. Each path entry names " -"a location to search for modules." +"finders. One of these, called the :term:`path based finder` " +"(:class:`~importlib.machinery.PathFinder`), searches an :term:`import path`, " +"which contains a list of :term:`path entries `. Each path entry " +"names a location to search for modules." msgstr "" "上で触れた通り、 Python にはいくつかのデフォルトのメタパス・ファインダーが備" "わっています。そのうちの 1 つは :term:`パスベース・ファインダー ` を返" -"します。このプロトコルは web からモジュールのローダーを取得するのに使われま" +"パスベース・ファインダーは、検索できるパスエントリの種類を拡張・カスタマイズ" +"するための追加のフックやプロトコルを提供します。\n" +"例えば、ネットワーク上の URL をパスエントリとしてサポートするには、HTTP の処" +"理を実装してウェブ上のモジュールを探すフックを書けます。\n" +"このフック (呼び出し可能オブジェクト) は、後述するプロトコルをサポートし" +"た :term:`パスエントリ・ファインダー ` を返します。\n" +"そのファインダーを使って、ウェブからモジュールをロードするローダーを取得しま" "す。" #: ../../reference/import.rst:670 msgid "" "A word of warning: this section and the previous both use the term *finder*, " -"distinguishing between them by using the terms :term:`meta path finder` and :" -"term:`path entry finder`. These two types of finders are very similar, " +"distinguishing between them by using the terms :term:`meta path finder` " +"and :term:`path entry finder`. These two types of finders are very similar, " "support similar protocols, and function in similar ways during the import " "process, but it's important to keep in mind that they are subtly different. " "In particular, meta path finders operate at the beginning of the import " @@ -1291,10 +1371,10 @@ msgstr "" #: ../../reference/import.rst:698 msgid "" -"As a meta path finder, the :term:`path based finder` implements the :meth:" -"`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " -"however it exposes additional hooks that can be used to customize how " -"modules are found and loaded from the :term:`import path`." +"As a meta path finder, the :term:`path based finder` implements " +"the :meth:`~importlib.abc.MetaPathFinder.find_spec` protocol previously " +"described, however it exposes additional hooks that can be used to customize " +"how modules are found and loaded from the :term:`import path`." msgstr "" "メタパス・ファインダーとして、 :term:`パスベース・ファインダー ` には前に解説した :meth:`~importlib.abc.MetaPathFinder.find_spec` プ" @@ -1304,38 +1384,48 @@ msgstr "" #: ../../reference/import.rst:703 msgid "" -"Three variables are used by the :term:`path based finder`, :data:`sys." -"path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " -"``__path__`` attributes on package objects are also used. These provide " -"additional ways that the import machinery can be customized." +"Three variables are used by the :term:`path based " +"finder`, :data:`sys.path`, :data:`sys.path_hooks` " +"and :data:`sys.path_importer_cache`. The ``__path__`` attributes on package " +"objects are also used. These provide additional ways that the import " +"machinery can be customized." msgstr "" -":term:`パスベース・ファインダー ` は :data:`sys.path` 、 :" -"data:`sys.path_hooks` 、 :data:`sys.path_importer_cache` という 3 つの変数を" -"使います。さらにパッケージオブジェクトの ``__path__`` 属性も使います。これら" -"によって、インポート処理をカスタマイズする方法が提供されます。" +":term:`パスベース・ファインダー ` " +"は :data:`sys.path` 、 :data:`sys.path_hooks` 、 :data:`sys.path_importer_cache` " +"という 3 つの変数を使います。さらにパッケージオブジェクトの ``__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` " "environment variable and various other installation- and implementation-" "specific defaults. Entries in :data:`sys.path` can name directories on the " -"file system, zip files, and potentially other \"locations\" (see the :mod:" -"`site` module) that should be searched for modules, such as URLs, or " -"database queries. Only strings should be present on :data:`sys.path`; all " -"other data types are ignored." -msgstr "" +"file system, zip files, and potentially other \"locations\" (see " +"the :mod:`site` module) that should be searched for modules, such as URLs, " +"or 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 "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " "finder's :meth:`~importlib.machinery.PathFinder.find_spec` method as " -"described previously. When the ``path`` argument to :meth:`~importlib." -"machinery.PathFinder.find_spec` is given, it will be a list of string paths " -"to traverse - typically a package's ``__path__`` attribute for an import " -"within that package. If the ``path`` argument is ``None``, this indicates a " -"top level import and :data:`sys.path` is used." +"described previously. When the ``path`` argument " +"to :meth:`~importlib.machinery.PathFinder.find_spec` is given, it will be a " +"list of string paths to traverse - typically a package's ``__path__`` " +"attribute for an import within that package. If the ``path`` argument is " +"``None``, this indicates a top level import and :data:`sys.path` is used." msgstr "" ":term:`パスベース・ファインダー ` は :term:`メタパス・ファ" "インダー ` なので、インポート機構は、前で解説したパスベー" @@ -1344,82 +1434,95 @@ msgstr "" "``path`` 引数が :meth:`~importlib.machinery.PathFinder.find_spec` に渡された" "ときは、それは走査するパス文字列のリスト - 典型的にはそのパッケージの中でイン" "ポートしているパッケージの ``__path__`` 属性になります。 ``path`` 引数が " -"``None`` だった場合、それは最上位のインポートであることを示していて、 :data:" -"`sys.path` が使われます。" +"``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:" -"`~importlib.abc.PathEntryFinder`) for the path entry. Because this can be " -"an expensive operation (e.g. there may be ``stat()`` call overheads for this " -"search), the path based finder maintains a cache mapping path entries to " -"path entry finders. This cache is maintained in :data:`sys." -"path_importer_cache` (despite the name, this cache actually stores finder " -"objects rather than being limited to :term:`importer` objects). In this way, " -"the expensive search for a particular :term:`path entry` location's :term:" -"`path entry finder` need only be done once. User code is free to remove " -"cache entries from :data:`sys.path_importer_cache` forcing the path based " -"finder to perform the path entry search again." -msgstr "" +"each of these, looks for an appropriate :term:`path entry finder` " +"(:class:`~importlib.abc.PathEntryFinder`) for the path entry. Because this " +"can be an expensive operation (e.g. there may be ``stat()`` call overheads " +"for this search), the path based finder maintains a cache mapping path " +"entries to path entry finders. This cache is maintained " +"in :data:`sys.path_importer_cache` (despite the name, this cache actually " +"stores finder objects rather than being limited to :term:`importer` " +"objects). In this way, the expensive search for a particular :term:`path " +"entry` location's :term:`path entry finder` need only be done once. User " +"code is free to remove 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:" -"`path entry hooks ` in this list is called with a single " -"argument, the path entry to be searched. This callable may either return a :" -"term:`path entry finder` that can handle the path entry, or it may raise :" -"exc:`ImportError`. An :exc:`ImportError` is used by the path based finder " -"to signal that the hook cannot find a :term:`path entry finder` for that :" -"term:`path entry`. The exception is ignored and :term:`import path` " +"iterates over every callable in :data:`sys.path_hooks`. Each of " +"the :term:`path entry hooks ` in this list is called with a " +"single argument, the path entry to be searched. This callable may either " +"return a :term:`path entry finder` that can handle the path entry, or it may " +"raise :exc:`ImportError`. An :exc:`ImportError` is used by the path based " +"finder to signal that the hook cannot find a :term:`path entry finder` for " +"that :term:`path entry`. The exception is ignored and :term:`import path` " "iteration continues. The hook should expect either a string or bytes " "object; the encoding of bytes objects is up to the hook (e.g. it may be a " "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 "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " -"being returned, then the path based finder's :meth:`~importlib.machinery." -"PathFinder.find_spec` method will store ``None`` in :data:`sys." -"path_importer_cache` (to indicate that there is no finder for this path " -"entry) and return ``None``, indicating that this :term:`meta path finder` " -"could not find the module." +"being returned, then the path based " +"finder's :meth:`~importlib.machinery.PathFinder.find_spec` method will store " +"``None`` in :data:`sys.path_importer_cache` (to indicate that there is no " +"finder for this path entry) and return ``None``, indicating that " +"this :term:`meta path finder` could not find the module." msgstr "" ":data:`sys.path_hooks` を辿る処理が :term:`パスエントリ・ファインダー ` を何も返さずに終わった場合、パスベース・ファインダーの :meth:" -"`~importlib.machinery.PathFinder.find_spec` メソッドは、 :data:`sys." -"path_importer_cache` に (このパスエントリに対するファインダーが存在しないこと" -"を示すために) ``None`` を保存し、 :term:`メタパス・ファインダー ` はモジュールが見つからなかったことを伝えるために ``None`` を返しま" -"す。" +"entry finder>` を何も返さずに終わった場合、パスベース・ファインダー" +"の :meth:`~importlib.machinery.PathFinder.find_spec` メソッド" +"は、 :data:`sys.path_importer_cache` に (このパスエントリに対するファインダー" +"が存在しないことを示すために) ``None`` を保存し、 :term:`メタパス・ファイン" +"ダー ` はモジュールが見つからなかったことを伝えるために " +"``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 "" @@ -1428,9 +1531,9 @@ msgid "" "current working directory cannot be determined or is found not to exist, no " "value is stored in :data:`sys.path_importer_cache`. Second, the value for " "the current working directory is looked up fresh for each module lookup. " -"Third, the path used for :data:`sys.path_importer_cache` and returned by :" -"meth:`importlib.machinery.PathFinder.find_spec` will be the actual current " -"working directory and not the empty string." +"Third, the path used for :data:`sys.path_importer_cache` and returned " +"by :meth:`importlib.machinery.PathFinder.find_spec` will be the actual " +"current working directory and not the empty string." msgstr "" #: ../../reference/import.rst:775 @@ -1448,32 +1551,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." +"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 +1593,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 +1635,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" @@ -1546,9 +1655,9 @@ msgid "" "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -"インポートシステム全体を置き換えるための最も信頼性のある仕組みは、 :data:" -"`sys.meta_path` のデフォルトの内容を削除し、全部をカスタムのメタパスフックで" -"置き換えるものです。" +"インポートシステム全体を置き換えるための最も信頼性のある仕組み" +"は、 :data:`sys.meta_path` のデフォルトの内容を削除し、全部をカスタムのメタパ" +"スフックで置き換えるものです。" #: ../../reference/import.rst:835 msgid "" @@ -1563,35 +1672,36 @@ 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 " -"sufficient to raise :exc:`ModuleNotFoundError` directly from :meth:" -"`~importlib.abc.MetaPathFinder.find_spec` instead of returning ``None``. The " -"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`` を返すのはメタパス" -"の走査を続けるべきであることを意味しますが、例外を送出するとすぐに走査を打ち" -"切ります。" - -#: ../../reference/import.rst:851 +"sufficient to raise :exc:`ModuleNotFoundError` directly " +"from :meth:`~importlib.abc.MetaPathFinder.find_spec` instead of returning " +"``None``. The latter indicates that the meta path search should continue, " +"while raising an exception terminates it immediately." +msgstr "" +"標準のインポートシステム全体を無効にせず、一部のモジュールのインポートだけを" +"防ぐには、メタパスの先頭に近い位置にあるフックで処理します。\n" +":meth:`~importlib.abc.MetaPathFinder.find_spec` から ``None`` を返す代わり" +"に、直接 :exc:`ModuleNotFoundError` を送出すれば十分です。\n" +"``None`` はメタパスの検索を続けることを意味しますが、例外を送出すると検索は直" +"ちに終了します。" + 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 +1714,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 +1740,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__" @@ -1646,9 +1775,9 @@ msgstr "__main__ に対する特別な考慮" msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere `, the ``__main__`` module is " -"directly initialized at interpreter startup, much like :mod:`sys` and :mod:" -"`builtins`. However, unlike those two, it doesn't strictly qualify as a " -"built-in module. This is because the manner in which ``__main__`` is " +"directly initialized at interpreter startup, much like :mod:`sys` " +"and :mod:`builtins`. However, unlike those two, it doesn't strictly qualify " +"as a built-in module. This is because the manner in which ``__main__`` is " "initialized depends on the flags and other options with which the " "interpreter is invoked." msgstr "" @@ -1687,14 +1816,14 @@ msgstr "" #: ../../reference/import.rst:915 msgid "" -"In :ref:`the remaining cases ` ``__main__." -"__spec__`` is set to ``None``, as the code used to populate the :mod:" -"`__main__` does not correspond directly with an importable module:" +"In :ref:`the remaining cases ` " +"``__main__.__spec__`` is set to ``None``, as the code used to populate " +"the :mod:`__main__` does not correspond directly with an importable module:" msgstr "" -":ref:`それ以外のケース ` では、 ``__main__." -"__spec__`` は ``None`` に設定されます。これは、 :mod:`__main__` を生成 " -"(populate) するために使われたコードがインポート可能なモジュールと直接一致して" -"いないためです:" +":ref:`それ以外のケース ` では、 " +"``__main__.__spec__`` は ``None`` に設定されます。これは、 :mod:`__main__` を" +"生成 (populate) するために使われたコードがインポート可能なモジュールと直接一" +"致していないためです:" #: ../../reference/import.rst:919 msgid "interactive prompt" @@ -1716,13 +1845,13 @@ msgstr "ソースファイルやバイトコードファイルから直接起動 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " -"the :option:`-m` switch if valid module metadata is desired in :mod:" -"`__main__`." +"the :option:`-m` switch if valid module metadata is desired " +"in :mod:`__main__`." msgstr "" "最後のケースでは、たとえ技術的にはファイルがモジュールとして直接インポートで" "きた *としても* ``__main__.__spec__`` は常に ``None`` になることに注意してく" -"ださい。もし :mod:`__main__` において有効なモジュールメタデータが必要なら :" -"option:`-m` スイッチを使ってください。" +"ださい。もし :mod:`__main__` において有効なモジュールメタデータが必要な" +"ら :option:`-m` スイッチを使ってください。" #: ../../reference/import.rst:929 msgid "" @@ -1734,10 +1863,10 @@ msgid "" msgstr "" "``__main__`` がインポート可能なモジュールと一致し、 ``__main__.__spec__`` が" "それに応じて設定されていたとしても、それでもなお、この 2 つのモジュールは別物" -"とみなされることに注意してください。これは、 ``if __name__ == \"__main__\":" -"`` チェックによって保証されるブロックは、 ``__main__`` 名前空間を生成 " -"(populate) するためにモジュールが使用される時にだけ実行され、通常のインポート" -"時には実行されない、という事実に起因しています。" +"とみなされることに注意してください。これは、 ``if __name__ == " +"\"__main__\":`` チェックによって保証されるブロックは、 ``__main__`` 名前空間" +"を生成 (populate) するためにモジュールが使用される時にだけ実行され、通常のイ" +"ンポート時には実行されない、という事実に起因しています。" #: ../../reference/import.rst:937 msgid "References" @@ -1763,12 +1892,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 "" @@ -1818,10 +1950,11 @@ msgstr ":class:`types.ModuleType` を参照してください。" #: ../../reference/import.rst:970 msgid "" "The importlib implementation avoids using the return value directly. " -"Instead, it gets the module object by looking the module name up in :data:" -"`sys.modules`. The indirect effect of this is that an imported module may " -"replace itself in :data:`sys.modules`. This is implementation-specific " -"behavior that is not guaranteed to work in other Python implementations." +"Instead, it gets the module object by looking the module name up " +"in :data:`sys.modules`. The indirect effect of this is that an imported " +"module may replace itself in :data:`sys.modules`. This is implementation-" +"specific behavior that is not guaranteed to work in other Python " +"implementations." msgstr "" "importlib の実装は、戻り値を直接使うことは避けています。その代わりに、モ" "ジュール名を調べて :data:`sys.modules` からモジュールオブジェクトを得ます。こ" @@ -1898,9 +2031,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..23ec8909a 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 @@ -131,8 +131,8 @@ msgid "" "Python implemented in Java. This implementation can be used as a scripting " "language for Java applications, or can be used to create applications using " "the Java class libraries. It is also often used to create tests for Java " -"libraries. More information can be found at `the Jython website `_." +"libraries. More information can be found at `the Jython website `_." msgstr "" "Javaで実装されたPythonです。この実装はJavaアプリケーションのためのスクリプト" "言語として、もしくはJavaクラスライブラリを使ったアプリケーションを作成するた" @@ -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" @@ -235,8 +234,8 @@ msgstr "" #: ../../reference/introduction.rst:106 msgid "" -"Each rule begins with a name (which is the name defined by the rule) and ``::" -"=``. A vertical bar (``|``) is used to separate alternatives; it is the " +"Each rule begins with a name (which is the name defined by the rule) and " +"``::=``. A vertical bar (``|``) is used to separate alternatives; it is the " "least binding operator in this notation. A star (``*``) means zero or more " "repetitions of the preceding item; likewise, a plus (``+``) means one or " "more repetitions, and a phrase enclosed in square brackets (``[ ]``) means " @@ -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..6f1ad4992 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 @@ -36,18 +36,18 @@ msgstr "字句解析" #: ../../reference/lexical_analysis.rst:10 msgid "" -"A Python program is read by a *parser*. Input to the parser is a stream of :" -"term:`tokens `, generated by the *lexical analyzer* (also known as " -"the *tokenizer*). This chapter describes how the lexical analyzer breaks a " -"file into tokens." +"A Python program is read by a *parser*. Input to the parser is a stream " +"of :term:`tokens `, generated by the *lexical analyzer* (also known " +"as the *tokenizer*). This chapter describes how the lexical analyzer breaks " +"a file into tokens." msgstr "" #: ../../reference/lexical_analysis.rst:15 msgid "" "Python reads program text as Unicode code points; the encoding of a source " -"file can be given by an encoding declaration and defaults to UTF-8, see :pep:" -"`3120` for details. If the source file cannot be decoded, a :exc:" -"`SyntaxError` is raised." +"file can be given by an encoding declaration and defaults to UTF-8, " +"see :pep:`3120` for details. If the source file cannot be decoded, " +"a :exc:`SyntaxError` is raised." msgstr "" "Python はプログラムテキストを Unicode コードポイントとして読み込みます。ソー" "スファイルのエンコーディングはエンコーディング宣言で与えられ、デフォルトは " @@ -68,11 +68,12 @@ msgstr "論理行 (logical line)" #: ../../reference/lexical_analysis.rst:38 msgid "" -"The end of a logical line is represented by the token :data:`~token." -"NEWLINE`. Statements cannot cross logical line boundaries except where :data:" -"`!NEWLINE` is allowed by the syntax (e.g., between statements in compound " -"statements). A logical line is constructed from one or more *physical lines* " -"by following the explicit or implicit *line joining* rules." +"The end of a logical line is represented by the " +"token :data:`~token.NEWLINE`. Statements cannot cross logical line " +"boundaries except where :data:`!NEWLINE` is allowed by the syntax (e.g., " +"between statements in compound statements). A logical line is constructed " +"from one or more *physical lines* by following the explicit or implicit " +"*line joining* rules." msgstr "" #: ../../reference/lexical_analysis.rst:48 @@ -139,36 +140,37 @@ msgid "" "line of its own. If it is the second line, the first line must also be a " "comment-only line. The recommended forms of an encoding expression are ::" msgstr "" -"Python スクリプト中の一行目か二行目にあるコメントが正規表現 " -"``coding[=:]\\s*([-\\w.]+)`` にマッチする場合、コメントはエンコード宣言として" -"処理されます; この表現の最初のグループがソースコードファイルのエンコードを指" -"定します。エンコード宣言は自身の行になければなりません。二行目にある場合、一" -"行目もコメントのみの行でなければなりません。エンコード宣言式として推奨する形" -"式は ::" +"Python スクリプト中の一行目か二行目にあるコメントが正規表現 ``coding[=:]" +"\\s*([-\\w.]+)`` にマッチする場合、コメントはエンコード宣言として処理されま" +"す; この表現の最初のグループがソースコードファイルのエンコードを指定します。" +"エンコード宣言は自身の行になければなりません。二行目にある場合、一行目もコメ" +"ントのみの行でなければなりません。エンコード宣言式として推奨する形式は ::" -#: ../../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 "" @@ -309,20 +321,20 @@ msgid "" "spaces; a :exc:`TabError` is raised in that case." msgstr "" "ソースファイルがタブとスペースを混在させ、その意味づけがタブのスペース換算数" -"に依存するようなら、インデントは不合理なものとして却下されます。その場合は :" -"exc:`TabError` が送出されます。" +"に依存するようなら、インデントは不合理なものとして却下されます。その場合" +"は :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,14 @@ 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." +"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 " @@ -351,11 +364,24 @@ msgid "" "the stack. If it is equal, nothing happens. If it is larger, it is pushed on " "the stack, and one :data:`!INDENT` token is generated. If it is smaller, it " "*must* be one of the numbers occurring on the stack; all numbers on the " -"stack that are larger are popped off, and for each number popped off a :data:" -"`!DEDENT` token is generated. At the end of the file, a :data:`!DEDENT` " -"token is generated for each number remaining on the stack that is larger " -"than zero." -msgstr "" +"stack that are larger are popped off, and for each number popped off " +"a :data:`!DEDENT` token is generated. At the end of the file, a :data:`!" +"DEDENT` 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 +391,6 @@ msgstr "" "以下の例に正しく (しかし当惑させるように) インデントされた Python コードの一" "部を示します::" -#: ../../reference/lexical_analysis.rst:224 msgid "" "def perm(l):\n" " # Compute the list of all permutations of l\n" @@ -379,12 +404,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 +429,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,31 +463,39 @@ 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." +"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 " -"*keywords* (:data:`~token.NAME`), *literals* (such as :data:`~token.NUMBER` " -"and :data:`~token.STRING`), and other symbols (*operators* and " -"*delimiters*, :data:`~token.OP`). Whitespace characters (other than logical " -"line terminators, discussed earlier) are not tokens, but serve to delimit " -"tokens. Where ambiguity exists, a token comprises the longest possible " -"string that forms a legal token, when read from left to right." -msgstr "" +"Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` " +"and :data:`~token.DEDENT`, the following categories of tokens exist: " +"*identifiers* and *keywords* (:data:`~token.NAME`), *literals* (such " +"as :data:`~token.NUMBER` and :data:`~token.STRING`), and other symbols " +"(*operators* and *delimiters*, :data:`~token.OP`). Whitespace characters " +"(other than logical line terminators, discussed earlier) are not tokens, but " +"serve to delimit 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" @@ -472,8 +523,8 @@ msgid "" "the underscore ``_`` and, except for the first character, the digits ``0`` " "through ``9``. Python 3.0 introduced additional characters from outside the " "ASCII range (see :pep:`3131`). For these characters, the classification " -"uses the version of the Unicode Character Database as included in the :mod:" -"`unicodedata` module." +"uses the version of the Unicode Character Database as included in " +"the :mod:`unicodedata` module." msgstr "" #: ../../reference/lexical_analysis.rst:311 @@ -526,8 +577,8 @@ msgstr "*Pc* - 連結用句読記号 (connector punctuations)" #: ../../reference/lexical_analysis.rst:332 msgid "" -"*Other_ID_Start* - explicit list of characters in `PropList.txt `_ to support backwards " +"*Other_ID_Start* - explicit list of characters in `PropList.txt `_ to support backwards " "compatibility" msgstr "" @@ -564,7 +615,6 @@ msgstr "" "して使われ、通常の識別子として使うことはできません。キーワードは厳密に下記の" "通りに綴らなければなりません:" -#: ../../reference/lexical_analysis.rst:358 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -574,6 +624,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 +644,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 +658,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 +682,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 `." +"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``.)" +"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 +720,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 +735,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 "``__*``" @@ -722,14 +784,15 @@ msgid "" "whitespace is not allowed between the :token:`~python-grammar:stringprefix` " "or :token:`~python-grammar:bytesprefix` and the rest of the literal. The " "source character set is defined by the encoding declaration; it is UTF-8 if " -"no encoding declaration is given in the source file; see section :ref:" -"`encodings`." +"no encoding declaration is given in the source file; see " +"section :ref:`encodings`." msgstr "" -"上記の生成規則で示されていない文法的な制限が一つあります。リテラルの :token:" -"`~python-grammar:stringprefix` や :token:`~python-grammar:bytesprefix` と残り" -"の部分の間に空白を入れてはならないことです。ソースコード文字セット (source " -"character set) はエンコーディング宣言で定義されます。エンコーディング宣言がな" -"ければ UTF-8 です。節 :ref:`encodings` を参照してください。" +"上記の生成規則で示されていない文法的な制限が一つあります。リテラル" +"の :token:`~python-grammar:stringprefix` や :token:`~python-" +"grammar:bytesprefix` と残りの部分の間に空白を入れてはならないことです。ソース" +"コード文字セット (source character set) はエンコーディング宣言で定義されま" +"す。エンコーディング宣言がなければ UTF-8 です。節 :ref:`encodings` を参照して" +"ください。" #: ../../reference/lexical_analysis.rst:499 msgid "" @@ -776,12 +839,12 @@ msgstr "" #: ../../reference/lexical_analysis.rst:531 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " -"simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" -"`414` for more information." +"simplify the maintenance of dual Python 2.x and 3.x codebases. " +"See :pep:`414` for more information." msgstr "" "Python 2.x と 3.x 両対応のコードベースのメンテナンスを単純化するために、レガ" -"シー unicode リテラル (``u'value'``) のサポートが再び導入されました。詳細は :" -"pep:`414` を参照してください。" +"シー unicode リテラル (``u'value'``) のサポートが再び導入されました。詳細" +"は :pep:`414` を参照してください。" #: ../../reference/lexical_analysis.rst:539 msgid "" @@ -810,9 +873,8 @@ msgstr "" "\" とは、文字列の囲みを開始するときに使った文字を示し、``'`` か ``\"`` のいず" "れかです。)" -#: ../../reference/lexical_analysis.rst:567 msgid "Escape sequences" -msgstr "" +msgstr "エスケープシーケンス" #: ../../reference/lexical_analysis.rst:569 msgid "" @@ -839,9 +901,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 +992,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 +1003,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 +1018,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 +1029,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 +1040,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 +1055,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." @@ -1023,15 +1081,15 @@ msgstr "標準 C と同じく、最大で 3 桁の 8 進数まで受理します #: ../../reference/lexical_analysis.rst:635 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`DeprecationWarning`." +"Octal escapes with value larger than ``0o377`` produce " +"a :exc:`DeprecationWarning`." msgstr "" #: ../../reference/lexical_analysis.rst:639 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`SyntaxWarning`. In a future Python version they will be eventually a :exc:" -"`SyntaxError`." +"Octal escapes with value larger than ``0o377`` produce " +"a :exc:`SyntaxWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`." msgstr "" #: ../../reference/lexical_analysis.rst:645 @@ -1080,9 +1138,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 +1189,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 +1214,8 @@ msgstr "" "きます) 、フォーマット済み文字列リテラルと通常の文字列リテラルを結合したりす" "ることもできますので注意してください。" -#: ../../reference/lexical_analysis.rst:729 msgid "f-strings" -msgstr "" +msgstr "f-strings" #: ../../reference/lexical_analysis.rst:733 msgid "" @@ -1166,11 +1225,11 @@ msgid "" "While other string literals always have a constant value, formatted strings " "are really expressions evaluated at run time." msgstr "" -"フォーマット済み文字列リテラル( :dfn:`formatted string literal` )または :" -"dfn:`f-string` は、接頭辞 ``'f'`` または ``'F'`` の付いた文字列リテラルです。" -"これらの文字列には、波括弧 ``{}`` で区切られた式である置換フィールドを含める" -"ことができます。他の文字列リテラルの場合は内容が常に一定で変わることが無いの" -"に対して、フォーマット済み文字列リテラルは実行時に式として評価されます。" +"フォーマット済み文字列リテラル( :dfn:`formatted string literal` )また" +"は :dfn:`f-string` は、接頭辞 ``'f'`` または ``'F'`` の付いた文字列リテラルで" +"す。これらの文字列には、波括弧 ``{}`` で区切られた式である置換フィールドを含" +"めることができます。他の文字列リテラルの場合は内容が常に一定で変わることが無" +"いのに対して、フォーマット済み文字列リテラルは実行時に式として評価されます。" #: ../../reference/lexical_analysis.rst:739 msgid "" @@ -1332,18 +1391,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 +1412,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 +1427,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 "" @@ -1396,8 +1463,8 @@ msgid "" "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" "フォーマット済み文字列リテラルを Python に追加した提案 :pep:`498` も参照して" -"ください。また関連する文字列フォーマットの仕組みを使っている :meth:`str." -"format` も参照してください。" +"ください。また関連する文字列フォーマットの仕組みを使ってい" +"る :meth:`str.format` も参照してください。" #: ../../reference/lexical_analysis.rst:894 msgid "Numeric literals" @@ -1473,9 +1540,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 +1665,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 +1716,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 +1780,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 +1811,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 +1835,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 +1877,8 @@ msgstr "標準 C" msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:548 msgid "\\ (backslash)" -msgstr "" +msgstr "\\ (バックスラッシュ)" #: ../../reference/lexical_analysis.rst:548 msgid "\\\\" @@ -1883,37 +1928,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 +1967,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 +1983,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 +2010,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..599c85ade 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 "" @@ -229,10 +229,11 @@ msgid "" "necessarily :exc:`AttributeError`)." msgstr "" "ターゲットが属性参照の場合: 参照されている一次語の式が値評価されます。値は代" -"入可能な属性を伴うオブジェクトでなければなりません; そうでなければ、 :exc:" -"`TypeError` が送出されます。次に、このオブジェクトに対して、被代入オブジェク" -"トを指定した属性に代入してよいか問い合わせます; 代入を実行できない場合、例外 " -"(通常は :exc:`AttributeError` ですが、必然ではありません) を送出します。" +"入可能な属性を伴うオブジェクトでなければなりません; そうでなけれ" +"ば、 :exc:`TypeError` が送出されます。次に、このオブジェクトに対して、被代入" +"オブジェクトを指定した属性に代入してよいか問い合わせます; 代入を実行できない" +"場合、例外 (通常は :exc:`AttributeError` ですが、必然ではありません) を送出し" +"ます。" #: ../../reference/simple_stmts.rst:170 msgid "" @@ -247,19 +248,22 @@ msgid "" msgstr "" "注意: オブジェクトがクラスインスタンスで、代入演算子の両辺に属性参照があると" "き、右辺式の ``a.x`` はインスタンスの属性と (インスタンスの属性が存在しなけれ" -"ば) クラス属性のどちらにもアクセスする可能性があります。左辺のターゲット ``a." -"x`` は常にインスタンスの属性として割り当てられ、必要ならば生成されます。この" -"とおり、現れる二つの ``a.x`` は同じ値を参照するとは限りません: 右辺式はクラス" -"属性を参照し、左辺は新しいインスタンス属性を代入のターゲットとして生成するよ" -"うなとき::" +"ば) クラス属性のどちらにもアクセスする可能性があります。左辺のターゲット " +"``a.x`` は常にインスタンスの属性として割り当てられ、必要ならば生成されます。" +"このとおり、現れる二つの ``a.x`` は同じ値を参照するとは限りません: 右辺式はク" +"ラス属性を参照し、左辺は新しいインスタンス属性を代入のターゲットとして生成す" +"るようなとき::" -#: ../../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 "" @@ -287,9 +291,9 @@ msgid "" "must yield an integer. If it is negative, the sequence's length is added to " "it. The resulting value must be a nonnegative integer less than the " "sequence's length, and the sequence is asked to assign the assigned object " -"to its item with that index. If the index is out of range, :exc:" -"`IndexError` is raised (assignment to a subscripted sequence cannot add new " -"items to a list)." +"to its item with that index. If the index is out of " +"range, :exc:`IndexError` is raised (assignment to a subscripted sequence " +"cannot add new items to a list)." msgstr "" "一次語が (リストのような) ミュータブルなシーケンスオブジェクトであれば、添字" "表記は整数を与えなければなりません。整数が負なら、シーケンスの長さが加算され" @@ -299,7 +303,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 +311,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 +371,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 +418,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 +425,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 +456,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 +484,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 +492,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,14 +516,18 @@ 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 " "side is not present for an expression target, then the interpreter evaluates " -"the target except for the last :meth:`~object.__setitem__` or :meth:`~object." -"__setattr__` call." +"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 +555,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,41 +584,47 @@ 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 " "implementation, the built-in variable ``__debug__`` is ``True`` under normal " "circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an :" -"keyword:`assert` statement when optimization is requested at compile time. " -"Note that it is unnecessary to include the source code for the expression " -"that failed in the error message; it will be displayed as part of the stack " -"trace." -msgstr "" +"option :option:`-O`). The current code generator emits no code for " +"an :keyword:`assert` statement when optimization is requested at compile " +"time. Note that it is unnecessary to include the source code for the " +"expression 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 +644,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" @@ -644,13 +682,13 @@ msgstr "" msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " -"statement in the same code block. If the name is unbound, a :exc:" -"`NameError` exception will be raised." +"statement in the same code block. If the name is unbound, " +"a :exc:`NameError` exception will be raised." msgstr "" "名前の削除は、ローカルまたはグローバル名前空間からその名前の束縛を取り除きま" "す。どちらの名前空間かは、名前が同じコードブロック内の :keyword:`global` 文で" -"宣言されているかどうかによります。名前が未束縛 (unbound) なら、 :exc:" -"`NameError` 例外が送出されます。" +"宣言されているかどうかによります。名前が未束縛 (unbound) な" +"ら、 :exc:`NameError` 例外が送出されます。" #: ../../reference/simple_stmts.rst:473 msgid "" @@ -713,20 +751,21 @@ msgstr "" msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " -"returned value (if any) is used as an argument to construct :exc:" -"`StopIteration` and becomes the :attr:`StopIteration.value` attribute." +"returned value (if any) is used as an argument to " +"construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` " +"attribute." msgstr "" -"ジェネレータ関数では、 :keyword:`return` 文はジェネレータの終わりを示し、 :" -"exc:`StopIteration` 例外を送出させます。返された値は (あれば)、 :exc:" -"`StopIteration` を構成する引数に使われ、 :attr:`StopIteration.value` 属性にな" -"ります。" +"ジェネレータ関数では、 :keyword:`return` 文はジェネレータの終わりを示" +"し、 :exc:`StopIteration` 例外を送出させます。返された値は (あれ" +"ば)、 :exc:`StopIteration` を構成する引数に使わ" +"れ、 :attr:`StopIteration.value` 属性になります。" #: ../../reference/simple_stmts.rst:515 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " -"indicates that the asynchronous generator is done and will cause :exc:" -"`StopAsyncIteration` to be raised. A non-empty :keyword:`!return` statement " -"is a syntax error in an asynchronous generator function." +"indicates that the asynchronous generator is done and will " +"cause :exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`!" +"return` statement is a syntax error in an asynchronous generator function." msgstr "" "非同期ジェネレータ関数では、引数無しの :keyword:`return` 文は非同期ジェネレー" "タの終わりを示し、 :exc:`StopAsyncIteration` を送出させます。\n" @@ -737,43 +776,50 @@ 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 " +"Yield expressions and statements are only used when defining " +"a :term:`generator` function, and are only used in the body of the generator " "function. Using :keyword:`yield` in a function definition is sufficient to " "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 "" -"For full details of :keyword:`yield` semantics, refer to the :ref:" -"`yieldexpr` section." +"For full details of :keyword:`yield` semantics, refer to " +"the :ref:`yieldexpr` section." msgstr "" ":keyword:`yield` の意味の完全な説明は、 :ref:`yieldexpr` 節を参照してくださ" "い。" @@ -782,20 +828,23 @@ 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 "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " -"object. It must be either a subclass or an instance of :class:" -"`BaseException`. If it is a class, the exception instance will be obtained " -"when needed by instantiating the class with no arguments." +"object. It must be either a subclass or an instance " +"of :class:`BaseException`. If it is a class, the exception instance will be " +"obtained when needed by instantiating the class with no arguments." msgstr "" "そうでなければ、 :keyword:`raise` は最初の式を、例外オブジェクトとして評価し" "ます。これは、 :class:`BaseException` のサブクラスまたはインスタンスでなけれ" @@ -804,13 +853,12 @@ msgstr "" #: ../../reference/simple_stmts.rst:580 msgid "" -"The :dfn:`type` of the exception is the exception instance's class, the :dfn:" -"`value` is the instance itself." +"The :dfn:`type` of the exception is the exception instance's class, " +"the :dfn:`value` is the instance itself." 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 +867,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 +888,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,17 +916,38 @@ 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 :" -"keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"exception is already being handled. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " "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 +967,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,12 +1001,20 @@ 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 "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information about handling exceptions is in section :ref:" -"`try`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information about handling exceptions is in " +"section :ref:`try`." msgstr "" "例外に関する追加情報は :ref:`exceptions` 節にあります。また、例外処理に関する" "情報は :ref:`try` 節にあります。" @@ -919,19 +1024,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" @@ -939,8 +1047,8 @@ msgstr ":keyword:`!break` 文" #: ../../reference/simple_stmts.rst:695 msgid "" -":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" -"keyword:`while` loop, but not nested in a function or class definition " +":keyword:`break` may only occur syntactically nested in a :keyword:`for` " +"or :keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" ":keyword:`break` 文は、構文としては :keyword:`for` ループや :keyword:`while` " @@ -952,7 +1060,7 @@ msgid "" "It terminates the nearest enclosing loop, skipping the optional :keyword:`!" "else` clause if the loop has one." msgstr "" -":keyword:`break` 文は、文を囲う最も内側のループを終了させ、ループにオプション" +"``break`` 文は、文を囲う最も内側のループを終了させ、ループにオプション" "の :keyword:`!else` 節がある場合にはそれをスキップします。" #: ../../reference/simple_stmts.rst:705 @@ -986,8 +1094,8 @@ msgid "" msgstr "" ":keyword:`continue` 文は :keyword:`for` ループや :keyword:`while` ループ内の" "ネストで構文法的にのみ現れますが、ループ内の関数定義やクラス定義の中には現れ" -"ません。 :keyword:`continue` 文は、文を囲う最も内側のループの次の周期に処理を" -"継続します。" +"ません。 ``continue`` 文は、文を囲う最も内側のループの次の周期に処理を継続し" +"ます。" #: ../../reference/simple_stmts.rst:734 msgid "" @@ -1016,8 +1124,8 @@ msgstr "モジュールを見付け出し、必要であればロードし初期 #: ../../reference/simple_stmts.rst:768 msgid "" -"define a name or names in the local namespace for the scope where the :" -"keyword:`import` statement occurs." +"define a name or names in the local namespace for the scope where " +"the :keyword:`import` statement occurs." msgstr "" ":keyword:`import` 文が表れるスコープのローカル名前空間で名前を定義する。" @@ -1056,13 +1164,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." +"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,17 +1239,24 @@ 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 " "bound locally\n" -"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as fbb\n" -"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as baz\n" +"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as fbb\n" +"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.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 "" @@ -1184,10 +1298,9 @@ msgid "" "definitions will raise a :exc:`SyntaxError`." msgstr "" "インポートのワイルドカード形式 --- ``from module import *`` --- は、モジュー" -"ルレベルでのみ許されます。クラスや関数定義でこの形式を使おうとすると、 :exc:" -"`SyntaxError` が送出されます。" +"ルレベルでのみ許されます。クラスや関数定義でこの形式を使おうとする" +"と、 :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 +1316,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``." +"``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 +1453,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 +1468,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,14 +1479,18 @@ 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 " -"will, by default, use the new syntax or semantics associated with the future " -"statement. This can be controlled by optional arguments to :func:`compile` " -"--- see the documentation of that function for details." +"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 will, by default, use the new syntax or semantics associated with " +"the future 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 +1518,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 +1535,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` " @@ -1422,22 +1542,23 @@ msgid "" "string or code object supplied to the built-in :func:`exec` function does " "not affect the code block *containing* the function call, and code contained " "in such a string is unaffected by :keyword:`!global` statements in the code " -"containing the function call. The same applies to the :func:`eval` and :" -"func:`compile` functions." +"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 " @@ -1445,16 +1566,28 @@ msgid "" "identifiers to refer to names previously bound in nonlocal scopes. It allows " "encapsulated code to rebind such nonlocal identifiers. If a name is bound " "in more than one nonlocal scope, the nearest binding is used. If a name is " -"not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" -"`SyntaxError` is raised." -msgstr "" +"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,76 +1597,83 @@ 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." +"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 " -"accessed through the type alias's :attr:`!__value__` attribute (see :ref:" -"`lazy-evaluation`). This allows the type alias to refer to names that are " -"not yet defined." +"accessed through the type alias's :attr:`!__value__` attribute " +"(see :ref:`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 +1756,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 +1801,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 +1855,8 @@ msgstr "assignment, augmented" msgid "+=" msgstr "+=" -#: ../../reference/simple_stmts.rst:263 msgid "augmented assignment" -msgstr "" +msgstr "累算代入" #: ../../reference/simple_stmts.rst:263 msgid "-=" @@ -1766,21 +1902,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 +1927,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 +2087,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 +2113,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..e240282d5 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,25 +46,24 @@ 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 " "program. A complete Python program is executed in a minimally initialized " "environment: all built-in and standard modules are available, but none have " -"been initialized, except for :mod:`sys` (various system services), :mod:" -"`builtins` (built-in functions, exceptions and ``None``) and :mod:" -"`__main__`. The latter is used to provide the local and global namespace " -"for execution of the complete program." +"been initialized, except for :mod:`sys` (various system " +"services), :mod:`builtins` (built-in functions, exceptions and ``None``) " +"and :mod:`__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 "" @@ -85,8 +84,8 @@ msgstr "" "インタプリタは、対話的モード (interactive mode) で起動されることもあります; " "この場合、インタプリタは完全なプログラムを読んで実行するのではなく、一度に単" "一の実行文 (複合文のときもあります) を読み込んで実行します。初期状態の環境" -"は、完全なプログラムを実行するときの環境と同じです; 各実行文は、 :mod:" -"`__main__` の名前空間内で実行されます。" +"は、完全なプログラムを実行するときの環境と同じです; 各実行文" +"は、 :mod:`__main__` の名前空間内で実行されます。" #: ../../reference/toplevel_components.rst:55 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" @@ -154,8 +152,8 @@ msgid "" ":func:`eval` is used for expression input. It ignores leading whitespace. " "The string argument to :func:`eval` must have the following form:" msgstr "" -"式入力には :func:`eval` が使われます。これは先頭の空白を無視します。 :func:" -"`eval` に対する文字列引数は、以下の形式をとらなければなりません:" +"式入力には :func:`eval` が使われます。これは先頭の空白を無視しま" +"す。 :func:`eval` に対する文字列引数は、以下の形式をとらなければなりません:" #: ../../reference/toplevel_components.rst:8 msgid "interpreter" diff --git a/sphinx.po b/sphinx.po index 4d98b5b16..a6a6b6f90 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." @@ -150,8 +146,8 @@ msgstr "EPUB" #: ../../tools/templates/download.html:65 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download (ca. %" +"(download_size)s MiB)" msgstr "" #: ../../tools/templates/download.html:70 @@ -197,14 +193,14 @@ msgid "" "send\n" "email to docs@python.org." msgstr "" -"Python ドキュメントへのコメントや提案がある場合は、 docs@python.org へメールを送ってください。\n" +"Python ドキュメントへのコメントや提案がある場合は、 docs@python.org へメールを送ってくださ" +"い。\n" "(訳注: 日本語訳へのコメントや提案は GitHub の issue tracker へ報告してください。)" -#: ../../tools/templates/dummy.html:6 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../tools/templates/dummy.html:10 msgid "Part of the" @@ -339,9 +335,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 +448,7 @@ msgstr "問題の報告" #: ../../tools/templates/indexcontent.html:75 msgid "Contributing to docs" -msgstr "" +msgstr "ドキュメントへの貢献" #: ../../tools/templates/indexcontent.html:76 msgid "Download the documentation" @@ -499,9 +494,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 +513,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" +"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..a2a5f96f9 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,26 +31,26 @@ 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 "" "On Windows, or Unix-like systems with :mod:`curses` support, a new " "interactive shell is used by default. This one supports color, multiline " -"editing, history browsing, and paste mode. To disable color, see :ref:" -"`using-on-controlling-color` for details. Function keys provide some " -"additional functionality. :kbd:`F1` enters the interactive help browser :mod:" -"`pydoc`. :kbd:`F2` allows for browsing command-line history with neither " -"output nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` enters \"paste " -"mode\", which makes pasting larger blocks of code easier. Press :kbd:`F3` to " -"return to the regular prompt." +"editing, history browsing, and paste mode. To disable color, " +"see :ref:`using-on-controlling-color` for details. Function keys provide " +"some additional functionality. :kbd:`F1` enters the interactive help " +"browser :mod:`pydoc`. :kbd:`F2` allows for browsing command-line history " +"with neither output nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` " +"enters \"paste mode\", which makes pasting larger blocks of code easier. " +"Press :kbd:`F3` to return to the regular prompt." msgstr "" #: ../../tutorial/appendix.rst:28 @@ -63,8 +63,8 @@ msgstr "" #: ../../tutorial/appendix.rst:32 msgid "" -"If the new interactive shell is not desired, it can be disabled via the :" -"envvar:`PYTHON_BASIC_REPL` environment variable." +"If the new interactive shell is not desired, it can be disabled via " +"the :envvar:`PYTHON_BASIC_REPL` environment variable." msgstr "" "新しい対話型シェルを望まない場合は、環境変数 :envvar:`PYTHON_BASIC_REPL` で無" "効にできます。" @@ -78,8 +78,8 @@ msgid "" "When an error occurs, the interpreter prints an error message and a stack " "trace. In interactive mode, it then returns to the primary prompt; when " "input came from a file, it exits with a nonzero exit status after printing " -"the stack trace. (Exceptions handled by an :keyword:`except` clause in a :" -"keyword:`try` statement are not errors in this context.) Some errors are " +"the stack trace. (Exceptions handled by an :keyword:`except` clause in " +"a :keyword:`try` statement are not errors in this context.) Some errors are " "unconditionally fatal and cause an exit with a nonzero exit status; this " "applies to internal inconsistencies and some cases of running out of " "memory. All error messages are written to the standard error stream; normal " @@ -87,26 +87,26 @@ msgid "" msgstr "" "エラーが発生すると、インタープリタはエラーメッセージとスタックトレースを表示" "します。対話モードでは、それから元のプロンプトに戻ります; ファイルから実行し" -"た場合は、スタックトレースを表示してゼロ以外の終了ステータスで終了します(:" -"keyword:`try` 文の :keyword:`except` 節で処理された例外は、ここでいうエラーに" -"はあたりません。)一部のエラーは無条件に致命的であり、ゼロ以外の終了ステータ" -"スで終了します; これは内部の不整合やある種のメモリ不足の場合に適用されます。" -"エラーメッセージは全て標準エラー出力に書き込まれます; これに対して、通常は実" -"行した命令から出力される内容は標準出力に書き込まれます。" +"た場合は、スタックトレースを表示してゼロ以外の終了ステータスで終了します" +"(:keyword:`try` 文の :keyword:`except` 節で処理された例外は、ここでいうエ" +"ラーにはあたりません。)一部のエラーは無条件に致命的であり、ゼロ以外の終了ス" +"テータスで終了します; これは内部の不整合やある種のメモリ不足の場合に適用され" +"ます。エラーメッセージは全て標準エラー出力に書き込まれます; これに対して、通" +"常は実行した命令から出力される内容は標準出力に書き込まれます。" #: ../../tutorial/appendix.rst:50 msgid "" "Typing the interrupt character (usually :kbd:`Control-C` or :kbd:`Delete`) " "to the primary or secondary prompt cancels the input and returns to the " "primary prompt. [#]_ Typing an interrupt while a command is executing raises " -"the :exc:`KeyboardInterrupt` exception, which may be handled by a :keyword:" -"`try` statement." +"the :exc:`KeyboardInterrupt` exception, which may be handled by " +"a :keyword:`try` statement." msgstr "" "割り込み文字 (interrupt character、普通は :kbd:`Control-C` か :kbd:`Delete`) " "を一次または二次プロンプトに対してタイプすると、入力が取り消されて一次プロン" -"プトに戻ります。 [#]_ コマンドの実行中に割り込み文字をタイプすると :exc:" -"`KeyboardInterrupt` 例外が送出されます。この例外は :keyword:`try` 文で処理で" -"きます。" +"プトに戻ります。 [#]_ コマンドの実行中に割り込み文字をタイプする" +"と :exc:`KeyboardInterrupt` 例外が送出されます。この例外は :keyword:`try` 文" +"で処理できます。" #: ../../tutorial/appendix.rst:60 msgid "Executable Python Scripts" @@ -143,8 +143,8 @@ msgstr "" #: ../../tutorial/appendix.rst:74 msgid "" -"The script can be given an executable mode, or permission, using the :" -"program:`chmod` command." +"The script can be given an executable mode, or permission, using " +"the :program:`chmod` command." msgstr "" ":program:`chmod` コマンドを使えば、スクリプトに実行モードや実行権限を与えるこ" "とができます。" @@ -180,12 +180,11 @@ msgid "" "the :file:`.profile` feature of the Unix shells." msgstr "" "Python を対話的に使うときには、インタプリタが起動する度に実行される何らかの標" -"準的なコマンドがあると便利なことがよくあります。これを行うには、 :envvar:" -"`PYTHONSTARTUP` と呼ばれる環境変数を、インタプリタ起動時に実行されるコマンド" -"が入ったファイル名に設定します。この機能は Unix シェルの :file:`.profile` に" -"似ています。" +"準的なコマンドがあると便利なことがよくあります。これを行うに" +"は、 :envvar:`PYTHONSTARTUP` と呼ばれる環境変数を、インタプリタ起動時に実行さ" +"れるコマンドが入ったファイル名に設定します。この機能は 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,28 +194,29 @@ 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 "" "If you want to read an additional start-up file from the current directory, " -"you can program this in the global start-up file using code like ``if os." -"path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read())``. If you " +"you can program this in the global start-up file using code like ``if " +"os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read())``. If you " "want to use the startup file in a script, you must do this explicitly in the " "script::" msgstr "" "もし現在のディレクトリから追加でスタートアップファイルを読み出したいのなら、" -"グローバルのスタートアップファイルの中に ``if os.path.isfile('.pythonrc." -"py'): exec(open('.pythonrc.py').read())`` のようなプログラムを書くことができ" -"ます。スクリプト中でスタートアップファイルを使いたいのなら、以下のようにして" -"スクリプト中で明示的に実行しなければなりません::" +"グローバルのスタートアップファイルの中に ``if " +"os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read())`` のような" +"プログラムを書くことができます。スクリプト中でスタートアップファイルを使いた" +"いのなら、以下のようにしてスクリプト中で明示的に実行しなければなりません::" #: ../../tutorial/appendix.rst:113 msgid "" @@ -245,10 +245,11 @@ msgid "" "location of your user site-packages directory. Start Python and run this " "code::" msgstr "" -"Python はユーザーが Python をカスタマイズするための2つのフック、 :index:" -"`sitecustomize` と :index:`usercustomize` を提供しています。これがどのように" -"動作しているかを知るには、まずはユーザーの site-packages ディレクトリの場所を" -"見つける必要があります。Python を起動して次のコードを実行してください::" +"Python はユーザーが Python をカスタマイズするための2つのフッ" +"ク、 :index:`sitecustomize` と :index:`usercustomize` を提供しています。これ" +"がどのように動作しているかを知るには、まずはユーザーの site-packages ディレク" +"トリの場所を見つける必要があります。Python を起動して次のコードを実行してくだ" +"さい::" #: ../../tutorial/appendix.rst:130 msgid "" @@ -275,13 +276,13 @@ msgstr "" msgid "" ":index:`sitecustomize` works in the same way, but is typically created by an " "administrator of the computer in the global site-packages directory, and is " -"imported before :index:`usercustomize`. See the documentation of the :mod:" -"`site` module for more details." +"imported before :index:`usercustomize`. See the documentation of " +"the :mod:`site` module for more details." msgstr "" ":index:`sitecustomize` モジュールも同じように動作しますが、一般的にコンピュー" -"ターの管理者によって、グローバルの site-packages ディレクトリに作成され、 :" -"index:`usercustomize` より先にインポートされます。詳細は :mod:`site` モジュー" -"ルのドキュメントを参照してください。" +"ターの管理者によって、グローバルの site-packages ディレクトリに作成さ" +"れ、 :index:`usercustomize` より先にインポートされます。詳細は :mod:`site` モ" +"ジュールのドキュメントを参照してください。" #: ../../tutorial/appendix.rst:145 msgid "Footnotes" 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..11c91d306 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." @@ -199,11 +207,11 @@ msgid "" msgstr "" "ところで、 *属性* という言葉は、ドットに続く名前すべてに対して使っています " "--- 例えば式 ``z.real`` で、 ``real`` はオブジェクト ``z`` の属性です。厳密に" -"いえば、モジュール内の名前に対する参照は属性の参照です。式 ``modname." -"funcname`` では、 ``modname`` はあるモジュールオブジェクトで、 ``funcname`` " -"はその属性です。この場合には、モジュールの属性とモジュールの中で定義されてい" -"るグローバル名の間には、直接的な対応付けがされます。これらの名前は同じ名前空" -"間を共有しているのです! [#]_" +"いえば、モジュール内の名前に対する参照は属性の参照です。式 " +"``modname.funcname`` では、 ``modname`` はあるモジュールオブジェクトで、 " +"``funcname`` はその属性です。この場合には、モジュールの属性とモジュールの中で" +"定義されているグローバル名の間には、直接的な対応付けがされます。これらの名前" +"は同じ名前空間を共有しているのです! [#]_" #: ../../tutorial/classes.rst:90 msgid "" @@ -228,9 +236,9 @@ msgid "" "module is created when the module definition is read in; normally, module " "namespaces also last until the interpreter quits. The statements executed " "by the top-level invocation of the interpreter, either read from a script " -"file or interactively, are considered part of a module called :mod:" -"`__main__`, so they have their own global namespace. (The built-in names " -"actually also live in a module; this is called :mod:`builtins`.)" +"file or interactively, are considered part of a module " +"called :mod:`__main__`, so they have their own global namespace. (The built-" +"in names actually also live in a module; this is called :mod:`builtins`.)" msgstr "" "名前空間は様々な時点で作成され、その寿命も様々です。組み込みの名前が入った名" "前空間は Python インタプリタが起動するときに作成され、決して削除されることは" @@ -239,8 +247,8 @@ msgstr "" "残ります。インタプリタのトップレベルで実行された文は、スクリプトファイルから" "読み出されたものでも対話的に読み出されたものでも、 :mod:`__main__` という名前" "のモジュールの一部分であるとみなされるので、独自の名前空間を持つことになりま" -"す。 (組み込みの名前は実際にはモジュール内に存在します。そのモジュールは :" -"mod:`builtins` と呼ばれています。)" +"す。 (組み込みの名前は実際にはモジュール内に存在します。そのモジュール" +"は :mod:`builtins` と呼ばれています。)" #: ../../tutorial/classes.rst:106 msgid "" @@ -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,22 +306,22 @@ 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 " -"rebind variables found outside of the innermost scope, the :keyword:" -"`nonlocal` statement can be used; if not declared nonlocal, those variables " -"are read-only (an attempt to write to such a variable will simply create a " -"*new* local variable in the innermost scope, leaving the identically named " -"outer variable unchanged)." -msgstr "" -"名前が global と宣言されている場合、その名前に対する参照や代入は全て、モ" -"ジュールのグローバルな名前の入った最後から2番目のスコープに対して直接行われま" -"す。最内スコープの外側にある変数に再束縛するには、 :keyword:`nonlocal` 文が使" -"えます。nonlocal と宣言されなかった変数は、全て読み出し専用となります (そのよ" -"うな変数に対する書き込みは、単に *新しい* ローカル変数をもっとも内側のスコー" -"プで作成し、外部のスコープの値は変化しません)。" +"rebind variables found outside of the innermost scope, " +"the :keyword:`nonlocal` statement can be used; if not declared nonlocal, " +"those variables are read-only (an attempt to write to such a variable will " +"simply create a *new* local variable in the innermost scope, leaving the " +"identically named outer variable unchanged)." +msgstr "" +"名前を global と宣言すると、その名前への参照と代入はすべて、モジュールのグ" +"ローバル名を持つ最後から 2 番目のスコープで直接行われます。\n" +"最も内側のスコープより外側にある変数を再束縛するには、:keyword:`nonlocal` 文" +"を使えます。\n" +"こうした外側の変数は、nonlocal と宣言しない限り読み出し専用です。\n" +"代入しようとすると、最も内側のスコープに同名の *新しい* ローカル変数が作ら" +"れ、外側の変数は変わりません。" #: ../../tutorial/classes.rst:133 msgid "" @@ -344,32 +352,31 @@ 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 " -"innermost scope. Assignments do not copy data --- they just bind names to " -"objects. The same is true for deletions: the statement ``del x`` removes " -"the binding of ``x`` from the namespace referenced by the local scope. In " -"fact, all operations that introduce new names use the local scope: in " -"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` 文、関数の定義は、モジュールや関数名をローカ" -"ルスコープの名前に拘束します。" +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 innermost scope. Assignments do not copy data --- they just bind " +"names to objects. The same is true for deletions: the statement ``del x`` " +"removes the binding of ``x`` from the namespace referenced by the local " +"scope. In fact, all operations that introduce new names use the local " +"scope: in particular, :keyword:`import` statements and function definitions " +"bind the module or function name in the local scope." +msgstr "" +":keyword:`global` 文や :keyword:`nonlocal` 文が有効でない場合、\n" +"Python では名前への代入は常に最も内側のスコープで行われます。\n" +"代入はデータをコピーせず、名前をオブジェクトに束縛するだけです。\n" +"削除も同様で、``del x`` はローカルスコープの名前空間から ``x`` の束縛を削除し" +"ます。\n" +"新しい名前を導入する操作はすべてローカルスコープを使います。\n" +"例えば :keyword:`import` 文や関数定義は、モジュール名や関数名をローカルスコー" +"プで束縛します。" #: ../../tutorial/classes.rst:154 msgid "" "The :keyword:`global` statement can be used to indicate that particular " -"variables live in the global scope and should be rebound there; the :keyword:" -"`nonlocal` statement indicates that particular variables live in an " -"enclosing scope and should be rebound there." +"variables live in the global scope and should be rebound there; " +"the :keyword:`nonlocal` statement indicates that particular variables live " +"in an enclosing scope and should be rebound there." msgstr "" ":keyword:`global` 文を使うと、特定の変数がグローバルスコープに存在し、そこで" "再束縛されることを指示できます。 :keyword:`nonlocal` 文は、特定の変数が外側の" @@ -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." +"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 "" @@ -637,8 +648,8 @@ msgstr "" msgid "" "The instantiation operation (\"calling\" a class object) creates an empty " "object. Many classes like to create objects with instances customized to a " -"specific initial state. Therefore a class may define a special method named :" -"meth:`~object.__init__`, like this::" +"specific initial state. Therefore a class may define a special method " +"named :meth:`~object.__init__`, like this::" msgstr "" "インスタンス化操作 (クラスオブジェクトの \"呼出し\") では、空のオブジェクトが" "作られます。多くのクラスでは、特定の初期状態にカスタマイズされたオブジェクト" @@ -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" @@ -778,9 +797,9 @@ msgid "" "example::" msgstr "" "この :class:`!MyClass` の例では、文字列 ``'hello world'`` が返されます。しか" -"し、必ずしもすぐメソッドを呼び出さなければならないわけではありません。 ``x." -"f`` はメソッドオブジェクトであり、どこかに入れておいて後で呼び出すことができ" -"ます。例えば次のコードは::" +"し、必ずしもすぐメソッドを呼び出さなければならないわけではありません。 " +"``x.f`` はメソッドオブジェクトであり、どこかに入れておいて後で呼び出すことが" +"できます。例えば次のコードは::" #: ../../tutorial/classes.rst:366 msgid "" @@ -798,8 +817,8 @@ msgstr "``hello world`` を時が終わるまで印字し続けるでしょう #: ../../tutorial/classes.rst:372 msgid "" -"What exactly happens when a method is called? You may have noticed that ``x." -"f()`` was called without an argument above, even though the function " +"What exactly happens when a method is called? You may have noticed that " +"``x.f()`` was called without an argument above, even though the function " "definition for :meth:`!f` specified an argument. What happened to the " "argument? Surely Python raises an exception when a function that requires an " "argument is called without any --- even if the argument isn't actually " @@ -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 "" @@ -908,11 +926,11 @@ msgid "" "not be used as a class variable because just a single list would be shared " "by all *Dog* instances::" msgstr "" -":ref:`tut-object` で議論したように、共有データはリストや辞書のような :term:" -"`mutable` オブジェクトが関与すると驚くべき効果を持ち得ます。例えば、以下の" -"コードの *tricks* リストはクラス変数として使われるべきではありません、なぜな" -"らたった一つのリストがすべての *Dog* インスタンスによって共有されることになり" -"得るからです::" +":ref:`tut-object` で議論したように、共有データはリストや辞書のよう" +"な :term:`mutable` オブジェクトが関与すると驚くべき効果を持ち得ます。例えば、" +"以下のコードの *tricks* リストはクラス変数として使われるべきではありません、" +"なぜならたった一つのリストがすべての *Dog* インスタンスによって共有されること" +"になり得るからです::" #: ../../tutorial/classes.rst:428 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 "" @@ -1294,10 +1312,10 @@ msgstr "" msgid "" "An overriding method in a derived class may in fact want to extend rather " "than simply replace the base class method of the same name. There is a " -"simple way to call the base class method directly: just call ``BaseClassName." -"methodname(self, arguments)``. This is occasionally useful to clients as " -"well. (Note that this only works if the base class is accessible as " -"``BaseClassName`` in the global scope.)" +"simple way to call the base class method directly: just call " +"``BaseClassName.methodname(self, arguments)``. This is occasionally useful " +"to clients as well. (Note that this only works if the base class is " +"accessible as ``BaseClassName`` in the global scope.)" msgstr "" "派生クラスで上書きしているメソッドでは、基底クラスの同名のメソッドを置き換え" "るのではなく、拡張したいのかもしれません。基底クラスのメソッドを直接呼び出す" @@ -1317,8 +1335,8 @@ msgid "" "derived from :class:`int`." msgstr "" ":func:`isinstance` を使うとインスタンスの型が調べられます。 " -"``isinstance(obj, int)`` は ``obj.__class__`` が :class:`int` や :class:" -"`int` の派生クラスの場合に限り ``True`` になります。" +"``isinstance(obj, int)`` は ``obj.__class__`` が :class:`int` " +"や :class:`int` の派生クラスの場合に限り ``True`` になります。" #: ../../tutorial/classes.rst:618 msgid "" @@ -1373,10 +1391,10 @@ msgstr "" "ほとんどのシンプルな多重継承において、親クラスから継承される属性の検索は、深" "さ優先で、左から右に、そして継承の階層の中で同じクラスが複数出てくる(訳注: " "ダイアモンド継承と呼ばれます)場合に2度探索をしない、と考えることができま" -"す。なので、ある属性が :class:`!DerivedClassName` で見つからない場合、まず :" -"class:`!Base1` から検索され、そして(再帰的に) :class:`!Base1` の基底クラス" -"から検索され、それでも見つからなかった場合は :class:`!Base2` から検索される、" -"といった具合になります。" +"す。なので、ある属性が :class:`!DerivedClassName` で見つからない場合、ま" +"ず :class:`!Base1` から検索され、そして(再帰的に) :class:`!Base1` の基底ク" +"ラスから検索され、それでも見つからなかった場合は :class:`!Base2` から検索され" +"る、といった具合になります。" #: ../../tutorial/classes.rst:647 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,24 +1628,26 @@ 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 "" -":ref:`Instance method objects ` have attributes, too: :" -"attr:`m.__self__ ` is the instance object with the method :" -"meth:`!m`, and :attr:`m.__func__ ` is the :ref:`function " -"object ` corresponding to the method." +":ref:`Instance method objects ` have attributes, " +"too: :attr:`m.__self__ ` is the instance object with the " +"method :meth:`!m`, and :attr:`m.__func__ ` is " +"the :ref:`function object ` corresponding to the method." msgstr "" -":ref:`Instance method objects ` にも属性があります。 :attr:" -"`m.__self__ ` はメソッド :meth:`!m` の属しているインスタンス" -"オブジェクトで、:attr:`m.__func__ ` はそのメソッドに対応す" -"る :ref:`function object ` です。" +":ref:`Instance method objects ` にも属性がありま" +"す。 :attr:`m.__self__ ` はメソッド :meth:`!m` の属している" +"インスタンスオブジェクトで、:attr:`m.__func__ ` はそのメソッ" +"ドに対応する :ref:`function object ` です。" #: ../../tutorial/classes.rst:782 msgid "Iterators" @@ -1665,24 +1688,24 @@ msgstr "" #: ../../tutorial/classes.rst:798 msgid "" "This style of access is clear, concise, and convenient. The use of " -"iterators pervades and unifies Python. Behind the scenes, the :keyword:" -"`for` statement calls :func:`iter` on the container object. The function " -"returns an iterator object that defines the method :meth:`~iterator." -"__next__` which accesses elements in the container one at a time. When " -"there are no more elements, :meth:`~iterator.__next__` raises a :exc:" -"`StopIteration` exception which tells the :keyword:`!for` loop to " -"terminate. You can call the :meth:`~iterator.__next__` method using the :" -"func:`next` built-in function; this example shows how it all works::" +"iterators pervades and unifies Python. Behind the scenes, " +"the :keyword:`for` statement calls :func:`iter` on the container object. " +"The function returns an iterator object that defines the " +"method :meth:`~iterator.__next__` which accesses elements in the container " +"one at a time. When there are no more elements, :meth:`~iterator.__next__` " +"raises a :exc:`StopIteration` exception which tells the :keyword:`!for` loop " +"to terminate. You can call the :meth:`~iterator.__next__` method using " +"the :func:`next` built-in function; this example shows how it all works::" msgstr "" "こういう要素へのアクセス方法は明確で簡潔で使い易いものです。イテレータの活用" "は Python へ広く行き渡り、統一感を持たせています。裏では :keyword:`!for` 文は" "コンテナオブジェクトに対して :func:`iter` 関数を呼んでいます。関数は、コンテ" "ナの中の要素に1つずつアクセスする :meth:`~iterator.__next__` メソッドが定義さ" -"れているイテレータオブジェクトを返します。これ以上要素が無い場合は、 :meth:" -"`~iterator.__next__` メソッドは :exc:`StopIteration` 例外を送出し、その通知を" -"受け :keyword:`for` ループは終了します。組み込みの :func:`next` 関数を使っ" -"て :meth:`~iterator.__next__` メソッドを直接呼ぶこともできます; この例は関数" -"がどう働くのかを示しています::" +"れているイテレータオブジェクトを返します。これ以上要素が無い場合" +"は、 :meth:`~iterator.__next__` メソッドは :exc:`StopIteration` 例外を送出" +"し、その通知を受け :keyword:`for` ループは終了します。組み込み" +"の :func:`next` 関数を使って :meth:`~iterator.__next__` メソッドを直接呼ぶこ" +"ともできます; この例は関数がどう働くのかを示しています::" #: ../../tutorial/classes.rst:807 msgid "" @@ -1795,18 +1818,19 @@ msgstr "ジェネレータ (generator)" #: ../../tutorial/classes.rst:862 msgid "" ":term:`Generators ` are a simple and powerful tool for creating " -"iterators. They are written like regular functions but use the :keyword:" -"`yield` statement whenever they want to return data. Each time :func:`next` " -"is called on it, the generator resumes where it left off (it remembers all " -"the data values and which statement was last executed). An example shows " -"that generators can be trivially easy to create::" +"iterators. They are written like regular functions but use " +"the :keyword:`yield` statement whenever they want to return data. Each " +"time :func:`next` is called on it, the generator resumes where it left off " +"(it remembers all the data values and which statement was last executed). " +"An example shows that generators can be trivially easy to create::" msgstr "" ":term:`ジェネレータ ` は、イテレータを作成するための簡潔で強力な" "ツールです。ジェネレータは通常の関数のように書かれますが、何らかのデータを返" -"すときには :keyword:`yield` 文を使います。そのジェネレータに対して :func:" -"`next` が呼び出されるたびに、ジェネレータは以前に中断した処理を再開します " -"(ジェネレータは、全てのデータ値と最後にどの文が実行されたかを記憶していま" -"す)。以下の例を見れば、ジェネレータがとても簡単に作成できることがわかります::" +"すときには :keyword:`yield` 文を使います。そのジェネレータに対し" +"て :func:`next` が呼び出されるたびに、ジェネレータは以前に中断した処理を再開" +"します (ジェネレータは、全てのデータ値と最後にどの文が実行されたかを記憶して" +"います)。以下の例を見れば、ジェネレータがとても簡単に作成できることがわかりま" +"す::" #: ../../tutorial/classes.rst:869 msgid "" @@ -1840,25 +1864,24 @@ msgstr "" msgid "" "Anything that can be done with generators can also be done with class-based " "iterators as described in the previous section. What makes generators so " -"compact is that the :meth:`~iterator.__iter__` and :meth:`~generator." -"__next__` methods are created automatically." +"compact is that the :meth:`~iterator.__iter__` " +"and :meth:`~generator.__next__` methods are created automatically." msgstr "" "ジェネレータでできることは、前の節で解説したクラスを使ったイテレータでも実現" -"できます。ジェネレータの定義がコンパクトになるのは :meth:`~iterator." -"__iter__` メソッドと :meth:`~generator.__next__` メソッドが自動で作成されるか" -"らです。" +"できます。ジェネレータの定義がコンパクトになるの" +"は :meth:`~iterator.__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``." +"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 +1898,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 +1906,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 +1967,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 +1985,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..012b460e1 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 @@ -87,9 +87,9 @@ msgstr "" msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " "part is optional. The keyword ':keyword:`!elif`' is short for 'else if', " -"and is useful to avoid excessive indentation. An :keyword:`!if` ... :" -"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the " -"``switch`` or ``case`` statements found in other languages." +"and is useful to avoid excessive indentation. An :keyword:`!" +"if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute " +"for the ``switch`` or ``case`` statements found in other languages." msgstr "" "ゼロ個以上の :keyword:`elif` 部を使うことができ、 :keyword:`else` 部を付ける" "こともできます。キーワード ':keyword:`!elif`' は 'else if' を短くしたもので、" @@ -97,36 +97,34 @@ 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 " "progression of numbers (like in Pascal), or giving the user the ability to " -"define both the iteration step and halting condition (as C), Python's :" -"keyword:`!for` statement iterates over the items of any sequence (a list or " -"a string), in the order that they appear in the sequence. For example (no " -"pun intended):" +"define both the iteration step and halting condition (as C), " +"Python's :keyword:`!for` statement iterates over the items of any sequence " +"(a list or a string), in the order that they appear in the sequence. For " +"example (no 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 +146,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 +189,13 @@ 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::" +"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 "" @@ -258,8 +254,8 @@ msgid "" "To iterate over the indices of a sequence, you can combine :func:`range` " "and :func:`len` as follows::" msgstr "" -"あるシーケンスにわたってインデクスで反復を行うには、 :func:`range` と :func:" -"`len` を次のように組み合わせられます::" +"あるシーケンスにわたってインデクスで反復を行うには、 :func:`range` " +"と :func:`len` を次のように組み合わせられます::" #: ../../tutorial/controlflow.rst:125 msgid "" @@ -319,9 +315,9 @@ msgstr "" msgid "" "We say such an object is :term:`iterable`, that is, suitable as a target for " "functions and constructs that expect something from which they can obtain " -"successive items until the supply is exhausted. We have seen that the :" -"keyword:`for` statement is such a construct, while an example of a function " -"that takes an iterable is :func:`sum`::" +"successive items until the supply is exhausted. We have seen that " +"the :keyword:`for` statement is such a construct, while an example of a " +"function that takes an iterable is :func:`sum`::" msgstr "" "このようなオブジェクトは :term:`イテラブル ` と呼ばれます。\n" "これらは関数や構成物のターゲットとして、あるだけの項目を逐次与えるのに適して" @@ -351,13 +347,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::" +"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 "" @@ -432,9 +427,9 @@ msgid "" "finishes without executing the :keyword:`!break`, the :keyword:`!else` " "clause executes." msgstr "" -":keyword:`!for` または :keyword:`!while` ループ中の :keyword:`!break` 文は :" -"keyword:`!else` 節と対になる場合があります。:keyword:`!break` を実行せずに" -"ループが終了すると、:keyword:`!else` 節が実行されます。" +":keyword:`!for` または :keyword:`!while` ループ中の :keyword:`!break` 文" +"は :keyword:`!else` 節と対になる場合があります。:keyword:`!break` を実行せず" +"にループが終了すると、:keyword:`!else` 節が実行されます。" #: ../../tutorial/controlflow.rst:208 msgid "" @@ -458,10 +453,10 @@ msgid "" "ending the loop early, such as a :keyword:`return` or a raised exception, " "will also skip execution of the :keyword:`else` clause." msgstr "" -"どちらのループでも、ループが :keyword:`break` によって終了した場合は :" -"keyword:`!else` 句は **実行されません**。当然、 :keyword:`return` や例外の発" -"生によってループが途中で終了した場合にも、:keyword:`else` 節の実行はスキップ" -"されます。" +"どちらのループでも、ループが :keyword:`break` によって終了した場合" +"は :keyword:`!else` 句は **実行されません**。当然、 :keyword:`return` や例外" +"の発生によってループが途中で終了した場合にも、:keyword:`else` 節の実行はス" +"キップされます。" #: ../../tutorial/controlflow.rst:218 msgid "" @@ -469,7 +464,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 +486,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 +509,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 +516,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 +531,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 +544,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 +597,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 +606,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 +646,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 +664,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 +686,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 +697,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 +716,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 +763,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 +771,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 "" @@ -791,8 +795,8 @@ msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " "variables would be set to what. Only the standalone names (like ``var`` " -"above) are assigned to by a match statement. Dotted names (like ``foo." -"bar``), attribute names (the ``x=`` and ``y=`` above) or class names " +"above) are assigned to by a match statement. Dotted names (like " +"``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names " "(recognized by the \"(...)\" next to them like ``Point`` above) are never " "assigned to." msgstr "" @@ -804,14 +808,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 +854,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 +877,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 +930,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 "" @@ -981,8 +981,8 @@ msgstr "" #: ../../tutorial/controlflow.rst:455 msgid "" -"For a more detailed explanation and additional examples, you can look into :" -"pep:`636` which is written in a tutorial format." +"For a more detailed explanation and additional examples, you can look " +"into :pep:`636` which is written in a tutorial format." msgstr "" "より詳細な説明と追加の例は :pep:`636` にチュートリアル形式で記述してありま" "す。" @@ -999,7 +999,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 +1012,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,30 +1031,27 @@ 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:" -"`docstring`. (More about docstrings can be found in the section :ref:`tut-" -"docstrings`.) There are tools which use docstrings to automatically produce " -"online or printed documentation, or to let the user interactively browse " -"through code; it's good practice to include docstrings in code that you " -"write, so make a habit of it." -msgstr "" -"関数の本体の記述する文の最初の行は文字列リテラルにすることもできます。その場" -"合、この文字列は関数のドキュメンテーション文字列 (documentation string)、また" +"this string literal is the function's documentation string, " +"or :dfn:`docstring`. (More about docstrings can be found in the " +"section :ref:`tut-docstrings`.) There are tools which use docstrings to " +"automatically produce online or printed documentation, or to let the user " +"interactively browse 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` でさらに扱っています。) ドキュメンテーション文字列を使ったツール" "には、オンライン文書や印刷文書を自動的に生成したり、ユーザが対話的にコードか" "ら直接閲覧できるようにするものがあります。自分が書くコードにドキュメンテー" "ション文字列を入れるのはよい習慣です。書く癖をつけてください。" -#: ../../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 +1064,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 +1093,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 "" @@ -1129,15 +1127,15 @@ msgid "" "without a :keyword:`return` statement do return a value, albeit a rather " "boring one. This value is called ``None`` (it's a built-in name). Writing " "the value ``None`` is normally suppressed by the interpreter if it would be " -"the only value written. You can see it if you really want to using :func:" -"`print`::" +"the only value written. You can see it if you really want to " +"using :func:`print`::" msgstr "" "他の言語出身の人からは、 ``fib`` は値を返さないので関数ではなく手続き " -"(procedure) だと異論があるかもしれませんね。技術的に言えば、実際には :" -"keyword:`return` 文を持たない関数もややつまらない値ですが値を返しています。こ" -"の値は ``None`` と呼ばれます (これは組み込みの名前です)。 ``None`` だけを書き" -"出そうとすると、インタプリタは通常出力を抑制します。本当に出力したいのなら、" -"以下のように :func:`print` を使うと見ることができます::" +"(procedure) だと異論があるかもしれませんね。技術的に言えば、実際に" +"は :keyword:`return` 文を持たない関数もややつまらない値ですが値を返していま" +"す。この値は ``None`` と呼ばれます (これは組み込みの名前です)。 ``None`` だけ" +"を書き出そうとすると、インタプリタは通常出力を抑制します。本当に出力したいの" +"なら、以下のように :func:`print` を使うと見ることができます::" #: ../../tutorial/controlflow.rst:531 msgid "" @@ -1149,15 +1147,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 +1168,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 +1185,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``." +"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 "" @@ -1207,23 +1202,23 @@ msgid "" "expression), and ``methodname`` is the name of a method that is defined by " "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " -"possible to define your own object types and methods, using *classes*, see :" -"ref:`tut-classes`) The method :meth:`!append` shown in the example is " +"possible to define your own object types and methods, using *classes*, " +"see :ref:`tut-classes`) The method :meth:`!append` shown in the example is " "defined for list objects; it adds a new element at the end of the list. In " "this example it is equivalent to ``result = result + [a]``, but more " "efficient." msgstr "" "``result.append(a)`` という文で、 ``result`` オブジェクトの *メソッド* が呼び" -"出されます。メソッドとは、オブジェクトに「属する」関数のことであり、 ``obj." -"methodname`` と表されます。ここで、 ``obj`` は何らかのオブジェクト (式の場合" -"もあります) であり、 ``methodname`` はそのオブジェクトの型で定義されたメソッ" -"ド名です。色々な型がそれぞれ独自のメソッドを定義しています。異なる型が同じ名" -"前のメソッドを持つことも可能であり、どちらの方のものであるかという曖昧さは生" -"まれません。(*クラス*を使って独自の型やメソッドを自分で定義することもできま" -"す。参照: :ref:`tut-classes`) 例にある :meth:`!append` メソッドは、リストオブ" -"ジェクトに対して定義されているもので、リストの末尾に新しい要素を追加します。" -"この例では ``result = result + [a]`` と等価ですが、計算効率の上ではベターで" -"す。" +"出されます。メソッドとは、オブジェクトに「属する」関数のことであり、 " +"``obj.methodname`` と表されます。ここで、 ``obj`` は何らかのオブジェクト (式" +"の場合もあります) であり、 ``methodname`` はそのオブジェクトの型で定義された" +"メソッド名です。色々な型がそれぞれ独自のメソッドを定義しています。異なる型が" +"同じ名前のメソッドを持つことも可能であり、どちらの方のものであるかという曖昧" +"さは生まれません。(*クラス*を使って独自の型やメソッドを自分で定義することもで" +"きます。参照: :ref:`tut-classes`) 例にある :meth:`!append` メソッドは、リスト" +"オブジェクトに対して定義されているもので、リストの末尾に新しい要素を追加しま" +"す。この例では ``result = result + [a]`` と等価ですが、計算効率の上ではベター" +"です。" #: ../../tutorial/controlflow.rst:572 msgid "More on Defining Functions" @@ -1339,16 +1334,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 +1426,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 +1449,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 +1633,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 +1857,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 +1873,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 +1930,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 +1943,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 +1950,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 +1979,8 @@ msgid "" msgstr "" "最後に、最も使うことの少ない選択肢として、関数が任意の個数の引数で呼び出せる" "よう指定する方法があります。これらの引数はタプル (:ref:`tut-tuples` を参照) " -"に格納されます。可変個の引数の前に、ゼロ個かそれ以上の引数があっても構いませ" -"ん。 ::" +"に格納されます。可変個の引数の前に、ゼロ個かそれ以上の通常の引数があっても構" +"いません。 ::" #: ../../tutorial/controlflow.rst:927 msgid "" @@ -2152,9 +2132,13 @@ msgstr "" #: ../../tutorial/controlflow.rst:1001 msgid "" "The above example uses a lambda expression to return a function. Another " -"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::" +"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 +2164,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 +2171,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 +2231,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 +2276,6 @@ msgstr "" "ロンの間で、 ``->`` の後ろに式を書くことで定義されます。\n" "次の例では、必須引数と任意引数、戻り値にアノテーションが付与されています::" -#: ../../tutorial/controlflow.rst:1086 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2301,9 +2294,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 @@ -2392,8 +2385,8 @@ msgid "" msgstr "" "クラスや関数に一貫性のある名前を付けること。慣習では ``UpperCamelCase`` をク" "ラス名に使い、 ``lowercase_with_underscores`` を関数名やメソッド名に使いま" -"す。常に ``self`` をメソッドの第 1 引数の名前 (クラスやメソッドについては :" -"ref:`tut-firstclasses` を見よ) として使うこと。" +"す。常に ``self`` をメソッドの第 1 引数の名前 (クラスやメソッドについて" +"は :ref:`tut-firstclasses` を見よ) として使うこと。" #: ../../tutorial/controlflow.rst:1141 msgid "" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index c50ac9c23..cb4fd15f6 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 @@ -124,8 +123,8 @@ msgid "" "customization, see :func:`sorted` for their explanation)." msgstr "" "リストの項目を、インプレース演算 (in place、元のデータを演算結果で置き換える" -"やりかた) でソートします。引数はソート方法のカスタマイズに使えます。 :func:" -"`sorted` の説明を参照してください。" +"やりかた) でソートします。引数はソート方法のカスタマイズに使えま" +"す。 :func:`sorted` の説明を参照してください。" #: ../../tutorial/datastructures.rst:90 msgid "Reverse the elements of the list in place." @@ -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 "" @@ -705,10 +701,10 @@ msgid "" "the *tuple*." msgstr "" "リストや文字列には、インデクスやスライスを使った演算のように、数多くの共通の" -"性質があることを見てきました。これらは *シーケンス (sequence)* データ型 (:" -"ref:`typesseq` を参照) の二つの例です。 Python はまだ進歩の過程にある言語なの" -"で、他のシーケンスデータ型が追加されるかもしれません。標準のシーケンス型はも" -"う一つあります: *タプル (tuple)* 型です。" +"性質があることを見てきました。これらは *シーケンス (sequence)* データ型 " +"(:ref:`typesseq` を参照) の二つの例です。 Python はまだ進歩の過程にある言語な" +"ので、他のシーケンスデータ型が追加されるかもしれません。標準のシーケンス型は" +"もう一つあります: *タプル (tuple)* 型です。" #: ../../tutorial/datastructures.rst:378 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,27 +762,28 @@ 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 " "usually contain a heterogeneous sequence of elements that are accessed via " "unpacking (see later in this section) or indexing (or even by attribute in " -"the case of :func:`namedtuples `). Lists are :term:" -"`mutable`, and their elements are usually homogeneous and are accessed by " -"iterating over the list." -msgstr "" -"タプルはリストと似ていますが、たいてい異なる場面と異なる目的で利用されます。" -"タプルは :term:`不変 ` で、複数の型の要素からなることもあり、要素" -"はアンパック(この節の後半に出てきます)操作やインデックス (あるいは :func:" -"`namedtuples ` の場合は属性)でアクセスすることが多い" -"です。一方、リストは :term:`可変 ` で、要素はたいてい同じ型のオブ" -"ジェクトであり、たいていイテレートによってアクセスします。" +"the case of :func:`namedtuples `). Lists " +"are :term:`mutable`, and their elements are usually homogeneous and are " +"accessed by iterating over the list." +msgstr "" +"タプルはリストと似て見えますが、使う場面や目的は異なることが多いです。\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 @@ -956,16 +951,16 @@ msgstr "辞書型 (dictionary)" #: ../../tutorial/datastructures.rst:495 msgid "" -"Another useful data type built into Python is the *dictionary* (see :ref:" -"`typesmapping`). Dictionaries are sometimes found in other languages as " -"\"associative memories\" or \"associative arrays\". Unlike sequences, which " -"are indexed by a range of numbers, dictionaries are indexed by *keys*, which " -"can be any immutable type; strings and numbers can always be keys. Tuples " -"can be used as keys if they contain only strings, numbers, or tuples; if a " -"tuple contains any mutable object either directly or indirectly, it cannot " -"be used as a key. You can't use lists as keys, since lists can be modified " -"in place using index assignments, slice assignments, or methods like :meth:`!" -"append` and :meth:`!extend`." +"Another useful data type built into Python is the *dictionary* " +"(see :ref:`typesmapping`). Dictionaries are sometimes found in other " +"languages as \"associative memories\" or \"associative arrays\". Unlike " +"sequences, which are indexed by a range of numbers, dictionaries are indexed " +"by *keys*, which can be any immutable type; strings and numbers can always " +"be keys. Tuples can be used as keys if they contain only strings, numbers, " +"or tuples; if a tuple contains any mutable object either directly or " +"indirectly, it cannot be used as a key. You can't use lists as keys, since " +"lists can be modified in place using index assignments, slice assignments, " +"or methods like :meth:`!append` and :meth:`!extend`." msgstr "" "もう一つ、有用な型が Python に組み込まれています。それは *辞書 (dictionary)* " "(:ref:`typesmapping` を参照)です。辞書は他の言語にも \"連想記憶 (associated " @@ -975,9 +970,9 @@ msgstr "" "文字列、数値は常にキーにすることができます。タプルは、文字列、数値、その他の" "タプルのみを含む場合はキーにすることができます。直接、あるいは間接的に変更可" "能なオブジェクトを含むタプルはキーにできません。リストをキーとして使うことは" -"できません。これは、リストにスライスやインデクス指定の代入を行ったり、 :meth:" -"`!append` や :meth:`!extend` のようなメソッドを使うと、インプレースで変更する" -"ことができるためです。" +"できません。これは、リストにスライスやインデクス指定の代入を行った" +"り、 :meth:`!append` や :meth:`!extend` のようなメソッドを使うと、インプレー" +"スで変更することができるためです。" #: ../../tutorial/datastructures.rst:506 msgid "" @@ -996,9 +991,9 @@ msgstr "" #: ../../tutorial/datastructures.rst:512 msgid "" "The main operations on a dictionary are storing a value with some key and " -"extracting the value given the key. It is also possible to delete a key:" -"value pair with ``del``. If you store using a key that is already in use, " -"the old value associated with that key is forgotten. It is an error to " +"extracting the value given the key. It is also possible to delete a " +"key:value pair with ``del``. If you store using a key that is already in " +"use, the old value associated with that key is forgotten. It is an error to " "extract a value using a non-existent key." msgstr "" "辞書での主な操作は、ある値を何らかのキーを付けて記憶することと、キーを指定し" @@ -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 " +"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..55cc5c3e6 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 @@ -153,12 +153,12 @@ msgstr "" msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " -"types in the example are :exc:`ZeroDivisionError`, :exc:`NameError` and :exc:" -"`TypeError`. The string printed as the exception type is the name of the " -"built-in exception that occurred. This is true for all built-in exceptions, " -"but need not be true for user-defined exceptions (although it is a useful " -"convention). Standard exception names are built-in identifiers (not reserved " -"keywords)." +"types in the example are :exc:`ZeroDivisionError`, :exc:`NameError` " +"and :exc:`TypeError`. The string printed as the exception type is the name " +"of the built-in exception that occurred. This is true for all built-in " +"exceptions, but need not be true for user-defined exceptions (although it is " +"a useful convention). Standard exception names are built-in identifiers (not " +"reserved keywords)." msgstr "" "エラーメッセージの最終行は何が起こったかを示しています。例外は様々な型 " "(type) で起こり、その型がエラーメッセージの一部として出力されます。上の例での" @@ -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,22 +195,20 @@ 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 " -"has been entered, but allows the user to interrupt the program (using :kbd:" -"`Control-C` or whatever the operating system supports); note that a user-" -"generated interruption is signalled by raising the :exc:`KeyboardInterrupt` " -"exception. ::" -msgstr "" -"例外を選別して処理するようなプログラムを書くことができます。以下の例を見てく" -"ださい。この例では、有効な文字列が入力されるまでユーザに入力を促しますが、" -"ユーザがプログラムに (:kbd:`Control-C` か、またはオペレーティングシステムがサ" -"ポートしている何らかのキーを使って) 割り込みをかけてプログラムを中断させるこ" -"とができるようにしています。ユーザが生成した割り込みは、 :exc:" -"`KeyboardInterrupt` 例外が送出されることで通知されるということに注意してくだ" -"さい。 ::" +"has been entered, but allows the user to interrupt the program " +"(using :kbd:`Control-C` or whatever the operating system supports); note " +"that a user-generated interruption is signalled by raising " +"the :exc:`KeyboardInterrupt` exception. ::" +msgstr "" +"特定の例外を処理するプログラムを書くことができます。\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." @@ -230,16 +235,16 @@ msgstr ":keyword:`try` 文は下記のように動作します。" #: ../../tutorial/errors.rst:105 msgid "" -"First, the *try clause* (the statement(s) between the :keyword:`try` and :" -"keyword:`except` keywords) is executed." +"First, the *try clause* (the statement(s) between the :keyword:`try` " +"and :keyword:`except` keywords) is executed." msgstr "" "まず、 *try 節 (try clause)* (キーワード :keyword:`try` と :keyword:`except` " "の間の文) が実行されます。" #: ../../tutorial/errors.rst:108 msgid "" -"If no exception occurs, the *except clause* is skipped and execution of the :" -"keyword:`try` statement is finished." +"If no exception occurs, the *except clause* is skipped and execution of " +"the :keyword:`try` statement is finished." msgstr "" "何も例外が発生しなければ、 *except 節* をスキップして :keyword:`try` 文の実行" "を終えます。" @@ -262,10 +267,10 @@ msgid "" "handler is found, it is an *unhandled exception* and execution stops with an " "error message." msgstr "" -"もしも *except 節* で指定された例外と一致しない例外が発生すると、その例外は :" -"keyword:`try` 文の外側に渡されます。例外に対するハンドラ (handler、処理部) が" -"どこにもなければ、 *処理されない例外 (unhandled exception)* となり、エラー" -"メッセージを出して実行を停止します。" +"もしも *except 節* で指定された例外と一致しない例外が発生すると、その例外" +"は :keyword:`try` 文の外側に渡されます。例外に対するハンドラ (handler、処理" +"部) がどこにもなければ、 *処理されない例外 (unhandled exception)* となり、エ" +"ラーメッセージを出して実行を停止します。" #: ../../tutorial/errors.rst:120 msgid "" @@ -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,22 +428,23 @@ 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 " "exceptions. Exceptions which are not subclasses of :exc:`Exception` are not " "typically handled, because they are used to indicate that the program should " -"terminate. They include :exc:`SystemExit` which is raised by :meth:`sys." -"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` があります。" +"terminate. They include :exc:`SystemExit` which is raised " +"by :meth:`sys.exit` and :exc:`KeyboardInterrupt` which is raised when a user " +"wishes to interrupt the program." +msgstr "" +":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,43 @@ 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::" +"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 +745,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 +784,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 +805,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 +857,6 @@ msgstr "" ":keyword:`try` 文にはもう一つオプションの節があります。この節はクリーンアップ" "動作を定義するためのもので、どんな状況でも必ず実行されます。例を示します::" -#: ../../tutorial/errors.rst:392 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -737,6 +869,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,63 +893,72 @@ 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 "" -"An exception could occur during execution of an :keyword:`!except` or :" -"keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" -"`!finally` clause has been executed." +"An exception could occur during execution of an :keyword:`!except` " +"or :keyword:`!else` clause. Again, the exception is re-raised after " +"the :keyword:`!finally` clause has been executed." msgstr "" ":keyword:`!except` 節または :keyword:`!else` 節の実行中に例外が発生することが" "あり得ます。その場合も、 :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`)." +"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 "" -"If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" -"`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " -"will execute just prior to the :keyword:`!break`, :keyword:`!continue` or :" -"keyword:`!return` statement's execution." +"If the :keyword:`!try` statement reaches " +"a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, " +"the :keyword:`!finally` clause will execute just prior to the :keyword:`!" +"break`, :keyword:`!continue` or :keyword:`!return` statement's execution." msgstr "" "もし :keyword:`!try` 文が :keyword:`break` 文、 :keyword:`continue` 文また" -"は :keyword:`return` 文のいずれかに達すると、その :keyword:`!break` 文、 :" -"keyword:`!continue` 文または :keyword:`!return` 文の実行の直前に :keyword:`!" -"finally` 節が実行されます。" +"は :keyword:`return` 文のいずれかに達すると、その :keyword:`!break` " +"文、 :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 :" -"keyword:`!return` statement, not the value from the :keyword:`!try` " -"clause's :keyword:`!return` statement. This can be confusing and is " -"therefore discouraged. From version 3.14 the compiler emits a :exc:" -"`SyntaxWarning` for it (see :pep:`765`)." -msgstr "" +"returned value will be the one from the :keyword:`!finally` " +"clause's :keyword:`!return` statement, not the value from the :keyword:`!" +"try` clause's :keyword:`!return` statement. 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:`!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 +969,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,12 +1010,38 @@ 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 "" "As you can see, the :keyword:`finally` clause is executed in any event. " -"The :exc:`TypeError` raised by dividing two strings is not handled by the :" -"keyword:`except` clause and therefore re-raised after the :keyword:`!" +"The :exc:`TypeError` raised by dividing two strings is not handled by " +"the :keyword:`except` clause and therefore re-raised after the :keyword:`!" "finally` clause has been executed." msgstr "" "見てわかるとおり、 :keyword:`finally` 節はどの場合にも実行されています。\n" @@ -889,11 +1073,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 +1094,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 +1118,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 +1125,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 +1182,6 @@ msgstr "" "に対して各 ``except*`` 節で特定の型の例外を取り出し、それ以外の例外は他の節に" "伝えられ、最終的に例外が送出されます。::" -#: ../../tutorial/errors.rst:564 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1038,19 +1224,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 +1287,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 +1318,6 @@ msgstr "" "字列を受け取り、例外のノートのリストに追加します。標準のトレースバックでは例" "外の後に、全てのノートが追加した順番に出力されます。::" -#: ../../tutorial/errors.rst:634 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1101,6 +1334,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 +1359,6 @@ msgstr "" "ト情報を追加したい場合があります。以下のグループ内の各例外が持つノートは、エ" "ラーがいつ発生したかを示しています。::" -#: ../../tutorial/errors.rst:653 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" @@ -1160,3 +1406,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..82072e14e 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,20 +246,22 @@ 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 "" "Also, since the 0.1 cannot get any closer to the exact value of 1/10 and 0.3 " -"cannot get any closer to the exact value of 3/10, then pre-rounding with :" -"func:`round` function cannot help:" +"cannot get any closer to the exact value of 3/10, then pre-rounding " +"with :func:`round` function cannot help:" msgstr "" "0.1 はこれ以上 1/10 に近くなることができない値で、 0.3 もまた 3/10 に一番近い" "値なので、 :func:`round` 関数を使って計算前に丸めを行なっても意味がありませ" @@ -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,32 +334,31 @@ 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 "" "While pathological cases do exist, for most casual use of floating-point " "arithmetic you'll see the result you expect in the end if you simply round " "the display of your final results to the number of decimal digits you " -"expect. :func:`str` usually suffices, and for finer control see the :meth:" -"`str.format` method's format specifiers in :ref:`formatstrings`." +"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 "" -"For use cases which require exact decimal representation, try using the :mod:" -"`decimal` module which implements decimal arithmetic suitable for accounting " -"applications and high-precision applications." +"For use cases which require exact decimal representation, try using " +"the :mod:`decimal` module which implements decimal arithmetic suitable for " +"accounting applications and high-precision applications." msgstr "" "正確な10進数表現が必要となるような場合には、 :mod:`decimal` モジュールを利用" "してみてください。このモジュールは会計アプリケーションや高精度の計算が求めら" @@ -360,22 +377,23 @@ msgstr "" msgid "" "If you are a heavy user of floating-point operations you should take a look " "at the NumPy package and many other packages for mathematical and " -"statistical operations supplied by the SciPy project. See ." +"statistical operations supplied by the SciPy project. See ." msgstr "" -"あなたが浮動小数点演算のヘビーユーザーなら、SciPy プロジェクトが提供している " -"NumPy パッケージやその他の数学用パッケージを調べてみるべきです。 を参照してください。" +"浮動小数点演算を頻繁に使う場合は、NumPy パッケージや、SciPy プロジェクトが提" +"供するその他の数学・統計演算用の多くのパッケージを調べてみてください。 " +" を参照してください。" #: ../../tutorial/floatingpoint.rst:181 msgid "" "Python provides tools that may help on those rare occasions when you really " -"*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:" +"*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 +401,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 +416,8 @@ msgid "" ">>> x == 3537115888337719 / 1125899906842624\n" "True" msgstr "" +">>> x == 3537115888337719 / 1125899906842624\n" +"True" #: ../../tutorial/floatingpoint.rst:200 msgid "" @@ -409,6 +432,8 @@ msgid "" ">>> x.hex()\n" "'0x1.921f9f01b866ep+1'" msgstr "" +">>> x.hex()\n" +"'0x1.921f9f01b866ep+1'" #: ../../tutorial/floatingpoint.rst:208 msgid "" @@ -423,6 +448,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 +470,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 +481,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 +494,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 +519,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 +555,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 +570,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 +587,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 +619,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 +645,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 +672,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 +695,8 @@ msgid "" ">>> 3602879701896397 * 10 ** 55 // 2 ** 55\n" "1000000000000000055511151231257827021181583404541015625" msgstr "" +">>> 3602879701896397 * 10 ** 55 // 2 ** 55\n" +"1000000000000000055511151231257827021181583404541015625" #: ../../tutorial/floatingpoint.rst:342 msgid "" @@ -650,16 +705,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 +742,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..0a268f96b 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,13 +80,18 @@ 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 "" "For a description of standard objects and modules, see :ref:`library-" "index`. :ref:`reference-index` gives a more formal definition of the " -"language. To write extensions in C or C++, read :ref:`extending-index` and :" -"ref:`c-api-index`. There are also several books covering Python in depth." +"language. To write extensions in C or C++, read :ref:`extending-index` " +"and :ref:`c-api-index`. There are also several books covering Python in " +"depth." msgstr "" "標準オブジェクトやモジュールの詳細は、 :ref:`library-index` を参照してくださ" "い。 また、正式な言語定義は、 :ref:`reference-index` にあります。 C 言語や C+" @@ -100,13 +107,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..26ad949a1 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 @@ -51,15 +51,16 @@ msgstr "出力を見やすくフォーマットする" #: ../../tutorial/inputoutput.rst:17 msgid "" "So far we've encountered two ways of writing values: *expression statements* " -"and the :func:`print` function. (A third way is using the :meth:`~io." -"TextIOBase.write` method of file objects; the standard output file can be " -"referenced as ``sys.stdout``. See the Library Reference for more information " -"on this.)" +"and the :func:`print` function. (A third way is using " +"the :meth:`~io.TextIOBase.write` method of file objects; the standard output " +"file can be referenced as ``sys.stdout``. See the Library Reference for more " +"information on this.)" msgstr "" -"これまでに、値を出力する二つの方法: *式文 (expression statement)* と :func:" -"`print` 関数が出てきました。 (第三はファイルオブジェクトの :meth:`~io." -"TextIOBase.write` メソッドを使う方法です。標準出力を表すファイルは ``sys." -"stdout`` で参照できます。詳細はライブラリリファレンスを参照してください。)" +"これまでに、値を出力する二つの方法: *式文 (expression statement)* " +"と :func:`print` 関数が出てきました。 (第三はファイルオブジェクト" +"の :meth:`~io.TextIOBase.write` メソッドを使う方法です。標準出力を表すファイ" +"ルは ``sys.stdout`` で参照できます。詳細はライブラリリファレンスを参照してく" +"ださい。)" #: ../../tutorial/inputoutput.rst:22 msgid "" @@ -90,8 +91,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 +104,9 @@ msgid "" "there are two examples of how to format variables:" msgstr "" "文字列の :meth:`str.format` メソッドは、もう少し手間がかかります。\n" -"ここでも ``{`` と ``}`` を使って変数に代入する場所の印を付けて、細かいフォー" -"マットの指示を出せますが、フォーマットされる対象の情報を与える必要がありま" -"す。次のコードには、変数をフォーマットする方法の例が二つあります:" +"ここでも ``{`` と ``}`` で変数の値を埋め込む位置を示し、細かなフォーマットの" +"指示を出せますが、フォーマットする対象の情報も渡す必要があります。\n" +"次のコードには、変数の値をフォーマットする例が 2 つあります:" #: ../../tutorial/inputoutput.rst:46 msgid "" @@ -112,13 +116,18 @@ 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 "" "Notice how the ``yes_votes`` are padded with spaces and a negative sign only " "for negative numbers. The example also prints ``percentage`` multiplied by " -"100, with 2 decimal places and followed by a percent sign (see :ref:" -"`formatspec` for details)." +"100, with 2 decimal places and followed by a percent sign " +"(see :ref:`formatspec` for details)." msgstr "" "``yes_votes`` が、スペースと、負数の場合は負符号で埋められていることに注意し" "てください。この例では、100を掛けた ``percentage`` を、パーセント記号付きで小" @@ -150,20 +159,20 @@ msgstr "" msgid "" "The :func:`str` function is meant to return representations of values which " "are fairly human-readable, while :func:`repr` is meant to generate " -"representations which can be read by the interpreter (or will force a :exc:" -"`SyntaxError` if there is no equivalent syntax). For objects which don't " -"have a particular representation for human consumption, :func:`str` will " -"return the same value as :func:`repr`. Many values, such as numbers or " +"representations which can be read by the interpreter (or will force " +"a :exc:`SyntaxError` if there is no equivalent syntax). For objects which " +"don't have a particular representation for human consumption, :func:`str` " +"will return the same value as :func:`repr`. Many values, such as numbers or " "structures like lists and dictionaries, have the same representation using " "either function. Strings, in particular, have two distinct representations." msgstr "" ":func:`str` 関数は値の人間に読める表現を返すためのもので、 :func:`repr` 関数" -"はインタープリタに読める (あるいは同値となる構文がない場合は必ず :exc:" -"`SyntaxError` になるような) 表現を返すためのものです。人間が読むのに適した特" -"定の表現を持たないオブジェクトにおいては、 :func:`str` は :func:`repr` と同じ" -"値を返します。数値や、リストや辞書を始めとするデータ構造など、多くの値がどち" -"らの関数に対しても同じ表現を返します。一方、文字列は、2つの異なる表現を持って" -"います。" +"はインタープリタに読める (あるいは同値となる構文がない場合は必" +"ず :exc:`SyntaxError` になるような) 表現を返すためのものです。人間が読むのに" +"適した特定の表現を持たないオブジェクトにおいては、 :func:`str` " +"は :func:`repr` と同じ値を返します。数値や、リストや辞書を始めとするデータ構" +"造など、多くの値がどちらの関数に対しても同じ表現を返します。一方、文字列は、2" +"つの異なる表現を持っています。" #: ../../tutorial/inputoutput.rst:75 msgid "Some examples::" @@ -229,16 +238,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 +265,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 +288,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 "" @@ -284,8 +303,8 @@ msgid "" "applies :func:`repr`::" msgstr "" "他の修飾子は、フォーマットする前に値を変換するのに使えます。\n" -"``'!a'`` は :func:`ascii` を、 ``'!s'`` は :func:`str` を、 ``'!r'`` は :" -"func:`repr` を適用します::" +"``'!a'`` は :func:`ascii` を、 ``'!s'`` は :func:`str` を、 ``'!r'`` " +"は :func:`repr` を適用します::" #: ../../tutorial/inputoutput.rst:144 msgid "" @@ -295,15 +314,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 "" @@ -312,8 +335,8 @@ msgid "" "specifications, see the reference guide for the :ref:`formatspec`." msgstr "" "``=`` 指定子の詳細については :ref:`self-documenting expressions ` を参照してください。 フォーマットについての仕様は :ref:" -"`formatspec` のリファレンスガイドを参照してください。" +"whatsnew>` を参照してください。 フォーマットについての仕様" +"は :ref:`formatspec` のリファレンスガイドを参照してください。" #: ../../tutorial/inputoutput.rst:166 msgid "The String format() Method" @@ -328,17 +351,20 @@ 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 "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " -"brackets can be used to refer to the position of the object passed into the :" -"meth:`str.format` method. ::" +"brackets can be used to refer to the position of the object passed into " +"the :meth:`str.format` method. ::" msgstr "" -"括弧とその中の文字(これをフォーマットフィールドと呼びます)は、 :meth:`str." -"format` メソッドに渡されたオブジェクトに置換されます。括弧の中の数字は :meth:" -"`str.format` メソッドに渡されたオブジェクトの位置を表すのに使えます。 ::" +"括弧とその中の文字(これをフォーマットフィールドと呼びます)" +"は、 :meth:`str.format` メソッドに渡されたオブジェクトに置換されます。括弧の" +"中の数字は :meth:`str.format` メソッドに渡されたオブジェクトの位置を表すのに" +"使えます。 ::" #: ../../tutorial/inputoutput.rst:178 msgid "" @@ -347,6 +373,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 +392,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 +406,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 +428,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 "" @@ -404,18 +444,22 @@ msgstr "" #: ../../tutorial/inputoutput.rst:209 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.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::" +"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 +468,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,11 +497,24 @@ 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 "" -"For a complete overview of string formatting with :meth:`str.format`, see :" -"ref:`formatstrings`." +"For a complete overview of string formatting with :meth:`str.format`, " +"see :ref:`formatstrings`." msgstr "" ":meth:`str.format` による文字列書式設定の完全な解説は、 :ref:`formatstrings` " "を参照してください。" @@ -502,13 +563,12 @@ msgstr "" #: ../../tutorial/inputoutput.rst:263 msgid "" -"(Note that the one space between each column was added by the way :func:" -"`print` works: it always adds spaces between its arguments.)" +"(Note that the one space between each column was added by the " +"way :func:`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 +579,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 +606,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 +624,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 +636,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 +661,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 "" @@ -620,18 +689,19 @@ msgid "" "*encoding*. If *encoding* is not specified, the default is platform " "dependent (see :func:`open`). Because UTF-8 is the modern de-facto standard, " "``encoding=\"utf-8\"`` is recommended unless you know that you need to use a " -"different encoding. Appending a ``'b'`` to the mode opens the file in :dfn:" -"`binary mode`. Binary mode data is read and written as :class:`bytes` " -"objects. You can not specify *encoding* when opening file in binary mode." +"different encoding. Appending a ``'b'`` to the mode opens the file " +"in :dfn:`binary mode`. Binary mode data is read and written " +"as :class:`bytes` objects. You can not specify *encoding* when opening file " +"in binary mode." msgstr "" "通常、ファイルはテキストモード (:dfn:`text mode`) で開かれ、特定の *エンコー" "ディング* でエンコードされたファイルに対して文字列を読み書きします。*エンコー" -"ディング* が指定されなければ、デフォルトはプラットフォーム依存です(:func:" -"`open` を参照してください)。UTF-8は現在の事実上の標準のため、異なるエンコー" -"ディングを指定したい場合以外は ``encoding=\"utf-8\"`` の指定がおすすめです。" -"モードに ``'b'`` をつけるとファイルを :dfn:`binary mode` で開きます。バイナ" -"リーモードでのデータは :class:`bytes` オブジェクトで読み書きします。ファイル" -"をバイナリーモードで開くときは *エンコーディング* は指定できません。" +"ディング* が指定されなければ、デフォルトはプラットフォーム依存です" +"(:func:`open` を参照してください)。UTF-8は現在の事実上の標準のため、異なるエ" +"ンコーディングを指定したい場合以外は ``encoding=\"utf-8\"`` の指定がおすすめ" +"です。モードに ``'b'`` をつけるとファイルを :dfn:`binary mode` で開きます。バ" +"イナリーモードでのデータは :class:`bytes` オブジェクトで読み書きします。ファ" +"イルをバイナリーモードで開くときは *エンコーディング* は指定できません。" #: ../../tutorial/inputoutput.rst:344 msgid "" @@ -639,9 +709,9 @@ msgid "" "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " "writing in text mode, the default is to convert occurrences of ``\\n`` back " "to platform-specific line endings. This behind-the-scenes modification to " -"file data is fine for text files, but will corrupt binary data like that in :" -"file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when " -"reading and writing such files." +"file data is fine for text files, but will corrupt binary data like that " +"in :file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode " +"when reading and writing such files." msgstr "" "テキストモードの読み取りでは、プラットフォーム固有の行末記号 (Unix では " "``\\n`` 、Windows では ``\\r\\n``) をただの ``\\n`` に変換するのがデフォルト" @@ -656,16 +726,16 @@ msgstr "" msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " -"suite finishes, even if an exception is raised at some point. Using :" -"keyword:`!with` is also much shorter than writing equivalent :keyword:" -"`try`\\ -\\ :keyword:`finally` blocks::" +"suite finishes, even if an exception is raised at some point. " +"Using :keyword:`!with` is also much shorter than writing " +"equivalent :keyword:`try`\\ -\\ :keyword:`finally` blocks::" msgstr "" "ファイルオブジェクトを扱うときに :keyword:`with` キーワードを使うのは良い習慣" "です。\n" "その利点は、処理中に例外が発生しても必ず最後にファイルをちゃんと閉じることで" "す。\n" -":keyword:`!with` を使うと、同じことを :keyword:`try`\\ -\\ :keyword:" -"`finally` ブロックを使って書くよりずっと簡潔に書けます::" +":keyword:`!with` を使うと、同じことを :keyword:`try`\\ -" +"\\ :keyword:`finally` ブロックを使って書くよりずっと簡潔に書けます::" #: ../../tutorial/inputoutput.rst:358 msgid "" @@ -685,8 +755,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:365 msgid "" -"If you're not using the :keyword:`with` keyword, then you should call ``f." -"close()`` to close the file and immediately free up any system resources " +"If you're not using the :keyword:`with` keyword, then you should call " +"``f.close()`` to close the file and immediately free up any system resources " "used by it." msgstr "" "もし :keyword:`with` キーワードを使用しない場合は、ファイルを閉じ、このファイ" @@ -720,6 +790,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 +836,10 @@ msgid "" ">>> f.read()\n" "''" msgstr "" +">>> f.read()\n" +"'これがファイル全体です。\\n'\n" +">>> f.read()\n" +"''" #: ../../tutorial/inputoutput.rst:411 msgid "" @@ -787,6 +866,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,14 +890,19 @@ 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 "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." msgstr "" -"ファイルのすべての行をリスト形式で読み取りたいなら、``list(f)`` や ``f." -"readlines()`` を使うこともできます。" +"ファイルのすべての行をリスト形式で読み取りたいなら、``list(f)`` や " +"``f.readlines()`` を使うこともできます。" #: ../../tutorial/inputoutput.rst:437 msgid "" @@ -827,14 +917,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 +939,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 "" @@ -921,9 +1012,10 @@ msgid "" "and :meth:`~io.IOBase.truncate` which are less frequently used; consult the " "Library Reference for a complete guide to file objects." msgstr "" -"ファイルオブジェクトには、他にも :meth:`~io.IOBase.isatty` や :meth:`~io." -"IOBase.truncate` といった、あまり使われないメソッドがあります。ファイルオブ" -"ジェクトについての完全なガイドは、ライブラリリファレンスを参照してください。" +"ファイルオブジェクトには、他にも :meth:`~io.IOBase.isatty` " +"や :meth:`~io.IOBase.truncate` といった、あまり使われないメソッドがあります。" +"ファイルオブジェクトについての完全なガイドは、ライブラリリファレンスを参照し" +"てください。" #: ../../tutorial/inputoutput.rst:488 msgid "Saving structured data with :mod:`json`" @@ -939,18 +1031,18 @@ msgid "" "parsing and serializing by hand becomes complicated." msgstr "" "文字列は簡単にファイルに読み書きできます。数値の場合には少し努力が必要です。" -"というのも、 :meth:`~io.TextIOBase.read` メソッドは文字列しか返さないため、 :" -"func:`int` のような関数にその文字列を渡して、たとえば文字列 ``'123'`` のよう" -"な文字列を、数値 123 に変換しなくてはならないからです。もっと複雑なデータ型、" -"例えば入れ子になったリストや辞書の場合、手作業でのパースやシリアライズは困難" -"になります。" +"というのも、 :meth:`~io.TextIOBase.read` メソッドは文字列しか返さないた" +"め、 :func:`int` のような関数にその文字列を渡して、たとえば文字列 ``'123'`` " +"のような文字列を、数値 123 に変換しなくてはならないからです。もっと複雑なデー" +"タ型、例えば入れ子になったリストや辞書の場合、手作業でのパースやシリアライズ" +"は困難になります。" #: ../../tutorial/inputoutput.rst:499 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " -"interchange format called `JSON (JavaScript Object Notation) `_. The standard module called :mod:`json` can take Python data " +"interchange format called `JSON (JavaScript Object Notation) `_. The standard module called :mod:`json` can take Python data " "hierarchies, and convert them to string representations; this process is " "called :dfn:`serializing`. Reconstructing the data from the string " "representation is called :dfn:`deserializing`. Between serializing and " @@ -992,12 +1084,17 @@ 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 "" -"Another variant of the :func:`~json.dumps` function, called :func:`~json." -"dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " -"a :term:`text file` object opened for writing, we can do this::" +"Another variant of the :func:`~json.dumps` function, " +"called :func:`~json.dump`, simply serializes the object to a :term:`text " +"file`. So if ``f`` is a :term:`text file` object opened for writing, we can " +"do this::" msgstr "" ":func:`~json.dumps` に似た関数に、:func:`~json.dump` があり、こちらは単純にオ" "ブジェクトを :term:`text file` にシリアライズします。``f`` が書き込み用に開か" @@ -1005,7 +1102,7 @@ msgstr "" #: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" -msgstr "" +msgstr "json.dump(x, f)" #: ../../tutorial/inputoutput.rst:528 msgid "" @@ -1017,7 +1114,7 @@ msgstr "" #: ../../tutorial/inputoutput.rst:531 msgid "x = json.load(f)" -msgstr "" +msgstr "x = json.load(f)" #: ../../tutorial/inputoutput.rst:534 msgid "" @@ -1044,7 +1141,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 +1149,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..99affacda 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 @@ -55,20 +55,20 @@ msgid "" "final ``'.'`` and then suggest completions from the attributes of the " "resulting object. Note that this may execute application-defined code if an " "object with a :meth:`~object.__getattr__` method is part of the expression. " -"The default configuration also saves your history into a file named :file:`." -"python_history` in your user directory. The history will be available again " -"during the next interactive interpreter session." +"The default configuration also saves your history into a file " +"named :file:`.python_history` in your user directory. The history will be " +"available again during the next interactive interpreter session." msgstr "" "変数とモジュール名の補完はインタプリタの起動時に :ref:`自動的に有効化されま" "す ` 。 従って :kbd:`Tab` キーは補完機能を呼び出し、" "Python の文の名前、現在のローカル変数、および利用可能なモジュール名を検索しま" "す。 ``string.a`` のようなドットで区切られた式については、最後の ``'.'`` まで" -"の式を評価し、結果として得られたオブジェクトの属性から補完候補を示します。 :" -"meth:`~object.__getattr__` メソッドを持ったオブジェクトが式に含まれている場" -"合、 :meth:`~object.__getattr__` がアプリケーション定義のコードを実行するかも" -"しれないので注意してください。デフォルトの設定ではあなたのユーザーディレクト" -"リの :file:`.python_history` という名前のファイルに履歴を保存します。 履歴は" -"次回の対話的なインタプリタのセッションで再び利用することができます。" +"の式を評価し、結果として得られたオブジェクトの属性から補完候補を示しま" +"す。 :meth:`~object.__getattr__` メソッドを持ったオブジェクトが式に含まれてい" +"る場合、 ``__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..d69f0b9fc 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,24 +115,24 @@ 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 "" "A second way of starting the interpreter is ``python -c command [arg] ...``, " -"which executes the statement(s) in *command*, analogous to the shell's :" -"option:`-c` option. Since Python statements often contain spaces or other " -"characters that are special to the shell, it is usually advised to quote " -"*command* in its entirety." +"which executes the statement(s) in *command*, analogous to the " +"shell's :option:`-c` option. Since Python statements often contain spaces " +"or other 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,19 +140,18 @@ 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 "" "When a script file is used, it is sometimes useful to be able to run the " -"script and enter interactive mode afterwards. This can be done by passing :" -"option:`-i` before the script." +"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." -"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* から参照できます。" +"インタープリタに渡したスクリプト名とその後に続く引数は、文字列のリストに変換" +"されて ``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]`` は見つかったモジュールの" +"フルパスになります。\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..8a1291bb9 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,18 +138,19 @@ msgstr "" "20\n" ">>> (50 - 5*6) / 4\n" "5.0\n" -">>> 8 / 5 # 除算は常に浮動小数点数(float)を返す\n" +">>> 8 / 5 # 除算は常に浮動小数点数を返す\n" "1.6" #: ../../tutorial/introduction.rst:68 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " -"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." +"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 +158,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 +177,7 @@ msgstr "" ">>> 17 / 3 # 除算は浮動小数点数を返す\n" "5.666666666666667\n" ">>>\n" -">>> 17 // 3 # 整数除算は小数部を破棄する\n" +">>> 17 // 3 # 切り捨て除算は小数部を切り捨てる\n" "5\n" ">>> 17 % 3 # % 演算子は剰余を返す\n" "2\n" @@ -193,7 +188,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 +207,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 +227,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 +247,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 +264,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,22 +294,22 @@ 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 "" "In addition to :class:`int` and :class:`float`, Python supports other types " -"of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." -"Fraction`. Python also has built-in support for :ref:`complex numbers " -"`, and uses the ``j`` or ``J`` suffix to indicate the " -"imaginary part (e.g. ``3+5j``)." +"of numbers, such as :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Python also has built-in support " +"for :ref:`complex numbers `, 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 +323,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 +339,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 +385,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 +412,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 +435,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 +447,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 +480,7 @@ msgstr "" msgid "" "Strings can be concatenated (glued together) with the ``+`` operator, and " "repeated with ``*``::" -msgstr "" -"文字列は ``+`` 演算子で連結させる (くっつけて一つにする) ことができ、``*`` 演" -"算子で反復させることができます::" +msgstr "文字列は ``+`` 演算子で連結し、 ``*`` 演算子で繰り返せます::" #: ../../tutorial/introduction.rst:219 msgid "" @@ -501,8 +497,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 +511,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 +525,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 +560,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 +576,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 +596,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 +624,8 @@ msgid "" "used to obtain individual characters, *slicing* allows you to obtain a " "substring::" msgstr "" -"インデクス表記に加え、 *スライス* もサポートされています。インデクス表記は" -"個々の文字を取得するのに使いますが、 *スライス* を使うと部分文字列を取得する" -"ことができます::" +"インデックス指定に加えて *スライス* も使えます。インデックス指定では個々の文" +"字を取得し、 *スライス* では部分文字列を取得できます::" #: ../../tutorial/introduction.rst:279 msgid "" @@ -650,9 +644,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 +668,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 +690,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 +715,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 +725,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 +739,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 +748,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 +767,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 +792,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 +808,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 +829,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 +839,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 +856,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 +867,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 +938,7 @@ msgid "" "type, i.e. it is possible to change their content::" msgstr "" ":term:`不変 ` な文字列とは違って、リストは :term:`可変 ` " -"型ですので、要素を入れ替えられます::" +"型ですので、内容を変更できます::" #: ../../tutorial/introduction.rst:416 msgid "" @@ -972,8 +958,8 @@ msgstr "" #: ../../tutorial/introduction.rst:423 msgid "" -"You can also add new items at the end of the list, by using the :meth:`!list." -"append` *method* (we will see more about methods later)::" +"You can also add new items at the end of the list, by using the :meth:`!" +"list.append` *method* (we will see more about methods later)::" msgstr "" ":meth:`!list.append` を使って、リストの末尾に新しい要素を追加できます (このメ" "ソッドについては後で詳しく見ていきます)::" @@ -999,7 +985,8 @@ msgid "" msgstr "" "単純な代入ではPythonは決してデータをコピーしません。リストを変数に代入する" "と、その変数は *既存のリスト* を参照します。ある変数を通してリストに任意の変" -"更を行うと、そのリストを参照したすべての他の変数を通して確認できます。::" +"更を行うと、同じリストを参照している他のすべての変数からもその変更を確認でき" +"ます。::" #: ../../tutorial/introduction.rst:436 msgid "" @@ -1141,7 +1128,7 @@ msgid "" "follows::" msgstr "" "もちろん、2 たす 2 よりももっと複雑な課題にも Python を使えます。\n" -"例えば、`Fibonacci series `_ の先頭の部分列は次のように書けます::" #: ../../tutorial/introduction.rst:503 @@ -1204,14 +1191,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 +1212,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 +1232,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..3cc3ba2ef 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 "" @@ -76,8 +77,8 @@ msgstr "" "モジュールは Python の定義や文が入ったファイルです。ファイル名はモジュール名" "に接尾語 :file:`.py` がついたものになります。モジュールの中では、(文字列の) " "モジュール名をグローバル変数 ``__name__`` で取得できます。例えば、お気に入り" -"のテキストエディタを使って、現在のディレクトリに以下の内容のファイル :file:" -"`fibo.py` を作成してみましょう::" +"のテキストエディタを使って、現在のディレクトリに以下の内容のファイ" +"ル :file:`fibo.py` を作成してみましょう::" #: ../../tutorial/modules.rst:28 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." +"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 "" @@ -328,14 +328,15 @@ msgid "" "For efficiency reasons, each module is only imported once per interpreter " "session. Therefore, if you change your modules, you must restart the " "interpreter -- or, if it's just one module you want to test interactively, " -"use :func:`importlib.reload`, e.g. ``import importlib; importlib." -"reload(modulename)``." +"use :func:`importlib.reload`, e.g. ``import importlib; " +"importlib.reload(modulename)``." msgstr "" "実行効率上の理由で、各モジュールはインタープリタの 1 セッションごとに 1 回だ" "け import されます。従って、モジュールを修正した場合には、インタープリタを再" "起動させなければなりません -- もしくは、その場で手直ししてテストしたいモ" -"ジュールが 1 つだった場合には、例えば ``import importlib; importlib." -"reload(modulename)`` のように :func:`importlib.reload` を使ってください。" +"ジュールが 1 つだった場合には、例えば ``import importlib; " +"importlib.reload(modulename)`` のように :func:`importlib.reload` を使ってくだ" +"さい。" #: ../../tutorial/modules.rst:147 msgid "Executing modules as scripts" @@ -349,15 +350,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,32 +401,35 @@ 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:" -"`sys.builtin_module_names`. If not found, it then searches for a file named :" -"file:`spam.py` in a list of directories given by the variable :data:`sys." -"path`. :data:`sys.path` is initialized from these locations:" +"for a built-in module with that name. These module names are listed " +"in :data:`sys.builtin_module_names`. If not found, it then searches for a " +"file named :file:`spam.py` in a list of directories given by the " +"variable :data:`sys.path`. :data:`sys.path` is initialized from these " +"locations:" msgstr "" ":mod:`!spam` という名前のモジュールをインポートするとき、インタープリタはまず" -"その名前の組み込みモジュールを探します。モジュール名の一覧は :data:`sys." -"builtin_module_names` にあります。見つからなかった場合は、 :file:`spam.py` と" -"いう名前のファイルを :data:`sys.path` にあるディレクトリのリストから探しま" -"す。 :data:`sys.path` は以下の場所に初期化されます:" +"その名前の組み込みモジュールを探します。モジュール名の一覧" +"は :data:`sys.builtin_module_names` にあります。\n" +"見つからなかった場合は、\n" +":file:`spam.py` という名前のファイルを :data:`sys.path` にあるディレクトリの" +"リストから探します。\n" +":data:`sys.path` は次の場所を基に初期化されます。" #: ../../tutorial/modules.rst:192 msgid "" @@ -548,24 +552,23 @@ msgid "" "have an ``opt-`` tag and are usually smaller. Future releases may change " "the effects of optimization." msgstr "" -"コンパイル済みモジュールのサイズを小さくするために、Python コマンドに :" -"option:`-O` または :option:`-OO` スイッチを使うことができます。``-O`` スイッ" -"チは assert ステートメントを除去し、``-OO`` スイッチは assert ステートメント" -"と __doc__ 文字列を除去します。いくつかのプログラムはこれらの除去されるものに" -"依存している可能性があるため、自分が何をしているかを理解しているときに限って" -"これらのオプションを使うべきです。\"最適化\" されたモジュールは ``opt-`` タグ" -"を持ち、通常のコンパイル済みモジュールよりサイズが小さくなります。将来のリ" -"リースでは最適化の影響が変わる可能性があります。" +"コンパイル済みモジュールのサイズを小さくするために、Python コマンド" +"に :option:`-O` または :option:`-OO` スイッチを使うことができます。``-O`` ス" +"イッチは assert ステートメントを除去し、``-OO`` スイッチは assert ステートメ" +"ントと __doc__ 文字列を除去します。いくつかのプログラムはこれらの除去されるも" +"のに依存している可能性があるため、自分が何をしているかを理解しているときに" +"限ってこれらのオプションを使うべきです。\"最適化\" されたモジュールは ``opt-" +"`` タグを持ち、通常のコンパイル済みモジュールよりサイズが小さくなります。将来" +"のリリースでは最適化の影響が変わる可能性があります。" -#: ../../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." +"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 +590,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 +603,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 +679,7 @@ msgid "" "defines. It returns a sorted list of strings::" msgstr "" "組込み関数 :func:`dir` は、あるモジュールがどんな名前を定義しているか調べるた" -"めに使われます。 :func:`dir` はソートされた文字列のリストを返します::" +"めに使われます。 ``dir()`` はソートされた文字列のリストを返します::" #: ../../tutorial/modules.rst:312 msgid "" @@ -768,14 +775,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`::" +"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,29 +874,30 @@ 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 " -"sound file formats (usually recognized by their extension, for example: :" -"file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to create and " -"maintain a growing collection of modules for the conversion between the " -"various file formats. There are also many different operations you might " -"want to perform on sound data (such as mixing, adding echo, applying an " -"equalizer function, creating an artificial stereo effect), so in addition " -"you will be writing a never-ending stream of modules to perform these " -"operations. Here's a possible structure for your package (expressed in " -"terms of a hierarchical filesystem):" -msgstr "" -"音声ファイルや音声データを一様に扱うためのモジュールのコレクション (\"パッ" -"ケージ\") を設計したいと仮定しましょう。 音声ファイルには多くの異なった形式が" -"ある (通常は拡張子、 例えば :file:`.wav`, :file:`.aiff`, :file:`.au` などで認" -"識されます) ので、増え続ける様々なファイル形式を相互変換するモジュールを、 作" -"成したりメンテナンスしたりする必要があるかもしれません。 また、 音声データに" -"対して実行したい様々な独自の操作 (ミキシング、 エコーの追加、 イコライザ関数" -"の適用、 人工的なステレオ効果の作成など) があるかもしれません。 そうなると、 " -"こうした操作を実行するモジュールを果てしなく書くことになるでしょう。 以下に " -"(階層的なファイルシステムで表現した) パッケージの構造案を示します:" +"sound file formats (usually recognized by their extension, for " +"example: :file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to " +"create and maintain a growing collection of modules for the conversion " +"between the various file formats. There are also many different operations " +"you might want to perform on sound data (such as mixing, adding echo, " +"applying an equalizer function, creating an artificial stereo effect), so in " +"addition you will be writing a never-ending stream of modules to perform " +"these operations. Here's a possible structure for your package (expressed " +"in terms of a hierarchical filesystem):" +msgstr "" +"音声ファイルや音声データを統一的に扱うためのモジュールの集まり (「パッケー" +"ジ」) を設計したいとします。\n" +"音声ファイルには多くの形式があり、通常" +"は :file:`.wav`、:file:`.aiff`、:file:`.au` などの拡張子で見分けます。\n" +"そのため、形式を相互変換するモジュールを作成・保守し、その数を増やしていく必" +"要があるかもしれません。\n" +"また、ミキシング、エコーの追加、イコライザ機能の適用、人工的なステレオ効果の" +"作成など、音声データに行いたい操作もさまざまです。\n" +"こうした操作を実行するためのモジュールも、次々に書くことになるでしょう。\n" +"パッケージの構造は、例えば次のようにできます (階層的なファイルシステムで表し" +"ています):" #: ../../tutorial/modules.rst:410 msgid "" @@ -941,13 +949,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." +"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 "" @@ -959,15 +967,15 @@ msgid "" "can just be an empty file, but it can also execute initialization code for " "the package or set the ``__all__`` variable, described later." msgstr "" -"ファイルを含むディレクトリをパッケージとしてPython に扱わせるには、ファイル :" -"file:`__init__.py` が必要です(より高度な機能 :term:`namespace package` を使う" -"場合を除く)。\n" +"ファイルを含むディレクトリをパッケージとしてPython に扱わせるには、ファイ" +"ル :file:`__init__.py` が必要です(より高度な機能 :term:`namespace package` を" +"使う場合を除く)。\n" "これにより、 ``string`` のようなよくある名前のディレクトリにより、モジュール" "検索パスの後の方で見つかる正しいモジュールが意図せず隠蔽されてしまうのを防ぐ" "ためです。\n" -"最も簡単なケースでは :file:`__init__.py` はただの空ファイルで構いませんが、 :" -"file:`__init__.py` ではパッケージのための初期化コードを実行したり、後述の " -"``__all__`` 変数を設定してもかまいません。" +"最も簡単なケースでは :file:`__init__.py` はただの空ファイルで構いません" +"が、 :file:`__init__.py` ではパッケージのための初期化コードを実行したり、後述" +"の ``__all__`` 変数を設定してもかまいません。" #: ../../tutorial/modules.rst:447 msgid "" @@ -1027,8 +1035,8 @@ msgstr "from sound.effects.echo import echofilter" #: ../../tutorial/modules.rst:470 msgid "" -"Again, this loads the submodule :mod:`!echo`, but this makes its function :" -"func:`!echofilter` directly available::" +"Again, this loads the submodule :mod:`!echo`, but this makes its " +"function :func:`!echofilter` directly available::" msgstr "" "また、これもサブモジュール :mod:`!echo` をロードしますが、 :func:`!" "echofilter` 関数を直接利用可能にします::" @@ -1043,16 +1051,16 @@ msgid "" "submodule (or subpackage) of the package, or some other name defined in the " "package, like a function, class or variable. The ``import`` statement first " "tests whether the item is defined in the package; if not, it assumes it is a " -"module and attempts to load it. If it fails to find it, an :exc:" -"`ImportError` exception is raised." +"module and attempts to load it. If it fails to find it, " +"an :exc:`ImportError` exception is raised." msgstr "" "``from package import item`` を使う場合、 *item* はパッケージ *package* のサ" "ブモジュール (またはサブパッケージ) でもかまいませんし、関数やクラス、変数の" "ような、 *package* で定義されている別の名前でもかまわないことに注意してくださ" "い。 ``import`` 文はまず、 *item* がパッケージ内で定義されているかどうか調べ" "ます。定義されていなければ、 *item* はモジュール名であると仮定して、モジュー" -"ルをロードしようと試みます。もしモジュールが見つからなければ、 :exc:" -"`ImportError` が送出されます。" +"ルをロードしようと試みます。もしモジュールが見つからなけれ" +"ば、 :exc:`ImportError` が送出されます。" #: ../../tutorial/modules.rst:482 msgid "" @@ -1098,15 +1106,15 @@ msgid "" "effects/__init__.py` could contain the following code::" msgstr "" "唯一の解決策は、パッケージの作者にパッケージの索引を明示的に提供させる という" -"ものです。 :keyword:`import` 文の使う規約は、パッケージの :file:`__init__." -"py` コードに ``__all__`` という名前のリストが定義されていれば、 ``from " -"package import *`` が現れたときに import すべきモジュール名のリストとして使" -"う、というものです。 パッケージの新バージョンがリリースされるときにリストを最" -"新の状態に更新するのは パッケージの作者の責任となります。 自分のパッケージか" -"ら \\* を import するという使い方が考えられないならば、 パッケージの作者はこ" -"の使い方をサポートしないことにしてもかまいません。 例えば、ファイル :file:" -"`sound/effects/__init__.py` には、次のような コードを入れてもよいかもしれませ" -"ん::" +"ものです。 :keyword:`import` 文の使う規約は、パッケージ" +"の :file:`__init__.py` コードに ``__all__`` という名前のリストが定義されてい" +"れば、 ``from package import *`` が現れたときに import すべきモジュール名のリ" +"ストとして使う、というものです。 パッケージの新バージョンがリリースされるとき" +"にリストを最新の状態に更新するのは パッケージの作者の責任となります。 自分の" +"パッケージから \\* を import するという使い方が考えられないならば、 パッケー" +"ジの作者はこの使い方をサポートしないことにしてもかまいません。 例えば、ファイ" +"ル :file:`sound/effects/__init__.py` には、次のような コードを入れてもよいか" +"もしれません::" #: ../../tutorial/modules.rst:511 msgid "__all__ = [\"echo\", \"surround\", \"reverse\"]" @@ -1147,14 +1155,23 @@ 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 "" "If ``__all__`` is not defined, the statement ``from sound.effects import *`` " "does *not* import all submodules from the package :mod:`!sound.effects` into " -"the current namespace; it only ensures that the package :mod:`!sound." -"effects` has been imported (possibly running any initialization code in :" -"file:`__init__.py`) and then imports whatever names are defined in the " +"the current namespace; it only ensures that the package :mod:`!" +"sound.effects` has been imported (possibly running any initialization code " +"in :file:`__init__.py`) and then imports whatever names are defined in the " "package. This includes any names defined (and submodules explicitly loaded) " "by :file:`__init__.py`. It also includes any submodules of the package that " "were explicitly loaded by previous :keyword:`import` statements. Consider " @@ -1183,14 +1200,14 @@ msgstr "" #: ../../tutorial/modules.rst:545 msgid "" "In this example, the :mod:`!echo` and :mod:`!surround` modules are imported " -"in the current namespace because they are defined in the :mod:`!sound." -"effects` package when the ``from...import`` statement is executed. (This " -"also works when ``__all__`` is defined.)" +"in the current namespace because they are defined in the :mod:`!" +"sound.effects` package when the ``from...import`` statement is executed. " +"(This also works when ``__all__`` is defined.)" msgstr "" "上の例では、 :mod:`!echo` と :mod:`!surround` モジュールが現在の名前空間に " -"import されます。これらのモジュールは ``from...import`` 文が実行された際に :" -"mod:`!sound.effects` 内で定義されているからです。 (この機構は ``__all__`` が" -"定義されているときにも働きます。)" +"import されます。これらのモジュールは ``from...import`` 文が実行された際" +"に :mod:`!sound.effects` 内で定義されているからです。 (この機構は " +"``__all__`` が定義されているときにも働きます。)" #: ../../tutorial/modules.rst:550 msgid "" @@ -1202,42 +1219,42 @@ 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 " -"of siblings packages. For example, if the module :mod:`!sound.filters." -"vocoder` needs to use the :mod:`!echo` module in the :mod:`!sound.effects` " -"package, it can use ``from sound.effects import echo``." +"of siblings packages. For example, if the module :mod:`!" +"sound.filters.vocoder` needs to use the :mod:`!echo` module in the :mod:`!" +"sound.effects` 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 "" "You can also write relative imports, with the ``from module import name`` " "form of import statement. These imports use leading dots to indicate the " -"current and parent packages involved in the relative import. From the :mod:" -"`!surround` module for example, you might use::" +"current and parent packages involved in the relative import. From " +"the :mod:`!surround` module for example, you might use::" msgstr "" "また、明示的な相対importを ``from module import name`` の形式の import 文で利" "用できます。この明示的な相対 import では、先頭のドットで現在および親パッケー" @@ -1278,6 +1295,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..4d5057271 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 @@ -59,8 +59,8 @@ msgid "" "function which operates much differently." msgstr "" "``from os import *`` ではなく、 ``import os`` 形式を使うようにしてください。" -"そうすることで、動作が大きく異なる組み込み関数 :func:`open` が :func:`os." -"open` で遮蔽されるのを避けられます。" +"そうすることで、動作が大きく異なる組み込み関数 :func:`open` " +"が :func:`os.open` で遮蔽されるのを避けられます。" #: ../../tutorial/stdlib.rst:29 msgid "" @@ -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,12 +181,21 @@ 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 "" -"When run at the command line with ``python top.py --lines=5 alpha.txt beta." -"txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` to " -"``['alpha.txt', 'beta.txt']``." +"When run at the command line with ``python top.py --lines=5 alpha.txt " +"beta.txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` " +"to ``['alpha.txt', 'beta.txt']``." msgstr "" "コマンドラインで ``python top.py --lines=5 alpha.txt beta.txt`` を実行する" "と、上のスクリプトは ``args.lines`` を ``5`` 、 ``args.filenames`` を " @@ -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 "" @@ -442,14 +473,14 @@ msgstr "データ圧縮" #: ../../tutorial/stdlib.rst:238 msgid "" "Common data archiving and compression formats are directly supported by " -"modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" -"`zipfile` and :mod:`tarfile`. ::" +"modules " +"including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` " +"and :mod:`tarfile`. ::" msgstr "" "一般的なデータアーカイブと圧縮形式は、以下のようなモジュールによって直接的に" -"サポートされます: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" -"`zipfile`, :mod:`tarfile`。 ::" +"サポートされま" +"す: :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 +494,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" @@ -481,14 +523,14 @@ msgstr "" #: ../../tutorial/stdlib.rst:264 msgid "" "For example, it may be tempting to use the tuple packing and unpacking " -"feature instead of the traditional approach to swapping arguments. The :mod:" -"`timeit` module quickly demonstrates a modest performance advantage::" +"feature instead of the traditional approach to swapping arguments. " +"The :mod:`timeit` module quickly demonstrates a modest performance " +"advantage::" 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 +538,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 "" @@ -503,9 +550,9 @@ msgid "" "and :mod:`pstats` modules provide tools for identifying time critical " "sections in larger blocks of code." msgstr "" -":mod:`timeit` では小さい粒度を提供しているのに対し、 :mod:`profile` や :mod:" -"`pstats` モジュールではより大きなコードブロックにおいて律速となる部分を判定す" -"るためのツールを提供しています。" +":mod:`timeit` では小さい粒度を提供しているのに対し、 :mod:`profile` " +"や :mod:`pstats` モジュールではより大きなコードブロックにおいて律速となる部分" +"を判定するためのツールを提供しています。" #: ../../tutorial/stdlib.rst:282 msgid "Quality Control" @@ -520,7 +567,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 +575,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 +650,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 "" @@ -645,32 +691,33 @@ msgid "" "The :mod:`json` package provides robust support for parsing this popular " "data interchange format. The :mod:`csv` module supports direct reading and " "writing of files in Comma-Separated Value format, commonly supported by " -"databases and spreadsheets. XML processing is supported by the :mod:`xml." -"etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, " -"these modules and packages greatly simplify data interchange between Python " -"applications and other tools." +"databases and spreadsheets. XML processing is supported by " +"the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` " +"packages. Together, these modules and packages greatly simplify data " +"interchange between Python applications and other tools." msgstr "" ":mod:`json` パッケージはこの一般的なデータ交換形式のパースをロバストにサポー" "トしています。:mod:`csv` モジュールはデータベースや表計算で一般的にサポートさ" -"れている CSV ファイルを直接読み書きするのをサポートしています。:mod:`xml." -"etree.ElementTree`、:mod:`xml.dom` ならびに :mod:`xml.sax` パッケージは XML " -"の処理をサポートしています。総合すると、これらのモジュールによって Python ア" -"プリケーションと他のツールの間でとても簡単にデータを受け渡すことが出来ます。" +"れている CSV ファイルを直接読み書きするのをサポートしていま" +"す。:mod:`xml.etree.ElementTree`、:mod:`xml.dom` ならびに :mod:`xml.sax` パッ" +"ケージは XML の処理をサポートしています。総合すると、これらのモジュールによっ" +"て 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 msgid "" -"Internationalization is supported by a number of modules including :mod:" -"`gettext`, :mod:`locale`, and the :mod:`codecs` package." +"Internationalization is supported by a number of modules " +"including :mod:`gettext`, :mod:`locale`, and the :mod:`codecs` package." msgstr "" "国際化に関する機能は、 :mod:`gettext`, :mod:`locale`, :mod:`codecs` パッケー" "ジといったモジュール群でサポートされています。" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index e5c409092..cc0cc646f 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,29 +186,32 @@ 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 "" "The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when " "a placeholder is not supplied in a dictionary or a keyword argument. For " -"mail-merge style applications, user supplied data may be incomplete and the :" -"meth:`~string.Template.safe_substitute` method may be more appropriate --- " -"it will leave placeholders unchanged if data is missing::" +"mail-merge style applications, user supplied data may be incomplete and " +"the :meth:`~string.Template.safe_substitute` method may be more appropriate " +"--- it will leave placeholders unchanged if data is missing::" msgstr "" ":meth:`~string.Template.substitute` メソッドは、プレースホルダに相当する値が" "辞書やキーワード引数にない場合に :exc:`KeyError` を送出します。メールマージ機" "能のようなアプリケーションの場合、ユーザが入力するデータは不完全なことがある" -"ので、欠落したデータがあるとプレースホルダをそのままにして出力する :meth:" -"`~string.Template.safe_substitute` メソッドを使う方が適切かもしれません::" +"ので、欠落したデータがあるとプレースホルダをそのままにして出力す" +"る :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 +222,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 +238,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 +263,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" @@ -244,23 +298,22 @@ msgstr "バイナリデータレコードの操作" #: ../../tutorial/stdlib2.rst:136 msgid "" -"The :mod:`struct` module provides :func:`~struct.pack` and :func:`~struct." -"unpack` functions for working with variable length binary record formats. " -"The following example shows how to loop through header information in a ZIP " -"file without using the :mod:`zipfile` module. Pack codes ``\"H\"`` and " -"``\"I\"`` represent two and four byte unsigned numbers respectively. The " -"``\"<\"`` indicates that they are standard size and in little-endian byte " -"order::" +"The :mod:`struct` module provides :func:`~struct.pack` " +"and :func:`~struct.unpack` functions for working with variable length binary " +"record formats. The following example shows how to loop through header " +"information in a ZIP file without using the :mod:`zipfile` module. Pack " +"codes ``\"H\"`` and ``\"I\"`` represent two and four byte unsigned numbers " +"respectively. The ``\"<\"`` indicates that they are standard size and in " +"little-endian byte order::" msgstr "" -":mod:`struct` モジュールでは、様々な長さのバイナリレコード形式を操作する :" -"func:`~struct.pack` や :func:`~struct.unpack` といった関数を提供しています。 " -"以下の例では、 :mod:`zipfile` モジュールを使わずに、ZIP ファイルのヘッダ情報" -"を巡回する方法を示しています。``\"H\"`` と ``\"I\"`` というパック符号は、そ" -"れぞれ2バイトと4バイトの符号無し 整数を表しています。 ``\"<\"`` は、そのパッ" -"ク符号が standard サイズであり、バイトオーダーがリトルエンディアンであること" -"を示しています::" +":mod:`struct` モジュールでは、様々な長さのバイナリレコード形式を操作す" +"る :func:`~struct.pack` や :func:`~struct.unpack` といった関数を提供していま" +"す。 以下の例では、 :mod:`zipfile` モジュールを使わずに、ZIP ファイルのヘッダ" +"情報を巡回する方法を示しています。``\"H\"`` と ``\"I\"`` というパック符号" +"は、それぞれ2バイトと4バイトの符号無し 整数を表しています。 ``\"<\"`` は、そ" +"のパック符号が standard サイズであり、バイトオーダーがリトルエンディアンであ" +"ることを示しています::" -#: ../../tutorial/stdlib2.rst:144 msgid "" "import struct\n" "\n" @@ -281,12 +334,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 +596,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 +615,6 @@ msgstr "" "速く、その一方で中間にある値の参照は遅くなります。こうしたオブジェクトは" "キューや木構造の幅優先探索の実装に向いています::" -#: ../../tutorial/stdlib2.rst:314 msgid "" ">>> from collections import deque\n" ">>> d = deque([\"task1\", \"task2\", \"task3\"])\n" @@ -541,8 +622,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 +637,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 +654,6 @@ msgstr "" "リストの代わりの実装以外にも、標準ライブラリにはソート済みのリストを操作する" "ための関数を備えた :mod:`bisect` のようなツールも提供しています::" -#: ../../tutorial/stdlib2.rst:334 msgid "" ">>> import bisect\n" ">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n" @@ -570,6 +661,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 +679,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 +687,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" @@ -603,9 +704,10 @@ msgid "" "decimal floating-point arithmetic. Compared to the built-in :class:`float` " "implementation of binary floating point, the class is especially helpful for" msgstr "" -":mod:`decimal` モジュールでは、 10 進浮動小数の算術演算をサポートする :class:" -"`~decimal.Decimal` データ型を提供しています。組み込みの 2 進浮動小数の実装で" -"ある :class:`float` に比べて、このクラスがとりわけ便利なのは、以下の場合です" +":mod:`decimal` モジュールでは、 10 進浮動小数の算術演算をサポートす" +"る :class:`~decimal.Decimal` データ型を提供しています。組み込みの 2 進浮動小" +"数の実装である :class:`float` に比べて、このクラスがとりわけ便利なのは、以下" +"の場合です" #: ../../tutorial/stdlib2.rst:362 msgid "" @@ -631,17 +733,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 +749,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 +762,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 +777,6 @@ msgstr "" ":class:`~decimal.Decimal` クラスは厳密な値を表現できるため、2 進浮動小数点数" "では 期待通りに計算できないような剰余の計算や等値テストも実現できます::" -#: ../../tutorial/stdlib2.rst:390 msgid "" ">>> Decimal('1.00') % Decimal('.10')\n" "Decimal('0.00')\n" @@ -684,6 +788,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 +805,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..eb123bd1d 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" @@ -93,15 +92,16 @@ msgstr "仮想環境の作成" #: ../../tutorial/venv.rst:38 msgid "" -"The module used to create and manage virtual environments is called :mod:" -"`venv`. :mod:`venv` will install the Python version from which the command " -"was run (as reported by the :option:`--version` option). For instance, " -"executing the command with ``python3.12`` will install version 3.12." +"The module used to create and manage virtual environments is " +"called :mod:`venv`. :mod:`venv` will install the Python version from which " +"the command 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 +109,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 +122,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 +133,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 +164,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 +175,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 +191,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 +207,7 @@ msgstr "仮想環境を無効化するには、ターミナルに::" #: ../../tutorial/venv.rst:93 msgid "deactivate" -msgstr "" +msgstr "deactivate" #: ../../tutorial/venv.rst:95 msgid "into the terminal." @@ -210,15 +219,15 @@ msgstr "pip を使ったパッケージ管理" #: ../../tutorial/venv.rst:100 msgid "" -"You can install, upgrade, and remove packages using a program called :" -"program:`pip`. By default ``pip`` will install packages from the `Python " -"Package Index `_. You can browse the Python Package Index " -"by going to it in your web browser." +"You can install, upgrade, and remove packages using a program " +"called :program:`pip`. By default ``pip`` will install packages from the " +"`Python 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 +235,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 +255,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 +278,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 +291,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 +306,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 +342,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 +372,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 +386,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 +398,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 +410,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 +427,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 +445,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..5820c3452 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 "" @@ -154,13 +153,13 @@ msgid "" "new features, and announcing new modules. Mailing list archives are " "available at https://mail.python.org/pipermail/." msgstr "" -"Python 関連の質問や問題の報告については、ニュースグループ :newsgroup:`comp." -"lang.python` に投稿するか、またはメーリングリスト python-list@python.org に送" -"ることができます。ニュースグループとメーリングリストはゲートウェイされます。" -"したがって、片方に投稿されたメッセージは、もう片方へ自動的に転送されます。質" -"問(と回答)、新しい機能の提案、新しいモジュールの発表などで、1日に数百通の投稿" -"があります。メーリングリストのアーカイブは https://mail.python.org/" -"pipermail/ で利用可能です。" +"Python 関連の質問や問題の報告については、ニュースグルー" +"プ :newsgroup:`comp.lang.python` に投稿するか、またはメーリングリスト python-" +"list@python.org に送ることができます。ニュースグループとメーリングリストは" +"ゲートウェイされます。したがって、片方に投稿されたメッセージは、もう片方へ自" +"動的に転送されます。質問(と回答)、新しい機能の提案、新しいモジュールの発表な" +"どで、1日に数百通の投稿があります。メーリングリストのアーカイブは https://" +"mail.python.org/pipermail/ で利用可能です。" #: ../../tutorial/whatnow.rst:64 msgid "" diff --git a/using/cmdline.po b/using/cmdline.po index d3df55a1e..1c8607ea3 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." +"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,58 +133,56 @@ 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 "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" -"c\"`` and the current directory will be added to the start of :data:`sys." -"path` (allowing modules in that directory to be imported as top level " -"modules)." +"c\"`` and the current directory will be added to the start " +"of :data:`sys.path` (allowing modules in that directory to be imported as " +"top level modules)." msgstr "" "このオプションが指定された場合、 :data:`sys.argv` の最初の要素は ``\"-c\"`` " "になり、カレントディレクトリが :data:`sys.path` の先頭に追加されます (その" "ディレクトリにあるモジュールをトップレベルモジュールとして import 出来るよう" "になります)。" -#: ../../using/cmdline.rst:74 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_command`` with " "argument ``command``." msgstr "" -"引数 ``command`` を指定して :ref:`監査イベント ` ``cpython." -"run_command`` を送出します。 " +"引数 ``command`` を指定して :ref:`監査イベント ` " +"``cpython.run_command`` を送出します。" -#: ../../using/cmdline.rst:76 msgid "*command* is automatically dedented before execution." -msgstr "" +msgstr "*command* は実行前に自動で共通のインデントが取り除かれます。" #: ../../using/cmdline.rst:81 msgid "" "Search :data:`sys.path` for the named module and execute its contents as " "the :mod:`__main__` module." msgstr "" -":data:`sys.path` から指定されたモジュール名のモジュールを探し、その内容を :" -"mod:`__main__` モジュールとして実行します。" +":data:`sys.path` から指定されたモジュール名のモジュールを探し、その内容" +"を :mod:`__main__` モジュールとして実行します。" #: ../../using/cmdline.rst:84 msgid "" @@ -231,12 +232,16 @@ 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." +":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 +251,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`` を送出します。 " +"引数 ``module-name`` を指定して :ref:`監査イベント ` " +"``cpython.run_module`` を送出します。" #: ../../using/cmdline.rst:122 msgid ":func:`runpy.run_module`" @@ -272,9 +277,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" @@ -291,19 +297,18 @@ msgstr "" #: ../../using/cmdline.rst:140 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" -"\"`` and the current directory will be added to the start of :data:`sys." -"path`." +"\"`` and the current directory will be added to the start " +"of :data:`sys.path`." 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 +340,32 @@ 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." +":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`` を送出します。 " +"引数 ``filename`` を指定して :ref:`監査イベント ` " +"``cpython.run_file`` を送出します。" #: ../../using/cmdline.rst:174 msgid ":func:`runpy.run_path`" @@ -373,9 +380,10 @@ msgid "" "config`)." msgstr "" "インターフェイスオプションが与えられなかった場合、:option:`-i` が暗黙的に指定" -"され、``sys.argv[0]`` が空の文字列 (``\"\"``) になり、 現在のディレクトリが :" -"data:`sys.path` の先頭に追加されます。また、利用可能であればタブ補完と履歴編" -"集が自動的に有効化されます (:ref:`rlcompleter-config` を参照してください)。" +"され、``sys.argv[0]`` が空の文字列 (``\"\"``) になり、 現在のディレクトリ" +"が :data:`sys.path` の先頭に追加されます。また、利用可能であればタブ補完と履" +"歴編集が自動的に有効化されます (:ref:`rlcompleter-config` を参照してくださ" +"い)。" #: ../../using/cmdline.rst:184 msgid ":ref:`tut-invoking`" @@ -389,43 +397,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 +441,21 @@ 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`)." +"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 +466,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 +475,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." +"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." +"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 "" @@ -537,63 +556,76 @@ msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -"Python を隔離モードで実行します。:option:`-E`、:option:`-P`、および :option:" -"`-s` オプションも暗黙的に指定されます。" +"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`." +"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 "" @@ -603,12 +635,11 @@ msgstr "" #: ../../using/cmdline.rst:371 msgid "" -"Turn on hash randomization. This option only has an effect if the :envvar:" -"`PYTHONHASHSEED` environment variable is set to ``0``, since hash " -"randomization is enabled by default." +"Turn on hash randomization. This option only has an effect if " +"the :envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since " +"hash 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 +647,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 +661,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." @@ -639,15 +674,14 @@ msgstr "このオプションが無視されなくなりました." #: ../../using/cmdline.rst:397 msgid "" -"Don't add the :data:`user site-packages directory ` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory ` " +"to :data:`sys.path`." msgstr "" -":data:`ユーザのサイトパッケージのディレクトリ ` を :data:" -"`sys.path` に追加しません。" +":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 @@ -658,33 +692,35 @@ msgstr ":pep:`370` -- ユーザごとの ``site-packages`` ディレクトリ" msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" ":mod:`site` モジュールの import と、そのモジュールが行なっていた site ごと" "の :data:`sys.path` への操作を無効にします。後で :mod:`site` を明示的に " -"import しても、これらの操作は実行されません (実行したい場合は、 :func:`site." -"main` を呼び出してください)。" +"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 "" "Print a message each time a module is initialized, showing the place " -"(filename or built-in module) from which it is loaded. When given twice (:" -"option:`!-vv`), print a message for each file that is checked for when " +"(filename or built-in module) from which it is loaded. When given twice " +"(:option:`!-vv`), print a message for each file that is checked for when " "searching for a module. Also provides information on module cleanup at exit." msgstr "" "モジュールが初期化されるたびにメッセージを出力し、それがどこ (ファイル名やビ" @@ -693,11 +729,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`." @@ -708,17 +745,17 @@ msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -"警告制御。 Python の警告機構はデフォルトでは警告メッセージを :data:`sys." -"stderr` に表示します。" +"警告制御。 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 +765,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 +812,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 +830,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)." +"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." +"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,98 +884,134 @@ msgstr "" "様々な実装固有のオプションのために予約されています。現在のところ CPython は以" "下の値を定義しています:" -#: ../../using/cmdline.rst:512 msgid "" -"``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" -"`PYTHONFAULTHANDLER`." +"``-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 " -"traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start tracing with a " -"traceback limit of *NFRAME* frames. See :func:`tracemalloc.start` and :" -"envvar:`PYTHONTRACEMALLOC` for more information." +"``-X tracemalloc`` to start tracing Python memory allocations using " +"the :mod:`tracemalloc` module. By default, only the most recent frame is " +"stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start " +"tracing with a 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`." +"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`." +"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`." +"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) " "to every instruction in code objects. This is useful when smaller code " "objects and pyc files are desired as well as suppressing the extra visual " -"location indicators when the interpreter displays tracebacks. See also :" -"envvar:`PYTHONNODEBUGRANGES`." +"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 "" @@ -928,11 +1021,10 @@ msgid "" "installed Python (the normal case). If it's under development (running from " "the source tree) then the default is ``off``. Note that the :mod:`!" "importlib_bootstrap` and :mod:`!importlib_bootstrap_external` frozen modules " -"are always used, even if this flag is set to ``off``. See also :envvar:" -"`PYTHON_FROZEN_MODULES`." +"are always used, even if this flag is set to ``off``. See " +"also :envvar:`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,16 +1032,31 @@ 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 " "report Python calls using DWARF information. This option is only available " "on some platforms and will do nothing if is not supported on the current " -"system. The default value is \"off\". See also :envvar:" -"`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." -msgstr "" +"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,39 +1066,53 @@ 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 "" - -#: ../../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 " -"greater than or equal to 1. This option may be useful for users who need to " -"limit CPU resources of a container system. See also :envvar:" -"`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." -msgstr "" +"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` も参照してください。" + +msgid "" +":samp:`-X cpu_count={n}` " +"overrides :func:`os.cpu_count`, :func:`os.process_cpu_count`, " +"and :func:`multiprocessing.cpu_count`. *n* must be greater than or equal to " +"1. This option may be useful for users who need to 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 "" ":samp:`-X presite={package.module}` specifies a module that should be " -"imported before the :mod:`site` module is executed and before the :mod:" -"`__main__` module exists. Therefore, the imported module isn't :mod:" -"`__main__`. This can be used to execute code early during Python " +"imported before the :mod:`site` module is executed and before " +"the :mod:`__main__` module exists. Therefore, the imported module " +"isn't :mod:`__main__`. This can be used to execute code early during Python " "initialization. Python needs to be :ref:`built in debug mode ` " "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,35 +1123,39 @@ 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 " -"store warnings filter state. If unset, the value of this option defaults to " -"``1`` on free-threaded builds and to ``0`` otherwise. See also :envvar:" -"`PYTHON_CONTEXT_AWARE_WARNINGS`." +":samp:`-X context_aware_warnings={0,1}` causes " +"the :class:`warnings.catch_warnings` context manager to use " +"a :class:`~contextvars.ContextVar` to store warnings filter state. If " +"unset, the value of this option defaults to ``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 "" -"It also allows passing arbitrary values and retrieving them through the :" -"data:`sys._xoptions` dictionary." +"It also allows passing arbitrary values and retrieving them through " +"the :data:`sys._xoptions` dictionary." 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" @@ -1079,9 +1204,9 @@ msgid "" "``FORCE_COLOR``." msgstr "" "これらのすべての環境変数は、色の出力の制御のために他のツールにも使用されま" -"す。 Python インタープリターでのみ色の出力を制御するには、 :envvar:" -"`PYTHON_COLORS` 環境変数を使用できます。この変数は、 ``FORCE_COLOR`` よりも優" -"先される ``NO_COLOR`` よりも、さらに優先されます。" +"す。 Python インタープリターでのみ色の出力を制御するに" +"は、 :envvar:`PYTHON_COLORS` 環境変数を使用できます。この変数は、 " +"``FORCE_COLOR`` よりも優先される ``NO_COLOR`` よりも、さらに優先されます。" #: ../../using/cmdline.rst:718 msgid "Environment variables" @@ -1101,15 +1226,16 @@ msgstr "" #: ../../using/cmdline.rst:727 msgid "" "Change the location of the standard Python libraries. By default, the " -"libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" -"`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and :file:" -"`{exec_prefix}` are installation-dependent directories, both defaulting to :" -"file:`/usr/local`." +"libraries are searched in :file:`{prefix}/lib/python{version}` " +"and :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` " +"and :file:`{exec_prefix}` are installation-dependent directories, both " +"defaulting to :file:`/usr/local`." msgstr "" -"標準 Python ライブラリの場所を変更します。デフォルトでは、ライブラリは :file:" -"`{prefix}/lib/python{version}` と :file:`{exec_prefix}/lib/python{version}` " -"から検索されます。ここで、 :file:`{prefix}` と :file:`{exec_prefix}` はインス" -"トール依存のディレクトリで、両方共デフォルトでは :file:`/usr/local` です。" +"標準 Python ライブラリの場所を変更します。デフォルトでは、ライブラリ" +"は :file:`{prefix}/lib/python{version}` と :file:`{exec_prefix}/lib/" +"python{version}` から検索されます。ここで、 :file:`{prefix}` " +"と :file:`{exec_prefix}` はインストール依存のディレクトリで、両方共デフォルト" +"では :file:`/usr/local` です。" #: ../../using/cmdline.rst:733 msgid "" @@ -1117,16 +1243,16 @@ msgid "" "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -":envvar:`PYTHONHOME` が1つのディレクトリに設定されている場合、その値は :file:" -"`{prefix}` と :file:`{exec_prefix}` の両方を置き換えます。それらに別々の値を" -"指定したい場合は、 :envvar:`PYTHONHOME` を :file:`{prefix}:{exec_prefix}` の" -"ように指定します。" +":envvar:`PYTHONHOME` が1つのディレクトリに設定されている場合、その値" +"は :file:`{prefix}` と :file:`{exec_prefix}` の両方を置き換えます。それらに" +"別々の値を指定したい場合は、 :envvar:`PYTHONHOME` を :file:`{prefix}:" +"{exec_prefix}` のように指定します。" #: ../../using/cmdline.rst:740 msgid "" "Augment the default search path for module files. The format is the same as " -"the shell's :envvar:`PATH`: one or more directory pathnames separated by :" -"data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). Non-" +"the shell's :envvar:`PATH`: one or more directory pathnames separated " +"by :data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). Non-" "existent directories are silently ignored." msgstr "" "モジュールファイルのデフォルトの検索パスを追加します。この環境変数のフォー" @@ -1157,8 +1283,8 @@ msgstr "" #: ../../using/cmdline.rst:753 msgid "" -"An additional directory will be inserted in the search path in front of :" -"envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" +"An additional directory will be inserted in the search path in front " +"of :envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" "options`. The search path can be manipulated from within a Python program as " "the variable :data:`sys.path`." msgstr "" @@ -1166,17 +1292,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." +"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,53 +1324,64 @@ 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 "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-O` option. If set to an integer, it is equivalent to specifying :" -"option:`-O` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-O` option. If set to an integer, it is equivalent to " +"specifying :option:`-O` multiple times." msgstr "" "この変数に空でない文字列を設定するのは :option:`-O` オプションを指定するのと" "等価です。整数を設定した場合、 :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 " "by the default implementation of :func:`sys.breakpointhook` which itself is " "called by built-in :func:`breakpoint`. If not set, or set to the empty " "string, it is equivalent to the value \"pdb.set_trace\". Setting this to " -"the string \"0\" causes the default implementation of :func:`sys." -"breakpointhook` to do nothing but return immediately." -msgstr "" +"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 "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-d` option. If set to an integer, it is equivalent to specifying :" -"option:`-d` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-d` option. If set to an integer, it is equivalent to " +"specifying :option:`-d` multiple times." msgstr "" "この変数に空でない文字列を設定するのは :option:`-d` オプションを指定するのと" "等価です。整数を指定した場合、 :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 "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-i` option." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-i` option." msgstr "" "この変数に空でない文字列を設定するのは :option:`-i` オプションを指定するのと" "等価です。" @@ -1255,29 +1394,32 @@ 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 "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-u` option." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-u` option." msgstr "" "この変数に空でない文字列を設定するのは :option:`-u` オプションを指定するのと" "等価です。" #: ../../using/cmdline.rst:845 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-v` option. If set to an integer, it is equivalent to specifying :" -"option:`-v` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-v` option. If set to an integer, it is equivalent to " +"specifying :option:`-v` multiple times." msgstr "" "この変数に空でない文字列を設定するのは :option:`-v` オプションを指定するのと" "等価です。整数を設定した場合、 :option:`-v` を複数回指定したのと同じになりま" @@ -1301,13 +1443,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 +1488,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 "" @@ -1357,10 +1503,10 @@ msgid "" "Both the ``encodingname`` and the ``:errorhandler`` parts are optional and " "have the same meaning as in :func:`str.encode`." msgstr "" -"この変数がインタープリタ実行前に設定されていた場合、``encodingname:" -"errorhandler`` という文法で標準入力/標準出力/標準エラー出力のエンコードを上書" -"きします。 ``encodingname`` と ``:errorhandler`` の部分はどちらも任意で、:" -"func:`str.encode` と同じ意味を持ちます。" +"この変数がインタープリタ実行前に設定されていた場合、" +"``encodingname:errorhandler`` という文法で標準入力/標準出力/標準エラー出力の" +"エンコードを上書きします。 ``encodingname`` と ``:errorhandler`` の部分はどち" +"らも任意で、:func:`str.encode` と同じ意味を持ちます。" #: ../../using/cmdline.rst:906 msgid "" @@ -1374,13 +1520,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 +1540,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 " +"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 +1559,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,17 +1577,27 @@ 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:" -"`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:" -"`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python " -"traceback. This is equivalent to :option:`-X` ``faulthandler`` option." +"If this environment variable is set to a non-empty " +"string, :func:`faulthandler.enable` is called at startup: install a handler " +"for :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~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,94 +1606,114 @@ 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." +"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 "" -"If this environment variable is set to a non-empty string, enable the :ref:" -"`debug mode ` of the :mod:`asyncio` module." +"If this environment variable is set to a non-empty string, enable " +"the :ref:`debug mode ` of the :mod:`asyncio` module." msgstr "" -"この環境変数が空でない文字列に設定された場合、:mod:`asyncio` モジュールの :" -"ref:`デバッグモード ` が有効化されます。" +"この環境変数が空でない文字列に設定された場合、: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`)." +"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." +"``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." +"``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 "" -"If set to a non-empty string, Python will print statistics of the :ref:" -"`pymalloc memory allocator ` every time a new pymalloc object " -"arena is created, and on shutdown." +"If set to a non-empty string, Python will print statistics of " +"the :ref:`pymalloc memory allocator ` every time a new pymalloc " +"object arena is created, and on shutdown." msgstr "" "空でない文字列に設定されると、Python は新たなオブジェクトアリーナが生成される" "時と、シャットダウン時に :ref:`pymalloc メモリアロケータ ` の統計情" @@ -1542,56 +1726,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`." +"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 +1795,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 +1813,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,26 +1824,44 @@ 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:" -"`error handler ` for :data:`sys.stdin` and :data:`sys." -"stdout` (:data:`sys.stderr` continues to use ``backslashreplace`` as it does " -"in any other locale). This stream handling behavior can be overridden using :" -"envvar:`PYTHONIOENCODING` as usual." -msgstr "" +"implicit locale coercion) automatically enables the " +"``surrogateescape`` :ref:`error handler ` " +"for :data:`sys.stdin` and :data:`sys.stdout` (:data:`sys.stderr` continues " +"to use ``backslashreplace`` as it does 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 +1869,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." +"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." +"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 +1923,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`." +"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`." +"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,43 +1999,51 @@ 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`." +"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 "" "If this variable is set to any value, the interpreter will not attempt to " -"load the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" -"`readline`, and will instead use the traditional parser-based :term:`REPL`." +"load the Python-based :term:`REPL` that requires :mod:`curses` " +"and :mod:`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)." +"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 +2054,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 +2087,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..38ab25191 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 @@ -55,13 +55,16 @@ msgstr "Windows では、 Microsoft Visual Studio 2017 以降が必要です。" #: ../../using/configure.rst:19 msgid "" "Support for `IEEE 754 `_ floating-" -"point numbers and `floating-point Not-a-Number (NaN) `_." +"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 "" @@ -79,8 +82,8 @@ msgstr "" #: ../../using/configure.rst:32 msgid "" -"Autoconf 2.72 and aclocal 1.16.5 are required to regenerate the :file:" -"`configure` script." +"Autoconf 2.72 and aclocal 1.16.5 are required to regenerate " +"the :file:`configure` script." msgstr "" #: ../../using/configure.rst:35 @@ -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,27 +220,28 @@ 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 "" -"See the :meth:`sqlite3.Connection.enable_load_extension` method of the :mod:" -"`sqlite3` module." +"See the :meth:`sqlite3.Connection.enable_load_extension` method of " +"the :mod:`sqlite3` module." msgstr "" ":mod:`sqlite3` モジュールの :meth:`sqlite3.Connection.enable_load_extension` " "メソッドを参照してください。" #: ../../using/configure.rst:124 msgid "" -"Disable IPv6 support (enabled by default if supported), see the :mod:" -"`socket` module." +"Disable IPv6 support (enabled by default if supported), see " +"the :mod:`socket` module." msgstr "" -"IPv6サポートを無効にします(サポートされている場合はデフォルトで有効)、 :mod:" -"`socket` モジュールを参照してください。" +"IPv6サポートを無効にします(サポートされている場合はデフォルトで有" +"効)、 :mod:`socket` モジュールを参照してください。" #: ../../using/configure.rst:129 msgid "Define the size in bits of Python :class:`int` digits: 15 or 30 bits." @@ -249,31 +269,29 @@ msgstr "Python の実行ファイルの接尾辞を *SUFFIX* に設定します #: ../../using/configure.rst:141 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " -"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." -"wasm`` on WASI, and an empty string on other platforms (``python`` " +"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, " +"``.wasm`` on WASI, and an empty string on other platforms (``python`` " "executable)." msgstr "" "デフォルトの接尾辞は、 Windows と macOS では ``.exe`` ( ``python.exe`` 実行" -"ファイル)、 Emscripten node では ``.js`` 、 Emscripten browser では ``." -"html`` 、 WASI では ``.wasm`` 、その他のプラットフォームでは空文字列になりま" -"す ( ``python`` 実行ファイル)。" +"ファイル)、 Emscripten node では ``.js`` 、 Emscripten browser では " +"``.html`` 、 WASI では ``.wasm`` 、その他のプラットフォームでは空文字列になり" +"ます ( ``python`` 実行ファイル)。" -#: ../../using/configure.rst:146 msgid "" -"The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." -"wasm``." +"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." +"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,176 +472,163 @@ 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 "" -"Enables **experimental** support for running Python without the :term:" -"`global interpreter lock` (GIL): free threading build." +"Enables **experimental** support for running Python without " +"the :term:`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`." +"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``." +"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``." +"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." @@ -787,8 +810,8 @@ msgstr "インストールオプション" #: ../../using/configure.rst:492 msgid "" -"Install architecture-independent files in PREFIX. On Unix, it defaults to :" -"file:`/usr/local`." +"Install architecture-independent files in PREFIX. On Unix, it defaults " +"to :file:`/usr/local`." msgstr "" "アーキテクチャに依存しないファイルを PREFIX にインストールします。Unix の場" "合、デフォルトは :file:`/usr/local` です。" @@ -797,21 +820,20 @@ 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 "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -"アーキテクチャ依存のファイルを EPREFIX にインストールします。デフォルトは :" -"option:`--prefix` です。" +"アーキテクチャ依存のファイルを EPREFIX にインストールします。デフォルト" +"は :option:`--prefix` です。" #: ../../using/configure.rst:504 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." @@ -820,8 +842,8 @@ msgstr "" #: ../../using/configure.rst:508 msgid "" -"Don't build nor install test modules, like the :mod:`test` package or the :" -"mod:`!_testcapi` extension module (built and installed by default)." +"Don't build nor install test modules, like the :mod:`test` package or " +"the :mod:`!_testcapi` extension module (built and installed by default)." msgstr "" ":mod:`test` パッケージや :mod:`!_testcapi` 拡張モジュール(デフォルトでビル" "ド、インストールされます)のようなテストモジュールをビルド、インストールしない" @@ -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,81 +990,102 @@ 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." +"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 " +"Enable interpreters using tail calls in CPython. If enabled, enabling PGO " +"(:option:`--enable-optimizations`) is highly recommended. This option " "specifically requires a C compiler with proper tail call support, and the " "`preserve_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,240 +1094,265 @@ 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 "" "Release builds and debug builds are now ABI compatible: defining the " -"``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" -"option:`--with-trace-refs` option)." +"``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see " +"the :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,68 +1543,57 @@ 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 "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -"作成するユニバーサルバイナリの種類を指定します。このオプションは、 :option:" -"`--enable-universalsdk` が指定された場合のみ有効です。" +"作成するユニバーサルバイナリの種類を指定します。このオプション" +"は、 :option:`--enable-universalsdk` が指定された場合のみ有効です。" #: ../../using/configure.rst:997 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,11 +1601,16 @@ msgid "" "tags used on macOS `_" msgstr "" +"この構成項目の値は、macOS のユニバーサルバイナリ wheel で使用する識別子と同じ" +"では *ない* ことに注意してください。\n" +"詳しくは、Python Packaging User Guide の `macOS で使用するパッケージングのプ" +"ラットフォーム互換性タグ `_ を参照してください。" #: ../../using/configure.rst:1016 msgid "" -"Specify the name for the python framework on macOS only valid when :option:" -"`--enable-framework` is set (default: ``Python``)." +"Specify the name for the python framework on macOS only valid " +"when :option:`--enable-framework` is set (default: ``Python``)." msgstr "" "macOS の Python フレームワークの名前を指定します。 :option:`--enable-" "framework` が指定された場合のみ有効です (デフォルトでは ``Python``) 。" @@ -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" @@ -1669,8 +1746,8 @@ msgstr ":file:`pyconfig.h` (:file:`configure` により作成されます);" #: ../../using/configure.rst:1104 msgid "" -":file:`Modules/Setup`: C extensions built by the Makefile using :file:" -"`Module/makesetup` shell script;" +":file:`Modules/Setup`: C extensions built by the Makefile " +"using :file:`Module/makesetup` shell script;" msgstr "" ":file:`Modules/Setup`: :file:`Module/makesetup` シェルスクリプトを使用して " "Makefile がビルドする C 拡張。" @@ -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,37 +1964,56 @@ 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" -"\n" +"\n" ">>> _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 "" -"The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" -"`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " -"depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" +"The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` " +"and :c:macro:`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are " +"defined differently depending if the ``Py_BUILD_CORE_MODULE`` macro is " +"defined:" msgstr "" #: ../../using/configure.rst:1259 @@ -1910,37 +2024,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 +2065,53 @@ 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)``." +"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`)." +"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." +"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 +2119,196 @@ 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)``." +"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)``." +"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`)." +":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." +"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 +2317,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..bae0d6674 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 @@ -33,14 +33,13 @@ msgid "" "checks." msgstr "" "Python プログラミング言語をサポートする IDE はたくさんあります。\n" -"多くのエディタや IDE にはシンタックスハイライト機能、デバッグツール、 :pep:" -"`8` チェック機能があります。" +"多くのエディタや IDE にはシンタックスハイライト機能、デバッグツー" +"ル、 :pep:`8` チェック機能があります。" #: ../../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,16 +47,25 @@ 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 `_ and `Integrated Development Environments `_ for a comprehensive " -"list." +"PythonEditors>`_ and `Integrated Development Environments `_ 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..b928f8b9f 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 "" @@ -440,9 +497,9 @@ msgstr "" #: ../../using/mac.rst:300 msgid "" -"For this release, the **Shell profile updater** package and the :file:" -"`Update Shell Profile.command` in |usemac_applications_folder_version| do " -"not support the free-threaded package." +"For this release, the **Shell profile updater** package and " +"the :file:`Update Shell Profile.command` in |" +"usemac_applications_folder_version| do not support the free-threaded package." msgstr "" #: ../../using/mac.rst:304 @@ -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 "" @@ -525,10 +592,10 @@ msgid "" "except for :file:`Python.framework`. Be aware that having both framework " "``bin`` directories in ``PATH`` can lead to confusion if there are duplicate " "names like ``python3.13`` in both; which one is actually used depends on the " -"order they appear in ``PATH``. The ``which python3.x`` or ``which python3." -"xt`` commands can show which path is being used. Using virtual environments " -"can help avoid such ambiguities. Another option might be to create a shell :" -"command:`alias` to the desired interpreter, like:" +"order they appear in ``PATH``. The ``which python3.x`` or ``which " +"python3.xt`` commands can show which path is being used. Using virtual " +"environments can help avoid such ambiguities. Another option might be to " +"create a shell :command:`alias` to the desired interpreter, like:" msgstr "" #: ../../using/mac.rst:358 @@ -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 "" @@ -567,8 +633,8 @@ msgid "" "# while accepting the other defaults (install all other packages)\n" "cat > ./choicechanges.plist <\n" -"\n" +"\n" "\n" "\n" " \n" @@ -583,8 +649,8 @@ msgid "" "\n" "EOF\n" "\n" -"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges." -"plist -target /" +"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./" +"choicechanges.plist -target /" msgstr "" #: ../../using/mac.rst:405 @@ -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." +"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 " +"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..079c8e210 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::" @@ -159,9 +176,11 @@ msgstr "例えば、i386 ユーザーが Python 2.5.1 を取得するには次 #: ../../using/unix.rst:79 msgid "" -"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." -"tgz" +"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 "" @@ -199,35 +221,33 @@ msgid "" "in the root of the Python source tree." msgstr "" ":ref:`Configure のオプション ` や特定の Unix プラット" -"フォームにおける注意点は Python ソースツリーのルートにある :source:`README." -"rst` に細かく記載されています。" +"フォームにおける注意点は 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..330024542 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,30 +150,42 @@ 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 "" "When you first install a runtime, you will likely be prompted to add a " "directory to your :envvar:`PATH`. This is optional, if you prefer to use the " "``py`` command, but is offered for those who prefer the full range of " -"aliases (such as ``python3.14.exe``) to be available. The directory will be :" -"file:`%LocalAppData%\\\\Python\\\\bin` by default, but may be customized by " -"an administrator. Click Start and search for \"Edit environment variables " +"aliases (such as ``python3.14.exe``) to be available. The directory will " +"be :file:`%LocalAppData%\\\\Python\\\\bin` by default, but may be customized " +"by an administrator. Click Start and search for \"Edit environment variables " "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,23 @@ 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." +"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 +293,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 +318,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 +332,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 +346,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 +366,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 +392,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 +439,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 +446,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 +470,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 +492,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 +535,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 +549,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 +596,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 +637,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 +655,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 +675,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 +700,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 +751,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 +775,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 +817,55 @@ 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\"}}``." +"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 +876,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,32 +924,45 @@ 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 " "aliases directory (which you may have added to your :envvar:`PATH` " -"environment variable) can be used in a shebang, even if it is not on your :" -"envvar:`PATH`. This allows the use of shebangs like ``/usr/bin/python3.12`` " -"to select a particular runtime." +"environment variable) can be used in a shebang, even if it is not on " +"your :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 " -"the behaviour of the Unix ``env`` program, which performs the same search, " -"but prefers launching known Python commands. A warning may be displayed when " -"searching for arbitrary executables, and this search may be disabled by the " -"``shebang_can_run_anything`` configuration option." +"The ``/usr/bin/env`` form of shebang line will also search " +"the :envvar:`PATH` environment variable for unrecognized commands. This " +"corresponds to the behaviour of the Unix ``env`` program, which performs the " +"same search, but prefers launching known Python commands. A warning may be " +"displayed when 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 +980,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 +989,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,26 +1024,41 @@ msgid "" "own system-wide modifications to :envvar:`PATH`, the registry, or the Start " "menu." msgstr "" - -#: ../../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%\\" -"\\Microsoft\\\\WindowsApps\\\\PythonSoftwareFoundation." -"PythonManager_3847v3x7pw1km` or :file:`%LocalAppData%\\\\Microsoft\\" -"\\WindowsApps\\\\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0`, " -"depending on whether it was installed from python.org or through the Windows " -"Store. Attempting to run the executable directly from Program Files is not " +"MSI によってインストールしたランタイムは MSIX によってインストールしたものと" +"共有され、すべてユーザ単位に限られます。\n" +"Python インストールマネージャは、マシン単位のランタイムのインストールをサポー" +"トしていません。\n" +"マシン単位のインストールを模倣するには、管理者として ``py install --" +"target=`` を実行し、:envvar:`PATH`、レジストリ、スタートメ" +"ニューにシステム全体への変更を自分で追加できます。" + +msgid "" +"When the MSIX is installed, but commands are not available in " +"the :envvar:`PATH` environment variable, they can be found " +"under :file:`%LocalAppData%\\\\Microsoft\\\\WindowsApps\\" +"\\PythonSoftwareFoundation.PythonManager_3847v3x7pw1km` " +"or :file:`%LocalAppData%\\\\Microsoft\\\\WindowsApps\\" +"\\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0`, depending on " +"whether it was installed from python.org or through the Windows 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 +1066,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 +1080,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 +1141,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 +1170,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 +1177,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 +1194,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 +1214,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,56 +1290,57 @@ 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 "" -"Comma-separated list of shortcut kinds to exclude (e.g. ``\"pep514," -"start\"``). Disabled shortcuts are not reactivated by " +"Comma-separated list of shortcut kinds to exclude (e.g. " +"``\"pep514,start\"``). Disabled shortcuts are not reactivated by " "``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`." +"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 +1382,8 @@ msgid "" "commands." msgstr "" -#: ../../using/windows.rst:711 ../../using/windows.rst:719 msgid "Troubleshooting" -msgstr "" +msgstr "トラブルシューティング" #: ../../using/windows.rst:713 msgid "" @@ -1194,40 +1394,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 +1439,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 +1484,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 +1502,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." +"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 +1551,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 +1573,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 +1609,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 +1616,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 +1633,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 +1673,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 +1682,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 "" @@ -1506,8 +1723,8 @@ msgid "" "information on using nuget. What follows is a summary that is sufficient for " "Python developers." msgstr "" -"nuget の使用方法についての最新の情報を得るには `nuget.org `_ に行ってください。\n" +"nuget の使用方法についての最新の情報を得るには `nuget.org `_ に行ってください。\n" "ここから先は Python 開発者にとって十分な要約です。" #: ../../using/windows.rst:883 @@ -1522,13 +1739,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 +1754,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 +1772,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 "" @@ -1605,16 +1827,17 @@ msgid "" "version, `pythonx86-freethreaded `_ for the 32-bit version, and `pythonarm64-freethreaded " "`_ for the ARM64 " -"version. These packages contain both the ``python3.13t.exe`` and ``python." -"exe`` entry points, both of which run free threaded." +"version. These packages contain both the ``python3.13t.exe`` and " +"``python.exe`` entry points, both of which run free threaded." msgstr "" "フリースレッドバイナリ (free-threaded binaries) を含むパッケージは、 64-bit " "版では `python-freethreaded `_ 、 32-bit 版では `pythonx86-freethreaded `_ 、 ARM64 版では `pythonarm64-" -"freethreaded `_ と命" -"名されます。これらのパッケージはともに ``python3.13t.exe`` と ``python.exe`` " -"エントリーポイントを含み、どちらもフリースレッドで実行されます。" +"freethreaded>`_ 、 32-bit 版では `pythonx86-freethreaded `_ 、 ARM64 版では " +"`pythonarm64-freethreaded `_ と命名されます。これらのパッケージはともに " +"``python3.13t.exe`` と ``python.exe`` エントリーポイントを含み、どちらもフ" +"リースレッドで実行されます。" #: ../../using/windows.rst:946 msgid "Alternative bundles" @@ -1649,10 +1872,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 +1916,8 @@ msgstr "" "ませんし、コア Python チームはこれらを保守もしませんしサポートもしませんので" "ご理解ください。" -#: ../../using/windows.rst:974 msgid "Supported Windows versions" -msgstr "" +msgstr "サポートする Windows のバージョン" #: ../../using/windows.rst:976 msgid "" @@ -1718,7 +1940,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 +1947,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 +1962,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" @@ -1748,15 +1975,17 @@ msgstr "UTF-8 モード" #: ../../using/windows.rst:1010 msgid "" "Windows still uses legacy encodings for the system encoding (the ANSI Code " -"Page). Python uses it for the default encoding of text files (e.g. :func:" -"`locale.getencoding`)." +"Page). Python uses it for the default encoding of text files " +"(e.g. :func:`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 +2011,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 "" @@ -1825,31 +2056,30 @@ msgstr "" #: ../../using/windows.rst:1055 msgid "" -"If the environment variable :envvar:`PYTHONPATH` exists, as described in :" -"ref:`using-on-envvars`, its entries are added next. Note that on Windows, " -"paths in this variable must be separated by semicolons, to distinguish them " -"from the colon used in drive identifiers (``C:\\`` etc.)." +"If the environment variable :envvar:`PYTHONPATH` exists, as described " +"in :ref:`using-on-envvars`, its entries are added next. Note that on " +"Windows, paths in this variable must be separated by semicolons, to " +"distinguish them from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" "その次に、 :envvar:`PYTHONPATH` 環境変数が存在するとき、 :ref:`using-on-" "envvars` で解説されているように追加されます。 Windows ではドライブ識別子 " "(``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 " -"both the ``HKEY_CURRENT_USER`` and ``HKEY_LOCAL_MACHINE`` hives. Subkeys " -"which have semicolon-delimited path strings as their default value will " -"cause each path to be added to :data:`sys.path`. (Note that all known " +"Additional \"application paths\" can be added in the registry as subkeys " +"of :samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` " +"under both the ``HKEY_CURRENT_USER`` and ``HKEY_LOCAL_MACHINE`` hives. " +"Subkeys which have semicolon-delimited path strings as their default value " +"will 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 +2132,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,19 +2174,22 @@ 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 "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " -"executable, explicitly set :c:member:`PyConfig.module_search_paths` before :" -"c:func:`Py_InitializeFromConfig`." +"executable, explicitly set :c:member:`PyConfig.module_search_paths` " +"before :c:func:`Py_InitializeFromConfig`." msgstr "" #: ../../using/windows.rst:1113 @@ -1965,11 +2197,10 @@ msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -"自身のアプリケーションから :file:`python.exe` を起動する前に、 :envvar:" -"`PYTHONPATH` をクリアしたり上書きし、 :envvar:`PYTHONHOME` をセットしてくださ" -"い。" +"自身のアプリケーションから :file:`python.exe` を起動する前" +"に、 :envvar:`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 +2208,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 "" @@ -1995,23 +2231,28 @@ msgstr "" #: ../../using/windows.rst:1130 msgid "" -"Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." -"cfg``." +"Add ``._pth`` file support and removes ``applocal`` option from " +"``pyvenv.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 +2280,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,26 +2307,28 @@ 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 "" -"`PythonWin `_ is a sample MFC application shipped with PyWin32. " -"It is an embeddable IDE with a built-in debugger." +"`PythonWin `_ is a sample MFC application shipped " +"with PyWin32. It is an embeddable IDE with a built-in debugger." msgstr "" -"`PythonWin `_ は PyWin32 に付属している、サンプルのMFCアプリケー" -"ションです。これはビルトインのデバッガを含む、組み込み可能なIDEです。" +"`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 +2346,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 +2397,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 +2474,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 "" @@ -2443,13 +2692,13 @@ msgstr "自分一人用インストールのためのデフォルトインスト #: ../../using/windows.rst:1333 msgid "" -":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` or :file:" -"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` or :file:" -"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" +":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` " +"or :file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` " +"or :file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" msgstr "" -":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` または :file:" -"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` または :file:" -"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" +":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` また" +"は :file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` また" +"は :file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" #: ../../using/windows.rst:1343 msgid "DefaultCustomTargetDir" @@ -2505,13 +2754,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 +2897,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 +2908,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 +2929,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 "" @@ -2702,11 +2948,12 @@ msgstr "" #: ../../using/windows.rst:1420 msgid "" -"The options listed above can also be provided in a file named ``unattend." -"xml`` alongside the executable. This file specifies a list of options and " -"values. When a value is provided as an attribute, it will be converted to a " -"number if possible. Values provided as element text are always left as " -"strings. This example file sets the same options as the previous example:" +"The options listed above can also be provided in a file named " +"``unattend.xml`` alongside the executable. This file specifies a list of " +"options and values. When a value is provided as an attribute, it will be " +"converted to a number if possible. Values provided as element text are " +"always left as strings. This example file sets the same options as the " +"previous example:" msgstr "" "上でリストしたオプションは、実行ファイルと同じ場所の ``unattend.xml`` と名付" "けられたファイルで与えることもできます。このファイルはオプションとその値のリ" @@ -2714,7 +2961,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 +2993,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 +3057,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." +"\"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 +3081,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 +3098,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 +3116,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 "" @@ -2912,15 +3184,14 @@ msgid "" "of Python, so it does not matter which version is installed. To check that " "the launcher is available, execute the following command in Command Prompt::" msgstr "" -"Python 3.3 とそれ以降のシステムワイドなインストールでは、ランチャーが :" -"envvar:`PATH` に追加されます。ランチャーは、入手可能なあらゆる Python のバー" -"ジョンに互換性があるため、実際にどのバージョンの Python がインストールされて" -"いるのかは重要ではありません。ランチャーが使えるかを確認するには以下のコマン" -"ドをコマンドプロンプトで実行してください::" +"Python 3.3 とそれ以降のシステムワイドなインストールでは、ランチャー" +"が :envvar:`PATH` に追加されます。ランチャーは、入手可能なあらゆる Python の" +"バージョンに互換性があるため、実際にどのバージョンの Python がインストールさ" +"れているのかは重要ではありません。ランチャーが使えるかを確認するには以下のコ" +"マンドをコマンドプロンプトで実行してください::" -#: ../../using/windows.rst:1555 msgid "py" -msgstr "" +msgstr "py" #: ../../using/windows.rst:1557 msgid "" @@ -2942,9 +3213,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 +3224,8 @@ msgstr "" "インストールしてある Python 2 の最新バージョンを起動したい場合は、次のコマン" "ドを実行してみてください::" -#: ../../using/windows.rst:1570 msgid "py -2" -msgstr "" +msgstr "py -2" #: ../../using/windows.rst:1572 msgid "" @@ -2964,25 +3233,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 +3258,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 +3284,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 +3309,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 +3329,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 +3348,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 +3372,8 @@ msgstr "" "インストールされている最新の Python 2.x のバージョン番号が表示されるはずで" "す。では、1行目を以下のように変更してみてください:" -#: ../../using/windows.rst:1644 msgid "#! python3" -msgstr "" +msgstr "#! python3" #: ../../using/windows.rst:1648 msgid "" @@ -3116,14 +3406,14 @@ msgstr "ファイルの関連付けから起動する" #: ../../using/windows.rst:1662 msgid "" -"The launcher should have been associated with Python files (i.e. ``.py``, ``." -"pyw``, ``.pyc`` files) when it was installed. This means that when you " +"The launcher should have been associated with Python files (i.e. ``.py``, " +"``.pyw``, ``.pyc`` files) when it was installed. This means that when you " "double-click on one of these files from Windows explorer the launcher will " "be used, and therefore you can use the same facilities described above to " "have the script specify the version which should be used." msgstr "" -"インストール時に、ランチャは Python ファイル (すなわち ``.py``, ``.pyw``, ``." -"pyc`` ファイル) に関連付けられたはずです。そのため、これらのファイルを " +"インストール時に、ランチャは Python ファイル (すなわち ``.py``, ``.pyw``, " +"``.pyc`` ファイル) に関連付けられたはずです。そのため、これらのファイルを " "Windows のエクスプローラーでダブルクリックした際はランチャが使われ、上で述べ" "たのと同じ機能を使ってスクリプトが使われるべきバージョンを指定できるようにな" "ります。" @@ -3157,15 +3447,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 +3501,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." +"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 "" @@ -3235,12 +3531,11 @@ msgid "" "program, which performs a :envvar:`PATH` search. If an executable matching " "the first argument after the ``env`` command cannot be found, but the " "argument starts with ``python``, it will be handled as described for the " -"other virtual commands. The environment variable :envvar:" -"`PYLAUNCHER_NO_SEARCH_PATH` may be set (to any value) to skip this search " -"of :envvar:`PATH`." +"other virtual commands. The environment " +"variable :envvar:`PYLAUNCHER_NO_SEARCH_PATH` may be set (to any value) to " +"skip this search 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 +3545,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 +3568,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 +3588,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" @@ -3299,16 +3606,16 @@ msgstr "INI ファイルによるカスタマイズ" #: ../../using/windows.rst:1780 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " -"user's application data directory (``%LOCALAPPDATA%`` or ``$env:" -"LocalAppData``) and ``py.ini`` in the same directory as the launcher. The " -"same .ini files are used for both the 'console' version of the launcher (i." -"e. py.exe) and for the 'windows' version (i.e. pyw.exe)." +"user's application data directory (``%LOCALAPPDATA%`` or " +"``$env:LocalAppData``) and ``py.ini`` in the same directory as the launcher. " +"The same .ini files are used for both the 'console' version of the launcher " +"(i.e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" "ランチャは2つの .ini ファイルを探しに行きます。具体的には、現在のユーザーのア" -"プリケーションデータディレクトリ (``%LOCALAPPDATA%`` または ``$env:" -"LocalAppData``) の ``py.ini`` と、ランチャと同じディレクトリにある ``py." -"ini`` です。'コンソール' 版のランチャ (つまり py.exe) と 'Windows' 版のラン" -"チャ (つまり pyw.exe) は同一の .ini ファイルを使用します。" +"プリケーションデータディレクトリ (``%LOCALAPPDATA%`` または " +"``$env:LocalAppData``) の ``py.ini`` と、ランチャと同じディレクトリにある " +"``py.ini`` です。'コンソール' 版のランチャ (つまり py.exe) と 'Windows' 版の" +"ランチャ (つまり pyw.exe) は同一の .ini ファイルを使用します。" #: ../../using/windows.rst:1786 msgid "" @@ -3352,12 +3659,12 @@ msgstr "" #: ../../using/windows.rst:1802 msgid "" -"If no version qualifiers are found in a command, the environment variable :" -"envvar:`PY_PYTHON` can be set to specify the default version qualifier. If " -"it is not set, the default is \"3\". The variable can specify any value that " -"may be passed on the command line, such as \"3\", \"3.7\", \"3.7-32\" or " -"\"3.7-64\". (Note that the \"-64\" option is only available with the " -"launcher included with Python 3.7 or newer.)" +"If no version qualifiers are found in a command, the environment " +"variable :envvar:`PY_PYTHON` can be set to specify the default version " +"qualifier. If it is not set, the default is \"3\". The variable can specify " +"any value that may be passed on the command line, such as \"3\", \"3.7\", " +"\"3.7-32\" or \"3.7-64\". (Note that the \"-64\" option is only available " +"with the launcher included with Python 3.7 or newer.)" msgstr "" "コマンドにバージョン修飾子が見つからない場合、環境変数 :envvar:`PY_PYTHON` を" "設定して、デフォルトのバージョン修飾子を指定できます。\n" @@ -3482,11 +3789,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 +3804,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 +3847,8 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:1894 msgid "Install on demand" -msgstr "" +msgstr "必要に応じたインストール" #: ../../using/windows.rst:1896 msgid "" @@ -3554,27 +3863,30 @@ msgstr "" msgid "" "An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the " "launcher to always try to install Python, even if it is detected. This is " -"mainly intended for testing (and should be used with :envvar:" -"`PYLAUNCHER_DRYRUN`)." +"mainly intended for testing (and should be used " +"with :envvar:`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 +3900,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 +3911,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 +3922,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 +3936,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 +3949,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 +3960,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 +3971,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..1545aa5bc 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 @@ -236,8 +236,8 @@ msgid "" "up to write Python Enhancement Proposals (PEPs), modelled on the internet " "RFC process. PEPs are draft documents that describe a proposed new feature, " "and are continually revised until the community reaches a consensus, either " -"accepting or rejecting the proposal. Quoting from the introduction to :pep:" -"`1`, \"PEP Purpose and Guidelines\":" +"accepting or rejecting the proposal. Quoting from the introduction " +"to :pep:`1`, \"PEP Purpose and Guidelines\":" msgstr "" "実際のパッチの作成は新機能の追加での最後のステップであり、通常、良いデザイン" "を工面する前のタスクと容易に比較出来ます。一方で新機能についての議論はしばし" @@ -326,17 +326,17 @@ msgstr "" #: ../../whatsnew/2.0.rst:155 msgid "" "In Python source code, Unicode strings are written as ``u\"string\"``. " -"Arbitrary Unicode characters can be written using a new escape sequence, :" -"samp:`\\\\u{HHHH}`, where *HHHH* is a 4-digit hexadecimal number from 0000 " -"to FFFF. The existing :samp:`\\\\x{HH}` escape sequence can also be used, " -"and octal escapes can be used for characters up to U+01FF, which is " +"Arbitrary Unicode characters can be written using a new escape " +"sequence, :samp:`\\\\u{HHHH}`, where *HHHH* is a 4-digit hexadecimal number " +"from 0000 to FFFF. The existing :samp:`\\\\x{HH}` escape sequence can also " +"be used, and octal escapes can be used for characters up to U+01FF, which is " "represented by ``\\777``." msgstr "" "Python ソースコード内では Unicode 文字列は ``u\"string\"`` のように書きます。" -"任意の Unicode 文字は新しく追加されたエスケープシーケンスで書きます。 :samp:" -"`\\\\u{HHHH}` のように書き、 *HHHH* は 0000 から FFFF までの 4 桁の 16 進表記" -"数です。以前からあるエスケープシーケンス :samp:`\\\\x{HH}` も使えますし、8 進" -"表記も、 ``\\777`` で表現される U+01FF までの文字に使えます。" +"任意の Unicode 文字は新しく追加されたエスケープシーケンスで書きま" +"す。 :samp:`\\\\u{HHHH}` のように書き、 *HHHH* は 0000 から FFFF までの 4 桁" +"の 16 進表記数です。以前からあるエスケープシーケンス :samp:`\\\\x{HH}` も使え" +"ますし、8 進表記も、 ``\\777`` で表現される U+01FF までの文字に使えます。" #: ../../whatsnew/2.0.rst:161 msgid "" @@ -351,17 +351,17 @@ 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 プログラム全体を通して利用可能となるよう登録するために定義さ" "れています。エンコーディングが指定されない場合はデフォルトのエンコーディング" -"は普通 7 ビット ASCII ですが、Python インストレーションにおいて、 :file:" -"`site.py` のカスタマイズ版内で ``sys.setdefaultencoding(encoding)`` を呼び出" -"すことで変更出来ます。" +"は普通 7 ビット ASCII ですが、Python インストレーションにおい" +"て、 :file:`site.py` のカスタマイズ版内で " +"``sys.setdefaultencoding(encoding)`` を呼び出すことで変更出来ます。" #: ../../whatsnew/2.0.rst:172 msgid "" @@ -451,8 +451,8 @@ msgid "" msgstr "" ":mod:`codecs` モジュールには、既存のエンコーディングをルックアップする関数、" "新しいエンコーディングを登録する関数が含まれます。新しいエンコーディングを実" -"装したいと思うのでない限りは、一番使うことになるのは ``codecs." -"lookup(encoding)`` でしょう。これは 4 要素のタプルを返します: " +"装したいと思うのでない限りは、一番使うことになるのは " +"``codecs.lookup(encoding)`` でしょう。これは 4 要素のタプルを返します: " "``(encode_func, decode_func, stream_reader, stream_writer)`` 。" #: ../../whatsnew/2.0.rst:209 @@ -479,21 +479,31 @@ msgstr "" "2 要素のタプル ``(ustring, length)`` を返します。 *ustring* が結果の Unicode " "文字列で、整数 *length* が、8 ビット文字列何文字が消費されたかを表します。" -#: ../../whatsnew/2.0.rst:219 msgid "" "*stream_reader* is a class that supports decoding input from a stream. " "*stream_reader(file_obj)* returns an object that supports the :meth:`!" "read`, :meth:`!readline`, and :meth:`!readlines` methods. These methods " "will all translate from the given encoding and return Unicode strings." msgstr "" +"*stream_reader* は、ストリームからの入力のデコードをサポートするクラスで" +"す。\n" +"*stream_reader(file_obj)* は :meth:`!read`、:meth:`!readline`、:meth:`!" +"readlines` メソッドを持つオブジェクトを返します。\n" +"これらのメソッドはいずれも、指定されたエンコーディングから変換して Unicode 文" +"字列を返します。" -#: ../../whatsnew/2.0.rst:224 msgid "" "*stream_writer*, similarly, is a class that supports encoding output to a " -"stream. *stream_writer(file_obj)* returns an object that supports the :meth:" -"`!write` and :meth:`!writelines` methods. These methods expect Unicode " -"strings, translating them to the given encoding on output." +"stream. *stream_writer(file_obj)* returns an object that supports " +"the :meth:`!write` and :meth:`!writelines` methods. These methods expect " +"Unicode strings, translating them to the given encoding on output." msgstr "" +"同様に、*stream_writer* はストリームへの出力のエンコードをサポートするクラス" +"です。\n" +"*stream_writer(file_obj)* は :meth:`!write` と :meth:`!writelines` メソッドを" +"持つオブジェクトを返します。\n" +"これらのメソッドは Unicode 文字列を受け取り、出力時に指定されたエンコーディン" +"グに変換します。" #: ../../whatsnew/2.0.rst:229 msgid "" @@ -503,7 +513,6 @@ msgstr "" "例えば以下のコードは Unicode 文字列を UTF-8 でエンコーディングしてファイルに" "書きます::" -#: ../../whatsnew/2.0.rst:232 msgid "" "import codecs\n" "\n" @@ -516,17 +525,29 @@ msgid "" "output.write( unistr )\n" "output.close()" msgstr "" +"import codecs\n" +"\n" +"unistr = u'\\u0660\\u2000ab ...'\n" +"\n" +"(UTF8_encode, UTF8_decode,\n" +" UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8')\n" +"\n" +"output = UTF8_streamwriter( open( '/tmp/output', 'wb') )\n" +"output.write( unistr )\n" +"output.close()" #: ../../whatsnew/2.0.rst:243 msgid "The following code would then read UTF-8 input from the file::" msgstr "そして以下コードではファイルから UTF-8 で読めます::" -#: ../../whatsnew/2.0.rst:245 msgid "" "input = UTF8_streamreader( open( '/tmp/output', 'rb') )\n" "print repr(input.read())\n" "input.close()" msgstr "" +"input = UTF8_streamreader( open( '/tmp/output', 'rb') )\n" +"print repr(input.read())\n" +"input.close()" #: ../../whatsnew/2.0.rst:249 msgid "" @@ -594,7 +615,6 @@ msgstr "" "例を考えましょう。指定の部分文字列を含む文字列リストから全てを探す例です。こ" "のように書けるでしょう::" -#: ../../whatsnew/2.0.rst:280 msgid "" "# Given the list L, make a list of all strings\n" "# containing the substring S.\n" @@ -602,6 +622,11 @@ msgid "" " string.find(s, substring) != -1,\n" " L)" msgstr "" +"# リスト L から、部分文字列 S を含むすべての文字列の\n" +"# リストを作る。\n" +"sublist = filter( lambda s, substring=S:\n" +" string.find(s, substring) != -1,\n" +" L)" #: ../../whatsnew/2.0.rst:286 msgid "" @@ -613,21 +638,23 @@ msgstr "" "フォルト引数を使い、これに検索対象の部分文字列を渡しています。リスト内包表記" "はこれを明快にします::" -#: ../../whatsnew/2.0.rst:290 msgid "sublist = [ s for s in L if string.find(s, S) != -1 ]" -msgstr "" +msgstr "sublist = [ s for s in L if string.find(s, S) != -1 ]" #: ../../whatsnew/2.0.rst:292 msgid "List comprehensions have the form::" msgstr "リスト内包表記は以下の形式を持ちます::" -#: ../../whatsnew/2.0.rst:294 msgid "" "[ expression for expr in sequence1\n" " for expr2 in sequence2 ...\n" " for exprN in sequenceN\n" " if condition ]" msgstr "" +"[ expression for expr in sequence1\n" +" for expr2 in sequence2 ...\n" +" for exprN in sequenceN\n" +" if condition ]" #: ../../whatsnew/2.0.rst:299 msgid "" @@ -635,16 +662,16 @@ msgid "" "iterated over. The sequences do not have to be the same length, because " "they are *not* iterated over in parallel, but from left to right; this is " "explained more clearly in the following paragraphs. The elements of the " -"generated list will be the successive values of *expression*. The final :" -"keyword:`!if` clause is optional; if present, *expression* is only evaluated " -"and added to the result if *condition* is true." +"generated list will be the successive values of *expression*. The " +"final :keyword:`!if` clause is optional; if present, *expression* is only " +"evaluated and added to the result if *condition* is true." msgstr "" ":keyword:`!for`...\\ :keyword:`!in` 節はイテレートするシーケンスを含みます。" "シーケンス群は同じ長さである必要はありません。それらは並列でイテレートされる " "*のではなく* 左から右の順で周ります。続くパラグラフでもっとわかりやすく説明し" -"ます。生成されるリストの要素は一連の *expression* の値となります。最後の :" -"keyword:`if` 節はオプショナルです。これがあれば *expression* は *condition* " -"が真の場合にのみ評価・追加されます。" +"ます。生成されるリストの要素は一連の *expression* の値となります。最後" +"の :keyword:`!if` 節はオプショナルです。これがあれば *expression* は " +"*condition* が真の場合にのみ評価・追加されます。" #: ../../whatsnew/2.0.rst:307 msgid "" @@ -654,7 +681,6 @@ msgstr "" "セマンティクスについてとてもわかりやすく説明しておきましょう。リスト内包は以" "下の Python コードと等価です::" -#: ../../whatsnew/2.0.rst:310 msgid "" "for expr1 in sequence1:\n" " for expr2 in sequence2:\n" @@ -665,6 +691,14 @@ msgid "" " # the expression to the\n" " # resulting list." msgstr "" +"for expr1 in sequence1:\n" +" for expr2 in sequence2:\n" +" ...\n" +" for exprN in sequenceN:\n" +" if (condition):\n" +" # 式の値を\n" +" # 結果のリストに\n" +" # 追加する。" #: ../../whatsnew/2.0.rst:319 msgid "" @@ -677,7 +711,6 @@ msgstr "" "きの最終出力は、長さが各シーケンス長の積に等しくなるということです。長さ 3 の" "リスト二つなら、出力リストの長さは 9 要素です::" -#: ../../whatsnew/2.0.rst:324 msgid "" "seq1 = 'abc'\n" "seq2 = (1,2,3)\n" @@ -685,6 +718,11 @@ msgid "" "[('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1),\n" "('c', 2), ('c', 3)]" msgstr "" +"seq1 = 'abc'\n" +"seq2 = (1,2,3)\n" +">>> [ (x,y) for x in seq1 for y in seq2]\n" +"[('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1),\n" +"('c', 2), ('c', 3)]" #: ../../whatsnew/2.0.rst:330 msgid "" @@ -696,13 +734,16 @@ msgstr "" "括弧で囲わなくてはなりません。下にあるリスト内包表記で、最初のは構文エラーで" "すが、二番目は有効です::" -#: ../../whatsnew/2.0.rst:334 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]" #: ../../whatsnew/2.0.rst:339 msgid "" @@ -735,7 +776,6 @@ msgstr "" "メント ``a += 2`` は変数 ``a`` に 2 を加算し、これはちょっとだけ長い記述 ``a " "= a + 2`` と同じです。" -#: ../../whatsnew/2.0.rst:356 msgid "" "The full list of supported assignment operators is ``+=``, ``-=``, ``*=``, " "``/=``, ``%=``, ``**=``, ``&=``, ``|=``, ``^=``, ``>>=``, and ``<<=``. " @@ -744,8 +784,13 @@ msgid "" "following :class:`!Number` class stores a number and supports using += to " "create a new instance with an incremented value." msgstr "" +"サポートされる代入演算子は ``+=``、``-=``、``*=``、``/=``、``%=``、``**=``、" +"``&=``、``|=``、``^=``、``>>=``、``<<=`` です。\n" +"Python のクラスは :meth:`!__iadd__`、:meth:`!__isub__` などの名前のメソッドを" +"定義して、累算代入演算子をオーバーライドできます。\n" +"例えば、次の :class:`!Number` クラスは数値を格納し、+= を使って値を増やした新" +"しいインスタンスを作成できます。" -#: ../../whatsnew/2.0.rst:367 msgid "" "class Number:\n" " def __init__(self, value):\n" @@ -757,14 +802,25 @@ msgid "" "n += 3\n" "print n.value" msgstr "" +"class Number:\n" +" def __init__(self, value):\n" +" self.value = value\n" +" def __iadd__(self, increment):\n" +" return Number( self.value + increment)\n" +"\n" +"n = Number(5)\n" +"n += 3\n" +"print n.value" -#: ../../whatsnew/2.0.rst:377 msgid "" "The :meth:`!__iadd__` special method is called with the value of the " "increment, and should return a new instance with an appropriately modified " "value; this return value is bound as the new value of the variable on the " "left-hand side." msgstr "" +":meth:`!__iadd__` 特殊メソッドは増分の値を引数として呼び出され、値を適切に変" +"更した新しいインスタンスを返す必要があります。\n" +"この戻り値が左辺の変数の新しい値として束縛されます。" #: ../../whatsnew/2.0.rst:381 msgid "" @@ -781,16 +837,22 @@ msgstr "" msgid "String Methods" msgstr "文字列メソッド" -#: ../../whatsnew/2.0.rst:392 msgid "" "Until now string-manipulation functionality was in the :mod:`string` module, " "which was usually a front-end for the :mod:`!strop` module written in C. " "The addition of Unicode posed a difficulty for the :mod:`!strop` module, " "because the functions would all need to be rewritten in order to accept " -"either 8-bit or Unicode strings. For functions such as :func:`!string." -"replace`, which takes 3 string arguments, that means eight possible " +"either 8-bit or Unicode strings. For functions such as :func:`!" +"string.replace`, which takes 3 string arguments, that means eight possible " "permutations, and correspondingly complicated code." msgstr "" +"これまで、文字列操作の機能は :mod:`string` モジュールにあり、通常は C で書か" +"れた :mod:`!strop` モジュールのフロントエンドになっていました。\n" +"Unicode の追加により、:mod:`!strop` モジュールには問題が生じました。\n" +"8 ビット文字列と Unicode 文字列の両方を受け付けるには、すべての関数を書き直す" +"必要があるためです。\n" +"文字列引数を 3 つ受け取る :func:`!string.replace` などの関数では、組み合わせ" +"が 8 通りになり、その分コードも複雑になります。" #: ../../whatsnew/2.0.rst:400 msgid "" @@ -801,7 +863,6 @@ msgstr "" "代わりに、Python 2.0 は問題を文字列型に押し込み、文字列操作機能が 8 ビット文" "字列と Unicode 文字列の両方のメソッドを通じて利用可能としました。" -#: ../../whatsnew/2.0.rst:404 msgid "" ">>> 'andrew'.capitalize()\n" "'Andrew'\n" @@ -810,6 +871,12 @@ msgid "" ">>> 'moshe'.find('sh')\n" "2" msgstr "" +">>> 'andrew'.capitalize()\n" +"'Andrew'\n" +">>> 'hostname'.replace('os', 'linux')\n" +"'hlinuxtname'\n" +">>> 'moshe'.find('sh')\n" +"2" #: ../../whatsnew/2.0.rst:411 msgid "" @@ -819,8 +886,8 @@ msgid "" "operate." msgstr "" "変わらない一つのこと、華やかなエイプリルフールのジョークではありませんが、そ" -"れは Python 文字列が :term:`immutable` だということです。ですので文字列メソッ" -"ドは新しい文字列を返し、それが操作する文字列を変更しません。" +"れは Python 文字列が immutable だということです。ですので文字列メソッドは新し" +"い文字列を返し、それが操作する文字列を変更しません。" #: ../../whatsnew/2.0.rst:415 msgid "" @@ -838,14 +905,18 @@ msgid "" "``s.endswith(t)`` is equivalent to ``s[-len(t):] == t``." msgstr "" -#: ../../whatsnew/2.0.rst:423 msgid "" -"One other method which deserves special mention is :meth:`!join`. The :meth:" -"`!join` method of a string receives one parameter, a sequence of strings, " -"and is equivalent to the :func:`!string.join` function from the old :mod:" -"`string` module, with the arguments reversed. In other words, ``s." -"join(seq)`` is equivalent to the old ``string.join(seq, s)``." +"One other method which deserves special mention is :meth:`!join`. " +"The :meth:`!join` method of a string receives one parameter, a sequence of " +"strings, and is equivalent to the :func:`!string.join` function from the " +"old :mod:`string` module, with the arguments reversed. In other words, " +"``s.join(seq)`` is equivalent to the old ``string.join(seq, s)``." msgstr "" +"特に触れておきたいもう一つのメソッドは :meth:`!join` です。\n" +"文字列の :meth:`!join` メソッドは、文字列のシーケンスという 1 つの引数を受け" +"取り、従来の :mod:`string` モジュールの :func:`!string.join` 関数で引数の順番" +"を逆にしたものに相当します。\n" +"つまり、``s.join(seq)`` は従来の ``string.join(seq, s)`` と同じです。" #: ../../whatsnew/2.0.rst:433 msgid "Garbage Collection of Cycles" @@ -891,11 +962,12 @@ msgstr "" "最も単純な循環について考えてみます。クラスインスタンスが自身への参照を持つ場" "合です::" -#: ../../whatsnew/2.0.rst:452 msgid "" "instance = SomeClass()\n" "instance.myself = instance" msgstr "" +"instance = SomeClass()\n" +"instance.myself = instance" #: ../../whatsnew/2.0.rst:455 msgid "" @@ -960,8 +1032,8 @@ msgstr "" "えも許容出来ないであるとか、あるいは循環のコレクションがバギーであることを疑" "うのであれば、 :program:`configure` スクリプト実行時に :option:`!--without-" "cycle-gc` スイッチを与えることでそうすることが出来ます。 (---訳注: Python " -"2.3 でこの循環参照の GC は必須となり、 :option:`!--without-cycle-gc` 、 :" -"option:`!--with-cycle-gc` での有無効化は撤廃されました。---)" +"2.3 でこの循環参照の GC は必須となり、 :option:`!--without-cycle-" +"gc` 、 :option:`!--with-cycle-gc` での有無効化は撤廃されました。---)" #: ../../whatsnew/2.0.rst:482 msgid "" @@ -1001,7 +1073,6 @@ msgstr "" msgid "Minor Language Changes" msgstr "言語のマイナー変更" -#: ../../whatsnew/2.0.rst:504 msgid "" "A new syntax makes it more convenient to call a given function with a tuple " "of arguments and/or a dictionary of keyword arguments. In Python 1.5 and " @@ -1012,16 +1083,27 @@ msgid "" "and clearer way to achieve the same effect. This syntax is symmetrical with " "the syntax for defining functions::" msgstr "" +"引数のタプルやキーワード引数の辞書を使って関数を呼び出すための便利な構文が追" +"加されました。\n" +"Python 1.5 以前では組み込み関数 :func:`!apply` を使っていました。\n" +"``apply(f, args, kw)`` は、引数のタプル *args* と辞書 *kw* 内のキーワード引数" +"を渡して関数 :func:`!f` を呼び出します。\n" +"2.0 でも :func:`!apply` は同じように使えますが、Greg Ewing のパッチにより、" +"``f(*args, **kw)`` という短く分かりやすい書き方で同じことができるようになりま" +"した。\n" +"これは次の関数定義の構文と対称的です。 ::" -#: ../../whatsnew/2.0.rst:513 msgid "" "def f(*args, **kw):\n" " # args is a tuple of positional args,\n" " # kw is a dictionary of keyword args\n" " ..." msgstr "" +"def f(*args, **kw):\n" +" # args は位置引数のタプル、\n" +" # kw はキーワード引数の辞書\n" +" ..." -#: ../../whatsnew/2.0.rst:518 msgid "" "The ``print`` statement can now have its output directed to a file-like " "object by following the ``print`` with ``>> file``, similar to the " @@ -1031,10 +1113,16 @@ msgid "" "``sys.stdout`` and then restore the old value. For sending output to " "standard error, it's much easier to write this::" msgstr "" +"``print`` の後に ``>> file`` を置くと、ファイル類似オブジェクトに出力できるよ" +"うになりました。\n" +"Unix シェルのリダイレクト演算子と似ています。\n" +"以前は、``print`` の便利さや単純さに欠けるファイル類似オブジェクトの :meth:`!" +"write` メソッドを使うか、\n" +"``sys.stdout`` に新しい値を代入してから元の値に戻す必要がありました。\n" +"標準エラー出力への出力は、次のように書く方がずっと簡単です。 ::" -#: ../../whatsnew/2.0.rst:526 msgid "print >> sys.stderr, \"Warning: action field not supplied\"" -msgstr "" +msgstr "print >> sys.stderr, \"Warning: action field not supplied\"" #: ../../whatsnew/2.0.rst:528 msgid "" @@ -1054,12 +1142,11 @@ msgid "" "which inserts the :func:`str` of its argument. For example, ``'%r %s' % " "('abc', 'abc')`` returns a string containing ``'abc' abc``." msgstr "" -"``%`` 演算子を使う際に新しい書式化スタイルが利用可能です; '%r' はその引数の :" -"func:`repr` を挿入します。これは対称性の検討からも考えられました。今の場合は" -"既存の '%s' が引数の :func:`str` を挿入することに呼応するものです。例えば " -"``'%r %s' % ('abc', 'abc')`` は文字列 ``'abc' abc`` を返します。" +"``%`` 演算子を使う際に新しい書式化スタイルが利用可能です; '%r' はその引数" +"の :func:`repr` を挿入します。これは対称性の検討からも考えられました。今の場" +"合は既存の '%s' が引数の :func:`str` を挿入することに呼応するものです。例え" +"ば ``'%r %s' % ('abc', 'abc')`` は文字列 ``'abc' abc`` を返します。" -#: ../../whatsnew/2.0.rst:538 msgid "" "Previously there was no way to implement a class that overrode Python's " "built-in :keyword:`in` operator and implemented a custom version. ``obj in " @@ -1071,6 +1158,15 @@ msgid "" "built-in objects written in C can define what :keyword:`!in` means for them " "via a new slot in the sequence protocol." msgstr "" +"以前は Python の組み込みの :keyword:`in` 演算子をオーバーライドして独自の動作" +"を実装するクラスは作れませんでした。\n" +"``obj in seq`` は、シーケンス *seq* に *obj* があれば真を返します。\n" +"Python は *obj* が見つかるか :exc:`IndexError` が発生するまで、シーケンスの各" +"インデックスを順に調べていました。\n" +"Moshe Zadka のパッチにより、:keyword:`!in` の独自の実装を提供する :meth:`!" +"__contains__` 特殊メソッドが追加されました。\n" +"また、C で書かれた新しい組み込みオブジェクトは、シーケンスプロトコルの新しい" +"スロットを通じて :keyword:`!in` の意味を定義できます。" #: ../../whatsnew/2.0.rst:547 msgid "" @@ -1089,15 +1185,17 @@ msgstr "" "が書き直してクラッシュしないようにして、有用な結果を生成するようにしたことで" "す。例えば以下コード::" -#: ../../whatsnew/2.0.rst:554 msgid "" "a = []\n" "b = []\n" "a.append(a)\n" "b.append(b)" msgstr "" +"a = []\n" +"b = []\n" +"a.append(a)\n" +"b.append(b)" -#: ../../whatsnew/2.0.rst:559 msgid "" "The comparison ``a==b`` returns true, because the two recursive data " "structures are isomorphic. See the thread \"trashcan and PR#7\" in the April " @@ -1108,24 +1206,44 @@ msgid "" "even if a user-defined :meth:`!__cmp__` method encountered an error, since " "the resulting exception would simply be silently swallowed." msgstr "" +"この 2 つの再帰的なデータ構造は同型なので、``a==b`` の比較は真を返します。\n" +"この実装に至る議論と関連する有用なリンクについては、python-dev メーリングリス" +"トの 2000 年 4 月のアーカイブにある \"trashcan and PR#7\" スレッドを参照して" +"ください。\n" +"また、比較でも例外を送出できるようになりました。\n" +"以前の Python では、ユーザー定義の :meth:`!__cmp__` メソッドでエラーが発生し" +"ても、その例外が黙って無視されていたため、``cmp(a,b)`` などの比較演算は常に結" +"果を返していました。" -#: ../../whatsnew/2.0.rst:571 msgid "" "Work has been done on porting Python to 64-bit Windows on the Itanium " -"processor, mostly by Trent Mick of ActiveState. (Confusingly, ``sys." -"platform`` is still ``'win32'`` on Win64 because it seems that for ease of " -"porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin also " -"supports Windows CE; see the Python CE page at https://pythonce.sourceforge." -"net/ for more information." -msgstr "" +"processor, mostly by Trent Mick of ActiveState. (Confusingly, " +"``sys.platform`` is still ``'win32'`` on Win64 because it seems that for " +"ease of porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin " +"also supports Windows CE; see the Python CE page at https://" +"pythonce.sourceforge.net/ for more information." +msgstr "" +"主に ActiveState の Trent Mick によって、Itanium プロセッサー上の 64 ビット " +"Windows への Python の移植作業が進められました。\n" +"(紛らわしいことに、Win64 でも ``sys.platform`` は依然として ``'win32'`` で" +"す。\n" +"移植を容易にするため、MS Visual C++ が Itanium 上でもコードを 32 ビットとして" +"扱うようだからです。)\n" +"PythonWin は Windows CE もサポートしています。\n" +"詳しくは https://pythonce.sourceforge.net/ の Python CE のページを参照してく" +"ださい。" -#: ../../whatsnew/2.0.rst:577 msgid "" "Another new platform is Darwin/MacOS X; initial support for it is in Python " "2.0. Dynamic loading works, if you specify \"configure --with-dyld --with-" "suffix=.x\". Consult the README in the Python source distribution for more " "instructions." msgstr "" +"新たに対応したプラットフォームには Darwin/MacOS X もあり、Python 2.0 で初期サ" +"ポートが追加されました。\n" +"\"configure --with-dyld --with-suffix=.x\" を指定すると動的読み込みが動作しま" +"す。\n" +"詳しい手順は Python ソース配布物の README を参照してください。" #: ../../whatsnew/2.0.rst:581 msgid "" @@ -1133,26 +1251,29 @@ msgid "" "confusing :exc:`NameError` exception when code refers to a local variable " "before the variable has been assigned a value. For example, the following " "code raises an exception on the ``print`` statement in both 1.5.2 and 2.0; " -"in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a new :exc:" -"`UnboundLocalError` exception. :exc:`UnboundLocalError` is a subclass of :" -"exc:`NameError`, so any existing code that expects :exc:`NameError` to be " -"raised should still work. ::" +"in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a " +"new :exc:`UnboundLocalError` exception. :exc:`UnboundLocalError` is a " +"subclass of :exc:`NameError`, so any existing code that " +"expects :exc:`NameError` to be raised should still work. ::" msgstr "" -"変数に値が割り当てられる前にローカル変数を参照するコードにおいて、 :exc:" -"`NameError` 例外はよく混乱するものであり、この欠点を軽減する試みがなされまし" -"た。例えば下に挙げるコードは ``print`` 文で 1.5.2 と 2.0 の両方で例外が発生し" -"ますが、1.5.2 は :exc:`NameError` 例外が、2.0 では新規の例外 :exc:" -"`UnboundLocalError` が投げられます。 :exc:`UnboundLocalError` は :exc:" -"`NameError` のサブクラスですので :exc:`NameError` が投げられることを想定する" -"既存のコードはそのまま動作するはずです。::" +"変数に値が割り当てられる前にローカル変数を参照するコードにおい" +"て、 :exc:`NameError` 例外はよく混乱するものであり、この欠点を軽減する試みが" +"なされました。例えば下に挙げるコードは ``print`` 文で 1.5.2 と 2.0 の両方で例" +"外が発生しますが、1.5.2 は :exc:`NameError` 例外が、2.0 では新規の例" +"外 :exc:`UnboundLocalError` が投げられます。 :exc:`UnboundLocalError` " +"は :exc:`NameError` のサブクラスですので :exc:`NameError` が投げられることを" +"想定する既存のコードはそのまま動作するはずです。::" -#: ../../whatsnew/2.0.rst:590 msgid "" "def f():\n" " print \"i=\",i\n" " i = i + 1\n" "f()" msgstr "" +"def f():\n" +" print \"i=\",i\n" +" i = i + 1\n" +"f()" #: ../../whatsnew/2.0.rst:595 msgid "" @@ -1184,47 +1305,59 @@ msgstr "" "のに対し、 :func:`zip` は返すリストの長さを、引数のシーケンスの最も短い長さに" "切り詰めます。" -#: ../../whatsnew/2.0.rst:610 msgid "" "The :func:`int` and :func:`!long` functions now accept an optional \"base\" " "parameter when the first argument is a string. ``int('123', 10)`` returns " -"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises a :exc:" -"`TypeError` exception with the message \"can't convert non-string with " -"explicit base\"." +"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises " +"a :exc:`TypeError` exception with the message \"can't convert non-string " +"with explicit base\"." msgstr "" +":func:`int` と :func:`!long` 関数は、第 1 引数が文字列の場合にオプションの " +"``base`` パラメータを受け付けるようになりました。\n" +"``int('123', 10)`` は 123 を、``int('123', 16)`` は 291 を返します。\n" +"``int(123, 16)`` は \"can't convert non-string with explicit base\" という" +"メッセージの :exc:`TypeError` 例外を送出します。" #: ../../whatsnew/2.0.rst:616 msgid "" "A new variable holding more detailed version information has been added to " "the :mod:`sys` module. ``sys.version_info`` is a tuple ``(major, minor, " -"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, ``sys." -"version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string such " -"as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release." +"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, " +"``sys.version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string " +"such as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release." msgstr "" ":mod:`sys` モジュールに、これまでより詳細なバージョン情報を持つ変数が追加され" "ました。 ``sys.version_info`` はタプル ``(major, minor, micro, level, " -"serial)`` です。例えば仮に 2.0.1beta1 というバージョンだったとすれば、 ``sys." -"version_info`` は ``(2, 0, 1, 'beta', 1)`` となるでしょう。 *level* は " +"serial)`` です。例えば仮に 2.0.1beta1 というバージョンだったとすれば、 " +"``sys.version_info`` は ``(2, 0, 1, 'beta', 1)`` となるでしょう。 *level* は " "``\"alpha\"`` や ``\"beta\"`` といった文字列で、最終リリースでは " "``\"final\"`` です。(---訳注: Python 2.7 で名前付きタプルになっています。ま" "た、その属性名では level ではなく releaselevel です。---)" -#: ../../whatsnew/2.0.rst:622 msgid "" "Dictionaries have an odd new method, ``setdefault(key, default)``, which " "behaves similarly to the existing :meth:`!get` method. However, if the key " -"is missing, :meth:`!setdefault` both returns the value of *default* as :meth:" -"`!get` would do, and also inserts it into the dictionary as the value for " -"*key*. Thus, the following lines of code::" +"is missing, :meth:`!setdefault` both returns the value of *default* " +"as :meth:`!get` would do, and also inserts it into the dictionary as the " +"value for *key*. Thus, the following lines of code::" msgstr "" +"辞書に少し変わった新しいメソッド ``setdefault(key, default)`` が追加されまし" +"た。\n" +"既存の :meth:`!get` メソッドと似ていますが、キーが存在しない場合、:meth:`!" +"setdefault` は :meth:`!get` と同様に *default* の値を返すだけでなく、\n" +"その値を *key* の値として辞書に挿入します。\n" +"したがって、次のコードは以下のように置き換えられます。 ::" -#: ../../whatsnew/2.0.rst:628 msgid "" "if dict.has_key( key ): return dict[key]\n" "else:\n" " dict[key] = []\n" " return dict[key]" msgstr "" +"if dict.has_key( key ): return dict[key]\n" +"else:\n" +" dict[key] = []\n" +" return dict[key]" #: ../../whatsnew/2.0.rst:633 msgid "" @@ -1237,19 +1370,19 @@ msgid "" "The interpreter sets a maximum recursion depth in order to catch runaway " "recursion before filling the C stack and causing a core dump or GPF.. " "Previously this limit was fixed when you compiled Python, but in 2.0 the " -"maximum recursion depth can be read and modified using :func:`sys." -"getrecursionlimit` and :func:`sys.setrecursionlimit`. The default value is " -"1000, and a rough maximum value for a given platform can be found by running " -"a new script, :file:`Misc/find_recursionlimit.py`." +"maximum recursion depth can be read and modified " +"using :func:`sys.getrecursionlimit` and :func:`sys.setrecursionlimit`. The " +"default value is 1000, and a rough maximum value for a given platform can be " +"found by running a new script, :file:`Misc/find_recursionlimit.py`." msgstr "" "再帰の暴走を C のスタックが埋め尽くされてコアダンプしたり GPF (訳注: General " "Protection Fault) する前に捕捉するために、インタプリタは最大の再帰の深さを" "セットします。以前まではこの制限は Python コンパイル時点で決めてしまっていま" -"したが、2.0 では最大の再帰の深さは :func:`sys.getrecursionlimit` と :func:" -"`sys.setrecursionlimit` を使って読み取れ、修正出来ます。このデフォルトは " -"1000 です。また、当該プラットフォームでのおよその最大値は、新たに追加されたス" -"クリプト :file:`Misc/find_recursionlimit.py` を実行することで知ることが出来ま" -"す。" +"したが、2.0 では最大の再帰の深さは :func:`sys.getrecursionlimit` " +"と :func:`sys.setrecursionlimit` を使って読み取れ、修正出来ます。このデフォル" +"トは 1000 です。また、当該プラットフォームでのおよその最大値は、新たに追加さ" +"れたスクリプト :file:`Misc/find_recursionlimit.py` を実行することで知ることが" +"出来ます。" #: ../../whatsnew/2.0.rst:647 msgid "Porting to 2.0" @@ -1284,7 +1417,6 @@ msgid "" "``L.append( (1,2) )``." msgstr "" -#: ../../whatsnew/2.0.rst:665 msgid "" "The earlier versions of these methods were more forgiving because they used " "an old function in Python's C interface to parse their arguments; 2.0 " @@ -1295,14 +1427,23 @@ msgid "" "preprocessor symbol ``NO_STRICT_LIST_APPEND`` to preserve the old behaviour; " "this isn't recommended." msgstr "" +"以前のこれらのメソッドは、Python の C インターフェースの古い関数で引数を解析" +"していたため、より寛容でした。\n" +"2.0 では、現行の引数解析関数 :c:func:`PyArg_ParseTuple` を使うように更新され" +"ました。\n" +"この関数は分かりやすいエラーメッセージを提供し、複数引数での呼び出しをエラー" +"として扱います。\n" +"どうしても 2.0 を使う必要がありコードを修正できない場合は、:file:`Objects/" +"listobject.c` を編集してプリプロセッサーシンボル ``NO_STRICT_LIST_APPEND`` を" +"定義すれば従来の動作を維持できますが、推奨しません。" #: ../../whatsnew/2.0.rst:673 msgid "" "Some of the functions in the :mod:`socket` module are still forgiving in " "this way. For example, ``socket.connect( ('hostname', 25) )`` is the " -"correct form, passing a tuple representing an IP address, but ``socket." -"connect('hostname', 25)`` also works. :meth:`socket.connect_ex ` and :meth:`socket.bind ` are " +"correct form, passing a tuple representing an IP address, but " +"``socket.connect('hostname', 25)`` also works. :meth:`socket.connect_ex " +"` and :meth:`socket.bind ` are " "similarly easy-going. 2.0alpha1 tightened these functions up, but because " "the documentation actually used the erroneous multiple argument form, many " "people wrote code which would break with the stricter checking. GvR backed " @@ -1349,7 +1490,6 @@ msgstr "" "以前まではエラーメッセージは存在しない属性名 ``eggs`` だけでしたので、この事" "実に便乗して書かれたコードは 2.0 では壊れます。" -#: ../../whatsnew/2.0.rst:694 msgid "" "Some work has been done to make integers and long integers a bit more " "interchangeable. In 1.5.2, large-file support was added for Solaris, to " @@ -1365,6 +1505,21 @@ msgid "" "the ``%`` operator (``%d``, ``%i``, ``%x``, etc.). For example, ``\"%d\" % " "2L**64`` will produce the string ``18446744073709551616``." msgstr "" +"整数と長整数を、より相互に置き換えて使えるようにする作業が行われました。\n" +"1.5.2 では Solaris に大きなファイルのサポートが追加され、2 GiB を超えるファイ" +"ルを読み取れるようになりました。\n" +"これに伴い、ファイルオブジェクトの :meth:`!tell` メソッドは通常の整数の代わり" +"に長整数を返すようになりました。\n" +"2 つのファイルオフセットの差を求め、その結果をシーケンスの乗算や文字列のスラ" +"イスに使おうとするコードでは、:exc:`TypeError` が発生していました。\n" +"2.0 ではシーケンスの乗算やスライスに長整数を使え、直感的に期待される動作にな" +"ります。\n" +"``3L * 'abc'`` は 'abcabcabc' を、``(0,1,2,3)[2L:4L]`` は (2,3) を返しま" +"す。\n" +"ファイルオブジェクトの :meth:`!seek` メソッドや、``%`` 演算子がサポートする書" +"式 (``%d``、``%i``、``%x`` など) のように、以前は整数しか受け付けなかったさま" +"ざまな場面でも長整数を使えるようになりました。\n" +"例えば、``\"%d\" % 2L**64`` は文字列 ``18446744073709551616`` を生成します。" #: ../../whatsnew/2.0.rst:708 msgid "" @@ -1383,18 +1538,24 @@ msgstr "" "は問題でなくなりましたが、 'L' が付くことをあてにして ``str(longval)[:-1]`` " "とするコードが今度は数値の最後の桁を失ってしまいます。" -#: ../../whatsnew/2.0.rst:716 msgid "" "Taking the :func:`repr` of a float now uses a different formatting precision " "than :func:`str`. :func:`repr` uses ``%.17g`` format string for C's :func:`!" -"sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is that :" -"func:`repr` may occasionally show more decimal places than :func:`str`, for " -"certain numbers. For example, the number 8.1 can't be represented exactly " -"in binary, so ``repr(8.1)`` is ``'8.0999999999999996'``, while str(8.1) is " -"``'8.1'``." -msgstr "" +"sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is " +"that :func:`repr` may occasionally show more decimal places " +"than :func:`str`, for certain numbers. For example, the number 8.1 can't " +"be represented exactly in binary, so ``repr(8.1)`` is " +"``'8.0999999999999996'``, while str(8.1) is ``'8.1'``." +msgstr "" +"浮動小数点数の :func:`repr` は、:func:`str` とは異なる書式化の精度を使うよう" +"になりました。\n" +":func:`repr` は C の :func:`!sprintf` に ``%.17g`` という書式文字列を使" +"い、:func:`str` は従来どおり ``%.12g`` を使います。\n" +"その結果、数値によっては :func:`repr` が :func:`str` よりも多くの小数桁を表示" +"する場合があります。\n" +"例えば、8.1 は 2 進数では正確に表せないため、``repr(8.1)`` は " +"``'8.0999999999999996'``、``str(8.1)`` は ``'8.1'`` となります。" -#: ../../whatsnew/2.0.rst:724 msgid "" "The ``-X`` command-line option, which turned all standard exceptions into " "strings instead of classes, has been removed; the standard exceptions will " @@ -1402,6 +1563,11 @@ msgid "" "standard exceptions was translated from Python to a built-in C module, " "written by Barry Warsaw and Fredrik Lundh." msgstr "" +"標準例外をクラスの代わりに文字列にするコマンドラインオプション ``-X`` は削除" +"されました。\n" +"標準例外は常にクラスになります。\n" +"標準例外を含む :mod:`!exceptions` モジュールは、Python での実装から Barry " +"Warsaw と Fredrik Lundh が書いた組み込みの C モジュールに置き換えられました。" #: ../../whatsnew/2.0.rst:740 msgid "Extending/Embedding Changes" @@ -1438,14 +1604,18 @@ msgstr "" "API が変わるか ABI が変わるならプラットフォームに関係なくリコンパイルは常に必" "要です。 ---)" -#: ../../whatsnew/2.0.rst:753 msgid "" "Users of Jim Fulton's ExtensionClass module will be pleased to find out that " -"hooks have been added so that ExtensionClasses are now supported by :func:" -"`isinstance` and :func:`issubclass`. This means you no longer have to " -"remember to write code such as ``if type(obj) == myExtensionClass``, but can " -"use the more natural ``if isinstance(obj, myExtensionClass)``." +"hooks have been added so that ExtensionClasses are now supported " +"by :func:`isinstance` and :func:`issubclass`. This means you no longer have " +"to remember to write code such as ``if type(obj) == myExtensionClass``, but " +"can use the more natural ``if isinstance(obj, myExtensionClass)``." msgstr "" +"Jim Fulton の ExtensionClass モジュールの利用者に朗報です。\n" +"フックの追加により、:func:`isinstance` と :func:`issubclass` が " +"ExtensionClass をサポートするようになりました。\n" +"これで ``if type(obj) == myExtensionClass`` のように書く必要はなくなり、より" +"自然な ``if isinstance(obj, myExtensionClass)`` を使えます。" #: ../../whatsnew/2.0.rst:759 msgid "" @@ -1469,8 +1639,8 @@ msgstr "" msgid "" "Vladimir Marangozov's long-awaited malloc restructuring was completed, to " "make it easy to have the Python interpreter use a custom allocator instead " -"of C's standard :c:func:`malloc`. For documentation, read the comments in :" -"file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy " +"of C's standard :c:func:`malloc`. For documentation, read the comments " +"in :file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy " "discussions during which the interface was hammered out, see the web " "archives of the 'patches' and 'python-dev' lists at python.org." msgstr "" @@ -1521,7 +1691,6 @@ msgstr "" "のコンパイルには ANSI C コンパイラが必須になりました。K&R C しかサポートしな" "いコンパイラではもうコンパイル出来ません。" -#: ../../whatsnew/2.0.rst:790 msgid "" "Previously the Python virtual machine used 16-bit numbers in its bytecode, " "limiting the size of source files. In particular, this affected the maximum " @@ -1529,27 +1698,39 @@ msgid "" "who are generating Python code would run into this limit. A patch by " "Charles G. Waldman raises the limit from ``2**16`` to ``2**32``." msgstr "" +"以前の Python 仮想マシンはバイトコードに 16 ビットの数値を使っており、ソース" +"ファイルの大きさに制限がありました。\n" +"特に Python ソース内のリストや辞書のリテラルの最大サイズに影響し、Python コー" +"ドを生成する人がこの制限に遭遇することがありました。\n" +"Charles G. Waldman のパッチにより、上限は ``2**16`` から ``2**32`` に引き上げ" +"られました。" -#: ../../whatsnew/2.0.rst:796 msgid "" "Three new convenience functions intended for adding constants to a module's " -"dictionary at module initialization time were added: :c:func:" -"`PyModule_AddObject`, :c:func:`PyModule_AddIntConstant`, and :c:func:" -"`PyModule_AddStringConstant`. Each of these functions takes a module " -"object, a null-terminated C string containing the name to be added, and a " -"third argument for the value to be assigned to the name. This third " +"dictionary at module initialization time were " +"added: :c:func:`PyModule_AddObject`, :c:func:`PyModule_AddIntConstant`, " +"and :c:func:`PyModule_AddStringConstant`. Each of these functions takes a " +"module object, a null-terminated C string containing the name to be added, " +"and a third argument for the value to be assigned to the name. This third " "argument is, respectively, a Python object, a C long, or a C string." msgstr "" +"モジュールの初期化時にモジュールの辞書へ定数を追加するための便利な関数が 3 つ" +"追加されました。\n" +":c:func:`PyModule_AddObject`、:c:func:`PyModule_AddIntConstant`、:c:func:`PyModule_AddStringConstant` " +"です。\n" +"各関数は、モジュールオブジェクト、追加する名前を含むヌル終端の C 文字列、その" +"名前に代入する値を表す第 3 引数を受け取ります。\n" +"第 3 引数は、それぞれ Python オブジェクト、C の long、C の文字列です。" #: ../../whatsnew/2.0.rst:804 msgid "" -"A wrapper API was added for Unix-style signal handlers. :c:func:" -"`PyOS_getsig` gets a signal handler and :c:func:`PyOS_setsig` will set a new " -"handler." +"A wrapper API was added for Unix-style signal " +"handlers. :c:func:`PyOS_getsig` gets a signal handler " +"and :c:func:`PyOS_setsig` will set a new handler." msgstr "" -"Unix スタイルのシグナルハンドラへのラッパーAPIが追加されました。 :c:func:" -"`PyOS_getsig` でシグナルハンドラを取得し、 :c:func:`PyOS_setsig` で新しいハン" -"ドラをセットします。" +"Unix スタイルのシグナルハンドラへのラッパーAPIが追加されまし" +"た。 :c:func:`PyOS_getsig` でシグナルハンドラを取得" +"し、 :c:func:`PyOS_setsig` で新しいハンドラをセットします。" #: ../../whatsnew/2.0.rst:811 msgid "Distutils: Making Modules Easy to Install" @@ -1575,7 +1756,6 @@ msgstr "" "れは拡張パッケージごとに異なり、Python インストールをある種つまらない作業とし" "ていました。" -#: ../../whatsnew/2.0.rst:821 msgid "" "The SIG for distribution utilities, shepherded by Greg Ward, has created the " "Distutils, a system to make package installation much easier. They form the " @@ -1590,23 +1770,39 @@ msgid "" "separating the build from the install, building or installing in non-default " "directories, and more." msgstr "" +"Greg Ward が率いる配布ユーティリティの SIG は、パッケージのインストールを大幅" +"に簡単にするシステム Distutils を作成しました。\n" +"これは Python の標準ライブラリに新たに加わった ``distutils`` パッケージを構成" +"します。\n" +"うまくいけば、Python モジュールをソースからインストールする手順はどれも同じに" +"なります。\n" +"まず tarball や zip アーカイブを展開し、``python setup.py install`` を実行す" +"るだけです。\n" +"プラットフォームとコンパイラーは自動的に検出され、C 拡張モジュールがコンパイ" +"ルされて、配布物が適切なディレクトリにインストールされます。\n" +"オプションのコマンドライン引数でインストール処理を細かく制御できます。\n" +"distutils パッケージには、ビルドとインストールの分離、デフォルト以外のディレ" +"クトリでのビルドやインストールなど、デフォルトの動作を変更できる箇所が多数あ" +"ります。" #: ../../whatsnew/2.0.rst:833 msgid "" "In order to use the Distutils, you need to write a :file:`setup.py` script. " -"For the simple case, when the software contains only .py files, a minimal :" -"file:`setup.py` can be just a few lines long::" +"For the simple case, when the software contains only .py files, a " +"minimal :file:`setup.py` can be just a few lines long::" msgstr "" "Distutils を使うには :file:`setup.py` スクリプトを書く必要があります。単純な" -"ケースでは、ソフトウェアが .py ファイルだけを含む場合、最小限の :file:`setup." -"py` は数行足らずで書けます::" +"ケースでは、ソフトウェアが .py ファイルだけを含む場合、最小限" +"の :file:`setup.py` は数行足らずで書けます::" -#: ../../whatsnew/2.0.rst:837 msgid "" "from distutils.core import setup\n" "setup (name = \"foo\", version = \"1.0\",\n" " py_modules = [\"module1\", \"module2\"])" msgstr "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" py_modules = [\"module1\", \"module2\"])" #: ../../whatsnew/2.0.rst:841 msgid "" @@ -1616,12 +1812,14 @@ msgstr "" ":file:`setup.py` ファイルは、ソフトウェアが少しのパッケージで構成される場合は" "これより大きく複雑になることはありません::" -#: ../../whatsnew/2.0.rst:844 msgid "" "from distutils.core import setup\n" "setup (name = \"foo\", version = \"1.0\",\n" " packages = [\"package\", \"package.subpackage\"])" msgstr "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" packages = [\"package\", \"package.subpackage\"])" #: ../../whatsnew/2.0.rst:848 msgid "" @@ -1631,7 +1829,6 @@ msgstr "" "C 拡張が最も複雑なケースになりえます。以下は PyXML パッケージからもってきた例" "です::" -#: ../../whatsnew/2.0.rst:851 msgid "" "from distutils.core import setup, Extension\n" "\n" @@ -1646,6 +1843,18 @@ msgid "" "setup (name = \"PyXML\", version = \"0.5.4\",\n" " ext_modules =[ expat_extension ] )" msgstr "" +"from distutils.core import setup, Extension\n" +"\n" +"expat_extension = Extension('xml.parsers.pyexpat',\n" +" define_macros = [('XML_NS', None)],\n" +" include_dirs = [ 'extensions/expat/xmltok',\n" +" 'extensions/expat/xmlparse' ],\n" +" sources = [ 'extensions/pyexpat.c',\n" +" 'extensions/expat/xmltok/xmltok.c',\n" +" 'extensions/expat/xmltok/xmlrole.c', ]\n" +" )\n" +"setup (name = \"PyXML\", version = \"0.5.4\",\n" +" ext_modules =[ expat_extension ] )" #: ../../whatsnew/2.0.rst:864 msgid "" @@ -1678,7 +1887,6 @@ msgstr "" msgid "XML Modules" msgstr "XML モジュール" -#: ../../whatsnew/2.0.rst:882 msgid "" "Python 1.5.2 included a simple XML parser in the form of the :mod:`!xmllib` " "module, contributed by Sjoerd Mullender. Since 1.5.2's release, two " @@ -1692,22 +1900,44 @@ msgid "" "documentation or the source code for complete details. The Python XML SIG is " "also working on improved documentation." msgstr "" +"Python 1.5.2 には、Sjoerd Mullender が貢献した :mod:`!xmllib` モジュールとい" +"う簡単な XML パーサーが含まれていました。\n" +"1.5.2 のリリース以降、XML 処理のための 2 種類のインターフェースが広く使われる" +"ようになりました。\n" +"SAX2 (Simple API for XML のバージョン 2) は :mod:`!xmllib` と似た点のあるイベ" +"ント駆動のインターフェースを提供します。\n" +"DOM (Document Object Model) は XML 文書を走査や変更が可能なノードのツリーに変" +"換する、ツリーに基づいたインターフェースです。\n" +"Python 2.0 では :mod:`xml` パッケージの一部として、SAX2 インターフェースと機" +"能を絞った DOM インターフェースが含まれています。\n" +"ここでは、これらの新しいインターフェースの概要を紹介します。\n" +"詳しくは Python のドキュメントまたはソースコードを参照してください。\n" +"Python XML SIG もドキュメントの改善に取り組んでいます。" #: ../../whatsnew/2.0.rst:896 msgid "SAX2 Support" msgstr "SAX2 サポート" -#: ../../whatsnew/2.0.rst:898 msgid "" "SAX defines an event-driven interface for parsing XML. To use SAX, you must " "write a SAX handler class. Handler classes inherit from various classes " "provided by SAX, and override various methods that will then be called by " -"the XML parser. For example, the :meth:`~xml.sax.handler.ContentHandler." -"startElement` and :meth:`~xml.sax.handler.ContentHandler.endElement` methods " -"are called for every starting and end tag encountered by the parser, the :" -"meth:`~xml.sax.handler.ContentHandler.characters` method is called for every " -"chunk of character data, and so forth." -msgstr "" +"the XML parser. For example, " +"the :meth:`~xml.sax.handler.ContentHandler.startElement` " +"and :meth:`~xml.sax.handler.ContentHandler.endElement` methods are called " +"for every starting and end tag encountered by the parser, " +"the :meth:`~xml.sax.handler.ContentHandler.characters` method is called for " +"every chunk of character data, and so forth." +msgstr "" +"SAX は XML を解析するためのイベント駆動のインターフェースを定義します。\n" +"SAX を使うには SAX ハンドラークラスを作成する必要があります。\n" +"ハンドラークラスは SAX が提供するクラスを継承し、XML パーサーから呼び出される" +"各種メソッドをオーバーライドします。\n" +"例えば、パーサーが開始タグや終了タグに遭遇するたび" +"に :meth:`~xml.sax.handler.ContentHandler.startElement` " +"と :meth:`~xml.sax.handler.ContentHandler.endElement` が呼び出され、\n" +"文字データのまとまりごと" +"に :meth:`~xml.sax.handler.ContentHandler.characters` が呼び出されます。" #: ../../whatsnew/2.0.rst:906 msgid "" @@ -1725,14 +1955,13 @@ msgstr "" #: ../../whatsnew/2.0.rst:912 msgid "" "For example, this little example program defines a handler that prints a " -"message for every starting and ending tag, and then parses the file :file:" -"`hamlet.xml` using it::" +"message for every starting and ending tag, and then parses the " +"file :file:`hamlet.xml` using it::" msgstr "" "以下の小さな実例プログラムでは、全ての開始・終了タグでメッセージを印字するハ" "ンドラを定義して、ファイル :file:`hamlet.xml` をそのハンドラを使ってパースし" "ています::" -#: ../../whatsnew/2.0.rst:916 msgid "" "from xml import sax\n" "\n" @@ -1753,18 +1982,36 @@ msgid "" "# Parse a file!\n" "parser.parse( 'hamlet.xml' )" msgstr "" +"from xml import sax\n" +"\n" +"class SimpleHandler(sax.ContentHandler):\n" +" def startElement(self, name, attrs):\n" +" print 'Start of element:', name, attrs.keys()\n" +"\n" +" def endElement(self, name):\n" +" print 'End of element:', name\n" +"\n" +"# パーサーオブジェクトを作成\n" +"parser = sax.make_parser()\n" +"\n" +"# 使用するハンドラーを指定\n" +"handler = SimpleHandler()\n" +"parser.setContentHandler( handler )\n" +"\n" +"# ファイルを解析\n" +"parser.parse( 'hamlet.xml' )" -#: ../../whatsnew/2.0.rst:935 msgid "" "For more information, consult the Python documentation, or the XML HOWTO at " "https://pyxml.sourceforge.net/topics/howto/xml-howto.html." msgstr "" +"詳しくは Python のドキュメント、または https://pyxml.sourceforge.net/topics/" +"howto/xml-howto.html の XML HOWTO を参照してください。" #: ../../whatsnew/2.0.rst:940 msgid "DOM Support" msgstr "DOM サポート" -#: ../../whatsnew/2.0.rst:942 msgid "" "The Document Object Model is a tree-based representation for an XML " "document. A top-level :class:`!Document` instance is the root of the tree, " @@ -1775,6 +2022,13 @@ msgid "" "access element and attribute values, insert and delete nodes, and convert " "the tree back into XML." msgstr "" +"Document Object Model は XML 文書をツリーで表現するものです。\n" +"最上位の :class:`!Document` インスタンスがツリーの根となり、最上位" +"の :class:`!Element` インスタンスを唯一の子として持ちます。\n" +"この :class:`!Element` は文字データや子要素を表す子ノードを持ち、それらにもさ" +"らに子があるという形で続きます。\n" +"DOM を使うと、このツリーを自由な順序で走査し、要素や属性の値にアクセスし、" +"ノードを挿入・削除して、ツリーを XML に戻せます。" #: ../../whatsnew/2.0.rst:950 msgid "" @@ -1791,21 +2045,26 @@ msgstr "" "XML に変換することも出来ます。これにより単純に ````...\\ ```` を" "ファイルに書くよりも柔軟性の高い方法で XML 出力を生成出来ます。" -#: ../../whatsnew/2.0.rst:956 msgid "" -"The DOM implementation included with Python lives in the :mod:`xml.dom." -"minidom` module. It's a lightweight implementation of the Level 1 DOM with " -"support for XML namespaces. The :func:`!parse` and :func:`!parseString` " -"convenience functions are provided for generating a DOM tree::" +"The DOM implementation included with Python lives in " +"the :mod:`xml.dom.minidom` module. It's a lightweight implementation of the " +"Level 1 DOM with support for XML namespaces. The :func:`!parse` " +"and :func:`!parseString` convenience functions are provided for generating a " +"DOM tree::" msgstr "" +"Python に同梱されている DOM 実装は :mod:`xml.dom.minidom` モジュールにありま" +"す。\n" +"XML 名前空間をサポートする、Level 1 DOM の軽量な実装です。\n" +"DOM ツリーを生成するための便利な関数 :func:`!parse` と :func:`!parseString` " +"が用意されています。 ::" -#: ../../whatsnew/2.0.rst:961 msgid "" "from xml.dom import minidom\n" "doc = minidom.parse('hamlet.xml')" msgstr "" +"from xml.dom import minidom\n" +"doc = minidom.parse('hamlet.xml')" -#: ../../whatsnew/2.0.rst:964 msgid "" "``doc`` is a :class:`!Document` instance. :class:`!Document`, like all the " "other DOM classes such as :class:`!Element` and :class:`Text`, is a subclass " @@ -1816,23 +2075,35 @@ msgid "" "and :class:`!Document` instances have a method to find all child elements " "with a given tag name. Continuing from the previous 2-line example::" msgstr "" +"``doc`` は :class:`!Document` のインスタンスです。\n" +":class:`!Document` は、:class:`!Element` や :class:`Text` など他の DOM クラス" +"と同様、基底クラス :class:`!Node` のサブクラスです。\n" +"そのため DOM ツリーのすべてのノードは、自分と子ノードの XML 表現を含む文字列" +"を返す :meth:`!toxml` など、共通のメソッドをサポートしています。\n" +"各クラスには独自のメソッドもあります。\n" +"例えば、:class:`!Element` と :class:`!Document` のインスタンスには、指定した" +"タグ名を持つ子要素をすべて見つけるメソッドがあります。\n" +"先ほどの 2 行の例に続けると、次のようになります。 ::" -#: ../../whatsnew/2.0.rst:973 msgid "" "perslist = doc.getElementsByTagName( 'PERSONA' )\n" "print perslist[0].toxml()\n" "print perslist[1].toxml()" msgstr "" +"perslist = doc.getElementsByTagName( 'PERSONA' )\n" +"print perslist[0].toxml()\n" +"print perslist[1].toxml()" #: ../../whatsnew/2.0.rst:977 msgid "For the *Hamlet* XML file, the above few lines output::" msgstr "*Hamlet* XML ファイルに対して上の例は以下のような出力をします::" -#: ../../whatsnew/2.0.rst:979 msgid "" "CLAUDIUS, king of Denmark. \n" "HAMLET, son to the late, and nephew to the present king." msgstr "" +"CLAUDIUS, king of Denmark. \n" +"HAMLET, son to the late, and nephew to the present king." #: ../../whatsnew/2.0.rst:982 msgid "" @@ -1858,17 +2129,17 @@ msgid "" "root.insertBefore( root.childNodes[0], root.childNodes[20] )" msgstr "" -#: ../../whatsnew/2.0.rst:997 msgid "" "Again, I will refer you to the Python documentation for a complete listing " "of the different :class:`!Node` classes and their various methods." msgstr "" +"各種 :class:`!Node` クラスとそのメソッドの完全な一覧についても、Python のド" +"キュメントを参照してください。" #: ../../whatsnew/2.0.rst:1002 msgid "Relationship to PyXML" msgstr "PyXML との関係" -#: ../../whatsnew/2.0.rst:1004 msgid "" "The XML Special Interest Group has been working on XML-related Python code " "for a while. Its code distribution, called PyXML, is available from the " @@ -1877,6 +2148,13 @@ msgid "" "written programs that used PyXML, you're probably wondering about its " "compatibility with the 2.0 :mod:`xml` package." msgstr "" +"XML Special Interest Group は、しばらく前から XML 関連の Python コードに取り" +"組んできました。\n" +"PyXML という名前のコード配布物は、SIG のウェブページ https://www.python.org/" +"community/sigs/current/xml-sig から入手できます。\n" +"PyXML 配布物も ``xml`` というパッケージ名を使っていました。\n" +"PyXML を使うプログラムを書いたことがある方は、2.0 の :mod:`xml` パッケージと" +"の互換性が気になるでしょう。" #: ../../whatsnew/2.0.rst:1010 msgid "" @@ -1898,58 +2176,72 @@ msgstr "" "なスーパーセットとなり、多くの追加機能が追加されます。 PyXML の追加機能には次" "のようなものがあります。" -#: ../../whatsnew/2.0.rst:1019 msgid "4DOM, a full DOM implementation from FourThought, Inc." -msgstr "" +msgstr "FourThought, Inc. による完全な DOM 実装、4DOM。" -#: ../../whatsnew/2.0.rst:1021 msgid "The xmlproc validating parser, written by Lars Marius Garshol." -msgstr "" +msgstr "Lars Marius Garshol が書いた妥当性検証パーサー xmlproc。" -#: ../../whatsnew/2.0.rst:1023 msgid "The :mod:`!sgmlop` parser accelerator module, written by Fredrik Lundh." -msgstr "" +msgstr "Fredrik Lundh が書いたパーサーの高速化モジュール :mod:`!sgmlop`。" #: ../../whatsnew/2.0.rst:1029 msgid "Module changes" msgstr "更新されたモジュール" -#: ../../whatsnew/2.0.rst:1031 msgid "" "Lots of improvements and bugfixes were made to Python's extensive standard " -"library; some of the affected modules include :mod:`readline`, :mod:" -"`ConfigParser `, :mod:`!cgi`, :mod:`calendar`, :mod:`posix`, :" -"mod:`readline`, :mod:`!xmllib`, :mod:`!aifc`, :mod:`!chunk`, :mod:`wave`, :" -"mod:`random`, :mod:`shelve`, and :mod:`!nntplib`. Consult the CVS logs for " -"the exact patch-by-patch details." +"library; some of the affected modules " +"include :mod:`readline`, :mod:`ConfigParser `, :mod:`!" +"cgi`, :mod:`calendar`, :mod:`posix`, :mod:`readline`, :mod:`!xmllib`, :mod:`!" +"aifc`, :mod:`!chunk`, :mod:`wave`, :mod:`random`, :mod:`shelve`, and :mod:`!" +"nntplib`. Consult the CVS logs for the exact patch-by-patch details." msgstr "" +"Python の豊富な標準ライブラリには、多くの改善とバグ修正が行われました。\n" +"対象には :mod:`readline`、:mod:`ConfigParser `、:mod:`!" +"cgi`、:mod:`calendar`、:mod:`posix`、:mod:`readline`、:mod:`!xmllib`、:mod:`!" +"aifc`、:mod:`!chunk`、:mod:`wave`、:mod:`random`、:mod:`shelve`、:mod:`!" +"nntplib` などがあります。\n" +"各パッチの詳しい内容は CVS のログを参照してください。" -#: ../../whatsnew/2.0.rst:1037 msgid "" "Brian Gallew contributed OpenSSL support for the :mod:`socket` module. " "OpenSSL is an implementation of the Secure Socket Layer, which encrypts the " -"data being sent over a socket. When compiling Python, you can edit :file:" -"`Modules/Setup` to include SSL support, which adds an additional function to " -"the :mod:`socket` module: ``socket.ssl(socket, keyfile, certfile)``, which " -"takes a socket object and returns an SSL socket. The :mod:`httplib ` " -"and :mod:`urllib` modules were also changed to support ``https://`` URLs, " -"though no one has implemented FTP or SMTP over SSL." -msgstr "" +"data being sent over a socket. When compiling Python, you can " +"edit :file:`Modules/Setup` to include SSL support, which adds an additional " +"function to the :mod:`socket` module: ``socket.ssl(socket, keyfile, " +"certfile)``, which takes a socket object and returns an SSL socket. " +"The :mod:`httplib ` and :mod:`urllib` modules were also changed to " +"support ``https://`` URLs, though no one has implemented FTP or SMTP over " +"SSL." +msgstr "" +"Brian Gallew は :mod:`socket` モジュールに OpenSSL のサポートを追加しまし" +"た。\n" +"OpenSSL は、ソケット経由で送信するデータを暗号化する Secure Socket Layer の実" +"装です。\n" +"Python のコンパイル時に :file:`Modules/Setup` を編集して SSL サポートを含める" +"と、:mod:`socket` モジュールに ``socket.ssl(socket, keyfile, certfile)`` とい" +"う関数が追加されます。\n" +"これはソケットオブジェクトを受け取り、SSL ソケットを返します。\n" +":mod:`httplib ` と :mod:`urllib` モジュールも ``https://`` URL をサポー" +"トするよう変更されましたが、SSL 上の FTP や SMTP はまだ実装されていません。" -#: ../../whatsnew/2.0.rst:1046 msgid "" "The :mod:`httplib ` module has been rewritten by Greg Stein to support " "HTTP/1.1." msgstr "" +":mod:`httplib ` モジュールは HTTP/1.1 をサポートするために Greg Stein " +"によって書き直されました。" -#: ../../whatsnew/2.0.rst:1048 msgid "" "Backward compatibility with the 1.5 version of :mod:`!httplib` is provided, " "though using HTTP/1.1 features such as pipelining will require rewriting " "code to use a different set of interfaces." msgstr "" +":mod:`!httplib` の 1.5 版との後方互換性は提供されますが、パイプライン処理な" +"ど HTTP/1.1 の機能を使うには、別のインターフェースを使うようにコードを書き直" +"す必要があります。" -#: ../../whatsnew/2.0.rst:1052 msgid "" "The :mod:`!Tkinter` module now supports Tcl/Tk version 8.1, 8.2, or 8.3, and " "support for the older 7.x versions has been dropped. The Tkinter module now " @@ -1957,6 +2249,12 @@ msgid "" "contributed an optimization which makes operations like ``create_line`` and " "``create_polygon`` much faster, especially when using lots of coordinates." msgstr "" +":mod:`!Tkinter` モジュールは Tcl/Tk のバージョン 8.1、8.2、8.3 をサポートする" +"ようになり、古い 7.x のサポートは終了しました。\n" +"Tkinter モジュールでは Tk ウィジェットに Unicode 文字列を表示できるようになり" +"ました。\n" +"また、Fredrik Lundh による最適化で、特に多数の座標を使う場合に " +"``create_line`` や ``create_polygon`` などの操作が大幅に高速化しました。" #: ../../whatsnew/2.0.rst:1058 msgid "" @@ -1977,10 +2275,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:1065 msgid "" "As mentioned in the earlier discussion of 2.0's Unicode support, the " -"underlying implementation of the regular expressions provided by the :mod:" -"`re` module has been changed. SRE, a new regular expression engine written " -"by Fredrik Lundh and partially funded by Hewlett Packard, supports matching " -"against both 8-bit strings and Unicode strings." +"underlying implementation of the regular expressions provided by " +"the :mod:`re` module has been changed. SRE, a new regular expression engine " +"written by Fredrik Lundh and partially funded by Hewlett Packard, supports " +"matching against both 8-bit strings and Unicode strings." msgstr "" "2.0 の Unicode サポートについて前述したように、 :mod:`re` モジュールで提供さ" "れる正規表現の根底となる実装が変更されました。SRE は新しい正規表現エンジン" @@ -2012,22 +2310,25 @@ msgid "" msgstr "" ":mod:`atexit`: Python インタプリタが終了する前に呼び出す関数を登録します。こ" "れまで ``sys.exitfunc`` に直接セットしてきたコードは :mod:`atexit` モジュー" -"ルを代わりに用いるように修正してください。 :mod:`atexit` をインポートし、 :" -"func:`atexit.register` で終了時に呼び出す関数を登録します。(Contributed by " -"Skip Montanaro.)" +"ルを代わりに用いるように修正してください。 :mod:`atexit` をインポート" +"し、 :func:`atexit.register` で終了時に呼び出す関数を登録します。" +"(Contributed by Skip Montanaro.)" -#: ../../whatsnew/2.0.rst:1087 msgid "" ":mod:`codecs`, :mod:`!encodings`, :mod:`unicodedata`: Added as part of the " "new Unicode support." msgstr "" +":mod:`codecs`、:mod:`!encodings`、:mod:`unicodedata`: 新しい Unicode サポート" +"の一部として追加されました。" -#: ../../whatsnew/2.0.rst:1090 msgid "" ":mod:`filecmp`: Supersedes the old :mod:`!cmp`, :mod:`!cmpcache` and :mod:`!" "dircmp` modules, which have now become deprecated. (Contributed by Gordon " "MacMillan and Moshe Zadka.)" msgstr "" +":mod:`filecmp`: 非推奨となった従来の :mod:`!cmp`、:mod:`!cmpcache`、:mod:`!" +"dircmp` モジュールに取って代わるものです。\n" +"(Gordon MacMillan と Moshe Zadka が貢献しました。)" #: ../../whatsnew/2.0.rst:1094 msgid "" @@ -2043,12 +2344,14 @@ msgstr "" "す。 (Integrated by Barry Warsaw, from separate contributions by Martin von " "Löwis, Peter Funk, and James Henstridge.)" -#: ../../whatsnew/2.0.rst:1099 msgid "" ":mod:`!linuxaudiodev`: Support for the :file:`/dev/audio` device on Linux, a " "twin to the existing :mod:`!sunaudiodev` module. (Contributed by Peter " "Bosch, with fixes by Jeremy Hylton.)" msgstr "" +":mod:`!linuxaudiodev`: Linux の :file:`/dev/audio` デバイスをサポートする、既" +"存の :mod:`!sunaudiodev` モジュールに相当するものです。\n" +"(Peter Bosch が貢献し、Jeremy Hylton が修正しました。)" #: ../../whatsnew/2.0.rst:1103 msgid "" @@ -2056,22 +2359,22 @@ msgid "" "A file's contents can be mapped directly into memory, at which point it " "behaves like a mutable string, so its contents can be read and modified. " "They can even be passed to functions that expect ordinary strings, such as " -"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by A." -"M. Kuchling.)" +"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by " +"A.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 msgid "" ":mod:`!pyexpat`: An interface to the Expat XML parser. (Contributed by Paul " "Prescod.)" msgstr "" +":mod:`!pyexpat`: Expat XML パーサーへのインターフェースです。\n" +"(Paul Prescod が貢献しました。)" -#: ../../whatsnew/2.0.rst:1112 msgid "" ":mod:`robotparser `: Parse a :file:`robots.txt` file, " "which is used for writing web spiders that politely avoid certain areas of a " @@ -2079,6 +2382,12 @@ msgid "" "builds a set of rules from it, and can then answer questions about the " "fetchability of a given URL. (Contributed by Skip Montanaro.)" msgstr "" +":mod:`robotparser `: ウェブサイトの特定の領域を適切に避け" +"るウェブスパイダーを書くために使う :file:`robots.txt` ファイルを解析しま" +"す。\n" +"このパーサーは :file:`robots.txt` ファイルの内容を受け取って規則の集合を作成" +"し、指定した URL を取得してよいかどうかを判定できます。\n" +"(Skip Montanaro が貢献しました。)" #: ../../whatsnew/2.0.rst:1118 msgid "" @@ -2088,11 +2397,12 @@ msgstr "" ":mod:`tabnanny`: Python ソースコードが曖昧なインデントになっていないかを" "チェックするモジュール/スクリプトです。 (Contributed by Tim Peters.)" -#: ../../whatsnew/2.0.rst:1121 msgid "" ":mod:`!UserString`: A base class useful for deriving objects that behave " "like strings." msgstr "" +":mod:`!UserString`: 文字列のように振る舞うオブジェクトを派生させるために便利" +"な基底クラスです。" #: ../../whatsnew/2.0.rst:1124 msgid "" @@ -2101,19 +2411,18 @@ msgid "" "are tried in a specific order. The user can alter which browser is launched " "by setting the *BROWSER* environment variable. (Originally inspired by Eric " "S. Raymond's patch to :mod:`urllib` which added similar functionality, but " -"the final module comes from code originally implemented by Fred Drake as :" -"file:`Tools/idle/BrowserControl.py`, and adapted for the standard library by " -"Fred.)" +"the final module comes from code originally implemented by Fred Drake " +"as :file:`Tools/idle/BrowserControl.py`, and adapted for the standard " +"library by Fred.)" msgstr "" ":mod:`webbrowser`: 指定した URL で、プラットフォームに依存しない方法でウェブ" "ブラウザを起動するモジュールです。個々のプラットフォームにおいて様々なブラウ" "ザが特定の順序で試されます。ユーザはどのブラウザを起動するかを環境変数 " -"*BROWSER* をセットすることで変更出来ます。(元々は Eric S. Raymond による :" -"mod:`urllib` への、同じ機能追加をするパッチに触発されましたが、最終的なモ" +"*BROWSER* をセットすることで変更出来ます。(元々は Eric S. Raymond によ" +"る :mod:`urllib` への、同じ機能追加をするパッチに触発されましたが、最終的なモ" "ジュールは Fred Drake が元々 :file:`Tools/idle/BrowserControl.py` として実装" "したものに由来し、Fred が標準ライブラリに適合させました。)" -#: ../../whatsnew/2.0.rst:1133 msgid "" ":mod:`_winreg `: An interface to the Windows registry. :mod:`!" "_winreg` is an adaptation of functions that have been part of PythonWin " @@ -2121,6 +2430,10 @@ msgid "" "to support Unicode. :mod:`!_winreg` was written by Bill Tutt and Mark " "Hammond." msgstr "" +":mod:`_winreg `: Windows レジストリへのインターフェースです。\n" +":mod:`!_winreg` は 1995 年から PythonWin に含まれていた関数を適応したもので、" +"今回コアの配布物に追加され、Unicode をサポートするよう拡張されました。\n" +":mod:`!_winreg` は Bill Tutt と Mark Hammond が書きました。" #: ../../whatsnew/2.0.rst:1138 msgid "" @@ -2131,17 +2444,19 @@ msgid "" msgstr "" ":mod:`zipfile`: ZIP 形式アーカイブの読み書きのためのモジュールです。DOS/" "Windows での :program:`PKZIP` や Unix での :program:`zip` により生成される" -"アーカイブで、 :program:`gzip` 形式とは混同しないで下さい (こちらは :mod:" -"`gzip` モジュールによってサポートされています)。(Contributed by James C. " -"Ahlstrom.)" +"アーカイブで、 :program:`gzip` 形式とは混同しないで下さい (こちら" +"は :mod:`gzip` モジュールによってサポートされています)。(Contributed by " +"James C. Ahlstrom.)" -#: ../../whatsnew/2.0.rst:1143 msgid "" ":mod:`!imputil`: A module that provides a simpler way for writing customized " "import hooks, in comparison to the existing :mod:`!ihooks` module. " "(Implemented by Greg Stein, with much discussion on python-dev along the " "way.)" msgstr "" +":mod:`!imputil`: 既存の :mod:`!ihooks` モジュールより簡単に、独自のインポート" +"フックを書けるモジュールです。\n" +"(Greg Stein が実装し、その過程で python-dev 上で多くの議論が行われました。)" #: ../../whatsnew/2.0.rst:1151 msgid "IDLE Improvements" @@ -2211,8 +2526,8 @@ msgstr "エディタウィンドウ内では、下部に行/桁を表示する #: ../../whatsnew/2.0.rst:1178 msgid "" -"Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module (:" -"kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." +"Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module " +"(:kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." msgstr "" "新たな 3 つのキーストロークコマンド: モジュールのチェック (:kbd:`Alt-F5`)、モ" "ジュールのインポート (:kbd:`F5`)、スクリプト実行 (:kbd:`Ctrl-F5`)." @@ -2221,24 +2536,34 @@ msgstr "" msgid "Deleted and Deprecated Modules" msgstr "削除されたモジュール、非推奨となったモジュール" -#: ../../whatsnew/2.0.rst:1187 msgid "" "A few modules have been dropped because they're obsolete, or because there " "are now better ways to do the same thing. The :mod:`!stdwin` module is " "gone; it was for a platform-independent windowing toolkit that's no longer " "developed." msgstr "" - -#: ../../whatsnew/2.0.rst:1191 -msgid "" -"A number of modules have been moved to the :file:`lib-old` subdirectory: :" -"mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!dump`, :mod:`!find`, :" -"mod:`!grep`, :mod:`!packmail`, :mod:`!poly`, :mod:`!util`, :mod:`!" -"whatsound`, :mod:`!zmod`. If you have code which relies on a module that's " -"been moved to :file:`lib-old`, you can simply add that directory to ``sys." -"path`` to get them back, but you're encouraged to update any code that " -"uses these modules." -msgstr "" +"古くなったり、同じことをするためのよりよい方法ができたりしたため、いくつかの" +"モジュールが削除されました。\n" +":mod:`!stdwin` モジュールは削除されました。\n" +"これは、開発が終了したプラットフォーム非依存のウィンドウツールキット用のモ" +"ジュールでした。" + +msgid "" +"A number of modules have been moved to the :file:`lib-old` " +"subdirectory: :mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!" +"dump`, :mod:`!find`, :mod:`!grep`, :mod:`!packmail`, :mod:`!poly`, :mod:`!" +"util`, :mod:`!whatsound`, :mod:`!zmod`. If you have code which relies on a " +"module that's been moved to :file:`lib-old`, you can simply add that " +"directory to ``sys.path`` to get them back, but you're encouraged to " +"update any code that uses these modules." +msgstr "" +"いくつかのモジュールが :file:`lib-old` サブディレクトリに移動しました。\n" +":mod:`!cmp`、:mod:`!cmpcache`、:mod:`!dircmp`、:mod:`!dump`、:mod:`!" +"find`、:mod:`!grep`、:mod:`!packmail`、:mod:`!poly`、:mod:`!util`、:mod:`!" +"whatsound`、:mod:`!zmod` です。\n" +":file:`lib-old` に移動したモジュールに依存するコードがある場合、そのディレク" +"トリを ``sys.path`` に追加すれば再び使えるようになりますが、これらのモジュー" +"ルを使うコードの更新をお勧めします。" #: ../../whatsnew/2.0.rst:1200 msgid "Acknowledgements" diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index ce73012b9..a873407ac 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 @@ -95,7 +95,6 @@ msgstr "" "このことは直感的な期待と一致せずしばしば人々を驚かせました。例えば、入れ子に" "なった再帰関数の定義は動きません::" -#: ../../whatsnew/2.1.rst:44 msgid "" "def f():\n" " ...\n" @@ -104,8 +103,13 @@ msgid "" " return g(value-1) + 1\n" " ..." msgstr "" +"def f():\n" +" ...\n" +" def g(value):\n" +" ...\n" +" return g(value-1) + 1\n" +" ..." -#: ../../whatsnew/2.1.rst:51 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " "because the binding of the name ``g`` isn't in either its local namespace or " @@ -116,8 +120,15 @@ msgid "" "find local variables being copied by passing them as the default values of " "arguments. ::" msgstr "" +"名前 ``g`` の束縛がローカル名前空間にもモジュールレベルの名前空間にもないた" +"め、関数 :func:`!g` は常に :exc:`NameError` 例外を送出します。\n" +"これは実際には大きな問題ではありません (このような内部関数を再帰的に定義する" +"ことは、そう多くないでしょう)。\n" +"しかし、:keyword:`lambda` 式を使いにくくするという実用上の問題もありまし" +"た。\n" +":keyword:`lambda` を使うコードでは、引数のデフォルト値として渡すことでローカ" +"ル変数をコピーしている例がよく見られます。 ::" -#: ../../whatsnew/2.1.rst:59 msgid "" "def find(self, name):\n" " \"Return list of any entries equal to 'name'\"\n" @@ -125,6 +136,11 @@ msgid "" " self.list_attribute)\n" " return L" msgstr "" +"def find(self, name):\n" +" \"name と等しい項目のリストを返す\"\n" +" L = filter(lambda x, name=name: x == name,\n" +" self.list_attribute)\n" +" return L" #: ../../whatsnew/2.1.rst:65 msgid "" @@ -140,10 +156,11 @@ msgid "" "added to the language to fix this problem. As a first effect, the " "``name=name`` default argument is now unnecessary in the above example. Put " "simply, when a given variable name is not assigned a value within a function " -"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:" -"`import` statements), references to the variable will be looked up in the " -"local namespace of the enclosing scope. A more detailed explanation of the " -"rules, and a dissection of the implementation, can be found in the PEP." +"(by an assignment, or the :keyword:`def`, :keyword:`class`, " +"or :keyword:`import` statements), references to the variable will be looked " +"up in the local namespace of the enclosing scope. A more detailed " +"explanation of the rules, and a dissection of the implementation, can be " +"found in the PEP." msgstr "" "Python 2.1の最も重要な変更点は、この問題を解決するために静的なスコープが追加" "されたことです。最初の効果として、``name=name`` という例ではデフォルトの引数" @@ -189,15 +206,14 @@ msgstr "" "数にアクセスするために別のコードを生成する必要があります。 ``from module " "import *``, ``exec`` はコンパイラにこれを理解することを不可能にしてしまいま" "す。なぜならそれらはコンパイル時にはわからないローカル名前空間に名前を追加す" -"るからです。それゆえ、もし関数が関数定義を含んだり自由な変数に :keyword:" -"`lambda` の語句を含んだりする場合、コンパイラは :exc:`SyntaxError` 例外を上げ" -"て知らせます。" +"るからです。それゆえ、もし関数が関数定義を含んだり自由な変数" +"に :keyword:`lambda` の語句を含んだりする場合、コンパイラ" +"は :exc:`SyntaxError` 例外を上げて知らせます。" #: ../../whatsnew/2.1.rst:96 msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "前述した説明を少し明確にするため、例を挙げます::" -#: ../../whatsnew/2.1.rst:98 msgid "" "x = 1\n" "def f():\n" @@ -206,13 +222,21 @@ msgid "" " def g():\n" " return x" msgstr "" +"x = 1\n" +"def f():\n" +" # 次の行は構文エラー\n" +" exec 'x=2'\n" +" def g():\n" +" return x" -#: ../../whatsnew/2.1.rst:105 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " "would define a new local variable named ``x`` whose value should be accessed " "by :func:`!g`." msgstr "" +"``exec`` 文を含む 4 行目は構文エラーです。\n" +"``exec`` が ``x`` という新しいローカル変数を定義し、:func:`!g` がその値にアク" +"セスするはずだからです。" #: ../../whatsnew/2.1.rst:109 msgid "" @@ -272,34 +296,33 @@ msgid "" "name :mod:`__future__`. Nested scopes can be enabled by the following " "statement::" msgstr "" -"この構文は :mod:`__future__` という名の予約モジュールを使う ``from..." -"import`` ステートメントを使用します。ネストしたスコープは以下のステートメント" -"で有効にできます。" +"この構文は :mod:`__future__` という名の予約モジュールを使う " +"``from...import`` ステートメントを使用します。ネストしたスコープは以下のス" +"テートメントで有効にできます。" -#: ../../whatsnew/2.1.rst:141 msgid "from __future__ import nested_scopes" -msgstr "" +msgstr "from __future__ import nested_scopes" #: ../../whatsnew/2.1.rst:143 msgid "" "While it looks like a normal :keyword:`import` statement, it's not; there " "are strict rules on where such a future statement can be put. They can only " -"be at the top of a module, and must precede any Python code or regular :" -"keyword:`!import` statements. This is because such statements can affect " -"how the Python bytecode compiler parses code and generates bytecode, so they " -"must precede any statement that will result in bytecodes being produced." +"be at the top of a module, and must precede any Python code or " +"regular :keyword:`!import` statements. This is because such statements can " +"affect how the Python bytecode compiler parses code and generates bytecode, " +"so they must precede any statement that will result in bytecodes being " +"produced." msgstr "" "普通 の :keyword:`import` ステートメントに見えますが、実は違います; このよう" "な未来のステートメントが置かれる場所には厳格なルールがあります。これらはモ" -"ジュールの冒頭にしか置けませんし、必ず何らかのPythonコードや正規の :keyword:" -"`!import` ステートメントの前になければなりません。それと言うのもこのようなス" -"テートメントは、Pythonのバイトコードコンパイラがコードを解析し、バイトコード" -"を生成する方法に影響しますので、生成されるバイトコードとなるステートメントの" -"前になくてはならないのです。" +"ジュールの冒頭にしか置けませんし、必ず何らかのPythonコードや正規" +"の :keyword:`!import` ステートメントの前になければなりません。それと言うのも" +"このようなステートメントは、Pythonのバイトコードコンパイラがコードを解析し、" +"バイトコードを生成する方法に影響しますので、生成されるバイトコードとなるス" +"テートメントの前になくてはならないのです。" -#: ../../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." @@ -348,55 +371,49 @@ msgstr "メソッド名" msgid "``<``" msgstr "``<``" -#: ../../whatsnew/2.1.rst:181 msgid ":meth:`~object.__lt__`" -msgstr "" +msgstr ":meth:`~object.__lt__`" #: ../../whatsnew/2.1.rst:183 msgid "``<=``" msgstr "``<=``" -#: ../../whatsnew/2.1.rst:183 msgid ":meth:`~object.__le__`" -msgstr "" +msgstr ":meth:`~object.__le__`" #: ../../whatsnew/2.1.rst:185 msgid "``>``" msgstr "``>``" -#: ../../whatsnew/2.1.rst:185 msgid ":meth:`~object.__gt__`" -msgstr "" +msgstr ":meth:`~object.__gt__`" #: ../../whatsnew/2.1.rst:187 msgid "``>=``" msgstr "``>=``" -#: ../../whatsnew/2.1.rst:187 msgid ":meth:`~object.__ge__`" -msgstr "" +msgstr ":meth:`~object.__ge__`" #: ../../whatsnew/2.1.rst:189 msgid "``==``" msgstr "``==``" -#: ../../whatsnew/2.1.rst:189 msgid ":meth:`~object.__eq__`" -msgstr "" +msgstr ":meth:`~object.__eq__`" #: ../../whatsnew/2.1.rst:191 msgid "``!=``" msgstr "``!=``" -#: ../../whatsnew/2.1.rst:191 msgid ":meth:`~object.__ne__`" -msgstr "" +msgstr ":meth:`~object.__ne__`" #: ../../whatsnew/2.1.rst:194 msgid "" -"(The magic methods are named after the corresponding Fortran operators ``.LT." -"``. ``.LE.``, &c. Numeric programmers are almost certainly quite familiar " -"with these names and will find them easy to remember.)" +"(The magic methods are named after the corresponding Fortran operators " +"``.LT.``. ``.LE.``, &c. Numeric programmers are almost certainly quite " +"familiar with these names and will find them easy to remember.)" msgstr "" "(特殊メソッドはFortranの ``.LT.`` や ``.LE.`` 等々の演算子にちなんで命名され" "ています。プログラマはほぼ確実にこれらの名前を熟知していますので、覚えやすい" @@ -439,14 +456,14 @@ msgstr "" msgid "" "There are also corresponding changes of interest to C programmers; there's a " "new slot ``tp_richcmp`` in type objects and an API for performing a given " -"rich comparison. I won't cover the C API here, but will refer you to :pep:" -"`207`, or to 2.1's C API documentation, for the full list of related " +"rich comparison. I won't cover the C API here, but will refer you " +"to :pep:`207`, or to 2.1's C API documentation, for the full list of related " "functions." msgstr "" "C プログラマにとって興味深い関連する変更があります。型オブジェクトに新しい " "``tp_richcmp`` スロットと、この拡張された比較を行うAPIが追加されました。ここ" -"ではC APIについて言及しませんが、あながた関連する関数のリストを見たければ、 :" -"pep:`207` かバージョン2.1のC APIドキュメントを参照してください。" +"ではC APIについて言及しませんが、あながた関連する関数のリストを見たけれ" +"ば、 :pep:`207` かバージョン2.1のC APIドキュメントを参照してください。" #: ../../whatsnew/2.1.rst:222 msgid ":pep:`207` - Rich Comparisons" @@ -487,8 +504,8 @@ msgstr "" #: ../../whatsnew/2.1.rst:242 msgid "" -"Python 2.1 adds the warning framework to be used in this scheme. It adds a :" -"mod:`warnings` module that provide functions to issue warnings, and to " +"Python 2.1 adds the warning framework to be used in this scheme. It adds " +"a :mod:`warnings` module that provide functions to issue warnings, and to " "filter out warnings that you don't want to be displayed. Third-party modules " "can also use this framework to deprecate old features that they no longer " "wish to support." @@ -498,27 +515,30 @@ msgstr "" "ジュールを追加します。サードパーティーのモジュールはまた、彼らがサポート対象" "外にしたい古い機能を非推奨と知らしめるのにこのフレームワークを利用できます。" -#: ../../whatsnew/2.1.rst:248 msgid "" "For example, in Python 2.1 the :mod:`!regex` module is deprecated, so " "importing it causes a warning to be printed::" msgstr "" +"例えば、Python 2.1 では :mod:`!regex` モジュールが非推奨となったため、イン" +"ポートすると警告が表示されます。 ::" -#: ../../whatsnew/2.1.rst:251 msgid "" ">>> import regex\n" "__main__:1: DeprecationWarning: the regex module\n" " is deprecated; please use the re module\n" ">>>" msgstr "" +">>> import regex\n" +"__main__:1: DeprecationWarning: the regex module\n" +" is deprecated; please use the re module\n" +">>>" #: ../../whatsnew/2.1.rst:256 msgid "Warnings can be issued by calling the :func:`warnings.warn` function::" msgstr "警告は :func:`warnings.warn` 関数を呼び出すことで発行できます::" -#: ../../whatsnew/2.1.rst:258 msgid "warnings.warn(\"feature X no longer supported\")" -msgstr "" +msgstr "warnings.warn(\"feature X no longer supported\")" #: ../../whatsnew/2.1.rst:260 msgid "" @@ -528,16 +548,19 @@ msgstr "" "最初のパラメータは警告メッセージです。任意追加のパラメータは、特定の警告カテ" "ゴリを指定するために利用することができます。" -#: ../../whatsnew/2.1.rst:263 msgid "" "Filters can be added to disable certain warnings; a regular expression " "pattern can be applied to the message or to the module name in order to " -"suppress a warning. For example, you may have a program that uses the :mod:" -"`!regex` module and not want to spare the time to convert it to use the :mod:" -"`re` module right now. The warning can be suppressed by calling ::" +"suppress a warning. For example, you may have a program that uses " +"the :mod:`!regex` module and not want to spare the time to convert it to use " +"the :mod:`re` module right now. The warning can be suppressed by calling ::" msgstr "" +"特定の警告を無効にするフィルターを追加できます。\n" +"メッセージやモジュール名に正規表現パターンを適用して、警告を抑制できます。\n" +"例えば、:mod:`!regex` モジュールを使うプログラムがあり、今すぐ :mod:`re` モ" +"ジュールに置き換えるための時間を取りたくないかもしれません。\n" +"次の呼び出しで警告を抑制できます。 ::" -#: ../../whatsnew/2.1.rst:269 msgid "" "import warnings\n" "warnings.filterwarnings(action = 'ignore',\n" @@ -545,17 +568,28 @@ msgid "" " category=DeprecationWarning,\n" " module = '__main__')" msgstr "" +"import warnings\n" +"warnings.filterwarnings(action = 'ignore',\n" +" message='.*regex module is deprecated',\n" +" category=DeprecationWarning,\n" +" module = '__main__')" -#: ../../whatsnew/2.1.rst:275 msgid "" -"This adds a filter that will apply only to warnings of the class :class:" -"`DeprecationWarning` triggered in the :mod:`__main__` module, and applies a " -"regular expression to only match the message about the :mod:`!regex` module " -"being deprecated, and will cause such warnings to be ignored. Warnings can " -"also be printed only once, printed every time the offending code is " -"executed, or turned into exceptions that will cause the program to stop " -"(unless the exceptions are caught in the usual way, of course)." +"This adds a filter that will apply only to warnings of the " +"class :class:`DeprecationWarning` triggered in the :mod:`__main__` module, " +"and applies a regular expression to only match the message about the :mod:`!" +"regex` module being deprecated, and will cause such warnings to be ignored. " +"Warnings can also be printed only once, printed every time the offending " +"code is executed, or turned into exceptions that will cause the program to " +"stop (unless the exceptions are caught in the usual way, of course)." msgstr "" +"これにより、:mod:`__main__` モジュールで発生する :class:`DeprecationWarning` " +"クラスの警告だけに適用されるフィルターを追加します。\n" +"正規表現で :mod:`!regex` モジュールの非推奨化についてのメッセージだけを選び、" +"その警告を無視します。\n" +"警告は、一度だけ表示する、問題のコードが実行されるたびに表示する、プログラム" +"を停止させる例外に変える、といった設定もできます。\n" +"(もちろん、通常どおり例外を捕捉すれば停止しません。)" #: ../../whatsnew/2.1.rst:283 msgid "" @@ -647,17 +681,17 @@ msgstr "" msgid "" "In another far-reaching change to the build mechanism, Neil Schemenauer " "restructured things so Python now uses a single makefile that isn't " -"recursive, instead of makefiles in the top directory and in each of the :" -"file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` " +"recursive, instead of makefiles in the top directory and in each of " +"the :file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` " "subdirectories. This makes building Python faster and also makes hacking " "the Makefiles clearer and simpler." msgstr "" "もう一つの大きなビルド機構の変更点は Neil Schemenauer による再構成で、今や " -"Python は、トップディレクトリと :file:`Python/`, :file:`Parser/`, :file:" -"`Objects/`, :file:`Modules/` サブディレクトリにあった別々の Makefile が再帰的" -"にビルドする代わりに、再帰をしないトップレベルの単一 makefile を使うように" -"なっています。このことで Python のビルドは速くなり、 Makefile をもてあそぶの" -"が単純明快になっています。" +"Python は、トップディレクトリと :file:`Python/`, :file:`Parser/" +"`, :file:`Objects/`, :file:`Modules/` サブディレクトリにあった別々の " +"Makefile が再帰的にビルドする代わりに、再帰をしないトップレベルの単一 " +"makefile を使うようになっています。このことで Python のビルドは速くなり、 " +"Makefile をもてあそぶのが単純明快になっています。" #: ../../whatsnew/2.1.rst:335 msgid ":pep:`229` - Using Distutils to Build Python" @@ -702,7 +736,6 @@ msgstr "" "例えば、他の関数 ``f(x)`` の結果を、その関数の引数と結果を辞書に格納すること" "でキャッシュするメモライジング関数を考えてみましょう。" -#: ../../whatsnew/2.1.rst:356 msgid "" "_cache = {}\n" "def memoize(x):\n" @@ -716,8 +749,18 @@ msgid "" "\n" " return retval" msgstr "" +"_cache = {}\n" +"def memoize(x):\n" +" if _cache.has_key(x):\n" +" return _cache[x]\n" +"\n" +" retval = f(x)\n" +"\n" +" # 返されたオブジェクトをキャッシュ\n" +" _cache[x] = retval\n" +"\n" +" return retval" -#: ../../whatsnew/2.1.rst:368 msgid "" "This version works for simple things such as integers, but it has a side " "effect; the ``_cache`` dictionary holds a reference to the return values, so " @@ -726,6 +769,11 @@ msgid "" "object, or a data structure that takes up a lot of memory, this can be a " "problem." msgstr "" +"この版は整数のような単純なものには使えますが、副作用があります。\n" +"``_cache`` 辞書が戻り値への参照を保持するため、Python プロセスが終了して後始" +"末をするまで、戻り値は解放されません。\n" +"整数ではあまり目立ちませんが、:func:`!f` がオブジェクトや大量のメモリを使う" +"データ構造を返す場合は問題になり得ます。" #: ../../whatsnew/2.1.rst:374 msgid "" @@ -747,13 +795,13 @@ msgstr "" "それは参照されたオブジェクトを返すか、もう存在していないのであれば ``None`` " "を返します。" -#: ../../whatsnew/2.1.rst:382 msgid "" "This makes it possible to write a :func:`!memoize` function whose cache " "doesn't keep objects alive, by storing weak references in the cache. ::" msgstr "" +"これにより、キャッシュに弱参照を格納することで、キャッシュがオブジェクトを生" +"存させ続けない :func:`!memoize` 関数を書けます。 ::" -#: ../../whatsnew/2.1.rst:385 msgid "" "_cache = {}\n" "def memoize(x):\n" @@ -770,8 +818,21 @@ msgid "" "\n" " return retval" msgstr "" +"_cache = {}\n" +"def memoize(x):\n" +" if _cache.has_key(x):\n" +" obj = _cache[x]()\n" +" # 弱参照の参照先がまだ存在するなら、\n" +" # そのオブジェクトを返す\n" +" if obj is not None: return obj\n" +"\n" +" retval = f(x)\n" +"\n" +" # 弱参照をキャッシュ\n" +" _cache[x] = weakref.ref(retval)\n" +"\n" +" return retval" -#: ../../whatsnew/2.1.rst:400 msgid "" "The :mod:`weakref` module also allows creating proxy objects which behave " "like weak references --- an object referenced only by proxy objects is " @@ -781,8 +842,14 @@ msgid "" "to use a proxy will cause a :exc:`!weakref.ReferenceError` exception to be " "raised. ::" msgstr "" +":mod:`weakref` モジュールでは、弱参照のように振る舞うプロキシオブジェクトも作" +"成できます。\n" +"プロキシオブジェクトからしか参照されていないオブジェクトは解放されます。\n" +"ただし、オブジェクトを取得するための明示的な呼び出しは不要で、参照先が存在す" +"る間はプロキシがすべての操作を透過的にそのオブジェクトに転送します。\n" +"オブジェクトが解放された後にプロキシを使おうとすると、:exc:`!" +"weakref.ReferenceError` 例外が送出されます。 ::" -#: ../../whatsnew/2.1.rst:407 msgid "" "proxy = weakref.proxy(obj)\n" "proxy.attr # Equivalent to obj.attr\n" @@ -790,6 +857,11 @@ msgid "" "del obj\n" "proxy.attr # raises weakref.ReferenceError" msgstr "" +"proxy = weakref.proxy(obj)\n" +"proxy.attr # obj.attr と同じ\n" +"proxy.meth() # obj.meth() と同じ\n" +"del obj\n" +"proxy.attr # weakref.ReferenceError を送出" #: ../../whatsnew/2.1.rst:416 msgid ":pep:`205` - Weak References" @@ -803,7 +875,6 @@ msgstr "Fred L. Drake, Jr. 著、実装" msgid "PEP 232: Function Attributes" msgstr "PEP 232: 関数の属性" -#: ../../whatsnew/2.1.rst:425 msgid "" "In Python 2.1, functions can now have arbitrary information attached to " "them. People were often using docstrings to hold information about functions " @@ -816,6 +887,16 @@ msgid "" "documentation; for example, it means you can't properly document functions " "intended for private use in Zope." msgstr "" +"Python 2.1 では、関数に任意の情報を付加できるようになりました。\n" +"関数に情報を付加する唯一の手段が :attr:`~function.__doc__` 属性だったため、関" +"数やメソッドに関する情報を docstring に格納することがよくありました。\n" +"例えば、ウェブアプリケーションサーバー Zope では、docstring を持つ関数を外部" +"から安全にアクセスできるものとして扱います。\n" +"John Aycock の解析フレームワーク SPARK では、docstring に解析対象の BNF 文法" +"の一部を格納します。\n" +"しかし docstring は本来、関数の説明を格納するためのものなので、このような用途" +"の兼用は望ましくありません。\n" +"例えば Zope では、非公開用の関数を適切に文書化できなくなります。" #: ../../whatsnew/2.1.rst:436 msgid "" @@ -825,7 +906,6 @@ msgstr "" "ついに関数に、任意の属性をセットし、取り出すことが出来るようになりました。普" "通の Python 構文で出来ます::" -#: ../../whatsnew/2.1.rst:439 msgid "" "def f(): pass\n" "\n" @@ -833,16 +913,28 @@ msgid "" "f.secure = 1\n" "f.grammar = \"A ::= B (C D)*\"" msgstr "" +"def f(): pass\n" +"\n" +"f.publish = 1\n" +"f.secure = 1\n" +"f.grammar = \"A ::= B (C D)*\"" -#: ../../whatsnew/2.1.rst:445 msgid "" -"The dictionary containing attributes can be accessed as the function's :attr:" -"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " -"instances, in functions you can actually assign a new dictionary to :attr:" -"`~function.__dict__`, though the new value is restricted to a regular Python " -"dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " -"instance, or any other random object that behaves like a mapping." +"The dictionary containing attributes can be accessed as the " +"function's :attr:`~function.__dict__`. Unlike the :attr:`~type.__dict__` " +"attribute of class instances, in functions you can actually assign a new " +"dictionary to :attr:`~function.__dict__`, though the new value is restricted " +"to a regular Python dictionary; you *can't* be tricky and set it to " +"a :class:`!UserDict` instance, or any other random object that behaves like " +"a mapping." msgstr "" +"属性を格納する辞書には、関数の :attr:`~function.__dict__` としてアクセスでき" +"ます。\n" +"クラスのインスタンスの :attr:`~type.__dict__` 属性とは異なり、関数" +"の :attr:`~function.__dict__` には新しい辞書を代入できます。\n" +"ただし、新しい値は通常の Python の辞書に限られます。\n" +":class:`!UserDict` インスタンスや、マッピングのように振る舞うその他の任意のオ" +"ブジェクトを設定することは **できません**。" #: ../../whatsnew/2.1.rst:455 msgid ":pep:`232` - Function Attributes" @@ -875,9 +967,10 @@ msgid "" "In Python 2.1, the :keyword:`import` statement will work to simulate case-" "sensitivity on case-insensitive platforms. Python will now search for the " "first case-sensitive match by default, raising an :exc:`ImportError` if no " -"such file is found, so ``import file`` will not import a module named ``FILE." -"PY``. Case-insensitive matching can be requested by setting the :envvar:" -"`PYTHONCASEOK` environment variable before starting the Python interpreter." +"such file is found, so ``import file`` will not import a module named " +"``FILE.PY``. Case-insensitive matching can be requested by setting " +"the :envvar:`PYTHONCASEOK` environment variable before starting the Python " +"interpreter." msgstr "" "Python 2.1 では :keyword:`import` 文が、case-insensitive (大小文字に無関心)な" "プラットフォームで case-sensitivity (大小文字への繊細さ)をシミュレートして動" @@ -904,7 +997,6 @@ msgstr "" "呼び出される呼び出し可能オブジェクトを、 :func:`sys.displayhook` 変数にセット" "出来ます。たとえば特別な pretty- printing 関数をセット出来ます::" -#: ../../whatsnew/2.1.rst:488 msgid "" ">>> # Create a recursive data structure\n" "... L = [1,2,3]\n" @@ -918,6 +1010,17 @@ msgid "" "[1, 2, 3, ]\n" ">>>" msgstr "" +">>> # 再帰的なデータ構造を作成\n" +"... L = [1,2,3]\n" +">>> L.append(L)\n" +">>> L # Python のデフォルトの出力を表示\n" +"[1, 2, 3, [...]]\n" +">>> # 表示用の関数として pprint.pprint() を使う\n" +"... import sys, pprint\n" +">>> sys.displayhook = pprint.pprint\n" +">>> L\n" +"[1, 2, 3, ]\n" +">>>" #: ../../whatsnew/2.1.rst:503 msgid ":pep:`217` - Display Hook for Interactive Use" @@ -988,7 +1091,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 +1102,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 `_ で閲覧可) が最大のものでしたが、ソフトウェアの登録は任意だった" "ため、多くの人は登録しませんでした。" @@ -1008,30 +1110,31 @@ msgstr "" #: ../../whatsnew/2.1.rst:552 msgid "" "As a first small step toward fixing the problem, Python software packaged " -"using the Distutils :command:`sdist` command will include a file named :file:" -"`PKG-INFO` containing information about the package such as its name, " -"version, and author (metadata, in cataloguing terminology). :pep:`241` " -"contains the full list of fields that can be present in the :file:`PKG-INFO` " -"file. As people began to package their software using Python 2.1, more and " -"more packages will include metadata, making it possible to build automated " -"cataloguing systems and experiment with them. With the result experience, " -"perhaps it'll be possible to design a really good catalog and then build " -"support for it into Python 2.2. For example, the Distutils :command:`sdist` " -"and :command:`bdist_\\*` commands could support an ``upload`` option that " -"would automatically upload your package to a catalog server." -msgstr "" -"この問題をどうにかするための最初の小さな一歩として、Distutils の :command:" -"`sdist` コマンドを使ってパッケージ化する Python ソフトウェアに :file:`PKG-" -"INFO` と名付けられたファイルを含むようにしました。これには名前、バージョン、" -"著者 (カタログ化の用語ではメタデータ) のような情報を含んでいます。 :pep:" -"`241` が :file:`PKG-INFO` ファイルに持てるフィールドの完全なリストを記述して" -"います。Python 2.1 を使ったソフトウェアをパッケージ化し始めた人々によってパッ" -"ケージがどんどんメタデータを含み、自動的なカタログ化システムを構築し、それを" -"実験することが出来るようになります。その結果の経験により、おそらく本当に良い" -"カタログを設計出来、Python 2.2 でそのサポートを構築出来るでしょう。例えば " -"Distutils の :command:`sdist` コマンドと :command:`bdist_\\*` コマンド群はあ" -"なたのパッケージをカタログサーバに自動的にアップロードする ``upload`` オプ" -"ションをサポート出来るでしょう。" +"using the Distutils :command:`sdist` command will include a file " +"named :file:`PKG-INFO` containing information about the package such as its " +"name, version, and author (metadata, in cataloguing " +"terminology). :pep:`241` contains the full list of fields that can be " +"present in the :file:`PKG-INFO` file. As people began to package their " +"software using Python 2.1, more and more packages will include metadata, " +"making it possible to build automated cataloguing systems and experiment " +"with them. With the result experience, perhaps it'll be possible to design " +"a really good catalog and then build support for it into Python 2.2. For " +"example, the Distutils :command:`sdist` and :command:`bdist_\\*` commands " +"could support an ``upload`` option that would automatically upload your " +"package to a catalog server." +msgstr "" +"この問題をどうにかするための最初の小さな一歩として、Distutils " +"の :command:`sdist` コマンドを使ってパッケージ化する Python ソフトウェア" +"に :file:`PKG-INFO` と名付けられたファイルを含むようにしました。これには名" +"前、バージョン、著者 (カタログ化の用語ではメタデータ) のような情報を含んでい" +"ます。 :pep:`241` が :file:`PKG-INFO` ファイルに持てるフィールドの完全なリス" +"トを記述しています。Python 2.1 を使ったソフトウェアをパッケージ化し始めた人々" +"によってパッケージがどんどんメタデータを含み、自動的なカタログ化システムを構" +"築し、それを実験することが出来るようになります。その結果の経験により、おそら" +"く本当に良いカタログを設計出来、Python 2.2 でそのサポートを構築出来るでしょ" +"う。例えば Distutils の :command:`sdist` コマンドと :command:`bdist_\\*` コマ" +"ンド群はあなたのパッケージをカタログサーバに自動的にアップロードする " +"``upload`` オプションをサポート出来るでしょう。" #: ../../whatsnew/2.1.rst:565 msgid "" @@ -1039,8 +1142,8 @@ msgid "" "not using Python 2.1, since a new release of the Distutils will be made for " "users of earlier Python versions. Version 1.0.2 of the Distutils includes " "the changes described in :pep:`241`, as well as various bugfixes and " -"enhancements. It will be available from the Distutils SIG at https://www." -"python.org/community/sigs/current/distutils-sig/." +"enhancements. It will be available from the Distutils SIG at https://" +"www.python.org/community/sigs/current/distutils-sig/." msgstr "" ":file:`PKG-INFO` を含んだパッケージの作成は Python 2.1 を使っていなくても開始" "することが出来ます。Distutils の新しいリリースが以前のバージョンの Python " @@ -1069,17 +1172,23 @@ msgstr "" msgid "New and Improved Modules" msgstr "新しいモジュールと改良されたモジュール" -#: ../../whatsnew/2.1.rst:587 msgid "" "Ka-Ping Yee contributed two new modules: :mod:`!inspect.py`, a module for " "getting information about live Python code, and :mod:`!pydoc.py`, a module " -"for interactively converting docstrings to HTML or text. As a bonus, :file:" -"`Tools/scripts/pydoc`, which is now automatically installed, uses :mod:`!" -"pydoc.py` to display documentation given a Python module, package, or class " -"name. For example, ``pydoc xml.dom`` displays the following::" +"for interactively converting docstrings to HTML or text. As a " +"bonus, :file:`Tools/scripts/pydoc`, which is now automatically installed, " +"uses :mod:`!pydoc.py` to display documentation given a Python module, " +"package, or class name. For example, ``pydoc xml.dom`` displays the " +"following::" msgstr "" +"Ka-Ping Yee が 2 つの新しいモジュールを追加しました。\n" +"実行中の Python コードについての情報を取得する :mod:`!inspect.py` と、" +"docstring を対話的に HTML やテキストに変換する :mod:`!pydoc.py` です。\n" +"さらに、自動的にインストールされるようになった :file:`Tools/scripts/pydoc` " +"は、Python のモジュール名、パッケージ名、クラス名を指定すると :mod:`!" +"pydoc.py` を使ってドキュメントを表示します。\n" +"例えば、``pydoc xml.dom`` は次のように表示します。 ::" -#: ../../whatsnew/2.1.rst:594 msgid "" "Python Library Documentation: package xml.dom in xml\n" "\n" @@ -1096,35 +1205,61 @@ msgid "" " This package contains the following modules:\n" " ..." msgstr "" +"Python Library Documentation: package xml.dom in xml\n" +"\n" +"NAME\n" +" xml.dom - W3C Document Object Model implementation for Python.\n" +"\n" +"FILE\n" +" /usr/local/lib/python2.1/xml/dom/__init__.pyc\n" +"\n" +"DESCRIPTION\n" +" The Python mapping of the Document Object Model is documented in the\n" +" Python Library Reference in the section on the xml.dom package.\n" +"\n" +" This package contains the following modules:\n" +" ..." #: ../../whatsnew/2.1.rst:609 msgid "" -":file:`pydoc` also includes a Tk-based interactive help browser. :file:" -"`pydoc` quickly becomes addictive; try it out!" +":file:`pydoc` also includes a Tk-based interactive help " +"browser. :file:`pydoc` quickly becomes addictive; try it out!" msgstr "" -":file:`pydoc` には TK ベースの対話的ヘルプブラウザも含まれています。 :file:" -"`pydoc` はすぐに病みつきになります。お試しあれ。" +":file:`pydoc` には TK ベースの対話的ヘルプブラウザも含まれていま" +"す。 :file:`pydoc` はすぐに病みつきになります。お試しあれ。" -#: ../../whatsnew/2.1.rst:612 msgid "" "Two different modules for unit testing were added to the standard library. " "The :mod:`doctest` module, contributed by Tim Peters, provides a testing " "framework based on running embedded examples in docstrings and comparing the " "results against the expected output. PyUnit, contributed by Steve Purcell, " "is a unit testing framework inspired by JUnit, which was in turn an " -"adaptation of Kent Beck's Smalltalk testing framework. See https://pyunit." -"sourceforge.net/ for more information about PyUnit." -msgstr "" - -#: ../../whatsnew/2.1.rst:620 -msgid "" -"The :mod:`difflib` module contains a class, :class:`~difflib." -"SequenceMatcher`, which compares two sequences and computes the changes " -"required to transform one sequence into the other. For example, this module " -"can be used to write a tool similar to the Unix :program:`diff` program, and " -"in fact the sample program :file:`Tools/scripts/ndiff.py` demonstrates how " -"to write such a script." -msgstr "" +"adaptation of Kent Beck's Smalltalk testing framework. See https://" +"pyunit.sourceforge.net/ for more information about PyUnit." +msgstr "" +"単体テストのための 2 つのモジュールが標準ライブラリに追加されました。\n" +"Tim Peters が貢献した :mod:`doctest` モジュールは、docstring に埋め込まれた例" +"を実行し、その結果を期待する出力と比較するテストフレームワークです。\n" +"Steve Purcell が貢献した PyUnit は、JUnit に着想を得た単体テストフレームワー" +"クです。\n" +"JUnit は Kent Beck の Smalltalk のテストフレームワークを基にしたものです。\n" +"PyUnit について詳しくは https://pyunit.sourceforge.net/ を参照してください。" + +msgid "" +"The :mod:`difflib` module contains a " +"class, :class:`~difflib.SequenceMatcher`, which compares two sequences and " +"computes the changes required to transform one sequence into the other. For " +"example, this module can be used to write a tool similar to the " +"Unix :program:`diff` program, and in fact the sample program :file:`Tools/" +"scripts/ndiff.py` demonstrates how to write such a script." +msgstr "" +":mod:`difflib` モジュールには、2 つのシーケンスを比較し、一方をもう一方に変換" +"するために必要な変更を計算する :class:`~difflib.SequenceMatcher` クラスがあり" +"ます。\n" +"例えば、このモジュールを使って Unix の :program:`diff` プログラムに似たツール" +"を書けます。\n" +"実際に、サンプルプログラム :file:`Tools/scripts/ndiff.py` はそのようなスクリ" +"プトの書き方を示しています。" #: ../../whatsnew/2.1.rst:626 msgid "" @@ -1140,7 +1275,6 @@ msgstr "" "の高い方、低い方に移動出来、パネルライブラリはパネルがどこで重なるか、区域の" "どちらが可視かを理解します。" -#: ../../whatsnew/2.1.rst:632 msgid "" "The PyXML package has gone through a few releases since Python 2.0, and " "Python 2.1 includes an updated version of the :mod:`xml` package. Some of " @@ -1148,28 +1282,32 @@ msgid "" "ability for Expat parsers to handle files in any encoding supported by " "Python, and various bugfixes for SAX, DOM, and the :mod:`!minidom` module." msgstr "" +"Python 2.0 以降、PyXML パッケージは何度かリリースされ、Python 2.1 には更新さ" +"れた :mod:`xml` パッケージが含まれています。\n" +"主な変更には、Expat 1.2 以降のサポート、Python がサポートする任意のエンコー" +"ディングのファイルを Expat パーサーで処理する機能、SAX、DOM、:mod:`!minidom` " +"モジュールのさまざまなバグ修正があります。" #: ../../whatsnew/2.1.rst:638 msgid "" -"Ping also contributed another hook for handling uncaught exceptions. :func:" -"`sys.excepthook` can be set to a callable object. When an exception isn't " -"caught by any :keyword:`try`...\\ :keyword:`except` blocks, the exception " -"will be passed to :func:`sys.excepthook`, which can then do whatever it " -"likes. At the Ninth Python Conference, Ping demonstrated an application for " -"this hook: printing an extended traceback that not only lists the stack " -"frames, but also lists the function arguments and the local variables for " -"each frame." -msgstr "" -"Ka-Ping Yee は未捕捉の例外を処理するもうひとつのフックも寄稿しました。 :func:" -"`sys.excepthook` には呼び出し可能オブジェクトをセット出来ます。例外がどの :" -"keyword:`try`...\\ :keyword:`except` にも捕捉されない場合に、例外は :func:" -"`sys.excepthook` に通されて、そこで好きなことを何でも出来ます。9 回目の " -"Python カンファレンスにおいて、Ping はこのフックを使ったアプリケーションのデ" -"モを行いました。そこでは、スタックフレームを列挙するだけでなくそれぞれのフ" -"レームでの関数の引数とローカル変数の列挙も行う拡張トレースバックの表示をして" -"いました。" - -#: ../../whatsnew/2.1.rst:646 +"Ping also contributed another hook for handling uncaught " +"exceptions. :func:`sys.excepthook` can be set to a callable object. When an " +"exception isn't caught by any :keyword:`try`...\\ :keyword:`except` blocks, " +"the exception will be passed to :func:`sys.excepthook`, which can then do " +"whatever it likes. At the Ninth Python Conference, Ping demonstrated an " +"application for this hook: printing an extended traceback that not only " +"lists the stack frames, but also lists the function arguments and the local " +"variables for each frame." +msgstr "" +"Ka-Ping Yee は未捕捉の例外を処理するもうひとつのフックも寄稿しまし" +"た。 :func:`sys.excepthook` には呼び出し可能オブジェクトをセット出来ます。例" +"外がどの :keyword:`try`...\\ :keyword:`except` にも捕捉されない場合に、例外" +"は :func:`sys.excepthook` に通されて、そこで好きなことを何でも出来ます。9 回" +"目の Python カンファレンスにおいて、Ping はこのフックを使ったアプリケーション" +"のデモを行いました。そこでは、スタックフレームを列挙するだけでなくそれぞれの" +"フレームでの関数の引数とローカル変数の列挙も行う拡張トレースバックの表示をし" +"ていました。" + msgid "" "Various functions in the :mod:`time` module, such as :func:`~time.asctime` " "and :func:`~time.localtime`, require a floating-point argument containing " @@ -1181,6 +1319,15 @@ msgid "" "lengthier ``time.asctime(time.localtime(time.time()))`` that was previously " "required." msgstr "" +":mod:`time` モジュールの :func:`~time.asctime` や :func:`~time.localtime` な" +"どの関数には、エポックからの経過秒数を表す浮動小数点数の引数が必要でした。\n" +"これらの関数は現在時刻を扱うために使われることが最も多いため、この引数は省略" +"可能になりました。\n" +"値を指定しなければ現在時刻を使います。\n" +"例えば、ログファイルのエントリーには現在時刻の文字列がよく必要になります。\n" +"Python 2.1 では、従来必要だった長い " +"``time.asctime(time.localtime(time.time()))`` の代わりに ``time.asctime()`` " +"を使えます。" #: ../../whatsnew/2.1.rst:655 msgid "This change was proposed and implemented by Thomas Wouters." @@ -1228,18 +1375,18 @@ msgstr "" #: ../../whatsnew/2.1.rst:673 msgid "" "A new implementation-dependent function, ``sys._getframe([depth])``, has " -"been added to return a given frame object from the current call stack. :func:" -"`sys._getframe` returns the frame at the top of the call stack; if the " -"optional integer argument *depth* is supplied, the function returns the " -"frame that is *depth* calls below the top of the stack. For example, ``sys." -"_getframe(1)`` returns the caller's frame object." +"been added to return a given frame object from the current call " +"stack. :func:`sys._getframe` returns the frame at the top of the call " +"stack; if the optional integer argument *depth* is supplied, the function " +"returns the frame that is *depth* calls below the top of the stack. For " +"example, ``sys._getframe(1)`` returns the caller's frame object." msgstr "" "実装依存の関数ですが ``sys._getframe([depth])`` が、現在の呼び出しスタックよ" -"り、指定したフレームオブジェクトを返すものとして追加されました。 :func:`sys." -"_getframe` は呼び出しスタックの一番上のフレームを返します。オプショナルな整数" -"引数 *depth* を与えると、関数はスタックの一番上から下 *depth* ぶんの呼び出し" -"のフレームを返します。例えば ``sys._getframe(1)`` は呼び出し元のフレームオブ" -"ジェクトを返します。" +"り、指定したフレームオブジェクトを返すものとして追加されまし" +"た。 :func:`sys._getframe` は呼び出しスタックの一番上のフレームを返します。オ" +"プショナルな整数引数 *depth* を与えると、関数はスタックの一番上から下 " +"*depth* ぶんの呼び出しのフレームを返します。例えば ``sys._getframe(1)`` は呼" +"び出し元のフレームオブジェクトを返します。" #: ../../whatsnew/2.1.rst:680 msgid "" @@ -1265,39 +1412,59 @@ msgstr "" "変更ログの検索では 117 のパッチ適用と 136 のバグフィックスが見つかります。と" "もに少なく見積もっています。いくつかの注目に値する変更を紹介します:" -#: ../../whatsnew/2.1.rst:695 msgid "" "A specialized object allocator is now optionally available, that should be " "faster than the system :c:func:`malloc` and have less memory overhead. The " "allocator uses C's :c:func:`!malloc` function to get large pools of memory, " "and then fulfills smaller memory requests from these pools. It can be " -"enabled by providing the :option:`!--with-pymalloc` option to the :program:" -"`configure` script; see :file:`Objects/obmalloc.c` for the implementation " -"details." +"enabled by providing the :option:`!--with-pymalloc` option to " +"the :program:`configure` script; see :file:`Objects/obmalloc.c` for the " +"implementation details." msgstr "" +"システムの :c:func:`malloc` より高速でメモリのオーバーヘッドが少ないと期待さ" +"れる、オブジェクト専用のアロケーターをオプションとして利用できるようになりま" +"した。\n" +"このアロケーターは C の :c:func:`!malloc` 関数で大きなメモリプールを確保し、" +"そこから小さなメモリ要求に応えます。\n" +":program:`configure` スクリプトに :option:`!--with-pymalloc` を指定すると有効" +"になります。\n" +"実装の詳細は :file:`Objects/obmalloc.c` を参照してください。" -#: ../../whatsnew/2.1.rst:702 msgid "" "Authors of C extension modules should test their code with the object " "allocator enabled, because some incorrect code may break, causing core dumps " "at runtime. There are a bunch of memory allocation functions in Python's C " -"API that have previously been just aliases for the C library's :c:func:" -"`malloc` and :c:func:`free`, meaning that if you accidentally called " -"mismatched functions, the error wouldn't be noticeable. When the object " -"allocator is enabled, these functions aren't aliases of :c:func:`!malloc` " -"and :c:func:`!free` any more, and calling the wrong function to free memory " -"will get you a core dump. For example, if memory was allocated using :c:" -"macro:`PyMem_New`, it has to be freed using :c:func:`PyMem_Del`, not :c:func:" -"`!free`. A few modules included with Python fell afoul of this and had to " -"be fixed; doubtless there are more third-party modules that will have the " -"same problem." -msgstr "" +"API that have previously been just aliases for the C " +"library's :c:func:`malloc` and :c:func:`free`, meaning that if you " +"accidentally called mismatched functions, the error wouldn't be noticeable. " +"When the object allocator is enabled, these functions aren't aliases " +"of :c:func:`!malloc` and :c:func:`!free` any more, and calling the wrong " +"function to free memory will get you a core dump. For example, if memory " +"was allocated using :c:macro:`PyMem_New`, it has to be freed " +"using :c:func:`PyMem_Del`, not :c:func:`!free`. A few modules included with " +"Python fell afoul of this and had to be fixed; doubtless there are more " +"third-party modules that will have the same problem." +msgstr "" +"C 拡張モジュールの作者は、オブジェクトアロケーターを有効にしてコードをテスト" +"してください。\n" +"不正なコードの一部が動作しなくなり、実行時にコアダンプを引き起こす場合がある" +"ためです。\n" +"Python の C API にある多数のメモリ確保関数は、以前は C ライブラリ" +"の :c:func:`malloc` と :c:func:`free` の単なる別名でした。\n" +"そのため、誤って対応しない関数を呼び出してもエラーに気付きませんでした。\n" +"オブジェクトアロケーターを有効にすると、これらの関数は :c:func:`!malloc` " +"や :c:func:`!free` の別名ではなくなり、メモリ解放に誤った関数を使うとコアダン" +"プが発生します。\n" +"例えば、:c:macro:`PyMem_New` で確保したメモリは、:c:func:`!free` ではな" +"く :c:func:`PyMem_Del` で解放する必要があります。\n" +"Python に同梱されているモジュールにも、この問題に該当して修正が必要になったも" +"のがありました。\n" +"同じ問題を持つサードパーティーのモジュールも、ほかにあるはずです。" #: ../../whatsnew/2.1.rst:715 msgid "The object allocator was contributed by Vladimir Marangozov." msgstr "オブジェクトアロケータは Vladimir Marangozov により寄稿されました。" -#: ../../whatsnew/2.1.rst:717 msgid "" "The speed of line-oriented file I/O has been improved because people often " "complain about its lack of speed, and because it's often been used as a " @@ -1308,23 +1475,42 @@ msgid "" "operating systems. Tim Peters did much of the benchmarking and coding for " "this change, motivated by a discussion in comp.lang.python." msgstr "" +"行単位のファイル入出力は、遅さを指摘されることが多く、単純なベンチマークにも" +"よく使われるため、高速化されました。\n" +"ファイルオブジェクトの :meth:`readline` メソッドが書き直され、大幅に高速にな" +"りました。\n" +"高速化の程度は C ライブラリの :c:func:`!getc` の遅さに左右されるためプラット" +"フォームごとに異なりますが、およそ 66% で、特定のオペレーティングシステムでは" +"さらに大きな改善も見込まれます。\n" +"comp.lang.python での議論をきっかけに、Tim Peters がベンチマークと実装の大部" +"分を担当しました。" -#: ../../whatsnew/2.1.rst:726 msgid "" "A new module and method for file objects was also added, contributed by Jeff " -"Epler. The new method, :meth:`!xreadlines`, is similar to the existing :func:" -"`!xrange` built-in. :func:`!xreadlines` returns an opaque sequence object " -"that only supports being iterated over, reading a line on every iteration " -"but not reading the entire file into memory as the existing :meth:`!" -"readlines` method does. You'd use it like this::" -msgstr "" +"Epler. The new method, :meth:`!xreadlines`, is similar to the " +"existing :func:`!xrange` built-in. :func:`!xreadlines` returns an opaque " +"sequence object that only supports being iterated over, reading a line on " +"every iteration but not reading the entire file into memory as the " +"existing :meth:`!readlines` method does. You'd use it like this::" +msgstr "" +"Jeff Epler の貢献により、新しいモジュールとファイルオブジェクトのメソッドも追" +"加されました。\n" +"新しいメソッド :meth:`!xreadlines` は、既存の組み込み関数 :func:`!xrange` に" +"似ています。\n" +":func:`!xreadlines` は、反復処理だけをサポートする不透明なシーケンスオブジェ" +"クトを返します。\n" +"反復のたびに 1 行を読み取り、既存の :meth:`!readlines` メソッドのようにファイ" +"ル全体をメモリに読み込むことはありません。\n" +"次のように使います。 ::" -#: ../../whatsnew/2.1.rst:733 msgid "" "for line in sys.stdin.xreadlines():\n" " # ... do something for each line ...\n" " ..." msgstr "" +"for line in sys.stdin.xreadlines():\n" +" # ... 各行を処理する ...\n" +" ..." #: ../../whatsnew/2.1.rst:737 msgid "" @@ -1336,7 +1522,6 @@ msgstr "" "python-dev/2001-January/ にある 2001 年 1 月 1--15 日の python-dev のまとめを" "ご覧ください。" -#: ../../whatsnew/2.1.rst:740 msgid "" "A new method, :meth:`~dict.popitem`, was added to dictionaries to enable " "destructively iterating through the contents of a dictionary; this can be " @@ -1346,6 +1531,14 @@ msgid "" "was implemented mostly by Tim Peters and Guido van Rossum, after a " "suggestion and preliminary patch by Moshe Zadka." msgstr "" +"辞書に :meth:`~dict.popitem` メソッドが追加され、内容を削除しながら反復処理で" +"きるようになりました。\n" +"すべてのキーや値を含むリストを作成する必要がないため、大きな辞書では高速にな" +"る可能性があります。\n" +"``D.popitem()`` は辞書 ``D`` から任意の ``(key, value)`` の組を削除し、要素" +"数 2 のタプルとして返します。\n" +"Moshe Zadka の提案と最初のパッチを受け、主に Tim Peters と Guido van Rossum " +"が実装しました。" #: ../../whatsnew/2.1.rst:748 msgid "" @@ -1358,17 +1551,18 @@ msgid "" msgstr "" "``from module import *`` を使ってインポートする際にインポートされる名前を制御" "出来るようになりました。インポートされるべき名前のリストを含む ``__all__`` 属" -"性を定義することでこれを行えます。一つのよくある不平が、 :mod:`sys` や :mod:" -"`string` のように、ほかのモジュールをモジュールがインポートする場合に、 " -"``from module import *`` がインポートしているモジュールの名前空間内にそれらを" -"追加することです。これをフィックスするには、 ``__all__`` に公開名を単に列挙し" -"ます::" +"性を定義することでこれを行えます。一つのよくある不平が、 :mod:`sys` " +"や :mod:`string` のように、ほかのモジュールをモジュールがインポートする場合" +"に、 ``from module import *`` がインポートしているモジュールの名前空間内にそ" +"れらを追加することです。これをフィックスするには、 ``__all__`` に公開名を単に" +"列挙します::" -#: ../../whatsnew/2.1.rst:755 msgid "" "# List public names\n" "__all__ = ['Database', 'open']" msgstr "" +"# 公開する名前を列挙\n" +"__all__ = ['Database', 'open']" #: ../../whatsnew/2.1.rst:758 msgid "" @@ -1406,13 +1600,17 @@ msgstr "" "例外を送出できるようになり、またこれによりコンパイラの再編成という喜ばしい副" "作用がありました。Jeremy Hylton により達成されました。" -#: ../../whatsnew/2.1.rst:773 msgid "" -"C extensions which import other modules have been changed to use :c:func:" -"`PyImport_ImportModule`, which means that they will use any import hooks " -"that have been installed. This is also encouraged for third-party " -"extensions that need to import some other module from C code." +"C extensions which import other modules have been changed to " +"use :c:func:`PyImport_ImportModule`, which means that they will use any " +"import hooks that have been installed. This is also encouraged for third-" +"party extensions that need to import some other module from C code." msgstr "" +"他のモジュールをインポートする C 拡張は、:c:func:`PyImport_ImportModule` を使" +"うよう変更されました。\n" +"これにより、登録されているインポートフックが使われます。\n" +"C コードから別のモジュールをインポートする必要があるサードパーティーの拡張で" +"も、この関数の使用が推奨されます。" #: ../../whatsnew/2.1.rst:778 msgid "" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 2d3c23904..a313e0e82 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 @@ -98,7 +98,6 @@ msgstr "" "させます。この、本記事中において最も長くて複雑なセクションについて始める前" "に、変更の概要を提供し、いくつかの所感を提示しておこうと思います。" -#: ../../whatsnew/2.2.rst:52 msgid "" "A long time ago I wrote a web page listing flaws in Python's design. One of " "the most significant flaws was that it's impossible to subclass Python types " @@ -109,6 +108,15 @@ msgid "" "there's lots of C code that expects a regular Python list and won't accept " "a :class:`~collections.UserList` instance." msgstr "" +"ずっと前に、私は Python の設計上の欠点を列挙した Web ページを書きました。\n" +"特に重大な欠点の一つは、C で実装された Python の型のサブクラスを作れないこと" +"でした。\n" +"とりわけ組み込み型のサブクラスを作れないため、例えばリストに便利なメソッドを" +"一つ追加するだけでも、リストを継承するという方法は使えません。\n" +":mod:`!UserList` モジュールには、リストのすべてのメソッドを備え、さらに継承も" +"できるクラスがありますが、通常の Python のリストを要求" +"し、:class:`~collections.UserList` のインスタンスを受け付けない C コードも数" +"多くあります。" #: ../../whatsnew/2.2.rst:61 msgid "" @@ -134,7 +142,6 @@ msgstr "" "以前より使えたインスタンスメソッド加え、静的メソッド、クラスメソッドを今や定" "義出来ます。" -#: ../../whatsnew/2.2.rst:70 msgid "" "It's also possible to automatically call methods on accessing or setting an " "instance attribute by using a new mechanism called :dfn:`properties`. Many " @@ -142,6 +149,11 @@ msgid "" "instead, making the resulting code simpler and faster. As a small side " "benefit, attributes can now have docstrings, too." msgstr "" +":dfn:`プロパティ` と呼ばれる新しい仕組みにより、インスタンス属性へのアクセス" +"や設定の際に、自動的にメソッドを呼び出すことも可能です。\n" +":meth:`~object.__getattr__` を使っていた多くの箇所はプロパティを使う形に書き" +"直せ、コードが簡単になり高速化します。\n" +"さらに、属性にも docstring を付けられるようになりました。" #: ../../whatsnew/2.2.rst:76 msgid "" @@ -229,56 +241,69 @@ msgid "" msgstr "" "では、新スタイルクラスは、どうやって定義すればいいのでしょう? 答えは、既存の" "新スタイルクラスをサブクラス化することです。たとえば整数、リスト、辞書やファ" -"イルでさえも、ほとんどの Python 組み込み型は今では新スタイルクラスです。 :" -"class:`object` という名の新スタイルクラスは全ての組み込み型の基底クラスとして" -"既に追加されていて、相応しい組み込み型がなければ単に :class:`object` をサブク" -"ラス化すれば良いです::" +"イルでさえも、ほとんどの Python 組み込み型は今では新スタイルクラスで" +"す。 :class:`object` という名の新スタイルクラスは全ての組み込み型の基底クラス" +"として既に追加されていて、相応しい組み込み型がなければ単に :class:`object` を" +"サブクラス化すれば良いです::" -#: ../../whatsnew/2.2.rst:116 msgid "" "class C(object):\n" " def __init__ (self):\n" " ...\n" " ..." msgstr "" +"class C(object):\n" +" def __init__ (self):\n" +" ...\n" +" ..." -#: ../../whatsnew/2.2.rst:121 msgid "" "This means that :keyword:`class` statements that don't have any base classes " "are always classic classes in Python 2.2. (Actually you can also change " "this by setting a module-level variable named :attr:`!__metaclass__` --- " -"see :pep:`253` for the details --- but it's easier to just subclass :class:" -"`object`.)" +"see :pep:`253` for the details --- but it's easier to just " +"subclass :class:`object`.)" msgstr "" +"したがって、基底クラスを持たない :keyword:`class` 文は、Python 2.2 では常に旧" +"スタイルクラスになります。\n" +"(実際には :attr:`!__metaclass__` というモジュールレベルの変数を設定して変更す" +"ることもできます。\n" +"詳しくは :pep:`253` を参照してください。\n" +"ただし、:class:`object` を継承する方が簡単です。)" #: ../../whatsnew/2.2.rst:126 msgid "" "The type objects for the built-in types are available as built-ins, named " -"using a clever trick. Python has always had built-in functions named :func:" -"`int`, :func:`float`, and :func:`str`. In 2.2, they aren't functions any " -"more, but type objects that behave as factories when called. ::" +"using a clever trick. Python has always had built-in functions " +"named :func:`int`, :func:`float`, and :func:`str`. In 2.2, they aren't " +"functions any more, but type objects that behave as factories when called. ::" msgstr "" "組み込み型(ビルトイン型)のための型オブジェクトは、クレバーなトリックを使って" "名付けられた組み込み(ビルトイン)として利用可能です。Python は既に組み込み関" "数 :func:`int`, :func:`float`, :func:`str` を持っていました。2.2 にはその関数" "はなくなり、型オブジェクトは呼び出されるとファクトリとして振舞います::" -#: ../../whatsnew/2.2.rst:131 msgid "" ">>> int\n" "\n" ">>> int('123')\n" "123" msgstr "" +">>> int\n" +"\n" +">>> int('123')\n" +"123" -#: ../../whatsnew/2.2.rst:136 msgid "" "To make the set of types complete, new type objects such as :func:`dict` " "and :func:`!file` have been added. Here's a more interesting example, " "adding a :meth:`!lock` method to file objects::" msgstr "" +"型の集合を完全にするため、:func:`dict` や :func:`!file` などの新しい型オブ" +"ジェクトが追加されました。\n" +"より興味深い例として、ファイルオブジェクトに :meth:`!lock` メソッドを追加して" +"みましょう。 ::" -#: ../../whatsnew/2.2.rst:140 msgid "" "class LockableFile(file):\n" " def lock (self, operation, length=0, start=0, whence=0):\n" @@ -286,20 +311,29 @@ msgid "" " return fcntl.lockf(self.fileno(), operation,\n" " length, start, whence)" msgstr "" +"class LockableFile(file):\n" +" def lock (self, operation, length=0, start=0, whence=0):\n" +" import fcntl\n" +" return fcntl.lockf(self.fileno(), operation,\n" +" length, start, whence)" -#: ../../whatsnew/2.2.rst:146 msgid "" "The now-obsolete :mod:`!posixfile` module contained a class that emulated " "all of a file object's methods and also added a :meth:`!lock` method, but " "this class couldn't be passed to internal functions that expected a built-in " "file, something which is possible with our new :class:`!LockableFile`." msgstr "" +"現在は廃止された :mod:`!posixfile` モジュールには、ファイルオブジェクトのすべ" +"てのメソッドを模倣し、さらに :meth:`!lock` メソッドを追加するクラスがありまし" +"た。\n" +"しかし、そのクラスは組み込みのファイルオブジェクトを要求する内部関数に渡せま" +"せんでした。\n" +"新しい :class:`!LockableFile` なら渡すことができます。" #: ../../whatsnew/2.2.rst:153 msgid "Descriptors" msgstr "デスクリプタ" -#: ../../whatsnew/2.2.rst:155 msgid "" "In previous versions of Python, there was no consistent way to discover what " "attributes and methods were supported by an object. There were some informal " @@ -310,6 +344,14 @@ msgid "" "inheritance or an arbitrary :meth:`!__getattr__` hook were in use this could " "still be inaccurate." msgstr "" +"これまでの Python には、オブジェクトが備える属性やメソッドを一貫した方法で調" +"べる手段がありませんでした。\n" +"名前のリストを持つ :attr:`!__members__` や :attr:`!__methods__` 属性を定義す" +"る、といった非公式の慣習はありましたが、拡張型やクラスの作者がわざわざ定義し" +"ないことも多くありました。\n" +"代わりにオブジェクトの :attr:`~object.__dict__` を調べることもできましたが、" +"クラスの継承や任意の :meth:`!__getattr__` フックが使われていると、やはり正確" +"な情報は得られない場合がありました。" #: ../../whatsnew/2.2.rst:163 msgid "" @@ -319,11 +361,11 @@ msgid "" "it's a method or a field. With the descriptor API, static methods and class " "methods become possible, as well as more exotic constructs." msgstr "" -"その新しいクラスモデルの根底にあったひとつの大きな着想は、 :dfn:" -"`descriptors` を使ったオブジェクトの属性を記述する API を正式なものにしてしま" -"うことです。デスクリプタは属性の値を記述し、それがメソッドなのかフィールドな" -"のかを伝えます。デスククリプタ API によって、静的メソッドとクラスメソッドが、" -"より風変わりなコンストラクタとともに可能となりました。" +"その新しいクラスモデルの根底にあったひとつの大きな着想" +"は、 :dfn:`descriptors` を使ったオブジェクトの属性を記述する API を正式なもの" +"にしてしまうことです。デスクリプタは属性の値を記述し、それがメソッドなのか" +"フィールドなのかを伝えます。デスククリプタ API によって、静的メソッドとクラス" +"メソッドが、より風変わりなコンストラクタとともに可能となりました。" #: ../../whatsnew/2.2.rst:169 msgid "" @@ -337,9 +379,8 @@ msgstr "" msgid ":attr:`~definition.__name__` is the attribute's name." msgstr ":attr:`~definition.__name__` は属性の名前です。" -#: ../../whatsnew/2.2.rst:174 msgid ":attr:`~definition.__doc__` is the attribute's docstring." -msgstr "" +msgstr ":attr:`~definition.__doc__` は属性の docstring です。" #: ../../whatsnew/2.2.rst:176 msgid "" @@ -366,13 +407,13 @@ msgid "" msgstr "" "例えば、あなたが ``obj.x`` と書いたときに Python が実際に行うことは以下です::" -#: ../../whatsnew/2.2.rst:186 msgid "" "descriptor = obj.__class__.x\n" "descriptor.__get__(obj)" msgstr "" +"descriptor = obj.__class__.x\n" +"descriptor.__get__(obj)" -#: ../../whatsnew/2.2.rst:189 msgid "" "For methods, :meth:`descriptor.__get__ ` returns a temporary " "object that's callable, and wraps up the instance and the method to be " @@ -383,8 +424,18 @@ msgid "" "functions. Class methods are passed the class of the object, but not the " "object itself. Static and class methods are defined like this::" msgstr "" +"メソッドの場合、:meth:`descriptor.__get__ ` は、インスタンス" +"とそのインスタンスに対して呼び出すメソッドをまとめた、呼び出し可能な一時オブ" +"ジェクトを返します。\n" +"これによって静的メソッドやクラスメソッドも実現できるようになりました。\n" +"それぞれ、メソッドだけを包むデスクリプタ、またはメソッドとクラスをまとめて包" +"むデスクリプタを持ちます。\n" +"これらの新しい種類のメソッドについて簡単に説明すると、静的メソッドにはインス" +"タンスが渡されず、通常の関数と似ています。\n" +"クラスメソッドにはオブジェクト自体ではなく、そのオブジェクトのクラスが渡され" +"ます。\n" +"静的メソッドとクラスメソッドは次のように定義します。 ::" -#: ../../whatsnew/2.2.rst:199 msgid "" "class C(object):\n" " def f(arg1, arg2):\n" @@ -395,8 +446,15 @@ msgid "" " ...\n" " g = classmethod(g)" msgstr "" +"class C(object):\n" +" def f(arg1, arg2):\n" +" ...\n" +" f = staticmethod(f)\n" +"\n" +" def g(cls, arg1, arg2):\n" +" ...\n" +" g = classmethod(g)" -#: ../../whatsnew/2.2.rst:208 msgid "" "The :func:`staticmethod` function takes the function :func:`!f`, and returns " "it wrapped up in a descriptor so it can be stored in the class object. You " @@ -404,6 +462,11 @@ msgid "" "static f``, ``defstatic f()``, or something like that) but no such syntax " "has been defined yet; that's been left for future versions of Python." msgstr "" +":func:`staticmethod` 関数は関数 :func:`!f` を受け取り、クラスオブジェクトに格" +"納できるようデスクリプタで包んで返します。\n" +"このようなメソッドを作るための特殊な構文 (``def static f`` や ``defstatic " +"f()`` など) を期待するかもしれませんが、まだ定義されておらず、今後の Python " +"のバージョンに委ねられています。" #: ../../whatsnew/2.2.rst:214 msgid "" @@ -420,7 +483,6 @@ msgstr "" "デスクリプタクラスを書けるかもしれません。それを使ったクラスはきっとこう定義" "出来るでしょう::" -#: ../../whatsnew/2.2.rst:221 msgid "" "from eiffel import eiffelmethod\n" "\n" @@ -437,8 +499,21 @@ msgid "" "\n" " f = eiffelmethod(f, pre_f, post_f)" msgstr "" +"from eiffel import eiffelmethod\n" +"\n" +"class C(object):\n" +" def f(self, arg1, arg2):\n" +" # 実際の関数\n" +" ...\n" +" def pre_f(self):\n" +" # 事前条件を確認\n" +" ...\n" +" def post_f(self):\n" +" # 事後条件を確認\n" +" ...\n" +"\n" +" f = eiffelmethod(f, pre_f, post_f)" -#: ../../whatsnew/2.2.rst:236 msgid "" "Note that a person using the new :func:`!eiffelmethod` doesn't have to " "understand anything about descriptors. This is why I think the new features " @@ -447,6 +522,13 @@ msgid "" "the ZODB or whatever, but most users will just write code on top of the " "resulting libraries and ignore the implementation details." msgstr "" +"新しい :func:`!eiffelmethod` の利用者は、デスクリプタについて何も理解する必要" +"がないことに注目してください。\n" +"そのため、これらの新機能が言語の基本的な複雑さを増すことはないと私は考えてい" +"ます。\n" +":func:`!eiffelmethod` や ZODB などを作るために詳しく知る必要がある専門家は少" +"数で、ほとんどの利用者は実装の詳細を気にせず、できあがったライブラリを使って" +"コードを書くだけでしょう。" #: ../../whatsnew/2.2.rst:245 msgid "Multiple Inheritance: The Diamond Rule" @@ -459,10 +541,9 @@ msgid "" "taken from :pep:`253` by Guido van Rossum)::" msgstr "" "多重継承は名前解決のルールの変更を経てより有用なものになっています。クラスの" -"このようなセットを考えてみましょう (ダイアグラムは Guido van Rossum による :" -"pep:`253` より)::" +"このようなセットを考えてみましょう (ダイアグラムは Guido van Rossum によ" +"る :pep:`253` より)::" -#: ../../whatsnew/2.2.rst:251 msgid "" " class A:\n" " ^ ^ def save(self): ...\n" @@ -478,17 +559,37 @@ msgid "" " \\ /\n" " class D" msgstr "" +" class A:\n" +" ^ ^ def save(self): ...\n" +" / \\\n" +" / \\\n" +" / \\\n" +" / \\\n" +"class B class C:\n" +" ^ ^ def save(self): ...\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" class D" -#: ../../whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " -"classes are searched depth-first, going from left to right. A reference to :" -"meth:`!D.save` will search the classes :class:`!D`, :class:`!B`, and then :" -"class:`!A`, where :meth:`!save` would be found and returned. :meth:`!C." -"save` would never be found at all. This is bad, because if :class:`!C`'s :" -"meth:`!save` method is saving some internal state specific to :class:`!C`, " -"not calling it will result in that state never getting saved." -msgstr "" +"classes are searched depth-first, going from left to right. A reference " +"to :meth:`!D.save` will search the classes :class:`!D`, :class:`!B`, and " +"then :class:`!A`, where :meth:`!save` would be found and returned. :meth:`!" +"C.save` would never be found at all. This is bad, because if :class:`!" +"C`'s :meth:`!save` method is saving some internal state specific to :class:`!" +"C`, not calling it will result in that state never getting saved." +msgstr "" +"旧スタイルクラスの検索規則は単純ですが、あまり賢くありません。\n" +"基底クラスを左から右へ深さ優先で検索します。\n" +":meth:`!D.save` を参照すると、:class:`!D`、:class:`!B`、:class:`!A` の順にク" +"ラスを検索し、そこで見つかった :meth:`!save` を返します。\n" +":meth:`!C.save` は決して見つかりません。\n" +"これは問題です。\n" +":class:`!C` の :meth:`!save` メソッドが :class:`!C` 固有の内部状態を保存して" +"いる場合、それを呼び出さないとその状態がまったく保存されないからです。" #: ../../whatsnew/2.2.rst:273 msgid "" @@ -503,27 +604,32 @@ msgstr "" "ほとんどのケースで同じ結果となり、本当に複雑な継承グラフの場合にもっと有用な" "結果となりました)。" -#: ../../whatsnew/2.2.rst:278 msgid "" "List all the base classes, following the classic lookup rule and include a " "class multiple times if it's visited repeatedly. In the above example, the " "list of visited classes is [:class:`!D`, :class:`!B`, :class:`!A`, :class:`!" "C`, :class:`!A`]." msgstr "" +"従来の検索規則に従ってすべての基底クラスを列挙し、同じクラスに何度も到達した" +"場合はその都度リストに含めます。\n" +"上の例では、列挙されるクラスは [:class:`!D`, :class:`!B`, :class:`!" +"A`, :class:`!C`, :class:`!A`] です。" -#: ../../whatsnew/2.2.rst:283 msgid "" "Scan the list for duplicated classes. If any are found, remove all but one " "occurrence, leaving the *last* one in the list. In the above example, the " "list becomes [:class:`!D`, :class:`!B`, :class:`!C`, :class:`!A`] after " "dropping duplicates." msgstr "" +"リストを調べてクラスの重複を見つけます。\n" +"重複があれば、*最後* のものを一つだけ残してほかを削除します。\n" +"上の例では、重複を取り除くと [:class:`!D`, :class:`!B`, :class:`!" +"C`, :class:`!A`] になります。" -#: ../../whatsnew/2.2.rst:288 msgid "" -"Following this rule, referring to :meth:`!D.save` will return :meth:`!C." -"save`, which is the behaviour we're after. This lookup rule is the same as " -"the one followed by Common Lisp. A new built-in function, :func:`super`, " +"Following this rule, referring to :meth:`!D.save` will return :meth:`!" +"C.save`, which is the behaviour we're after. This lookup rule is the same " +"as the one followed by Common Lisp. A new built-in function, :func:`super`, " "provides a way to get at a class's superclasses without having to " "reimplement Python's algorithm. The most commonly used form will be " "``super(class, obj)``, which returns a bound superclass object (not the " @@ -531,8 +637,16 @@ msgid "" "the superclass; for example, :class:`!D`'s :meth:`!save` method would look " "like this::" msgstr "" +"この規則に従えば、:meth:`!D.save` を参照すると :meth:`!C.save` が返され、求め" +"ていた動作になります。\n" +"これは Common Lisp と同じ検索規則です。\n" +"新しい組み込み関数 :func:`super` を使えば、Python のアルゴリズムを自分で実装" +"し直さずにクラスのスーパークラスにアクセスできます。\n" +"最もよく使う形式は ``super(class, obj)`` で、これは束縛されたスーパークラスの" +"オブジェクトを返します (実際のクラスオブジェクトではありません)。\n" +"この形式はメソッド内からスーパークラスのメソッドを呼び出す際に使います。\n" +"例えば :class:`!D` の :meth:`!save` メソッドは次のようになります。 ::" -#: ../../whatsnew/2.2.rst:297 msgid "" "class D (B,C):\n" " def save (self):\n" @@ -541,6 +655,12 @@ msgid "" " # Save D's private information here\n" " ..." msgstr "" +"class D (B,C):\n" +" def save (self):\n" +" # スーパークラスの .save() を呼び出す\n" +" super(D, self).save()\n" +" # ここで D 固有の情報を保存\n" +" ..." #: ../../whatsnew/2.2.rst:304 msgid "" @@ -556,14 +676,20 @@ msgstr "" msgid "Attribute Access" msgstr "属性アクセス" -#: ../../whatsnew/2.2.rst:312 msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " "convenience, to make code more readable by automatically mapping an " -"attribute access such as ``obj.parent`` into a method call such as ``obj." -"get_parent``. Python 2.2 adds some new ways of controlling attribute access." +"attribute access such as ``obj.parent`` into a method call such as " +"``obj.get_parent``. Python 2.2 adds some new ways of controlling attribute " +"access." msgstr "" +"高度な Python のクラスのかなり多くが、:meth:`~object.__getattr__` で属性アク" +"セスのフックを定義しています。\n" +"特によくあるのは利便性のためで、``obj.parent`` のような属性アクセスを " +"``obj.get_parent`` のようなメソッド呼び出しへ自動的に対応付け、コードを読みや" +"すくしています。\n" +"Python 2.2 では、属性アクセスを制御する新しい方法がいくつか加わりました。" #: ../../whatsnew/2.2.rst:318 msgid "" @@ -585,28 +711,38 @@ msgid "" "called if ``foo`` isn't found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:329 msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " "complicated because to avoid recursion you can't use regular attribute " -"accesses inside them, and instead have to mess around with the contents of :" -"attr:`~object.__dict__`. :meth:`~object.__getattr__` methods also end up " -"being called by Python when it checks for other methods such as :meth:" -"`~object.__repr__` or :meth:`!__coerce__`, and so have to be written with " -"this in mind. Finally, calling a function on every attribute access results " -"in a sizable performance loss." -msgstr "" +"accesses inside them, and instead have to mess around with the contents " +"of :attr:`~object.__dict__`. :meth:`~object.__getattr__` methods also end up " +"being called by Python when it checks for other methods such " +"as :meth:`~object.__repr__` or :meth:`!__coerce__`, and so have to be " +"written with this in mind. Finally, calling a function on every attribute " +"access results in a sizable performance loss." +msgstr "" +"ただし、属性の参照を捕捉するには、Python 2.2 でサポートされた :dfn:`プロパ" +"ティ` を使う方が簡単な場合が多いでしょう。\n" +":meth:`!__getattr__` メソッドを書くのは複雑です。\n" +"再帰を避けるためにメソッドの内部では通常の属性アクセスを使えず、代わり" +"に :attr:`~object.__dict__` の内容を操作しなければならないからです。\n" +"また Python が :meth:`~object.__repr__` や :meth:`!__coerce__` などの別のメ" +"ソッドを探すときにも :meth:`~object.__getattr__` メソッドが呼ばれるので、その" +"ことを考慮して書く必要があります。\n" +"さらに、属性にアクセスするたびに関数を呼び出すと、性能が大きく低下します。" -#: ../../whatsnew/2.2.rst:338 msgid "" ":class:`property` is a new built-in type that packages up three functions " "that get, set, or delete an attribute, and a docstring. For example, if you " "want to define a :attr:`!size` attribute that's computed, but also settable, " "you could write::" msgstr "" +":class:`property` は、属性を取得、設定、削除する 3 つの関数と docstring をま" +"とめる新しい組み込み型です。\n" +"例えば、値を計算して返すとともに設定もできる :attr:`!size` 属性を定義するに" +"は、次のように書けます。 ::" -#: ../../whatsnew/2.2.rst:343 msgid "" "class C(object):\n" " def get_size (self):\n" @@ -623,8 +759,21 @@ msgid "" " None,\n" " \"Storage size of this instance\")" msgstr "" +"class C(object):\n" +" def get_size (self):\n" +" result = ... computation ...\n" +" return result\n" +" def set_size (self, size):\n" +" ... compute something based on the size\n" +" and set internal state appropriately ...\n" +"\n" +" # プロパティを定義します。「この属性を削除する」\n" +" # メソッドは None として定義しているので、\n" +" # この属性は削除できません。\n" +" size = property(get_size, set_size,\n" +" None,\n" +" \"このインスタンスの記憶域のサイズ\")" -#: ../../whatsnew/2.2.rst:358 msgid "" "That is certainly clearer and easier to write than a pair of :meth:`!" "__getattr__`/:meth:`!__setattr__` methods that check for the :attr:`!size` " @@ -633,16 +782,22 @@ msgid "" "the only ones which have to perform the work of calling a function, so " "references to other attributes run at their usual speed." msgstr "" +"これは確かに、:meth:`!__getattr__` と :meth:`!__setattr__` の両メソッド" +"で :attr:`!size` 属性だけを特別に扱い、ほかの属性はすべてインスタンス" +"の :attr:`~object.__dict__` から取得するように書くよりも明快で、記述も簡単で" +"す。\n" +"関数呼び出しが必要になるのも :attr:`!size` へのアクセスだけなので、ほかの属性" +"の参照は通常の速度で実行できます。" #: ../../whatsnew/2.2.rst:365 msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " "attribute. Python objects are usually very dynamic; at any time it's " -"possible to define a new attribute on an instance by just doing ``obj." -"new_attr=1``. A new-style class can define a class attribute named :attr:" -"`~object.__slots__` to limit the legal attributes to a particular set of " -"names. An example will make this clear::" +"possible to define a new attribute on an instance by just doing " +"``obj.new_attr=1``. A new-style class can define a class attribute " +"named :attr:`~object.__slots__` to limit the legal attributes to a " +"particular set of names. An example will make this clear::" msgstr "" "もう一つ最後、新しいクラス属性 :attr:`~object.__slots__` を使うと、オブジェク" "トで参照出来る属性リストを制約することが出来ます。Python オブジェクトは普通非" @@ -651,7 +806,6 @@ msgstr "" "という名前のクラス属性を定義出来、これにより適正な属性名集合を特定の集合に制" "限出来ます。実例をみるのが早いです::" -#: ../../whatsnew/2.2.rst:372 msgid "" ">>> class C(object):\n" "... __slots__ = ('template', 'name')\n" @@ -667,14 +821,27 @@ msgid "" " File \"\", line 1, in ?\n" "AttributeError: 'C' object has no attribute 'newattr'" msgstr "" +">>> class C(object):\n" +"... __slots__ = ('template', 'name')\n" +"...\n" +">>> obj = C()\n" +">>> print obj.template\n" +"None\n" +">>> obj.template = 'Test'\n" +">>> print obj.template\n" +"Test\n" +">>> obj.newattr = None\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"AttributeError: 'C' object has no attribute 'newattr'" #: ../../whatsnew/2.2.rst:386 msgid "" "Note how you get an :exc:`AttributeError` on the attempt to assign to an " "attribute not listed in :attr:`~object.__slots__`." msgstr "" -":attr:`~object.__slots__` リストに含めなかった属性への代入を試みて :exc:" -"`AttributeError` になっていることに注目してください。" +":attr:`~object.__slots__` リストに含めなかった属性への代入を試み" +"て :exc:`AttributeError` になっていることに注目してください。" #: ../../whatsnew/2.2.rst:393 msgid "Related Links" @@ -691,34 +858,37 @@ msgstr "" "分な簡単な概要だけ示しました。ですが、多くの詳細は、単純化したり無視していま" "す。もっと完全な光景を眺めたければ、どこに行けば良いでしょうか?" -#: ../../whatsnew/2.2.rst:399 msgid "" "The :ref:`descriptorhowto` is a lengthy tutorial introduction to the " "descriptor features, written by Guido van Rossum. If my description has " "whetted your appetite, go read this tutorial next, because it goes into much " "more detail about the new features while still remaining quite easy to read." msgstr "" +":ref:`descriptorhowto` は、Guido van Rossum が書いたデスクリプタ機能の詳しい" +"入門チュートリアルです。\n" +"ここでの説明で興味を持ったなら、次にこのチュートリアルを読んでください。\n" +"読みやすさを保ちながら、新機能をはるかに詳しく説明しています。" #: ../../whatsnew/2.2.rst:404 msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " "API. :pep:`253` is titled \"Subtyping Built-in Types\", and describes the " -"changes to type objects that make it possible to subtype built-in objects. :" -"pep:`253` is the more complicated PEP of the two, and at a few points the " -"necessary explanations of types and meta-types may cause your head to " -"explode. Both PEPs were written and implemented by Guido van Rossum, with " -"substantial assistance from the rest of the Zope Corp. team." +"changes to type objects that make it possible to subtype built-in " +"objects. :pep:`253` is the more complicated PEP of the two, and at a few " +"points the necessary explanations of types and meta-types may cause your " +"head to explode. Both PEPs were written and implemented by Guido van " +"Rossum, with substantial assistance from the rest of the Zope Corp. team." msgstr "" "次です。2 つの関連する PEP、 :pep:`252`, :pep:`253` があります。 :pep:`252` " "は \"型をもっとクラスに似せる(Making Types Look More Like Classes)\" というタ" "イトルで、デスクリプタ API についてカバーしています。 :pep:`253` は \"組み込" "み型のサブタイプ化(Subtyping Built-in Types)\" というタイトルで、組み込み型の" -"サブタイプを可能とするための型オブジェクトの変更について記述しています。 :" -"pep:`253` は 252 よりも複雑な PEP で、型とメタ型で必要な説明のいくつかのポイ" -"ントでは、あなたの脳味噌は爆発するかもしれないです。どちらの PEP も、著・実装" -"ともに、Zope Corp. チームの残りのメンバーからのかなりの支援を受けて、Guido " -"van Rossum によって書かれました。" +"サブタイプを可能とするための型オブジェクトの変更について記述していま" +"す。 :pep:`253` は 252 よりも複雑な PEP で、型とメタ型で必要な説明のいくつか" +"のポイントでは、あなたの脳味噌は爆発するかもしれないです。どちらの PEP も、" +"著・実装ともに、Zope Corp. チームの残りのメンバーからのかなりの支援を受けて、" +"Guido van Rossum によって書かれました。" #: ../../whatsnew/2.2.rst:413 msgid "" @@ -746,20 +916,21 @@ msgstr "" "インターフェイスです。オブジェクトが呼び出し元からどのように反復されるのか定" "義出来ます。" -#: ../../whatsnew/2.2.rst:427 msgid "" "In Python versions up to 2.1, the usual way to make ``for item in obj`` work " "is to define a :meth:`~object.__getitem__` method that looks something like " "this::" msgstr "" +"Python 2.1 以前では、``for item in obj`` を動作させる一般的な方法は、次のよう" +"な :meth:`~object.__getitem__` メソッドを定義することでした。 ::" -#: ../../whatsnew/2.2.rst:430 msgid "" "def __getitem__(self, index):\n" " return " msgstr "" +"def __getitem__(self, index):\n" +" return " -#: ../../whatsnew/2.2.rst:433 msgid "" ":meth:`~object.__getitem__` is more properly used to define an indexing " "operation on an object so that you can write ``obj[5]`` to retrieve the " @@ -772,28 +943,54 @@ msgid "" "using ``file[5]`` to randomly access the sixth element will work, though it " "really should." msgstr "" +":meth:`~object.__getitem__` の本来の用途は、``obj[5]`` と書いて 6 番目の要素" +"を取得できるよう、オブジェクトのインデックス操作を定義することです。\n" +"これを :keyword:`for` ループに対応するためだけに使うと、少し誤解を招きま" +"す。\n" +"ループで走査できるようにしたいファイル風オブジェクトを考えてみてください。\n" +"そのクラスはおそらく、*index* が毎回 1 ずつ増える一連" +"の :meth:`~object.__getitem__` 呼び出しを想定しているので、*index* パラメー" +"ターに実質的な意味はありません。\n" +"つまり :meth:`~object.__getitem__` メソッドがあっても、``file[5]`` で 6 番目" +"の要素にランダムアクセスできるとは限りませんが、本来はできるはずなのです。" + +msgid "" +"In Python 2.2, iteration can be implemented separately, " +"and :meth:`~object.__getitem__` methods can be limited to classes that " +"really do support random access. The basic idea of iterators is simple. A " +"new built-in function, ``iter(obj)`` or ``iter(C, sentinel)``, is used to " +"get an iterator. ``iter(obj)`` returns an iterator for the object *obj*, " +"while ``iter(C, sentinel)`` returns an iterator that will invoke the " +"callable object *C* until it returns *sentinel* to signal that the iterator " +"is done." +msgstr "" +"Python 2.2 では反復処理を独立して実装でき、:meth:`~object.__getitem__` メソッ" +"ドを本当にランダムアクセスに対応するクラスだけに限定できます。\n" +"イテレータの基本的な考え方は単純です。\n" +"新しい組み込み関数 ``iter(obj)`` または ``iter(C, sentinel)`` でイテレータを" +"取得します。\n" +"``iter(obj)`` はオブジェクト *obj* のイテレータを返します。\n" +"一方 ``iter(C, sentinel)`` は、呼び出し可能オブジェクト *C* を繰り返し呼び出" +"し、終了を示す *sentinel* が返されたら反復を終えるイテレータを返します。" -#: ../../whatsnew/2.2.rst:443 -msgid "" -"In Python 2.2, iteration can be implemented separately, and :meth:`~object." -"__getitem__` methods can be limited to classes that really do support random " -"access. The basic idea of iterators is simple. A new built-in function, " -"``iter(obj)`` or ``iter(C, sentinel)``, is used to get an iterator. " -"``iter(obj)`` returns an iterator for the object *obj*, while ``iter(C, " -"sentinel)`` returns an iterator that will invoke the callable object *C* " -"until it returns *sentinel* to signal that the iterator is done." -msgstr "" - -#: ../../whatsnew/2.2.rst:451 msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " "this method can just return ``self``. In particular, iterators will usually " -"be their own iterators. Extension types implemented in C can implement a :c:" -"member:`~PyTypeObject.tp_iter` function in order to return an iterator, and " -"extension types that want to behave as iterators can define a :c:member:" -"`~PyTypeObject.tp_iternext` function." -msgstr "" +"be their own iterators. Extension types implemented in C can implement " +"a :c:member:`~PyTypeObject.tp_iter` function in order to return an iterator, " +"and extension types that want to behave as iterators can define " +"a :c:member:`~PyTypeObject.tp_iternext` function." +msgstr "" +"Python のクラスでは :meth:`!__iter__` メソッドを定義できます。\n" +"このメソッドは、そのオブジェクトの新しいイテレータを作成して返すものです。\n" +"オブジェクト自体が自身のイテレータなら、単に ``self`` を返しても構いませ" +"ん。\n" +"特にイテレータは通常、自分自身のイテレータになります。\n" +"C で実装された拡張型は :c:member:`~PyTypeObject.tp_iter` 関数を実装してイテ" +"レータを返せます。\n" +"また、イテレータとして振る舞う拡張型は :c:member:`~PyTypeObject.tp_iternext` " +"関数を定義できます。" #: ../../whatsnew/2.2.rst:458 msgid "" @@ -804,10 +1001,10 @@ msgid "" msgstr "" "それでは、結局のところイテレータは実際どんなでしょうか? これに必要なメソッド" "は一つ、 :meth:`next` です (---訳注: Python 3 で ``__next__`` に変更されてい" -"ます---)。これは引数を取らず、次の値を返します。返すべき値がなくなったら、 :" -"meth:`next` 呼び出しは :exc:`StopIteration` 例外を送出しなければなりません::" +"ます---)。これは引数を取らず、次の値を返します。返すべき値がなくなった" +"ら、 :meth:`next` 呼び出しは :exc:`StopIteration` 例外を送出しなければなりま" +"せん::" -#: ../../whatsnew/2.2.rst:463 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -825,20 +1022,41 @@ msgid "" "StopIteration\n" ">>>" msgstr "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> print i\n" +"\n" +">>> i.next()\n" +"1\n" +">>> i.next()\n" +"2\n" +">>> i.next()\n" +"3\n" +">>> i.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"StopIteration\n" +">>>" -#: ../../whatsnew/2.2.rst:479 msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " "backward compatibility and convenience, an iterator is automatically " -"constructed for sequences that don't implement :meth:`!__iter__` or a :c:" -"member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still " +"constructed for sequences that don't implement :meth:`!__iter__` or " +"a :c:member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still " "work. Wherever the Python interpreter loops over a sequence, it's been " "changed to use the iterator protocol. This means you can do things like " "this::" msgstr "" +"2.2 の Python の :keyword:`for` 文が要求するのは、もはやシーケンスではな" +"く、:func:`iter` がイテレータを返すようなオブジェクトです。\n" +"後方互換性と利便性のため、:meth:`!__iter__` " +"や :c:member:`~PyTypeObject.tp_iter` スロットを実装していないシーケンスにも自" +"動的にイテレータが作られ、``for i in [1,2,3]`` は引き続き動作します。\n" +"Python インタープリタがシーケンスをループで走査していた箇所は、すべてイテレー" +"タプロトコルを使うように変更されました。\n" +"これにより、次のようなことができます。 ::" -#: ../../whatsnew/2.2.rst:487 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -846,17 +1064,21 @@ msgid "" ">>> a,b,c\n" "(1, 2, 3)" msgstr "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> a,b,c = i\n" +">>> a,b,c\n" +"(1, 2, 3)" #: ../../whatsnew/2.2.rst:493 msgid "" -"Iterator support has been added to some of Python's basic types. Calling :" -"func:`iter` on a dictionary will return an iterator which loops over its " -"keys::" +"Iterator support has been added to some of Python's basic types. " +"Calling :func:`iter` on a dictionary will return an iterator which loops " +"over its keys::" msgstr "" "いくつかの Python の基礎型には既にイテレータのサポートが追加されています。辞" "書に対して :func:`iter` を呼び出すと、キーの反復をするイテレータが返ります::" -#: ../../whatsnew/2.2.rst:496 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" @@ -875,15 +1097,37 @@ msgid "" "Dec 12\n" "Oct 10" 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: print key, m[key]\n" +"...\n" +"Mar 3\n" +"Feb 2\n" +"Aug 8\n" +"Sep 9\n" +"May 5\n" +"Jun 6\n" +"Jul 7\n" +"Jan 1\n" +"Apr 4\n" +"Nov 11\n" +"Dec 12\n" +"Oct 10" -#: ../../whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " -"values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" -"meth:`!itervalues`, or :meth:`!iteritems` methods to get an appropriate " -"iterator. In a minor related change, the :keyword:`in` operator now works on " -"dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." -msgstr "" +"values, or key/value pairs, you can explicitly call the :meth:`!" +"iterkeys`, :meth:`!itervalues`, or :meth:`!iteritems` methods to get an " +"appropriate iterator. In a minor related change, the :keyword:`in` operator " +"now works on dictionaries, so ``key in dict`` is now equivalent to " +"``dict.has_key(key)``." +msgstr "" +"これはデフォルトの動作にすぎません。\n" +"キー、値、キーと値の組を反復処理したい場合は、:meth:`!iterkeys`、:meth:`!" +"itervalues`、:meth:`!iteritems` メソッドを明示的に呼び出して、対応するイテ" +"レーターを取得できます。\n" +"関連する小さな変更として、:keyword:`in` 演算子が辞書でも使えるようになり、" +"``key in dict`` は ``dict.has_key(key)`` と同じ意味になりました。" #: ../../whatsnew/2.2.rst:519 msgid "" @@ -895,12 +1139,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 "" @@ -950,24 +1196,26 @@ msgid "" "functions." msgstr "" "Python や C の標準的な関数コールについては、よくご存じに違いありません。関数" -"を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その関数が :" -"keyword:`return` 文まで来ると、ローカル変数が破壊されてから、返り値が呼び出し" -"元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベート名前空間に新規" -"のローカル変数が作られるのです。しかし、関数を出るときにローカル変数を捨てな" -"ければどうなるでしょうか。その出ていったところから関数を続行できたとしたら、" -"どうでしょう。これこそジェネレータが提供する機能です; すなわち、ジェネレータ" -"は続行できる関数と考えることができます。" +"を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その関数" +"が :keyword:`return` 文まで来ると、ローカル変数が破壊されてから、返り値が呼び" +"出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベート名前空間に" +"新規のローカル変数が作られるのです。しかし、関数を出るときにローカル変数を捨" +"てなければどうなるでしょうか。その出ていったところから関数を続行できたとした" +"ら、どうでしょう。これこそジェネレータが提供する機能です; すなわち、ジェネ" +"レータは続行できる関数と考えることができます。" #: ../../whatsnew/2.2.rst:557 msgid "Here's the simplest example of a generator function::" msgstr "ジェネレータ関数の最も単純な例です::" -#: ../../whatsnew/2.2.rst:559 msgid "" "def generate_ints(N):\n" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.2.rst:563 msgid "" @@ -979,8 +1227,8 @@ msgid "" "import generators`` statement near the top of the module's source code. In " "Python 2.3 this statement will become unnecessary." msgstr "" -"新しいキーワード :keyword:`yield` がジェネレータのために導入されました。 :" -"keyword:`!yield` ステートメントを含むどんな関数もジェネレータ関数です; " +"新しいキーワード :keyword:`yield` がジェネレータのために導入されまし" +"た。 :keyword:`!yield` ステートメントを含むどんな関数もジェネレータ関数です; " "Python バイトコードコンパイラはこれを検知し、関数が特別に扱われるように翻訳し" "ます。新たなキーワードの導入なので、ジェネレータを使えるようにするには " "``from __future__ import generators`` ステートメントをモジュールソースコード" @@ -997,33 +1245,32 @@ msgid "" "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " "and local variables are preserved. On the next call to the generator's " -"``next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`!try` block of a :keyword:" -"`try`...\\ :keyword:`finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"``next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`!try` block of " +"a :keyword:`try`...\\ :keyword:`finally` statement; read :pep:`255` for a " +"full 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::" msgstr "上記の :func:`!generate_ints` ジェネレータはこんな具合に使います::" -#: ../../whatsnew/2.2.rst:586 msgid "" ">>> gen = generate_ints(3)\n" ">>> gen\n" @@ -1040,6 +1287,20 @@ msgid "" " File \"\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +" File \"\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.2.rst:601 msgid "" @@ -1084,17 +1345,17 @@ msgid "" msgstr "" "自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタンス変" "数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整数のリス" -"トを返すのは、 ``self.count`` を 0 にして、 :meth:`next` メソッドが ``self." -"count`` をインクリメントして返すようにすればできます。しかしながら、ある程度" -"複雑なジェネレータになってくると、同じことをするクラスを書くのは格段にややこ" -"しいことになります。 :file:`Lib/test/test_generators.py` にはもっと面白い例が" -"たくさん含まれています。一番単純な一つは、ジェネレータを再帰的に使ってツリー" -"を順繰りに横断する実装をするこれです (---訳注: ジェネレータは現在の最新 3.5 " -"までの間に 2 度大きな機能強化が行われているのですが、一つが 2.5 での PEP 342 " -"でこれは yield 「に」値を戻せるようにするものです。もう一つが 3.3 での PEP " -"380 で、これはサブジェネレータへの委譲 ``yield from `` の追加でした。" -"ですのでこの 3.3 からの ``yield from`` を使うと下記例はもっとスッキリ書けま" -"す。---)::" +"トを返すのは、 ``self.count`` を 0 にして、 :meth:`next` メソッドが " +"``self.count`` をインクリメントして返すようにすればできます。しかしながら、あ" +"る程度複雑なジェネレータになってくると、同じことをするクラスを書くのは格段に" +"ややこしいことになります。 :file:`Lib/test/test_generators.py` にはもっと面白" +"い例がたくさん含まれています。一番単純な一つは、ジェネレータを再帰的に使って" +"ツリーを順繰りに横断する実装をするこれです (---訳注: ジェネレータは現在の最" +"新 3.5 までの間に 2 度大きな機能強化が行われているのですが、一つが 2.5 での " +"PEP 342 でこれは yield 「に」値を戻せるようにするものです。もう一つが 3.3 で" +"の PEP 380 で、これはサブジェネレータへの委譲 ``yield from `` の追加" +"でした。ですのでこの 3.3 からの ``yield from`` を使うと下記例はもっとスッキリ" +"書けます。---)::" #: ../../whatsnew/2.2.rst:621 msgid "" @@ -1130,17 +1391,18 @@ msgid "" "Language\" at https://www2.cs.arizona.edu/icon/docs/ipd266.htm gives an idea " "of what this looks like::" msgstr "" -"ジェネレータの発想はほかのプログラミング言語、特に Icon (https://www2.cs." -"arizona.edu/icon/) から着想しています。Icon ではジェネレータが言語の中枢に" -"なっています。Icon では、あらゆる式と関数がジェネレータのように振舞います。 " -"https://www2.cs.arizona.edu/icon/docs/ipd266.htm の \"Icon プログラミング言語" -"の概要\" の一つの例が、これがどのようなものであるのかを教えてくれます::" +"ジェネレータの発想はほかのプログラミング言語、特に Icon (https://" +"www2.cs.arizona.edu/icon/) から着想しています。Icon ではジェネレータが言語の" +"中枢になっています。Icon では、あらゆる式と関数がジェネレータのように振舞いま" +"す。 https://www2.cs.arizona.edu/icon/docs/ipd266.htm の \"Icon プログラミン" +"グ言語の概要\" の一つの例が、これがどのようなものであるのかを教えてくれます::" -#: ../../whatsnew/2.2.rst:642 msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" +"sentence := \"Store it in the neighboring harbor\"\n" +"if (i := find(\"or\", sentence)) > 5 then write(i)" #: ../../whatsnew/2.2.rst:645 msgid "" @@ -1195,7 +1457,6 @@ msgstr "" msgid "PEP 237: Unifying Long Integers and Integers" msgstr "PEP 237: 長整数と整数を一体化していく" -#: ../../whatsnew/2.2.rst:672 msgid "" "In recent versions, the distinction between regular integers, which are 32-" "bit values on most machines, and long integers, which can be of arbitrary " @@ -1207,6 +1468,15 @@ msgid "" "be used as a slice index, and ``'abc'[1L:]`` would raise a :exc:`TypeError` " "exception with the message 'slice index must be int'." msgstr "" +"最近のバージョンでは、ほとんどのマシンで 32 ビットの値を扱う通常の整数と、任" +"意の大きさの値を扱える長整数との区別が厄介になっていました。\n" +"例えば ``2**32`` バイトを超えるファイルを扱えるプラットフォームでは、ファイル" +"オブジェクトの :meth:`!tell` メソッドは長整数を返す必要があります。\n" +"ところが Python の各所には通常の整数を想定し、長整数を渡すとエラーになる部分" +"がありました。\n" +"例えば Python 1.5 では、スライスのインデックスには通常の整数しか使えず、" +"``'abc'[1L:]`` は「slice index must be int」というメッセージ" +"の :exc:`TypeError` 例外を送出しました。" #: ../../whatsnew/2.2.rst:682 msgid "" @@ -1225,17 +1495,20 @@ msgstr "" "3 で 'L' が廃止されて、付けると構文エラーになるようになったのは事実です。です" "が少なくとも Python 2.7 では :option:`!-3` でも :option:`!-Qwarnall` でも警告" "とならないので注意してください。Python 2 系を使っていて Python 3 との互換性を" -"持ちたいならば、 2.2 以降では 'L' は付けるべきではありません。 --- ) かつて :" -"exc:`OverflowError` となっていたような多くの演算が、今ではその結果として長整" -"数を返します。例えば::" +"持ちたいならば、 2.2 以降では 'L' は付けるべきではありません。 --- ) かつ" +"て :exc:`OverflowError` となっていたような多くの演算が、今ではその結果として" +"長整数を返します。例えば::" -#: ../../whatsnew/2.2.rst:690 msgid "" ">>> 1234567890123\n" "1234567890123L\n" ">>> 2 ** 64\n" "18446744073709551616L" msgstr "" +">>> 1234567890123\n" +"1234567890123L\n" +">>> 2 ** 64\n" +"18446744073709551616L" #: ../../whatsnew/2.2.rst:695 msgid "" @@ -1243,11 +1516,11 @@ msgid "" "You can still distinguish them with the :func:`type` built-in function, but " "that's rarely needed." msgstr "" -"ほとんどのケースで、今や整数と長整数は同じものとして扱われるでしょう。 :func:" -"`type` ビルトインで今でも区別出来ますが、ほとんど必要ないでしょう (--- 訳注: " -"Python 3 では本当にこの2つの区別がなくなったので、当然区別出来ません。Python " -"3 系への移行を考えている Python 2 コードは、両者の区別に頼らないようにするべ" -"きです。 ---)。" +"ほとんどのケースで、今や整数と長整数は同じものとして扱われるでしょ" +"う。 :func:`type` ビルトインで今でも区別出来ますが、ほとんど必要ないでしょう " +"(--- 訳注: Python 3 では本当にこの2つの区別がなくなったので、当然区別出来ませ" +"ん。Python 3 系への移行を考えている Python 2 コードは、両者の区別に頼らないよ" +"うにするべきです。 ---)。" #: ../../whatsnew/2.2.rst:702 msgid ":pep:`237` - Unifying Long Integers and Integers" @@ -1294,11 +1567,11 @@ msgid "" msgstr "" "(議論の的となるのはこれが *本当の* 設計の欠陥なのかどうかと、果たしてこれを修" "正することで既存のコードを破壊する価値はあるのかどうかです。それは python-" -"dev での終わりのない議論を巻き起こし、2001 年 7 月には :newsgroup:`comp.lang." -"python` への辛辣な投稿の嵐に突入しました。私はここではどちらかの側に立って説" -"きつけるつもりはなく、Python 2.2 で何が実現したのかを記述することだけに専念し" -"ます。:pep:`238` にはその主張と反対意見の要約が書かれていますので、そちらをお" -"読みください。)" +"dev での終わりのない議論を巻き起こし、2001 年 7 月に" +"は :newsgroup:`comp.lang.python` への辛辣な投稿の嵐に突入しました。私はここで" +"はどちらかの側に立って説きつけるつもりはなく、Python 2.2 で何が実現したのかを" +"記述することだけに専念します。:pep:`238` にはその主張と反対意見の要約が書かれ" +"ていますので、そちらをお読みください。)" #: ../../whatsnew/2.2.rst:729 msgid "" @@ -1369,22 +1642,26 @@ msgstr "" "(classic division) のままです。 ``/`` が持つデフォルトの意味は Python 3.0 に" "なるまで変更されません。" -#: ../../whatsnew/2.2.rst:756 msgid "" -"Classes can define methods called :meth:`~object.__truediv__` and :meth:" -"`~object.__floordiv__` to overload the two division operators. At the C " -"level, there are also slots in the :c:type:`PyNumberMethods` structure so " -"extension types can define the two operators." +"Classes can define methods called :meth:`~object.__truediv__` " +"and :meth:`~object.__floordiv__` to overload the two division operators. At " +"the C level, there are also slots in the :c:type:`PyNumberMethods` structure " +"so extension types can define the two operators." msgstr "" +"クラスは :meth:`~object.__truediv__` と :meth:`~object.__floordiv__` というメ" +"ソッドを定義して、2 種類の除算演算子をオーバーロードできます。\n" +"C レベルでも :c:type:`PyNumberMethods` 構造体にスロットがあり、拡張型でこれら" +"の演算子を定義できます。" #: ../../whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " -"will work with the changed division semantics. Running python with :option:" -"`!-Q warn` will cause a warning to be issued whenever division is applied to " -"two integers. You can use this to find code that's affected by the change " -"and fix it. By default, Python 2.2 will simply perform classic division " -"without a warning; the warning will be turned on by default in Python 2.3." +"will work with the changed division semantics. Running python " +"with :option:`!-Q warn` will cause a warning to be issued whenever division " +"is applied to two integers. You can use this to find code that's affected " +"by the change and fix it. By default, Python 2.2 will simply perform " +"classic division without a warning; the warning will be turned on by default " +"in Python 2.3." msgstr "" "Python 2.2 は、コードが変更後の除算セマンティクスで動作するかどうかをテストす" "るコマンドライン引数をサポートします。 :option:`!-Q warn` で python を実行す" @@ -1434,7 +1711,6 @@ msgid "" "characters\"; consult it for further details." msgstr "" -#: ../../whatsnew/2.2.rst:795 msgid "" "Another change is simpler to explain. Since their introduction, Unicode " "strings have supported an :meth:`!encode` method to convert the string to a " @@ -1444,6 +1720,13 @@ msgid "" "the specified encoding and decodes it, returning whatever is returned by the " "codec." msgstr "" +"もう一つの変更は簡単に説明できます。\n" +"Unicode 文字列は導入当初から、UTF-8 や Latin-1 など指定したエンコーディングに" +"変換する :meth:`!encode` メソッドをサポートしていました。\n" +"2.2 では、これと対になる ``decode([*encoding*])`` メソッドが 8 ビット文字列に" +"追加されました (Unicode 文字列には追加されていません)。\n" +":meth:`!decode` は文字列が指定したエンコーディングであると仮定してデコード" +"し、コーデックが返す値をそのまま返します。" #: ../../whatsnew/2.2.rst:802 msgid "" @@ -1456,7 +1739,6 @@ msgstr "" "ンコーディング、 :mod:`zlib` モジュールでの圧縮のためのエンコーディングが追加" "されています::" -#: ../../whatsnew/2.2.rst:806 msgid "" ">>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n" "... and repetitive text.\n" @@ -1476,19 +1758,40 @@ msgid "" ">>> \"sheesh\".encode('rot-13')\n" "'furrfu'" msgstr "" +">>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n" +"... and repetitive text.\n" +"... \"\"\"\n" +">>> data = s.encode('zlib')\n" +">>> data\n" +"'x\\x9c\\r\\xc9\\xc1\\r\\x80 \\x10\\x04\\xc0?Ul...'\n" +">>> data.decode('zlib')\n" +"'Here is a lengthy piece of redundant, overly verbose,\\nand repetitive text." +"\\n'\n" +">>> print s.encode('uu')\n" +"begin 666 \n" +"M2&5R92!I=F5R8F]S92P*86YD(')E<&5T:71I=F4@=&5X=\"X*\n" +"\n" +"end\n" +">>> \"sheesh\".encode('rot-13')\n" +"'furrfu'" -#: ../../whatsnew/2.2.rst:823 msgid "" "To convert a class instance to Unicode, a :meth:`!__unicode__` method can be " "defined by a class, analogous to :meth:`!__str__`." msgstr "" +"クラスのインスタンスを Unicode に変換するために、クラスで :meth:`!__str__` に" +"相当する :meth:`!__unicode__` メソッドを定義できます。" -#: ../../whatsnew/2.2.rst:826 msgid "" ":meth:`!encode`, :meth:`!decode`, and :meth:`!__unicode__` were implemented " "by Marc-André Lemburg. The changes to support using UCS-4 internally were " "implemented by Fredrik Lundh and Martin von Löwis." msgstr "" +":meth:`!encode`、:meth:`!decode`、:meth:`!__unicode__` は Marc-André Lemburg " +"が実装しました。\n" +"内部で UCS-4 を使えるようにする変更は Fredrik Lundh と Martin von Löwis が実" +"装しました。" #: ../../whatsnew/2.2.rst:833 msgid ":pep:`261` - Support for 'wide' Unicode characters" @@ -1537,7 +1840,6 @@ msgstr "" "われませんでした。このことは直感的な期待と一致せずしばしば人々を驚かせまし" "た。例えば、入れ子になった再帰関数の定義は動きません::" -#: ../../whatsnew/2.2.rst:856 msgid "" "def f():\n" " ...\n" @@ -1546,8 +1848,13 @@ msgid "" " return g(value-1) + 1\n" " ..." msgstr "" +"def f():\n" +" ...\n" +" def g(value):\n" +" ...\n" +" return g(value-1) + 1\n" +" ..." -#: ../../whatsnew/2.2.rst:863 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " "because the binding of the name ``g`` isn't in either its local namespace or " @@ -1558,8 +1865,15 @@ msgid "" "find local variables being copied by passing them as the default values of " "arguments. ::" msgstr "" +"名前 ``g`` の束縛がローカル名前空間にもモジュールレベルの名前空間にもないた" +"め、関数 :func:`!g` は常に :exc:`NameError` 例外を送出します。\n" +"これは実際には大きな問題ではありません (このような内部関数を再帰的に定義する" +"ことは、そう多くないでしょう)。\n" +"しかし、:keyword:`lambda` 式を使いにくくするという実用上の問題もありまし" +"た。\n" +":keyword:`!lambda` を使うコードでは、引数のデフォルト値として渡すことでローカ" +"ル変数をコピーしている例がよく見られます。 ::" -#: ../../whatsnew/2.2.rst:871 msgid "" "def find(self, name):\n" " \"Return list of any entries equal to 'name'\"\n" @@ -1567,6 +1881,11 @@ msgid "" " self.list_attribute)\n" " return L" msgstr "" +"def find(self, name):\n" +" \"name と等しい項目のリストを返す\"\n" +" L = filter(lambda x, name=name: x == name,\n" +" self.list_attribute)\n" +" return L" #: ../../whatsnew/2.2.rst:877 msgid "" @@ -1582,10 +1901,11 @@ msgid "" "added to the language to fix this problem. As a first effect, the " "``name=name`` default argument is now unnecessary in the above example. Put " "simply, when a given variable name is not assigned a value within a function " -"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:" -"`import` statements), references to the variable will be looked up in the " -"local namespace of the enclosing scope. A more detailed explanation of the " -"rules, and a dissection of the implementation, can be found in the PEP." +"(by an assignment, or the :keyword:`def`, :keyword:`class`, " +"or :keyword:`import` statements), references to the variable will be looked " +"up in the local namespace of the enclosing scope. A more detailed " +"explanation of the rules, and a dissection of the implementation, can be " +"found in the PEP." msgstr "" "Python 2.2 の最も重要な変更点は、この問題を解決するために静的なスコープが追加" "されたことです。最初の効果として、 ``name=name`` という例ではデフォルトの引数" @@ -1631,15 +1951,14 @@ msgstr "" "数にアクセスするために別のコードを生成する必要があります。 ``from module " "import *``, ``exec`` はコンパイラにこれを理解することを不可能にしてしまいま" "す。なぜならそれらはコンパイル時にはわからないローカル名前空間に名前を追加す" -"るからです。それゆえ、もし関数が関数定義を含んだり自由な変数に :keyword:" -"`lambda` の語句を含んだりする場合、コンパイラは :exc:`SyntaxError` 例外を上げ" -"て知らせます。" +"るからです。それゆえ、もし関数が関数定義を含んだり自由な変数" +"に :keyword:`lambda` の語句を含んだりする場合、コンパイラ" +"は :exc:`SyntaxError` 例外を上げて知らせます。" #: ../../whatsnew/2.2.rst:908 msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "前述した説明を少し明確にするため、例を挙げます::" -#: ../../whatsnew/2.2.rst:910 msgid "" "x = 1\n" "def f():\n" @@ -1648,13 +1967,21 @@ msgid "" " def g():\n" " return x" msgstr "" +"x = 1\n" +"def f():\n" +" # 次の行は構文エラー\n" +" exec 'x=2'\n" +" def g():\n" +" return x" -#: ../../whatsnew/2.2.rst:917 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " "would define a new local variable named ``x`` whose value should be accessed " "by :func:`!g`." msgstr "" +"``exec`` 文を含む 4 行目は構文エラーです。\n" +"``exec`` が ``x`` という新しいローカル変数を定義し、:func:`!g` がその値にアク" +"セスするはずだからです。" #: ../../whatsnew/2.2.rst:921 msgid "" @@ -1677,7 +2004,6 @@ msgstr "Jeremy Hylton著、実装" msgid "New and Improved Modules" msgstr "新しいモジュールと改良されたモジュール" -#: ../../whatsnew/2.2.rst:937 msgid "" "The :mod:`xmlrpclib ` module was contributed to the standard " "library by Fredrik Lundh, providing support for writing XML-RPC clients. " @@ -1686,8 +2012,14 @@ msgid "" "from the O'Reilly Network, and then lists the recent headlines for one " "channel::" msgstr "" +"Fredrik Lundh の貢献により :mod:`xmlrpclib ` モジュールが標準" +"ライブラリに追加され、XML-RPC クライアントの作成をサポートするようになりまし" +"た。\n" +"XML-RPC は HTTP と XML の上に構築された単純な遠隔手続き呼び出しプロトコルで" +"す。\n" +"例えば、次のコードは O'Reilly Network から RSS チャンネルの一覧を取得し、一つ" +"のチャンネルの最新の見出しを列挙します。 ::" -#: ../../whatsnew/2.2.rst:943 msgid "" "import xmlrpclib\n" "s = xmlrpclib.Server(\n" @@ -1706,18 +2038,36 @@ msgid "" "# 'description': 'A utility which converts HTML to XSL FO.',\n" "# 'title': 'html2fo 0.3 (Default)'}, ... ]" msgstr "" +"import xmlrpclib\n" +"s = xmlrpclib.Server(\n" +" 'http://www.oreillynet.com/meerkat/xml-rpc/server.php')\n" +"channels = s.meerkat.getChannels()\n" +"# channels は次のような辞書のリスト:\n" +"# [{'id': 4, 'title': 'Freshmeat Daily News'}\n" +"# {'id': 190, 'title': '32Bits Online'},\n" +"# {'id': 4549, 'title': '3DGamers'}, ... ]\n" +"\n" +"# 一つのチャンネルの項目を取得\n" +"items = s.meerkat.getItems( {'channel': 4} )\n" +"\n" +"# items も次のような辞書のリスト:\n" +"# [{'link': 'http://freshmeat.net/releases/52719/',\n" +"# 'description': 'A utility which converts HTML to XSL FO.',\n" +"# 'title': 'html2fo 0.3 (Default)'}, ... ]" -#: ../../whatsnew/2.2.rst:960 msgid "" "The :mod:`SimpleXMLRPCServer ` module makes it easy to create " "straightforward XML-RPC servers. See http://xmlrpc.scripting.com/ for more " "information about XML-RPC." msgstr "" +":mod:`SimpleXMLRPCServer ` モジュールを使うと、単純な XML-RPC " +"サーバーを簡単に作成できます。\n" +"XML-RPC について詳しくは http://xmlrpc.scripting.com/ を参照してください。" #: ../../whatsnew/2.2.rst:963 msgid "" -"The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" -"`2104`. (Contributed by Gerhard Häring.)" +"The new :mod:`hmac` module implements the HMAC algorithm described " +"by :rfc:`2104`. (Contributed by Gerhard Häring.)" msgstr "" "新しい :mod:`hmac` モジュールは、 :rfc:`2104` で記述される HMAC アルゴリズム" "を実装します 。 (Contributed by Gerhard Häring.)" @@ -1727,18 +2077,19 @@ msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " "such as :attr:`!memberst_mtime` or :attr:`~time.struct_time.tm_year`. The " -"enhanced functions include :func:`~os.stat`, :func:`~os.fstat`, :func:`~os." -"statvfs`, and :func:`~os.fstatvfs` in the :mod:`os` module, and :func:`~time." -"localtime`, :func:`~time.gmtime`, and :func:`~time.strptime` in the :mod:" -"`time` module." +"enhanced functions " +"include :func:`~os.stat`, :func:`~os.fstat`, :func:`~os.statvfs`, " +"and :func:`~os.fstatvfs` in the :mod:`os` module, " +"and :func:`~time.localtime`, :func:`~time.gmtime`, " +"and :func:`~time.strptime` in the :mod:`time` module." msgstr "" #: ../../whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " -"now this can be written more clearly as ``file_size = os.stat(filename)." -"st_size``." +"now this can be written more clearly as ``file_size = " +"os.stat(filename).st_size``." msgstr "" "例えば旧式のタプルでファイルサイズを得るには ``file_size = os.stat(filename)" "[stat.ST_SIZE]`` のように書くしかありませんでしたが、今ではもっとわかりやす" @@ -1759,31 +2110,35 @@ msgstr "" #: ../../whatsnew/2.2.rst:982 msgid "" -"The :mod:`socket` module can be compiled to support IPv6; specify the :" -"option:`!--enable-ipv6` option to Python's configure script. (Contributed " -"by Jun-ichiro \"itojun\" Hagino.)" +"The :mod:`socket` module can be compiled to support IPv6; specify " +"the :option:`!--enable-ipv6` option to Python's configure script. " +"(Contributed by Jun-ichiro \"itojun\" Hagino.)" msgstr "" ":mod:`socket` モジュールを IPv6 サポート付きでコンパイル可能になりました。" "Python の :program:`configure` スクリプトに :option:`!--enable-ipv6` オプショ" "ンを与えてください。(Contributed by Jun-ichiro \"itojun\" Hagino.)" -#: ../../whatsnew/2.2.rst:986 msgid "" "Two new format characters were added to the :mod:`struct` module for 64-bit " "integers on platforms that support the C :c:expr:`long long` type. ``q`` is " "for a signed 64-bit integer, and ``Q`` is for an unsigned one. The value is " "returned in Python's long integer type. (Contributed by Tim Peters.)" msgstr "" +"C の :c:expr:`long long` 型をサポートするプラットフォーム向けに、64 ビット整" +"数を扱う 2 つの書式文字が :mod:`struct` モジュールに追加されました。\n" +"``q`` は符号付き、``Q`` は符号なしの 64 ビット整数を表します。\n" +"値は Python の長整数型として返されます。\n" +"(Tim Peters が貢献しました。)" #: ../../whatsnew/2.2.rst:991 msgid "" -"In the interpreter's interactive mode, there's a new built-in function :func:" -"`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " -"interactive help. ``help(object)`` displays any available help text about " -"*object*. :func:`help` with no argument puts you in an online help utility, " -"where you can enter the names of functions, classes, or modules to read " -"their help text. (Contributed by Guido van Rossum, using Ka-Ping Yee's :mod:" -"`pydoc` module.)" +"In the interpreter's interactive mode, there's a new built-in " +"function :func:`help` that uses the :mod:`pydoc` module introduced in Python " +"2.1 to provide interactive help. ``help(object)`` displays any available " +"help text about *object*. :func:`help` with no argument puts you in an " +"online help utility, where you can enter the names of functions, classes, or " +"modules to read their help text. (Contributed by Guido van Rossum, using Ka-" +"Ping Yee's :mod:`pydoc` module.)" msgstr "" "インタプリタの対話モードに新たに :func:`help` ビルトインが追加されています。" "これは Python 2.1 で導入された :mod:`pydoc` モジュールを用いて対話的なヘルプ" @@ -1793,7 +2148,6 @@ msgstr "" "れらのヘルプテキストを読むことが出来ます。 (Contributed by Guido van Rossum, " "using Ka-Ping Yee's :mod:`pydoc` module.)" -#: ../../whatsnew/2.2.rst:999 msgid "" "Various bugfixes and performance improvements have been made to the SRE " "engine underlying the :mod:`re` module. For example, the :func:`re.sub` " @@ -1803,6 +2157,15 @@ msgid "" "all the non-overlapping matches in a given string. (SRE is maintained by " "Fredrik Lundh. The BIGCHARSET patch was contributed by Martin von Löwis.)" msgstr "" +":mod:`re` モジュールの基盤となる SRE エンジンに、さまざまなバグ修正と性能改善" +"が行われました。\n" +"例えば :func:`re.sub` 関数と :func:`re.split` 関数は C で書き直されました。\n" +"また、あるパッチによって一部の Unicode 文字範囲の処理速度が 2 倍になりまし" +"た。\n" +"新しい :meth:`~re.finditer` メソッドは、指定した文字列で重複しないすべての" +"マッチを反復するイテレータを返します。\n" +"(SRE の保守担当は Fredrik Lundh です。BIGCHARSET パッチは Martin von Löwis が" +"提供しました。)" #: ../../whatsnew/2.2.rst:1007 msgid "" @@ -1813,8 +2176,9 @@ msgid "" msgstr "" ":mod:`smtplib` モジュールに :rfc:`2487` 「Secure SMTP over TLS」のサポートが" "追加されました。これにより Python プログラムとメール転送エージェント間での" -"メッセージの暗号化された SMTP トラフィックが可能になりました。 :mod:" -"`smtplib` は SMTP 認証もサポートしています。 (Contributed by Gerhard Häring.)" +"メッセージの暗号化された SMTP トラフィックが可能になりまし" +"た。 :mod:`smtplib` は SMTP 認証もサポートしています。 (Contributed by " +"Gerhard Häring.)" #: ../../whatsnew/2.2.rst:1012 msgid "" @@ -1827,7 +2191,6 @@ msgstr "" "張のサポートが追加されました: :rfc:`2342` で定義されている NAMESPACE 拡張、 " "SORT、 GETACL、 SETACL。(Contributed by Anthony Baxter and Michel Pelletier.)" -#: ../../whatsnew/2.2.rst:1016 msgid "" "The :mod:`!rfc822` module's parsing of email addresses is now compliant " "with :rfc:`2822`, an update to :rfc:`822`. (The module's name is *not* " @@ -1835,8 +2198,13 @@ msgid "" "been added for parsing and generating e-mail messages. (Contributed by " "Barry Warsaw, and arising out of his work on Mailman.)" msgstr "" +":mod:`!rfc822` モジュールのメールアドレスの解析が、:rfc:`822` を更新し" +"た :rfc:`2822` に準拠するようになりました。\n" +"(モジュール名を ``rfc2822`` に変更する予定は *ありません*。)\n" +"電子メールメッセージを解析・生成する新しいパッケージ :mod:`email` も追加され" +"ました。\n" +"(Barry Warsaw による Mailman の開発から生まれた貢献です。)" -#: ../../whatsnew/2.2.rst:1022 msgid "" "The :mod:`difflib` module now contains a new :class:`!Differ` class for " "producing human-readable lists of changes (a \"delta\") between two " @@ -1846,32 +2214,53 @@ msgid "" "contributed by David Goodger, from ndiff.py code by Tim Peters who then did " "the generatorization.)" msgstr "" +":mod:`difflib` モジュールに、2 つのテキスト行のシーケンスの間の変更点 (「差" +"分」) を読みやすいリストにする、新しい :class:`!Differ` クラスが加わりまし" +"た。\n" +"また、ジェネレータ関数 :func:`!ndiff` と :func:`!restore` も加わりました。\n" +"前者は 2 つのシーケンスから差分を返し、後者は差分から元のシーケンスの一方を返" +"します。\n" +"(Tim Peters の ndiff.py をもとに David Goodger が主要な作業を行い、その後 " +"Tim Peters がジェネレータ化しました。)" + +msgid "" +"New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, " +"and :const:`!ascii_uppercase` were added to the :mod:`string` module. There " +"were several modules in the standard library that used :const:`!" +"string.letters` to mean the ranges A-Za-z, but that assumption is incorrect " +"when locales are in use, because :const:`!string.letters` varies depending " +"on the set of legal characters defined by the current locale. The buggy " +"modules have all been fixed to use :const:`!ascii_letters` instead. " +"(Reported by an unknown person; fixed by Fred L. Drake, Jr.)" +msgstr "" +":mod:`string` モジュールに、新しい定数 :const:`!ascii_letters`、:const:`!" +"ascii_lowercase`、:const:`!ascii_uppercase` が加わりました。\n" +"標準ライブラリのいくつかのモジュールは、:const:`!string.letters` を A-Za-z の" +"範囲という意味で使っていました。\n" +"しかし :const:`!string.letters` は現在のロケールが定義する有効な文字の集合に" +"応じて変わるため、ロケールの使用時にはその想定は誤りです。\n" +"これらのバグのあるモジュールはすべて、代わりに :const:`!ascii_letters` を使う" +"よう修正されました。\n" +"(報告者は不明、修正は Fred L. Drake, Jr. によるものです。)" -#: ../../whatsnew/2.2.rst:1029 -msgid "" -"New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" -"`!ascii_uppercase` were added to the :mod:`string` module. There were " -"several modules in the standard library that used :const:`!string.letters` " -"to mean the ranges A-Za-z, but that assumption is incorrect when locales are " -"in use, because :const:`!string.letters` varies depending on the set of " -"legal characters defined by the current locale. The buggy modules have all " -"been fixed to use :const:`!ascii_letters` instead. (Reported by an unknown " -"person; fixed by Fred L. Drake, Jr.)" -msgstr "" - -#: ../../whatsnew/2.2.rst:1038 msgid "" "The :mod:`mimetypes` module now makes it easier to use alternative MIME-type " "databases by the addition of a :class:`~mimetypes.MimeTypes` class, which " "takes a list of filenames to be parsed. (Contributed by Fred L. Drake, Jr.)" msgstr "" +":mod:`mimetypes` モジュールに、解析するファイル名のリストを受け取" +"る :class:`~mimetypes.MimeTypes` クラスが追加され、別の MIME 型データベースを" +"使いやすくなりました。\n" +"(Fred L. Drake, Jr. が貢献しました。)" -#: ../../whatsnew/2.2.rst:1042 msgid "" "A :class:`~threading.Timer` class was added to the :mod:`threading` module " "that allows scheduling an activity to happen at some future time. " "(Contributed by Itamar Shtull-Trauring.)" msgstr "" +":mod:`threading` モジュールに :class:`~threading.Timer` クラスが追加され、後" +"の時刻に処理を実行するようスケジュールできるようになりました。\n" +"(Itamar Shtull-Trauring が貢献しました。)" #: ../../whatsnew/2.2.rst:1050 msgid "Interpreter Changes and Fixes" @@ -1903,22 +2292,28 @@ msgid "" msgstr "" "プロファイルとトレースの関数が C で実装されました。Python ベースのものと比較" "して圧倒的に高速に操作出来、プロファイルとトレースのオーバヘッドを削減するは" -"ずです。これは Python の開発環境の著者に朗報でしょう。2 つの C 関数、 :c:" -"func:`PyEval_SetProfile` と :c:func:`PyEval_SetTrace` が Python API に追加さ" -"れました。既存の :func:`sys.setprofile` 関数、 :func:`sys.settrace` 関数はそ" -"のまま存在し、単純に新規 C レベル関数を使うように修正されました。 " +"ずです。これは Python の開発環境の著者に朗報でしょう。2 つの C 関" +"数、 :c:func:`PyEval_SetProfile` と :c:func:`PyEval_SetTrace` が Python API " +"に追加されました。既存の :func:`sys.setprofile` 関数、 :func:`sys.settrace` " +"関数はそのまま存在し、単純に新規 C レベル関数を使うように修正されました。 " "(Contributed by Fred L. Drake, Jr.)" -#: ../../whatsnew/2.2.rst:1066 msgid "" "Another low-level API, primarily of interest to implementers of Python " -"debuggers and development tools, was added. :c:func:" -"`PyInterpreterState_Head` and :c:func:`PyInterpreterState_Next` let a caller " -"walk through all the existing interpreter objects; :c:func:" -"`PyInterpreterState_ThreadHead` and :c:func:`PyThreadState_Next` allow " -"looping over all the thread states for a given interpreter. (Contributed by " -"David Beazley.)" -msgstr "" +"debuggers and development tools, was " +"added. :c:func:`PyInterpreterState_Head` " +"and :c:func:`PyInterpreterState_Next` let a caller walk through all the " +"existing interpreter objects; :c:func:`PyInterpreterState_ThreadHead` " +"and :c:func:`PyThreadState_Next` allow looping over all the thread states " +"for a given interpreter. (Contributed by David Beazley.)" +msgstr "" +"主に Python のデバッガーや開発ツールの実装者向けに、別の低水準 API も追加され" +"ました。\n" +":c:func:`PyInterpreterState_Head` と :c:func:`PyInterpreterState_Next` を使う" +"と、存在するすべてのインタープリタオブジェクトをたどれます。\n" +":c:func:`PyInterpreterState_ThreadHead` と :c:func:`PyThreadState_Next` を使" +"うと、指定したインタープリタのすべてのスレッド状態をたどれます。\n" +"(David Beazley が貢献しました。)" #: ../../whatsnew/2.2.rst:1073 msgid "" @@ -1944,16 +2339,16 @@ msgstr "" "拡張モジュールを新 API でアップグレードするには、以下のステップを実施してくだ" "さい:" -#: ../../whatsnew/2.2.rst:1082 msgid "Rename :c:macro:`!Py_TPFLAGS_GC` to :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" +":c:macro:`!Py_TPFLAGS_GC` を :c:macro:`Py_TPFLAGS_HAVE_GC` に改名します。" #: ../../whatsnew/2.2.rst:1084 msgid "" "Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate" msgstr "" -"オブジェクトのアロケートには :c:func:`PyObject_GC_New` または :c:func:" -"`PyObject_GC_NewVar` を使ってください。" +"オブジェクトのアロケートには :c:func:`PyObject_GC_New` また" +"は :c:func:`PyObject_GC_NewVar` を使ってください。" #: ../../whatsnew/2.2.rst:1085 msgid "objects, and :c:func:`PyObject_GC_Del` to deallocate them." @@ -1961,20 +2356,22 @@ msgstr "" "そしてオブジェクトのデアロケートには :c:func:`PyObject_GC_Del` を使ってくださ" "い。" -#: ../../whatsnew/2.2.rst:1087 msgid "" -"Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" -"func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." +"Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` " +"and :c:func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" +":c:func:`!PyObject_GC_Init` を :c:func:`PyObject_GC_Track` に、:c:func:`!" +"PyObject_GC_Fini` を :c:func:`PyObject_GC_UnTrack` に改名します。" -#: ../../whatsnew/2.2.rst:1090 msgid "Remove :c:macro:`!PyGC_HEAD_SIZE` from object size calculations." msgstr "" +"オブジェクトサイズの計算から :c:macro:`!PyGC_HEAD_SIZE` を取り除きます。" -#: ../../whatsnew/2.2.rst:1092 msgid "" "Remove calls to :c:func:`!PyObject_AS_GC` and :c:func:`!PyObject_FROM_GC`." msgstr "" +":c:func:`!PyObject_AS_GC` と :c:func:`!PyObject_FROM_GC` の呼び出しを削除しま" +"す。" #: ../../whatsnew/2.2.rst:1094 msgid "" @@ -1996,7 +2393,6 @@ msgstr "" "換するのとは違っています。 (Contributed by M.-A. Lemburg, and used for the " "MBCS support on Windows described in the following section.)" -#: ../../whatsnew/2.2.rst:1103 msgid "" "A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been " "added that's simpler and presumably faster. Instead of specifying a format " @@ -2004,26 +2400,42 @@ msgid "" "expected, and a set of pointers to :c:expr:`PyObject*` variables that will " "be filled in with argument values." msgstr "" +"より単純で、おそらく高速な別の引数解析関数 :c:func:`PyArg_UnpackTuple` が追加" +"されました。\n" +"呼び出し側は書式文字列の代わりに、想定する引数の最小数と最大数、および引数の" +"値を格納する :c:expr:`PyObject*` 変数へのポインターを渡すだけです。" -#: ../../whatsnew/2.2.rst:1109 msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " "arguments or a single untyped argument. Calling such methods is more " -"efficient than calling a corresponding method that uses :c:macro:" -"`METH_VARARGS`. Also, the old :c:macro:`!METH_OLDARGS` style of writing C " -"methods is now officially deprecated." -msgstr "" - -#: ../../whatsnew/2.2.rst:1115 -msgid "" -"Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" -"`PyOS_vsnprintf` were added to provide cross-platform implementations for " -"the relatively new :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In " -"contrast to the standard :c:func:`sprintf` and :c:func:`!vsprintf` " -"functions, the Python versions check the bounds of the buffer used to " -"protect against buffer overruns. (Contributed by M.-A. Lemburg.)" -msgstr "" +"efficient than calling a corresponding method that " +"uses :c:macro:`METH_VARARGS`. Also, the old :c:macro:`!METH_OLDARGS` style " +"of writing C methods is now officially deprecated." +msgstr "" +"引数を取らないメソッドや、型を限定しない引数を一つ取るメソッドの実装を簡単に" +"するため、メソッド定義テーブルで 2 つの新しいフラグ :c:macro:`METH_NOARGS` " +"と :c:macro:`METH_O` を使えるようになりました。\n" +"このようなメソッドの呼び出しは、同等の処理を :c:macro:`METH_VARARGS` で実装し" +"たメソッドの呼び出しより効率的です。\n" +"また、C のメソッドを記述する旧来の :c:macro:`!METH_OLDARGS` 形式が正式に非推" +"奨となりました。" + +msgid "" +"Two new wrapper functions, :c:func:`PyOS_snprintf` " +"and :c:func:`PyOS_vsnprintf` were added to provide cross-platform " +"implementations for the relatively new :c:func:`snprintf` " +"and :c:func:`vsnprintf` C lib APIs. In contrast to the " +"standard :c:func:`sprintf` and :c:func:`!vsprintf` functions, the Python " +"versions check the bounds of the buffer used to protect against buffer " +"overruns. (Contributed by M.-A. Lemburg.)" +msgstr "" +"比較的新しい C ライブラリの API :c:func:`snprintf` と :c:func:`vsnprintf` を" +"プラットフォームによらず使えるようにするため、新しいラッパー関" +"数 :c:func:`PyOS_snprintf` と :c:func:`PyOS_vsnprintf` が追加されました。\n" +"標準の :c:func:`sprintf` 関数や :c:func:`!vsprintf` 関数と異なり、Python 版は" +"使用するバッファの境界を確認してバッファオーバーランを防ぎます。\n" +"(M.-A. Lemburg による貢献です。)" #: ../../whatsnew/2.2.rst:1122 msgid "" @@ -2058,14 +2470,15 @@ msgstr "" msgid "Some of the more notable changes are:" msgstr "ほかの、さらに特筆すべき変更のいくつかを挙げます:" -#: ../../whatsnew/2.2.rst:1140 msgid "" "The code for the MacOS port for Python, maintained by Jack Jansen, is now " "kept in the main Python CVS tree, and many changes have been made to support " "MacOS X." msgstr "" +"Jack Jansen が保守する Python の MacOS 移植版のコードは、メインの Python CVS " +"ツリーで管理されるようになり、MacOS X をサポートするための多くの変更が行われ" +"ました。" -#: ../../whatsnew/2.2.rst:1143 msgid "" "The most significant change is the ability to build Python as a framework, " "enabled by supplying the :option:`!--enable-framework` option to the " @@ -2078,14 +2491,29 @@ msgid "" "application, porting the MacPython IDE, possibly using Python as a standard " "OSA scripting language and much more.\"" msgstr "" +"最も重要な変更は、Python をフレームワークとしてビルドできるようになったことで" +"す。\n" +"Python のコンパイル時に configure スクリプトへ :option:`!--enable-framework` " +"オプションを渡すと有効になります。\n" +"Jack Jansen は次のように説明しています。「これにより、自己完結した Python 環" +"境と OS X フレームワークとの連携部分が :file:`/Library/Frameworks/" +"Python.framework` (または任意の別の場所) にインストールされます。\n" +"今のところ、これ自体による直接的な利点はほとんどありません (実際には、Python " +"を見つけられるように PATH を変更する必要があるという欠点があります)。\n" +"しかしこれは、本格的な Python アプリケーションの作成、MacPython IDE の移植、" +"Python を標準の OSA スクリプト言語として使う可能性など、さまざまなことの基礎" +"となります。」" -#: ../../whatsnew/2.2.rst:1154 msgid "" "Most of the MacPython toolbox modules, which interface to MacOS APIs such as " "windowing, QuickTime, scripting, etc. have been ported to OS X, but they've " "been left commented out in :file:`setup.py`. People who want to experiment " "with these modules can uncomment them manually." msgstr "" +"ウィンドウ、QuickTime、スクリプトなどの MacOS API に接続する MacPython の " +"toolbox モジュールの大部分は OS X に移植されましたが、:file:`setup.py` ではコ" +"メントアウトされたままです。\n" +"これらのモジュールを試したい場合は、自分でコメントを解除できます。" #: ../../whatsnew/2.2.rst:1177 msgid "" @@ -2101,13 +2529,13 @@ msgstr "" msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " -"The :exc:`ReferenceError` exception has therefore moved from the :mod:" -"`weakref` module to become a built-in exception." +"The :exc:`ReferenceError` exception has therefore moved from " +"the :mod:`weakref` module to become a built-in exception." msgstr "" "Python 2.1 で拡張モジュールとして追加された弱参照は、今では Python 中核の一部" -"です。これは新スタイルクラスの実装のために使われるからです。このため :mod:" -"`weakref` モジュールにいた :exc:`ReferenceError` 例外をビルトイン例外に移動し" -"ました。" +"です。これは新スタイルクラスの実装のために使われるからです。このた" +"め :mod:`weakref` モジュールにいた :exc:`ReferenceError` 例外をビルトイン例外" +"に移動しました。" #: ../../whatsnew/2.2.rst:1186 msgid "" @@ -2120,10 +2548,10 @@ msgstr "" #: ../../whatsnew/2.2.rst:1190 msgid "" -"An additional *flags* argument has been added to the built-in function :func:" -"`compile`, so the behaviour of ``__future__`` statements can now be " -"correctly observed in simulated shells, such as those presented by IDLE and " -"other development environments. This is described in :pep:`264`. " +"An additional *flags* argument has been added to the built-in " +"function :func:`compile`, so the behaviour of ``__future__`` statements can " +"now be correctly observed in simulated shells, such as those presented by " +"IDLE and other development environments. This is described in :pep:`264`. " "(Contributed by Michael Hudson.)" msgstr "" "ビルトイン関数 :func:`compile` に *flags* 引数が追加され、これにより " @@ -2180,18 +2608,27 @@ msgstr "" ":file:`Tools/scripts/ftpmirror.py` スクリプトが、もしあれば、 :file:`.netrc` " "ファイルを読むようになりました。 (Contributed by Mike Romberg.)" -#: ../../whatsnew/2.2.rst:1216 msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " "Python 2.3. :class:`!xrange` objects tried to pretend they were full " -"sequence types by supporting slicing, sequence multiplication, and the :" -"keyword:`in` operator, but these features were rarely used and therefore " -"buggy. The :meth:`!tolist` method and the :attr:`!start`, :attr:`!stop`, " -"and :attr:`!step` attributes are also being deprecated. At the C level, the " -"fourth argument to the :c:func:`!PyRange_New` function, ``repeat``, has also " -"been deprecated." -msgstr "" +"sequence types by supporting slicing, sequence multiplication, and " +"the :keyword:`in` operator, but these features were rarely used and " +"therefore buggy. The :meth:`!tolist` method and the :attr:`!start`, :attr:`!" +"stop`, and :attr:`!step` attributes are also being deprecated. At the C " +"level, the fourth argument to the :c:func:`!PyRange_New` function, " +"``repeat``, has also been deprecated." +msgstr "" +":func:`!xrange` 関数が返すオブジェクトの一部の機能が非推奨となり、アクセスす" +"ると警告が出るようになりました。\n" +"これらは Python 2.3 で削除されます。\n" +":class:`!xrange` オブジェクトは、スライス、シーケンスの乗算、:keyword:`in` 演" +"算子に対応して完全なシーケンス型のように振る舞おうとしていましたが、これらの" +"機能はほとんど使われず、そのためバグがありました。\n" +":meth:`!tolist` メソッドと :attr:`!start`、:attr:`!stop`、:attr:`!step` 属性" +"も非推奨となります。\n" +"C レベルでは、:c:func:`!PyRange_New` 関数の第 4 引数 ``repeat`` も非推奨とな" +"りました。" #: ../../whatsnew/2.2.rst:1225 msgid "" @@ -2209,20 +2646,27 @@ msgstr "" "Peters がバグをフィックスし、 Michael がまた別のケースを見つけ、ということを" "繰り返しました。" -#: ../../whatsnew/2.2.rst:1232 msgid "" "On Windows, Python can now be compiled with Borland C thanks to a number of " "patches contributed by Stephen Hansen, though the result isn't fully " "functional yet. (But this *is* progress...)" msgstr "" +"Stephen Hansen の多数のパッチにより、Windows では Borland C で Python をコン" +"パイルできるようになりました。\n" +"ただし、まだ完全には動作しません。\n" +"(それでも、これは *進歩* です。)" -#: ../../whatsnew/2.2.rst:1236 msgid "" "Another Windows enhancement: Wise Solutions generously offered PythonLabs " "use of their InstallerMaster 8.1 system. Earlier PythonLabs Windows " "installers used Wise 5.0a, which was beginning to show its age. (Packaged " "up by Tim Peters.)" msgstr "" +"Windows 向けのもう一つの改善として、Wise Solutions が PythonLabs に " +"InstallerMaster 8.1 システムの使用を快く提供しました。\n" +"従来の PythonLabs の Windows インストーラーは、古さが目立ち始めていた Wise " +"5.0a を使っていました。\n" +"(Tim Peters がパッケージ化しました。)" #: ../../whatsnew/2.2.rst:1240 msgid "" @@ -2243,16 +2687,15 @@ msgstr "" #: ../../whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " -"extension modules, it's now possible to set the flags used by :c:func:" -"`dlopen` using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` " -"functions. (Contributed by Bram Stolk.)" +"extension modules, it's now possible to set the flags used " +"by :c:func:`dlopen` using the :func:`sys.getdlopenflags` " +"and :func:`sys.setdlopenflags` functions. (Contributed by Bram Stolk.)" msgstr "" "Python が C の :c:func:`dlopen` 関数を拡張モジュールのロードに用いるプラット" -"フォームにおいて、 :c:func:`dlopen` で使われるフラグを :func:`sys." -"getdlopenflags` 関数と :func:`sys.setdlopenflags` 関数でセット出来るようにな" -"りました。 (Contributed by Bram Stolk.)" +"フォームにおいて、 :c:func:`dlopen` で使われるフラグ" +"を :func:`sys.getdlopenflags` 関数と :func:`sys.setdlopenflags` 関数でセット" +"出来るようになりました。 (Contributed by Bram Stolk.)" -#: ../../whatsnew/2.2.rst:1251 msgid "" "The :func:`pow` built-in function no longer supports 3 arguments when " "floating-point numbers are supplied. ``pow(x, y, z)`` returns ``(x**y) % " @@ -2260,6 +2703,12 @@ msgid "" "result varies unpredictably depending on the platform. A call such as " "``pow(2.0, 8.0, 7.0)`` will now raise a :exc:`TypeError` exception." msgstr "" +"組み込み関数 :func:`pow` は、浮動小数点数を渡す場合に 3 引数での呼び出しをサ" +"ポートしなくなりました。\n" +"``pow(x, y, z)`` は ``(x**y) % z`` を返しますが、浮動小数点数では有用でなく、" +"最終結果がプラットフォームによって予測できない形で変わります。\n" +"``pow(2.0, 8.0, 7.0)`` のような呼び出しは :exc:`TypeError` 例外を送出するよう" +"になりました。" #: ../../whatsnew/2.2.rst:1261 msgid "Acknowledgements" diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 86b8a7ba9..133736f18 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 @@ -114,9 +114,9 @@ msgstr "" "2.3 を使う必要があれば別ですが、このモジュールは 2.4 で既にビルトインで置き換" "えられ、2.6 では非推奨となり、3.0 では削除されています。ので、集合型について" "知りたければここよりも 2.4 のビルトインの方から読んだ方が良いです。---) --- " -"新しいモジュール :mod:`!sets` には、集合データ型の実装が含まれています。 :" -"class:`Set` クラスは :term:`mutable` の集合のためのクラスで、メンバの追加と削" -"除が出来ます。 :class:`!ImmutableSet` は変更できない集合のためのクラスなの" +"新しいモジュール :mod:`!sets` には、集合データ型の実装が含まれていま" +"す。 :class:`Set` クラスは mutable の集合のためのクラスで、メンバの追加と削除" +"が出来ます。 :class:`!ImmutableSet` は変更できない集合のためのクラスなの" "で、:class:`!ImmutableSet` のインスタンスを辞書のキーとして利用出来ます。集合" "型は辞書の上に構築されているので、集合内の要素はハッシュ可能でなければなりま" "せん。" @@ -125,7 +125,6 @@ msgstr "" msgid "Here's a simple example::" msgstr "単純な使用例です::" -#: ../../whatsnew/2.3.rst:52 msgid "" ">>> import sets\n" ">>> S = sets.Set([1,2,3])\n" @@ -141,21 +140,34 @@ msgid "" "Set([1, 2, 5])\n" ">>>" msgstr "" +">>> import sets\n" +">>> S = sets.Set([1,2,3])\n" +">>> S\n" +"Set([1, 2, 3])\n" +">>> 1 in S\n" +"True\n" +">>> 0 in S\n" +"False\n" +">>> S.add(5)\n" +">>> S.remove(3)\n" +">>> S\n" +"Set([1, 2, 5])\n" +">>>" #: ../../whatsnew/2.3.rst:66 msgid "" -"The union and intersection of sets can be computed with the :meth:" -"`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " +"The union and intersection of sets can be computed with " +"the :meth:`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " "alternative notation uses the bitwise operators ``&`` and ``|``. Mutable " "sets also have in-place versions of these methods, :meth:`!union_update` " "and :meth:`~frozenset.intersection_update`. ::" msgstr "" -"和集合 (union) と共通集合 (intersection) は :meth:`~frozenset.union` と :" -"meth:`~frozenset.intersection` メソッドで計算出来ます; 別の記法として、ビット" -"演算子 ``&`` と ``|`` も使えます。変更可能な集合ではこれらのインプレイス版 :" -"meth:`!union_update` と :meth:`~frozenset.intersection_update` も使えます::" +"和集合 (union) と共通集合 (intersection) は :meth:`~frozenset.union` " +"と :meth:`~frozenset.intersection` メソッドで計算出来ます; 別の記法として、" +"ビット演算子 ``&`` と ``|`` も使えます。変更可能な集合ではこれらのインプレイ" +"ス版 :meth:`!union_update` と :meth:`~frozenset.intersection_update` も使えま" +"す::" -#: ../../whatsnew/2.3.rst:71 msgid "" ">>> S1 = sets.Set([1,2,3])\n" ">>> S2 = sets.Set([4,5,6])\n" @@ -172,6 +184,20 @@ msgid "" "Set([1, 2, 3, 4, 5, 6])\n" ">>>" msgstr "" +">>> S1 = sets.Set([1,2,3])\n" +">>> S2 = sets.Set([4,5,6])\n" +">>> S1.union(S2)\n" +"Set([1, 2, 3, 4, 5, 6])\n" +">>> S1 | S2 # 別の書き方\n" +"Set([1, 2, 3, 4, 5, 6])\n" +">>> S1.intersection(S2)\n" +"Set([])\n" +">>> S1 & S2 # 別の書き方\n" +"Set([])\n" +">>> S1.union_update(S2)\n" +">>> S1\n" +"Set([1, 2, 3, 4, 5, 6])\n" +">>>" #: ../../whatsnew/2.3.rst:86 msgid "" @@ -179,16 +205,15 @@ msgid "" "the set of all elements in the union that aren't in the intersection. " "Another way of putting it is that the symmetric difference contains all " "elements that are in exactly one set. Again, there's an alternative " -"notation (``^``), and an in-place version with the ungainly name :meth:" -"`~frozenset.symmetric_difference_update`. ::" +"notation (``^``), and an in-place version with the ungainly " +"name :meth:`~frozenset.symmetric_difference_update`. ::" msgstr "" "2 つの集合の対称差 (symmetric difference) を取ることも出来ます。これは、" "union から intersection を除いた全要素を取ります。別の言い方をすれば、対称差" "とは、正確に一つの集合だけに含まれる全要素、ということです。ほかと同じくビッ" -"ト演算子の記法 (``^``) が使え、インプレイスバージョンは見苦しい名前の :meth:" -"`~frozenset.symmetric_difference_update` です::" +"ト演算子の記法 (``^``) が使え、インプレイスバージョンは見苦しい名前" +"の :meth:`~frozenset.symmetric_difference_update` です::" -#: ../../whatsnew/2.3.rst:92 msgid "" ">>> S1 = sets.Set([1,2,3,4])\n" ">>> S2 = sets.Set([3,4,5,6])\n" @@ -198,6 +223,13 @@ msgid "" "Set([1, 2, 5, 6])\n" ">>>" msgstr "" +">>> S1 = sets.Set([1,2,3,4])\n" +">>> S2 = sets.Set([3,4,5,6])\n" +">>> S1.symmetric_difference(S2)\n" +"Set([1, 2, 5, 6])\n" +">>> S1 ^ S2\n" +"Set([1, 2, 5, 6])\n" +">>>" #: ../../whatsnew/2.3.rst:100 msgid "" @@ -207,7 +239,6 @@ msgstr "" ":meth:`!issubset` と :meth:`!issuperset` メソッドも使えます。これはある集合が" "部分集合、上位集合であるかとうかをチェックします::" -#: ../../whatsnew/2.3.rst:103 msgid "" ">>> S1 = sets.Set([1,2,3])\n" ">>> S2 = sets.Set([2,3])\n" @@ -219,6 +250,15 @@ msgid "" "True\n" ">>>" msgstr "" +">>> S1 = sets.Set([1,2,3])\n" +">>> S2 = sets.Set([2,3])\n" +">>> S2.issubset(S1)\n" +"True\n" +">>> S1.issubset(S2)\n" +"False\n" +">>> S1.issuperset(S2)\n" +"True\n" +">>>" #: ../../whatsnew/2.3.rst:116 msgid ":pep:`218` - Adding a Built-In Set Object Type" @@ -268,24 +308,26 @@ msgid "" "functions." msgstr "" "Python や C の標準的な関数コールについては、よくご存じに違いありません。関数" -"を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その関数が :" -"keyword:`return` 文まで来ると、ローカル変数が破壊されてから、返り値が呼び出し" -"元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベート名前空間に新規" -"のローカル変数が作られるのです。しかし、関数を出るときにローカル変数を捨てな" -"ければどうなるでしょうか。その出ていったところから関数を続行できたとしたら、" -"どうでしょう。これこそジェネレータが提供する機能です; すなわち、ジェネレータ" -"は続行できる関数と考えることができます。" +"を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その関数" +"が :keyword:`return` 文まで来ると、ローカル変数が破壊されてから、返り値が呼び" +"出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベート名前空間に" +"新規のローカル変数が作られるのです。しかし、関数を出るときにローカル変数を捨" +"てなければどうなるでしょうか。その出ていったところから関数を続行できたとした" +"ら、どうでしょう。これこそジェネレータが提供する機能です; すなわち、ジェネ" +"レータは続行できる関数と考えることができます。" #: ../../whatsnew/2.3.rst:145 msgid "Here's the simplest example of a generator function::" msgstr "ジェネレータ関数の最も単純な例です::" -#: ../../whatsnew/2.3.rst:147 msgid "" "def generate_ints(N):\n" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.3.rst:151 msgid "" @@ -294,8 +336,8 @@ msgid "" "this is detected by Python's bytecode compiler which compiles the function " "specially as a result." msgstr "" -"新しいキーワード :keyword:`yield` がジェネレータのために導入されました。 :" -"keyword:`!yield` ステートメントを含むどんな関数もジェネレータ関数です; " +"新しいキーワード :keyword:`yield` がジェネレータのために導入されまし" +"た。 :keyword:`!yield` ステートメントを含むどんな関数もジェネレータ関数です; " "Python バイトコードコンパイラはこれを検知し、関数が特別に扱われるように翻訳し" "ます。 (---訳注: Python 2.5 の PEP 342 も参照して下さい。この 2.2 で導入時点" "の ``yield`` はステートメントではなく式に変更されています。---)" @@ -308,34 +350,33 @@ msgid "" "of ``i``, similar to a :keyword:`return` statement. The big difference " "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " -"and local variables are preserved. On the next call to the generator's ``." -"next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`try` block of a :keyword:`!" -"try`...\\ :keyword:`!finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"and local variables are preserved. On the next call to the generator's " +"``.next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`try` block of " +"a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a " +"full 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::" msgstr "上記の :func:`!generate_ints` ジェネレータはこんな具合に使います::" -#: ../../whatsnew/2.3.rst:171 msgid "" ">>> gen = generate_ints(3)\n" ">>> gen\n" @@ -352,6 +393,20 @@ msgid "" " File \"stdin\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +" File \"stdin\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.3.rst:186 msgid "" @@ -396,17 +451,17 @@ msgid "" msgstr "" "自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタンス変" "数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整数のリス" -"トを返すのは、 ``self.count`` を 0 にして、 :meth:`next` メソッドが ``self." -"count`` をインクリメントして返すようにすればできます。しかしながら、ある程度" -"複雑なジェネレータになってくると、同じことをするクラスを書くのは格段にややこ" -"しいことになります。 :file:`Lib/test/test_generators.py` にはもっと面白い例が" -"たくさん含まれています。一番単純な一つは、ジェネレータを再帰的に使ってツリー" -"を順繰りに横断する実装をするこれです (---訳注: ジェネレータは現在の最新 3.5 " -"までの間に 2 度大きな機能強化が行われているのですが、一つが 2.5 での PEP 342 " -"でこれは yield 「に」値を戻せるようにするものです。もう一つが 3.3 での PEP " -"380 で、これはサブジェネレータへの委譲 ``yield from `` の追加でした。" -"ですのでこの 3.3 からの ``yield from`` を使うと下記例はもっとスッキリ書けま" -"す。---)::" +"トを返すのは、 ``self.count`` を 0 にして、 :meth:`next` メソッドが " +"``self.count`` をインクリメントして返すようにすればできます。しかしながら、あ" +"る程度複雑なジェネレータになってくると、同じことをするクラスを書くのは格段に" +"ややこしいことになります。 :file:`Lib/test/test_generators.py` にはもっと面白" +"い例がたくさん含まれています。一番単純な一つは、ジェネレータを再帰的に使って" +"ツリーを順繰りに横断する実装をするこれです (---訳注: ジェネレータは現在の最" +"新 3.5 までの間に 2 度大きな機能強化が行われているのですが、一つが 2.5 での " +"PEP 342 でこれは yield 「に」値を戻せるようにするものです。もう一つが 3.3 で" +"の PEP 380 で、これはサブジェネレータへの委譲 ``yield from `` の追加" +"でした。ですのでこの 3.3 からの ``yield from`` を使うと下記例はもっとスッキリ" +"書けます。---)::" #: ../../whatsnew/2.3.rst:206 msgid "" @@ -442,17 +497,18 @@ msgid "" "Language\" at https://www2.cs.arizona.edu/icon/docs/ipd266.htm gives an idea " "of what this looks like::" msgstr "" -"ジェネレータの発想はほかのプログラミング言語、特に Icon (https://www2.cs." -"arizona.edu/icon/) から着想しています。Icon ではジェネレータが言語の中枢に" -"なっています。Icon では、あらゆる式と関数がジェネレータのように振舞います。 " -"https://www2.cs.arizona.edu/icon/docs/ipd266.htm の \"Icon プログラミング言語" -"の概要\" の一つの例が、これがどのようなものであるのかを教えてくれます::" +"ジェネレータの発想はほかのプログラミング言語、特に Icon (https://" +"www2.cs.arizona.edu/icon/) から着想しています。Icon ではジェネレータが言語の" +"中枢になっています。Icon では、あらゆる式と関数がジェネレータのように振舞いま" +"す。 https://www2.cs.arizona.edu/icon/docs/ipd266.htm の \"Icon プログラミン" +"グ言語の概要\" の一つの例が、これがどのようなものであるのかを教えてくれます::" -#: ../../whatsnew/2.3.rst:227 msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" +"sentence := \"Store it in the neighboring harbor\"\n" +"if (i := find(\"or\", sentence)) > 5 then write(i)" #: ../../whatsnew/2.3.rst:230 msgid "" @@ -518,19 +574,20 @@ msgstr "" "りました。エンコーディングはソースコードの 1 行目か 2 行目に特殊形式のコメン" "トを含めることで宣言出来ます。 UTF-8 ファイルであればこのように宣言出来ます::" -#: ../../whatsnew/2.3.rst:264 msgid "" "#!/usr/bin/env python\n" "# -*- coding: UTF-8 -*-" msgstr "" +"#!/usr/bin/env python\n" +"# -*- coding: UTF-8 -*-" #: ../../whatsnew/2.3.rst:267 msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " "ASCII. Executing or importing modules that contain string literals with 8-" -"bit characters and have no encoding declaration will result in a :exc:" -"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a " -"syntax error." +"bit characters and have no encoding declaration will result in " +"a :exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will " +"be a syntax error." msgstr "" "このエンコーディング宣言がなければ、デフォルトの 7 ビット ASCII エンコーディ" "ングが使われます(訳注: Python 3 からはデフォルトは utf-8 (PEP 3120))。8 ビッ" @@ -571,15 +628,14 @@ msgstr "PEP 273: Zip アーカイブからモジュールをインポートす msgid "" "The new :mod:`zipimport` module adds support for importing modules from a " "ZIP-format archive. You don't need to import the module explicitly; it will " -"be automatically imported if a ZIP archive's filename is added to ``sys." -"path``. For example:" +"be automatically imported if a ZIP archive's filename is added to " +"``sys.path``. For example:" msgstr "" "新たなモジュール :mod:`zipimport` が、ZIP フォーマットの書庫からモジュールの" -"インポートをサポートします。 :mod:`zipimport` を明示的にインポートする必要は" -"ありません; ``sys.path`` に ZIP 形式書庫が追加されるとそれは自動的にインポー" -"トされます。例えば::" +"インポートをサポートします。 ``zipimport`` を明示的にインポートする必要はあり" +"ません; ``sys.path`` に ZIP 形式書庫が追加されるとそれは自動的にインポートさ" +"れます。例えば::" -#: ../../whatsnew/2.3.rst:296 msgid "" "amk@nyman:~/src/python$ unzip -l /tmp/example.zip\n" "Archive: /tmp/example.zip\n" @@ -598,22 +654,39 @@ msgid "" "'/tmp/example.zip/jwzthreading.py'\n" ">>>" msgstr "" +"amk@nyman:~/src/python$ unzip -l /tmp/example.zip\n" +"Archive: /tmp/example.zip\n" +" Length Date Time Name\n" +" -------- ---- ---- ----\n" +" 8467 11-26-02 22:30 jwzthreading.py\n" +" -------- -------\n" +" 8467 1 file\n" +"amk@nyman:~/src/python$ ./python\n" +"Python 2.3 (#1, Aug 1 2003, 19:54:32)\n" +">>> import sys\n" +">>> sys.path.insert(0, '/tmp/example.zip') # パスの先頭に .zip ファイルを追" +"加\n" +">>> import jwzthreading\n" +">>> jwzthreading.__file__\n" +"'/tmp/example.zip/jwzthreading.py'\n" +">>>" #: ../../whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " -"archive can contain any kind of files, but only files named :file:`\\*.py`, :" -"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only " -"contains :file:`\\*.py` files, Python will not attempt to modify the archive " -"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP " -"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow." +"archive can contain any kind of files, but only files " +"named :file:`\\*.py`, :file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. " +"If an archive only contains :file:`\\*.py` files, Python will not attempt to " +"modify the archive by adding the corresponding :file:`\\*.pyc` file, meaning " +"that if a ZIP archive doesn't contain :file:`\\*.pyc` files, importing may " +"be rather slow." msgstr "" "``sys.path`` には今や ZIP 書庫のファイル名も入れることが出来ます。ZIP アーカ" -"イブ内にはどんなファイルを置いてもかまいませんが、import できるのは :file:" -"`\\*.py`, :file:`\\*.pyc`, :file:`\\*.pyo` だけです。書庫に :file:`\\*.py` だ" -"けが含まれる場合には、Python は書庫を修正して対応する :file:`\\*.pyc` を作る" -"などということはしないので、 :file:`\\*.pyc` ファイルを含まない ZIP 書庫から" -"のインポートはやや遅いかもしれません。" +"イブ内にはどんなファイルを置いてもかまいませんが、import できるの" +"は :file:`\\*.py`, :file:`\\*.pyc`, :file:`\\*.pyo` だけです。書庫" +"に :file:`\\*.py` だけが含まれる場合には、Python は書庫を修正して対応す" +"る :file:`\\*.pyc` を作るなどということはしないので、 :file:`\\*.pyc` ファイ" +"ルを含まない ZIP 書庫からのインポートはやや遅いかもしれません。" #: ../../whatsnew/2.3.rst:321 msgid "" @@ -633,14 +706,14 @@ msgstr ":pep:`273` - Zip アーカイブからモジュールをインポート msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described in :pep:" -"`302`. See section :ref:`section-pep302` for a description of the new import " -"hooks." +"written by Just van Rossum that uses the import hooks described " +"in :pep:`302`. See section :ref:`section-pep302` for a description of the " +"new import hooks." msgstr "" "このモジュールの実装も行った、James C. Ahlstrom による PEP です。 Python 2.3 " -"は :pep:`273` の仕様に従っていますが、 Just van Rossum の書いた、 :pep:" -"`302` に記述されているインポートフックによる実装を使っています。その新しいイ" -"ンポートフックについては :ref:`section-pep302` をみてください。" +"は :pep:`273` の仕様に従っていますが、 Just van Rossum の書い" +"た、 :pep:`302` に記述されているインポートフックによる実装を使っています。そ" +"の新しいインポートフックについては :ref:`section-pep302` をみてください。" #: ../../whatsnew/2.3.rst:338 msgid "PEP 277: Unicode file name support for Windows NT" @@ -660,19 +733,20 @@ msgstr "" #: ../../whatsnew/2.3.rst:344 msgid "" "Python now allows using arbitrary Unicode strings (within the limitations of " -"the file system) for all functions that expect file names, most notably the :" -"func:`open` built-in function. If a Unicode string is passed to :func:`os." -"listdir`, Python now returns a list of Unicode strings. A new function, :" -"func:`!os.getcwdu`, returns the current directory as a Unicode string." +"the file system) for all functions that expect file names, most notably " +"the :func:`open` built-in function. If a Unicode string is passed " +"to :func:`os.listdir`, Python now returns a list of Unicode strings. A new " +"function, :func:`!os.getcwdu`, returns the current directory as a Unicode " +"string." 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 "" @@ -682,14 +756,17 @@ msgstr "" "ファイル名のバイト文字列はいまでも動きます。Windows 版 Python は透過的にそれ" "らを Unicode に ``mbcs`` エンコーディングを使って変換します。" -#: ../../whatsnew/2.3.rst:353 msgid "" "Other systems also allow Unicode strings as file names but convert them to " -"byte strings before passing them to the system, which can cause a :exc:" -"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " -"strings are supported as file names by checking :const:`os.path." -"supports_unicode_filenames`, a Boolean value." +"byte strings before passing them to the system, which can cause " +"a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary " +"Unicode strings are supported as file names by " +"checking :const:`os.path.supports_unicode_filenames`, a Boolean value." msgstr "" +"ほかのシステムもファイル名に Unicode 文字列を使えますが、システムへ渡す前にバ" +"イト列に変換するため、:exc:`UnicodeError` が送出される場合があります。\n" +"アプリケーションは真偽値 :const:`os.path.supports_unicode_filenames` を調べる" +"ことで、任意の Unicode 文字列をファイル名に使えるかどうかを確認できます。" #: ../../whatsnew/2.3.rst:359 msgid "Under MacOS, :func:`os.listdir` may now return Unicode filenames." @@ -732,9 +809,9 @@ msgstr "" msgid "" "Python's file objects can now support end of line conventions other than the " "one followed by the platform on which Python is running. Opening a file with " -"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:" -"`universal newlines` mode. All three line ending conventions will be " -"translated to a ``'\\n'`` in the strings returned by the various file " +"the mode ``'U'`` or ``'rU'`` will open a file for reading " +"in :term:`universal newlines` mode. All three line ending conventions will " +"be translated to a ``'\\n'`` in the strings returned by the various file " "methods such as :meth:`!read` and :meth:`!readline`." msgstr "" "Python のファイルオブジェクトが、動作しているプラットフォームに従わない行終端" @@ -757,9 +834,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:396 msgid "" -"This feature can be disabled when compiling Python by specifying the :option:" -"`!--without-universal-newlines` switch when running Python's :program:" -"`configure` script." +"This feature can be disabled when compiling Python by specifying " +"the :option:`!--without-universal-newlines` switch when running " +"Python's :program:`configure` script." msgstr "" "この機能は Python をソースからビルドする際に :program:`configure` スクリプト" "に :option:`!--without-universal-newlines` スイッチ を付けることで無効に出来" @@ -794,24 +871,29 @@ msgid "A common idiom to change every element of a list looks like this::" msgstr "" "リストの全てを変更するためのよくあるイディオムはこのようなものでしょう::" -#: ../../whatsnew/2.3.rst:421 msgid "" "for i in range(len(L)):\n" " item = L[i]\n" " # ... compute some result based on item ...\n" " L[i] = result" msgstr "" +"for i in range(len(L)):\n" +" item = L[i]\n" +" # ... item をもとに結果を計算 ...\n" +" L[i] = result" #: ../../whatsnew/2.3.rst:426 msgid "This can be rewritten using :func:`enumerate` as::" msgstr "これは :func:`enumerate` を使ってこのように書き換えることが出来ます::" -#: ../../whatsnew/2.3.rst:428 msgid "" "for i, item in enumerate(L):\n" " # ... compute some result based on item ...\n" " L[i] = result" msgstr "" +"for i, item in enumerate(L):\n" +" # ... item をもとに結果を計算 ...\n" +" L[i] = result" #: ../../whatsnew/2.3.rst:435 msgid ":pep:`279` - The enumerate() built-in function" @@ -847,27 +929,28 @@ msgstr "" msgid "" "The :class:`~logging.Logger` class is the primary class. Most application " "code will deal with one or more :class:`~logging.Logger` objects, each one " -"used by a particular subsystem of the application. Each :class:`~logging." -"Logger` is identified by a name, and names are organized into a hierarchy " -"using ``.`` as the component separator. For example, you might have :class:" -"`~logging.Logger` instances named ``server``, ``server.auth`` and ``server." -"network``. The latter two instances are below ``server`` in the hierarchy. " -"This means that if you turn up the verbosity for ``server`` or direct " -"``server`` messages to a different handler, the changes will also apply to " -"records logged to ``server.auth`` and ``server.network``. There's also a " -"root :class:`~logging.Logger` that's the parent of all other loggers." +"used by a particular subsystem of the application. " +"Each :class:`~logging.Logger` is identified by a name, and names are " +"organized into a hierarchy using ``.`` as the component separator. For " +"example, you might have :class:`~logging.Logger` instances named ``server``, " +"``server.auth`` and ``server.network``. The latter two instances are below " +"``server`` in the hierarchy. This means that if you turn up the verbosity " +"for ``server`` or direct ``server`` messages to a different handler, the " +"changes will also apply to records logged to ``server.auth`` and " +"``server.network``. There's also a root :class:`~logging.Logger` that's the " +"parent of all other loggers." msgstr "" ":class:`~logging.Logger` が最も重要なクラスです。ほとんどのアプリケーション" "コードは一つかそれ以上の :class:`~logging.Logger` オブジェクトを扱い、それぞ" "れ一つはそのアプリケーションの特定のサブシステムで使われるでしょう。それぞれ" "の :class:`~logging.Logger` は名前で識別され、名前は ``.`` をコンポーネントの" -"セパレータとして使う階層で体系化されます。例えば、 ``server``, ``server." -"auth``, ``server.network`` といった名前の :class:`~logging.Logger` インスタン" -"スを持つといった具合です。この例の後ろ 2 つは階層で ``server`` の下にありま" -"す。 ``server`` への冗長性を見つけた場合や ``server`` メッセージを直接異なる" -"ハンドラに向けた場合、変更は ``server.auth`` と ``server.network`` へのログ記" -"録にも適用されるということです。全てのほかのロガーの親となる、ルート :class:" -"`~logging.Logger` もあります。" +"セパレータとして使う階層で体系化されます。例えば、 ``server``, " +"``server.auth``, ``server.network`` といった名前の :class:`~logging.Logger` " +"インスタンスを持つといった具合です。この例の後ろ 2 つは階層で ``server`` の下" +"にあります。 ``server`` への冗長性を見つけた場合や ``server`` メッセージを直" +"接異なるハンドラに向けた場合、変更は ``server.auth`` と ``server.network`` へ" +"のログ記録にも適用されるということです。全てのほかのロガーの親となる、ルー" +"ト :class:`~logging.Logger` もあります。" #: ../../whatsnew/2.3.rst:464 msgid "" @@ -877,7 +960,6 @@ msgstr "" "単純な用法のために、 :mod:`logging` パッケージはいくつかの便利関数を含んでい" "て、これは常にルートログを使います::" -#: ../../whatsnew/2.3.rst:467 msgid "" "import logging\n" "\n" @@ -887,42 +969,58 @@ msgid "" "logging.error('Error occurred')\n" "logging.critical('Critical error -- shutting down')" msgstr "" +"import logging\n" +"\n" +"logging.debug('Debugging information')\n" +"logging.info('Informational message')\n" +"logging.warning('Warning:config file %s not found', 'server.conf')\n" +"logging.error('Error occurred')\n" +"logging.critical('Critical error -- shutting down')" #: ../../whatsnew/2.3.rst:475 ../../whatsnew/2.3.rst:500 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 "" "In the default configuration, informational and debugging messages are " "suppressed and the output is sent to standard error. You can enable the " -"display of informational and debugging messages by calling the :meth:" -"`~logging.Logger.setLevel` method on the root logger." +"display of informational and debugging messages by calling " +"the :meth:`~logging.Logger.setLevel` method on the root logger." msgstr "" +"デフォルトの設定では、情報やデバッグ用のメッセージは出力されず、出力先は標準" +"エラーです。\n" +"ルートロガーの :meth:`~logging.Logger.setLevel` メソッドを呼び出すと、情報や" +"デバッグ用のメッセージも表示するようにできます。" -#: ../../whatsnew/2.3.rst:486 msgid "" "Notice the :func:`~logging.warning` call's use of string formatting " "operators; all of the functions for logging messages take the arguments " "``(msg, arg1, arg2, ...)`` and log the string resulting from ``msg % (arg1, " "arg2, ...)``." msgstr "" +":func:`~logging.warning` の呼び出しで文字列の書式化演算子を使っている点に注目" +"してください。\n" +"メッセージを記録する関数はすべて ``(msg, arg1, arg2, ...)`` という引数を取" +"り、``msg % (arg1, arg2, ...)`` の結果の文字列を記録します。" -#: ../../whatsnew/2.3.rst:490 msgid "" "There's also an :func:`~logging.exception` function that records the most " "recent traceback. Any of the other functions will also record the traceback " "if you specify a true value for the keyword argument *exc_info*. ::" msgstr "" +"直近のトレースバックを記録する :func:`~logging.exception` 関数もあります。\n" +"ほかの関数でも、キーワード引数 *exc_info* に真の値を指定すればトレースバック" +"を記録します。 ::" -#: ../../whatsnew/2.3.rst:494 msgid "" "def f():\n" " try: 1/0\n" @@ -930,8 +1028,12 @@ msgid "" "\n" "f()" msgstr "" +"def f():\n" +" try: 1/0\n" +" except: logging.exception('Problem recorded')\n" +"\n" +"f()" -#: ../../whatsnew/2.3.rst:502 msgid "" "ERROR:root:Problem recorded\n" "Traceback (most recent call last):\n" @@ -939,6 +1041,11 @@ msgid "" " 1/0\n" "ZeroDivisionError: integer division or modulo by zero" msgstr "" +"ERROR:root:Problem recorded\n" +"Traceback (most recent call last):\n" +" File \"t.py\", line 6, in f\n" +" 1/0\n" +"ZeroDivisionError: integer division or modulo by zero" #: ../../whatsnew/2.3.rst:508 msgid "" @@ -952,7 +1059,6 @@ msgstr "" "していなければ、作成されます。 ``getLogger(None)`` はルートロガーを返しま" "す。::" -#: ../../whatsnew/2.3.rst:512 msgid "" "log = logging.getLogger('server')\n" " ...\n" @@ -961,16 +1067,24 @@ msgid "" "log.critical('Disk full')\n" " ..." msgstr "" +"log = logging.getLogger('server')\n" +" ...\n" +"log.info('Listening on port %i', port)\n" +" ...\n" +"log.critical('Disk full')\n" +" ..." -#: ../../whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " -"``server.auth`` is also seen by ``server`` and ``root``, but a :class:" -"`~logging.Logger` can prevent this by setting its :attr:`~logging.Logger." -"propagate` attribute to :const:`False`." +"``server.auth`` is also seen by ``server`` and ``root``, but " +"a :class:`~logging.Logger` can prevent this by setting " +"its :attr:`~logging.Logger.propagate` attribute to :const:`False`." msgstr "" +"ログレコードは通常、階層を上に向かって伝わるので、``server.auth`` に記録した" +"メッセージは ``server`` や ``root`` でも確認できます。\n" +"ただし :class:`~logging.Logger` の :attr:`~logging.Logger.propagate` 属性" +"を :const:`False` にすると、この伝播を止められます。" -#: ../../whatsnew/2.3.rst:523 msgid "" "There are more classes provided by the :mod:`logging` package that can be " "customized. When a :class:`~logging.Logger` instance is told to log a " @@ -978,11 +1092,21 @@ msgid "" "any number of different :class:`~logging.Handler` instances. Loggers and " "handlers can also have an attached list of filters, and each filter can " "cause the :class:`~logging.LogRecord` to be ignored or can modify the record " -"before passing it along. When they're finally output, :class:`~logging." -"LogRecord` instances are converted to text by a :class:`~logging.Formatter` " -"class. All of these classes can be replaced by your own specially written " -"classes." -msgstr "" +"before passing it along. When they're finally " +"output, :class:`~logging.LogRecord` instances are converted to text by " +"a :class:`~logging.Formatter` class. All of these classes can be replaced " +"by your own specially written classes." +msgstr "" +":mod:`logging` パッケージには、カスタマイズ可能なクラスがほかにもあります。\n" +":class:`~logging.Logger` インスタンスにメッセージの記録を指示する" +"と、:class:`~logging.LogRecord` インスタンスが作られ、任意の数" +"の :class:`~logging.Handler` インスタンスに送られます。\n" +"ロガーとハンドラーにはフィルターのリストを取り付けることもでき、各フィルター" +"は :class:`~logging.LogRecord` を無視したり、次へ渡す前に変更したりできま" +"す。\n" +"最終的な出力の際には、:class:`~logging.Formatter` クラスによっ" +"て :class:`~logging.LogRecord` インスタンスがテキストに変換されます。\n" +"これらのクラスはすべて、自分で書いた専用のクラスに置き換えられます。" #: ../../whatsnew/2.3.rst:533 msgid "" @@ -1010,25 +1134,29 @@ msgstr "PEP 著: Vinay Sajip と Trent Mick; 実装: Vinay Sajip." msgid "PEP 285: A Boolean Type" msgstr "PEP 285: Boolean 型" -#: ../../whatsnew/2.3.rst:552 msgid "" "A Boolean type was added to Python 2.3. Two new constants were added to " -"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. (:const:" -"`True` and :const:`False` constants were added to the built-ins in Python " -"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 " -"and aren't a different type.)" -msgstr "" +"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. " +"(:const:`True` and :const:`False` constants were added to the built-ins in " +"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 " +"and 0 and aren't a different type.)" +msgstr "" +"Python 2.3 に真偽値型が加わりました。\n" +":mod:`!__builtin__` モジュールに 2 つの新しい定数 :const:`True` " +"と :const:`False` が追加されました。\n" +"(:const:`True` と :const:`False` という定数自体は Python 2.2.1 で組み込みに追" +"加されていましたが、2.2.1 では単に整数値 1 と 0 を設定したもので、別の型では" +"ありません。)" #: ../../whatsnew/2.3.rst:558 msgid "" "The type object for this new type is named :class:`bool`; the constructor " -"for it takes any Python value and converts it to :const:`True` or :const:" -"`False`. ::" +"for it takes any Python value and converts it to :const:`True` " +"or :const:`False`. ::" msgstr "" "この新しい型の型オブジェクトの名前は :class:`bool` です; これのコンストラクタ" "は任意の Python 値を取り、 :const:`True` または :const:`False` に変換します::" -#: ../../whatsnew/2.3.rst:561 msgid "" ">>> bool(1)\n" "True\n" @@ -1039,6 +1167,14 @@ msgid "" ">>> bool( (1,) )\n" "True" msgstr "" +">>> bool(1)\n" +"True\n" +">>> bool(0)\n" +"False\n" +">>> bool([])\n" +"False\n" +">>> bool( (1,) )\n" +"True" #: ../../whatsnew/2.3.rst:570 msgid "" @@ -1048,7 +1184,6 @@ msgstr "" "標準ライブラリモジュールとビルトイン関数のほとんどが、そうすべきときには " "Boolean を返すように変更されました::" -#: ../../whatsnew/2.3.rst:573 msgid "" ">>> obj = []\n" ">>> hasattr(obj, 'append')\n" @@ -1058,6 +1193,13 @@ msgid "" ">>> isinstance(obj, tuple)\n" "False" msgstr "" +">>> obj = []\n" +">>> hasattr(obj, 'append')\n" +"True\n" +">>> isinstance(obj, list)\n" +"True\n" +">>> isinstance(obj, tuple)\n" +"False" #: ../../whatsnew/2.3.rst:581 msgid "" @@ -1078,25 +1220,24 @@ msgstr "" msgid "" "Python's Booleans were *not* added for the sake of strict type-checking. A " "very strict language such as Pascal would also prevent you performing " -"arithmetic with Booleans, and would require that the expression in an :" -"keyword:`if` statement always evaluate to a Boolean result. Python is not " -"this strict and never will be, as :pep:`285` explicitly says. This means " -"you can still use any expression in an :keyword:`!if` statement, even ones " -"that evaluate to a list or tuple or some random object. The Boolean type is " -"a subclass of the :class:`int` class so that arithmetic using a Boolean " -"still works. ::" +"arithmetic with Booleans, and would require that the expression in " +"an :keyword:`if` statement always evaluate to a Boolean result. Python is " +"not this strict and never will be, as :pep:`285` explicitly says. This " +"means you can still use any expression in an :keyword:`!if` statement, even " +"ones that evaluate to a list or tuple or some random object. The Boolean " +"type is a subclass of the :class:`int` class so that arithmetic using a " +"Boolean still works. ::" msgstr "" "Python の Boolean は、厳格な型チェックを目的として追加された *のではありませ" "ん* 。Pascal のようなとても厳格な言語では、Boolean の数学演算も阻むでしょう" "し、 :keyword:`if` ステートメントの式が必ず Boolean の結果に評価されなければ" -"ならないことを要求するでしょう。 Python はこの厳しさを今持ちませんし、 :pep:" -"`285` が名言するように、未来永劫持つことはありません。このことは、 :keyword:" -"`!if` ステートメントにこれからも任意の式を書けることを意味しますし、リストや" -"らタプルやら何かほかのデタラメなオブジェクトに評価されるものでも良いことを意" -"味します。Boolean 型は :class:`int` クラスのサブクラスであって、Boolean の算" -"術演算はこれからも動作します::" +"ならないことを要求するでしょう。 Python はこの厳しさを今持ちません" +"し、 :pep:`285` が名言するように、未来永劫持つことはありません。このこと" +"は、 :keyword:`!if` ステートメントにこれからも任意の式を書けることを意味しま" +"すし、リストやらタプルやら何かほかのデタラメなオブジェクトに評価されるもので" +"も良いことを意味します。Boolean 型は :class:`int` クラスのサブクラスであっ" +"て、Boolean の算術演算はこれからも動作します::" -#: ../../whatsnew/2.3.rst:596 msgid "" ">>> True + 1\n" "2\n" @@ -1107,6 +1248,14 @@ msgid "" ">>> True * 75\n" "75" msgstr "" +">>> True + 1\n" +"2\n" +">>> False + 1\n" +"1\n" +">>> False * 75\n" +"0\n" +">>> True * 75\n" +"75" #: ../../whatsnew/2.3.rst:605 msgid "" @@ -1135,9 +1284,9 @@ msgstr "PEP 293: コーデックエラーを処理するコールバック" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), " -"\"ignore\" (skipping the character), or \"replace\" (using a question mark " -"in the output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " +"(skipping the character), or \"replace\" (using a question mark in the " +"output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1162,12 +1311,12 @@ msgid "" "replacement string." msgstr "" "Python は今や、異なる処理戦略を追加する柔軟なフレームワークを手にしました。新" -"しいエラーハンドラを :func:`codecs.register_error` で追加出来、コーデックは :" -"func:`codecs.lookup_error` を使ってそのエラーハンドラにアクセス出来ます。等価" -"な C API も C で書かれたコーデックのために追加されています。エラーハンドラ" -"は、変換すべき文字列、そのエラーが検出されたその文字列内での位置、ターゲット" -"エンコーディングのような必要な状態情報を受け取ります。ハンドラは例外を投げる" -"か、置換文字列を返せます。" +"しいエラーハンドラを :func:`codecs.register_error` で追加出来、コーデック" +"は :func:`codecs.lookup_error` を使ってそのエラーハンドラにアクセス出来ます。" +"等価な C API も C で書かれたコーデックのために追加されています。エラーハンド" +"ラは、変換すべき文字列、そのエラーが検出されたその文字列内での位置、ターゲッ" +"トエンコーディングのような必要な状態情報を受け取ります。ハンドラは例外を投げ" +"るか、置換文字列を返せます。" #: ../../whatsnew/2.3.rst:638 msgid "" @@ -1210,13 +1359,16 @@ msgstr "" "ライセンスのようなパッケージ記述のメタデータを収集して、中央カタログサーバに" "送信します。結果のカタログは https://pypi.org で利用可能です。" -#: ../../whatsnew/2.3.rst:664 msgid "" "To make the catalog a bit more useful, a new optional *classifiers* keyword " "argument has been added to the Distutils :func:`!setup` function. A list of " "`Trove `_-style strings can be supplied to help " "classify the software." msgstr "" +"カタログをより便利にするため、Distutils の :func:`!setup` 関数に新しい省略可" +"能なキーワード引数 *classifiers* が追加されました。\n" +"ソフトウェアの分類に役立つ `Trove `_ 形式の文字" +"列のリストを指定できます。" #: ../../whatsnew/2.3.rst:669 msgid "" @@ -1226,7 +1378,6 @@ msgstr "" "以下は :file:`setup.py` に分類指定子 (classifier) を記述する例です。 " "Distutils の古いバージョンと互換になるように書いています。::" -#: ../../whatsnew/2.3.rst:672 msgid "" "from distutils import core\n" "kw = {'name': \"Quixote\",\n" @@ -1244,6 +1395,21 @@ msgid "" "\n" "core.setup(**kw)" msgstr "" +"from distutils import core\n" +"kw = {'name': \"Quixote\",\n" +" 'version': \"0.5.1\",\n" +" 'description': \"A highly Pythonic Web application framework\",\n" +" # ...\n" +" }\n" +"\n" +"if (hasattr(core, 'setup_keywords') and\n" +" 'classifiers' in core.setup_keywords):\n" +" kw['classifiers'] = \\\n" +" ['Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n" +" 'Environment :: No Input/Output (Daemon)',\n" +" 'Intended Audience :: Developers'],\n" +"\n" +"core.setup(**kw)" #: ../../whatsnew/2.3.rst:688 msgid "" @@ -1296,8 +1462,8 @@ msgstr "" msgid "" "``sys.path_hooks`` is a list of callable objects; most often they'll be " "classes. Each callable takes a string containing a path and either returns " -"an importer object that will handle imports from this path or raises an :exc:" -"`ImportError` exception if it can't handle this path." +"an importer object that will handle imports from this path or raises " +"an :exc:`ImportError` exception if it can't handle this path." msgstr "" "``sys.path_hooks`` は呼び出し可能オブジェクトのリストです。ほとんどの場合クラ" "スになるでしょう。それぞれの呼び出し可能オブジェクトは、パスを含む文字列を受" @@ -1306,8 +1472,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:721 msgid "" -"``sys.path_importer_cache`` caches importer objects for each path, so ``sys." -"path_hooks`` will only need to be traversed once for each path." +"``sys.path_importer_cache`` caches importer objects for each path, so " +"``sys.path_hooks`` will only need to be traversed once for each path." msgstr "" "``sys.path_importer_cache`` はそれぞれのパスごとのインポーターオブジェクトを" "キャッシュしますので、 ``sys.path_hooks`` は個々のパスを一回だけ横断すれば良" @@ -1349,7 +1515,6 @@ msgstr "" "Python の新しいインポートのロジックは、なので、擬似コードで示すとだいたいこん" "な感じです (少し単純化しています; 完全な詳細は :pep:`302` 参照)::" -#: ../../whatsnew/2.3.rst:738 msgid "" "for mp in sys.meta_path:\n" " loader = mp(fullname)\n" @@ -1370,6 +1535,24 @@ msgid "" "# Not found!\n" "raise ImportError" msgstr "" +"for mp in sys.meta_path:\n" +" loader = mp(fullname)\n" +" if loader is not None:\n" +" = loader.load_module(fullname)\n" +"\n" +"for path in sys.path:\n" +" for hook in sys.path_hooks:\n" +" try:\n" +" importer = hook(path)\n" +" except ImportError:\n" +" # ImportError なので、ほかのパスフックを試す\n" +" pass\n" +" else:\n" +" loader = importer.find_module(fullname)\n" +" = loader.load_module(fullname)\n" +"\n" +"# 見つからなかった!\n" +"raise ImportError" #: ../../whatsnew/2.3.rst:760 msgid ":pep:`302` - New Import Hooks" @@ -1398,9 +1581,8 @@ msgstr "" msgid "Comma-separated format is deceptively simple at first glance::" msgstr "カンマ区切りフォーマットは、ぱっと見で、簡単そうに見えます::" -#: ../../whatsnew/2.3.rst:776 msgid "Costs,150,200,3.95" -msgstr "" +msgstr "Costs,150,200,3.95" #: ../../whatsnew/2.3.rst:778 msgid "" @@ -1410,9 +1592,8 @@ msgstr "" "行を読んで ``line.split(',')``: これほどに簡単なものはあるだろうか、って? で" "すが、文字列データ内にカンマを含んだりすると、コトは複雑になります::" -#: ../../whatsnew/2.3.rst:781 msgid "\"Costs\",150,200,3.95,\"Includes taxes, shipping, and sundry items\"" -msgstr "" +msgstr "\"Costs\",150,200,3.95,\"Includes taxes, shipping, and sundry items\"" #: ../../whatsnew/2.3.rst:783 msgid "" @@ -1422,7 +1603,6 @@ msgstr "" "デカくて醜い正規表現でこれをパース出来るでしょうが、新登場の :mod:`csv` を使" "えば遥かに単純になります::" -#: ../../whatsnew/2.3.rst:786 msgid "" "import csv\n" "\n" @@ -1431,25 +1611,33 @@ msgid "" "for line in reader:\n" " print line" msgstr "" +"import csv\n" +"\n" +"input = open('datafile', 'rb')\n" +"reader = csv.reader(input)\n" +"for line in reader:\n" +" print line" -#: ../../whatsnew/2.3.rst:793 msgid "" "The :func:`~csv.reader` function takes a number of different options. The " "field separator isn't limited to the comma and can be changed to any " "character, and so can the quoting and line-ending characters." msgstr "" +":func:`~csv.reader` 関数にはさまざまなオプションがあります。\n" +"フィールドの区切りはカンマに限らず、任意の文字に変更でき、引用符や行末の文字" +"も同様に変更できます。" #: ../../whatsnew/2.3.rst:797 msgid "" "Different dialects of comma-separated files can be defined and registered; " -"currently there are two dialects, both used by Microsoft Excel. A separate :" -"class:`csv.writer` class will generate comma-separated files from a " -"succession of tuples or lists, quoting strings that contain the delimiter." +"currently there are two dialects, both used by Microsoft Excel. A " +"separate :class:`csv.writer` class will generate comma-separated files from " +"a succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" "カンマ区切りファイルの異なった方言を定義して登録出来ます。今のところ 2 つの方" -"言があって、両者とも Microsoft Excel で使われるものです。独立している :class:" -"`csv.writer` はタプルやリストの連続から、デリミタを含む文字列は引用符で囲みつ" -"つカンマ区切りファイルを生成します。" +"言があって、両者とも Microsoft Excel で使われるものです。独立してい" +"る :class:`csv.writer` はタプルやリストの連続から、デリミタを含む文字列は引用" +"符で囲みつつカンマ区切りファイルを生成します。" #: ../../whatsnew/2.3.rst:805 msgid ":pep:`305` - CSV File API" @@ -1467,7 +1655,6 @@ msgstr "" msgid "PEP 307: Pickle Enhancements" msgstr "PEP 307: Pickle の機能拡張" -#: ../../whatsnew/2.3.rst:817 msgid "" "The :mod:`pickle` and :mod:`!cPickle` modules received some attention during " "the 2.3 development cycle. In 2.2, new-style classes could be pickled " @@ -1475,6 +1662,12 @@ msgid "" "quotes a trivial example where a new-style class results in a pickled string " "three times longer than that for a classic class." msgstr "" +"2.3 の開発では :mod:`pickle` モジュールと :mod:`!cPickle` モジュールにも手が" +"加えられました。\n" +"2.2 でも新スタイルクラスは問題なく pickle 化できましたが、その結果はあまりコ" +"ンパクトではありませんでした。\n" +":pep:`307` には、新スタイルクラスの pickle 化で得られる文字列が旧スタイルクラ" +"スの場合の 3 倍の長さになる簡単な例が挙げられています。" #: ../../whatsnew/2.3.rst:823 msgid "" @@ -1485,15 +1678,14 @@ msgid "" "format. A new constant, :const:`pickle.HIGHEST_PROTOCOL`, can be used to " "select the fanciest protocol available." msgstr "" -"解決方法として、新しい pickle プロトコルが発明されました。 :func:`pickle." -"dumps` 関数はずっと長い間、テキストとするのかバイナリとするのかについてはサ" -"ポートしていました。2.3 ではこのフラグは Boolean から整数に再定義されました: " -"0 は旧式のテキストモード pickle フォーマット、1 が同じく旧式のバイナリフォー" -"マット、そして 2 が今回の 2.3 から特有のフォーマットです。新しく追加された定" -"数 :const:`pickle.HIGHEST_PROTOCOL` を指定すると、最も望ましいものが選択され" -"ます。" +"解決方法として、新しい pickle プロトコルが発明されまし" +"た。 :func:`pickle.dumps` 関数はずっと長い間、テキストとするのかバイナリとす" +"るのかについてはサポートしていました。2.3 ではこのフラグは Boolean から整数に" +"再定義されました: 0 は旧式のテキストモード pickle フォーマット、1 が同じく旧" +"式のバイナリフォーマット、そして 2 が今回の 2.3 から特有のフォーマットです。" +"新しく追加された定数 :const:`pickle.HIGHEST_PROTOCOL` を指定すると、最も望ま" +"しいものが選択されます。" -#: ../../whatsnew/2.3.rst:830 msgid "" "Unpickling is no longer considered a safe operation. 2.2's :mod:`pickle` " "provided hooks for trying to prevent unsafe classes from being unpickled " @@ -1501,15 +1693,24 @@ msgid "" "this code was ever audited and therefore it's all been ripped out in 2.3. " "You should not unpickle untrusted data in any version of Python." msgstr "" +"pickle の復元は、もはや安全な操作とはみなされません。\n" +"2.2 の :mod:`pickle` には、安全でないクラスの復元を防ぐためのフック (具体的に" +"は :attr:`!__safe_for_unpickling__` 属性) がありましたが、そのコードは一度も" +"監査されていなかったため、2.3 ですべて削除されました。\n" +"Python のどのバージョンでも、信頼できないデータから pickle を復元してはいけま" +"せん。" -#: ../../whatsnew/2.3.rst:836 msgid "" "To reduce the pickling overhead for new-style classes, a new interface for " -"customizing pickling was added using three special methods: :meth:`~object." -"__getstate__`, :meth:`~object.__setstate__`, and :meth:`~object." -"__getnewargs__`. Consult :pep:`307` for the full semantics of these " -"methods." +"customizing pickling was added using three special " +"methods: :meth:`~object.__getstate__`, :meth:`~object.__setstate__`, " +"and :meth:`~object.__getnewargs__`. Consult :pep:`307` for the full " +"semantics of these methods." msgstr "" +"新スタイルクラスの pickle 化のオーバーヘッドを減らすため、3 つの特殊メソッ" +"ド :meth:`~object.__getstate__`、:meth:`~object.__setstate__`、:meth:`~object.__getnewargs__` " +"で pickle 化をカスタマイズする新しいインターフェースが追加されました。\n" +"これらのメソッドの詳しい意味については :pep:`307` を参照してください。" #: ../../whatsnew/2.3.rst:841 msgid "" @@ -1527,9 +1728,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" @@ -1560,29 +1760,31 @@ msgid "" "even indexes::" msgstr "例えば、今やリストの偶数番目要素を簡単に取り出せます::" -#: ../../whatsnew/2.3.rst:871 msgid "" ">>> L = range(10)\n" ">>> L[::2]\n" "[0, 2, 4, 6, 8]" msgstr "" +">>> L = range(10)\n" +">>> L[::2]\n" +"[0, 2, 4, 6, 8]" #: ../../whatsnew/2.3.rst:875 msgid "" "Negative values also work to make a copy of the same list in reverse order::" msgstr "負の値では、同じリストの逆順コピーを作るように動作します::" -#: ../../whatsnew/2.3.rst:877 msgid "" ">>> L[::-1]\n" "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" msgstr "" +">>> L[::-1]\n" +"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" #: ../../whatsnew/2.3.rst:880 msgid "This also works for tuples, arrays, and strings::" msgstr "これはタプル、配列、文字列に対しても使えます::" -#: ../../whatsnew/2.3.rst:882 msgid "" ">>> s='abcd'\n" ">>> s[::2]\n" @@ -1590,6 +1792,11 @@ msgid "" ">>> s[::-1]\n" "'dcba'" msgstr "" +">>> s='abcd'\n" +">>> s[::2]\n" +"'ac'\n" +">>> s[::-1]\n" +"'dcba'" #: ../../whatsnew/2.3.rst:888 msgid "" @@ -1598,14 +1805,12 @@ 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 "" ">>> a = range(3)\n" ">>> a\n" @@ -1614,6 +1819,12 @@ msgid "" ">>> a\n" "[0, 4, 5, 6]" msgstr "" +">>> a = range(3)\n" +">>> a\n" +"[0, 1, 2]\n" +">>> a[1:3] = [4, 5, 6]\n" +">>> a\n" +"[0, 4, 5, 6]" #: ../../whatsnew/2.3.rst:900 msgid "" @@ -1625,7 +1836,6 @@ msgstr "" "トメントの右辺のリストは、置換されるスライスとしての要素数と同数でなければな" "りません::" -#: ../../whatsnew/2.3.rst:904 msgid "" ">>> a = range(4)\n" ">>> a\n" @@ -1640,12 +1850,23 @@ msgid "" " File \"\", line 1, in ?\n" "ValueError: attempt to assign sequence of size 3 to extended slice of size 2" msgstr "" +">>> a = range(4)\n" +">>> a\n" +"[0, 1, 2, 3]\n" +">>> a[::2]\n" +"[0, 2]\n" +">>> a[::2] = [0, -1]\n" +">>> a\n" +"[0, 1, -1, 3]\n" +">>> a[::2] = [0,1,2]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"ValueError: attempt to assign sequence of size 3 to extended slice of size 2" #: ../../whatsnew/2.3.rst:917 msgid "Deletion is more straightforward::" msgstr "削除はもっと素直です::" -#: ../../whatsnew/2.3.rst:919 msgid "" ">>> a = range(4)\n" ">>> a\n" @@ -1656,30 +1877,40 @@ msgid "" ">>> a\n" "[1, 3]" msgstr "" +">>> a = range(4)\n" +">>> a\n" +"[0, 1, 2, 3]\n" +">>> a[::2]\n" +"[0, 2]\n" +">>> del a[::2]\n" +">>> a\n" +"[1, 3]" -#: ../../whatsnew/2.3.rst:928 msgid "" "One can also now pass slice objects to the :meth:`~object.__getitem__` " "methods of the built-in sequences::" msgstr "" +"組み込みシーケンスの :meth:`~object.__getitem__` メソッドにスライスオブジェク" +"トを渡せるようにもなりました。 ::" -#: ../../whatsnew/2.3.rst:931 msgid "" ">>> range(10).__getitem__(slice(0, 5, 2))\n" "[0, 2, 4]" msgstr "" +">>> range(10).__getitem__(slice(0, 5, 2))\n" +"[0, 2, 4]" #: ../../whatsnew/2.3.rst:934 msgid "Or use slice objects directly in subscripts::" msgstr "あるいは直接 slice オブジェクトを添え字に使えます::" -#: ../../whatsnew/2.3.rst:936 msgid "" ">>> range(10)[slice(0, 5, 2)]\n" "[0, 2, 4]" msgstr "" +">>> range(10)[slice(0, 5, 2)]\n" +"[0, 2, 4]" -#: ../../whatsnew/2.3.rst:939 msgid "" "To simplify implementing sequences that support extended slicing, slice " "objects now have a method ``indices(length)`` which, given the length of a " @@ -1689,8 +1920,15 @@ msgid "" "innocuous phrase hides a welter of confusing details!). The method is " "intended to be used like this::" msgstr "" +"拡張スライスに対応するシーケンスを簡単に実装できるよう、スライスオブジェクト" +"に ``indices(length)`` メソッドが追加されました。\n" +"シーケンスの長さを渡すと、:func:`range` にそのまま渡せる ``(start, stop, " +"step)`` タプルを返します。\n" +":meth:`!indices` は、省略されたインデックスや範囲外のインデックスを通常のスラ" +"イスと同じ規則で扱います (この何気ない表現の裏には、ややこしい詳細が山ほど隠" +"れています!)。\n" +"このメソッドは次のように使うことを想定しています。 ::" -#: ../../whatsnew/2.3.rst:946 msgid "" "class FakeSeq:\n" " ...\n" @@ -1703,6 +1941,16 @@ msgid "" " else:\n" " return self.calc_item(i)" msgstr "" +"class FakeSeq:\n" +" ...\n" +" def calc_item(self, i):\n" +" ...\n" +" def __getitem__(self, item):\n" +" if isinstance(item, slice):\n" +" indices = item.indices(len(self))\n" +" return FakeSeq([self.calc_item(i) for i in range(*indices)])\n" +" else:\n" +" return self.calc_item(i)" #: ../../whatsnew/2.3.rst:957 msgid "" @@ -1739,8 +1987,8 @@ msgid "" "A new built-in function :func:`enumerate` was added, as described in " "section :ref:`section-enumerate` of this document." msgstr "" -"新たな組み込み関数 :func:`enumerate` が追加されました。このドキュメントの :" -"ref:`section-enumerate` で述べた通りです。" +"新たな組み込み関数 :func:`enumerate` が追加されました。このドキュメント" +"の :ref:`section-enumerate` で述べた通りです。" #: ../../whatsnew/2.3.rst:976 msgid "" @@ -1818,7 +2066,6 @@ msgstr "" "*default* が指定されていればそれを、そうでなければ :exc:`KeyError` を投げま" "す。::" -#: ../../whatsnew/2.3.rst:1008 msgid "" ">>> d = {1:2}\n" ">>> d\n" @@ -1837,6 +2084,22 @@ msgid "" "{}\n" ">>>" msgstr "" +">>> d = {1:2}\n" +">>> d\n" +"{1: 2}\n" +">>> d.pop(4)\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +"KeyError: 4\n" +">>> d.pop(1)\n" +"2\n" +">>> d.pop(1)\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +"KeyError: 'pop(): dictionary is empty'\n" +">>> d\n" +"{}\n" +">>>" #: ../../whatsnew/2.3.rst:1025 msgid "" @@ -1860,11 +2123,12 @@ msgstr "" "また、 :func:`dict` コンストラクタは小さな辞書を簡単に構築出来るよう、キー" "ワード引数を受け付けるようになりました::" -#: ../../whatsnew/2.3.rst:1034 msgid "" ">>> dict(red=1, blue=2, green=3, black=4)\n" "{'blue': 2, 'black': 4, 'green': 3, 'red': 1}" msgstr "" +">>> dict(red=1, blue=2, green=3, black=4)\n" +"{'blue': 2, 'black': 4, 'green': 3, 'red': 1}" #: ../../whatsnew/2.3.rst:1037 msgid "(Contributed by Just van Rossum.)" @@ -1885,10 +2149,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1044 msgid "" "Most type objects are now callable, so you can use them to create new " -"objects such as functions, classes, and modules. (This means that the :mod:" -"`!new` module can be deprecated in a future Python version, because you can " -"now use the type objects available in the :mod:`types` module.) For example, " -"you can create a new module object with the following code:" +"objects such as functions, classes, and modules. (This means that " +"the :mod:`!new` module can be deprecated in a future Python version, because " +"you can now use the type objects available in the :mod:`types` module.) For " +"example, you can create a new module object with the following code:" msgstr "" "ほとんどの型オブジェクトが今では呼び出し可能であり、なので関数、クラス、モ" "ジュールのようなオブジェクトを新たに構築するのにそれを使えます。 (:mod:`!" @@ -1897,7 +2161,6 @@ msgstr "" "2.6 で実際に撤廃されています。---) 例えば、新規モジュールオブジェクトは以下" "コードで構築出来ます:" -#: ../../whatsnew/2.3.rst:1052 msgid "" ">>> import types\n" ">>> m = types.ModuleType('abc','docstring')\n" @@ -1906,31 +2169,37 @@ msgid "" ">>> m.__doc__\n" "'docstring'" msgstr "" +">>> import types\n" +">>> m = types.ModuleType('abc','docstring')\n" +">>> m\n" +"\n" +">>> m.__doc__\n" +"'docstring'" #: ../../whatsnew/2.3.rst:1059 msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " "features which are in the process of being deprecated. The warning will " "*not* be printed by default. To check for use of features that will be " -"deprecated in the future, supply :option:`-Walways::" -"PendingDeprecationWarning:: <-W>` on the command line or use :func:`warnings." -"filterwarnings`." +"deprecated in the future, supply :option:`-" +"Walways::PendingDeprecationWarning:: <-W>` on the command line or " +"use :func:`warnings.filterwarnings`." msgstr "" "新たな警告 :exc:`PendingDeprecationWarning` が、将来廃止される予定のある機能" "であることを示すために追加されました。この警告はデフォルトで *出力されません" "* 。将来において廃止される予定の機能の使用をチェックするにはコマンドラインか" -"ら :option:`-Walways::PendingDeprecationWarning:: <-W>` を与えるか、 :func:" -"`warnings.filterwarnings` を使います。" +"ら :option:`-Walways::PendingDeprecationWarning:: <-W>` を与える" +"か、 :func:`warnings.filterwarnings` を使います。" #: ../../whatsnew/2.3.rst:1065 msgid "" "The process of deprecating string-based exceptions, as in ``raise \"Error " -"occurred\"``, has begun. Raising a string will now trigger :exc:" -"`PendingDeprecationWarning`." +"occurred\"``, has begun. Raising a string will now " +"trigger :exc:`PendingDeprecationWarning`." msgstr "" "文字列ベースの例外、例えば ``raise \"Error occurred\"`` のようなもの、これは" -"廃止のための過程を開始しています。文字列を例外として投げると :exc:" -"`PendingDeprecationWarning` が発行されます。" +"廃止のための過程を開始しています。文字列を例外として投げる" +"と :exc:`PendingDeprecationWarning` が発行されます。" #: ../../whatsnew/2.3.rst:1069 msgid "" @@ -1941,7 +2210,6 @@ msgstr "" "``None`` を変数名に使うと :exc:`SyntaxWarning` 警告を出すようになっています。" "将来バージョンの Python では ``None`` はキーワードになります。" -#: ../../whatsnew/2.3.rst:1072 msgid "" "The :meth:`!xreadlines` method of file objects, introduced in Python 2.1, is " "no longer necessary because files now behave as their own iterator. :meth:`!" @@ -1951,8 +2219,16 @@ msgid "" "encoding used by the file; Unicode strings written to the file will be " "automatically converted to bytes using the given encoding." msgstr "" +"ファイルが自分自身のイテレータとして振る舞うようになったため、Python 2.1 で追" +"加されたファイルオブジェクトの :meth:`!xreadlines` メソッドは不要になりまし" +"た。\n" +":meth:`!xreadlines` は、ファイルのすべての行を高速にループで処理するために導" +"入されましたが、今では単に ``for line in file_obj`` と書けます。\n" +"また、ファイルオブジェクトには、使用するエンコーディングを示す読み出し専用" +"の :attr:`!encoding` 属性が加わりました。\n" +"ファイルに書き込む Unicode 文字列は、指定されたエンコーディングで自動的にバイ" +"ト列へ変換されます。" -#: ../../whatsnew/2.3.rst:1080 msgid "" "The method resolution order used by new-style classes has changed, though " "you'll only notice the difference if you have a really complicated " @@ -1966,8 +2242,19 @@ msgid "" "pipermail/python-dev/2002-October/029035.html. Samuele Pedroni first pointed " "out the problem and also implemented the fix by coding the C3 algorithm." msgstr "" +"新スタイルクラスのメソッド解決順序が変わりましたが、非常に複雑な継承階層でな" +"ければ違いに気づかないでしょう。\n" +"旧スタイルクラスはこの変更の影響を受けません。\n" +"Python 2.2 はもともとクラスの祖先をトポロジカルソートしていましたが、2.3 は論" +"文 `\"A Monotonic Superclass Linearization for Dylan\" `_ で説明された C3 " +"アルゴリズムを使います。\n" +"変更の動機については、Michele Simionato の記事 :ref:`python_2.3_mro` または " +"https://mail.python.org/pipermail/python-dev/2002-October/029035.html のメッ" +"セージで始まる python-dev のスレッドを読んでください。\n" +"Samuele Pedroni が最初に問題を指摘し、C3 アルゴリズムを実装して修正も行いまし" +"た。" -#: ../../whatsnew/2.3.rst:1093 msgid "" "Python runs multithreaded programs by switching between threads after " "executing N bytecodes. The default value for N has been increased from 10 " @@ -1977,6 +2264,13 @@ msgid "" "number using ``sys.setcheckinterval(N)``. The limit can be retrieved with " "the new :func:`!sys.getcheckinterval` function." msgstr "" +"Python は N 個のバイトコードを実行するたびにスレッドを切り替えて、マルチス" +"レッドのプログラムを実行します。\n" +"N のデフォルト値が 10 から 100 に増え、切り替えのオーバーヘッドが減ることでシ" +"ングルスレッドのアプリケーションが高速になりました。\n" +"一部のマルチスレッドアプリケーションでは応答が遅くなる可能性がありますが、" +"``sys.setcheckinterval(N)`` でこの値を小さく戻せば簡単に対処できます。\n" +"この値は新しい :func:`!sys.getcheckinterval` 関数で取得できます。" #: ../../whatsnew/2.3.rst:1101 msgid "" @@ -1990,32 +2284,39 @@ msgstr "" "型名に前置されるようになりました。例えば、Python 2.2 ではソケットオブジェクト" "を作って :attr:`!__class__` を出力すると、このような出力だったでしょう::" -#: ../../whatsnew/2.3.rst:1106 msgid "" ">>> s = socket.socket()\n" ">>> s.__class__\n" "" msgstr "" +">>> s = socket.socket()\n" +">>> s.__class__\n" +"" #: ../../whatsnew/2.3.rst:1110 msgid "In 2.3, you get this::" msgstr "2.3 ではこうなります::" -#: ../../whatsnew/2.3.rst:1112 msgid "" ">>> s.__class__\n" "" msgstr "" +">>> s.__class__\n" +"" -#: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" -"`~type.__bases__` attributes of new-style classes. There are some " +"been removed: you can now assign to the :attr:`~type.__name__` " +"and :attr:`~type.__bases__` attributes of new-style classes. There are some " "restrictions on what can be assigned to :attr:`!__bases__` along the lines " "of those relating to assigning to an instance's :attr:`~object.__class__` " "attribute." msgstr "" +"旧スタイルクラスと新スタイルクラスの既知の非互換性が一つ解消されました。\n" +"新スタイルクラスの :attr:`~type.__name__` 属性と :attr:`~type.__bases__` 属性" +"に代入できるようになりました。\n" +":attr:`!__bases__` に代入できる値には、インスタンス" +"の :attr:`~object.__class__` 属性への代入と同様の制約があります。" #: ../../whatsnew/2.3.rst:1125 msgid "String Changes" @@ -2035,7 +2336,6 @@ msgstr "" "のサブストリングであれば :const:`True` を返すように変更されました。 *X* が空" "文字列の場合は結果は常に :const:`True` になります。 ::" -#: ../../whatsnew/2.3.rst:1133 msgid "" ">>> 'ab' in 'abcd'\n" "True\n" @@ -2044,6 +2344,12 @@ msgid "" ">>> '' in 'abcd'\n" "True" msgstr "" +">>> 'ab' in 'abcd'\n" +"True\n" +">>> 'ad' in 'abcd'\n" +"False\n" +">>> '' in 'abcd'\n" +"True" #: ../../whatsnew/2.3.rst:1140 msgid "" @@ -2063,7 +2369,6 @@ msgstr "" "を指定する省略可能な引数が追加されています。デフォルトは従来通り全ての空白文" "字を削除します。::" -#: ../../whatsnew/2.3.rst:1147 msgid "" ">>> ' abc '.strip()\n" "'abc'\n" @@ -2075,26 +2380,40 @@ msgid "" "u'\\u4001abc'\n" ">>>" msgstr "" +">>> ' abc '.strip()\n" +"'abc'\n" +">>> '><><><>'.strip('<>')\n" +"'abc'\n" +">>> '><><><>\\n'.strip('<>')\n" +"'abc<><><>\\n'\n" +">>> u'\\u4000\\u4001abc\\u4000'.strip(u'\\u4000')\n" +"u'\\u4001abc'\n" +">>>" #: ../../whatsnew/2.3.rst:1157 msgid "(Suggested by Simon Brunning and implemented by Walter Dörwald.)" msgstr "(Suggested by Simon Brunning and implemented by Walter Dörwald.)" -#: ../../whatsnew/2.3.rst:1159 msgid "" "The :meth:`~str.startswith` and :meth:`~str.endswith` string methods now " "accept negative numbers for the *start* and *end* parameters." msgstr "" +"文字列の :meth:`~str.startswith` メソッドと :meth:`~str.endswith` メソッド" +"が、*start* パラメーターと *end* パラメーターの負の値を受け付けるようになりま" +"した。" -#: ../../whatsnew/2.3.rst:1162 msgid "" "Another new string method is :meth:`~str.zfill`, originally a function in " "the :mod:`string` module. :meth:`~str.zfill` pads a numeric string with " "zeros on the left until it's the specified width. Note that the ``%`` " "operator is still more flexible and powerful than :meth:`~str.zfill`. ::" msgstr "" +"もう一つの新しい文字列メソッドは :meth:`~str.zfill` で、もともと" +"は :mod:`string` モジュールの関数でした。\n" +":meth:`~str.zfill` は、数を表す文字列が指定した幅になるまで左側をゼロで埋めま" +"す。\n" +"ただし、``%`` 演算子の方が :meth:`~str.zfill` よりも柔軟で高機能です。 ::" -#: ../../whatsnew/2.3.rst:1167 msgid "" ">>> '45'.zfill(4)\n" "'0045'\n" @@ -2103,18 +2422,29 @@ msgid "" ">>> 'goofy'.zfill(6)\n" "'0goofy'" msgstr "" +">>> '45'.zfill(4)\n" +"'0045'\n" +">>> '12345'.zfill(4)\n" +"'12345'\n" +">>> 'goofy'.zfill(6)\n" +"'0goofy'" #: ../../whatsnew/2.3.rst:1174 msgid "(Contributed by Walter Dörwald.)" msgstr "(Contributed by Walter Dörwald.)" -#: ../../whatsnew/2.3.rst:1176 msgid "" "A new type object, :class:`!basestring`, has been added. Both 8-bit strings " "and Unicode strings inherit from this type, so ``isinstance(obj, " "basestring)`` will return :const:`True` for either kind of string. It's a " "completely abstract type, so you can't create :class:`!basestring` instances." msgstr "" +"新しい型オブジェクト :class:`!basestring` が加わりました。\n" +"8 ビット文字列と Unicode 文字列の両方がこの型を継承するので、" +"``isinstance(obj, basestring)`` はどちらの文字列に対しても :const:`True` を返" +"します。\n" +"これは完全に抽象的な型なので、:class:`!basestring` のインスタンスは作れませ" +"ん。" #: ../../whatsnew/2.3.rst:1181 msgid "" @@ -2130,19 +2460,20 @@ msgstr "" msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/2.3.rst:1191 msgid "" "The creation of new-style class instances has been made much faster; they're " "now faster than classic classes!" msgstr "" +"新スタイルクラスのインスタンスの作成が大幅に高速化され、旧スタイルクラスより" +"速くなりました!" -#: ../../whatsnew/2.3.rst:1194 msgid "" "The :meth:`~list.sort` method of list objects has been extensively rewritten " "by Tim Peters, and the implementation is significantly faster." msgstr "" +"Tim Peters がリストオブジェクトの :meth:`~list.sort` メソッドを大幅に書き直" +"し、実装がかなり高速になりました。" -#: ../../whatsnew/2.3.rst:1197 msgid "" "Multiplication of large long integers is now much faster thanks to an " "implementation of Karatsuba multiplication, an algorithm that scales better " @@ -2150,34 +2481,48 @@ msgid "" "algorithm. (Original patch by Christopher A. Craig, and significantly " "reworked by Tim Peters.)" msgstr "" +"Karatsuba 乗算が実装され、大きな長整数の乗算が大幅に高速になりました。\n" +"このアルゴリズムは、学校で習う筆算の乗算アルゴリズムに必要な *O*\\ " +"(*n*\\ :sup:`2`) よりも、桁数が増えたときの計算量の増加を抑えられます。\n" +"(最初のパッチは Christopher A. Craig によるもので、Tim Peters が大幅に手を加" +"えました。)" -#: ../../whatsnew/2.3.rst:1202 msgid "" "The ``SET_LINENO`` opcode is now gone. This may provide a small speed " -"increase, depending on your compiler's idiosyncrasies. See section :ref:" -"`23section-other` for a longer explanation. (Removed by Michael Hudson.)" +"increase, depending on your compiler's idiosyncrasies. See " +"section :ref:`23section-other` for a longer explanation. (Removed by Michael " +"Hudson.)" msgstr "" +"``SET_LINENO`` オペコードが削除されました。\n" +"コンパイラーの特性によっては、これにより多少高速になる場合があります。\n" +"詳しい説明は :ref:`23section-other` を参照してください。\n" +"(Michael Hudson が削除しました。)" -#: ../../whatsnew/2.3.rst:1206 msgid "" ":func:`!xrange` objects now have their own iterator, making ``for i in " "xrange(n)`` slightly faster than ``for i in range(n)``. (Patch by Raymond " "Hettinger.)" msgstr "" +":func:`!xrange` オブジェクトが専用のイテレータを持つようになり、``for i in " +"xrange(n)`` は ``for i in range(n)`` よりわずかに高速になりました。\n" +"(Raymond Hettinger によるパッチです。)" -#: ../../whatsnew/2.3.rst:1210 msgid "" "A number of small rearrangements have been made in various hotspots to " "improve performance, such as inlining a function or removing some code. " "(Implemented mostly by GvR, but lots of people have contributed single " "changes.)" msgstr "" +"性能向上のため、頻繁に実行される箇所で関数のインライン化やコードの削除など、" +"多数の小さな変更が行われました。\n" +"(主な実装者は GvR ですが、多くの人が個々の変更を提供しました。)" -#: ../../whatsnew/2.3.rst:1214 msgid "" "The net result of the 2.3 optimizations is that Python 2.3 runs the pystone " "benchmark around 25% faster than Python 2.2." msgstr "" +"2.3 での最適化を総合すると、Python 2.3 は pystone ベンチマークを Python 2.2 " +"より約 25% 高速に実行します。" #: ../../whatsnew/2.3.rst:1221 msgid "New, Improved, and Deprecated Modules" @@ -2227,11 +2572,11 @@ msgid "" "incompatibilities. When upgrading to Python 2.3, if the new interpreter is " "compiled with a new version of the underlying BerkeleyDB library, you will " "almost certainly have to convert your database files to the new version. " -"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :" -"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/" -"scripts` directory. If you've already been using the PyBSDDB package and " -"importing it as :mod:`!bsddb3`, you will have to change your ``import`` " -"statements to import it as :mod:`!bsddb`." +"You can do this fairly easily with the new scripts :file:`db2pickle.py` " +"and :file:`pickle2db.py` which you will find in the " +"distribution's :file:`Tools/scripts` directory. If you've already been " +"using the PyBSDDB package and importing it as :mod:`!bsddb3`, you will have " +"to change your ``import`` statements to import it as :mod:`!bsddb`." msgstr "" "古いバージョンのモジュールは :mod:`!bsddb185` にリネームされて、自動的にはビ" "ルドされません。有効にするには :file:`Modules/Setup` を編集する必要がありま" @@ -2248,8 +2593,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1249 msgid "" "The new :mod:`bz2` module is an interface to the bz2 data compression " -"library. bz2-compressed data is usually smaller than corresponding :mod:" -"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)" +"library. bz2-compressed data is usually smaller than " +"corresponding :mod:`zlib`\\ -compressed data. (Contributed by Gustavo " +"Niemeyer.)" msgstr "" "新規の :mod:`bz2` モジュールは bz2 データ圧縮ライブラリへのインターフェイスで" "す。bz2 圧縮データは普通 :mod:`zlib` 圧縮データよりも小さくなります。 " @@ -2263,7 +2609,6 @@ msgstr "" "標準の日付時刻型が :mod:`datetime` モジュールとして追加されています。詳細はこ" "のドキュメントの下の方に記述してありますのでそちらを参照して下さい。" -#: ../../whatsnew/2.3.rst:1256 msgid "" "The Distutils :class:`!Extension` class now supports an extra constructor " "argument named *depends* for listing additional source files that an " @@ -2272,13 +2617,21 @@ msgid "" "includes the header file :file:`sample.h`, you would create the :class:`!" "Extension` object like this::" msgstr "" +"Distutils の :class:`!Extension` クラスに、拡張モジュールが依存する追加のソー" +"スファイルを列挙するコンストラクター引数 *depends* が加わりました。\n" +"これにより、依存先のファイルが変更されると Distutils がモジュールを再コンパイ" +"ルします。\n" +"例えば :file:`sampmodule.c` がヘッダーファイル :file:`sample.h` をインクルー" +"ドしている場合、:class:`!Extension` オブジェクトは次のように作ります。 ::" -#: ../../whatsnew/2.3.rst:1263 msgid "" "ext = Extension(\"samp\",\n" " sources=[\"sampmodule.c\"],\n" " depends=[\"sample.h\"])" msgstr "" +"ext = Extension(\"samp\",\n" +" sources=[\"sampmodule.c\"],\n" +" depends=[\"sample.h\"])" #: ../../whatsnew/2.3.rst:1267 msgid "" @@ -2288,21 +2641,27 @@ msgstr "" ":file:`sample.h` を修正するとモジュールは再コンパイルされます。 (Contributed " "by Jeremy Hylton.)" -#: ../../whatsnew/2.3.rst:1270 msgid "" -"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :" -"envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` " -"environment variables, using them to override the settings in Python's " -"configuration (contributed by Robert Weber)." +"Other minor changes to Distutils: it now checks for " +"the :envvar:`CC`, :envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, " +"and :envvar:`CPPFLAGS` environment variables, using them to override the " +"settings in Python's configuration (contributed by Robert Weber)." msgstr "" +"Distutils のその他の小さな変更として、環境変" +"数 :envvar:`CC`、:envvar:`CFLAGS`、:envvar:`!" +"CPP`、:envvar:`LDFLAGS`、:envvar:`CPPFLAGS` を確認し、Python の構成設定を上書" +"きするようになりました (Robert Weber による貢献です)。" -#: ../../whatsnew/2.3.rst:1275 msgid "" "Previously the :mod:`doctest` module would only search the docstrings of " "public methods and functions for test cases, but it now also examines " -"private ones as well. The :func:`~doctest.DocTestSuite` function creates a :" -"class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." +"private ones as well. The :func:`~doctest.DocTestSuite` function creates " +"a :class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." msgstr "" +"これまで :mod:`doctest` モジュールは公開メソッドや公開関数の docstring からだ" +"けテストケースを探していましたが、非公開のものも調べるようになりました。\n" +":func:`~doctest.DocTestSuite` 関数は、一連の :mod:`doctest` テストか" +"ら :class:`unittest.TestSuite` オブジェクトを作成します。" #: ../../whatsnew/2.3.rst:1280 msgid "" @@ -2312,23 +2671,33 @@ msgstr "" "新しい関数 ``gc.get_referents(object)`` は *object* により参照されている全て" "のオブジェクトのリストを返します。" -#: ../../whatsnew/2.3.rst:1283 msgid "" "The :mod:`getopt` module gained a new function, :func:`~getopt.gnu_getopt`, " "that supports the same arguments as the existing :func:`~getopt.getopt` " -"function but uses GNU-style scanning mode. The existing :func:`~getopt." -"getopt` stops processing options as soon as a non-option argument is " -"encountered, but in GNU-style mode processing continues, meaning that " -"options and arguments can be mixed. For example::" +"function but uses GNU-style scanning mode. The " +"existing :func:`~getopt.getopt` stops processing options as soon as a non-" +"option argument is encountered, but in GNU-style mode processing continues, " +"meaning that options and arguments can be mixed. For example::" msgstr "" +":mod:`getopt` モジュールに新しい関数 :func:`~getopt.gnu_getopt` が加わりまし" +"た。\n" +"既存の :func:`~getopt.getopt` 関数と同じ引数に対応しますが、GNU 形式の走査" +"モードを使います。\n" +"従来の :func:`~getopt.getopt` はオプションでない引数に出会うとオプションの処" +"理を終了しますが、GNU 形式では処理を続けるため、オプションと引数を混在させら" +"れます。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/2.3.rst:1289 msgid "" ">>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n" "([('-f', 'filename')], ['output', '-v'])\n" ">>> getopt.gnu_getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n" "([('-f', 'filename'), ('-v', '')], ['output'])" msgstr "" +">>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n" +"([('-f', 'filename')], ['output', '-v'])\n" +">>> getopt.gnu_getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n" +"([('-f', 'filename'), ('-v', '')], ['output'])" #: ../../whatsnew/2.3.rst:1294 msgid "(Contributed by Peter Åstrand.)" @@ -2342,20 +2711,22 @@ msgstr "" "モジュール :mod:`grp`, :mod:`pwd`, :mod:`resource` では拡張されたタプルを返す" "ようになりました::" -#: ../../whatsnew/2.3.rst:1299 msgid "" ">>> import grp\n" ">>> g = grp.getgrnam('amk')\n" ">>> g.gr_name, g.gr_gid\n" "('amk', 500)" msgstr "" +">>> import grp\n" +">>> g = grp.getgrnam('amk')\n" +">>> g.gr_name, g.gr_gid\n" +"('amk', 500)" #: ../../whatsnew/2.3.rst:1304 msgid "The :mod:`gzip` module can now handle files exceeding 2 GiB." msgstr "" ":mod:`gzip` モジュールが 2 GiB を超えるファイルを扱えるようになっています。" -#: ../../whatsnew/2.3.rst:1306 msgid "" "The new :mod:`heapq` module contains an implementation of a heap queue " "algorithm. A heap is an array-like data structure that keeps items in a " @@ -2366,16 +2737,27 @@ msgid "" "priorityque.html for more information about the priority queue data " "structure.)" msgstr "" +"新しい :mod:`heapq` モジュールには、ヒープキューアルゴリズムの実装が含まれて" +"います。\n" +"ヒープは配列のようなデータ構造で、すべてのインデックス *k* について " +"``heap[k] <= heap[2*k+1]`` および ``heap[k] <= heap[2*k+2]`` が成り立つよう、" +"要素を部分的に整列して保持します。\n" +"これによって最小の要素を素早く取り除け、ヒープの性質を維持しながら新しい要素" +"を挿入する計算量は *O*\\ (log *n*) です。\n" +"(優先度キューというデータ構造の詳細は https://xlinux.nist.gov/dads//HTML/" +"priorityque.html を参照してください。)" -#: ../../whatsnew/2.3.rst:1314 msgid "" -"The :mod:`heapq` module provides :func:`~heapq.heappush` and :func:`~heapq." -"heappop` functions for adding and removing items while maintaining the heap " -"property on top of some other mutable Python sequence type. Here's an " -"example that uses a Python list::" +"The :mod:`heapq` module provides :func:`~heapq.heappush` " +"and :func:`~heapq.heappop` functions for adding and removing items while " +"maintaining the heap property on top of some other mutable Python sequence " +"type. Here's an example that uses a Python list::" msgstr "" +":mod:`heapq` モジュールは、ほかのミュータブルな Python のシーケンス型を使い、" +"ヒープの性質を保って要素を追加・削除する :func:`~heapq.heappush` 関数" +"と :func:`~heapq.heappop` 関数を提供します。\n" +"Python のリストを使う例を示します。 ::" -#: ../../whatsnew/2.3.rst:1318 msgid "" ">>> import heapq\n" ">>> heap = []\n" @@ -2391,12 +2773,24 @@ msgid "" ">>> heap\n" "[5, 7, 11]" msgstr "" +">>> import heapq\n" +">>> heap = []\n" +">>> for item in [3, 7, 5, 11, 1]:\n" +"... heapq.heappush(heap, item)\n" +"...\n" +">>> heap\n" +"[1, 3, 5, 11, 7]\n" +">>> heapq.heappop(heap)\n" +"1\n" +">>> heapq.heappop(heap)\n" +"3\n" +">>> heap\n" +"[5, 7, 11]" #: ../../whatsnew/2.3.rst:1332 msgid "(Contributed by Kevin O'Connor.)" msgstr "(Contributed by Kevin O'Connor.)" -#: ../../whatsnew/2.3.rst:1334 msgid "" "The IDLE integrated development environment has been updated using the code " "from the IDLEfork project (https://idlefork.sourceforge.net). The most " @@ -2405,6 +2799,13 @@ msgid "" "operations. IDLE's core code has been incorporated into the standard library " "as the :mod:`idlelib` package." msgstr "" +"統合開発環境 IDLE が、IDLEfork プロジェクト (https://" +"idlefork.sourceforge.net) のコードを使って更新されました。\n" +"最も目立つ特徴は、開発中のコードがサブプロセスで実行されるようになったことで" +"す。\n" +"これにより、手動で ``reload()`` を実行する必要がなくなりました。\n" +"IDLE の中核となるコードは、:mod:`idlelib` パッケージとして標準ライブラリに組" +"み込まれました。" #: ../../whatsnew/2.3.rst:1340 msgid "" @@ -2414,7 +2815,6 @@ msgstr "" ":mod:`imaplib` モジュールが IMAP over SSL をサポートするようになりました. " "(Contributed by Piers Lauder and Tino Lange.)" -#: ../../whatsnew/2.3.rst:1343 msgid "" "The :mod:`itertools` contains a number of useful functions for use with " "iterators, inspired by various functions provided by the ML and Haskell " @@ -2425,6 +2825,14 @@ msgid "" "package's reference documentation for details. (Contributed by Raymond " "Hettinger.)" msgstr "" +":mod:`itertools` には、ML や Haskell が提供するさまざまな関数に着想を得た、イ" +"テレータで使える便利な関数が含まれています。\n" +"例えば ``itertools.ifilter(predicate, iterator)`` は、イテレータの要素のうち" +"関数 :func:`!predicate` が :const:`True` を返すものをすべて返し、" +"``itertools.repeat(obj, N)`` は ``obj`` を *N* 回返します。\n" +"このモジュールにはほかにも多くの関数があります。\n" +"詳細はパッケージのリファレンス文書を参照してください。\n" +"(Raymond Hettinger による貢献です。)" #: ../../whatsnew/2.3.rst:1352 msgid "" @@ -2437,11 +2845,11 @@ msgid "" "Hettinger.)" msgstr "" ":mod:`math` module の 2 つの新規関数 ``degrees(rads)`` と ``radians(degs)`` " -"は、ラジアンと度の間の変換を行います。 :mod:`math` モジュールの :func:`math." -"sin` や :func:`math.cos` などは常にラジアンでの入力が必要です。 :func:`math." -"log` 関数には底を指定するオプショナルの *base* 引数が追加されていて、 ``e`` " -"と ``10`` でない底の対数を計算するのが簡単になりました。 (Contributed by " -"Raymond Hettinger.)" +"は、ラジアンと度の間の変換を行います。 :mod:`math` モジュール" +"の :func:`math.sin` や :func:`math.cos` などは常にラジアンでの入力が必要で" +"す。 :func:`math.log` 関数には底を指定するオプショナルの *base* 引数が追加さ" +"れていて、 ``e`` と ``10`` でない底の対数を計算するのが簡単になりました。 " +"(Contributed by Raymond Hettinger.)" #: ../../whatsnew/2.3.rst:1359 msgid "" @@ -2452,24 +2860,32 @@ msgid "" "Denis S. Otkidach.)" msgstr "" -#: ../../whatsnew/2.3.rst:1365 msgid "" "In the :mod:`os` module, the :func:`!\\*stat` family of functions can now " "report fractions of a second in a timestamp. Such time stamps are " "represented as floats, similar to the value returned by :func:`time.time`." msgstr "" +":mod:`os` モジュールの :func:`!\\*stat` 系の関数が、タイムスタンプの秒未満の" +"部分を返せるようになりました。\n" +"このようなタイムスタンプは、:func:`time.time` が返す値と同様に浮動小数点数で" +"表します。" -#: ../../whatsnew/2.3.rst:1369 msgid "" "During testing, it was found that some applications will break if time " "stamps are floats. For compatibility, when using the tuple interface of " "the :class:`~os.stat_result` time stamps will be represented as integers. " "When using named fields (a feature first introduced in Python 2.2), time " -"stamps are still represented as integers, unless :func:`!os." -"stat_float_times` is invoked to enable float return values::" +"stamps are still represented as integers, unless :func:`!" +"os.stat_float_times` is invoked to enable float return values::" msgstr "" +"テストの結果、タイムスタンプが浮動小数点数だと正常に動作しなくなるアプリケー" +"ションがあることが分かりました。\n" +"互換性のため、:class:`~os.stat_result` のタプルインターフェースを使う場合、タ" +"イムスタンプは整数で表します。\n" +"名前付きフィールド (Python 2.2 で導入された機能) を使う場合も、:func:`!" +"os.stat_float_times` を呼んで浮動小数点数を返すようにしない限り、タイムスタン" +"プは引き続き整数で表します。 ::" -#: ../../whatsnew/2.3.rst:1376 msgid "" ">>> os.stat(\"/tmp\").st_mtime\n" "1034791200\n" @@ -2477,18 +2893,27 @@ msgid "" ">>> os.stat(\"/tmp\").st_mtime\n" "1034791200.6335014" msgstr "" +">>> os.stat(\"/tmp\").st_mtime\n" +"1034791200\n" +">>> os.stat_float_times(True)\n" +">>> os.stat(\"/tmp\").st_mtime\n" +"1034791200.6335014" #: ../../whatsnew/2.3.rst:1382 msgid "In Python 2.4, the default will change to always returning floats." msgstr "Python 2.4 では、浮動小数点数を返すのがデフォルトとなります。" -#: ../../whatsnew/2.3.rst:1384 msgid "" "Application developers should enable this feature only if all their " "libraries work properly when confronted with floating-point time stamps, or " "if they use the tuple API. If used, the feature should be activated on an " "application level instead of trying to enable it on a per-use basis." msgstr "" +"アプリケーション開発者は、使用するすべてのライブラリが浮動小数点数のタイムス" +"タンプを正しく扱える場合、またはタプル API を使っている場合に限り、この機能を" +"有効にしてください。\n" +"使用する場合は、個々の使用箇所で有効にしようとせず、アプリケーション全体で有" +"効にしてください。" #: ../../whatsnew/2.3.rst:1389 msgid "" @@ -2502,7 +2927,6 @@ msgstr "" "例メッセージを生成します。詳細はこのドキュメントの続くセクションを参照して下" "さい。" -#: ../../whatsnew/2.3.rst:1394 msgid "" "The old and never-documented :mod:`!linuxaudiodev` module has been " "deprecated, and a new version named :mod:`!ossaudiodev` has been added. The " @@ -2510,6 +2934,12 @@ msgid "" "other than Linux, and the interface has also been tidied and brought up to " "date in various ways. (Contributed by Greg Ward and Nicholas FitzRoy-Dale.)" msgstr "" +"古く、一度も文書化されなかった :mod:`!linuxaudiodev` モジュールが非推奨とな" +"り、新しい版が :mod:`!ossaudiodev` という名前で追加されました。\n" +"OSS サウンドドライバーは Linux 以外のプラットフォームでも使えるため、モジュー" +"ル名が変更されました。\n" +"インターフェースにもさまざまな整理や更新が行われています。\n" +"(Greg Ward と Nicholas FitzRoy-Dale による貢献です。)" #: ../../whatsnew/2.3.rst:1400 msgid "" @@ -2523,16 +2953,19 @@ msgstr "" "Windows の OS バージョンや Linux ディストリビューションのバージョンなどを取得" "できます。(Contributed by Marc-André Lemburg.)" -#: ../../whatsnew/2.3.rst:1405 msgid "" "The parser objects provided by the :mod:`pyexpat ` module " "can now optionally buffer character data, resulting in fewer calls to your " "character data handler and therefore faster performance. Setting the parser " -"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute to :" -"const:`True` will enable buffering." +"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute " +"to :const:`True` will enable buffering." msgstr "" +":mod:`pyexpat ` モジュールが提供するパーサーオブジェクト" +"で、必要に応じて文字データをバッファリングできるようになりました。\n" +"これにより、文字データハンドラーの呼び出し回数が減り、性能が向上します。\n" +"パーサーオブジェクトの :attr:`~xml.parsers.expat.xmlparser.buffer_text` 属性" +"を :const:`True` にすると、バッファリングが有効になります。" -#: ../../whatsnew/2.3.rst:1410 msgid "" "The ``sample(population, k)`` function was added to the :mod:`random` " "module. *population* is a sequence or :class:`!xrange` object containing " @@ -2540,8 +2973,14 @@ msgid "" "elements from the population without replacing chosen elements. *k* can be " "any value up to ``len(population)``. For example::" msgstr "" +":mod:`random` モジュールに ``sample(population, k)`` 関数が加わりました。\n" +"*population* は母集団の要素を含むシーケンスまたは :class:`!xrange` オブジェク" +"トです。\n" +":func:`~random.sample` は母集団から *k* 個の要素を、選んだ要素を母集団に戻さ" +"ずに選びます。\n" +"*k* には ``len(population)`` 以下の値を指定できます。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/2.3.rst:1416 msgid "" ">>> days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'St', 'Sn']\n" ">>> random.sample(days, 3) # Choose 3 elements\n" @@ -2560,6 +2999,21 @@ msgid "" "10000\n" "[3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]" msgstr "" +">>> days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'St', 'Sn']\n" +">>> random.sample(days, 3) # 3 個の要素を選ぶ\n" +"['St', 'Sn', 'Th']\n" +">>> random.sample(days, 7) # 7 個の要素を選ぶ\n" +"['Tu', 'Th', 'Mo', 'We', 'St', 'Fr', 'Sn']\n" +">>> random.sample(days, 7) # もう一度 7 個選ぶ\n" +"['We', 'Mo', 'Sn', 'Fr', 'Tu', 'St', 'Th']\n" +">>> random.sample(days, 8) # 8 個は選べない\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +" File \"random.py\", line 414, in sample\n" +" raise ValueError, \"sample larger than population\"\n" +"ValueError: sample larger than population\n" +">>> random.sample(xrange(1,10000,2), 10) # 10000 未満の奇数を 10 個選ぶ\n" +"[3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]" #: ../../whatsnew/2.3.rst:1432 msgid "" @@ -2575,14 +3029,15 @@ msgstr "" msgid "(All changes contributed by Raymond Hettinger.)" msgstr "(All changes contributed by Raymond Hettinger.)" -#: ../../whatsnew/2.3.rst:1438 msgid "" -"The :mod:`readline` module also gained a number of new functions: :func:" -"`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " +"The :mod:`readline` module also gained a number of new " +"functions: :func:`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " "and :func:`~readline.redisplay`." msgstr "" +":mod:`readline` モジュールに" +"も、:func:`~readline.get_history_item`、:func:`~readline.get_current_history_length`、:func:`~readline.redisplay` " +"という新しい関数が加わりました。" -#: ../../whatsnew/2.3.rst:1442 msgid "" "The :mod:`!rexec` and :mod:`!Bastion` modules have been declared dead, and " "attempts to import them will fail with a :exc:`RuntimeError`. New-style " @@ -2591,20 +3046,33 @@ msgid "" "them or time to do so. If you have applications using :mod:`!rexec`, " "rewrite them to use something else." msgstr "" +":mod:`!rexec` モジュールと :mod:`!Bastion` モジュールは廃止となり、インポート" +"しようとすると :exc:`RuntimeError` で失敗します。\n" +"新スタイルクラスによって、:mod:`!rexec` が提供する制限付き実行環境から抜け出" +"す新たな方法が生まれましたが、修正に関心を持つ人も、その時間がある人もいませ" +"ん。\n" +":mod:`!rexec` を使うアプリケーションは、ほかのものを使うように書き直してくだ" +"さい。" -#: ../../whatsnew/2.3.rst:1448 msgid "" "(Sticking with Python 2.2 or 2.1 will not make your applications any safer " "because there are known bugs in the :mod:`!rexec` module in those versions. " "To repeat: if you're using :mod:`!rexec`, stop using it immediately.)" msgstr "" +"(Python 2.2 や 2.1 を使い続けてもアプリケーションが安全になるわけではありませ" +"ん。\n" +"それらのバージョンの :mod:`!rexec` モジュールにも既知のバグがあります。\n" +"繰り返しますが、:mod:`!rexec` を使っているなら、直ちに使用をやめてください。)" -#: ../../whatsnew/2.3.rst:1452 msgid "" "The :mod:`!rotor` module has been deprecated because the algorithm it uses " "for encryption is not believed to be secure. If you need encryption, use " "one of the several AES Python modules that are available separately." msgstr "" +":mod:`!rotor` モジュールは、使用している暗号化アルゴリズムが安全とは考えられ" +"ないため、非推奨となりました。\n" +"暗号化が必要なら、別途入手できる Python 用 AES モジュールのいずれかを使ってく" +"ださい。" #: ../../whatsnew/2.3.rst:1456 msgid "" @@ -2614,12 +3082,13 @@ msgstr "" ":mod:`shutil` モジュールに ``move(src, dest)`` が追加されており、これはファイ" "ルまたはディレクトリを新しい場所へ再帰的に移動します。" -#: ../../whatsnew/2.3.rst:1459 msgid "" -"Support for more advanced POSIX signal handling was added to the :mod:" -"`signal` but then removed again as it proved impossible to make it work " -"reliably across platforms." +"Support for more advanced POSIX signal handling was added to " +"the :mod:`signal` but then removed again as it proved impossible to make it " +"work reliably across platforms." msgstr "" +":mod:`signal` に高度な POSIX シグナル処理のサポートが加わりましたが、プラット" +"フォームによらず確実に動作させることができないと分かり、再び削除されました。" #: ../../whatsnew/2.3.rst:1463 msgid "" @@ -2630,8 +3099,8 @@ msgid "" msgstr "" ":mod:`socket` モジュールがタイムアウトをサポートするようになりました。ソケッ" "トオブジェクトの ``settimeout(t)`` メソッドに *t* 秒を与えることで行えます。" -"これに続くソケット操作が *t* 秒を超えて完了しない場合には操作は中断し、 :exc:" -"`socket.timeout` 例外を投げます。" +"これに続くソケット操作が *t* 秒を超えて完了しない場合には操作は中断" +"し、 :exc:`socket.timeout` 例外を投げます。" #: ../../whatsnew/2.3.rst:1468 msgid "" @@ -2654,33 +3123,42 @@ msgstr "" "Windows での :mod:`socket` モジュールの Secure Sockets Layer (SSL) サポート" "が始まりました。" -#: ../../whatsnew/2.3.rst:1477 msgid "" "The value of the C :c:macro:`!PYTHON_API_VERSION` macro is now exposed at " "the Python level as ``sys.api_version``. The current exception can be " "cleared by calling the new :func:`!sys.exc_clear` function." msgstr "" +"C の :c:macro:`!PYTHON_API_VERSION` マクロの値が、Python レベルでも " +"``sys.api_version`` として公開されました。\n" +"新しい :func:`!sys.exc_clear` 関数を呼び出すと、現在の例外を消去できます。" #: ../../whatsnew/2.3.rst:1481 msgid "" -"The new :mod:`tarfile` module allows reading from and writing to :program:" -"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" +"The new :mod:`tarfile` module allows reading from and writing " +"to :program:`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" msgstr "" "新モジュール :mod:`tarfile` で :program:`tar` 形式のアーカイブファイルの読み" "書きが出来ます。 (Contributed by Lars Gustäbel.)" -#: ../../whatsnew/2.3.rst:1484 msgid "" "The new :mod:`textwrap` module contains functions for wrapping strings " "containing paragraphs of text. The ``wrap(text, width)`` function takes a " "string and returns a list containing the text split into lines of no more " "than the chosen width. The ``fill(text, width)`` function returns a single " "string, reformatted to fit into lines no longer than the chosen width. (As " -"you can guess, :func:`~textwrap.fill` is built on top of :func:`~textwrap." -"wrap`. For example::" +"you can guess, :func:`~textwrap.fill` is built on top " +"of :func:`~textwrap.wrap`. For example::" msgstr "" +"新しい :mod:`textwrap` モジュールには、テキストの段落を含む文字列を折り返す関" +"数が含まれています。\n" +"``wrap(text, width)`` 関数は文字列を受け取り、指定した幅以下の行に分割したテ" +"キストのリストを返します。\n" +"``fill(text, width)`` 関数は、各行が指定した幅以下に収まるように整形した一つ" +"の文字列を返します。\n" +"(想像のとおり、:func:`~textwrap.fill` は :func:`~textwrap.wrap` をもとに作ら" +"れています。)\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/2.3.rst:1491 msgid "" ">>> import textwrap\n" ">>> paragraph = \"Not a whit, we defy augury: ... more text ...\"\n" @@ -2697,45 +3175,83 @@ msgid "" "it will come: the readiness is all.\n" ">>>" msgstr "" +">>> import textwrap\n" +">>> paragraph = \"Not a whit, we defy augury: ... more text ...\"\n" +">>> textwrap.wrap(paragraph, 60)\n" +"[\"Not a whit, we defy augury: there's a special providence in\",\n" +" \"the fall of a sparrow. If it be now, 'tis not to come; if it\",\n" +" ...]\n" +">>> print textwrap.fill(paragraph, 35)\n" +"Not a whit, we defy augury: there's\n" +"a special providence in the fall of\n" +"a sparrow. If it be now, 'tis not\n" +"to come; if it be not to come, it\n" +"will be now; if it be not now, yet\n" +"it will come: the readiness is all.\n" +">>>" -#: ../../whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " -"actually implements the text wrapping strategy. Both the :class:`~textwrap." -"TextWrapper` class and the :func:`~textwrap.wrap` and :func:`~textwrap.fill` " -"functions support a number of additional keyword arguments for fine-tuning " -"the formatting; consult the module's documentation for details. (Contributed " -"by Greg Ward.)" -msgstr "" +"actually implements the text wrapping strategy. Both " +"the :class:`~textwrap.TextWrapper` class and the :func:`~textwrap.wrap` " +"and :func:`~textwrap.fill` functions support a number of additional keyword " +"arguments for fine-tuning the formatting; consult the module's documentation " +"for details. (Contributed by Greg Ward.)" +msgstr "" +"このモジュールには、実際の折り返し処理を実装し" +"た :class:`~textwrap.TextWrapper` クラスも含まれています。\n" +":class:`~textwrap.TextWrapper` クラスと :func:`~textwrap.wrap` 関" +"数、:func:`~textwrap.fill` 関数は、整形を細かく調整するための追加のキーワード" +"引数に対応しています。\n" +"詳細はモジュールの文書を参照してください。\n" +"(Greg Ward による貢献です。)" + +msgid "" +"The :mod:`!thread` and :mod:`threading` modules now have companion " +"modules, :mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-" +"nothing implementation of the :mod:`!thread` module's interface for " +"platforms where threads are not supported. The intention is to simplify " +"thread-aware modules (ones that *don't* rely on threads to run) by putting " +"the following code at the top::" +msgstr "" +":mod:`!thread` モジュールと :mod:`threading` モジュールに、対応する :mod:`!" +"dummy_thread` モジュールと :mod:`!dummy_threading` モジュールが加わりまし" +"た。\n" +"これらはスレッドをサポートしないプラットフォーム向けに、:mod:`!thread` モ" +"ジュールのインターフェースを何もしない形で実装しています。\n" +"目的は、スレッドに対応するものの、動作にはスレッドを *必要としない* モジュー" +"ルを、先頭に次のコードを置くだけで簡単に書けるようにすることです。 ::" -#: ../../whatsnew/2.3.rst:1512 -msgid "" -"The :mod:`!thread` and :mod:`threading` modules now have companion modules, :" -"mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-nothing " -"implementation of the :mod:`!thread` module's interface for platforms where " -"threads are not supported. The intention is to simplify thread-aware " -"modules (ones that *don't* rely on threads to run) by putting the following " -"code at the top::" -msgstr "" - -#: ../../whatsnew/2.3.rst:1519 msgid "" "try:\n" " import threading as _threading\n" "except ImportError:\n" " import dummy_threading as _threading" msgstr "" +"try:\n" +" import threading as _threading\n" +"except ImportError:\n" +" import dummy_threading as _threading" -#: ../../whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " -"clear that the module being used is not necessarily the actual :mod:" -"`threading` module. Code can call functions and use classes in :mod:`!" -"_threading` whether or not threads are supported, avoiding an :keyword:`if` " -"statement and making the code slightly clearer. This module will not " -"magically make multithreaded code run without threads; code that waits for " -"another thread to return or to do something will simply hang forever." -msgstr "" +"clear that the module being used is not necessarily the " +"actual :mod:`threading` module. Code can call functions and use classes " +"in :mod:`!_threading` whether or not threads are supported, avoiding " +"an :keyword:`if` statement and making the code slightly clearer. This " +"module will not magically make multithreaded code run without threads; code " +"that waits for another thread to return or to do something will simply hang " +"forever." +msgstr "" +"この例では、使用するモジュールが本物の :mod:`threading` モジュールとは限らな" +"いことを明示するため、モジュール名を :mod:`!_threading` としています。\n" +"スレッドがサポートされているかどうかにかかわらず :mod:`!_threading` の関数や" +"クラスを使えるので、:keyword:`if` 文が不要になり、コードが少し明快になりま" +"す。\n" +"このモジュールは、マルチスレッドのコードをスレッドなしで動かす魔法ではありま" +"せん。\n" +"別のスレッドが返ることや何かを行うことを待つコードは、単に永久に停止したまま" +"になります。" #: ../../whatsnew/2.3.rst:1532 msgid "" @@ -2767,7 +3283,6 @@ msgstr "" "ビット文字列を Unicode に変換するのと :func:`!unicode` 関数を使うのとでいずれ" "が高速なのかを把握するための短い例をお見せします::" -#: ../../whatsnew/2.3.rst:1545 msgid "" "import timeit\n" "\n" @@ -2782,6 +3297,18 @@ msgid "" "# [0.36831796169281006, 0.37441694736480713, 0.35304892063140869]\n" "# [0.17574405670166016, 0.18193507194519043, 0.17565798759460449]" msgstr "" +"import timeit\n" +"\n" +"timer1 = timeit.Timer('unicode(\"abc\")')\n" +"timer2 = timeit.Timer('\"abc\" + u\"\"')\n" +"\n" +"# 3 回計測する\n" +"print timer1.repeat(repeat=3, number=100000)\n" +"print timer2.repeat(repeat=3, number=100000)\n" +"\n" +"# 私のノートパソコンでの出力:\n" +"# [0.36831796169281006, 0.37441694736480713, 0.35304892063140869]\n" +"# [0.17574405670166016, 0.18193507194519043, 0.17565798759460449]" #: ../../whatsnew/2.3.rst:1558 msgid "" @@ -2801,9 +3328,9 @@ msgid "" "a command, passing it to the correct thread, and waiting for the results. " "Other interfaces can't be handled automatically but :mod:`!Tkinter` will now " "raise an exception on such an access so that you can at least find out about " -"the problem. See https://mail.python.org/pipermail/python-dev/2002-" -"December/031107.html for a more detailed explanation of this change. " -"(Implemented by Martin von Löwis.)" +"the problem. See https://mail.python.org/pipermail/python-dev/2002-December/" +"031107.html for a more detailed explanation of this change. (Implemented by " +"Martin von Löwis.)" msgstr "" ":mod:`!Tkinter` モジュールがスレッドを有効化した Tcl で動作するようになりまし" "た。Tcl のスレッドモデルは、ウィジットはそれが作られたスレッドからのみアクセ" @@ -2827,9 +3354,9 @@ msgid "" msgstr "" ":mod:`!_tkinter` を介した Tcl メソッド呼び出しは今では文字列だけを返すのでは" "ありません。代わりに Tcl は対応する Python の等価なオブジェクトに変換されたオ" -"ブジェクトを返します。Python に等価なものがなければ :class:`!_tkinter." -"Tcl_Obj` で包んで返します。この振る舞いは :class:`!tkapp` オブジェクトの :" -"meth:`!wantobjects` メソッドで制御出来ます。" +"ブジェクトを返します。Python に等価なものがなければ :class:`!" +"_tkinter.Tcl_Obj` で包んで返します。この振る舞いは :class:`!tkapp` オブジェク" +"トの :meth:`!wantobjects` メソッドで制御出来ます。" #: ../../whatsnew/2.3.rst:1578 msgid "" @@ -2853,11 +3380,12 @@ msgstr "" "ジェクトを生成する前に :mod:`!Tkinter` モジュールの :attr:`!wantobjects` 変数" "に偽をセットしてください::" -#: ../../whatsnew/2.3.rst:1587 msgid "" "import Tkinter\n" "Tkinter.wantobjects = 0" msgstr "" +"import Tkinter\n" +"Tkinter.wantobjects = 0" #: ../../whatsnew/2.3.rst:1590 msgid "Any breakage caused by this change should be reported as a bug." @@ -2881,15 +3409,15 @@ msgstr "" #: ../../whatsnew/2.3.rst:1598 msgid "" "Adding the mix-in as a superclass provides the full dictionary interface " -"whenever the class defines :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" +"whenever the class " +"defines :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. For example::" msgstr "" -"クラスがメソッド :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :" -"meth:`~object.__delitem__`, :meth:`!keys` を定義している場合にはいつでも、" -"スーパークラスとして mix-in を追加すると完全な辞書インターフェースになりま" -"す。例えば::" +"クラスがメソッ" +"ド :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, :meth:`!" +"keys` を定義している場合にはいつでも、スーパークラスとして mix-in を追加する" +"と完全な辞書インターフェースになります。例えば::" -#: ../../whatsnew/2.3.rst:1602 msgid "" ">>> import UserDict\n" ">>> class SeqDict(UserDict.DictMixin):\n" @@ -2928,18 +3456,58 @@ msgid "" " 'iterkeys', 'itervalues', 'keylist', 'keys', 'pop', 'popitem',\n" " 'setdefault', 'update', 'valuelist', 'values']" msgstr "" +">>> import UserDict\n" +">>> class SeqDict(UserDict.DictMixin):\n" +"... \"\"\"リストを使って実装した辞書風のオブジェクト。\"\"\"\n" +"... def __init__(self):\n" +"... self.keylist = []\n" +"... self.valuelist = []\n" +"... def __getitem__(self, key):\n" +"... try:\n" +"... i = self.keylist.index(key)\n" +"... except ValueError:\n" +"... raise KeyError\n" +"... return self.valuelist[i]\n" +"... def __setitem__(self, key, value):\n" +"... try:\n" +"... i = self.keylist.index(key)\n" +"... self.valuelist[i] = value\n" +"... except ValueError:\n" +"... self.keylist.append(key)\n" +"... self.valuelist.append(value)\n" +"... def __delitem__(self, key):\n" +"... try:\n" +"... i = self.keylist.index(key)\n" +"... except ValueError:\n" +"... raise KeyError\n" +"... self.keylist.pop(i)\n" +"... self.valuelist.pop(i)\n" +"... def keys(self):\n" +"... return list(self.keylist)\n" +"...\n" +">>> s = SeqDict()\n" +">>> dir(s) # ほかの辞書メソッドも実装されていることを確認\n" +"['__cmp__', '__contains__', '__delitem__', '__doc__', '__getitem__',\n" +" '__init__', '__iter__', '__len__', '__module__', '__repr__',\n" +" '__setitem__', 'clear', 'get', 'has_key', 'items', 'iteritems',\n" +" 'iterkeys', 'itervalues', 'keylist', 'keys', 'pop', 'popitem',\n" +" 'setdefault', 'update', 'valuelist', 'values']" #: ../../whatsnew/2.3.rst:1639 msgid "(Contributed by Raymond Hettinger.)" msgstr "(Contributed by Raymond Hettinger.)" -#: ../../whatsnew/2.3.rst:1641 msgid "" "The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output " -"in a particular encoding by providing an optional encoding argument to the :" -"meth:`~xml.dom.minidom.Node.toxml` and :meth:`~xml.dom.minidom.Node." -"toprettyxml` methods of DOM nodes." -msgstr "" +"in a particular encoding by providing an optional encoding argument to " +"the :meth:`~xml.dom.minidom.Node.toxml` " +"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of DOM nodes." +msgstr "" +":mod:`xml.dom.minidom` の DOM 実装で、DOM ノード" +"の :meth:`~xml.dom.minidom.Node.toxml` メソッド" +"と :meth:`~xml.dom.minidom.Node.toprettyxml` メソッドに省略可能なエンコーディ" +"ング引数を渡すと、指定したエンコーディングの XML を出力できるようになりまし" +"た。" #: ../../whatsnew/2.3.rst:1645 msgid "" @@ -2997,11 +3565,11 @@ msgid "" "URL is ASCII only." msgstr "" ":mod:`socket` モジュールも、C ライブラリに渡す前に Unicode ホスト名を ACE " -"バージョンに透過的に変換するように拡張されています。 :mod:`!httplib` や :mod:" -"`ftplib` のようなホスト名を扱うモジュールも Unicode ホスト名をサポートしてい" -"ます; :mod:`!httplib` は HTTP ``Host`` ヘッダをドメイン名の ACE 版を使って送" -"信します。 :mod:`urllib` は URL の ``path`` 部分が ASCII のみである限り、非 " -"ASCII ホスト名を持つ Unicode URL をサポートします" +"バージョンに透過的に変換するように拡張されています。 :mod:`!httplib` " +"や :mod:`ftplib` のようなホスト名を扱うモジュールも Unicode ホスト名をサポー" +"トしています; :mod:`!httplib` は HTTP ``Host`` ヘッダをドメイン名の ACE 版を" +"使って送信します。 :mod:`urllib` は URL の ``path`` 部分が ASCII のみである限" +"り、非 ASCII ホスト名を持つ Unicode URL をサポートします" #: ../../whatsnew/2.3.rst:1672 msgid "" @@ -3017,9 +3585,9 @@ msgstr "日付時刻型" #: ../../whatsnew/2.3.rst:1681 msgid "" -"Date and time types suitable for expressing timestamps were added as the :" -"mod:`datetime` module. The types don't support different calendars or many " -"fancy features, and just stick to the basics of representing time." +"Date and time types suitable for expressing timestamps were added as " +"the :mod:`datetime` module. The types don't support different calendars or " +"many fancy features, and just stick to the basics of representing time." msgstr "" "タイムスタンプとして使うのに相応しい日付と時刻の型が :mod:`datetime` モジュー" "ルとして追加されました。これら型は異なるカレンダであるとか多くの洒落た機能を" @@ -3030,8 +3598,8 @@ msgid "" "The three primary types are: :class:`~datetime.date`, representing a day, " "month, and year; :class:`~datetime.time`, consisting of hour, minute, and " "second; and :class:`~datetime.datetime`, which contains all the attributes " -"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also a :" -"class:`~datetime.timedelta` class representing differences between two " +"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also " +"a :class:`~datetime.timedelta` class representing differences between two " "points in time, and time zone logic is implemented by classes inheriting " "from the abstract :class:`~datetime.tzinfo` class." msgstr "" @@ -3042,22 +3610,27 @@ msgstr "" "ゾーンのロジックは抽象クラス :class:`~datetime.tzinfo` から派生したクラスによ" "り実装されます。" -#: ../../whatsnew/2.3.rst:1692 msgid "" -"You can create instances of :class:`~datetime.date` and :class:`~datetime." -"time` by either supplying keyword arguments to the appropriate constructor, " -"e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a " -"number of class methods. For example, the :meth:`~datetime.date.today` " -"class method returns the current local date." +"You can create instances of :class:`~datetime.date` " +"and :class:`~datetime.time` by either supplying keyword arguments to the " +"appropriate constructor, e.g. ``datetime.date(year=1972, month=10, " +"day=15)``, or by using one of a number of class methods. For example, " +"the :meth:`~datetime.date.today` class method returns the current local date." msgstr "" +":class:`~datetime.date` と :class:`~datetime.time` のインスタンスは、" +"``datetime.date(year=1972, month=10, day=15)`` のようにコンストラクターへキー" +"ワード引数を渡すか、用意されたいずれかのクラスメソッドを使って作成できま" +"す。\n" +"例えばクラスメソッド :meth:`~datetime.date.today` は、現在のローカルな日付を" +"返します。" #: ../../whatsnew/2.3.rst:1698 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 "" @@ -3071,12 +3644,14 @@ msgid "" "'2002 30 Dec'" msgstr "" -#: ../../whatsnew/2.3.rst:1710 msgid "" "The :meth:`~datetime.datetime.replace` method allows modifying one or more " "fields of a :class:`~datetime.date` or :class:`~datetime.datetime` " "instance, returning a new instance::" msgstr "" +":meth:`~datetime.datetime.replace` メソッドは、:class:`~datetime.date` また" +"は :class:`~datetime.datetime` インスタンスの一つ以上のフィールドを変更した、" +"新しいインスタンスを返します。 ::" #: ../../whatsnew/2.3.rst:1713 msgid "" @@ -3091,23 +3666,23 @@ msgstr "" #: ../../whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " -"the same as that of :meth:`~datetime.datetime.isoformat`). :class:" -"`~datetime.date` and :class:`~datetime.datetime` instances can be subtracted " -"from each other, and added to :class:`~datetime.timedelta` instances. The " -"largest missing feature is that there's no standard library support for " -"parsing strings and getting back a :class:`~datetime.date` or :class:" -"`~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` が追加されています。---)" +"the same as that " +"of :meth:`~datetime.datetime.isoformat`). :class:`~datetime.date` " +"and :class:`~datetime.datetime` instances can be subtracted from each other, " +"and added to :class:`~datetime.timedelta` instances. The largest missing " +"feature is that there's no standard library support for parsing strings and " +"getting back a :class:`~datetime.date` or :class:`~datetime.datetime`." +msgstr "" +"インスタンスは比較可能で、ハッシュ出来、文字列に変換出来ます (結果" +"は :meth:`~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 "" @@ -3131,10 +3706,10 @@ msgid "" msgstr "" ":mod:`getopt` モジュールはコマンドライン引数の単純な解析を提供しています。新" "規に追加された :mod:`optparse` モジュール (元々 Optik と呼ばれていたもので" -"す) は Unix の慣習に従ったもっと念入りなコマンドライン解析を行い、自動的に :" -"option:`!--help` のための出力をし、異なったオプションに対して異なったアクショ" -"ンを実行出来ます。 (---訳注: 2.7 以降は :mod:`optparse` よりも新しい :mod:" -"`argparse` を使ってください。---)" +"す) は Unix の慣習に従ったもっと念入りなコマンドライン解析を行い、自動的" +"に :option:`!--help` のための出力をし、異なったオプションに対して異なったアク" +"ションを実行出来ます。 (---訳注: 2.7 以降は ``optparse`` よりも新しい " +"``argparse`` を使ってください。---)" #: ../../whatsnew/2.3.rst:1742 msgid "" @@ -3144,7 +3719,6 @@ msgstr "" ":class:`~optparse.OptionParser` インスタンスを作ることから始め、プログラムの" "オプションがどんなであるかそれに対して教えてやります::" -#: ../../whatsnew/2.3.rst:1745 msgid "" "import sys\n" "from optparse import OptionParser\n" @@ -3157,21 +3731,33 @@ msgid "" " action='store', type='int', dest='length',\n" " help='set maximum length of output')" msgstr "" +"import sys\n" +"from optparse import OptionParser\n" +"\n" +"op = OptionParser()\n" +"op.add_option('-i', '--input',\n" +" action='store', type='string', dest='input',\n" +" help='set input filename')\n" +"op.add_option('-l', '--length',\n" +" action='store', type='int', dest='length',\n" +" help='set maximum length of output')" #: ../../whatsnew/2.3.rst:1756 msgid "" -"Parsing a command line is then done by calling the :meth:`~optparse." -"OptionParser.parse_args` method. ::" +"Parsing a command line is then done by calling " +"the :meth:`~optparse.OptionParser.parse_args` method. ::" msgstr "" "コマンドラインの解析は :meth:`~optparse.OptionParser.parse_args` メソッドを呼" "び出すことで行います ::" -#: ../../whatsnew/2.3.rst:1758 msgid "" "options, args = op.parse_args(sys.argv[1:])\n" "print options\n" "print args" msgstr "" +"options, args = op.parse_args(sys.argv[1:])\n" +"print options\n" +"print args" #: ../../whatsnew/2.3.rst:1762 msgid "" @@ -3189,7 +3775,6 @@ msgstr "" "色々な引数でこのスクリプトを実行すれば、あなたの期待するように動きます。この" "例での *length* 引数が自動的に整数に変換されることに注目してください。" -#: ../../whatsnew/2.3.rst:1768 msgid "" "$ ./python opt.py -i data arg1\n" "\n" @@ -3199,12 +3784,18 @@ msgid "" "[]\n" "$" msgstr "" +"$ ./python opt.py -i data arg1\n" +"\n" +"['arg1']\n" +"$ ./python opt.py --input=data --length=4\n" +"\n" +"[]\n" +"$" #: ../../whatsnew/2.3.rst:1778 msgid "The help message is automatically generated for you:" msgstr "ヘルプメッセージはあなたのために自動生成されます:" -#: ../../whatsnew/2.3.rst:1780 msgid "" "$ ./python opt.py --help\n" "usage: opt.py [options]\n" @@ -3217,6 +3808,16 @@ msgid "" " set maximum length of output\n" "$" msgstr "" +"$ ./python opt.py --help\n" +"usage: opt.py [options]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -iINPUT, --input=INPUT\n" +" set input filename\n" +" -lLENGTH, --length=LENGTH\n" +" set maximum length of output\n" +"$" #: ../../whatsnew/2.3.rst:1793 msgid "See the module's documentation for more details." @@ -3291,15 +3892,16 @@ msgid "" "are more third-party modules that will have the same problem." msgstr "" "問題を起こすとりわけ一般的な誤りが一つあります。Python の C API 内には数多く" -"のメモリアロケーション関数がありますが、これは以前は単に C ライブラリの :c:" -"func:`malloc` と :c:func:`free` への別名であり、何かの間違いでミスマッチな関" -"数呼び出しをしても、誤りは気付かれないものでした。今回のこのオブジェクトアロ" -"ケータを有効化すると、これら関数は :c:func:`malloc` と :c:func:`free` への別" -"名ではまったくなくて、メモリ解放に誤った関数を呼び出すとコアダンプし得ます。" -"例えば :c:func:`PyObject_Malloc` を使って獲得したメモリは :c:func:`free` では" -"なく :c:func:`PyObject_Free` を使って解放する必要があります。Python に含まれ" -"るいくつかのモジュールがまさにこれに抵触し、修正の必要がありました。間違いな" -"く多くのサードパーティモジュールが同じ問題を抱えているでしょう。" +"のメモリアロケーション関数がありますが、これは以前は単に C ライブラリ" +"の :c:func:`malloc` と :c:func:`free` への別名であり、何かの間違いでミスマッ" +"チな関数呼び出しをしても、誤りは気付かれないものでした。今回のこのオブジェク" +"トアロケータを有効化すると、これら関数は :c:func:`malloc` と :c:func:`free` " +"への別名ではまったくなくて、メモリ解放に誤った関数を呼び出すとコアダンプし得" +"ます。例えば :c:func:`PyObject_Malloc` を使って獲得したメモリ" +"は :c:func:`free` ではなく :c:func:`PyObject_Free` を使って解放する必要があり" +"ます。Python に含まれるいくつかのモジュールがまさにこれに抵触し、修正の必要が" +"ありました。間違いなく多くのサードパーティモジュールが同じ問題を抱えているで" +"しょう。" #: ../../whatsnew/2.3.rst:1836 msgid "" @@ -3318,8 +3920,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1842 msgid "" "To allocate and free an undistinguished chunk of memory use the \"raw " -"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:" -"func:`PyMem_Free`." +"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free`." msgstr "" "何某かの区別のないメモリの塊を獲得・解放するのには「生メモリ」ファミリを使い" "ます: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, :c:func:`PyMem_Free`." @@ -3328,35 +3930,36 @@ msgstr "" msgid "" "The \"object memory\" family is the interface to the pymalloc facility " "described above and is biased towards a large number of \"small\" " -"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:" -"func:`PyObject_Free`." +"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free`." msgstr "" "「オブジェクトメモリ」ファミリは上述の pymalloc 機構へのインターフェイスであ" -"り、多数の「小さな」獲得をするための特化がされています: :c:func:" -"`PyObject_Malloc`, :c:func:`PyObject_Realloc`, :c:func:`PyObject_Free`." +"り、多数の「小さな」獲得をするための特化がされていま" +"す: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, :c:func:`PyObject_Free`." #: ../../whatsnew/2.3.rst:1849 msgid "" -"To allocate and free Python objects, use the \"object\" family :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar`, and :c:func:`PyObject_Del`." +"To allocate and free Python objects, use the \"object\" " +"family :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, " +"and :c:func:`PyObject_Del`." msgstr "" -"Python オブジェクトの獲得と解放には「オブジェクト」ファミリ :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_Del` を使いま" -"す。" +"Python オブジェクトの獲得と解放には「オブジェクト」ファミ" +"リ :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_Del` " +"を使います。" #: ../../whatsnew/2.3.rst:1852 msgid "" "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides " "debugging features to catch memory overwrites and doubled frees in both " "extension modules and in the interpreter itself. To enable this support, " -"compile a debugging version of the Python interpreter by running :program:" -"`configure` with :option:`!--with-pydebug`." +"compile a debugging version of the Python interpreter by " +"running :program:`configure` with :option:`!--with-pydebug`." msgstr "" "Tim Peters による多大な仕事のおかげで、 2.3 の pymalloc はデバッグ機能も提供" "しています。これはメモリの上書き、二重解放に関して、拡張モジュールとインタプ" -"リタ自身について検出出来ます。このサポートを有効にするには :program:" -"`configure` スクリプトにオプション :option:`!--with-pydebug` を与えて Python " -"インタプリタをデバッグバージョンとしてコンパイルしてください。" +"リタ自身について検出出来ます。このサポートを有効にするに" +"は :program:`configure` スクリプトにオプション :option:`!--with-pydebug` を与" +"えて Python インタプリタをデバッグバージョンとしてコンパイルしてください。" #: ../../whatsnew/2.3.rst:1858 msgid "" @@ -3382,9 +3985,9 @@ msgid "" "top of the file :file:`Objects/obmalloc.c` in the Python source code. The " "above link points to the file within the python.org SVN browser." msgstr "" -"pymalloc 実装に関する完全な詳細については Python ソースコード内の :file:" -"`Objects/obmalloc.c` ファイルの先頭のコメントを参照してください。上のファイル" -"へのリンクは python.org の SVN ブラウザを指しています。" +"pymalloc 実装に関する完全な詳細については Python ソースコード内" +"の :file:`Objects/obmalloc.c` ファイルの先頭のコメントを参照してください。上" +"のファイルへのリンクは python.org の SVN ブラウザを指しています。" #: ../../whatsnew/2.3.rst:1876 msgid "Build and C API Changes" @@ -3398,8 +4001,8 @@ msgstr "Python のビルド過程と C API の変更は以下の通りです:" msgid "" "The cycle detection implementation used by the garbage collection has proven " "to be stable, so it's now been made mandatory. You can no longer compile " -"Python without it, and the :option:`!--with-cycle-gc` switch to :program:" -"`configure` has been removed." +"Python without it, and the :option:`!--with-cycle-gc` switch " +"to :program:`configure` has been removed." msgstr "" "ガーベージコレクションで使われている循環の検出実装が安定であることがわかった" "ため、必須とすることになりました。Python をこれなしでコンパイルすることはもう" @@ -3408,14 +4011,15 @@ msgstr "" #: ../../whatsnew/2.3.rst:1885 msgid "" -"Python can now optionally be built as a shared library (:file:`libpython2.3." -"so`) by supplying :option:`!--enable-shared` when running Python's :program:" -"`configure` script. (Contributed by Ondrej Palkovsky.)" +"Python can now optionally be built as a shared library " +"(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when " +"running Python's :program:`configure` script. (Contributed by Ondrej " +"Palkovsky.)" msgstr "" "Python がオプショナルでシェアドライブラリ (:file:`libpython2.3.so`) としてビ" -"ルド可能になりました。Python の :program:`configure` スクリプトに :option:" -"`!--enable-shared` オプションを与えることで可能です。 (Contributed by Ondrej " -"Palkovsky.)" +"ルド可能になりました。Python の :program:`configure` スクリプト" +"に :option:`!--enable-shared` オプションを与えることで可能です。 " +"(Contributed by Ondrej Palkovsky.)" #: ../../whatsnew/2.3.rst:1889 msgid "" @@ -3427,14 +4031,14 @@ msgid "" msgstr "" "マクロ :c:macro:`!DL_EXPORT` と :c:macro:`!DL_IMPORT` が非推奨となっていま" "す。Python コアが一般的にマクロ :c:macro:`!PyAPI_FUNC` と :c:macro:`!" -"PyAPI_DATA` を使うのに対し、Python 拡張モジュールの初期化関数が新規マクロ :c:" -"macro:`PyMODINIT_FUNC` を使って宣言されなければならなくなりました。" +"PyAPI_DATA` を使うのに対し、Python 拡張モジュールの初期化関数が新規マク" +"ロ :c:macro:`PyMODINIT_FUNC` を使って宣言されなければならなくなりました。" #: ../../whatsnew/2.3.rst:1894 msgid "" "The interpreter can be compiled without any docstrings for the built-in " -"functions and modules by supplying :option:`!--without-doc-strings` to the :" -"program:`configure` script. This makes the Python executable about 10% " +"functions and modules by supplying :option:`!--without-doc-strings` to " +"the :program:`configure` script. This makes the Python executable about 10% " "smaller, but will also mean that you can't get help for Python's built-ins. " "(Contributed by Gustavo Niemeyer.)" msgstr "" @@ -3458,20 +4062,20 @@ msgstr "" "修正しなければなりません。Python 2.2 以降ではメソッド定義テーブルでは引数を持" "たず、引数チェックを省けることを示すのに :c:macro:`METH_NOARGS` フラグが使え" "ます。2.2 以前の Python バージョンとの互換性が重要な場合には " -"``PyArg_ParseTuple(args, \"\")`` を代わりに使えますが、 :c:macro:" -"`METH_NOARGS` を使うより遅いです。" +"``PyArg_ParseTuple(args, \"\")`` を代わりに使えます" +"が、 :c:macro:`METH_NOARGS` を使うより遅いです。" #: ../../whatsnew/2.3.rst:1907 msgid "" ":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes " -"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:" -"`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and ``K`` for :c:" -"expr:`unsigned long long`." +"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` " +"for :c:expr:`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and " +"``K`` for :c:expr:`unsigned long long`." msgstr "" ":c:func:`PyArg_ParseTuple` に符号なし整数の色々なサイズのためのフォーマット文" -"字が追加されました: :c:expr:`unsigned char` のための ``B``, :c:expr:" -"`unsigned short int` のための ``H``, :c:expr:`unsigned int` のための ``I``, :" -"c:expr:`unsigned long long` のための ``K``。" +"字が追加されました: :c:expr:`unsigned char` のための " +"``B``, :c:expr:`unsigned short int` のための ``H``, :c:expr:`unsigned int` の" +"ための ``I``, :c:expr:`unsigned long long` のための ``K``。" #: ../../whatsnew/2.3.rst:1912 msgid "" @@ -3485,21 +4089,23 @@ msgstr "" #: ../../whatsnew/2.3.rst:1915 msgid "" "File objects now manage their internal string buffer differently, increasing " -"it exponentially when needed. This results in the benchmark tests in :file:" -"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 " -"seconds, according to one measurement)." +"it exponentially when needed. This results in the benchmark tests " +"in :file:`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds " +"to 1.7 seconds, according to one measurement)." msgstr "" "ファイルオブジェクトの内部文字列バッファの管理が変更されて、必要な場合には指" "数関数的に増やすようになりました。 :file:`Lib/test/test_bufio.py` 内のベンチ" "マークテストの結果での速度向上は大幅なものです (ある一つの計測では 57 秒から " "1.7 秒になりました)。" -#: ../../whatsnew/2.3.rst:1920 msgid "" "It's now possible to define class and static methods for a C extension type " "by setting either the :c:macro:`METH_CLASS` or :c:macro:`METH_STATIC` flags " "in a method's :c:type:`PyMethodDef` structure." msgstr "" +"メソッドの :c:type:`PyMethodDef` 構造体で :c:macro:`METH_CLASS` また" +"は :c:macro:`METH_STATIC` フラグを設定することにより、C 拡張型にクラスメソッ" +"ドや静的メソッドを定義できるようになりました。" #: ../../whatsnew/2.3.rst:1924 msgid "" @@ -3510,16 +4116,23 @@ msgstr "" "により Expat のシステムのバージョンやローカルにインストールされたものへの依存" "がなくなっています。" -#: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`~type.__module__` and :" -"attr:`~type.__name__` attributes. In summary, you will want to ensure the " -"type's dictionary contains a ``'__module__'`` key; making the module name " -"the part of the type name leading up to the final period will no longer have " -"the desired effect. For more detail, read the API reference documentation " -"or the source." -msgstr "" +"aware of a change in the rules relating to the :attr:`~type.__module__` " +"and :attr:`~type.__name__` attributes. In summary, you will want to ensure " +"the type's dictionary contains a ``'__module__'`` key; making the module " +"name the part of the type name leading up to the final period will no longer " +"have the desired effect. For more detail, read the API reference " +"documentation or the source." +msgstr "" +"拡張モジュールで型オブジェクトを動的に割り当てている場合" +"は、:attr:`~type.__module__` 属性と :attr:`~type.__name__` 属性に関する規則の" +"変更に注意してください。\n" +"要するに、型の辞書に ``'__module__'`` キーが含まれるようにする必要がありま" +"す。\n" +"型名の最後のピリオドより前の部分をモジュール名にする方法では、もはや期待した" +"結果が得られません。\n" +"詳細は API リファレンスかソースコードを読んでください。" #: ../../whatsnew/2.3.rst:1938 msgid "Port-Specific Changes" @@ -3530,34 +4143,42 @@ msgid "" "Support for a port to IBM's OS/2 using the EMX runtime environment was " "merged into the main Python source tree. EMX is a POSIX emulation layer " "over the OS/2 system APIs. The Python port for EMX tries to support all the " -"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:" -"`!fork` and :func:`fcntl` are restricted by the limitations of the " -"underlying emulation layer. The standard OS/2 port, which uses IBM's Visual " -"Age compiler, also gained support for case-sensitive import semantics as " -"part of the integration of the EMX port into CVS. (Contributed by Andrew " +"POSIX-like capability exposed by the EMX runtime, and mostly " +"succeeds; :func:`!fork` and :func:`fcntl` are restricted by the limitations " +"of the underlying emulation layer. The standard OS/2 port, which uses IBM's " +"Visual Age compiler, also gained support for case-sensitive import semantics " +"as part of the integration of the EMX port into CVS. (Contributed by Andrew " "MacIntyre.)" msgstr "" -#: ../../whatsnew/2.3.rst:1949 msgid "" "On MacOS, most toolbox modules have been weaklinked to improve backward " "compatibility. This means that modules will no longer fail to load if a " "single routine is missing on the current OS version. Instead calling the " "missing routine will raise an exception. (Contributed by Jack Jansen.)" msgstr "" +"MacOS では、後方互換性を改善するため、ほとんどの toolbox モジュールが弱いリン" +"クを使うようになりました。\n" +"これにより、現在の OS バージョンに一つのルーチンがないだけでモジュールの読み" +"込みが失敗することはなくなりました。\n" +"代わりに、そのルーチンを呼び出したときに例外が送出されます。\n" +"(Jack Jansen による貢献です。)" -#: ../../whatsnew/2.3.rst:1954 msgid "" "The RPM spec files, found in the :file:`Misc/RPM/` directory in the Python " "source distribution, were updated for 2.3. (Contributed by Sean " "Reifschneider.)" msgstr "" +"Python のソース配布物の :file:`Misc/RPM/` ディレクトリにある RPM spec ファイ" +"ルが、2.3 に合わせて更新されました。\n" +"(Sean Reifschneider による貢献です。)" -#: ../../whatsnew/2.3.rst:1957 msgid "" -"Other new platforms now supported by Python include AtheOS (http://www." -"atheos.cx/), GNU/Hurd, and OpenVMS." +"Other new platforms now supported by Python include AtheOS (http://" +"www.atheos.cx/), GNU/Hurd, and OpenVMS." msgstr "" +"そのほか、AtheOS (http://www.atheos.cx/)、GNU/Hurd、OpenVMS でも Python がサ" +"ポートされるようになりました。" #: ../../whatsnew/2.3.rst:1966 msgid "Other Changes and Fixes" @@ -3652,15 +4273,16 @@ msgstr "" #: ../../whatsnew/2.3.rst:2006 msgid "" -"A nifty new feature is that trace functions can now assign to the :attr:" -"`~frame.f_lineno` attribute of frame objects, changing the line that will be " -"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger " -"taking advantage of this new feature. (Implemented by Richie Hindle.)" +"A nifty new feature is that trace functions can now assign to " +"the :attr:`~frame.f_lineno` attribute of frame objects, changing the line " +"that will be executed next. A ``jump`` command has been added to " +"the :mod:`pdb` debugger taking advantage of this new feature. (Implemented " +"by Richie Hindle.)" msgstr "" -"気の利いた新機能としては、トレース関数は、今ではフレームオブジェクトの :attr:" -"`~frame.f_lineno` 属性を、次に実行される行に変更してセットします。 :mod:" -"`pdb` デバッガにはこの新機能の恩恵を受けて ``jump`` コマンドが追加されていま" -"す。 (Implemented by Richie Hindle.)" +"気の利いた新機能としては、トレース関数は、今ではフレームオブジェクト" +"の :attr:`~frame.f_lineno` 属性を、次に実行される行に変更してセットしま" +"す。 :mod:`pdb` デバッガにはこの新機能の恩恵を受けて ``jump`` コマンドが追加" +"されています。 (Implemented by Richie Hindle.)" #: ../../whatsnew/2.3.rst:2015 msgid "Porting to Python 2.3" @@ -3719,14 +4341,15 @@ msgid "" msgstr "" ":mod:`!_tkinter` を介した Tcl メソッド呼び出しは今では文字列だけを返すのでは" "ありません。代わりに Tcl は対応する Python の等価なオブジェクトに変換されたオ" -"ブジェクトを返します。Python に等価なものがなければ :class:`!_tkinter." -"Tcl_Obj` で包んで返します。" +"ブジェクトを返します。Python に等価なものがなければ :class:`!" +"_tkinter.Tcl_Obj` で包んで返します。" #: ../../whatsnew/2.3.rst:2039 msgid "" -"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:" -"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a " -"negative value, but in Python 2.4 they'll become positive long integers." +"Large octal and hex literals such as ``0xffffffff`` now trigger " +"a :exc:`FutureWarning`. Currently they're stored as 32-bit numbers and " +"result in a negative value, but in Python 2.4 they'll become positive long " +"integers." msgstr "" "``0xffffffff`` のような大きな値の 8 進、16 進リテラルで :exc:`FutureWarning` " "が発行されます。2.3 ではこれは 32 ビットの値に格納されて結果は負の値になりま" @@ -3770,12 +4393,11 @@ msgid "" msgstr "" "Distutils の :func:`!setup` 関数に *depends* のような色々な新しいキーワード引" "数が追加されています。Distutils の古いバージョンでは未知のキーワードを渡すと" -"処理を中断してしまいます。新旧で動作させなければならないのであれば、 :file:" -"`setup.py` 内で :func:`!get_distutil_options` 関数の有無をチェックし、それら" -"をサポートするバージョンの Distutils でのみ新しいキーワード引数を使うようにし" -"てください::" +"処理を中断してしまいます。新旧で動作させなければならないのであれ" +"ば、 :file:`setup.py` 内で :func:`!get_distutil_options` 関数の有無をチェック" +"し、それらをサポートするバージョンの Distutils でのみ新しいキーワード引数を使" +"うようにしてください::" -#: ../../whatsnew/2.3.rst:2058 msgid "" "from distutils import core\n" "\n" @@ -3784,6 +4406,12 @@ msgid "" " kw['depends'] = ['foo.h']\n" "ext = Extension(**kw)" msgstr "" +"from distutils import core\n" +"\n" +"kw = {'sources': 'foo.c', ...}\n" +"if hasattr(core, 'get_distutil_options'):\n" +" kw['depends'] = ['foo.h']\n" +"ext = Extension(**kw)" #: ../../whatsnew/2.3.rst:2065 msgid "" @@ -3827,6 +4455,5 @@ msgstr "" msgid "universal newlines" msgstr "universal newlines" -#: ../../whatsnew/2.3.rst:371 msgid "What's new" -msgstr "" +msgstr "新機能" diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index ded9ae059..55b1aa1d6 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 "" @@ -100,7 +99,6 @@ msgstr "" "共通集合 (intersection)、 差 (difference)、対称差 (symmetric difference) と" "いった数学演算を高速に行います::" -#: ../../whatsnew/2.4.rst:45 msgid "" ">>> a = set('abracadabra') # form a set from a string\n" ">>> 'z' in a # fast membership testing\n" @@ -128,6 +126,32 @@ msgid "" ">>> a\n" "set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])" msgstr "" +">>> a = set('abracadabra') # 文字列から集合を作る\n" +">>> 'z' in a # 高速な所属判定\n" +"False\n" +">>> a # a に含まれる重複しない文字\n" +"set(['a', 'r', 'b', 'c', 'd'])\n" +">>> ''.join(a) # 文字列に戻す\n" +"'arbcd'\n" +"\n" +">>> b = set('alacazam') # 2 つ目の集合を作る\n" +">>> a - b # a に含まれ b に含まれない文字\n" +"set(['r', 'd', 'b'])\n" +">>> a | b # a または b に含まれる文字\n" +"set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])\n" +">>> a & b # a と b の両方に含まれる文字\n" +"set(['a', 'c'])\n" +">>> a ^ b # a または b の片方だけに含まれる文" +"字\n" +"set(['r', 'd', 'b', 'm', 'z', 'l'])\n" +"\n" +">>> a.add('z') # 新しい要素を追加\n" +">>> a.update('wxy') # 複数の新しい要素を追加\n" +">>> a\n" +"set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])\n" +">>> a.remove('x') # 要素を一つ取り除く\n" +">>> a\n" +"set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])" #: ../../whatsnew/2.4.rst:71 msgid "" @@ -135,8 +159,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 "" @@ -144,10 +168,10 @@ msgid "" "you wish to subclass the :class:`Set` or :class:`ImmutableSet` classes. " "There are currently no plans to deprecate the module." msgstr "" -"2.3 で追加された :mod:`sets` モジュールは標準ライブラリに残されていて、 :" -"class:`Set` や :class:`ImmutableSet` をサブクラス化したければ便利かもしれませ" -"ん。今のところこれを撤廃する予定はありません。(---訳注: :mod:`sets` モジュー" -"ルは 2.6 で非推奨となっています。---)" +"2.3 で追加された :mod:`sets` モジュールは標準ライブラリに残されてい" +"て、 :class:`Set` や :class:`ImmutableSet` をサブクラス化したければ便利かもし" +"れません。今のところこれを撤廃する予定はありません。(---訳注: :mod:`sets` モ" +"ジュールは 2.6 で非推奨となっています。---)" #: ../../whatsnew/2.4.rst:82 msgid ":pep:`218` - Adding a Built-In Set Object Type" @@ -169,10 +193,11 @@ msgstr "PEP 237: 長整数と整数を一体化していく" msgid "" "The lengthy transition process for this PEP, begun in Python 2.2, takes " "another step forward in Python 2.4. In 2.3, certain integer operations that " -"would behave differently after int/long unification triggered :exc:" -"`FutureWarning` warnings and returned values limited to 32 or 64 bits " -"(depending on your platform). In 2.4, these expressions no longer produce a " -"warning and instead produce a different result that's usually a long integer." +"would behave differently after int/long unification " +"triggered :exc:`FutureWarning` warnings and returned values limited to 32 or " +"64 bits (depending on your platform). In 2.4, these expressions no longer " +"produce a warning and instead produce a different result that's usually a " +"long integer." msgstr "" "この PEP の非常に長期に渡る移行は Python 2.2 に始まり、Python 2.4 でさらにも" "う一歩前進しています。2.3 では int/long の一体化後に異なる振る舞いをする整数" @@ -209,7 +234,6 @@ msgstr "" msgid "PEP 289: Generator Expressions" msgstr "PEP 289: ジェネレータ式" -#: ../../whatsnew/2.4.rst:117 msgid "" "The iterator feature introduced in Python 2.2 and the :mod:`itertools` " "module make it easier to write programs that loop through large data sets " @@ -220,25 +244,39 @@ msgid "" "large. When trying to write a functionally styled program, it would be " "natural to write something like::" msgstr "" +"Python 2.2 で導入されたイテレータ機能と :mod:`itertools` モジュールによって、" +"データセット全体を一度にメモリへ読み込まずに、大きなデータセットをループで処" +"理するプログラムが書きやすくなりました。\n" +"リスト内包表記はすべての要素を含む Python のリストオブジェクトを作るので、こ" +"の用途にはあまり向きません。\n" +"必然的にすべてのオブジェクトをメモリへ読み込むことになり、データセットが非常" +"に大きい場合には問題になり得ます。\n" +"関数型のスタイルでプログラムを書こうとすると、次のように書くのが自然でしょ" +"う。 ::" -#: ../../whatsnew/2.4.rst:125 msgid "" "links = [link for link in get_all_links() if not link.followed]\n" "for link in links:\n" " ..." msgstr "" +"links = [link for link in get_all_links() if not link.followed]\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:129 msgid "instead of ::" msgstr "こうではなく ::" -#: ../../whatsnew/2.4.rst:131 msgid "" "for link in get_all_links():\n" " if link.followed:\n" " continue\n" " ..." msgstr "" +"for link in get_all_links():\n" +" if link.followed:\n" +" continue\n" +" ..." #: ../../whatsnew/2.4.rst:136 msgid "" @@ -260,12 +298,14 @@ msgstr "" "代わりにそれは、要素を一つずつ返すジェネレータを返します。上述の例はこう書け" "ます::" -#: ../../whatsnew/2.4.rst:144 msgid "" "links = (link for link in get_all_links() if not link.followed)\n" "for link in links:\n" " ..." msgstr "" +"links = (link for link in get_all_links() if not link.followed)\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:148 msgid "" @@ -278,9 +318,8 @@ msgstr "" "呼び出しを囲む括弧もそれに含まれるので、関数にそのまま渡すイテレータを作りた" "ければこれで良いです::" -#: ../../whatsnew/2.4.rst:153 msgid "print sum(obj.count for obj in list_all_objects())" -msgstr "" +msgstr "print sum(obj.count for obj in list_all_objects())" #: ../../whatsnew/2.4.rst:155 msgid "" @@ -330,11 +369,12 @@ msgstr "" msgid "The usual way of substituting variables by name is the ``%`` operator::" msgstr "変数置換を名前で行うためのいつもの方法は ``%`` 演算子です::" -#: ../../whatsnew/2.4.rst:180 msgid "" ">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" "'2: The Best of Times'" msgstr "" +">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:183 msgid "" @@ -365,13 +405,16 @@ msgstr "" "PEP 292 は :mod:`string` モジュールに :class:`Template` クラスを追加します。" "これは置換を指示するのに ``$`` を使います::" -#: ../../whatsnew/2.4.rst:195 msgid "" ">>> import string\n" ">>> t = string.Template('$page: $title')\n" ">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" "'2: The Best of Times'" msgstr "" +">>> import string\n" +">>> t = string.Template('$page: $title')\n" +">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:200 msgid "" @@ -383,12 +426,14 @@ msgstr "" "を送出します。 :meth:`safe_substitute` メソッドもあり、これはキー不在を無視し" "ます::" -#: ../../whatsnew/2.4.rst:204 msgid "" ">>> t = string.Template('$page: $title')\n" ">>> t.safe_substitute({'page':3})\n" "'3: $title'" msgstr "" +">>> t = string.Template('$page: $title')\n" +">>> t.safe_substitute({'page':3})\n" +"'3: $title'" #: ../../whatsnew/2.4.rst:211 msgid ":pep:`292` - Simpler String Substitutions" @@ -406,19 +451,18 @@ msgstr "PEP 318: 関数とメソッドのためのデコレータ" msgid "" "Python 2.2 extended Python's object model by adding static methods and class " "methods, but it didn't extend Python's syntax to provide any new way of " -"defining static or class methods. Instead, you had to write a :keyword:" -"`def` statement in the usual way, and pass the resulting method to a :func:" -"`staticmethod` or :func:`classmethod` function that would wrap up the " -"function as a method of the new type. Your code would look like this::" +"defining static or class methods. Instead, you had to write " +"a :keyword:`def` statement in the usual way, and pass the resulting method " +"to a :func:`staticmethod` or :func:`classmethod` function that would wrap up " +"the function as a method of the new type. Your code would look like this::" msgstr "" "Python 2.2 は Python オブジェクトモデルを静的メソッド、クラスメソッドを追加す" "ることで拡張はしましたが、それらを定義する新たな手段を提供するような Python " "構文の拡張はしませんでした。このため、 :keyword:`def` でメソッドは普通に書い" -"たのち、新型メソッドとしての関数へ仕立て上げる :func:`staticmethod` または :" -"func:`classmethod` にその結果のメソッドを渡す、という手順を取る必要がありまし" -"た。このような具合でした::" +"たのち、新型メソッドとしての関数へ仕立て上げる :func:`staticmethod` また" +"は :func:`classmethod` にその結果のメソッドを渡す、という手順を取る必要があり" +"ました。このような具合でした::" -#: ../../whatsnew/2.4.rst:227 msgid "" "class C:\n" " def meth (cls):\n" @@ -426,11 +470,16 @@ msgid "" "\n" " meth = classmethod(meth) # Rebind name to wrapped-up class method" msgstr "" +"class C:\n" +" def meth (cls):\n" +" ...\n" +"\n" +" meth = classmethod(meth) # ラップしたクラスメソッドに名前を束縛し直す" #: ../../whatsnew/2.4.rst:233 msgid "" -"If the method was very long, it would be easy to miss or forget the :func:" -"`classmethod` invocation after the function body." +"If the method was very long, it would be easy to miss or forget " +"the :func:`classmethod` invocation after the function body." msgstr "" "メソッドがとても長かったりすると、関数のボディの後ろの :func:`classmethod` 呼" "び出しは見失ったり忘れたりしやすいものでした。" @@ -469,7 +518,6 @@ msgstr "" "記法は Java より拝借して ``'@'`` 文字を指示子として使います。この新たな構文を" "使うと、上記の例はこのように書けます::" -#: ../../whatsnew/2.4.rst:249 msgid "" "class C:\n" "\n" @@ -477,6 +525,11 @@ msgid "" " def meth (cls):\n" " ..." msgstr "" +"class C:\n" +"\n" +" @classmethod\n" +" def meth (cls):\n" +" ..." #: ../../whatsnew/2.4.rst:256 msgid "" @@ -486,7 +539,6 @@ msgstr "" "``@classmethod`` は ``meth=classmethod(meth)`` 代入の速記法です。より一般的に" "は、このように書けば…:" -#: ../../whatsnew/2.4.rst:259 msgid "" "@A\n" "@B\n" @@ -494,16 +546,22 @@ msgid "" "def f ():\n" " ..." msgstr "" +"@A\n" +"@B\n" +"@C\n" +"def f ():\n" +" ..." #: ../../whatsnew/2.4.rst:265 msgid "It's equivalent to the following pre-decorator code::" msgstr "これはデコレータ前史の以下コードと等価です::" -#: ../../whatsnew/2.4.rst:267 msgid "" "def f(): ...\n" "f = A(B(C(f)))" msgstr "" +"def f(): ...\n" +"f = A(B(C(f)))" #: ../../whatsnew/2.4.rst:270 msgid "" @@ -514,10 +572,10 @@ msgid "" "definitions." msgstr "" "デコレータは関数定義の前になければなりません。一行ごとに一つのデコレータで" -"す。 def ステートメントと同じ行にあってはダメです。つまり ``@A def f(): ..." -"`` は不正です。モジュールレベルかクラス内の関数定義のみをデコレート出来ます; " -"クラス定義はデコレート出来ません。(--- 訳注: クラス定義のデコレータは Python " -"2.6 で追加されました (PEP 3129) 。---)" +"す。 def ステートメントと同じ行にあってはダメです。つまり ``@A def " +"f(): ...`` は不正です。モジュールレベルかクラス内の関数定義のみをデコレート出" +"来ます; クラス定義はデコレート出来ません。(--- 訳注: クラス定義のデコレータ" +"は Python 2.6 で追加されました (PEP 3129) 。---)" #: ../../whatsnew/2.4.rst:275 msgid "" @@ -534,7 +592,6 @@ msgstr "" "すが)。あなた自身のデコレータを書くのは簡単です。続く単純な例は、関数オブジェ" "クトに単に属性をセットするだけのものです::" -#: ../../whatsnew/2.4.rst:282 msgid "" ">>> def deco(func):\n" "... func.attr = 'decorated'\n" @@ -549,6 +606,18 @@ msgid "" "'decorated'\n" ">>>" msgstr "" +">>> def deco(func):\n" +"... func.attr = 'decorated'\n" +"... return func\n" +"...\n" +">>> @deco\n" +"... def f(): pass\n" +"...\n" +">>> f\n" +"\n" +">>> f.attr\n" +"'decorated'\n" +">>>" #: ../../whatsnew/2.4.rst:295 msgid "" @@ -558,7 +627,6 @@ msgstr "" "もう少しだけ現実的な例として、続く例ではデコレータに、与えられた引数が整数か" "どうかチェックさせてみます::" -#: ../../whatsnew/2.4.rst:298 msgid "" "def require_int (func):\n" " def wrapper (arg):\n" @@ -575,6 +643,20 @@ msgid "" "def p2(arg):\n" " print arg*2" msgstr "" +"def require_int (func):\n" +" def wrapper (arg):\n" +" assert isinstance(arg, int)\n" +" return func(arg)\n" +"\n" +" return wrapper\n" +"\n" +"@require_int\n" +"def p1 (arg):\n" +" print arg\n" +"\n" +"@require_int\n" +"def p2(arg):\n" +" print arg*2" #: ../../whatsnew/2.4.rst:313 msgid "" @@ -597,12 +679,14 @@ msgstr "" "なりません; この関数は単一の関数を取らなければならず、前述のように関数を返さ" "なければなりません。言い換えると、 ``@A @B @C(args)`` はこうなります::" -#: ../../whatsnew/2.4.rst:321 msgid "" "def f(): ...\n" "_deco = C(args)\n" "f = A(B(_deco(f)))" msgstr "" +"def f(): ...\n" +"_deco = C(args)\n" +"f = A(B(_deco(f)))" #: ../../whatsnew/2.4.rst:325 msgid "" @@ -611,13 +695,16 @@ msgstr "" "これが正しいと理解するには少しばかり頭をひねる必要がありますが、難しすぎるこ" "とはありません。" -#: ../../whatsnew/2.4.rst:327 msgid "" "A small related change makes the :attr:`func_name ` " "attribute of functions writable. This attribute is used to display function " "names in tracebacks, so decorators should change the name of any new " "function that's constructed and returned." msgstr "" +"関連する小さな変更として、関数の :attr:`func_name ` 属性が" +"書き換え可能になりました。\n" +"この属性はトレースバックで関数名を表示するために使われるので、デコレーターで" +"新しい関数を作って返す場合は、その名前を変更するようにしてください。" #: ../../whatsnew/2.4.rst:336 msgid ":pep:`318` - Decorators for Functions, Methods and Classes" @@ -653,7 +740,6 @@ msgstr "" "新しいビルトイン関数 ``reversed(seq)`` は、シーケンスを受け取って、シーケンス" "の要素を逆順にループするイテレータを返します::" -#: ../../whatsnew/2.4.rst:353 msgid "" ">>> for i in reversed(xrange(1,4)):\n" "... print i\n" @@ -662,27 +748,32 @@ msgid "" "2\n" "1" msgstr "" +">>> for i in reversed(xrange(1,4)):\n" +"... print i\n" +"...\n" +"3\n" +"2\n" +"1" #: ../../whatsnew/2.4.rst:360 msgid "" "Compared to extended slicing, such as ``range(1,4)[::-1]``, :func:`reversed` " "is easier to read, runs faster, and uses substantially less memory." msgstr "" -"``range(1,4)[::-1]`` のようにする拡張スライスでのやり方に比較して :func:" -"`reversed` は読みやすく、実行が高速で、大体の場合はメモリ使用が少なく済みま" -"す。" +"``range(1,4)[::-1]`` のようにする拡張スライスでのやり方に比較し" +"て :func:`reversed` は読みやすく、実行が高速で、大体の場合はメモリ使用が少な" +"く済みます。" #: ../../whatsnew/2.4.rst:363 msgid "" "Note that :func:`reversed` only accepts sequences, not arbitrary iterators. " -"If you want to reverse an iterator, first convert it to a list with :func:" -"`list`. ::" +"If you want to reverse an iterator, first convert it to a list " +"with :func:`list`. ::" msgstr "" ":func:`reversed` は任意のイテレータは受け付けず、シーケンスのみ受け付けること" "に注意してください。イテレータを逆順にしたければ、最初に :func:`list` でリス" "トに変換してください::" -#: ../../whatsnew/2.4.rst:367 msgid "" ">>> input = open('/etc/passwd', 'r')\n" ">>> for line in reversed(list(input)):\n" @@ -691,6 +782,12 @@ msgid "" "root:*:0:0:System Administrator:/var/root:/bin/tcsh\n" " ..." msgstr "" +">>> input = open('/etc/passwd', 'r')\n" +">>> for line in reversed(list(input)):\n" +"... print line\n" +"...\n" +"root:*:0:0:System Administrator:/var/root:/bin/tcsh\n" +" ..." #: ../../whatsnew/2.4.rst:377 msgid ":pep:`322` - Reverse Iteration" @@ -704,26 +801,36 @@ msgstr "Raymond Hettinger 著、実装." msgid "PEP 324: New subprocess Module" msgstr "PEP 324: 新しい subprocess モジュール" -#: ../../whatsnew/2.4.rst:386 msgid "" "The standard library provides a number of ways to execute a subprocess, " -"offering different features and different levels of complexity. ``os." -"system(command)`` is easy to use, but slow (it runs a shell process which " -"executes the command) and dangerous (you have to be careful about escaping " -"the shell's metacharacters). The :mod:`!popen2` module offers classes that " -"can capture standard output and standard error from the subprocess, but the " -"naming is confusing. The :mod:`subprocess` module cleans this up, " -"providing a unified interface that offers all the features you might need." -msgstr "" +"offering different features and different levels of complexity. " +"``os.system(command)`` is easy to use, but slow (it runs a shell process " +"which executes the command) and dangerous (you have to be careful about " +"escaping the shell's metacharacters). The :mod:`!popen2` module offers " +"classes that can capture standard output and standard error from the " +"subprocess, but the naming is confusing. The :mod:`subprocess` module " +"cleans this up, providing a unified interface that offers all the features " +"you might need." +msgstr "" +"標準ライブラリにはサブプロセスを実行する方法がいくつもあり、機能や複雑さもそ" +"れぞれ異なります。\n" +"``os.system(command)`` は使いやすいものの、遅く (シェルのプロセスを起動してコ" +"マンドを実行します)、危険でもあります (シェルのメタ文字のエスケープに注意する" +"必要があります)。\n" +":mod:`!popen2` モジュールにはサブプロセスの標準出力や標準エラーを取得できるク" +"ラスがありますが、名前が分かりにくくなっています。\n" +":mod:`subprocess` モジュールはこれを整理し、必要になり得る機能をすべて備えた" +"統一的なインターフェースを提供します。" -#: ../../whatsnew/2.4.rst:395 msgid "" "Instead of :mod:`!popen2`'s collection of classes, :mod:`subprocess` " "contains a single class called :class:`subprocess.Popen` whose constructor " "supports a number of different keyword arguments. ::" msgstr "" +":mod:`!popen2` に複数のクラスがあるのに対し、:mod:`subprocess` に" +"は :class:`subprocess.Popen` という一つのクラスがあり、そのコンストラクターが" +"さまざまなキーワード引数を受け付けます。 ::" -#: ../../whatsnew/2.4.rst:399 msgid "" "class Popen(args, bufsize=0, executable=None,\n" " stdin=None, stdout=None, stderr=None,\n" @@ -731,6 +838,11 @@ msgid "" " cwd=None, env=None, universal_newlines=False,\n" " startupinfo=None, creationflags=0):" msgstr "" +"class Popen(args, bufsize=0, executable=None,\n" +" stdin=None, stdout=None, stderr=None,\n" +" preexec_fn=None, close_fds=False, shell=False,\n" +" cwd=None, env=None, universal_newlines=False,\n" +" startupinfo=None, creationflags=0):" #: ../../whatsnew/2.4.rst:405 msgid "" @@ -786,20 +898,21 @@ msgstr "*preexec_fn* は子が開始する前に呼び出される関数です #: ../../whatsnew/2.4.rst:430 msgid "" -"*universal_newlines* opens the child's input and output using Python's :term:" -"`universal newlines` feature." +"*universal_newlines* opens the child's input and output using " +"Python's :term:`universal newlines` feature." msgstr "" "*universal_newlines* で、子の入出力を、Python の :term:`universal newlines` " "機能で開きます。" #: ../../whatsnew/2.4.rst:433 msgid "" -"Once you've created the :class:`Popen` instance, you can call its :meth:" -"`wait` method to pause until the subprocess has exited, :meth:`poll` to " -"check if it's exited without pausing, or ``communicate(data)`` to send the " -"string *data* to the subprocess's standard input. ``communicate(data)`` " -"then reads any data that the subprocess has sent to its standard output or " -"standard error, returning a tuple ``(stdout_data, stderr_data)``." +"Once you've created the :class:`Popen` instance, you can call " +"its :meth:`wait` method to pause until the subprocess has " +"exited, :meth:`poll` to check if it's exited without pausing, or " +"``communicate(data)`` to send the string *data* to the subprocess's standard " +"input. ``communicate(data)`` then reads any data that the subprocess has " +"sent to its standard output or standard error, returning a tuple " +"``(stdout_data, stderr_data)``." msgstr "" ":class:`Popen` インスタンスを作ってしまえば、あとはサブプロセスが終了するまで" "停止するために :meth:`wait` メソッド呼び出すことが出来、停止することなく終了" @@ -810,16 +923,15 @@ msgstr "" #: ../../whatsnew/2.4.rst:440 msgid "" -":func:`call` is a shortcut that passes its arguments along to the :class:" -"`Popen` constructor, waits for the command to complete, and returns the " -"status code of the subprocess. It can serve as a safer analog to :func:`os." -"system`::" +":func:`call` is a shortcut that passes its arguments along to " +"the :class:`Popen` constructor, waits for the command to complete, and " +"returns the status code of the subprocess. It can serve as a safer analog " +"to :func:`os.system`::" msgstr "" ":func:`call` は :class:`Popen` コンストラクタにその引数を流し込むショートカッ" "トで、コマンドが終了するまで待ち、サブプロセスの終了コードを返します。これ" "は :func:`os.system` に対する安全な置き換えとなりえます::" -#: ../../whatsnew/2.4.rst:444 msgid "" "sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n" "if sts == 0:\n" @@ -829,6 +941,13 @@ msgid "" " # dpkg returned an error\n" " ..." msgstr "" +"sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n" +"if sts == 0:\n" +" # 成功\n" +" ...\n" +"else:\n" +" # dpkg がエラーを返した\n" +" ..." #: ../../whatsnew/2.4.rst:452 msgid "" @@ -840,9 +959,8 @@ msgstr "" "あればキーワード引数として ``shell=True`` を与えた上でシーケンスの代わりに文" "字列を与えることが出来ます::" -#: ../../whatsnew/2.4.rst:456 msgid "sts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True)" -msgstr "" +msgstr "sts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True)" #: ../../whatsnew/2.4.rst:458 msgid "" @@ -942,11 +1060,12 @@ msgstr "" msgid "Sometimes you can see this inaccuracy when the number is printed::" msgstr "ときどきあなたはこの不正確さを、数値を表示する際に目にするでしょう::" -#: ../../whatsnew/2.4.rst:518 msgid "" ">>> 1.1\n" "1.1000000000000001" msgstr "" +">>> 1.1\n" +"1.1000000000000001" #: ../../whatsnew/2.4.rst:521 msgid "" @@ -990,15 +1109,16 @@ msgstr ":class:`Decimal` 型" #: ../../whatsnew/2.4.rst:540 msgid "" "A new module, :mod:`decimal`, was added to Python's standard library. It " -"contains two classes, :class:`Decimal` and :class:`Context`. :class:" -"`Decimal` instances represent numbers, and :class:`Context` instances are " -"used to wrap up various settings such as the precision and default rounding " -"mode." +"contains two classes, :class:`Decimal` " +"and :class:`Context`. :class:`Decimal` instances represent numbers, " +"and :class:`Context` instances are used to wrap up various settings such as " +"the precision and default rounding mode." msgstr "" "新しいモジュール :mod:`decimal` が Python 標準ライブラリに追加されました。こ" -"れには 2 つのクラス :class:`Decimal`, :class:`Context` を含みます。 :class:" -"`Decimal` インスタンスは数値を表現し、 :class:`Context` インスタンスは、精度" -"やデフォルトの丸めモードなどのさまざまな設定をまとめるのに使われます。" +"れには 2 つのクラス :class:`Decimal`, :class:`Context` を含みま" +"す。 :class:`Decimal` インスタンスは数値を表現し、 :class:`Context` インスタ" +"ンスは、精度やデフォルトの丸めモードなどのさまざまな設定をまとめるのに使われ" +"ます。" #: ../../whatsnew/2.4.rst:545 msgid "" @@ -1007,11 +1127,10 @@ msgid "" "represents. :class:`Decimal` instances can be created from integers or " "strings::" msgstr "" -":class:`Decimal` のインスタンスは普通の Python 整数や浮動小数点数のように :" -"term:`immutable` です。 :class:`Decimal` のインスタンスは整数や文字列から構築" -"出来ます::" +":class:`Decimal` のインスタンスは普通の Python 整数や浮動小数点数のよう" +"に :term:`immutable` です。 :class:`Decimal` のインスタンスは整数や文字列から" +"構築出来ます::" -#: ../../whatsnew/2.4.rst:550 msgid "" ">>> import decimal\n" ">>> decimal.Decimal(1972)\n" @@ -1019,6 +1138,11 @@ msgid "" ">>> decimal.Decimal(\"1.1\")\n" "Decimal(\"1.1\")" msgstr "" +">>> import decimal\n" +">>> decimal.Decimal(1972)\n" +"Decimal(\"1972\")\n" +">>> decimal.Decimal(\"1.1\")\n" +"Decimal(\"1.1\")" #: ../../whatsnew/2.4.rst:556 msgid "" @@ -1028,11 +1152,12 @@ msgstr "" "符号(sign)、10進数値のタプルで表した仮数部(mantissa)、指数部(exponent)を含ん" "だタプルを渡すことも出来ます::" -#: ../../whatsnew/2.4.rst:559 msgid "" ">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" "Decimal(\"-14.75\")" msgstr "" +">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" +"Decimal(\"-14.75\")" #: ../../whatsnew/2.4.rst:562 msgid "" @@ -1056,7 +1181,6 @@ msgstr "" "字列に変換して、その文字列を :class:`Decimal` コンストラクタに渡す必要があり" "ます::" -#: ../../whatsnew/2.4.rst:572 msgid "" ">>> f = 1.1\n" ">>> decimal.Decimal(str(f))\n" @@ -1064,6 +1188,11 @@ msgid "" ">>> decimal.Decimal('%.12f' % f)\n" "Decimal(\"1.100000000000\")" msgstr "" +">>> f = 1.1\n" +">>> decimal.Decimal(str(f))\n" +"Decimal(\"1.1\")\n" +">>> decimal.Decimal('%.12f' % f)\n" +"Decimal(\"1.100000000000\")" #: ../../whatsnew/2.4.rst:578 msgid "" @@ -1074,7 +1203,6 @@ msgstr "" "いったん :class:`Decimal` を手にしてしまえばあとは普通の数学演算が使えます。" "制約の一つ: べき乗には整数の指数しか使えません::" -#: ../../whatsnew/2.4.rst:582 msgid "" ">>> a = decimal.Decimal('35.72')\n" ">>> b = decimal.Decimal('1.73')\n" @@ -1093,6 +1221,22 @@ msgid "" " ...\n" "decimal.InvalidOperation: x ** (non-integer)" msgstr "" +">>> a = decimal.Decimal('35.72')\n" +">>> b = decimal.Decimal('1.73')\n" +">>> a+b\n" +"Decimal(\"37.45\")\n" +">>> a-b\n" +"Decimal(\"33.99\")\n" +">>> a*b\n" +"Decimal(\"61.7956\")\n" +">>> a/b\n" +"Decimal(\"20.64739884393063583815028902\")\n" +">>> a ** 2\n" +"Decimal(\"1275.9184\")\n" +">>> a**b\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.InvalidOperation: x ** (non-integer)" #: ../../whatsnew/2.4.rst:599 msgid "" @@ -1102,7 +1246,6 @@ msgstr "" ":class:`Decimal` インスタンスと整数は混ぜて使えますが、浮動小数点数とは出来ま" "せん::" -#: ../../whatsnew/2.4.rst:602 msgid "" ">>> a + 4\n" "Decimal(\"39.72\")\n" @@ -1113,6 +1256,14 @@ msgid "" "types.\n" ">>>" msgstr "" +">>> a + 4\n" +"Decimal(\"39.72\")\n" +">>> a + 4.5\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: You can interact Decimal only with int, long or Decimal data " +"types.\n" +">>>" #: ../../whatsnew/2.4.rst:610 msgid "" @@ -1127,7 +1278,6 @@ msgstr "" "能性があります。戻り値は普通の浮動小数点数であって :class:`Decimal` ではあり" "ません::" -#: ../../whatsnew/2.4.rst:616 msgid "" ">>> import math, cmath\n" ">>> d = decimal.Decimal('123456789012.345')\n" @@ -1136,22 +1286,29 @@ msgid "" ">>> cmath.sqrt(-d)\n" "351364.18288201344j" msgstr "" +">>> import math, cmath\n" +">>> d = decimal.Decimal('123456789012.345')\n" +">>> math.sqrt(d)\n" +"351364.18288201344\n" +">>> cmath.sqrt(-d)\n" +"351364.18288201344j" #: ../../whatsnew/2.4.rst:623 msgid "" -":class:`Decimal` instances have a :meth:`sqrt` method that returns a :class:" -"`Decimal`, but if you need other things such as trigonometric functions " -"you'll have to implement them. ::" +":class:`Decimal` instances have a :meth:`sqrt` method that returns " +"a :class:`Decimal`, but if you need other things such as trigonometric " +"functions you'll have to implement them. ::" msgstr "" -":class:`Decimal` インスタンスは :class:`Decimal` インスタンスを返す :meth:" -"`sqrt` メソッドを持っていますが、三角関数のようななにかほかのことが必要な場合" -"は、それらを実装する必要があるでしょう。::" +":class:`Decimal` インスタンスは :class:`Decimal` インスタンスを返" +"す :meth:`sqrt` メソッドを持っていますが、三角関数のようななにかほかのことが" +"必要な場合は、それらを実装する必要があるでしょう。::" -#: ../../whatsnew/2.4.rst:627 msgid "" ">>> d.sqrt()\n" "Decimal(\"351364.1828820134592177245001\")" msgstr "" +">>> d.sqrt()\n" +"Decimal(\"351364.1828820134592177245001\")" #: ../../whatsnew/2.4.rst:632 msgid "The :class:`Context` type" @@ -1172,12 +1329,14 @@ msgstr ":attr:`prec` は精度で、小数桁数です。" #: ../../whatsnew/2.4.rst:639 msgid "" ":attr:`rounding` specifies the rounding mode. The :mod:`decimal` module has " -"constants for the various possibilities: :const:`ROUND_DOWN`, :const:" -"`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, and various others." +"constants for the various " +"possibilities: :const:`ROUND_DOWN`, :const:`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, " +"and various others." msgstr "" ":attr:`rounding` は丸めのモードを指定します。 :mod:`decimal` にはこの値に渡せ" -"る定数が定義されています: :const:`ROUND_DOWN`, :const:`ROUND_CEILING`, :" -"const:`ROUND_HALF_EVEN`, それに色々。" +"る定数が定義されていま" +"す: :const:`ROUND_DOWN`, :const:`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, そ" +"れに色々。" #: ../../whatsnew/2.4.rst:643 msgid "" @@ -1192,17 +1351,16 @@ msgstr "" #: ../../whatsnew/2.4.rst:648 msgid "" -"There's a thread-local default context available by calling :func:" -"`getcontext`; you can change the properties of this context to alter the " -"default precision, rounding, or trap handling. The following example shows " -"the effect of changing the precision of the default context::" +"There's a thread-local default context available by " +"calling :func:`getcontext`; you can change the properties of this context to " +"alter the default precision, rounding, or trap handling. The following " +"example shows the effect of changing the precision of the default context::" msgstr "" "スレッドローカルなデフォルトのコンテキストを、 :func:`getcontext` を呼び出す" "ことで利用出来ます; デフォルトの精度、丸めモード、トラップ処理に代えてこのコ" "ンテキストのプロパティを変更出来ます。続く例はデフォルトコンテキストの精度を" "変更する効果についてお見せします::" -#: ../../whatsnew/2.4.rst:653 msgid "" ">>> decimal.getcontext().prec\n" "28\n" @@ -1212,6 +1370,13 @@ msgid "" ">>> decimal.Decimal(1) / decimal.Decimal(7)\n" "Decimal(\"0.142857143\")" msgstr "" +">>> decimal.getcontext().prec\n" +"28\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.1428571428571428571428571429\")\n" +">>> decimal.getcontext().prec = 9\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.142857143\")" #: ../../whatsnew/2.4.rst:661 msgid "" @@ -1222,7 +1387,6 @@ msgstr "" "エラー状態の場合のデフォルトアクションを選択出来ます; モジュールは無限大" "(infinity)あるいは非数(not-a-number: NaN)を返すか、例外を投げるかです::" -#: ../../whatsnew/2.4.rst:665 msgid "" ">>> decimal.Decimal(1) / decimal.Decimal(0)\n" "Traceback (most recent call last):\n" @@ -1233,6 +1397,14 @@ msgid "" "Decimal(\"Infinity\")\n" ">>>" msgstr "" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.DivisionByZero: x / 0\n" +">>> decimal.getcontext().traps[decimal.DivisionByZero] = False\n" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Decimal(\"Infinity\")\n" +">>>" #: ../../whatsnew/2.4.rst:674 msgid "" @@ -1262,11 +1434,12 @@ msgstr "" "Facundo Batista によって著され、Facundo Batista, Eric Price, Raymond " "Hettinger, Aahz, Tim Peters らによって実装されました。" -#: ../../whatsnew/2.4.rst:687 msgid "" "`http://www.lahey.com/float.htm `__" msgstr "" +"`http://www.lahey.com/float.htm `__" #: ../../whatsnew/2.4.rst:688 msgid "" @@ -1276,9 +1449,8 @@ msgstr "" "この記事は浮動小数点数の不正確さが起こりうるたくさんの問題について、Fortran " "コードを使って解説しています。" -#: ../../whatsnew/2.4.rst:691 msgid "https://speleotrove.com/decimal/" -msgstr "" +msgstr "https://speleotrove.com/decimal/" #: ../../whatsnew/2.4.rst:692 msgid "" @@ -1310,13 +1482,16 @@ msgstr "" "合、同じモジュールからのインポート文を何度も書くか、行末をバックスラッシュで" "エスケープするかするでしょう、このように::" -#: ../../whatsnew/2.4.rst:708 msgid "" "from SimpleXMLRPCServer import SimpleXMLRPCServer,\\\n" " SimpleXMLRPCRequestHandler,\\\n" " CGIXMLRPCRequestHandler,\\\n" " resolve_dotted_attribute" msgstr "" +"from SimpleXMLRPCServer import SimpleXMLRPCServer,\\\n" +" SimpleXMLRPCRequestHandler,\\\n" +" CGIXMLRPCRequestHandler,\\\n" +" resolve_dotted_attribute" #: ../../whatsnew/2.4.rst:713 msgid "" @@ -1328,13 +1503,16 @@ msgstr "" "けのものです。Python は丸括弧内の改行を無視しますので、バックスラッシュはもう" "必要ありません::" -#: ../../whatsnew/2.4.rst:717 msgid "" "from SimpleXMLRPCServer import (SimpleXMLRPCServer,\n" " SimpleXMLRPCRequestHandler,\n" " CGIXMLRPCRequestHandler,\n" " resolve_dotted_attribute)" msgstr "" +"from SimpleXMLRPCServer import (SimpleXMLRPCServer,\n" +" SimpleXMLRPCRequestHandler,\n" +" CGIXMLRPCRequestHandler,\n" +" resolve_dotted_attribute)" #: ../../whatsnew/2.4.rst:722 msgid "" @@ -1373,16 +1551,19 @@ msgstr "" "する色々な変換や表示の変換を選択出来ます。ところがこのモジュールは、数値ロ" "ケールを変更しないように気を配らなければなりませんでした。というのも Python " "内の色んな関数実装が、数値ロケールが ``'C'`` ロケールにセットされたままである" -"ことを必要としていたからです。しばしばこれは、コードが C ライブラリの :c:" -"func:`atof` 関数を使っていることに原因がありました。" +"ことを必要としていたからです。しばしばこれは、コードが C ライブラリ" +"の :c:func:`atof` 関数を使っていることに原因がありました。" -#: ../../whatsnew/2.4.rst:745 msgid "" "Not setting the numeric locale caused trouble for extensions that used third-" "party C libraries, however, because they wouldn't have the correct locale " "set. The motivating example was GTK+, whose user interface widgets weren't " "displaying numbers in the current locale." msgstr "" +"しかし数値ロケールを設定しないと、外部の C ライブラリを使う拡張モジュールでは" +"正しいロケールが設定されず、問題が起きました。\n" +"変更のきっかけとなった例は GTK+ で、ユーザーインターフェースのウィジェットが" +"現在のロケールに従って数値を表示していませんでした。" #: ../../whatsnew/2.4.rst:750 msgid "" @@ -1398,21 +1579,28 @@ msgid "" "convert a string to a C :c:expr:`double`." msgstr "" -#: ../../whatsnew/2.4.rst:756 msgid "" -"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts a :c:expr:" -"`double` to an ASCII string." +"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts " +"a :c:expr:`double` to an ASCII string." msgstr "" +"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` は :c:expr:`double` を " +"ASCII 文字列に変換します。" -#: ../../whatsnew/2.4.rst:759 msgid "" "The code for these functions came from the GLib library (`https://developer-" "old.gnome.org/glib/2.26/ `__), whose developers kindly relicensed the " -"relevant functions and donated them to the Python Software Foundation. The :" -"mod:`locale` module can now change the numeric locale, letting extensions " -"such as GTK+ produce the correct results." -msgstr "" +"relevant functions and donated them to the Python Software Foundation. " +"The :mod:`locale` module can now change the numeric locale, letting " +"extensions such as GTK+ produce the correct results." +msgstr "" +"これらの関数のコードは GLib ライブラリ (`https://developer-old.gnome.org/" +"glib/2.26/ `__) から来ています。\n" +"その開発者たちは親切にも該当する関数のライセンスを変更し、Python Software " +"Foundation に寄贈してくれました。\n" +":mod:`locale` モジュールは数値ロケールを変更できるようになり、GTK+ などの拡張" +"モジュールが正しい結果を得られるようになりました。" #: ../../whatsnew/2.4.rst:768 msgid ":pep:`331` - Locale-Independent Float/String Conversions" @@ -1441,9 +1629,9 @@ msgid "" "Built-in :func:`set` and :func:`frozenset` types were added (:pep:`218`). " "Other new built-ins include the ``reversed(seq)`` function (:pep:`322`)." msgstr "" -"ビルトインの :func:`set` 型と :func:`frozenset` 型が追加されました (:pep:" -"`218`)。ほか新たなビルトイン関数 ``reversed(seq)`` 関数が追加されました (:" -"pep:`322`)。" +"ビルトインの :func:`set` 型と :func:`frozenset` 型が追加されました " +"(:pep:`218`)。ほか新たなビルトイン関数 ``reversed(seq)`` 関数が追加されまし" +"た (:pep:`322`)。" #: ../../whatsnew/2.4.rst:784 msgid "Generator expressions were added (:pep:`289`)." @@ -1466,9 +1654,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:792 msgid "" -"The :meth:`dict.update` method now accepts the same argument forms as the :" -"class:`dict` constructor. This includes any mapping, any iterable of key/" -"value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" +"The :meth:`dict.update` method now accepts the same argument forms as " +"the :class:`dict` constructor. This includes any mapping, any iterable of " +"key/value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" msgstr "" ":meth:`dict.update` メソッドが :class:`dict` コンストラクタと同じ形式の引数を" "取れるようになりました。これには任意のマッピング、キー/値ペアのイテラブルと" @@ -1486,27 +1674,30 @@ msgstr "" #: ../../whatsnew/2.4.rst:800 msgid "" -"Strings also gained an :meth:`rsplit` method that works like the :meth:" -"`split` method but splits from the end of the string. (Contributed by Sean " -"Reifschneider.) ::" +"Strings also gained an :meth:`rsplit` method that works like " +"the :meth:`split` method but splits from the end of the string. " +"(Contributed by Sean Reifschneider.) ::" msgstr "" -"ほかに、文字列には :meth:`rsplit` メソッドも追加されています。これは :meth:" -"`split` メソッドと似た動きをしますが、後ろから順に分割します (Contributed by " -"Sean Reifschneider.) ::" +"ほかに、文字列には :meth:`rsplit` メソッドも追加されています。これ" +"は :meth:`split` メソッドと似た動きをしますが、後ろから順に分割します " +"(Contributed by Sean Reifschneider.) ::" -#: ../../whatsnew/2.4.rst:804 msgid "" ">>> 'www.python.org'.split('.', 1)\n" "['www', 'python.org']\n" "'www.python.org'.rsplit('.', 1)\n" "['www.python', 'org']" msgstr "" +">>> 'www.python.org'.split('.', 1)\n" +"['www', 'python.org']\n" +"'www.python.org'.rsplit('.', 1)\n" +"['www.python', 'org']" #: ../../whatsnew/2.4.rst:809 msgid "" -"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the :" -"meth:`sort` method of lists. These parameters make some common usages of :" -"meth:`sort` simpler. All of these parameters are optional." +"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to " +"the :meth:`sort` method of lists. These parameters make some common usages " +"of :meth:`sort` simpler. All of these parameters are optional." msgstr "" "リストの :meth:`sort` メソッドに 3 つのキーワード引数 *cmp*, *key*, " "*reverse* が追加されています。これらパラメータは :meth:`sort` のある種の用法" @@ -1517,8 +1708,8 @@ msgid "" "For the *cmp* parameter, the value should be a comparison function that " "takes two parameters and returns -1, 0, or +1 depending on how the " "parameters compare. This function will then be used to sort the list. " -"Previously this was the only parameter that could be provided to :meth:" -"`sort`." +"Previously this was the only parameter that could be provided " +"to :meth:`sort`." msgstr "" "*cmp* パラメータには比較関数を渡します。これは 2 つのパラメータを取り、パラ" "メータの比較結果に応じて -1, 0, +1 のいずれかを返します。この関数はリストの" @@ -1535,7 +1726,6 @@ msgstr "" "較キーを返す関数です。リストはその比較キーを使ってソートされます。続く例はリ" "ストを大文字小文字区別なく並び替えます::" -#: ../../whatsnew/2.4.rst:822 msgid "" ">>> L = ['A', 'b', 'c', 'D']\n" ">>> L.sort() # Case-sensitive sort\n" @@ -1550,6 +1740,18 @@ msgid "" ">>> L\n" "['A', 'b', 'c', 'D']" msgstr "" +">>> L = ['A', 'b', 'c', 'D']\n" +">>> L.sort() # 大文字・小文字を区別してソート\n" +">>> L\n" +"['A', 'D', 'b', 'c']\n" +">>> # 'key' パラメーターでリストをソート\n" +">>> L.sort(key=lambda x: x.lower())\n" +">>> L\n" +"['A', 'b', 'c', 'D']\n" +">>> # 従来の方法\n" +">>> L.sort(cmp=lambda x,y: cmp(x.lower(), y.lower()))\n" +">>> L\n" +"['A', 'b', 'c', 'D']" #: ../../whatsnew/2.4.rst:835 msgid "" @@ -1575,22 +1777,24 @@ msgstr "" "ソッドを使えます。例えば上記の大文字小文字によらない並べ替えはこのように書く" "のが最善です::" -#: ../../whatsnew/2.4.rst:845 msgid "" ">>> L.sort(key=str.lower)\n" ">>> L\n" "['A', 'b', 'c', 'D']" msgstr "" +">>> L.sort(key=str.lower)\n" +">>> L\n" +"['A', 'b', 'c', 'D']" #: ../../whatsnew/2.4.rst:849 msgid "" "Finally, the *reverse* parameter takes a Boolean value. If the value is " -"true, the list will be sorted into reverse order. Instead of ``L.sort(); L." -"reverse()``, you can now write ``L.sort(reverse=True)``." +"true, the list will be sorted into reverse order. Instead of ``L.sort(); " +"L.reverse()``, you can now write ``L.sort(reverse=True)``." msgstr "" "最後の *reverse* パラメータはブーリアン値を取ります。真ならばリストは逆順に" -"ソートされます。 ``L.sort(); L.reverse()`` と書く代わりにこれからは ``L." -"sort(reverse=True)`` と書けます。" +"ソートされます。 ``L.sort(); L.reverse()`` と書く代わりにこれからは " +"``L.sort(reverse=True)`` と書けます。" #: ../../whatsnew/2.4.rst:853 msgid "" @@ -1631,7 +1835,6 @@ msgstr "" msgid "the expression returns the new sorted copy" msgstr "式として新しいソート済みコピーを返します。" -#: ../../whatsnew/2.4.rst:873 msgid "" ">>> L = [9,7,8,3,2,4,1,6,5]\n" ">>> [10+i for i in sorted(L)] # usable in a list comprehension\n" @@ -1652,6 +1855,24 @@ msgid "" "red 1\n" "yellow 5" msgstr "" +">>> L = [9,7,8,3,2,4,1,6,5]\n" +">>> [10+i for i in sorted(L)] # リスト内包表記でも使用可能\n" +"[11, 12, 13, 14, 15, 16, 17, 18, 19]\n" +">>> L # 元のリストは変更されない\n" +"[9,7,8,3,2,4,1,6,5]\n" +">>> sorted('Monty Python') # 任意のイテラブルを入力にできる\n" +"[' ', 'M', 'P', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y', 'y']\n" +"\n" +">>> # 辞書の内容をキーの値でソートして表示\n" +">>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5)\n" +">>> for k, v in sorted(colormap.iteritems()):\n" +"... print k, v\n" +"...\n" +"black 4\n" +"blue 2\n" +"green 3\n" +"red 1\n" +"yellow 5" #: ../../whatsnew/2.4.rst:892 ../../whatsnew/2.4.rst:920 #: ../../whatsnew/2.4.rst:1213 @@ -1660,11 +1881,11 @@ msgstr "(Contributed by Raymond Hettinger.)" #: ../../whatsnew/2.4.rst:894 ../../whatsnew/2.4.rst:1520 msgid "" -"Integer operations will no longer trigger an :exc:`OverflowWarning`. The :" -"exc:`OverflowWarning` warning will disappear in Python 2.5." +"Integer operations will no longer trigger an :exc:`OverflowWarning`. " +"The :exc:`OverflowWarning` warning will disappear in Python 2.5." msgstr "" -"整数演算はもはや :exc:`OverflowWarning` は引き起こしません。 :exc:" -"`OverflowWarning` 警告は Python 2.5 で撤廃されます。" +"整数演算はもはや :exc:`OverflowWarning` は引き起こしませ" +"ん。 :exc:`OverflowWarning` 警告は Python 2.5 で撤廃されます。" #: ../../whatsnew/2.4.rst:897 msgid "" @@ -1693,15 +1914,14 @@ msgstr "" #: ../../whatsnew/2.4.rst:907 msgid "" "The :func:`zip` built-in function and :func:`itertools.izip` now return an " -"empty list if called with no arguments. Previously they raised a :exc:" -"`TypeError` exception. This makes them more suitable for use with variable " -"length argument lists::" +"empty list if called with no arguments. Previously they raised " +"a :exc:`TypeError` exception. This makes them more suitable for use with " +"variable length argument lists::" msgstr "" "ビルトイン関数の :func:`zip` と :func:`itertools.izip` が引数なしで呼ばれた場" "合に空リストを返すようになりました。以前は :exc:`TypeError` 例外でした。これ" "により可変引数リストをこなしやすくなります::" -#: ../../whatsnew/2.4.rst:912 msgid "" ">>> def transpose(array):\n" "... return zip(*array)\n" @@ -1711,14 +1931,25 @@ msgid "" ">>> transpose([])\n" "[]" msgstr "" +">>> def transpose(array):\n" +"... return zip(*array)\n" +"...\n" +">>> transpose([(1,2,3), (4,5,6)])\n" +"[(1, 4), (2, 5), (3, 6)]\n" +">>> transpose([])\n" +"[]" -#: ../../whatsnew/2.4.rst:922 msgid "" "Encountering a failure while importing a module no longer leaves a partially " "initialized module object in ``sys.modules``. The incomplete module object " "left behind would fool further imports of the same module into succeeding, " "leading to confusing errors. (Fixed by Tim Peters.)" msgstr "" +"モジュールのインポート中に失敗しても、部分的に初期化されたモジュールオブジェ" +"クトが ``sys.modules`` に残らなくなりました。\n" +"不完全なモジュールオブジェクトが残ると、その後の同じモジュールのインポートが" +"成功したように見え、分かりにくいエラーにつながっていました。\n" +"(Tim Peters が修正しました。)" #: ../../whatsnew/2.4.rst:927 msgid "" @@ -1737,51 +1968,64 @@ msgstr "最適化" msgid "" "The inner loops for list and tuple slicing were optimized and now run about " "one-third faster. The inner loops for dictionaries were also optimized, " -"resulting in performance boosts for :meth:`keys`, :meth:`values`, :meth:" -"`items`, :meth:`iterkeys`, :meth:`itervalues`, and :meth:`iteritems`. " -"(Contributed by Raymond Hettinger.)" +"resulting in performance boosts " +"for :meth:`keys`, :meth:`values`, :meth:`items`, :meth:`iterkeys`, :meth:`itervalues`, " +"and :meth:`iteritems`. (Contributed by Raymond Hettinger.)" msgstr "" -#: ../../whatsnew/2.4.rst:942 msgid "" "The machinery for growing and shrinking lists was optimized for speed and " "for space efficiency. Appending and popping from lists now runs faster due " -"to more efficient code paths and less frequent use of the underlying system :" -"c:func:`realloc`. List comprehensions also benefit. :meth:`list.extend` " -"was also optimized and no longer converts its argument into a temporary list " -"before extending the base list. (Contributed by Raymond Hettinger.)" +"to more efficient code paths and less frequent use of the underlying " +"system :c:func:`realloc`. List comprehensions also " +"benefit. :meth:`list.extend` was also optimized and no longer converts its " +"argument into a temporary list before extending the base list. (Contributed " +"by Raymond Hettinger.)" msgstr "" +"リストを拡大・縮小する仕組みが、速度とメモリ効率の両面で最適化されました。\n" +"コードの経路が効率化され、システムの :c:func:`realloc` の呼び出し頻度も減った" +"ことで、リストへの追加や取り出しが高速になりました。\n" +"リスト内包表記にも効果があります。\n" +":meth:`list.extend` も最適化され、元のリストを拡張する前に引数を一時的なリス" +"トへ変換しなくなりました。\n" +"(Raymond Hettinger による貢献です。)" #: ../../whatsnew/2.4.rst:949 msgid "" ":func:`list`, :func:`tuple`, :func:`map`, :func:`filter`, and :func:`zip` " -"now run several times faster with non-sequence arguments that supply a :meth:" -"`__len__` method. (Contributed by Raymond Hettinger.)" +"now run several times faster with non-sequence arguments that supply " +"a :meth:`__len__` method. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:953 msgid "" -"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, and :meth:" -"`dict.__contains__` are now implemented as :class:`method_descriptor` " -"objects rather than :class:`wrapper_descriptor` objects. This form of " -"access doubles their performance and makes them more suitable for use as " -"arguments to functionals: ``map(mydict.__getitem__, keylist)``. (Contributed " -"by Raymond Hettinger.)" +"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, " +"and :meth:`dict.__contains__` are now implemented " +"as :class:`method_descriptor` objects rather " +"than :class:`wrapper_descriptor` objects. This form of access doubles " +"their performance and makes them more suitable for use as arguments to " +"functionals: ``map(mydict.__getitem__, keylist)``. (Contributed by Raymond " +"Hettinger.)" msgstr "" -#: ../../whatsnew/2.4.rst:960 msgid "" "Added a new opcode, ``LIST_APPEND``, that simplifies the generated bytecode " "for list comprehensions and speeds them up by about a third. (Contributed " "by Raymond Hettinger.)" msgstr "" +"新しいオペコード ``LIST_APPEND`` が追加され、リスト内包表記のバイトコードが単" +"純になり、約 3 分の 1 高速になりました。\n" +"(Raymond Hettinger による貢献です。)" -#: ../../whatsnew/2.4.rst:964 msgid "" "The peephole bytecode optimizer has been improved to produce shorter, " "faster bytecode; remarkably, the resulting bytecode is more readable. " "(Enhanced by Raymond Hettinger.)" msgstr "" +"バイトコードののぞき穴最適化が改善され、より短く高速なバイトコードを生成する" +"ようになりました。\n" +"注目すべきことに、生成されたバイトコードは読みやすくもなっています。\n" +"(Raymond Hettinger による改善です。)" #: ../../whatsnew/2.4.rst:968 msgid "" @@ -1793,7 +2037,6 @@ msgid "" "number of strings together. (Contributed by Armin Rigo.)" msgstr "" -#: ../../whatsnew/2.4.rst:975 msgid "" "The net result of the 2.4 optimizations is that Python 2.4 runs the pystone " "benchmark around 5% faster than Python 2.3 and 35% faster than Python 2.2. " @@ -1801,6 +2044,12 @@ msgid "" "used measurement of Python's performance. Your own applications may show " "greater or smaller benefits from Python 2.4.)" msgstr "" +"2.4 での最適化を総合すると、Python 2.4 は pystone ベンチマークを Python 2.3 " +"より約 5%、Python 2.2 より約 35% 高速に実行します。\n" +"(pystone は特に優れたベンチマークではありませんが、Python の性能指標として最" +"も広く使われています。\n" +"実際のアプリケーションで Python 2.4 がもたらす効果は、これより大きい場合も小" +"さい場合もあります。)" #: ../../whatsnew/2.4.rst:991 msgid "New, Improved, and Deprecated Modules" @@ -1819,19 +2068,24 @@ msgstr "" "更の完全なリストについてはソースツリーの :file:`Misc/NEWS` を調べるか、あるい" "は全ての詳細について CVS ログに目を通してみてください。" -#: ../../whatsnew/2.4.rst:998 msgid "" "The :mod:`!asyncore` module's :func:`!loop` function now has a *count* " "parameter that lets you perform a limited number of passes through the " "polling loop. The default is still to loop forever." msgstr "" +":mod:`!asyncore` モジュールの :func:`!loop` 関数に *count* パラメーターが加わ" +"り、ポーリングループの実行回数を制限できるようになりました。\n" +"デフォルトでは、従来どおり無限に繰り返します。" -#: ../../whatsnew/2.4.rst:1002 msgid "" "The :mod:`base64` module now has more complete :rfc:`3548` support for " "Base64, Base32, and Base16 encoding and decoding, including optional case " "folding and optional alternative alphabets. (Contributed by Barry Warsaw.)" msgstr "" +":mod:`base64` モジュールが、Base64、Base32、Base16 のエンコードとデコードにつ" +"いて :rfc:`3548` をより完全にサポートするようになりました。\n" +"大文字・小文字の同一視や代替文字集合を選択するオプションも含まれます。\n" +"(Barry Warsaw による貢献です。)" #: ../../whatsnew/2.4.rst:1006 msgid "" @@ -1904,7 +2158,6 @@ msgid "" "either end::" msgstr "" -#: ../../whatsnew/2.4.rst:1036 msgid "" ">>> from collections import deque\n" ">>> d = deque('ghi') # make a new deque with three items\n" @@ -1921,6 +2174,20 @@ msgid "" ">>> 'h' in d # search the deque\n" "True" msgstr "" +">>> from collections import deque\n" +">>> d = deque('ghi') # 3 つの要素を持つ新しい deque を作る\n" +">>> d.append('j') # 右側に新しい要素を追加\n" +">>> d.appendleft('f') # 左側に新しい要素を追加\n" +">>> d # deque の表現を表示\n" +"deque(['f', 'g', 'h', 'i', 'j'])\n" +">>> d.pop() # 右端の要素を取り除いて返す\n" +"'j'\n" +">>> d.popleft() # 左端の要素を取り除いて返す\n" +"'f'\n" +">>> list(d) # deque の内容をリストにする\n" +"['g', 'h', 'i']\n" +">>> 'h' in d # deque を検索\n" +"True" #: ../../whatsnew/2.4.rst:1051 msgid "" @@ -1928,26 +2195,31 @@ msgid "" "take advantage of :class:`collections.deque` for improved performance. " "(Contributed by Raymond Hettinger.)" msgstr "" -":mod:`Queue` や :mod:`threading` のようないくつかのモジュールで、 :class:" -"`collections.deque` を生かして性能改善を成し遂げています。 (Contributed by " -"Raymond Hettinger.)" +":mod:`Queue` や :mod:`threading` のようないくつかのモジュール" +"で、 :class:`collections.deque` を生かして性能改善を成し遂げています。 " +"(Contributed by Raymond Hettinger.)" -#: ../../whatsnew/2.4.rst:1055 msgid "" "The :mod:`ConfigParser ` classes have been enhanced slightly. " "The :meth:`~configparser.ConfigParser.read` method now returns a list of the " -"files that were successfully parsed, and the :meth:`~configparser." -"ConfigParser.set` method raises :exc:`TypeError` if passed a *value* " -"argument that isn't a string. (Contributed by John Belmonte and David " -"Goodger.)" -msgstr "" +"files that were successfully parsed, and " +"the :meth:`~configparser.ConfigParser.set` method raises :exc:`TypeError` if " +"passed a *value* argument that isn't a string. (Contributed by John " +"Belmonte and David Goodger.)" +msgstr "" +":mod:`ConfigParser ` のクラスが少し拡張されました。\n" +":meth:`~configparser.ConfigParser.read` メソッドは正常に解析できたファイルの" +"リストを返すようになり、:meth:`~configparser.ConfigParser.set` メソッドは " +"*value* 引数が文字列でなければ :exc:`TypeError` を送出するようになりまし" +"た。\n" +"(John Belmonte と David Goodger による貢献です。)" #: ../../whatsnew/2.4.rst:1060 msgid "" -"The :mod:`curses` module now supports the ncurses extension :func:" -"`use_default_colors`. On platforms where the terminal supports " -"transparency, this makes it possible to use a transparent background. " -"(Contributed by Jörg Lehmann.)" +"The :mod:`curses` module now supports the ncurses " +"extension :func:`use_default_colors`. On platforms where the terminal " +"supports transparency, this makes it possible to use a transparent " +"background. (Contributed by Jörg Lehmann.)" msgstr "" ":mod:`curses` モジュールが ncurses 拡張の :func:`use_default_colors` をサポー" "トするようになりました。透明性をサポートするターミナルを持つプラットフォーム" @@ -1979,33 +2251,33 @@ msgstr "" "す。パッケージのバージョン 3.0 は MIME メッセージについての漸増的な新パーサを" "使います。これは :mod:`email.FeedParser` モジュールで利用可能です。この新パー" "サはメモリ内に全てのメッセージを読み込んでおく必要がなく、メッセージが不正で" -"あっても例外は投げません; 代わりにメッセージの全ての問題についてを :attr:" -"`defect` 属性に記録します。 (Developed by Anthony Baxter, Barry Warsaw, " -"Thomas Wouters, and others.)" +"あっても例外は投げません; 代わりにメッセージの全ての問題について" +"を :attr:`defect` 属性に記録します。 (Developed by Anthony Baxter, Barry " +"Warsaw, Thomas Wouters, and others.)" #: ../../whatsnew/2.4.rst:1078 msgid "" "The :mod:`heapq` module has been converted to C. The resulting tenfold " "improvement in speed makes the module suitable for handling high volumes of " -"data. In addition, the module has two new functions :func:`nlargest` and :" -"func:`nsmallest` that use heaps to find the N largest or smallest values in " -"a dataset without the expense of a full sort. (Contributed by Raymond " -"Hettinger.)" +"data. In addition, the module has two new functions :func:`nlargest` " +"and :func:`nsmallest` that use heaps to find the N largest or smallest " +"values in a dataset without the expense of a full sort. (Contributed by " +"Raymond Hettinger.)" msgstr "" ":mod:`heapq` モジュールは C に変換されました。性能改善は 10 倍となり、モ" "ジュールはより大きなデータを扱うのに相応しいものになりました。加えて、モ" -"ジュールには新しく 2 つの関数が追加されました。それは :func:`nlargest` と :" -"func:`nsmallest` で、データセット内の大きいものから N 番目まで、小さいものか" -"ら N 番目までを、高価な完全なソートを要することなく取り出すのに使います。" +"ジュールには新しく 2 つの関数が追加されました。それは :func:`nlargest` " +"と :func:`nsmallest` で、データセット内の大きいものから N 番目まで、小さいも" +"のから N 番目までを、高価な完全なソートを要することなく取り出すのに使います。" "(Contributed by Raymond Hettinger.)" #: ../../whatsnew/2.4.rst:1084 msgid "" "The :mod:`httplib ` module now contains constants for HTTP status " "codes defined in various HTTP-related RFC documents. Constants have names " -"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, and :const:" -"`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed by Andrew " -"Eland.)" +"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, " +"and :const:`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed " +"by Andrew Eland.)" msgstr "" #: ../../whatsnew/2.4.rst:1090 @@ -2015,8 +2287,8 @@ msgid "" "(contributed by Arnaud Mazin)." msgstr "" ":mod:`imaplib` モジュールが IMAP の THREAD コマンドをサポートするようになりま" -"した。 (contributed by Yves Dionne) また、 :meth:`deleteacl` メソッドと :" -"meth:`myrights` メソッドが追加されました。 (contributed by Arnaud Mazin)." +"した。 (contributed by Yves Dionne) また、 :meth:`deleteacl` メソッド" +"と :meth:`myrights` メソッドが追加されました。 (contributed by Arnaud Mazin)." #: ../../whatsnew/2.4.rst:1094 msgid "" @@ -2044,7 +2316,6 @@ msgstr "" "例をお見せするのが早いでしょう。ここでは *key* 関数は単に数値が偶数か奇数かを" "返すだけです。 :func:`groupby` の結果は偶数または奇数の一連の流れを返します::" -#: ../../whatsnew/2.4.rst:1106 msgid "" ">>> import itertools\n" ">>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]\n" @@ -2058,18 +2329,28 @@ msgid "" "0 [12, 14]\n" ">>>" msgstr "" +">>> import itertools\n" +">>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]\n" +">>> for key_val, it in itertools.groupby(L, lambda x: x % 2):\n" +"... print key_val, list(it)\n" +"...\n" +"0 [2, 4, 6]\n" +"1 [7]\n" +"0 [8]\n" +"1 [9, 11]\n" +"0 [12, 14]\n" +">>>" #: ../../whatsnew/2.4.rst:1118 msgid "" -":func:`groupby` is typically used with sorted input. The logic for :func:" -"`groupby` is similar to the Unix ``uniq`` filter which makes it handy for " -"eliminating, counting, or identifying duplicate elements::" +":func:`groupby` is typically used with sorted input. The logic " +"for :func:`groupby` is similar to the Unix ``uniq`` filter which makes it " +"handy for eliminating, counting, or identifying duplicate elements::" msgstr "" ":func:`groupby` は典型的にはソート済み入力に使います。 :func:`groupby` のロ" "ジックは除外、数え上げ、重複要素の特定を手軽に行う Unix の ``uniq`` フィルタ" "に似ています::" -#: ../../whatsnew/2.4.rst:1122 msgid "" ">>> word = 'abracadabra'\n" ">>> letters = sorted(word) # Turn string into a sorted list of letters\n" @@ -2090,6 +2371,24 @@ msgid "" ">>> [(k, len(list(g))) for k, g in groupby(letters)]\n" "[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]" msgstr "" +">>> word = 'abracadabra'\n" +">>> letters = sorted(word) # 文字列をソートされた文字のリストにする\n" +">>> letters\n" +"['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r']\n" +">>> for k, g in itertools.groupby(letters):\n" +"... print k, list(g)\n" +"...\n" +"a ['a', 'a', 'a', 'a', 'a']\n" +"b ['b', 'b']\n" +"c ['c']\n" +"d ['d']\n" +"r ['r', 'r']\n" +">>> # 重複しない文字を列挙\n" +">>> [k for k, g in groupby(letters)]\n" +"['a', 'b', 'c', 'd', 'r']\n" +">>> # 文字の出現回数を数える\n" +">>> [(k, len(list(g))) for k, g in groupby(letters)]\n" +"[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]" #: ../../whatsnew/2.4.rst:1141 msgid "(Contributed by Hye-Shik Chang.)" @@ -2105,7 +2404,6 @@ msgstr "" "す。これは *iterator* の、独立した *N* 個の複製イテレータを返します。 *N* は" "省略されればデフォルトは 2 です。::" -#: ../../whatsnew/2.4.rst:1147 msgid "" ">>> L = [1,2,3]\n" ">>> i1, i2 = itertools.tee(L)\n" @@ -2117,6 +2415,15 @@ msgid "" ">>> list(i2) # Run the second iterator to exhaustion\n" "[1, 2, 3]" msgstr "" +">>> L = [1,2,3]\n" +">>> i1, i2 = itertools.tee(L)\n" +">>> i1,i2\n" +"(, )\n" +">>> list(i1) # 最初のイテレータを最後まで進める\n" +"[1, 2, 3]\n" +">>> list(i2) # 2 つ目のイテレータを最後まで進める\n" +"[1, 2, 3]" #: ../../whatsnew/2.4.rst:1156 msgid "" @@ -2140,19 +2447,19 @@ msgstr "" #: ../../whatsnew/2.4.rst:1165 msgid "" -"A number of functions were added to the :mod:`locale` module, such as :func:" -"`bind_textdomain_codeset` to specify a particular encoding and a family of :" -"func:`!l\\*gettext` functions that return messages in the chosen encoding. " -"(Contributed by Gustavo Niemeyer.)" +"A number of functions were added to the :mod:`locale` module, such " +"as :func:`bind_textdomain_codeset` to specify a particular encoding and a " +"family of :func:`!l\\*gettext` functions that return messages in the chosen " +"encoding. (Contributed by Gustavo Niemeyer.)" msgstr "" #: ../../whatsnew/2.4.rst:1170 msgid "" -"Some keyword arguments were added to the :mod:`logging` package's :func:" -"`basicConfig` function to simplify log configuration. The default behavior " -"is to log messages to standard error, but various keyword arguments can be " -"specified to log to a particular file, change the logging format, or set the " -"logging level. For example::" +"Some keyword arguments were added to the :mod:`logging` " +"package's :func:`basicConfig` function to simplify log configuration. The " +"default behavior is to log messages to standard error, but various keyword " +"arguments can be specified to log to a particular file, change the logging " +"format, or set the logging level. For example::" msgstr "" ":mod:`logging` パッケージの :func:`basicConfig` 関数に、ログ設定を簡単にする" "いくつかのキーワード引数が追加されました。デフォルトの振る舞いはログメッセー" @@ -2172,18 +2479,18 @@ msgstr "" msgid "" "Other additions to the :mod:`logging` package include a ``log(level, msg)`` " "convenience method, as well as a :class:`TimedRotatingFileHandler` class " -"that rotates its log files at a timed interval. The module already had :" -"class:`RotatingFileHandler`, which rotated logs once the file exceeded a " -"certain size. Both classes derive from a new :class:`BaseRotatingHandler` " +"that rotates its log files at a timed interval. The module already " +"had :class:`RotatingFileHandler`, which rotated logs once the file exceeded " +"a certain size. Both classes derive from a new :class:`BaseRotatingHandler` " "class that can be used to implement other rotating handlers." msgstr "" "ほかの :mod:`logging` パッケージへの追加としては、 便利メソッド ``log(level, " -"msg)`` や、ログファイルを時間間隔でローテートするクラス :class:" -"`TimedRotatingFileHandler` などがあります。モジュールには元々 :class:" -"`RotatingFileHandler` が含まれており、こちらはファイルが特定のサイズを超過し" -"た場合にローテートするものです。両クラスとも新しく導出された :class:" -"`BaseRotatingHandler` 基底クラスから派生していて、これはまた別のローテートす" -"るハンドラを実装するのに使えます。" +"msg)`` や、ログファイルを時間間隔でローテートするクラ" +"ス :class:`TimedRotatingFileHandler` などがあります。モジュールには" +"元々 :class:`RotatingFileHandler` が含まれており、こちらはファイルが特定のサ" +"イズを超過した場合にローテートするものです。両クラスとも新しく導出され" +"た :class:`BaseRotatingHandler` 基底クラスから派生していて、これはまた別の" +"ローテートするハンドラを実装するのに使えます。" #: ../../whatsnew/2.4.rst:1188 msgid "(Changes implemented by Vinay Sajip.)" @@ -2213,8 +2520,8 @@ msgid "" "Two new functions were added to the :mod:`operator` module, " "``attrgetter(attr)`` and ``itemgetter(index)``. Both functions return " "callables that take a single argument and return the corresponding attribute " -"or item; these callables make excellent data extractors when used with :func:" -"`map` or :func:`sorted`. For example::" +"or item; these callables make excellent data extractors when used " +"with :func:`map` or :func:`sorted`. For example::" msgstr "" ":mod:`operator` モジュールに 2 つの関数 ``attrgetter(attr)`` と " "``itemgetter(index)`` が追加されています。両関数ともに、単一引数を取ってそれ" @@ -2222,7 +2529,6 @@ msgstr "" "出し可能オブジェクトは :func:`map` や :func:`sorted` とともに使う際の優れた" "データ抽出器になります。例えば::" -#: ../../whatsnew/2.4.rst:1205 msgid "" ">>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]\n" ">>> map(operator.itemgetter(0), L)\n" @@ -2232,6 +2538,14 @@ msgid "" ">>> sorted(L, key=operator.itemgetter(1)) # Sort list by second tuple item\n" "[('d', 1), ('c', 2), ('b', 3), ('a', 4)]" msgstr "" +">>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]\n" +">>> map(operator.itemgetter(0), L)\n" +"['c', 'd', 'a', 'b']\n" +">>> map(operator.itemgetter(1), L)\n" +"[2, 1, 4, 3]\n" +">>> sorted(L, key=operator.itemgetter(1)) # タプルの 2 番目の要素でリストを" +"ソート\n" +"[('d', 1), ('c', 2), ('b', 3), ('a', 4)]" #: ../../whatsnew/2.4.rst:1215 msgid "" @@ -2241,21 +2555,26 @@ msgid "" "can now include the string ``'%default'``, which will be replaced by the " "option's default value. (Contributed by Greg Ward.)" msgstr "" -":mod:`optparse` モジュールが色々更新されました。モジュールはメッセージを :" -"func:`gettext.gettext` を通して Optik のヘルプとエラーメッセージを国際化する" -"のを可能にしています。オプションのヘルプメッセージは文字列 ``'%default'`` を" -"含めることが出来るようになっており、これはオプションのデフォルト値に置換され" -"ます。(Contributed by Greg Ward.)" +":mod:`optparse` モジュールが色々更新されました。モジュールはメッセージ" +"を :func:`gettext.gettext` を通して Optik のヘルプとエラーメッセージを国際化" +"するのを可能にしています。オプションのヘルプメッセージは文字列 " +"``'%default'`` を含めることが出来るようになっており、これはオプションのデフォ" +"ルト値に置換されます。(Contributed by Greg Ward.)" -#: ../../whatsnew/2.4.rst:1221 msgid "" "The long-term plan is to deprecate the :mod:`!rfc822` module in some future " -"Python release in favor of the :mod:`email` package. To this end, the :func:" -"`email.Utils.formatdate ` function has been changed " -"to make it usable as a replacement for :func:`!rfc822.formatdate`. You may " -"want to write new e-mail processing code with this in mind. (Change " -"implemented by Anthony Baxter.)" -msgstr "" +"Python release in favor of the :mod:`email` package. To this end, " +"the :func:`email.Utils.formatdate ` function has " +"been changed to make it usable as a replacement for :func:`!" +"rfc822.formatdate`. You may want to write new e-mail processing code with " +"this in mind. (Change implemented by Anthony Baxter.)" +msgstr "" +"長期的には、将来の Python リリースで :mod:`!rfc822` モジュールを非推奨に" +"し、:mod:`email` パッケージへ置き換える計画です。\n" +"そのため、:func:`email.Utils.formatdate ` 関数" +"が :func:`!rfc822.formatdate` の代わりに使えるよう変更されました。\n" +"新しい電子メール処理のコードは、この点を考慮して書くとよいでしょう。\n" +"(Anthony Baxter による変更です。)" #: ../../whatsnew/2.4.rst:1227 msgid "" @@ -2316,9 +2635,9 @@ msgid "" "Hettinger.)" msgstr "" ":mod:`random` モジュールに、 ``getrandbits(N)`` 関数が追加されました。 *N* " -"ビット長の長整数を返します。既存の :meth:`randrange` メソッドは :meth:" -"`getrandbits` を適切な場所で使うようになり、任意の大きな乱数値生成をより効果" -"的にしています。 (Contributed by Raymond Hettinger.)" +"ビット長の長整数を返します。既存の :meth:`randrange` メソッド" +"は :meth:`getrandbits` を適切な場所で使うようになり、任意の大きな乱数値生成を" +"より効果的にしています。 (Contributed by Raymond Hettinger.)" #: ../../whatsnew/2.4.rst:1253 msgid "" @@ -2379,10 +2698,10 @@ msgid "" "service name for a given port number. (Contributed by Dave Cole and Barry " "Warsaw.)" msgstr "" -":mod:`socket` モジュールに 2 つ新しい関数が追加されています。 :func:" -"`socketpair` 関数は接続したソケットのペアを返し、 ``getservbyport(port)`` は" -"与えたポート番号からサービス名を探して返します。(Contributed by Dave Cole " -"and Barry Warsaw.)" +":mod:`socket` モジュールに 2 つ新しい関数が追加されていま" +"す。 :func:`socketpair` 関数は接続したソケットのペアを返し、 " +"``getservbyport(port)`` は与えたポート番号からサービス名を探して返します。" +"(Contributed by Dave Cole and Barry Warsaw.)" #: ../../whatsnew/2.4.rst:1280 msgid "" @@ -2414,7 +2733,6 @@ msgstr "" "の良い単純な方法でサポート出来ました。モジュールは :class:`local` クラスを" "持っており、その属性値は異なるスレッドごとにローカルになります::" -#: ../../whatsnew/2.4.rst:1292 msgid "" "import threading\n" "\n" @@ -2422,12 +2740,18 @@ msgid "" "data.number = 42\n" "data.url = ('www.python.org', 80)" msgstr "" +"import threading\n" +"\n" +"data = threading.local()\n" +"data.number = 42\n" +"data.url = ('www.python.org', 80)" #: ../../whatsnew/2.4.rst:1298 msgid "" -"Other threads can assign and retrieve their own values for the :attr:" -"`number` and :attr:`url` attributes. You can subclass :class:`local` to " -"initialize attributes or to add methods. (Contributed by Jim Fulton.)" +"Other threads can assign and retrieve their own values for " +"the :attr:`number` and :attr:`url` attributes. You can " +"subclass :class:`local` to initialize attributes or to add methods. " +"(Contributed by Jim Fulton.)" msgstr "" "この場合他のスレッドは :attr:`number` 属性、 :attr:`url` 属性に自身の値を代" "入、抽出出来ます。 :class:`local` クラスは属性初期化であるとかメソッドの追加" @@ -2454,12 +2778,14 @@ msgstr "" "これには Python 関数、クラスインスタンス, set, frozenset, deque, array と正規" "表現パターンオブジェクトが含まれます。(Contributed by Raymond Hettinger.)" -#: ../../whatsnew/2.4.rst:1311 msgid "" "The :mod:`xmlrpclib ` module now supports a multi-call " "extension for transmitting multiple XML-RPC calls in a single HTTP " "operation. (Contributed by Brian Quinlan.)" msgstr "" +":mod:`xmlrpclib ` モジュールが、1 回の HTTP 操作で複数の XML-" +"RPC 呼び出しを送る multi-call 拡張に対応しました。\n" +"(Brian Quinlan による貢献です。)" #: ../../whatsnew/2.4.rst:1315 msgid "" @@ -2472,7 +2798,6 @@ msgstr "" msgid "cookielib" msgstr "cookielib" -#: ../../whatsnew/2.4.rst:1326 msgid "" "The :mod:`cookielib ` library supports client-side handling " "for HTTP cookies, mirroring the :mod:`Cookie ` module's server-" @@ -2481,6 +2806,14 @@ msgid "" "and fetches the cookie from the jar when connecting to the server. As in web " "browsers, policy objects control whether cookies are accepted or not." msgstr "" +":mod:`cookielib ` ライブラリは、:mod:`Cookie ` " +"モジュールのサーバー側のクッキー処理に対応する、クライアント側の HTTP クッ" +"キー処理をサポートします。\n" +"クッキーはクッキージャーに格納されます。\n" +"ライブラリは、Web サーバーから受け取ったクッキーをクッキージャーへ自動的に保" +"存し、サーバーへの接続時にそこから取り出します。\n" +"Web ブラウザーと同じく、クッキーを受け入れるかどうかはポリシーオブジェクトが" +"制御します。" #: ../../whatsnew/2.4.rst:1333 msgid "" @@ -2496,9 +2829,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1338 msgid "" -":mod:`urllib2 ` has been changed to interact with :mod:" -"`cookielib `: :class:`HTTPCookieProcessor` manages a cookie " -"jar that is used when accessing URLs." +":mod:`urllib2 ` has been changed to interact " +"with :mod:`cookielib `: :class:`HTTPCookieProcessor` manages " +"a cookie jar that is used when accessing URLs." msgstr "" #: ../../whatsnew/2.4.rst:1342 @@ -2512,14 +2845,14 @@ msgstr "doctest" #: ../../whatsnew/2.4.rst:1350 msgid "" "The :mod:`doctest` module underwent considerable refactoring thanks to " -"Edward Loper and Tim Peters. Testing can still be as simple as running :" -"func:`doctest.testmod`, but the refactorings allow customizing the module's " -"operation in various ways" +"Edward Loper and Tim Peters. Testing can still be as simple as " +"running :func:`doctest.testmod`, but the refactorings allow customizing the " +"module's operation in various ways" msgstr "" "Edward Loper と Tim Peters のおかげにより、 :mod:`doctest` モジュールに注目に" -"値するリファクタリングが入りました。テストはこれまで通り単純に :func:" -"`doctest.testmod` を実行するすることで行えますが、リファクタリングはモジュー" -"ルの操作をカスタマイズする色々な手段を提供してくれます。" +"値するリファクタリングが入りました。テストはこれまで通り単純" +"に :func:`doctest.testmod` を実行するすることで行えますが、リファクタリングは" +"モジュールの操作をカスタマイズする色々な手段を提供してくれます。" #: ../../whatsnew/2.4.rst:1355 msgid "" @@ -2529,7 +2862,6 @@ msgstr "" "新規クラス :class:`DocTestFinder` は指定したオブジェクトの docstring からテス" "トを抽出します::" -#: ../../whatsnew/2.4.rst:1358 msgid "" "def f (x, y):\n" " \"\"\">>> f(2,2)\n" @@ -2544,6 +2876,18 @@ msgid "" "# Get list of DocTest instances\n" "tests = finder.find(f)" msgstr "" +"def f (x, y):\n" +" \"\"\">>> f(2,2)\n" +"4\n" +">>> f(3,2)\n" +"6\n" +" \"\"\"\n" +" return x*y\n" +"\n" +"finder = doctest.DocTestFinder()\n" +"\n" +"# DocTest インスタンスのリストを取得\n" +"tests = finder.find(f)" #: ../../whatsnew/2.4.rst:1371 msgid "" @@ -2553,7 +2897,6 @@ msgstr "" "新規クラス :class:`DocTestRunner` はテストを個々に実行し、結果の要約を生成出" "来ます::" -#: ../../whatsnew/2.4.rst:1374 msgid "" "runner = doctest.DocTestRunner()\n" "for t in tests:\n" @@ -2561,12 +2904,16 @@ msgid "" "\n" "runner.summarize(verbose=1)" msgstr "" +"runner = doctest.DocTestRunner()\n" +"for t in tests:\n" +" tried, failed = runner.run(t)\n" +"\n" +"runner.summarize(verbose=1)" #: ../../whatsnew/2.4.rst:1380 msgid "The above example produces the following output::" msgstr "上の例はこのような出力を生成します::" -#: ../../whatsnew/2.4.rst:1382 msgid "" "1 items passed all tests:\n" " 2 tests in f\n" @@ -2574,6 +2921,11 @@ msgid "" "2 passed and 0 failed.\n" "Test passed." msgstr "" +"1 items passed all tests:\n" +" 2 tests in f\n" +"2 tests in 1 items.\n" +"2 passed and 0 failed.\n" +"Test passed." #: ../../whatsnew/2.4.rst:1388 msgid "" @@ -2582,10 +2934,10 @@ msgid "" "number of different flags that customize its behaviour; ambitious users can " "also write a completely new subclass of :class:`OutputChecker`." msgstr "" -":class:`DocTestRunner` は実際の出力と結果の期待値の比較に、 :class:" -"`OutputChecker` のインスタンスを使います。このクラスはその振る舞いをカスタマ" -"イズする色々なフラグを取ります。意欲的なユーザであれば :class:" -"`OutputChecker` の完全な新しいサブクラスも書けます。" +":class:`DocTestRunner` は実際の出力と結果の期待値の比較" +"に、 :class:`OutputChecker` のインスタンスを使います。このクラスはその振る舞" +"いをカスタマイズする色々なフラグを取ります。意欲的なユーザであれ" +"ば :class:`OutputChecker` の完全な新しいサブクラスも書けます。" #: ../../whatsnew/2.4.rst:1393 msgid "" @@ -2594,12 +2946,11 @@ msgid "" "expected output matches any substring, making it easier to accommodate " "outputs that vary in minor ways::" msgstr "" -"デフォルトの出力チェッカーは多くのお手軽機能を持っています。例えば :const:" -"`doctest.ELLIPSIS` オプションフラグは、出力の期待値内での省略記号 (``...``) " -"と任意文字列を一致するとみなし、瑣末な部分が変化するような出力に簡単に適合す" -"るように出来ます::" +"デフォルトの出力チェッカーは多くのお手軽機能を持っています。例え" +"ば :const:`doctest.ELLIPSIS` オプションフラグは、出力の期待値内での省略記号 " +"(``...``) と任意文字列を一致するとみなし、瑣末な部分が変化するような出力に簡" +"単に適合するように出来ます::" -#: ../../whatsnew/2.4.rst:1398 msgid "" "def o (n):\n" " \"\"\">>> o(1)\n" @@ -2607,12 +2958,16 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def o (n):\n" +" \"\"\">>> o(1)\n" +"<__main__.C instance at 0x...>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1404 msgid "Another special string, ````, matches a blank line::" msgstr "もう一つの特殊文字列 ```` は空行に合致します::" -#: ../../whatsnew/2.4.rst:1406 msgid "" "def p (n):\n" " \"\"\">>> p(1)\n" @@ -2620,20 +2975,25 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def p (n):\n" +" \"\"\">>> p(1)\n" +"\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1412 msgid "" "Another new capability is producing a diff-style display of the output by " -"specifying the :const:`doctest.REPORT_UDIFF` (unified diffs), :const:" -"`doctest.REPORT_CDIFF` (context diffs), or :const:`doctest.REPORT_NDIFF` " -"(delta-style) option flags. For example::" +"specifying the :const:`doctest.REPORT_UDIFF` (unified " +"diffs), :const:`doctest.REPORT_CDIFF` (context diffs), " +"or :const:`doctest.REPORT_NDIFF` (delta-style) option flags. For example::" msgstr "" -"もう一つの新機能は出力の diff スタイル出力で、オプションフラグに :const:" -"`doctest.REPORT_UDIFF` (unified diffs), :const:`doctest.REPORT_CDIFF` " -"(context diffs), :const:`doctest.REPORT_NDIFF` (delta-style) を指定することで" -"利用出来ます。例えば以下があるとして::" +"もう一つの新機能は出力の diff スタイル出力で、オプションフラグ" +"に :const:`doctest.REPORT_UDIFF` (unified " +"diffs), :const:`doctest.REPORT_CDIFF` (context " +"diffs), :const:`doctest.REPORT_NDIFF` (delta-style) を指定することで利用出来" +"ます。例えば以下があるとして::" -#: ../../whatsnew/2.4.rst:1417 msgid "" "def g (n):\n" " \"\"\">>> g(4)\n" @@ -2646,14 +3006,24 @@ msgid "" " for word in L[:n]:\n" " print word" msgstr "" +"def g (n):\n" +" \"\"\">>> g(4)\n" +"here\n" +"is\n" +"a\n" +"lengthy\n" +">>>\"\"\"\n" +" L = 'here is a rather lengthy list of words'.split()\n" +" for word in L[:n]:\n" +" print word" -#: ../../whatsnew/2.4.rst:1428 msgid "" "Running the above function's tests with :const:`doctest.REPORT_UDIFF` " "specified, you get the following output:" msgstr "" +"上の関数のテストを :const:`doctest.REPORT_UDIFF` を指定して実行すると、次の出" +"力が得られます。" -#: ../../whatsnew/2.4.rst:1431 msgid "" "**********************************************************************\n" "File \"t.py\", line 15, in g\n" @@ -2667,6 +3037,17 @@ msgid "" " +rather\n" "**********************************************************************" msgstr "" +"**********************************************************************\n" +"File \"t.py\", line 15, in g\n" +"Failed example:\n" +" g(4)\n" +"Differences (unified diff with -expected +actual):\n" +" @@ -2,3 +2,3 @@\n" +" is\n" +" a\n" +" -lengthy\n" +" +rather\n" +"**********************************************************************" #: ../../whatsnew/2.4.rst:1449 msgid "Build and C API Changes" @@ -2683,14 +3064,17 @@ msgid "" "and :c:macro:`Py_RETURN_FALSE`. (Contributed by Brett Cannon.)" msgstr "" "拡張関数からの戻り値として一般的に使うための 3 つの便利なマクロが追加されてい" -"ます: :c:macro:`Py_RETURN_NONE`, :c:macro:`Py_RETURN_TRUE`, :c:macro:" -"`Py_RETURN_FALSE` (Contributed by Brett Cannon.)" +"ま" +"す: :c:macro:`Py_RETURN_NONE`, :c:macro:`Py_RETURN_TRUE`, :c:macro:`Py_RETURN_FALSE` " +"(Contributed by Brett Cannon.)" -#: ../../whatsnew/2.4.rst:1457 msgid "" "Another new macro, :c:macro:`Py_CLEAR`, decreases the reference count of " "*obj* and sets *obj* to the null pointer. (Contributed by Jim Fulton.)" msgstr "" +"もう一つの新しいマクロ :c:macro:`Py_CLEAR` は、*obj* の参照カウントを減らし、" +"*obj* をヌルポインターに設定します。\n" +"(Jim Fulton による貢献です。)" #: ../../whatsnew/2.4.rst:1460 msgid "" @@ -2716,23 +3100,26 @@ msgid "" "*X* is a NaN. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.4.rst:1471 msgid "" "C code can avoid unnecessary locking by using the new :c:func:`!" "PyEval_ThreadsInitialized` function to tell if any thread operations have " "been performed. If this function returns false, no lock operations are " "needed. (Contributed by Nick Coghlan.)" msgstr "" +"C コードでは、新しい :c:func:`!PyEval_ThreadsInitialized` 関数でスレッド操作" +"が行われたかどうかを調べ、不要なロックを避けられます。\n" +"この関数が偽を返す場合、ロック操作は不要です。\n" +"(Nick Coghlan による貢献です。)" #: ../../whatsnew/2.4.rst:1476 msgid "" -"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same as :c:" -"func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of " -"a number of arguments. (Contributed by Greg Chapman.)" +"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same " +"as :c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` " +"instead of a number of arguments. (Contributed by Greg Chapman.)" msgstr "" -"新規関数 :c:func:`PyArg_VaParseTupleAndKeywords` は :c:func:" -"`PyArg_ParseTupleAndKeywords` と同じですが、たくさんの引数の代わりに :c:type:" -"`va_list` を取ることだけが違います。(Contributed by Greg Chapman.)" +"新規関数 :c:func:`PyArg_VaParseTupleAndKeywords` " +"は :c:func:`PyArg_ParseTupleAndKeywords` と同じですが、たくさんの引数の代わり" +"に :c:type:`va_list` を取ることだけが違います。(Contributed by Greg Chapman.)" #: ../../whatsnew/2.4.rst:1480 msgid "" @@ -2742,23 +3129,32 @@ msgid "" "(Contributed by Raymond Hettinger.)" msgstr "" -#: ../../whatsnew/2.4.rst:1485 msgid "" "Python can now be built with additional profiling for the interpreter " -"itself, intended as an aid to people developing the Python core. Providing :" -"option:`!--enable-profiling` to the :program:`configure` script will let you " -"profile the interpreter with :program:`gprof`, and providing the :option:`!--" -"with-tsc` switch enables profiling using the Pentium's Time-Stamp-Counter " -"register. Note that the :option:`!--with-tsc` switch is slightly misnamed, " -"because the profiling feature also works on the PowerPC platform, though " -"that processor architecture doesn't call that register \"the TSC " -"register\". (Contributed by Jeremy Hylton.)" -msgstr "" +"itself, intended as an aid to people developing the Python core. " +"Providing :option:`!--enable-profiling` to the :program:`configure` script " +"will let you profile the interpreter with :program:`gprof`, and providing " +"the :option:`!--with-tsc` switch enables profiling using the Pentium's Time-" +"Stamp-Counter register. Note that the :option:`!--with-tsc` switch is " +"slightly misnamed, because the profiling feature also works on the PowerPC " +"platform, though that processor architecture doesn't call that register " +"\"the TSC register\". (Contributed by Jeremy Hylton.)" +msgstr "" +"Python コアの開発を支援するため、インタープリタ自体の追加のプロファイリング機" +"能を有効にしてビルドできるようになりました。\n" +":program:`configure` スクリプトに :option:`!--enable-profiling` を指定する" +"と :program:`gprof` でインタープリタをプロファイルでき、:option:`!--with-" +"tsc` を指定すると Pentium のタイムスタンプカウンターレジスターを使ったプロ" +"ファイリングが有効になります。\n" +":option:`!--with-tsc` という名前は少し不正確です。\n" +"この機能は PowerPC でも動作しますが、そのアーキテクチャでは該当するレジスター" +"を「TSC レジスター」とは呼ばないためです。\n" +"(Jeremy Hylton による貢献です。)" #: ../../whatsnew/2.4.rst:1495 msgid "" -"The :c:type:`!tracebackobject` type has been renamed to :c:type:" -"`PyTracebackObject`." +"The :c:type:`!tracebackobject` type has been renamed " +"to :c:type:`PyTracebackObject`." msgstr "" #: ../../whatsnew/2.4.rst:1502 @@ -2813,11 +3209,12 @@ msgid "" "(``<``, ``>``) will raise a :exc:`TypeError`." msgstr "" -#: ../../whatsnew/2.4.rst:1532 msgid "" ":func:`!dircache.listdir` now passes exceptions to the caller instead of " "returning empty lists." msgstr "" +":func:`!dircache.listdir` は、空のリストを返す代わりに、例外を呼び出し側へ伝" +"えるようになりました。" #: ../../whatsnew/2.4.rst:1535 msgid "" @@ -2844,11 +3241,12 @@ msgstr "" ":mod:`tarfile` モジュールがデフォルトで GNU フォーマットを生成するようになっ" "ています。" -#: ../../whatsnew/2.4.rst:1544 msgid "" "Encountering a failure while importing a module no longer leaves a partially " "initialized module object in ``sys.modules``." msgstr "" +"モジュールのインポート中に失敗しても、部分的に初期化されたモジュールオブジェ" +"クトが ``sys.modules`` に残らなくなりました。" #: ../../whatsnew/2.4.rst:1547 msgid "" @@ -2862,8 +3260,8 @@ msgstr "" msgid "" "The :func:`signals.signal` function now raises a :exc:`RuntimeError` " "exception for certain illegal values; previously these errors would pass " -"silently. For example, you can no longer set a handler on the :const:" -"`SIGKILL` signal." +"silently. For example, you can no longer set a handler on " +"the :const:`SIGKILL` signal." msgstr "" ":func:`signals.signal` 関数は、ある種の不正な値では :exc:`RuntimeError` を投" "げるようになっています。以前はこれらエラーは黙って通していました。例えばも" @@ -2889,6 +3287,5 @@ msgstr "" msgid "universal newlines" msgstr "universal newlines" -#: ../../whatsnew/2.4.rst:415 msgid "What's new" -msgstr "" +msgstr "新機能" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index 868f77dcb..993c646fe 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 @@ -38,12 +38,15 @@ msgstr "著者" msgid "A.M. Kuchling" msgstr "A.M. Kuchling" -#: ../../whatsnew/2.5.rst:12 msgid "" "This article explains the new features in Python 2.5. The final release of " "Python 2.5 is scheduled for August 2006; :pep:`356` describes the planned " "release schedule. Python 2.5 was released on September 19, 2006." msgstr "" +"この記事では Python 2.5 の新機能を説明します。\n" +"Python 2.5 の最終リリースは 2006 年 8 月に予定されており、:pep:`356` にリリー" +"ス計画が記載されています。\n" +"Python 2.5 は 2006 年 9 月 19 日にリリースされました。" #: ../../whatsnew/2.5.rst:16 msgid "" @@ -64,22 +67,22 @@ msgid "" "statement will make writing cleanup code easier (section :ref:`pep-343`). " "Values can now be passed into generators (section :ref:`pep-342`). Imports " "are now visible as either absolute or relative (section :ref:`pep-328`). " -"Some corner cases of exception handling are handled better (section :ref:" -"`pep-341`). All these improvements are worthwhile, but they're improvements " -"to one specific language feature or another; none of them are broad " -"modifications to Python's semantics." +"Some corner cases of exception handling are handled better " +"(section :ref:`pep-341`). All these improvements are worthwhile, but " +"they're improvements to one specific language feature or another; none of " +"them are broad modifications to Python's semantics." msgstr "" "言語の変更の意義は、中程度のものです。いくつかの心地よい機能が入りましたが、" "そのほとんどの機能は毎日使うというものでもありません。条件式(conditional " -"expressions)がついに言語に追加されました。ちょっと変わった文法です。 :ref:" -"`pep-308` のセクションを参照してください。新しい ':keyword:`with`' 文は後始末" -"のコードを書くのを簡単にします(:ref:`pep-343` セクション)。ジェネレータに値を" -"返すことが出来るようになりました(:ref:`pep-342` セクション)。インポートが、絶" -"対パス、相対パスのどちらかで可視に出来るようになりました(:ref:`pep-328` セク" -"ション)。例外ハンドリングのいくつかの境界のケースで、より良いハンドリングを行" -"えるようになりました(:ref:`pep-341` セクション)。これらのどの改善も価値が高い" -"ですが、それらは言語機能を限定的に改善するものであって、いずれも Python のセ" -"マンティクスを広範に修正するものではありません。" +"expressions)がついに言語に追加されました。ちょっと変わった文法で" +"す。 :ref:`pep-308` のセクションを参照してください。新しい ':keyword:`with`' " +"文は後始末のコードを書くのを簡単にします(:ref:`pep-343` セクション)。ジェネ" +"レータに値を返すことが出来るようになりました(:ref:`pep-342` セクション)。イン" +"ポートが、絶対パス、相対パスのどちらかで可視に出来るようになりました" +"(:ref:`pep-328` セクション)。例外ハンドリングのいくつかの境界のケースで、より" +"良いハンドリングを行えるようになりました(:ref:`pep-341` セクション)。これらの" +"どの改善も価値が高いですが、それらは言語機能を限定的に改善するものであって、" +"いずれも Python のセマンティクスを広範に修正するものではありません。" #: ../../whatsnew/2.5.rst:34 msgid "" @@ -133,13 +136,16 @@ msgstr "" "は Boolean 値が真か偽かによって値 A または B を返す式です。条件式により以下と" "同じ効果を持つ単一行代入式を書くことが出来ます::" -#: ../../whatsnew/2.5.rst:61 msgid "" "if condition:\n" " x = true_value\n" "else:\n" " x = false_value" msgstr "" +"if condition:\n" +" x = true_value\n" +"else:\n" +" x = false_value" #: ../../whatsnew/2.5.rst:66 msgid "" @@ -159,9 +165,8 @@ msgstr "" msgid "Guido van Rossum eventually chose a surprising syntax::" msgstr "Guido van Rossum は結果として意外な構文を選択しました::" -#: ../../whatsnew/2.5.rst:74 msgid "x = true_value if condition else false_value" -msgstr "" +msgstr "x = true_value if condition else false_value" #: ../../whatsnew/2.5.rst:76 msgid "" @@ -195,9 +200,8 @@ msgstr "" "にのみ使われていました。条件の構文はこのパターンで少しばかり明快さを増しま" "す::" -#: ../../whatsnew/2.5.rst:90 msgid "contents = ((doc + '\\n') if doc else '')" -msgstr "" +msgstr "contents = ((doc + '\\n') if doc else '')" #: ../../whatsnew/2.5.rst:92 msgid "" @@ -222,7 +226,6 @@ msgstr "" "定は Python 言語文法として括弧は *必要ない* とされましたが、スタイルの問題と" "しては私は常に括弧を付けるべきと思います。以下 2 つの例を考えてみてください::" -#: ../../whatsnew/2.5.rst:102 msgid "" "# First version -- no parens\n" "level = 1 if logging else 0\n" @@ -230,6 +233,11 @@ msgid "" "# Second version -- with parens\n" "level = (1 if logging else 0)" msgstr "" +"# 最初の書き方 -- 括弧なし\n" +"level = 1 if logging else 0\n" +"\n" +"# 2 つ目の書き方 -- 括弧あり\n" +"level = (1 if logging else 0)" #: ../../whatsnew/2.5.rst:108 msgid "" @@ -309,7 +317,6 @@ msgstr "" msgid "Here's a small but realistic example::" msgstr "以下にあるのは、小さいけれども現実的な一つの例です::" -#: ../../whatsnew/2.5.rst:150 msgid "" "import functools\n" "\n" @@ -321,20 +328,28 @@ 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')" #: ../../whatsnew/2.5.rst:160 msgid "" "Here's another example, from a program that uses PyGTK. Here a context-" "sensitive pop-up menu is being constructed dynamically. The callback " -"provided for the menu option is a partially applied version of the :meth:" -"`open_item` method, where the first argument has been provided. ::" +"provided for the menu option is a partially applied version of " +"the :meth:`open_item` method, where the first argument has been provided. ::" msgstr "" "もうひとつ、PyGTK を使うプログラムからの例をみてみましょう。いま、「コンテキ" "スト依存」のポップアップメニューを動的に構築しようとしています。そのメニュー" "オプションから提供されるコールバックは、 :meth:`open_item` メソッドの部分適用" "版で、その最初の引数が適用済みです::" -#: ../../whatsnew/2.5.rst:165 msgid "" "...\n" "class Application:\n" @@ -344,6 +359,13 @@ msgid "" " open_func = functools.partial(self.open_item, item_path)\n" " popup_menu.append( (\"Open\", open_func, 1) )" msgstr "" +"...\n" +"class Application:\n" +" def open_item(self, path):\n" +" ...\n" +" def init (self):\n" +" open_func = functools.partial(self.open_item, item_path)\n" +" popup_menu.append( (\"Open\", open_func, 1) )" #: ../../whatsnew/2.5.rst:173 msgid "" @@ -354,12 +376,11 @@ msgid "" "wrapped function are easier to understand. For example, you might write::" msgstr "" ":mod:`functools` モジュールのもう一つの関数は ``update_wrapper(wrapper, " -"wrapped)`` で、より良く振舞うデコレータを書くのに役立ちます。 :func:" -"`update_wrapper` は包まれるほうの名前、モジュール、ドキュメンテーション文字列" -"属性をラッパー関数にコピーすることで、トレースバックを理解しやすくします。た" -"とえばこう書けます::" +"wrapped)`` で、より良く振舞うデコレータを書くのに役立ちま" +"す。 :func:`update_wrapper` は包まれるほうの名前、モジュール、ドキュメンテー" +"ション文字列属性をラッパー関数にコピーすることで、トレースバックを理解しやす" +"くします。たとえばこう書けます::" -#: ../../whatsnew/2.5.rst:179 msgid "" "def my_decorator(f):\n" " def wrapper(*args, **kwds):\n" @@ -368,6 +389,12 @@ msgid "" " functools.update_wrapper(wrapper, f)\n" " return wrapper" msgstr "" +"def my_decorator(f):\n" +" def wrapper(*args, **kwds):\n" +" print 'Calling decorated function'\n" +" return f(*args, **kwds)\n" +" functools.update_wrapper(wrapper, f)\n" +" return wrapper" #: ../../whatsnew/2.5.rst:186 msgid "" @@ -378,7 +405,6 @@ msgstr "" ":func:`wraps` は、ラップされる関数についての情報をコピーするために、あなた自" "身のデコレータ内で使えるデコレータです。先の例はこのようにも書けます::" -#: ../../whatsnew/2.5.rst:190 msgid "" "def my_decorator(f):\n" " @functools.wraps(f)\n" @@ -387,6 +413,12 @@ msgid "" " return f(*args, **kwds)\n" " return wrapper" msgstr "" +"def my_decorator(f):\n" +" @functools.wraps(f)\n" +" def wrapper(*args, **kwds):\n" +" print 'Calling decorated function'\n" +" return f(*args, **kwds)\n" +" return wrapper" #: ../../whatsnew/2.5.rst:200 msgid ":pep:`309` - Partial Function Application" @@ -417,10 +449,10 @@ msgid "" "command, the dependency information will be recorded in the :file:`PKG-INFO` " "file." msgstr "" -"Distutils にいくつかの単純な依存性解決サポートが追加されました。 :func:" -"`setup` 関数に ``requires``, ``provides``, ``obsoletes`` キーワードパラメー" -"タが追加されています。 ``sdist`` コマンドでソース配布物をビルドする際に、依存" -"性についての情報が :file:`PKG-INFO` ファイルに記録されます。" +"Distutils にいくつかの単純な依存性解決サポートが追加されまし" +"た。 :func:`setup` 関数に ``requires``, ``provides``, ``obsoletes`` キーワー" +"ドパラメータが追加されています。 ``sdist`` コマンドでソース配布物をビルドする" +"際に、依存性についての情報が :file:`PKG-INFO` ファイルに記録されます。" #: ../../whatsnew/2.5.rst:217 msgid "" @@ -434,7 +466,6 @@ msgstr "" "し出すことが出来、パッケージの依存性を決めることが出来、必要パッケージをダウ" "ンロード出来ます::" -#: ../../whatsnew/2.5.rst:222 msgid "" "VERSION = '1.0'\n" "setup(name='PyPackage',\n" @@ -445,6 +476,14 @@ msgid "" " % VERSION),\n" " )" msgstr "" +"VERSION = '1.0'\n" +"setup(name='PyPackage',\n" +" version=VERSION,\n" +" requires=['numarray', 'zlib (>=1.1.4)'],\n" +" obsoletes=['OldPackage']\n" +" download_url=('http://www.example.com/pypackage/dist/pkg-%s.tar.gz'\n" +" % VERSION),\n" +" )" #: ../../whatsnew/2.5.rst:231 msgid "" @@ -494,13 +533,15 @@ msgstr "" msgid "PEP 328: Absolute and Relative Imports" msgstr "PEP 328: 絶対インポート、相対インポート" -#: ../../whatsnew/2.5.rst:259 msgid "" "The simpler part of :pep:`328` was implemented in Python 2.4: parentheses " "could now be used to enclose the names imported from a module using the " "``from ... import ...`` statement, making it easier to import many different " "names." msgstr "" +":pep:`328` のうち単純な部分は Python 2.4 で実装されました。\n" +"``from ... import ...`` 文でモジュールからインポートする名前を括弧で囲めるよ" +"うになり、多数の名前を簡単にインポートできるようになりました。" #: ../../whatsnew/2.5.rst:263 msgid "" @@ -518,37 +559,40 @@ msgstr "" msgid "Let's say you have a package directory like this::" msgstr "いま、あなたは以下のようなパッケージディレクトリを持っているとします::" -#: ../../whatsnew/2.5.rst:269 msgid "" "pkg/\n" "pkg/__init__.py\n" "pkg/main.py\n" "pkg/string.py" msgstr "" +"pkg/\n" +"pkg/__init__.py\n" +"pkg/main.py\n" +"pkg/string.py" #: ../../whatsnew/2.5.rst:274 msgid "" -"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` and :" -"mod:`pkg.string` submodules." +"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` " +"and :mod:`pkg.string` submodules." msgstr "" -":mod:`pkg` パッケージがモジュール :mod:`pkg.main` とサブモジュール :mod:`pkg." -"string` を持っています。" +":mod:`pkg` パッケージがモジュール :mod:`pkg.main` とサブモジュー" +"ル :mod:`pkg.string` を持っています。" #: ../../whatsnew/2.5.rst:277 msgid "" "Consider the code in the :file:`main.py` module. What happens if it " "executes the statement ``import string``? In Python 2.4 and earlier, it " "will first look in the package's directory to perform a relative import, " -"finds :file:`pkg/string.py`, imports the contents of that file as the :mod:" -"`pkg.string` module, and that module is bound to the name ``string`` in the :" -"mod:`pkg.main` module's namespace." +"finds :file:`pkg/string.py`, imports the contents of that file as " +"the :mod:`pkg.string` module, and that module is bound to the name " +"``string`` in the :mod:`pkg.main` module's namespace." msgstr "" ":file:`main.py` のなかの人、になってみましょう。 ``import string`` 文を実行す" "ると、何が起こるでしょうか? Python 2.4 とそれ以前のバージョンでは、相対イン" -"ポートとして実行するためにパッケージのディレクトリ内のものを最初に探し、 :" -"file:`pkg/string.py` を発見してそのファイル内容を :mod:`pkg.string` モジュー" -"ルであるとしてインポートし、そのモジュールは :mod:`pkg.main` モジュール内の名" -"前空間で、名前 ``string`` に束縛されます。" +"ポートとして実行するためにパッケージのディレクトリ内のものを最初に探" +"し、 :file:`pkg/string.py` を発見してそのファイル内容を :mod:`pkg.string` モ" +"ジュールであるとしてインポートし、そのモジュールは :mod:`pkg.main` モジュール" +"内の名前空間で、名前 ``string`` に束縛されます。" #: ../../whatsnew/2.5.rst:284 msgid "" @@ -561,29 +605,29 @@ msgid "" "that package isn't available on all Python installations." msgstr "" "よろしいでしょう。欲しいものが :mod:`pkg.string` であるならば。ですが欲しいの" -"は Python 標準ライブラリモジュールの :mod:`string` なのだとしたら? :mod:`pkg." -"string` を無視して標準モジュールを探す綺麗な方法はありません; 一般的に、 " -"``sys.modules`` の中身から探す必要がありました。これはちょっとばかり美しくあ" -"りません。Holger Krekel の :mod:`py.std` パッケージは標準ライブラリからモ" -"ジュールをインポートするのに ``import py; py.std.string.join()`` と、よりこぎ" -"れいな方法を与えてくれますが、そのパッケージは全ての Python インストレーショ" -"ンでの利用が可能にはなっていません。" +"は Python 標準ライブラリモジュールの :mod:`string` なのだとした" +"ら? :mod:`pkg.string` を無視して標準モジュールを探す綺麗な方法はありません; " +"一般的に、 ``sys.modules`` の中身から探す必要がありました。これはちょっとばか" +"り美しくありません。Holger Krekel の :mod:`py.std` パッケージは標準ライブラリ" +"からモジュールをインポートするのに ``import py; py.std.string.join()`` と、よ" +"りこぎれいな方法を与えてくれますが、そのパッケージは全ての Python インスト" +"レーションでの利用が可能にはなっていません。" #: ../../whatsnew/2.5.rst:292 msgid "" "Reading code which relies on relative imports is also less clear, because a " -"reader may be confused about which module, :mod:`string` or :mod:`pkg." -"string`, is intended to be used. Python users soon learned not to duplicate " -"the names of standard library modules in the names of their packages' " -"submodules, but you can't protect against having your submodule's name being " -"used for a new module added in a future version of Python." -msgstr "" -"相対インポートに頼ったコードを読むことは、より不明瞭でもあります。読者は :" -"mod:`string` と :mod:`pkg.string` のどちらを使おうとしているのかについて、混" -"乱するだろうからです。Python ユーザはすぐに、彼らのパッケージのサブモジュール" -"名が標準ライブラリモジュールの名前と被らないようにすることを学びますが、あな" -"たのサブモジュール名が将来のバージョンの Python に追加される新しいモジュール" -"で使われる名前にならないようにすることは出来ません。" +"reader may be confused about which module, :mod:`string` " +"or :mod:`pkg.string`, is intended to be used. Python users soon learned not " +"to duplicate the names of standard library modules in the names of their " +"packages' submodules, but you can't protect against having your submodule's " +"name being used for a new module added in a future version of Python." +msgstr "" +"相対インポートに頼ったコードを読むことは、より不明瞭でもあります。読者" +"は :mod:`string` と :mod:`pkg.string` のどちらを使おうとしているのかについ" +"て、混乱するだろうからです。Python ユーザはすぐに、彼らのパッケージのサブモ" +"ジュール名が標準ライブラリモジュールの名前と被らないようにすることを学びます" +"が、あなたのサブモジュール名が将来のバージョンの Python に追加される新しいモ" +"ジュールで使われる名前にならないようにすることは出来ません。" #: ../../whatsnew/2.5.rst:299 msgid "" @@ -613,34 +657,39 @@ msgstr "" "相対インポートは、 ``from ... import`` 形式を使う際にモジュール名の前にピリオ" "ドを付ければまだ可能です::" -#: ../../whatsnew/2.5.rst:310 msgid "" "# Import names from pkg.string\n" "from .string import name1, name2\n" "# Import pkg.string\n" "from . import string" msgstr "" +"# pkg.string から名前をインポート\n" +"from .string import name1, name2\n" +"# pkg.string をインポート\n" +"from . import string" #: ../../whatsnew/2.5.rst:315 msgid "" "This imports the :mod:`string` module relative to the current package, so " -"in :mod:`pkg.main` this will import *name1* and *name2* from :mod:`pkg." -"string`. Additional leading periods perform the relative import starting " -"from the parent of the current package. For example, code in the :mod:`A.B." -"C` module can do::" +"in :mod:`pkg.main` this will import *name1* and *name2* " +"from :mod:`pkg.string`. Additional leading periods perform the relative " +"import starting from the parent of the current package. For example, code " +"in the :mod:`A.B.C` module can do::" msgstr "" "これは現在のパッケージからの相対で :mod:`string` モジュールをインポートします" -"ので、 :mod:`pkg.main` 内ではこれは、 *name1* と *name2* を :mod:`pkg." -"string` からインポートするでしょう。加えて、先行する複数ピリオドは、現在の" -"パッケージの親からの相対インポートを実行します。例えば、 :mod:`A.B.C` モ" -"ジュール内のコードはこのように出来ます::" +"ので、 :mod:`pkg.main` 内ではこれは、 *name1* と *name2* " +"を :mod:`pkg.string` からインポートするでしょう。加えて、先行する複数ピリオド" +"は、現在のパッケージの親からの相対インポートを実行します。例え" +"ば、 :mod:`A.B.C` モジュール内のコードはこのように出来ます::" -#: ../../whatsnew/2.5.rst:320 msgid "" "from . import D # Imports A.B.D\n" "from .. import E # Imports A.E\n" "from ..F import G # Imports A.F.G" msgstr "" +"from . import D # A.B.D をインポート\n" +"from .. import E # A.E をインポート\n" +"from ..F import G # A.F.G をインポート" #: ../../whatsnew/2.5.rst:324 msgid "" @@ -660,7 +709,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 "" @@ -686,18 +735,18 @@ msgstr "" #: ../../whatsnew/2.5.rst:349 msgid "" "The :mod:`runpy` module implements a more sophisticated import mechanism so " -"that it's now possible to run modules in a package such as :mod:`pychecker." -"checker`. The module also supports alternative import mechanisms such as " -"the :mod:`zipimport` module. This means you can add a .zip archive's path " -"to ``sys.path`` and then use the :option:`-m` switch to execute code from " -"the archive." +"that it's now possible to run modules in a package such " +"as :mod:`pychecker.checker`. The module also supports alternative import " +"mechanisms such as the :mod:`zipimport` module. This means you can add " +"a .zip archive's path to ``sys.path`` and then use the :option:`-m` switch " +"to execute code from the archive." msgstr "" ":mod:`runpy` モジュールはインポートのメカニズムをより洗練された方法で実装して" "いるので、今では :mod:`pychecker.checker` のようにパッケージ内のモジュールも" -"実行出来ます。このモジュールは異なるインポートメカニズム、例えば :mod:" -"`zipimport` モジュールもサポートします。このことにより、 ``sys.path`` に ." -"zip アーカイブのパスを追加して、 :option:`-m` スイッチでアーカイブ内のコード" -"を実行する、といったことも出来ます。" +"実行出来ます。このモジュールは異なるインポートメカニズム、例え" +"ば :mod:`zipimport` モジュールもサポートします。このことにより、 " +"``sys.path`` に .zip アーカイブのパスを追加して、 :option:`-m` スイッチでアー" +"カイブ内のコードを実行する、といったことも出来ます。" #: ../../whatsnew/2.5.rst:359 msgid ":pep:`338` - Executing modules as scripts" @@ -711,7 +760,6 @@ msgstr "PEP 著と実装 Nick Coghlan." msgid "PEP 341: Unified try/except/finally" msgstr "PEP 341: try/except/finally の一体化" -#: ../../whatsnew/2.5.rst:370 msgid "" "Until Python 2.5, the :keyword:`try` statement came in two flavours. You " "could use a :keyword:`finally` block to ensure that code is always executed, " @@ -721,6 +769,13 @@ msgid "" "complicated and it wasn't clear what the semantics of the combined statement " "should be." msgstr "" +"Python 2.5 より前には、:keyword:`try` 文には 2 つの形式がありました。\n" +":keyword:`finally` ブロックでコードが必ず実行されるようにするか、一つ以上" +"の :keyword:`except` ブロックで特定の例外を捕捉するかでした。\n" +":keyword:`!except` ブロックと :keyword:`!finally` ブロックの両方を組み合わせ" +"ることはできませんでした。\n" +"組み合わせた場合に正しいバイトコードを生成するのが複雑で、その文の意味をどう" +"するべきかも明確ではなかったためです。" #: ../../whatsnew/2.5.rst:377 msgid "" @@ -729,13 +784,12 @@ msgid "" "block, and this clarified what the statement should mean. In Python 2.5, " "you can now write::" msgstr "" -"Guido van Rossum はいくらかの時間 Java での作業に時間を割きました。それは :" -"keyword:`except` ブロックと :keyword:`finally` ブロックを組み合わせるのと等価" -"なものをサポートしています。そしてこの作業が、このステートメントがどういう意" -"味であるべきかを明らかにしたのです。Python 2.5 では、あなたは今ではこう書くこ" -"とが出来ます::" +"Guido van Rossum はいくらかの時間 Java での作業に時間を割きました。それ" +"は :keyword:`except` ブロックと :keyword:`finally` ブロックを組み合わせるのと" +"等価なものをサポートしています。そしてこの作業が、このステートメントがどうい" +"う意味であるべきかを明らかにしたのです。Python 2.5 では、あなたは今ではこう書" +"くことが出来ます::" -#: ../../whatsnew/2.5.rst:382 msgid "" "try:\n" " block-1 ...\n" @@ -748,20 +802,30 @@ msgid "" "finally:\n" " final-block" msgstr "" +"try:\n" +" block-1 ...\n" +"except Exception1:\n" +" handler-1 ...\n" +"except Exception2:\n" +" handler-2 ...\n" +"else:\n" +" else-block\n" +"finally:\n" +" final-block" #: ../../whatsnew/2.5.rst:393 msgid "" "The code in *block-1* is executed. If the code raises an exception, the " -"various :keyword:`except` blocks are tested: if the exception is of class :" -"class:`Exception1`, *handler-1* is executed; otherwise if it's of class :" -"class:`Exception2`, *handler-2* is executed, and so forth. If no exception " -"is raised, the *else-block* is executed." +"various :keyword:`except` blocks are tested: if the exception is of " +"class :class:`Exception1`, *handler-1* is executed; otherwise if it's of " +"class :class:`Exception2`, *handler-2* is executed, and so forth. If no " +"exception is raised, the *else-block* is executed." msgstr "" -"*block-1* 内のコードが実行されます。そのコードが例外を投げた場合、個々の :" -"keyword:`except` ブロックがテストされます: その例外が :class:`Exception1` ク" -"ラスであれば、 *handler-1* が実行されます; そうでない場合で :class:" -"`Exception2` クラスであれば、 *handler-2* が実行されます、以下同文。例外が起" -"こらなければ、 *else-block* が実行されます。" +"*block-1* 内のコードが実行されます。そのコードが例外を投げた場合、個々" +"の :keyword:`except` ブロックがテストされます: その例外" +"が :class:`Exception1` クラスであれば、 *handler-1* が実行されます; そうでな" +"い場合で :class:`Exception2` クラスであれば、 *handler-2* が実行されます、以" +"下同文。例外が起こらなければ、 *else-block* が実行されます。" #: ../../whatsnew/2.5.rst:399 msgid "" @@ -811,7 +875,6 @@ msgid "To refresh your memory of basic generators, here's a simple example::" msgstr "" "基本的なジェネレータについて思い出してもらいましょう、単純な例はこんなです:" -#: ../../whatsnew/2.5.rst:428 msgid "" "def counter (maximum):\n" " i = 0\n" @@ -819,8 +882,12 @@ msgid "" " yield i\n" " i += 1" msgstr "" +"def counter (maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" yield i\n" +" i += 1" -#: ../../whatsnew/2.5.rst:434 msgid "" "When you call ``counter(10)``, the result is an iterator that returns the " "values from 0 up to 9. On encountering the :keyword:`yield` statement, the " @@ -829,17 +896,24 @@ msgid "" "the iterator's :meth:`next` method, picking up after the :keyword:`!yield` " "statement." msgstr "" +"``counter(10)`` を呼び出すと、0 から 9 までの値を返すイテレータが得られま" +"す。\n" +":keyword:`yield` 文に到達すると、イテレータは指定された値を返し、ローカル変数" +"を保持したまま関数の実行を一時停止します。\n" +"次にイテレータの :meth:`next` メソッドを呼び出すと、:keyword:`!yield` 文の直" +"後から実行を再開します。" -#: ../../whatsnew/2.5.rst:440 msgid "" "In Python 2.3, :keyword:`yield` was a statement; it didn't return any " "value. In 2.5, :keyword:`!yield` is now an expression, returning a value " "that can be assigned to a variable or otherwise operated on::" msgstr "" +"Python 2.3 の :keyword:`yield` は文で、値を返しませんでした。\n" +"2.5 の :keyword:`!yield` は式になり、変数への代入やほかの演算に使える値を返し" +"ます。 ::" -#: ../../whatsnew/2.5.rst:444 msgid "val = (yield i)" -msgstr "" +msgstr "val = (yield i)" #: ../../whatsnew/2.5.rst:446 msgid "" @@ -854,24 +928,28 @@ msgstr "" #: ../../whatsnew/2.5.rst:451 msgid "" -"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ -" -"expression must always be parenthesized except when it occurs at the top-" +"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ " +"-expression must always be parenthesized except when it occurs at the top-" "level expression on the right-hand side of an assignment. This means you " "can write ``val = yield i`` but have to use parentheses when there's an " "operation, as in ``val = (yield i) + 12``.)" msgstr "" -"(:pep:`342` がその規則を正確に説明していますが、それによると :keyword:" -"`yield` 式は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を付ける必" -"要があります。つまり ``val = yield i`` とは書けますが、 ``val = (yield i) + " -"12`` のように演算子があるときは括弧を使わなくてはいけません。)" +"(:pep:`342` がその規則を正確に説明していますが、それによる" +"と :keyword:`yield` 式は、代入式で右辺のトップレベルにあるとき以外はいつも括" +"弧を付ける必要があります。つまり ``val = yield i`` とは書けますが、 ``val = " +"(yield i) + 12`` のように演算子があるときは括弧を使わなくてはいけません。)" -#: ../../whatsnew/2.5.rst:458 msgid "" "Values are sent into a generator by calling its ``send(value)`` method. The " "generator's code is then resumed and the :keyword:`yield` expression returns " -"the specified *value*. If the regular :meth:`next` method is called, the :" -"keyword:`!yield` returns :const:`None`." +"the specified *value*. If the regular :meth:`next` method is called, " +"the :keyword:`!yield` returns :const:`None`." msgstr "" +"ジェネレータへ値を送るには、``send(value)`` メソッドを呼び出します。\n" +"するとジェネレータの実行が再開され、:keyword:`yield` 式が指定された *value* " +"を返します。\n" +"通常の :meth:`next` メソッドを呼び出した場合は、:keyword:`!yield` " +"が :const:`None` を返します。" #: ../../whatsnew/2.5.rst:463 msgid "" @@ -879,7 +957,6 @@ msgid "" "internal counter. ::" msgstr "以下は前のと同じ例ですが、内部カウンタの値の変更を許す修正をしました::" -#: ../../whatsnew/2.5.rst:466 msgid "" "def counter (maximum):\n" " i = 0\n" @@ -891,12 +968,20 @@ 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" #: ../../whatsnew/2.5.rst:476 msgid "And here's an example of changing the counter::" msgstr "そしてカウンタ変更の例がこちらです::" -#: ../../whatsnew/2.5.rst:478 msgid "" ">>> it = counter(10)\n" ">>> print it.next()\n" @@ -913,6 +998,20 @@ msgid "" " print it.next()\n" "StopIteration" msgstr "" +">>> it = counter(10)\n" +">>> print it.next()\n" +"0\n" +">>> print it.next()\n" +"1\n" +">>> print it.send(8)\n" +"8\n" +">>> print it.next()\n" +"9\n" +">>> print it.next()\n" +"Traceback (most recent call last):\n" +" File \"t.py\", line 15, in ?\n" +" print it.next()\n" +"StopIteration" #: ../../whatsnew/2.5.rst:493 msgid "" @@ -938,33 +1037,33 @@ msgid "" "expression where the generator's execution is paused." msgstr "" "``throw(type, value=None, traceback=None)`` はジェネレータ内で例外を投げるた" -"めに使います; その例外はジェネレータの実行が停止したところの :keyword:" -"`yield` 式によって投げられます。" +"めに使います; その例外はジェネレータの実行が停止したところ" +"の :keyword:`yield` 式によって投げられます。" #: ../../whatsnew/2.5.rst:504 msgid "" ":meth:`close` raises a new :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " -"generator's code must either raise :exc:`GeneratorExit` or :exc:" -"`StopIteration`. Catching the :exc:`GeneratorExit` exception and returning " -"a value is illegal and will trigger a :exc:`RuntimeError`; if the function " -"raises some other exception, that exception is propagated to the caller. :" -"meth:`close` will also be called by Python's garbage collector when the " -"generator is garbage-collected." +"generator's code must either raise :exc:`GeneratorExit` " +"or :exc:`StopIteration`. Catching the :exc:`GeneratorExit` exception and " +"returning a value is illegal and will trigger a :exc:`RuntimeError`; if the " +"function raises some other exception, that exception is propagated to the " +"caller. :meth:`close` will also be called by Python's garbage collector " +"when the generator is garbage-collected." msgstr "" ":meth:`close` はジェネレータ内で :exc:`GeneratorExit` 例外を投げてイテレート" -"を終了させます。この例外を受け取ったジェネレータのコードは :exc:" -"`GeneratorExit` か :exc:`StopIteration` を投げなくてはいけません; この例外を" -"捕捉して何かほかのことをしようとするのは規則違反であり、 :exc:`RuntimeError` " -"を引き起こします; 関数が何かほかの例外を投げると、その例外は呼び出し元に伝播" -"します。 :meth:`close` はジェネレータのガーベージコレクトによっても呼ばれま" -"す。" +"を終了させます。この例外を受け取ったジェネレータのコード" +"は :exc:`GeneratorExit` か :exc:`StopIteration` を投げなくてはいけません; こ" +"の例外を捕捉して何かほかのことをしようとするのは規則違反であ" +"り、 :exc:`RuntimeError` を引き起こします; 関数が何かほかの例外を投げると、そ" +"の例外は呼び出し元に伝播します。 :meth:`close` はジェネレータのガーベージコレ" +"クトによっても呼ばれます。" #: ../../whatsnew/2.5.rst:512 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`." +"suggest using a ``try: ... finally:`` suite instead of " +"catching :exc:`GeneratorExit`." msgstr "" ":exc:`GeneratorExit` が起こったときにクリーンアップ作業をする必要があるな" "ら、 :exc:`GeneratorExit` を捕捉するのではなく ``try: ... finaly:`` するよう" @@ -988,10 +1087,10 @@ msgid "" "effectively in Python." msgstr "" "ジェネレータは *コルーチン* という、より一般化された形式のサブルーチンにもな" -"ります。サブルーチンは一カ所 (関数の冒頭) から入って別の一カ所 (:keyword:" -"`return` 文) から出るだけですが、コルーチンはいろいろな場所 (:keyword:" -"`yield` 文) から入ったり出たり再開したりできるのです。わたしたちは Python で" -"コルーチンを効果的に使うためのパターンを理解する必要があります。" +"ります。サブルーチンは一カ所 (関数の冒頭) から入って別の一カ所 " +"(:keyword:`return` 文) から出るだけですが、コルーチンはいろいろな場所 " +"(:keyword:`yield` 文) から入ったり出たり再開したりできるのです。わたしたちは " +"Python でコルーチンを効果的に使うためのパターンを理解する必要があります。" #: ../../whatsnew/2.5.rst:524 msgid "" @@ -999,21 +1098,22 @@ msgid "" "obvious. :meth:`close` is called when a generator is garbage-collected, so " "this means the generator's code gets one last chance to run before the " "generator is destroyed. This last chance means that ``try...finally`` " -"statements in generators can now be guaranteed to work; the :keyword:" -"`finally` clause will now always get a chance to run. The syntactic " -"restriction that you couldn't mix :keyword:`yield` statements with a ``try..." -"finally`` suite has therefore been removed. This seems like a minor bit of " -"language trivia, but using generators and ``try...finally`` is actually " -"necessary in order to implement the :keyword:`with` statement described by :" -"pep:`343`. I'll look at this new statement in the following section." +"statements in generators can now be guaranteed to work; " +"the :keyword:`finally` clause will now always get a chance to run. The " +"syntactic restriction that you couldn't mix :keyword:`yield` statements with " +"a ``try...finally`` suite has therefore been removed. This seems like a " +"minor bit of language trivia, but using generators and ``try...finally`` is " +"actually necessary in order to implement the :keyword:`with` statement " +"described by :pep:`343`. I'll look at this new statement in the following " +"section." msgstr "" #: ../../whatsnew/2.5.rst:536 msgid "" -"Another even more esoteric effect of this change: previously, the :attr:" -"`gi_frame` attribute of a generator was always a frame object. It's now " -"possible for :attr:`gi_frame` to be ``None`` once the generator has been " -"exhausted." +"Another even more esoteric effect of this change: previously, " +"the :attr:`gi_frame` attribute of a generator was always a frame object. " +"It's now possible for :attr:`gi_frame` to be ``None`` once the generator has " +"been exhausted." msgstr "" "もう一つさらに深遠なこの変更の効果: 以前はジェネレータの :attr:`gi_frame` 属" "性は常にフレームオブジェクトでした。今では :attr:`gi_frame` は、ジェネレータ" @@ -1053,6 +1153,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 "" @@ -1086,33 +1188,42 @@ msgstr "" "':keyword:`with`' ステートメントは基本構造が以下となる新しい制御フロー構造で" "す::" -#: ../../whatsnew/2.5.rst:574 msgid "" "with expression [as variable]:\n" " with-block" msgstr "" +"with expression [as variable]:\n" +" with-block" -#: ../../whatsnew/2.5.rst:577 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" +"式を評価した結果は、コンテキスト管理プロトコルに対応するオブジェクトである必" +"要があります (つまり、:meth:`~object.__enter__` メソッド" +"と :meth:`~object.__exit__` メソッドを備えている必要があります)。" -#: ../../whatsnew/2.5.rst:581 msgid "" "The object's :meth:`~object.__enter__` is called before *with-block* is " "executed and therefore can run set-up code. It also may return a value that " "is bound to the name *variable*, if given. (Note carefully that *variable* " "is *not* assigned the result of *expression*.)" msgstr "" +"*with-block* を実行する前にオブジェクトの :meth:`~object.__enter__` が呼ばれ" +"るため、そこで準備のコードを実行できます。\n" +"値を返すこともでき、*variable* が指定されていればその名前に束縛されます。\n" +"(*variable* に代入されるのは *expression* の結果では *ない* 点に注意してくだ" +"さい。)" -#: ../../whatsnew/2.5.rst:586 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" +"*with-block* の実行が終わると、ブロックが例外を送出した場合も含めて、オブジェ" +"クトの :meth:`~object.__exit__` メソッドが呼ばれるので、そこで後始末のコード" +"を実行できます。" #: ../../whatsnew/2.5.rst:590 msgid "" @@ -1122,9 +1233,8 @@ msgstr "" "Python 2.5 でこのステートメントを有効にするには、以下のディレクティブをあなた" "のモジュールに追加する必要があります::" -#: ../../whatsnew/2.5.rst:593 msgid "from __future__ import with_statement" -msgstr "" +msgstr "from __future__ import with_statement" #: ../../whatsnew/2.5.rst:595 msgid "The statement will always be enabled in Python 2.6." @@ -1140,13 +1250,16 @@ msgstr "" "していて、 ':keyword:`with`' とともに使えます。ファイルオブジェクトがその一例" "です::" -#: ../../whatsnew/2.5.rst:600 msgid "" "with open('/etc/passwd', 'r') as f:\n" " for line in f:\n" " print line\n" " ... more processing code ..." msgstr "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... more processing code ..." #: ../../whatsnew/2.5.rst:605 msgid "" @@ -1158,11 +1271,12 @@ msgstr "" "は、たとえ :keyword:`for` ループが道半ばにして例外と成り果てても、自動的にク" "ローズされます。" -#: ../../whatsnew/2.5.rst:611 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" +"この場合、:meth:`~object.__enter__` が *self* を返すので、*f* " +"は :func:`open` が作ったオブジェクトそのものです。" #: ../../whatsnew/2.5.rst:614 msgid "" @@ -1172,13 +1286,16 @@ msgstr "" ":mod:`threading` モジュールのロック・条件変数でも ':keyword:`with`' ステート" "メントの恩恵にあずかれます::" -#: ../../whatsnew/2.5.rst:617 msgid "" "lock = threading.Lock()\n" "with lock:\n" " # Critical section of code\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with lock:\n" +" # コードのクリティカルセクション\n" +" ..." #: ../../whatsnew/2.5.rst:622 msgid "" @@ -1198,7 +1315,6 @@ msgstr "" "decimal のコンテキスト (計算の望みの精度と丸め特性をカプセル化しています) を" "保存しておいてあとで元に戻すのを簡単にしてくれます::" -#: ../../whatsnew/2.5.rst:629 msgid "" "from decimal import Decimal, Context, localcontext\n" "\n" @@ -1211,6 +1327,16 @@ msgid "" " # The original context is restored on exiting the block.\n" " print v.sqrt()" msgstr "" +"from decimal import Decimal, Context, localcontext\n" +"\n" +"# デフォルトの精度である 28 桁で表示\n" +"v = Decimal('578')\n" +"print v.sqrt()\n" +"\n" +"with localcontext(Context(prec=16)):\n" +" # このブロック内のコードはすべて 16 桁の精度を使う。\n" +" # ブロックを抜けると元のコンテキストに戻る。\n" +" print v.sqrt()" #: ../../whatsnew/2.5.rst:644 msgid "Writing Context Managers" @@ -1234,19 +1360,24 @@ msgstr "" msgid "A high-level explanation of the context management protocol is:" msgstr "コンテキスト管理プロトコルの高度な説明はこんなです:" -#: ../../whatsnew/2.5.rst:654 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" +"式を評価した結果は、「コンテキストマネージャー」と呼ばれるオブジェクトである" +"必要があります。\n" +"コンテキストマネージャーには :meth:`~object.__enter__` " +"と :meth:`~object.__exit__` の両メソッドが必要です。" -#: ../../whatsnew/2.5.rst:658 msgid "" "The context manager's :meth:`~object.__enter__` method is called. The value " "returned is assigned to *VAR*. If no ``'as VAR'`` clause is present, the " "value is simply discarded." msgstr "" +"コンテキストマネージャーの :meth:`~object.__enter__` メソッドが呼ばれ、その戻" +"り値が *VAR* に代入されます。\n" +"``'as VAR'`` 節がなければ、値は単に捨てられます。" #: ../../whatsnew/2.5.rst:662 msgid "The code in *BLOCK* is executed." @@ -1255,12 +1386,12 @@ msgstr "*BLOCK* 内のコードが実行されます。" #: ../../whatsnew/2.5.rst:664 msgid "" "If *BLOCK* raises an exception, the ``__exit__(type, value, traceback)`` is " -"called with the exception details, the same values returned by :func:`sys." -"exc_info`. The method's return value controls whether the exception is re-" -"raised: any false value re-raises the exception, and ``True`` will result in " -"suppressing it. You'll only rarely want to suppress the exception, because " -"if you do the author of the code containing the ':keyword:`with`' statement " -"will never realize anything went wrong." +"called with the exception details, the same values returned " +"by :func:`sys.exc_info`. The method's return value controls whether the " +"exception is re-raised: any false value re-raises the exception, and " +"``True`` will result in suppressing it. You'll only rarely want to suppress " +"the exception, because if you do the author of the code containing the " +"':keyword:`with`' statement will never realize anything went wrong." msgstr "" "*BLOCK* が例外を起こした場合、コンテキストマネージャの ``__exit__`` メソッド" "が 3 つの引数とともに呼び出されます。これは例外の詳細です (``type, value, " @@ -1271,11 +1402,12 @@ msgstr "" "':keyword:`with`' ステートメントを含んだコードの作者は何か間違ったことが起" "こったことに決して気付かないですから。" -#: ../../whatsnew/2.5.rst:672 msgid "" "If *BLOCK* didn't raise an exception, the :meth:`~object.__exit__` method " "is still called, but *type*, *value*, and *traceback* are all ``None``." msgstr "" +"*BLOCK* が例外を送出しなかった場合も :meth:`~object.__exit__` メソッドは呼ば" +"れますが、*type*、*value*、*traceback* はすべて ``None`` になります。" #: ../../whatsnew/2.5.rst:675 msgid "" @@ -1309,7 +1441,6 @@ msgstr "" "データベース接続を表現するオブジェクトがあると仮定しましょう。私たちの目標" "は、そのオブジェクトのユーザがこのように書けるようになることです::" -#: ../../whatsnew/2.5.rst:687 msgid "" "db_connection = DatabaseConnection()\n" "with db_connection as cursor:\n" @@ -1317,18 +1448,22 @@ msgid "" " cursor.execute('delete from ...')\n" " # ... more operations ..." msgstr "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... その他の操作 ..." #: ../../whatsnew/2.5.rst:693 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" "トランザクションはブロック内のコードがつつがなく終了すればコミットし、例外が" -"発生すればロールバックすべきです。私が思い描いている :class:" -"`DatabaseConnection` の基本的なインターフェイスはこんなです::" +"発生すればロールバックすべきです。私が思い描いてい" +"る :class:`DatabaseConnection` の基本的なインターフェイスはこんなです::" -#: ../../whatsnew/2.5.rst:697 msgid "" "class DatabaseConnection:\n" " # Database interface\n" @@ -1339,8 +1474,15 @@ msgid "" " def rollback (self):\n" " \"Rolls back current transaction\"" msgstr "" +"class DatabaseConnection:\n" +" # データベースのインターフェース\n" +" def cursor (self):\n" +" \"新しいトランザクションを開始し、カーソルオブジェクトを返す\"\n" +" def commit (self):\n" +" \"現在のトランザクションをコミットする\"\n" +" def rollback (self):\n" +" \"現在のトランザクションをロールバックする\"" -#: ../../whatsnew/2.5.rst:706 msgid "" "The :meth:`~object.__enter__` method is pretty easy, having only to start a " "new transaction. For this application the resulting cursor object would be " @@ -1348,8 +1490,13 @@ msgid "" "cursor`` to their ':keyword:`with`' statement to bind the cursor to a " "variable name. ::" msgstr "" +":meth:`~object.__enter__` メソッドは、新しいトランザクションを開始するだけな" +"ので簡単です。\n" +"この用途では、作成したカーソルオブジェクトを返すと便利なので、メソッドの戻り" +"値にします。\n" +"利用者は :keyword:`with` 文に ``as cursor`` を追加して、カーソルを変数名に束" +"縛できます。 ::" -#: ../../whatsnew/2.5.rst:711 msgid "" "class DatabaseConnection:\n" " ...\n" @@ -1358,14 +1505,23 @@ msgid "" " cursor = self.cursor()\n" " return cursor" msgstr "" +"class DatabaseConnection:\n" +" ...\n" +" def __enter__ (self):\n" +" # 新しいトランザクションを開始するコード\n" +" cursor = self.cursor()\n" +" return cursor" -#: ../../whatsnew/2.5.rst:718 msgid "" "The :meth:`~object.__exit__` method is the most complicated because it's " "where most of the work has to be done. The method has to check if an " "exception occurred. If there was no exception, the transaction is " "committed. The transaction is rolled back if there was an exception." msgstr "" +":meth:`~object.__exit__` メソッドは処理の大部分を担うため、最も複雑になりま" +"す。\n" +"このメソッドは例外が発生したかどうかを確認する必要があります。\n" +"例外がなければトランザクションをコミットし、例外があればロールバックします。" #: ../../whatsnew/2.5.rst:723 msgid "" @@ -1379,7 +1535,6 @@ msgstr "" "望むならもっと明示的に、コメントでマークした部分で :keyword:`return` 文を書い" "てもよろしいです::" -#: ../../whatsnew/2.5.rst:728 msgid "" "class DatabaseConnection:\n" " ...\n" @@ -1392,6 +1547,16 @@ msgid "" " self.rollback()\n" " # return False" msgstr "" +"class DatabaseConnection:\n" +" ...\n" +" def __exit__ (self, type, value, tb):\n" +" if tb is None:\n" +" # 例外がないのでコミット\n" +" self.commit()\n" +" else:\n" +" # 例外が発生したのでロールバック。\n" +" self.rollback()\n" +" # return False" #: ../../whatsnew/2.5.rst:743 msgid "The contextlib module" @@ -1412,8 +1577,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -1427,7 +1592,6 @@ msgstr "" "このデコレータを使って、前セクションの私たちのデータベースの例はこのように書" "けます::" -#: ../../whatsnew/2.5.rst:760 msgid "" "from contextlib import contextmanager\n" "\n" @@ -1446,6 +1610,22 @@ msgid "" "with db_transaction(db) as cursor:\n" " ..." msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction (connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." #: ../../whatsnew/2.5.rst:777 msgid "" @@ -1456,17 +1636,19 @@ msgid "" "lock::" msgstr "" ":mod:`contextlib` モジュールには ``nested(mgr1, mgr2, ...)`` 関数もあり、この" -"関数はたくさんのコンテキストマネージャを組み合わせることができて、入れ子の ':" -"keyword:`with`' を書く必要性をなくしてくれます。この例では、単一の ':keyword:" -"`!with`' でデータベーストランザクション開始とスレッドのロック獲得の両方をやっ" -"てのけています::" +"関数はたくさんのコンテキストマネージャを組み合わせることができて、入れ子の " +"':keyword:`with`' を書く必要性をなくしてくれます。この例では、単一の " +"':keyword:`!with`' でデータベーストランザクション開始とスレッドのロック獲得の" +"両方をやってのけています::" -#: ../../whatsnew/2.5.rst:782 msgid "" "lock = threading.Lock()\n" "with nested (db_transaction(db), lock) as (cursor, locked):\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." #: ../../whatsnew/2.5.rst:786 msgid "" @@ -1477,7 +1659,6 @@ msgstr "" "束縛出来るようにし、かつブロックの終了で、与えた引数が持つ ``object.close`` " "を呼び出します::" -#: ../../whatsnew/2.5.rst:789 msgid "" "import urllib, sys\n" "from contextlib import closing\n" @@ -1486,6 +1667,12 @@ msgid "" " for line in f:\n" " sys.stdout.write(line)" msgstr "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" #: ../../whatsnew/2.5.rst:799 msgid ":pep:`343` - The \"with\" statement" @@ -1519,8 +1706,8 @@ msgid "" "classes." msgstr "" "例外クラスは、今では旧スタイルクラスだけではなく新スタイルクラスになれます。" -"組み込みの :exc:`Exception` クラスと全ての標準組み込み例外 (:exc:" -"`NameError`, :exc:`ValueError`, など) が今では新スタイルクラスです。" +"組み込みの :exc:`Exception` クラスと全ての標準組み込み例外 " +"(:exc:`NameError`, :exc:`ValueError`, など) が今では新スタイルクラスです。" #: ../../whatsnew/2.5.rst:819 msgid "" @@ -1531,7 +1718,6 @@ msgstr "" "す (---訳注: 2.6 ではさらに GeneratorExit が Exception ではなく " "BaseExceotion の直接の子になり、これは 3.x でも引き継がれています。---)::" -#: ../../whatsnew/2.5.rst:822 msgid "" "BaseException # New in Python 2.5\n" "|- KeyboardInterrupt\n" @@ -1539,26 +1725,30 @@ msgid "" "|- Exception\n" " |- (all other current built-in exceptions)" msgstr "" +"BaseException # Python 2.5 で追加\n" +"|- KeyboardInterrupt\n" +"|- SystemExit\n" +"|- Exception\n" +" |- (その他の現在の組み込み例外すべて)" #: ../../whatsnew/2.5.rst:828 msgid "" "This rearrangement was done because people often want to catch all " -"exceptions that indicate program errors. :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit` aren't errors, though, and usually represent an explicit action " -"such as the user hitting :kbd:`Control-C` or code calling :func:`sys.exit`. " -"A bare ``except:`` will catch all exceptions, so you commonly need to list :" -"exc:`KeyboardInterrupt` and :exc:`SystemExit` in order to re-raise them. " -"The usual pattern is::" +"exceptions that indicate program errors. :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit` aren't errors, though, and usually represent an " +"explicit action such as the user hitting :kbd:`Control-C` or code " +"calling :func:`sys.exit`. A bare ``except:`` will catch all exceptions, so " +"you commonly need to list :exc:`KeyboardInterrupt` and :exc:`SystemExit` in " +"order to re-raise them. The usual pattern is::" msgstr "" "この再編成が行われたのは、人々がしばしばプログラムのエラーを示す例外すべてを" "捕捉したがるからです。 :exc:`KeyboardInterrupt` と :exc:`SystemExit` はエラー" -"ではありませんが、普通は :kbd:`Control-C` をユーザが叩いたか、コードが :func:" -"`sys.exit` を呼び出したかのような明示的なアクションを表します。剥き出しの " -"``except:`` はまさに全ての例外を捕捉しますから、一般に、再送出のために :exc:" -"`KeyboardInterrupt` と :exc:`SystemExit` はリストする必要があります。お決まり" -"のパターンはこんなです::" +"ではありませんが、普通は :kbd:`Control-C` をユーザが叩いたか、コード" +"が :func:`sys.exit` を呼び出したかのような明示的なアクションを表します。剥き" +"出しの ``except:`` はまさに全ての例外を捕捉しますから、一般に、再送出のため" +"に :exc:`KeyboardInterrupt` と :exc:`SystemExit` はリストする必要があります。" +"お決まりのパターンはこんなです::" -#: ../../whatsnew/2.5.rst:835 msgid "" "try:\n" " ...\n" @@ -1568,6 +1758,13 @@ msgid "" " # Log error...\n" " # Continue running program..." msgstr "" +"try:\n" +" ...\n" +"except (KeyboardInterrupt, SystemExit):\n" +" raise\n" +"except:\n" +" # エラーを記録...\n" +" # プログラムの実行を続ける..." #: ../../whatsnew/2.5.rst:843 msgid "" @@ -1591,18 +1788,18 @@ msgid "" "``except:`` form should be removed in Python 3.0, but Guido van Rossum " "hasn't decided whether to do this or not." msgstr "" -"Python 3.0 での目標は、例外として raise される全てのクラスが :exc:" -"`BaseException` からの、もしくは :exc:`BaseException` のある子孫であることを" -"要求することであり、Python 2.x シリーズの将来のリリースにおいてはこの制約の強" -"制を始めるかもしれません。ですからあなたの全ての例外は、今からすぐに :exc:" -"`Exception` 派生にするのが肝要です。捕捉例外を特定しない ``except:`` は " -"Python 3.0 から取り除かれるべきであることが提案されていますが、Guido van " +"Python 3.0 での目標は、例外として raise される全てのクラス" +"が :exc:`BaseException` からの、もしくは :exc:`BaseException` のある子孫であ" +"ることを要求することであり、Python 2.x シリーズの将来のリリースにおいてはこの" +"制約の強制を始めるかもしれません。ですからあなたの全ての例外は、今からすぐ" +"に :exc:`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 "" @@ -1629,15 +1826,17 @@ msgstr "PEP 著: Brett Cannon と Guido van Rossum; 実装: Brett Cannon." msgid "PEP 353: Using ssize_t as the index type" msgstr "PEP 353: 添え字型に ssize_t を使う" -#: ../../whatsnew/2.5.rst:874 msgid "" "A wide-ranging change to Python's C API, using a new :c:type:`Py_ssize_t` " "type definition instead of :c:expr:`int`, will permit the interpreter to " "handle more data on 64-bit platforms. This change doesn't affect Python's " "capacity on 32-bit platforms." msgstr "" +"Python の C API 全体にわたる変更として、:c:expr:`int` の代わりに新しい型定" +"義 :c:type:`Py_ssize_t` を使うようになり、64 ビット環境でインタープリタがより" +"多くのデータを扱えるようになります。\n" +"32 ビット環境で Python が扱える容量には影響しません。" -#: ../../whatsnew/2.5.rst:879 msgid "" "Various pieces of the Python interpreter used C's :c:expr:`int` type to " "store sizes or counts; for example, the number of items in a list or tuple " @@ -1648,14 +1847,24 @@ msgid "" "unix.org/version2/whatsnew/lp64_wp.html for a discussion -- but the most " "commonly available model leaves :c:expr:`int` as 32 bits.)" msgstr "" +"Python インタープリタの各所では、サイズや個数を格納するために C " +"の :c:expr:`int` 型を使っていました。\n" +"例えば、リストやタプルの要素数は :c:expr:`int` に格納されていました。\n" +"ほとんどの 64 ビット環境の C コンパイラーでも :c:expr:`int` は 32 ビット型な" +"ので、リストは最大 ``2**31 - 1`` = 2147483647 個の要素しか保持できませんでし" +"た。\n" +"(実際には 64 ビット C コンパイラーで使えるプログラミングモデルは複数ありま" +"す。\n" +"議論は https://unix.org/version2/whatsnew/lp64_wp.html を参照してください。\n" +"ただし最も広く使われるモデルでは :c:expr:`int` は 32 ビットのままです。)" #: ../../whatsnew/2.5.rst:888 msgid "" "A limit of 2147483647 items doesn't really matter on a 32-bit platform " "because you'll run out of memory before hitting the length limit. Each list " -"item requires space for a pointer, which is 4 bytes, plus space for a :c:" -"type:`PyObject` representing the item. 2147483647\\*4 is already more bytes " -"than a 32-bit address space can contain." +"item requires space for a pointer, which is 4 bytes, plus space for " +"a :c:type:`PyObject` representing the item. 2147483647\\*4 is already more " +"bytes than a 32-bit address space can contain." msgstr "" "2147483647 に要素数が制限されることは 32 ビットプラットフォームではあまり重大" "でもありません。その長さ制限を喰らう前にメモリを使い果たすでしょうから。それ" @@ -1666,7 +1875,6 @@ msgstr "" "掛ける説明なんかここでまったくされていない。なぜ掛ける? それと要素のインデク" "シングとアイテムの必要領域は議論には無関係なのでは?---)" -#: ../../whatsnew/2.5.rst:894 msgid "" "It's possible to address that much memory on a 64-bit platform, however. " "The pointers for a list that size would only require 16 GiB of space, so " @@ -1678,28 +1886,39 @@ msgid "" "users is still relatively small. (In 5 or 10 years, we may *all* be on 64-" "bit machines, and the transition would be more painful then.)" msgstr "" +"しかし、64 ビット環境ならそれだけのメモリにアクセスできます。\n" +"その大きさのリストでもポインターに必要な領域はわずか 16 GiB なので、Python の" +"プログラマーがこれほど大きなリストを作ることも不合理ではありません。\n" +"そこで、Python インタープリタを :c:expr:`int` 以外の型を使うよう変更する必要" +"があり、64 ビット環境では 64 ビットの型を使うことになりました。\n" +"この変更は 64 ビットマシンで非互換性を生じさせるため、その利用者がまだ比較的" +"少ない今のうちに移行する価値があると判断されました。\n" +"(5 年後や 10 年後には *全員* が 64 ビットマシンを使っているかもしれず、その時" +"の移行はもっと大変でしょう。)" #: ../../whatsnew/2.5.rst:904 msgid "" "This change most strongly affects authors of C extension modules. Python " -"strings and container types such as lists and tuples now use :c:type:" -"`Py_ssize_t` to store their size. Functions such as :c:func:`PyList_Size` " -"now return :c:type:`Py_ssize_t`. Code in extension modules may therefore " -"need to have some variables changed to :c:type:`Py_ssize_t`." +"strings and container types such as lists and tuples now " +"use :c:type:`Py_ssize_t` to store their size. Functions such " +"as :c:func:`PyList_Size` now return :c:type:`Py_ssize_t`. Code in " +"extension modules may therefore need to have some variables changed " +"to :c:type:`Py_ssize_t`." msgstr "" "この変更は C 拡張モジュールの著者に大変大きく影響します。Python 文字列とリス" "トやタプルのようなコンテナ型は、そのサイズを表すのに :c:type:`Py_ssize_t` を" -"使うようになっています。 :c:func:`PyList_Size` のような関数は :c:type:" -"`Py_ssize_t` を返します。拡張モジュール内のコードでは、ですので、ある程度の変" -"数の :c:type:`Py_ssize_t` への変更が必要でしょう。" +"使うようになっています。 :c:func:`PyList_Size` のような関数" +"は :c:type:`Py_ssize_t` を返します。拡張モジュール内のコードでは、ですので、" +"ある程度の変数の :c:type:`Py_ssize_t` への変更が必要でしょう。" #: ../../whatsnew/2.5.rst:910 msgid "" "The :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` functions have a " -"new conversion code, ``n``, for :c:type:`Py_ssize_t`. :c:func:" -"`PyArg_ParseTuple`'s ``s#`` and ``t#`` still output :c:expr:`int` by " -"default, but you can define the macro :c:macro:`PY_SSIZE_T_CLEAN` before " -"including :file:`Python.h` to make them return :c:type:`Py_ssize_t`." +"new conversion code, ``n``, " +"for :c:type:`Py_ssize_t`. :c:func:`PyArg_ParseTuple`'s ``s#`` and ``t#`` " +"still output :c:expr:`int` by default, but you can define the " +"macro :c:macro:`PY_SSIZE_T_CLEAN` before including :file:`Python.h` to " +"make them return :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:916 @@ -1733,23 +1952,23 @@ msgid "" "could be used as slice indexes." msgstr "" "NumPy 開発者たちは、新しい特殊メソッド、 :meth:`__index__` を追加することに" -"よってしか解決できない問題を抱えていました。スライスの表現 ``[start:stop:" -"step]`` を使う際、 *start*, *stop*, *step* は全て整数か長整数でなければなりま" -"せん。NumPy は様々な特殊化された整数型を持っていて、符号なし、符号付きの 8、" -"16、32、64 ビットに対応していますが、それらをスライスの添え字に使う手段はあり" -"ませんでした。" +"よってしか解決できない問題を抱えていました。スライスの表現 " +"``[start:stop:step]`` を使う際、 *start*, *stop*, *step* は全て整数か長整数で" +"なければなりません。NumPy は様々な特殊化された整数型を持っていて、符号なし、" +"符号付きの 8、16、32、64 ビットに対応していますが、それらをスライスの添え字に" +"使う手段はありませんでした。" #: ../../whatsnew/2.5.rst:941 msgid "" "Slicing can't just use the existing :meth:`__int__` method because that " -"method is also used to implement coercion to integers. If slicing used :" -"meth:`__int__`, floating-point numbers would also become legal slice indexes " -"and that's clearly an undesirable behaviour." +"method is also used to implement coercion to integers. If slicing " +"used :meth:`__int__`, floating-point numbers would also become legal slice " +"indexes and that's clearly an undesirable behaviour." msgstr "" "スライシングに既存の :meth:`__int__` メソッドをそのまま使うことは出来ません。" -"それらは整数への型変換を実装するのにも使われるからです。スライシングが :meth:" -"`__int__` を使ったとすれば、浮動小数点数でさえスライスの添え字として使うこと" -"が合法になりますが、それは明らかに望む振る舞いではありません。" +"それらは整数への型変換を実装するのにも使われるからです。スライシング" +"が :meth:`__int__` を使ったとすれば、浮動小数点数でさえスライスの添え字として" +"使うことが合法になりますが、それは明らかに望む振る舞いではありません。" #: ../../whatsnew/2.5.rst:946 msgid "" @@ -1760,18 +1979,20 @@ msgstr "" "その代わりに新しい特殊メソッド :meth:`__index__` が追加されました。これは引数" "を取らずに、スライスの添え字として使われる整数を返します。例えば::" -#: ../../whatsnew/2.5.rst:949 msgid "" "class C:\n" " def __index__ (self):\n" " return self.value" msgstr "" +"class C:\n" +" def __index__ (self):\n" +" return self.value" #: ../../whatsnew/2.5.rst:953 msgid "" "The return value must be either a Python integer or long integer. The " -"interpreter will check that the type returned is correct, and raises a :exc:" -"`TypeError` if this requirement isn't met." +"interpreter will check that the type returned is correct, and raises " +"a :exc:`TypeError` if this requirement isn't met." msgstr "" "戻り値は Python 整数または長整数でなければなりません。インタプリタは戻り値が" "正しいかどうかをチェックし、要求に合わない場合に :exc:`TypeError` を送出しま" @@ -1808,17 +2029,16 @@ msgid "" "The :class:`dict` type has a new hook for letting subclasses provide a " "default value when a key isn't contained in the dictionary. When a key isn't " "found, the dictionary's ``__missing__(key)`` method will be called. This " -"hook is used to implement the new :class:`defaultdict` class in the :mod:" -"`collections` module. The following example defines a dictionary that " -"returns zero for any missing key::" +"hook is used to implement the new :class:`defaultdict` class in " +"the :mod:`collections` module. The following example defines a dictionary " +"that returns zero for any missing key::" msgstr "" ":class:`dict` 型に新たなフックが追加されています。サブクラスが、辞書に含まれ" "ないキーに対してデフォルトを提供出来るようにするものです。キーが見つからない" -"場合、辞書の ``__missing__(key)`` メソッドが呼ばれます。このフックは :mod:" -"`collections` モジュール内の新しいクラス :class:`defaultdict` で使われていま" -"す。続く例は存在しないキーに対してゼロを返す辞書を定義しています::" +"場合、辞書の ``__missing__(key)`` メソッドが呼ばれます。このフック" +"は :mod:`collections` モジュール内の新しいクラス :class:`defaultdict` で使わ" +"れています。続く例は存在しないキーに対してゼロを返す辞書を定義しています::" -#: ../../whatsnew/2.5.rst:985 msgid "" "class zerodict (dict):\n" " def __missing__ (self, key):\n" @@ -1828,6 +2048,13 @@ msgid "" "print d[1], d[2] # Prints 1, 2\n" "print d[3], d[4] # Prints 0, 0" msgstr "" +"class zerodict (dict):\n" +" def __missing__ (self, key):\n" +" return 0\n" +"\n" +"d = zerodict({1:1, 2:2})\n" +"print d[1], d[2] # 1, 2 を表示\n" +"print d[3], d[4] # 0, 0 を表示" #: ../../whatsnew/2.5.rst:993 msgid "" @@ -1862,7 +2089,6 @@ msgstr "" msgid "Some examples::" msgstr "いくつかの例です::" -#: ../../whatsnew/2.5.rst:1007 msgid "" ">>> ('http://www.python.org').partition('://')\n" "('http', '://', 'www.python.org')\n" @@ -1875,6 +2101,16 @@ msgid "" ">>> 'www.python.org'.rpartition(':')\n" "('', '', 'www.python.org')" msgstr "" +">>> ('http://www.python.org').partition('://')\n" +"('http', '://', 'www.python.org')\n" +">>> ('file:/usr/share/doc/index.html').partition('://')\n" +"('file:/usr/share/doc/index.html', '', '')\n" +">>> (u'Subject: a quick question').partition(':')\n" +"(u'Subject', u':', u' a quick question')\n" +">>> 'www.python.org'.rpartition('.')\n" +"('www.python', '.', 'org')\n" +">>> 'www.python.org'.rpartition(':')\n" +"('', '', 'www.python.org')" #: ../../whatsnew/2.5.rst:1018 msgid "" @@ -1890,11 +2126,12 @@ msgstr "" "文字列型の :meth:`startswith` と :meth:`endswith` メソッドが、チェックされる" "文字列のタプルを受け容れるようになりました::" -#: ../../whatsnew/2.5.rst:1023 msgid "" "def is_image_file (filename):\n" " return filename.endswith(('.gif', '.jpg', '.tiff'))" msgstr "" +"def is_image_file (filename):\n" +" return filename.endswith(('.gif', '.jpg', '.tiff'))" #: ../../whatsnew/2.5.rst:1026 msgid "(Implemented by Georg Brandl following a suggestion by Tom Lynn.)" @@ -1911,11 +2148,11 @@ msgid "" msgstr "" "ビルトイン関数 :func:`min` と :func:`max` に、 :meth:`sort` における ``key`` " "に似たキーワード引数 ``key`` が追加されました。このパラメータには関数を与えま" -"す。これは一つの引数を取り、リスト内の全ての値に対して呼び出されます; :func:" -"`min`/:func:`max` はこの関数を全要素に適用したもののなかでの最小値/最大値を返" -"します。例えば、リスト中の最長の文字列を探すにはこのように出来ます::" +"す。これは一つの引数を取り、リスト内の全ての値に対して呼び出されま" +"す; :func:`min`/:func:`max` はこの関数を全要素に適用したもののなかでの最小値/" +"最大値を返します。例えば、リスト中の最長の文字列を探すにはこのように出来ま" +"す::" -#: ../../whatsnew/2.5.rst:1037 msgid "" "L = ['medium', 'longest', 'short']\n" "# Prints 'longest'\n" @@ -1923,6 +2160,11 @@ msgid "" "# Prints 'short', because lexicographically 'short' has the largest value\n" "print max(L)" msgstr "" +"L = ['medium', 'longest', 'short']\n" +"# 'longest' を表示\n" +"print max(L, key=len)\n" +"# 辞書順では 'short' が最大なので 'short' を表示\n" +"print max(L)" #: ../../whatsnew/2.5.rst:1043 msgid "(Contributed by Steven Bethard and Raymond Hettinger.)" @@ -1931,18 +2173,18 @@ msgstr "(Contributed by Steven Bethard and Raymond Hettinger.)" #: ../../whatsnew/2.5.rst:1045 msgid "" "Two new built-in functions, :func:`any` and :func:`all`, evaluate whether an " -"iterator contains any true or false values. :func:`any` returns :const:" -"`True` if any value returned by the iterator is true; otherwise it will " -"return :const:`False`. :func:`all` returns :const:`True` only if all of the " -"values returned by the iterator evaluate as true. (Suggested by Guido van " -"Rossum, and implemented by Raymond Hettinger.)" +"iterator contains any true or false values. :func:`any` " +"returns :const:`True` if any value returned by the iterator is true; " +"otherwise it will return :const:`False`. :func:`all` returns :const:`True` " +"only if all of the values returned by the iterator evaluate as true. " +"(Suggested by Guido van Rossum, and implemented by Raymond Hettinger.)" msgstr "" "2 つの新たなビルトイン関数 :func:`any` と :func:`all` は、イテレータがいくつ" "か真を含むかどうかを評価します。 :func:`any` はイテレータのいずれかが返す値が" "真と評価される場合に :const:`True` を返し、そうでなければ :const:`False` を返" -"します。 :func:`all` はイテレータが返す値の評価が真のみの場合に :const:" -"`True` を返します。 (Suggested by Guido van Rossum, and implemented by " -"Raymond Hettinger.)" +"します。 :func:`all` はイテレータが返す値の評価が真のみの場合" +"に :const:`True` を返します。 (Suggested by Guido van Rossum, and " +"implemented by Raymond Hettinger.)" #: ../../whatsnew/2.5.rst:1052 msgid "" @@ -1950,19 +2192,19 @@ msgid "" "integer or a regular integer. If a long integer is returned, the hash of " "that value is taken. In earlier versions the hash value was required to be " "a regular integer, but in 2.5 the :func:`id` built-in was changed to always " -"return non-negative numbers, and users often seem to use ``id(self)`` in :" -"meth:`__hash__` methods (though this is discouraged)." +"return non-negative numbers, and users often seem to use ``id(self)`` " +"in :meth:`__hash__` methods (though this is discouraged)." msgstr "" "クラスの :meth:`__hash__` メソッドが返す値として、長整数と整数のどちらでも良" "くなりました。長整数が返されれば、その値のハッシュから取られます。以前のバー" "ジョンではこれは普通の整数であることが要求されていましたが、2.5 ではビルトイ" -"ン関数 :func:`id` が変更されて常に非負数が返り、ユーザはしばしば :meth:" -"`__hash__` 内で ``id(self)`` を使うようです (これはお奨めしませんが)。 (---訳" -"注: 不思議な論法で意味がわかりません。id が非負を返すとなぜユーザは __hash__ " -"の実装に使おうとするのか? ユーザがそれをしてしまうのは単にデフォルト実装がそ" -"うだから、というだけではないかと思います。__cmp__, __eq__ が「身元」以外の意" -"味を使って比較を行うならば、 __cmp__ で id を使うのはシンプルに「ダメ」でしょ" -"う。--)" +"ン関数 :func:`id` が変更されて常に非負数が返り、ユーザはしばし" +"ば :meth:`__hash__` 内で ``id(self)`` を使うようです (これはお奨めしません" +"が)。 (---訳注: 不思議な論法で意味がわかりません。id が非負を返すとなぜユーザ" +"は __hash__ の実装に使おうとするのか? ユーザがそれをしてしまうのは単にデフォ" +"ルト実装がそうだから、というだけではないかと思います。__cmp__, __eq__ が「身" +"元」以外の意味を使って比較を行うならば、 __cmp__ で id を使うのはシンプルに" +"「ダメ」でしょう。--)" #: ../../whatsnew/2.5.rst:1061 msgid "" @@ -1979,9 +2221,8 @@ msgstr "" "は :pep:`263` を参照してください; 例えば、ソースコードの先頭付近にこのような" "行を追加することで出来ます::" -#: ../../whatsnew/2.5.rst:1067 msgid "# -*- coding: latin1 -*-" -msgstr "" +msgstr "# -*- coding: latin1 -*-" #: ../../whatsnew/2.5.rst:1069 msgid "" @@ -1994,7 +2235,6 @@ msgstr "" "8 ビット文字列との比較を試みると、新しい警告 :class:`UnicodeWarning` が引き起" "こされるようになっています。比較結果は偽です::" -#: ../../whatsnew/2.5.rst:1073 msgid "" ">>> chr(128) == unichr(128) # Can't convert chr(128) to Unicode\n" "__main__:1: UnicodeWarning: Unicode equal comparison failed\n" @@ -2004,6 +2244,13 @@ msgid "" ">>> chr(127) == unichr(127) # chr(127) can be converted\n" "True" msgstr "" +">>> chr(128) == unichr(128) # chr(128) は Unicode に変換できない\n" +"__main__:1: UnicodeWarning: Unicode equal comparison failed\n" +" to convert both arguments to Unicode - interpreting them\n" +" as being unequal\n" +"False\n" +">>> chr(127) == unichr(127) # chr(127) は変換できる\n" +"True" #: ../../whatsnew/2.5.rst:1081 msgid "" @@ -2017,13 +2264,13 @@ msgstr "" "以前はこれは :class:`UnicodeDecodeError` を起こしていましたので、2.5 でのこれ" "は辞書のアクセス時に悩ましい問題をもたらしました。キーとして使われている " "``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 でのこれに関する言及はありませんが変更があっ" -"たのかもしれません)。" +"例外が起こっていたでしょう。2.5 での、 辞書を実装してい" +"る :file:`dictobject.c` のほかの変更により、これは揉み消すのではなく、引き続" +"き例外を起こします(訳注: 原文では this exception といっているので " +"``UnicodeDecodeError`` が起こるように読めるのですが、2.5 時点での振る舞いは確" +"認出来ていませんが 2.7 では ``UnicodeWarning`` とともに ``KeyError`` が発生す" +"る、のようになるはずです。2.6 以降の What's New でのこれに関する言及はありま" +"せんが変更があったのかもしれません)。" #: ../../whatsnew/2.5.rst:1088 msgid "" @@ -2032,8 +2279,8 @@ msgid "" "introduced." msgstr "" "この種の比較で例外を起こすのは完全に正しいことではあるものの、その変更はコー" -"ドを破壊するかもしれないので、必要に応じて警告に出来るよう導入されたのが :" -"class:`UnicodeWarning` です。" +"ドを破壊するかもしれないので、必要に応じて警告に出来るよう導入されたの" +"が :class:`UnicodeWarning` です。" #: ../../whatsnew/2.5.rst:1091 msgid "(Implemented by Marc-André Lemburg.)" @@ -2044,21 +2291,21 @@ msgid "" "One error that Python programmers sometimes make is forgetting to include " "an :file:`__init__.py` module in a package directory. Debugging this mistake " "can be confusing, and usually requires running Python with the :option:`-v` " -"switch to log all the paths searched. In Python 2.5, a new :exc:" -"`ImportWarning` warning is triggered when an import would have picked up a " -"directory as a package but no :file:`__init__.py` was found. This warning " -"is silently ignored by default; provide the :option:`-Wd <-W>` option when " -"running the Python executable to display the warning message. (Implemented " -"by Thomas Wouters.)" -msgstr "" -"Python プログラマがよくしでかす間違いとして、パッケージディレクトリに :file:" -"`__init__.py` を入れ忘れる、というものがあります。この間違いのデバッグはやや" -"こしく、大抵 Python を :option:`-v` スイッチ付きで起動して、パス検索全てをロ" -"グ出力するハメになります。Python 2.5 ではパッケージディレクトリに :file:" -"`__init__.py` がないことが検出されると新たに :exc:`ImportWarning` 警告を出す" -"ようになりました。デフォルトではこの警告は黙って無視されます; これを出したけ" -"れば、 :option:`-Wd <-W>` スイッチをつけて Python を起動してください。" +"switch to log all the paths searched. In Python 2.5, a " +"new :exc:`ImportWarning` warning is triggered when an import would have " +"picked up a directory as a package but no :file:`__init__.py` was found. " +"This warning is silently ignored by default; provide the :option:`-Wd <-W>` " +"option when running the Python executable to display the warning message. " "(Implemented by Thomas Wouters.)" +msgstr "" +"Python プログラマがよくしでかす間違いとして、パッケージディレクトリ" +"に :file:`__init__.py` を入れ忘れる、というものがあります。この間違いのデバッ" +"グはややこしく、大抵 Python を :option:`-v` スイッチ付きで起動して、パス検索" +"全てをログ出力するハメになります。Python 2.5 ではパッケージディレクトリ" +"に :file:`__init__.py` がないことが検出されると新たに :exc:`ImportWarning` 警" +"告を出すようになりました。デフォルトではこの警告は黙って無視されます; これを" +"出したければ、 :option:`-Wd <-W>` スイッチをつけて Python を起動してくださ" +"い。(Implemented by Thomas Wouters.)" #: ../../whatsnew/2.5.rst:1102 msgid "" @@ -2069,11 +2316,12 @@ msgstr "" "注: object を派生しないので結果として旧スタイルクラスになります)。例えば以下" "は今や合法です::" -#: ../../whatsnew/2.5.rst:1105 msgid "" "class C():\n" " pass" msgstr "" +"class C():\n" +" pass" #: ../../whatsnew/2.5.rst:1108 msgid "(Implemented by Brett Cannon.)" @@ -2093,11 +2341,12 @@ msgstr "" "(quit しようと)試みてそうタイプしてしまうユーザにとってある種有用な文字列に" "なっていました::" -#: ../../whatsnew/2.5.rst:1121 msgid "" ">>> quit\n" "'Use Ctrl-D (i.e. EOF) to exit.'" msgstr "" +">>> quit\n" +"'Use Ctrl-D (i.e. EOF) to exit.'" #: ../../whatsnew/2.5.rst:1124 msgid "" @@ -2142,11 +2391,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1147 msgid "" -"When they were introduced in Python 2.4, the built-in :class:`set` and :" -"class:`frozenset` types were built on top of Python's dictionary type. In " -"2.5 the internal data structure has been customized for implementing sets, " -"and as a result sets will use a third less memory and are somewhat faster. " -"(Implemented by Raymond Hettinger.)" +"When they were introduced in Python 2.4, the built-in :class:`set` " +"and :class:`frozenset` types were built on top of Python's dictionary " +"type. In 2.5 the internal data structure has been customized for " +"implementing sets, and as a result sets will use a third less memory and are " +"somewhat faster. (Implemented by Raymond Hettinger.)" msgstr "" "Python 2.4 が導入されたとき、組み込みの :class:`set` と :class:`frozenset` 型" "は Python の辞書型の上に構築されたものでした。 Python 2.5 では、内部データ構" @@ -2168,13 +2417,16 @@ msgstr "" "によって追加されました。文字マップは Walter Dörwald と Martin von Löwis に" "よって改善されました。)" -#: ../../whatsnew/2.5.rst:1161 msgid "" "The ``long(str, base)`` function is now faster on long digit strings because " "fewer intermediate results are calculated. The peak is for strings of " "around 800--1000 digits where the function is 6 times faster. (Contributed " "by Alan McIntyre and committed at the NeedForSpeed sprint.)" msgstr "" +"``long(str, base)`` 関数は中間結果の計算回数が減り、長い数字列に対して高速に" +"なりました。\n" +"特に 800〜1000 桁ほどの文字列で効果が大きく、6 倍高速になっています。\n" +"(Alan McIntyre による貢献で、NeedForSpeed スプリントでコミットされました。)" #: ../../whatsnew/2.5.rst:1168 msgid "" @@ -2183,22 +2435,25 @@ msgid "" "methods. Iteration uses an internal buffer and the :meth:`!read\\*` " "methods don't use that buffer. Instead they would return the data " "following the buffer, causing the data to appear out of order. Mixing " -"iteration and these methods will now trigger a :exc:`ValueError` from the :" -"meth:`!read\\*` method. (Implemented by Thomas Wouters.)" +"iteration and these methods will now trigger a :exc:`ValueError` from " +"the :meth:`!read\\*` method. (Implemented by Thomas Wouters.)" msgstr "" -#: ../../whatsnew/2.5.rst:1178 msgid "" "The :mod:`struct` module now compiles structure format strings into an " "internal representation and caches this representation, yielding a 20% " "speedup. (Contributed by Bob Ippolito at the NeedForSpeed sprint.)" msgstr "" +":mod:`struct` モジュールは構造体の書式文字列を内部表現にコンパイルしてキャッ" +"シュするようになり、20% 高速化しました。\n" +"(NeedForSpeed スプリントでの Bob Ippolito による貢献です。)" #: ../../whatsnew/2.5.rst:1182 msgid "" "The :mod:`re` module got a 1 or 2% speedup by switching to Python's " -"allocator functions instead of the system's :c:func:`malloc` and :c:func:" -"`free`. (Contributed by Jack Diederich at the NeedForSpeed sprint.)" +"allocator functions instead of the system's :c:func:`malloc` " +"and :c:func:`free`. (Contributed by Jack Diederich at the NeedForSpeed " +"sprint.)" msgstr "" ":mod:`re` モジュールは、システムの :c:func:`malloc` と :c:func:`free` の代わ" "りに Python のアロケータ関数に切り替えることで、1~2%のスピードアップを達成し" @@ -2216,7 +2471,6 @@ msgstr "" "算術演算を行い、 ``a = 5`` に対応するコードを生成します。 (Raymond Hettinger " "による提案と実装。)" -#: ../../whatsnew/2.5.rst:1191 msgid "" "Function calls are now faster because code objects now keep the most " "recently finished frame (a \"zombie frame\") in an internal field of the " @@ -2226,14 +2480,26 @@ msgid "" "may improve cache locality and reduce memory usage a bit. (Contributed by " "Neal Norwitz.)" msgstr "" +"コードオブジェクトが直近に実行を終えたフレーム (「ゾンビフレーム」) を内部" +"フィールドに保持し、次の呼び出しで再利用するようになったため、関数呼び出しが" +"高速になりました。\n" +"(最初のパッチは Michael Hudson によるもので、Armin Rigo と Richard Jones が変" +"更を加え、NeedForSpeed スプリントでコミットされました。)\n" +"フレームオブジェクトも少し小さくなり、キャッシュの局所性やメモリ使用量が多少" +"改善する可能性があります。\n" +"(Neal Norwitz による貢献です。)" -#: ../../whatsnew/2.5.rst:1201 msgid "" "Python's built-in exceptions are now new-style classes, a change that speeds " "up instantiation considerably. Exception handling in Python 2.5 is " "therefore about 30% faster than in 2.4. (Contributed by Richard Jones, Georg " "Brandl and Sean Reifschneider at the NeedForSpeed sprint.)" msgstr "" +"Python の組み込み例外が新スタイルクラスになり、インスタンスの作成が大幅に高速" +"化されました。\n" +"そのため、Python 2.5 の例外処理は 2.4 より約 30% 高速です。\n" +"(NeedForSpeed スプリントでの Richard Jones、Georg Brandl、Sean Reifschneider " +"による貢献です。)" #: ../../whatsnew/2.5.rst:1206 msgid "" @@ -2259,34 +2525,35 @@ msgstr "" "と完全なリストが見たければソースツリーの :file:`Misc/NEWS` を調べるか、全ての" "詳細について SVN ログに目を通してみてください。" -#: ../../whatsnew/2.5.rst:1225 msgid "" "The :mod:`!audioop` module now supports the a-LAW encoding, and the code for " "u-LAW encoding has been improved. (Contributed by Lars Immisch.)" msgstr "" +":mod:`!audioop` モジュールが a-LAW 符号化に対応し、u-LAW 符号化のコードも改善" +"されました。\n" +"(Lars Immisch による貢献です。)" #: ../../whatsnew/2.5.rst:1228 msgid "" -"The :mod:`codecs` module gained support for incremental codecs. The :func:" -"`codec.lookup` function now returns a :class:`CodecInfo` instance instead of " -"a tuple. :class:`CodecInfo` instances behave like a 4-tuple to preserve " -"backward compatibility but also have the attributes :attr:`encode`, :attr:" -"`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:" -"`streamwriter`, and :attr:`streamreader`. Incremental codecs can receive " -"input and produce output in multiple chunks; the output is the same as if " -"the entire input was fed to the non-incremental codec. See the :mod:`codecs` " -"module documentation for details. (Designed and implemented by Walter " -"Dörwald.)" -msgstr "" -":mod:`codecs` モジュールに漸増的コーデックのサポートが追加されています。 :" -"func:`codec.lookup` 関数がタプルではなく :class:`CodecInfo` を返すようになっ" -"ています。 :class:`CodecInfo` のインスタンスは後方互換性を維持するために 4 要" -"素タプルのように振舞うだけでなく、属性 :attr:`encode`, :attr:`decode`, :attr:" -"`incrementalencoder`, :attr:`incrementaldecoder`, :attr:`streamwriter`, :" -"attr:`streamreader` を持ちます。漸増的コーデックは入力を受け取って出力するの" -"を複数チャンクに分けて行えます; 出力は非漸増的コーデックに一回で入力全体を渡" -"したものと同じになります。詳細は :mod:`codecs` モジュールのドキュメントを参照" -"して下さい。 (Designed and implemented by Walter Dörwald.)" +"The :mod:`codecs` module gained support for incremental codecs. " +"The :func:`codec.lookup` function now returns a :class:`CodecInfo` instance " +"instead of a tuple. :class:`CodecInfo` instances behave like a 4-tuple to " +"preserve backward compatibility but also have the " +"attributes :attr:`encode`, :attr:`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:`streamwriter`, " +"and :attr:`streamreader`. Incremental codecs can receive input and produce " +"output in multiple chunks; the output is the same as if the entire input was " +"fed to the non-incremental codec. See the :mod:`codecs` module documentation " +"for details. (Designed and implemented by Walter Dörwald.)" +msgstr "" +":mod:`codecs` モジュールに漸増的コーデックのサポートが追加されていま" +"す。 :func:`codec.lookup` 関数がタプルではなく :class:`CodecInfo` を返すよう" +"になっています。 :class:`CodecInfo` のインスタンスは後方互換性を維持するため" +"に 4 要素タプルのように振舞うだけでなく、属" +"性 :attr:`encode`, :attr:`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:`streamwriter`, :attr:`streamreader` " +"を持ちます。漸増的コーデックは入力を受け取って出力するのを複数チャンクに分け" +"て行えます; 出力は非漸増的コーデックに一回で入力全体を渡したものと同じになり" +"ます。詳細は :mod:`codecs` モジュールのドキュメントを参照して下さい。 " +"(Designed and implemented by Walter Dörwald.)" #: ../../whatsnew/2.5.rst:1240 msgid "" @@ -2314,7 +2581,6 @@ msgstr "" "ラクタも使えます。例えば、その頭文字を基準に語の索引をこのように作ることが出" "来ます::" -#: ../../whatsnew/2.5.rst:1251 msgid "" "words = \"\"\"Nel mezzo del cammin di nostra vita\n" "mi ritrovai per una selva oscura\n" @@ -2326,12 +2592,20 @@ msgid "" " init_letter = w[0]\n" " index[init_letter].append(w)" msgstr "" +"words = \"\"\"Nel mezzo del cammin di nostra vita\n" +"mi ritrovai per una selva oscura\n" +"che la diritta via era smarrita\"\"\".lower().split()\n" +"\n" +"index = defaultdict(list)\n" +"\n" +"for w in words:\n" +" init_letter = w[0]\n" +" index[init_letter].append(w)" #: ../../whatsnew/2.5.rst:1261 msgid "Printing ``index`` results in the following output::" msgstr "``index`` を出力するとこんな具合です::" -#: ../../whatsnew/2.5.rst:1263 msgid "" "defaultdict(, {'c': ['cammin', 'che'], 'e': ['era'],\n" " 'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],\n" @@ -2339,6 +2613,11 @@ msgid "" " 'p': ['per'], 's': ['selva', 'smarrita'],\n" " 'r': ['ritrovai'], 'u': ['una'], 'v': ['vita', 'via']}" msgstr "" +"defaultdict(, {'c': ['cammin', 'che'], 'e': ['era'],\n" +" 'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],\n" +" 'l': ['la'], 'o': ['oscura'], 'n': ['nel', 'nostra'],\n" +" 'p': ['per'], 's': ['selva', 'smarrita'],\n" +" 'r': ['ritrovai'], 'u': ['una'], 'v': ['vita', 'via']}" #: ../../whatsnew/2.5.rst:1269 msgid "(Contributed by Guido van Rossum.)" @@ -2346,15 +2625,16 @@ msgstr "(Contributed by Guido van Rossum.)" #: ../../whatsnew/2.5.rst:1271 msgid "" -"The :class:`deque` double-ended queue type supplied by the :mod:" -"`collections` module now has a ``remove(value)`` method that removes the " -"first occurrence of *value* in the queue, raising :exc:`ValueError` if the " -"value isn't found. (Contributed by Raymond Hettinger.)" +"The :class:`deque` double-ended queue type supplied by " +"the :mod:`collections` module now has a ``remove(value)`` method that " +"removes the first occurrence of *value* in the queue, " +"raising :exc:`ValueError` if the value isn't found. (Contributed by Raymond " +"Hettinger.)" msgstr "" ":mod:`collections` モジュールで提供されている両端キュー (double-ended queue) " "型 :class:`deque` に、キュー内で最初に現れる *value* を削除するメソッド " -"``remove(value)`` メソッドが追加されています。 *value* が見つからなければ :" -"exc:`ValueError` が送出されます。 (Contributed by Raymond Hettinger.)" +"``remove(value)`` メソッドが追加されています。 *value* が見つからなけれ" +"ば :exc:`ValueError` が送出されます。 (Contributed by Raymond Hettinger.)" #: ../../whatsnew/2.5.rst:1276 msgid "" @@ -2378,11 +2658,12 @@ msgid "" msgstr "" "新規モジュール: :mod:`cProfile` モジュールは既存の :mod:`profile` モジュール" "の C 実装で、遥かに小さなオーバヘッドで実行出来ます。モジュールのインターフェ" -"イスは :mod:`profile` と同じです: 関数をプロファイルするのには ``cProfile." -"run('main()')`` と実行し、プロファイル結果をファイルに書き出すなど出来ます。" -"これは Hotshot プロファイラとして知られるものではないですが (これも C で書か" -"れてますが :mod:`profile` モジュールのインターフェイスとは別物です)、将来バー" -"ジョンの Python で保守が続けられる予定です。(Contributed by Armin Rigo.)" +"イスは :mod:`profile` と同じです: 関数をプロファイルするのには " +"``cProfile.run('main()')`` と実行し、プロファイル結果をファイルに書き出すなど" +"出来ます。これは Hotshot プロファイラとして知られるものではないですが (これ" +"も C で書かれてますが :mod:`profile` モジュールのインターフェイスとは別物で" +"す)、将来バージョンの Python で保守が続けられる予定です。(Contributed by " +"Armin Rigo.)" #: ../../whatsnew/2.5.rst:1288 msgid "" @@ -2399,12 +2680,12 @@ msgstr "" msgid "" "The :mod:`csv` module, which parses files in comma-separated value format, " "received several enhancements and a number of bugfixes. You can now set the " -"maximum size in bytes of a field by calling the ``csv." -"field_size_limit(new_limit)`` function; omitting the *new_limit* argument " -"will return the currently set limit. The :class:`reader` class now has a :" -"attr:`line_num` attribute that counts the number of physical lines read from " -"the source; records can span multiple physical lines, so :attr:`line_num` is " -"not the same as the number of records read." +"maximum size in bytes of a field by calling the " +"``csv.field_size_limit(new_limit)`` function; omitting the *new_limit* " +"argument will return the currently set limit. The :class:`reader` class now " +"has a :attr:`line_num` attribute that counts the number of physical lines " +"read from the source; records can span multiple physical lines, " +"so :attr:`line_num` is not the same as the number of records read." msgstr "" #: ../../whatsnew/2.5.rst:1301 @@ -2433,13 +2714,16 @@ msgstr "" msgid "(Contributed by Skip Montanaro and Andrew McNamara.)" msgstr "(Contributed by Skip Montanaro and Andrew McNamara.)" -#: ../../whatsnew/2.5.rst:1311 msgid "" "The :class:`~datetime.datetime` class in the :mod:`datetime` module now has " "a ``strptime(string, format)`` method for parsing date strings, contributed " "by Josh Spoerri. It uses the same format characters as :func:`time.strptime` " "and :func:`time.strftime`::" msgstr "" +":mod:`datetime` モジュールの :class:`~datetime.datetime` クラスに、日付の文字" +"列を解析する ``strptime(string, format)`` メソッドが加わりました。\n" +"Josh Spoerri による貢献で、:func:`time.strptime` や :func:`time.strftime` と" +"同じ書式文字を使います。 ::" #: ../../whatsnew/2.5.rst:1316 msgid "" @@ -2456,11 +2740,11 @@ msgid "" "subsequences. Previously, the algorithm would occasionally break a block of " "matching elements into two list entries. (Enhancement by Tim Peters.)" msgstr "" -":mod:`difflib` モジュールのメソッド :meth:`SequenceMatcher." -"get_matching_blocks` が、合致するサブシーケンスを記述するブロックについて、最" -"小範囲リストを返すよう保障するようになりました。以前は時折 2 つのリストエント" -"リに合致要素ブロックが分割されることがありました。(Enhancement by Tim " -"Peters.)" +":mod:`difflib` モジュールのメソッ" +"ド :meth:`SequenceMatcher.get_matching_blocks` が、合致するサブシーケンスを記" +"述するブロックについて、最小範囲リストを返すよう保障するようになりました。以" +"前は時折 2 つのリストエントリに合致要素ブロックが分割されることがありました。" +"(Enhancement by Tim Peters.)" #: ../../whatsnew/2.5.rst:1326 msgid "" @@ -2475,10 +2759,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1330 msgid "" -"An *encoding* parameter was added to the :func:`testfile` function and the :" -"class:`DocFileSuite` class to specify the file's encoding. This makes it " -"easier to use non-ASCII characters in tests contained within a docstring. " -"(Contributed by Bjorn Tillenius.)" +"An *encoding* parameter was added to the :func:`testfile` function and " +"the :class:`DocFileSuite` class to specify the file's encoding. This makes " +"it easier to use non-ASCII characters in tests contained within a " +"docstring. (Contributed by Bjorn Tillenius.)" msgstr "" ":func:`testfile` 関数と :class:`DocFileSuite` にファイルのエンコーディングを" "指定するための *encoding* パラメータが追加されました。これにより docstring 内" @@ -2497,12 +2781,12 @@ msgstr "" msgid "" "The :mod:`fileinput` module was made more flexible. Unicode filenames are " "now supported, and a *mode* parameter that defaults to ``\"r\"`` was added " -"to the :func:`input` function to allow opening files in binary or :term:" -"`universal newlines` mode. Another new parameter, *openhook*, lets you use " -"a function other than :func:`open` to open the input files. Once you're " -"iterating over the set of files, the :class:`FileInput` object's new :meth:" -"`~fileinput.fileno` returns the file descriptor for the currently opened " -"file. (Contributed by Georg Brandl.)" +"to the :func:`input` function to allow opening files in binary " +"or :term:`universal newlines` mode. Another new parameter, *openhook*, lets " +"you use a function other than :func:`open` to open the input files. Once " +"you're iterating over the set of files, the :class:`FileInput` object's " +"new :meth:`~fileinput.fileno` returns the file descriptor for the currently " +"opened file. (Contributed by Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1354 @@ -2530,11 +2814,10 @@ msgid "" "example::" msgstr "" ":mod:`heapq` モジュールの :func:`nsmallest` 関数と :func:`nlargest` 関数が" -"キーワードパラメータ ``key`` をサポートするようになっています。これは :func:" -"`min`/:func:`max` 関数と :meth:`sort` メソッドで提供されているものと似たもの" -"です。例えば::" +"キーワードパラメータ ``key`` をサポートするようになっています。これ" +"は :func:`min`/:func:`max` 関数と :meth:`sort` メソッドで提供されているものと" +"似たものです。例えば::" -#: ../../whatsnew/2.5.rst:1366 msgid "" ">>> import heapq\n" ">>> L = [\"short\", 'medium', 'longest', 'longer still']\n" @@ -2543,6 +2826,12 @@ msgid "" ">>> heapq.nsmallest(2, L, key=len) # Return two shortest elements\n" "['short', 'medium']" msgstr "" +">>> import heapq\n" +">>> L = [\"short\", 'medium', 'longest', 'longer still']\n" +">>> heapq.nsmallest(2, L) # 辞書順で最小の 2 要素を返す\n" +"['longer still', 'longest']\n" +">>> heapq.nsmallest(2, L, key=len) # 最も短い 2 要素を返す\n" +"['short', 'medium']" #: ../../whatsnew/2.5.rst:1373 ../../whatsnew/2.5.rst:1382 msgid "(Contributed by Raymond Hettinger.)" @@ -2558,19 +2847,20 @@ msgstr "" "うになっています。これは slice オブジェクトとの互換性を高めるもので、つまり以" "下のように書くことが出来ます::" -#: ../../whatsnew/2.5.rst:1379 msgid "" "s = slice(5) # Create slice object\n" "itertools.islice(iterable, s.start, s.stop, s.step)" msgstr "" +"s = slice(5) # スライスオブジェクトを作る\n" +"itertools.islice(iterable, s.start, s.stop, s.step)" #: ../../whatsnew/2.5.rst:1384 msgid "" "The :func:`format` function in the :mod:`locale` module has been modified " "and two new functions were added, :func:`format_string` and :func:`currency`." msgstr "" -":mod:`locale` モジュールの :func:`format` 関数が更新され、2 つの関数 :func:" -"`format_string` と :func:`currency` が追加されました。" +":mod:`locale` モジュールの :func:`format` 関数が更新され、2 つの関" +"数 :func:`format_string` と :func:`currency` が追加されました。" #: ../../whatsnew/2.5.rst:1387 msgid "" @@ -2589,13 +2879,13 @@ msgstr "" #: ../../whatsnew/2.5.rst:1393 msgid "" -"To format strings with multiple %char specifiers, use the new :func:" -"`format_string` function that works like :func:`format` but also supports " -"mixing %char specifiers with arbitrary text." +"To format strings with multiple %char specifiers, use the " +"new :func:`format_string` function that works like :func:`format` but also " +"supports mixing %char specifiers with arbitrary text." msgstr "" "複数 %文字指定子を含む文字列をフォーマットするには、 :func:`format` のように" -"働き、任意のテキストと %文字指定子を混ぜた文字列をサポートする新しい :func:" -"`format_string` 関数を使ってください。" +"働き、任意のテキストと %文字指定子を混ぜた文字列をサポートする新し" +"い :func:`format_string` 関数を使ってください。" #: ../../whatsnew/2.5.rst:1397 msgid "" @@ -2620,13 +2910,13 @@ msgid "" "into an mbox-format one::" msgstr "" ":mod:`mailbox` モジュールでは、メールボックスについてそれを読むことに加えて修" -"正出来る能力を追加するための、大々的な書き換えが行われています。 :class:" -"`mbox`, :class:`MH`, :class:`Maildir` を含む新しいクラス群はメールボックス読" -"み込みに使われますが、メッセージ追加のための ``add(message)`` 、削除の " -"``remove(key)`` 、ロック/アンロックのための :meth:`lock`/:meth:`unlock` も" -"持っています。続く例は maildir 形式から mbox 形式に変換する例です::" +"正出来る能力を追加するための、大々的な書き換えが行われていま" +"す。 :class:`mbox`, :class:`MH`, :class:`Maildir` を含む新しいクラス群はメー" +"ルボックス読み込みに使われますが、メッセージ追加のための ``add(message)`` 、" +"削除の ``remove(key)`` 、ロック/アンロックのため" +"の :meth:`lock`/:meth:`unlock` も持っています。続く例は maildir 形式から " +"mbox 形式に変換する例です::" -#: ../../whatsnew/2.5.rst:1412 msgid "" "import mailbox\n" "\n" @@ -2638,6 +2928,15 @@ msgid "" "for msg in src:\n" " dest.add(msg)" msgstr "" +"import mailbox\n" +"\n" +"# 'factory=None' は、個々のメッセージを表すクラスとして\n" +"# email.Message.Message を使う。\n" +"src = mailbox.Maildir('maildir', factory=None)\n" +"dest = mailbox.mbox('/tmp/mbox')\n" +"\n" +"for msg in src:\n" +" dest.add(msg)" #: ../../whatsnew/2.5.rst:1422 msgid "" @@ -2647,34 +2946,42 @@ msgstr "" "(Contributed by Gregory K. Johnson. Funding was provided by Google's 2005 " "Summer of Code.)" -#: ../../whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" -"file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " -"database is also included. (Contributed by Martin von Löwis.)" +"New module: the :mod:`!msilib` module allows creating Microsoft " +"Installer :file:`.msi` files and CAB files. Some support for reading " +"the :file:`.msi` database is also included. (Contributed by Martin von " +"Löwis.)" msgstr "" +"新モジュール :mod:`!msilib` で、Microsoft Installer の :file:`.msi` ファイル" +"や CAB ファイルを作れるようになりました。\n" +":file:`.msi` データベースの読み取り機能も一部含まれます。\n" +"(Martin von Löwis による貢献です。)" -#: ../../whatsnew/2.5.rst:1429 msgid "" "The :mod:`!nis` module now supports accessing domains other than the system " "default domain by supplying a *domain* argument to the :func:`!nis.match` " "and :func:`!nis.maps` functions. (Contributed by Ben Bell.)" msgstr "" +":mod:`!nis` モジュールで、:func:`!nis.match` や :func:`!nis.maps` 関数に " +"*domain* 引数を指定すると、システムのデフォルト以外のドメインにもアクセスでき" +"るようになりました。\n" +"(Ben Bell による貢献です。)" #: ../../whatsnew/2.5.rst:1433 msgid "" "The :mod:`operator` module's :func:`itemgetter` and :func:`attrgetter` " -"functions now support multiple fields. A call such as ``operator." -"attrgetter('a', 'b')`` will return a function that retrieves the :attr:`a` " -"and :attr:`b` attributes. Combining this new feature with the :meth:`sort` " -"method's ``key`` parameter lets you easily sort lists using multiple " -"fields. (Contributed by Raymond Hettinger.)" +"functions now support multiple fields. A call such as " +"``operator.attrgetter('a', 'b')`` will return a function that retrieves " +"the :attr:`a` and :attr:`b` attributes. Combining this new feature with " +"the :meth:`sort` method's ``key`` parameter lets you easily sort lists " +"using multiple fields. (Contributed by Raymond Hettinger.)" msgstr "" ":mod:`operator` モジュールの :func:`itemgetter` 関数と :func:`attrgetter` 関" -"数が複数フィールドをサポートするようになりました。 ``operator." -"attrgetter('a', 'b')`` のように呼び出すと、 :attr:`a` と :attr:`b` 属性を取り" -"出す関数を返します。この新機能と :meth:`sort` メソッドの ``key`` パラメータを" -"組み合わせると、複数フィールドでのリストのソートが簡単になります。" +"数が複数フィールドをサポートするようになりました。 " +"``operator.attrgetter('a', 'b')`` のように呼び出すと、 :attr:`a` " +"と :attr:`b` 属性を取り出す関数を返します。この新機能と :meth:`sort` メソッド" +"の ``key`` パラメータを組み合わせると、複数フィールドでのリストのソートが簡単" +"になります。" #: ../../whatsnew/2.5.rst:1440 msgid "" @@ -2692,11 +2999,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1445 msgid "" -"The :mod:`os` module underwent several changes. The :attr:" -"`stat_float_times` variable now defaults to true, meaning that :func:`os." -"stat` will now return time values as floats. (This doesn't necessarily mean " -"that :func:`os.stat` will return times that are precise to fractions of a " -"second; not all systems support such precision.)" +"The :mod:`os` module underwent several changes. " +"The :attr:`stat_float_times` variable now defaults to true, meaning " +"that :func:`os.stat` will now return time values as floats. (This doesn't " +"necessarily mean that :func:`os.stat` will return times that are precise to " +"fractions of a second; not all systems support such precision.)" msgstr "" ":mod:`os` モジュールに多数の変更がありました。 :attr:`stat_float_times` 値の" "デフォルトが真となっていて、これはつまり :func:`os.stat` が時刻の値を浮動小数" @@ -2704,13 +3011,17 @@ msgstr "" "値を返すという意味ではありません; 全てのシステムがそのような精度をサポートし" "てはいません。)" -#: ../../whatsnew/2.5.rst:1451 msgid "" -"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, and :const:`os." -"SEEK_END` have been added; these are the parameters to the :func:`os.lseek` " -"function. Two new constants for locking are :const:`os.O_SHLOCK` and :const:" -"`os.O_EXLOCK`." +"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, " +"and :const:`os.SEEK_END` have been added; these are the parameters to " +"the :func:`os.lseek` function. Two new constants for locking " +"are :const:`os.O_SHLOCK` and :const:`os.O_EXLOCK`." msgstr "" +":const:`os.SEEK_SET`、:const:`os.SEEK_CUR`、:const:`os.SEEK_END` という定数が" +"追加されました。\n" +"これらは :func:`os.lseek` 関数の引数に使います。\n" +"ロック用には :const:`os.O_SHLOCK` と :const:`os.O_EXLOCK` の 2 つの定数が加わ" +"りました。" #: ../../whatsnew/2.5.rst:1456 msgid "" @@ -2734,9 +3045,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1465 msgid "" "On FreeBSD, the :func:`os.stat` function now returns times with nanosecond " -"resolution, and the returned object now has :attr:`st_gen` and :attr:" -"`st_birthtime`. The :attr:`st_flags` attribute is also available, if the " -"platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" +"resolution, and the returned object now has :attr:`st_gen` " +"and :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, " +"if the platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" msgstr "" "FreeBSD では、 :func:`os.stat` 関数がナノ秒精度の時刻を返し、また、返却オブ" "ジェクトが :attr:`st_gen` と :attr:`st_birthtime` を持つようになっていま" @@ -2759,27 +3070,34 @@ msgstr "" "``next`` のような実行再開コマンドを含めることが出来ます。 (Contributed by " "Grégoire Dooms.)" -#: ../../whatsnew/2.5.rst:1481 msgid "" "The :mod:`pickle` and :mod:`!cPickle` modules no longer accept a return " "value of ``None`` from the :meth:`~object.__reduce__` method; the method " "must return a tuple of arguments instead. The ability to return ``None`` " "was deprecated in Python 2.4, so this completes the removal of the feature." msgstr "" +":mod:`pickle` と :mod:`!cPickle` モジュールは、:meth:`~object.__reduce__` メ" +"ソッドの戻り値として ``None`` を受け付けなくなりました。\n" +"代わりに引数のタプルを返す必要があります。\n" +"``None`` を返す機能は Python 2.4 で非推奨となっており、これで削除が完了しま" +"す。" -#: ../../whatsnew/2.5.rst:1486 msgid "" "The :mod:`pkgutil` module, containing various utility functions for finding " "packages, was enhanced to support :pep:`302`'s import hooks and now also " "works for packages stored in ZIP-format archives. (Contributed by Phillip J. " "Eby.)" msgstr "" +"パッケージの検索などのユーティリティ関数を含む :mod:`pkgutil` モジュール" +"が、:pep:`302` のインポートフックに対応し、ZIP 形式のアーカイブ内のパッケージ" +"でも動作するようになりました。\n" +"(Phillip J. Eby による貢献です。)" #: ../../whatsnew/2.5.rst:1490 msgid "" -"The pybench benchmark suite by Marc-André Lemburg is now included in the :" -"file:`Tools/pybench` directory. The pybench suite is an improvement on the " -"commonly used :file:`pystone.py` program because pybench provides a more " +"The pybench benchmark suite by Marc-André Lemburg is now included in " +"the :file:`Tools/pybench` directory. The pybench suite is an improvement on " +"the commonly used :file:`pystone.py` program because pybench provides a more " "detailed measurement of the interpreter's speed. It times particular " "operations such as function calls, tuple slicing, method lookups, and " "numeric operations, instead of performing many different operations and " @@ -2819,12 +3137,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1507 msgid "" "The old :mod:`regex` and :mod:`regsub` modules, which have been deprecated " -"ever since Python 2.0, have finally been deleted. Other deleted modules: :" -"mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." +"ever since Python 2.0, have finally been deleted. Other deleted " +"modules: :mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." msgstr "" "古い :mod:`regex`, :mod:`regsub` モジュール、これは Python 2.0 からずっと非推" -"奨になっていましたが、ついに削除されました。ほかにも、 :mod:`statcache`, :" -"mod:`tzparse`, :mod:`whrandom` が削除されています。" +"奨になっていましたが、ついに削除されました。ほかに" +"も、 :mod:`statcache`, :mod:`tzparse`, :mod:`whrandom` が削除されています。" #: ../../whatsnew/2.5.rst:1511 msgid "" @@ -2833,16 +3151,16 @@ msgid "" "the default ``sys.path``, so unless your programs explicitly added the " "directory to ``sys.path``, this removal shouldn't affect your code." msgstr "" -":mod:`dircmp` や :mod:`ni` といった石器時代のモジュールを大事にしまっていた :" -"file:`lib-old` ディレクトリも削除されました。 :file:`lib-old` がデフォルト" -"で ``sys.path`` に含まれることはなかったので、あなたが明示的にそれを ``sys." -"path`` に入れてこなかった限り、この削除はあなたには関係ないでしょう。" +":mod:`dircmp` や :mod:`ni` といった石器時代のモジュールを大事にしまってい" +"た :file:`lib-old` ディレクトリも削除されました。 :file:`lib-old` がデフォル" +"トで ``sys.path`` に含まれることはなかったので、あなたが明示的にそれを " +"``sys.path`` に入れてこなかった限り、この削除はあなたには関係ないでしょう。" #: ../../whatsnew/2.5.rst:1516 msgid "" -"The :mod:`rlcompleter` module is no longer dependent on importing the :mod:" -"`readline` module and therefore now works on non-Unix platforms. (Patch from " -"Robert Kiendl.)" +"The :mod:`rlcompleter` module is no longer dependent on importing " +"the :mod:`readline` module and therefore now works on non-Unix platforms. " +"(Patch from Robert Kiendl.)" msgstr "" ":mod:`rlcompleter` モジュールが :mod:`readline` モジュールのインポートに依存" "しないようになりました。これにより非 Unix プラットフォームで動作するようにな" @@ -2862,8 +3180,8 @@ msgid "" "The :mod:`socket` module now supports :const:`AF_NETLINK` sockets on Linux, " "thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-" "specific mechanism for communications between a user-space process and " -"kernel code; an introductory article about them is at https://www." -"linuxjournal.com/article/7356. In Python code, netlink addresses are " +"kernel code; an introductory article about them is at https://" +"www.linuxjournal.com/article/7356. In Python code, netlink addresses are " "represented as a tuple of 2 integers, ``(pid, group_mask)``." msgstr "" @@ -2882,28 +3200,30 @@ msgstr "" #: ../../whatsnew/2.5.rst:1541 msgid "" -"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, and :meth:" -"`getproto` accessor methods to retrieve the family, type, and protocol " -"values for the socket." +"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, " +"and :meth:`getproto` accessor methods to retrieve the family, type, and " +"protocol values for the socket." msgstr "" -"ソケットオブジェクトには :meth:`getfamily`, :meth:`gettype`, :meth:" -"`getproto` アクセッサメソッドも追加されています。それぞれソケットについてのア" -"ドレスファミリ、タイプ、プロトコルを取得します。" +"ソケットオブジェクトに" +"は :meth:`getfamily`, :meth:`gettype`, :meth:`getproto` アクセッサメソッドも" +"追加されています。それぞれソケットについてのアドレスファミリ、タイプ、プロト" +"コルを取得します。" -#: ../../whatsnew/2.5.rst:1545 msgid "" "New module: the :mod:`!spwd` module provides functions for accessing the " "shadow password database on systems that support shadow passwords." msgstr "" +"新モジュール :mod:`!spwd` は、シャドウパスワードに対応するシステムで、その" +"データベースにアクセスする関数を提供します。" #: ../../whatsnew/2.5.rst:1548 msgid "" -"The :mod:`struct` is now faster because it compiles format strings into :" -"class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. This " -"is similar to how the :mod:`re` module lets you create compiled regular " -"expression objects. You can still use the module-level :func:`pack` and :" -"func:`unpack` functions; they'll create :class:`Struct` objects and cache " -"them. Or you can use :class:`Struct` instances directly::" +"The :mod:`struct` is now faster because it compiles format strings " +"into :class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. " +"This is similar to how the :mod:`re` module lets you create compiled regular " +"expression objects. You can still use the module-level :func:`pack` " +"and :func:`unpack` functions; they'll create :class:`Struct` objects and " +"cache them. Or you can use :class:`Struct` instances directly::" msgstr "" ":meth:`pack`, :meth:`unpack` メソッドでフォーマット文字列を :class:`Struct` " "オブジェクトにコンパイルすることで、 :mod:`struct` がより高速になっています。" @@ -2912,21 +3232,27 @@ msgstr "" "ます; それらは :class:`Struct` オブジェクトを作ってキャッシュします。あるい" "は :class:`Struct` インスタンスを直接使えます::" -#: ../../whatsnew/2.5.rst:1555 msgid "" "s = struct.Struct('ih3s')\n" "\n" "data = s.pack(1972, 187, 'abc')\n" "year, number, name = s.unpack(data)" msgstr "" +"s = struct.Struct('ih3s')\n" +"\n" +"data = s.pack(1972, 187, 'abc')\n" +"year, number, name = s.unpack(data)" -#: ../../whatsnew/2.5.rst:1560 msgid "" "You can also pack and unpack data to and from buffer objects directly using " "the ``pack_into(buffer, offset, v1, v2, ...)`` and ``unpack_from(buffer, " "offset)`` methods. This lets you store data directly into an array or a " "memory-mapped file." msgstr "" +"``pack_into(buffer, offset, v1, v2, ...)`` と ``unpack_from(buffer, " +"offset)`` メソッドで、バッファオブジェクトへ直接パックしたり、そこからアン" +"パックしたりできます。\n" +"これにより、配列やメモリマップファイルへデータを直接格納できます。" #: ../../whatsnew/2.5.rst:1565 msgid "" @@ -2957,10 +3283,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1575 msgid "" -"This information is also available to C extensions via the :c:func:" -"`Py_GetBuildInfo` function that returns a string of build information like " -"this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. (Contributed by " -"Barry Warsaw.)" +"This information is also available to C extensions via " +"the :c:func:`Py_GetBuildInfo` function that returns a string of build " +"information like this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. " +"(Contributed by Barry Warsaw.)" msgstr "" "この情報は C 拡張から :c:func:`Py_GetBuildInfo` 関数を使っても得ることが出来" "ます。これはビルド情報についての文字列を返し、例えば ``\"trunk:45355:45356M, " @@ -2980,11 +3306,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1585 msgid "" -"The :class:`TarFile` class in the :mod:`tarfile` module now has an :meth:" -"`extractall` method that extracts all members from the archive into the " -"current working directory. It's also possible to set a different directory " -"as the extraction target, and to unpack only a subset of the archive's " -"members." +"The :class:`TarFile` class in the :mod:`tarfile` module now has " +"an :meth:`extractall` method that extracts all members from the archive into " +"the current working directory. It's also possible to set a different " +"directory as the extraction target, and to unpack only a subset of the " +"archive's members." msgstr "" ":mod:`tarfile` モジュールの :class:`TarFile` クラスに :meth:`extractall` メ" "ソッドが追加されました。アーカイブから全てのメンバをカレントディレクトリに抽" @@ -3014,12 +3340,15 @@ msgstr "" "ではなく、Windows、POSIX スレッド、OS/2 で可能です。 (Contributed by Andrew " "MacIntyre.)" -#: ../../whatsnew/2.5.rst:1603 msgid "" "The :mod:`unicodedata` module has been updated to use version 4.1.0 of the " "Unicode character database. Version 3.2.0 is required by some " "specifications, so it's still available as :data:`unicodedata.ucd_3_2_0`." msgstr "" +":mod:`unicodedata` モジュールが Unicode 文字データベースのバージョン 4.1.0 を" +"使うよう更新されました。\n" +"バージョン 3.2.0 を必要とする仕様もあるため、そちら" +"も :data:`unicodedata.ucd_3_2_0` として引き続き利用できます。" #: ../../whatsnew/2.5.rst:1607 msgid "" @@ -3037,10 +3366,9 @@ msgstr "" "ジョンを定義しており、文字列から生成するもの、システム特性から生成するもの、" "純粋に乱数から生成するものがあります。このモジュールでは :class:`UUID` クラス" "と :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` 関数を持ってい" -"て、それら異なったバージョンの UUID を生成します。(UUID バージョン 2 は :rfc:" -"`4122` にありませんのでこのモジュールにもないです) ::" +"て、それら異なったバージョンの UUID を生成します。(UUID バージョン 2 " +"は :rfc:`4122` にありませんのでこのモジュールにもないです) ::" -#: ../../whatsnew/2.5.rst:1615 msgid "" ">>> import uuid\n" ">>> # make a UUID based on the host ID and current time\n" @@ -3059,6 +3387,22 @@ msgid "" ">>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n" "UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')" msgstr "" +">>> import uuid\n" +">>> # ホスト ID と現在の時刻をもとに UUID を作る\n" +">>> uuid.uuid1()\n" +"UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n" +"\n" +">>> # 名前空間 UUID と名前の MD5 ハッシュから UUID を作る\n" +">>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n" +"\n" +">>> # ランダムな UUID を作る\n" +">>> uuid.uuid4()\n" +"UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n" +"\n" +">>> # 名前空間 UUID と名前の SHA-1 ハッシュから UUID を作る\n" +">>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')" #: ../../whatsnew/2.5.rst:1632 msgid "(Contributed by Ka-Ping Yee.)" @@ -3066,42 +3410,46 @@ msgstr "(Contributed by Ka-Ping Yee.)" #: ../../whatsnew/2.5.rst:1634 msgid "" -"The :mod:`weakref` module's :class:`WeakKeyDictionary` and :class:" -"`WeakValueDictionary` types gained new methods for iterating over the weak " -"references contained in the dictionary. :meth:`iterkeyrefs` and :meth:" -"`keyrefs` methods were added to :class:`WeakKeyDictionary`, and :meth:" -"`itervaluerefs` and :meth:`valuerefs` were added to :class:" -"`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" +"The :mod:`weakref` module's :class:`WeakKeyDictionary` " +"and :class:`WeakValueDictionary` types gained new methods for iterating over " +"the weak references contained in the dictionary. :meth:`iterkeyrefs` " +"and :meth:`keyrefs` methods were added to :class:`WeakKeyDictionary`, " +"and :meth:`itervaluerefs` and :meth:`valuerefs` were added " +"to :class:`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" msgstr "" -":mod:`weakref` モジュールの :class:`WeakKeyDictionary` 型と :class:" -"`WeakValueDictionary` 型に、辞書内に含まれる弱参照を巡回する新たなメソッドが" -"追加されています。 :meth:`iterkeyrefs` と :meth:`keyrefs` が :class:" -"`WeakKeyDictionary` に追加され、 :meth:`itervaluerefs` と :meth:`valuerefs` " -"が :class:`WeakValueDictionary` に追加されました。(Contributed by Fred L. " -"Drake, Jr.)" +":mod:`weakref` モジュールの :class:`WeakKeyDictionary` 型" +"と :class:`WeakValueDictionary` 型に、辞書内に含まれる弱参照を巡回する新たな" +"メソッドが追加されています。 :meth:`iterkeyrefs` と :meth:`keyrefs` " +"が :class:`WeakKeyDictionary` に追加され、 :meth:`itervaluerefs` " +"と :meth:`valuerefs` が :class:`WeakValueDictionary` に追加されました。" +"(Contributed by Fred L. Drake, Jr.)" #: ../../whatsnew/2.5.rst:1641 msgid "" "The :mod:`webbrowser` module received a number of enhancements. It's now " "usable as a script with ``python -m webbrowser``, taking a URL as the " -"argument; there are a number of switches to control the behaviour (:option:" -"`!-n` for a new browser window, :option:`!-t` for a new tab). New module-" -"level functions, :func:`open_new` and :func:`open_new_tab`, were added to " -"support this. The module's :func:`open` function supports an additional " -"feature, an *autoraise* parameter that signals whether to raise the open " -"window when possible. A number of additional browsers were added to the " -"supported list such as Firefox, Opera, Konqueror, and elinks. (Contributed " -"by Oleg Broytmann and Georg Brandl.)" -msgstr "" - -#: ../../whatsnew/2.5.rst:1653 -msgid "" -"The :mod:`xmlrpclib ` module now supports returning :class:" -"`~datetime.datetime` objects for the XML-RPC date type. Supply " -"``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function or the :" -"class:`!Unmarshaller` class to enable this feature. (Contributed by Skip " -"Montanaro.)" +"argument; there are a number of switches to control the behaviour " +"(:option:`!-n` for a new browser window, :option:`!-t` for a new tab). New " +"module-level functions, :func:`open_new` and :func:`open_new_tab`, were " +"added to support this. The module's :func:`open` function supports an " +"additional feature, an *autoraise* parameter that signals whether to raise " +"the open window when possible. A number of additional browsers were added to " +"the supported list such as Firefox, Opera, Konqueror, and elinks. " +"(Contributed by Oleg Broytmann and Georg Brandl.)" +msgstr "" + +msgid "" +"The :mod:`xmlrpclib ` module now supports " +"returning :class:`~datetime.datetime` objects for the XML-RPC date type. " +"Supply ``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function " +"or the :class:`!Unmarshaller` class to enable this feature. (Contributed by " +"Skip Montanaro.)" msgstr "" +":mod:`xmlrpclib ` モジュールで、XML-RPC の日付型に対し" +"て :class:`~datetime.datetime` オブジェクトを返せるようになりました。\n" +":func:`~xmlrpc.client.loads` 関数や :class:`!Unmarshaller` クラスに " +"``use_datetime=True`` を指定すると有効になります。\n" +"(Skip Montanaro による貢献です。)" #: ../../whatsnew/2.5.rst:1660 msgid "" @@ -3129,7 +3477,6 @@ msgstr "" msgid "The ctypes package" msgstr "ctypes パッケージ" -#: ../../whatsnew/2.5.rst:1681 msgid "" "The :mod:`ctypes` package, written by Thomas Heller, has been added to the " "standard library. :mod:`ctypes` lets you call arbitrary functions in " @@ -3137,36 +3484,46 @@ msgid "" "module, which provides functions for loading shared libraries and calling " "functions in them. The :mod:`ctypes` package is much fancier." msgstr "" +"Thomas Heller が書いた :mod:`ctypes` パッケージが標準ライブラリに加わりまし" +"た。\n" +":mod:`ctypes` を使うと、共有ライブラリや DLL 内の任意の関数を呼び出せます。\n" +"長年の利用者なら、共有ライブラリの読み込みやその関数の呼び出しを行う :mod:`!" +"dl` モジュールを覚えているかもしれません。\n" +":mod:`ctypes` パッケージは、はるかに高機能です。" #: ../../whatsnew/2.5.rst:1687 msgid "" -"To load a shared library or DLL, you must create an instance of the :class:" -"`CDLL` class and provide the name or path of the shared library or DLL. Once " -"that's done, you can call arbitrary functions by accessing them as " -"attributes of the :class:`CDLL` object. ::" +"To load a shared library or DLL, you must create an instance of " +"the :class:`CDLL` class and provide the name or path of the shared library " +"or DLL. Once that's done, you can call arbitrary functions by accessing them " +"as attributes of the :class:`CDLL` object. ::" msgstr "" "シェアドライブラリや DLL をロードするには、 :class:`CDLL` クラスのインスタン" "スを、その名前かパスを渡して構築します。構築したら、 :class:`CDLL` オブジェク" "トの属性にアクセスすることで任意の関数呼び出しが出来ます::" -#: ../../whatsnew/2.5.rst:1692 msgid "" "import ctypes\n" "\n" "libc = ctypes.CDLL('libc.so.6')\n" "result = libc.printf(\"Line of output\\n\")" msgstr "" +"import ctypes\n" +"\n" +"libc = ctypes.CDLL('libc.so.6')\n" +"result = libc.printf(\"Line of output\\n\")" #: ../../whatsnew/2.5.rst:1697 msgid "" -"Type constructors for the various C types are provided: :func:`c_int`, :func:" -"`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :c:expr:`char " -"\\*`), and so forth. Unlike Python's types, the C versions are all mutable; " -"you can assign to their :attr:`value` attribute to change the wrapped " -"value. Python integers and strings will be automatically converted to the " -"corresponding C types, but for other types you must call the correct type " -"constructor. (And I mean *must*; getting it wrong will often result in the " -"interpreter crashing with a segmentation fault.)" +"Type constructors for the various C types are " +"provided: :func:`c_int`, :func:`c_float`, :func:`c_double`, :func:`c_char_p` " +"(equivalent to :c:expr:`char \\*`), and so forth. Unlike Python's types, " +"the C versions are all mutable; you can assign to their :attr:`value` " +"attribute to change the wrapped value. Python integers and strings will be " +"automatically converted to the corresponding C types, but for other types " +"you must call the correct type constructor. (And I mean *must*; getting " +"it wrong will often result in the interpreter crashing with a segmentation " +"fault.)" msgstr "" #: ../../whatsnew/2.5.rst:1706 @@ -3182,22 +3539,23 @@ msgstr "" "う。更新可能なメモリ領域が必要な場合は :func:`create_string_buffer` を使いま" "す::" -#: ../../whatsnew/2.5.rst:1711 msgid "" "s = \"this is a string\"\n" "buf = ctypes.create_string_buffer(s)\n" "libc.strfry(buf)" msgstr "" +"s = \"this is a string\"\n" +"buf = ctypes.create_string_buffer(s)\n" +"libc.strfry(buf)" #: ../../whatsnew/2.5.rst:1715 msgid "" -"C functions are assumed to return integers, but you can set the :attr:" -"`restype` attribute of the function object to change this::" +"C functions are assumed to return integers, but you can set " +"the :attr:`restype` attribute of the function object to change this::" msgstr "" -"C 関数はデフォルトでは整数を返すと仮定されますが、関数オブジェクトの :attr:" -"`restype` 属性をセットすることでこれを変更出来ます::" +"C 関数はデフォルトでは整数を返すと仮定されますが、関数オブジェクト" +"の :attr:`restype` 属性をセットすることでこれを変更出来ます::" -#: ../../whatsnew/2.5.rst:1718 msgid "" ">>> libc.atof('2.71828')\n" "-1783957616\n" @@ -3205,16 +3563,28 @@ msgid "" ">>> libc.atof('2.71828')\n" "2.71828" msgstr "" +">>> libc.atof('2.71828')\n" +"-1783957616\n" +">>> libc.atof.restype = ctypes.c_double\n" +">>> libc.atof('2.71828')\n" +"2.71828" -#: ../../whatsnew/2.5.rst:1724 msgid "" -":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes." -"pythonapi`` object. This object does *not* release the global interpreter " -"lock before calling a function, because the lock must be held when calling " -"into the interpreter's code. There's a :class:`~ctypes.py_object` type " -"constructor that will create a :c:expr:`PyObject *` pointer. A simple " -"usage::" +":mod:`ctypes` also provides a wrapper for Python's C API as the " +"``ctypes.pythonapi`` object. This object does *not* release the global " +"interpreter lock before calling a function, because the lock must be held " +"when calling into the interpreter's code. There's " +"a :class:`~ctypes.py_object` type constructor that will create " +"a :c:expr:`PyObject *` pointer. A simple usage::" msgstr "" +":mod:`ctypes` は、Python の C API のラッパーも ``ctypes.pythonapi`` オブジェ" +"クトとして提供します。\n" +"インタープリタのコードを呼び出すにはロックを保持する必要があるため、このオブ" +"ジェクトは関数を呼び出す前にグローバルインタープリタロックを解放 *しません" +"*。\n" +":c:expr:`PyObject *` ポインターを作る型コンストラク" +"ター :class:`~ctypes.py_object` があります。\n" +"簡単な使用例を示します。 ::" #: ../../whatsnew/2.5.rst:1730 msgid "" @@ -3226,35 +3596,39 @@ msgid "" "# d is now {'abc', 1}." msgstr "" -#: ../../whatsnew/2.5.rst:1737 msgid "" "Don't forget to use :func:`~ctypes.py_object`; if it's omitted you end up " "with a segmentation fault." msgstr "" +":func:`~ctypes.py_object` を忘れずに使ってください。\n" +"省略するとセグメンテーション違反になります。" #: ../../whatsnew/2.5.rst:1740 msgid "" ":mod:`ctypes` has been around for a while, but people still write and " -"distribution hand-coded extension modules because you can't rely on :mod:" -"`ctypes` being present. Perhaps developers will begin to write Python " -"wrappers atop a library accessed through :mod:`ctypes` instead of extension " -"modules, now that :mod:`ctypes` is included with core Python." +"distribution hand-coded extension modules because you can't rely " +"on :mod:`ctypes` being present. Perhaps developers will begin to write " +"Python wrappers atop a library accessed through :mod:`ctypes` instead of " +"extension modules, now that :mod:`ctypes` is included with core Python." msgstr "" -":mod:`ctypes` が周辺ライブラリとして登場してしばらく経ちますが、:mod:" -"`ctypes` が存在していることに依存できないとなれば人々はまだハードコードされた" -"拡張モジュールを書いて配布します。 :mod:`ctypes` が Python 中核に含められた" -"今、おそらく開発者たちは、拡張モジュールの代わりに :mod:`ctypes` を介してアク" -"セスするライブラリの上に Python ラッパーを書き始めるでしょう," +":mod:`ctypes` が周辺ライブラリとして登場してしばらく経ちます" +"が、:mod:`ctypes` が存在していることに依存できないとなれば人々はまだハード" +"コードされた拡張モジュールを書いて配布します。 :mod:`ctypes` が Python 中核に" +"含められた今、おそらく開発者たちは、拡張モジュールの代わりに :mod:`ctypes` を" +"介してアクセスするライブラリの上に Python ラッパーを書き始めるでしょう," #: ../../whatsnew/2.5.rst:1749 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." msgstr "" +"標準ライブラリに入る前の ctypes の Web ページ。チュートリアル、リファレンス、" +"FAQ があります。" #: ../../whatsnew/2.5.rst:1752 msgid "The documentation for the :mod:`ctypes` module." @@ -3274,16 +3648,18 @@ msgid "" msgstr "" "XML 処理のための、Fredrik Lundh の ElementTree ライブラリのサブセットが、標準" "ライブラリに :mod:`xml.etree` として追加されました。利用可能なモジュールは " -"ElementTree 1.2.6 よりの :mod:`ElementTree`, :mod:`ElementPath`, :mod:" -"`ElementInclude` です。 C 実装 :mod:`cElementTree` モジュールも含まれていま" -"す。" +"ElementTree 1.2.6 より" +"の :mod:`ElementTree`, :mod:`ElementPath`, :mod:`ElementInclude` です。 C 実" +"装 :mod:`cElementTree` モジュールも含まれています。" -#: ../../whatsnew/2.5.rst:1768 msgid "" "The rest of this section will provide a brief overview of using ElementTree. " "Full documentation for ElementTree is available at https://web.archive.org/" "web/20201124024954/http://effbot.org/zone/element-index.htm." msgstr "" +"この節の残りでは、ElementTree の使い方を簡単に紹介します。\n" +"詳しい文書は https://web.archive.org/web/20201124024954/http://effbot.org/" +"zone/element-index.htm にあります。" #: ../../whatsnew/2.5.rst:1772 msgid "" @@ -3306,10 +3682,9 @@ msgid "" "an :class:`ElementTree` instance::" msgstr "" "最も一般的に使う解析関数は :func:`parse` です。これは (ファイル名が含まれると" -"みなされる) 文字列またはファイルのようなオブジェクトを受け取って、 :class:" -"`ElementTree` インスタンスを返します::" +"みなされる) 文字列またはファイルのようなオブジェクトを受け取っ" +"て、 :class:`ElementTree` インスタンスを返します::" -#: ../../whatsnew/2.5.rst:1782 msgid "" "from xml.etree import ElementTree as ET\n" "\n" @@ -3319,14 +3694,21 @@ msgid "" " 'http://planet.python.org/rss10.xml')\n" "tree = ET.parse(feed)" msgstr "" +"from xml.etree import ElementTree as ET\n" +"\n" +"tree = ET.parse('ex-1.xml')\n" +"\n" +"feed = urllib.urlopen(\n" +" 'http://planet.python.org/rss10.xml')\n" +"tree = ET.parse(feed)" #: ../../whatsnew/2.5.rst:1790 msgid "" -"Once you have an :class:`ElementTree` instance, you can call its :meth:" -"`getroot` method to get the root :class:`Element` node." +"Once you have an :class:`ElementTree` instance, you can call " +"its :meth:`getroot` method to get the root :class:`Element` node." msgstr "" -":class:`ElementTree` インスタンスを手にしてしまえば、あとはルートの :class:" -"`Element` ノードを得るために :meth:`getroot` を呼び出せます。" +":class:`ElementTree` インスタンスを手にしてしまえば、あとはルート" +"の :class:`Element` ノードを得るために :meth:`getroot` を呼び出せます。" #: ../../whatsnew/2.5.rst:1793 msgid "" @@ -3339,13 +3721,16 @@ msgstr "" "ノードを返す :func:`XML` 関数 もあります。この関数を使えば、簡単に XML リテラ" "ルを使って XML 断片からツリーを組み上げることが綺麗に出来ます::" -#: ../../whatsnew/2.5.rst:1798 msgid "" "svg = ET.XML(\"\"\"\n" " \"\"\")\n" "svg.set('height', '320px')\n" "svg.append(elem1)" msgstr "" +"svg = ET.XML(\"\"\"\n" +" \"\"\")\n" +"svg.set('height', '320px')\n" +"svg.append(elem1)" #: ../../whatsnew/2.5.rst:1803 msgid "" @@ -3463,21 +3848,24 @@ msgstr "属性 *name* を削除する。" #: ../../whatsnew/2.5.rst:1837 msgid "" -"Comments and processing instructions are also represented as :class:" -"`Element` nodes. To check if a node is a comment or processing " +"Comments and processing instructions are also represented " +"as :class:`Element` nodes. To check if a node is a comment or processing " "instructions::" msgstr "" "コメントと処理命令 (processing instruction=PI) も、 :class:`Element` ノードで" "表現されます。ノードがコメントあるいは処理命令であるかをチェックするにはこの" "ようにします::" -#: ../../whatsnew/2.5.rst:1840 msgid "" "if elem.tag is ET.Comment:\n" " ...\n" "elif elem.tag is ET.ProcessingInstruction:\n" " ..." msgstr "" +"if elem.tag is ET.Comment:\n" +" ...\n" +"elif elem.tag is ET.ProcessingInstruction:\n" +" ..." #: ../../whatsnew/2.5.rst:1845 msgid "" @@ -3489,7 +3877,6 @@ msgstr "" "ます。 :func:`parse` のように、文字列もしくはファイルのようなオブジェクトを渡" "せます::" -#: ../../whatsnew/2.5.rst:1848 msgid "" "# Encoding is US-ASCII\n" "tree.write('output.xml')\n" @@ -3498,6 +3885,12 @@ msgid "" "f = open('output.xml', 'w')\n" "tree.write(f, encoding='utf-8')" msgstr "" +"# エンコーディングは US-ASCII\n" +"tree.write('output.xml')\n" +"\n" +"# エンコーディングは UTF-8\n" +"f = open('output.xml', 'w')\n" +"tree.write(f, encoding='utf-8')" #: ../../whatsnew/2.5.rst:1855 msgid "" @@ -3528,6 +3921,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." @@ -3537,7 +3932,6 @@ msgstr "ElementTree の公式ドキュメント" msgid "The hashlib package" msgstr "hashlib パッケージ" -#: ../../whatsnew/2.5.rst:1879 msgid "" "A new :mod:`hashlib` module, written by Gregory P. Smith, has been added to " "replace the :mod:`!md5` and :mod:`!sha` modules. :mod:`hashlib` adds " @@ -3545,8 +3939,13 @@ msgid "" "SHA-512). When available, the module uses OpenSSL for fast platform " "optimized implementations of algorithms." msgstr "" +"Gregory P. Smith が書いた新しい :mod:`hashlib` モジュールが、:mod:`!md5` " +"と :mod:`!sha` の代わりとして追加されました。\n" +":mod:`hashlib` では、さらに SHA-224、SHA-256、SHA-384、SHA-512 という安全な" +"ハッシュもサポートします。\n" +"利用可能なら OpenSSL を使い、プラットフォーム向けに最適化された高速な実装でア" +"ルゴリズムを実行します。" -#: ../../whatsnew/2.5.rst:1885 msgid "" "The old :mod:`!md5` and :mod:`!sha` modules still exist as wrappers around " "hashlib to preserve backwards compatibility. The new module's interface is " @@ -3554,8 +3953,13 @@ msgid "" "significant difference is that the constructor functions for creating new " "hashing objects are named differently. ::" msgstr "" +"後方互換性のため、古い :mod:`!md5` と :mod:`!sha` モジュールも hashlib のラッ" +"パーとして残っています。\n" +"新しいモジュールのインターフェースは以前のものに非常に近いですが、完全に同じ" +"ではありません。\n" +"主な違いは、新しいハッシュオブジェクトを作るコンストラクター関数の名前で" +"す。 ::" -#: ../../whatsnew/2.5.rst:1891 msgid "" "# Old versions\n" "h = md5.md5()\n" @@ -3580,6 +3984,28 @@ msgid "" "# Alternative form\n" "h = hashlib.new('md5') # Provide algorithm as a string" msgstr "" +"# 従来の書き方\n" +"h = md5.md5()\n" +"h = md5.new()\n" +"\n" +"# 新しい書き方\n" +"h = hashlib.md5()\n" +"\n" +"# 従来の書き方\n" +"h = sha.sha()\n" +"h = sha.new()\n" +"\n" +"# 新しい書き方\n" +"h = hashlib.sha1()\n" +"\n" +"# 以前は使えなかったハッシュ\n" +"h = hashlib.sha224()\n" +"h = hashlib.sha256()\n" +"h = hashlib.sha384()\n" +"h = hashlib.sha512()\n" +"\n" +"# 別の書き方\n" +"h = hashlib.new('md5') # アルゴリズムを文字列で指定" #: ../../whatsnew/2.5.rst:1914 msgid "" @@ -3603,12 +4029,14 @@ msgstr ":mod:`hashlib` モジュールについてのドキュメント。" msgid "The sqlite3 package" msgstr "sqlite3 パッケージ" -#: ../../whatsnew/2.5.rst:1933 msgid "" "The pysqlite module (https://www.pysqlite.org), a wrapper for the SQLite " "embedded database, has been added to the standard library under the package " "name :mod:`sqlite3`." msgstr "" +"組み込みデータベース SQLite のラッパーである pysqlite モジュール (https://" +"www.pysqlite.org) が、:mod:`sqlite3` というパッケージ名で標準ライブラリに加わ" +"りました。" #: ../../whatsnew/2.5.rst:1937 msgid "" @@ -3657,9 +4085,8 @@ msgstr "" "ジェクトを作ります。ここではデータはファイル :file:`/tmp/example` に格納され" "ているものとします。 ::" -#: ../../whatsnew/2.5.rst:1956 msgid "conn = sqlite3.connect('/tmp/example')" -msgstr "" +msgstr "conn = sqlite3.connect('/tmp/example')" #: ../../whatsnew/2.5.rst:1958 msgid "" @@ -3674,10 +4101,10 @@ msgid "" "Once you have a :class:`Connection`, you can create a :class:`Cursor` " "object and call its :meth:`execute` method to perform SQL commands::" msgstr "" -":class:`Connection` があれば、 :class:`Cursor` オブジェクトを作りその :meth:" -"`~Cursor.execute` メソッドを呼んで SQL コマンドを実行することができます::" +":class:`Connection` があれば、 :class:`Cursor` オブジェクトを作りそ" +"の :meth:`~Cursor.execute` メソッドを呼んで SQL コマンドを実行することができ" +"ます::" -#: ../../whatsnew/2.5.rst:1963 msgid "" "c = conn.cursor()\n" "\n" @@ -3690,6 +4117,16 @@ msgid "" "c.execute(\"\"\"insert into stocks\n" " values ('2006-01-05','BUY','RHAT',100,35.14)\"\"\")" msgstr "" +"c = conn.cursor()\n" +"\n" +"# テーブルを作成\n" +"c.execute('''create table stocks\n" +"(date text, trans text, symbol text,\n" +" qty real, price real)''')\n" +"\n" +"# データを 1 行挿入\n" +"c.execute(\"\"\"insert into stocks\n" +" values ('2006-01-05','BUY','RHAT',100,35.14)\"\"\")" #: ../../whatsnew/2.5.rst:1974 msgid "" @@ -3712,12 +4149,11 @@ msgid "" "``:1``.) For example::" msgstr "" "代わりに、DB-API のパラメータ割り当てを使います。 ``?`` を変数の値を使いたい" -"ところに埋めておきます。その上で、値のタプルをカーソルの :meth:`~Cursor." -"execute` メソッドの第2引数として引き渡します。(他のデータベースモジュールでは" -"変数の場所を示すのに ``%s`` や ``:1`` などの異なった表記を用いることがありま" -"す。) 例を示します::" +"ところに埋めておきます。その上で、値のタプルをカーソル" +"の :meth:`~Cursor.execute` メソッドの第2引数として引き渡します。(他のデータ" +"ベースモジュールでは変数の場所を示すのに ``%s`` や ``:1`` などの異なった表記" +"を用いることがあります。) 例を示します::" -#: ../../whatsnew/2.5.rst:1983 msgid "" "# Never do this -- insecure!\n" "symbol = 'IBM'\n" @@ -3734,6 +4170,20 @@ msgid "" " ):\n" " c.execute('insert into stocks values (?,?,?,?,?)', t)" msgstr "" +"# これは絶対にしないこと -- 安全でない!\n" +"symbol = 'IBM'\n" +"c.execute(\"... where symbol = '%s'\" % symbol)\n" +"\n" +"# 代わりにこうする\n" +"t = (symbol,)\n" +"c.execute('select * from stocks where symbol=?', t)\n" +"\n" +"# より大きな例\n" +"for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00),\n" +" ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),\n" +" ('2006-04-06', 'SELL', 'IBM', 500, 53.00),\n" +" ):\n" +" c.execute('insert into stocks values (?,?,?,?,?)', t)" #: ../../whatsnew/2.5.rst:1998 msgid "" @@ -3743,16 +4193,15 @@ msgid "" "the matching rows." msgstr "" "SELECT 文を実行した後データを取得する方法は3つありどれを使っても構いません。" -"一つはカーソルをイテレータ (:term:`iterator`) として扱う、一つはカーソルの :" -"meth:`~Cursor.fetchone` メソッドを呼んで一致した内の一行を取得する、もう一つ" -"は :meth:`~Cursor.fetchall` メソッドを呼んで一致した全ての行のリストとして受" -"け取る、という3つです。" +"一つはカーソルをイテレータ (:term:`iterator`) として扱う、一つはカーソル" +"の :meth:`~Cursor.fetchone` メソッドを呼んで一致した内の一行を取得する、もう" +"一つは :meth:`~Cursor.fetchall` メソッドを呼んで一致した全ての行のリストとし" +"て受け取る、という3つです。" #: ../../whatsnew/2.5.rst:2003 msgid "This example uses the iterator form::" msgstr "以下の例ではイテレータの形を使います::" -#: ../../whatsnew/2.5.rst:2005 msgid "" ">>> c = conn.cursor()\n" ">>> c.execute('select * from stocks order by price')\n" @@ -3765,6 +4214,16 @@ msgid "" "(u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0)\n" ">>>" msgstr "" +">>> c = conn.cursor()\n" +">>> c.execute('select * from stocks order by price')\n" +">>> for row in c:\n" +"... print row\n" +"...\n" +"(u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001)\n" +"(u'2006-03-28', u'BUY', u'IBM', 1000, 45.0)\n" +"(u'2006-04-06', u'SELL', u'IBM', 500, 53.0)\n" +"(u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0)\n" +">>>" #: ../../whatsnew/2.5.rst:2016 msgid "" @@ -3776,7 +4235,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." @@ -3813,9 +4272,9 @@ msgstr "wsgiref パッケージ" #: ../../whatsnew/2.5.rst:2042 msgid "" "The Web Server Gateway Interface (WSGI) v1.0 defines a standard interface " -"between web servers and Python web applications and is described in :pep:" -"`333`. The :mod:`wsgiref` package is a reference implementation of the WSGI " -"specification." +"between web servers and Python web applications and is described " +"in :pep:`333`. The :mod:`wsgiref` package is a reference implementation of " +"the WSGI specification." msgstr "" "Web Server Gateway Interface (WSGI) v1.0 は、 Web サーバと Python で記述され" "た Web アプリケーションとの標準インターフェースであり、 :pep:`333` で定義され" @@ -3831,7 +4290,6 @@ msgstr "" "れています; このサーバは製品ユースではないデバッグ目的に有用です。サーバを" "セットアップするには僅か数行で済みます::" -#: ../../whatsnew/2.5.rst:2053 msgid "" "from wsgiref import simple_server\n" "\n" @@ -3842,12 +4300,22 @@ msgid "" "httpd = simple_server.make_server(host, port, wsgi_app)\n" "httpd.serve_forever()" msgstr "" +"from wsgiref import simple_server\n" +"\n" +"wsgi_app = ...\n" +"\n" +"host = ''\n" +"port = 8000\n" +"httpd = simple_server.make_server(host, port, wsgi_app)\n" +"httpd.serve_forever()" #: ../../whatsnew/2.5.rst:2068 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." @@ -3879,7 +4347,6 @@ msgstr "" "続きは Martin von Löwis によって指揮されつつがなく遂行されました。この手続き" "は :pep:`347` にて開発されました。" -#: ../../whatsnew/2.5.rst:2088 msgid "" "Coverity, a company that markets a source code analysis tool called Prevent, " "provided the results of their examination of the Python source code. The " @@ -3887,31 +4354,42 @@ msgid "" "were refcounting problems, often occurring in error-handling code. See " "https://scan.coverity.com for the statistics." msgstr "" +"Prevent というソースコード解析ツールを販売する Coverity 社が、Python のソース" +"コードを調べた結果を提供しました。\n" +"約 60 件のバグが見つかり、速やかに修正されました。\n" +"多くは参照カウントの問題で、エラー処理のコードで起きることが多いものでし" +"た。\n" +"統計は https://scan.coverity.com を参照してください。" -#: ../../whatsnew/2.5.rst:2094 msgid "" "The largest change to the C API came from :pep:`353`, which modifies the " -"interpreter to use a :c:type:`Py_ssize_t` type definition instead of :c:expr:" -"`int`. See the earlier section :ref:`pep-353` for a discussion of this " -"change." +"interpreter to use a :c:type:`Py_ssize_t` type definition instead " +"of :c:expr:`int`. See the earlier section :ref:`pep-353` for a discussion " +"of this change." msgstr "" +"C API の最大の変更は :pep:`353` によるもので、インタープリタが :c:expr:`int` " +"の代わりに :c:type:`Py_ssize_t` という型定義を使うようになりました。\n" +"詳しくは前述の :ref:`pep-353` を参照してください。" -#: ../../whatsnew/2.5.rst:2099 msgid "" "The design of the bytecode compiler has changed a great deal, no longer " "generating bytecode by traversing the parse tree. Instead the parse tree is " "converted to an abstract syntax tree (or AST), and it is the abstract " "syntax tree that's traversed to produce the bytecode." msgstr "" +"バイトコードコンパイラーの設計が大きく変わり、構文解析木を走査して直接バイト" +"コードを生成しなくなりました。\n" +"代わりに構文解析木を抽象構文木 (AST) に変換し、そちらを走査してバイトコードを" +"生成します。" -#: ../../whatsnew/2.5.rst:2104 msgid "" -"It's possible for Python code to obtain AST objects by using the :func:" -"`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the value of " -"the *flags* parameter::" +"It's possible for Python code to obtain AST objects by using " +"the :func:`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the " +"value of the *flags* parameter::" msgstr "" +"Python コードからは、組み込みの :func:`compile` を使い、*flags* パラメーター" +"に ``_ast.PyCF_ONLY_AST`` を指定すると AST オブジェクトを取得できます。 ::" -#: ../../whatsnew/2.5.rst:2108 msgid "" "from _ast import PyCF_ONLY_AST\n" "ast = compile(\"\"\"a=0\n" @@ -3922,22 +4400,29 @@ msgid "" "assignment = ast.body[0]\n" "for_loop = ast.body[1]" msgstr "" +"from _ast import PyCF_ONLY_AST\n" +"ast = compile(\"\"\"a=0\n" +"for i in range(10):\n" +" a += i\n" +"\"\"\", \"\", 'exec', PyCF_ONLY_AST)\n" +"\n" +"assignment = ast.body[0]\n" +"for_loop = ast.body[1]" #: ../../whatsnew/2.5.rst:2117 msgid "" -"No official documentation has been written for the AST code yet, but :pep:" -"`339` discusses the design. To start learning about the code, read the " -"definition of the various AST nodes in :file:`Parser/Python.asdl`. A Python " -"script reads this file and generates a set of C structure definitions in :" -"file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` and :c:" -"func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take " -"Python source as input and return the root of an AST representing the " +"No official documentation has been written for the AST code yet, " +"but :pep:`339` discusses the design. To start learning about the code, read " +"the definition of the various AST nodes in :file:`Parser/Python.asdl`. A " +"Python script reads this file and generates a set of C structure definitions " +"in :file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` " +"and :c:func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, " +"take Python source as input and return the root of an AST representing the " "contents. This AST can then be turned into a code object by :c:func:`!" "PyAST_Compile`. For more information, read the source code, and then ask " "questions on python-dev." msgstr "" -#: ../../whatsnew/2.5.rst:2127 msgid "" "The AST code was developed under Jeremy Hylton's management, and implemented " "by (in alphabetical order) Brett Cannon, Nick Coghlan, Grant Edwards, John " @@ -3945,8 +4430,11 @@ msgid "" "Schemenauer, plus the participants in a number of AST sprints at conferences " "such as PyCon." msgstr "" +"AST のコードは Jeremy Hylton の指揮で開発され、Brett Cannon、Nick Coghlan、" +"Grant Edwards、John Ehresman、Kurt Kaiser、Neal Norwitz、Tim Peters、Armin " +"Rigo、Neil Schemenauer (アルファベット順)、および PyCon などのカンファレンス" +"で行われた AST スプリントの参加者たちが実装しました。" -#: ../../whatsnew/2.5.rst:2136 msgid "" "Evan Jones's patch to obmalloc, first described in a talk at PyCon DC 2005, " "was applied. Python 2.4 allocated small objects in 256K-sized arenas, but " @@ -3956,40 +4444,58 @@ msgid "" "the memory may be returned to the operating system. (Implemented by Evan " "Jones, and reworked by Tim Peters.)" msgstr "" +"PyCon DC 2005 の講演で初めて紹介された、Evan Jones の obmalloc パッチが適用さ" +"れました。\n" +"Python 2.4 は小さいオブジェクトを 256K のアリーナに割り当てていましたが、ア" +"リーナを解放することはありませんでした。\n" +"このパッチによって、空になったアリーナは解放されるようになります。\n" +"その結果、一部のプラットフォームでは、多数のオブジェクトを割り当てた後に削除" +"すると、Python のメモリ使用量が実際に減り、メモリが OS に返されることがありま" +"す。\n" +"(Evan Jones が実装し、Tim Peters が手を加えました。)" -#: ../../whatsnew/2.5.rst:2144 msgid "" "Note that this change means extension modules must be more careful when " "allocating memory. Python's API has many different functions for allocating " -"memory that are grouped into families. For example, :c:func:" -"`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free` are one " -"family that allocates raw memory, while :c:func:`PyObject_Malloc`, :c:func:" -"`PyObject_Realloc`, and :c:func:`PyObject_Free` are another family that's " -"supposed to be used for creating Python objects." -msgstr "" +"memory that are grouped into families. For " +"example, :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free` are one family that allocates raw memory, " +"while :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free` are another family that's supposed to be used " +"for creating Python objects." +msgstr "" +"この変更に伴い、拡張モジュールではメモリの割り当てにいっそう注意する必要があ" +"ります。\n" +"Python の API には多数のメモリ割り当て関数があり、いくつかの系統に分かれてい" +"ます。\n" +"例えば :c:func:`PyMem_Malloc`、:c:func:`PyMem_Realloc`、:c:func:`PyMem_Free` " +"は生のメモリを割り当てる系統" +"で、:c:func:`PyObject_Malloc`、:c:func:`PyObject_Realloc`、:c:func:`PyObject_Free` " +"は Python オブジェクトの作成に使う系統です。" #: ../../whatsnew/2.5.rst:2152 msgid "" -"Previously these different families all reduced to the platform's :c:func:" -"`malloc` and :c:func:`free` functions. This meant it didn't matter if you " -"got things wrong and allocated memory with the ``PyMem`` function but freed " -"it with the ``PyObject`` function. With 2.5's changes to obmalloc, these " -"families now do different things and mismatches will probably result in a " -"segfault. You should carefully test your C extension modules with Python " -"2.5." +"Previously these different families all reduced to the " +"platform's :c:func:`malloc` and :c:func:`free` functions. This meant it " +"didn't matter if you got things wrong and allocated memory with the " +"``PyMem`` function but freed it with the ``PyObject`` function. With 2.5's " +"changes to obmalloc, these families now do different things and mismatches " +"will probably result in a segfault. You should carefully test your C " +"extension modules with Python 2.5." msgstr "" #: ../../whatsnew/2.5.rst:2159 msgid "" "The built-in set types now have an official C API. Call :c:func:`PySet_New` " -"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` and :" -"c:func:`PySet_Discard` to add and remove elements, and :c:func:" -"`PySet_Contains` and :c:func:`PySet_Size` to examine the set's state. " -"(Contributed by Raymond Hettinger.)" -msgstr "" -"ビルトインの集合型のために公式の C API が作られました。新しく作るのには :c:" -"func:`PySet_New` か :c:func:`PyFrozenSet_New` を、要素の追加には :c:func:" -"`PySet_Add` 、削除には :c:func:`PySet_Discard` 、 :c:func:`PySet_Contains` " +"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` " +"and :c:func:`PySet_Discard` to add and remove elements, " +"and :c:func:`PySet_Contains` and :c:func:`PySet_Size` to examine the set's " +"state. (Contributed by Raymond Hettinger.)" +msgstr "" +"ビルトインの集合型のために公式の C API が作られました。新しく作るのに" +"は :c:func:`PySet_New` か :c:func:`PyFrozenSet_New` を、要素の追加に" +"は :c:func:`PySet_Add` 、削除に" +"は :c:func:`PySet_Discard` 、 :c:func:`PySet_Contains` " "と :c:func:`PySet_Size` で集合オブジェクトの状態を調べます。 (Contributed by " "Raymond Hettinger.)" @@ -4012,9 +4518,9 @@ msgid "" "``Py_LOCAL(type)`` declares the function as returning a value of the " "specified *type* and uses a fast-calling qualifier. " "``Py_LOCAL_INLINE(type)`` does the same thing and also requests the function " -"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :" -"file:`python.h` is included, a set of more aggressive optimizations are " -"enabled for the module; you should benchmark the results to find out if " +"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined " +"before :file:`python.h` is included, a set of more aggressive optimizations " +"are enabled for the module; you should benchmark the results to find out if " "these optimizations actually make the code faster. (Contributed by Fredrik " "Lundh at the NeedForSpeed sprint.)" msgstr "" @@ -4027,7 +4533,6 @@ msgstr "" "``PyErr_NewException(name, base, dict)`` が *base* 引数としてベースクラスのタ" "プルを受け付けるようになりました。 (Contributed by Georg Brandl.)" -#: ../../whatsnew/2.5.rst:2184 msgid "" "The :c:func:`!PyErr_Warn` function for issuing warnings is now deprecated in " "favour of ``PyErr_WarnEx(category, message, stacklevel)`` which lets you " @@ -4035,6 +4540,13 @@ msgid "" "A *stacklevel* of 1 is the function calling :c:func:`PyErr_WarnEx`, 2 is the " "function above that, and so forth. (Added by Neal Norwitz.)" msgstr "" +"警告を出す :c:func:`!PyErr_Warn` 関数は非推奨となり、代わりに " +"``PyErr_WarnEx(category, message, stacklevel)`` を使います。\n" +"この関数では、警告の対象とする呼び出し元までのスタックフレーム数を指定できま" +"す。\n" +"*stacklevel* が 1 なら :c:func:`PyErr_WarnEx` を呼んだ関数、2 ならその上の関" +"数というようになります。\n" +"(Neal Norwitz が追加しました。)" #: ../../whatsnew/2.5.rst:2190 msgid "" @@ -4046,19 +4558,24 @@ msgstr "" "でコンパイル出来るようになりました。 (Implemented by Anthony Baxter, " "Martin von Löwis, Skip Montanaro.)" -#: ../../whatsnew/2.5.rst:2194 msgid "" "The :c:func:`!PyRange_New` function was removed. It was never documented, " "never used in the core code, and had dangerously lax error checking. In the " "unlikely case that your extensions were using it, you can replace it by " "something like the following::" msgstr "" +":c:func:`!PyRange_New` 関数が削除されました。\n" +"一度も文書化されず、コアのコードでも使われておらず、エラーチェックも危険なほ" +"ど緩いものでした。\n" +"可能性は低いものの、拡張モジュールで使っていた場合は、次のようなコードで置き" +"換えられます。 ::" -#: ../../whatsnew/2.5.rst:2199 msgid "" "range = PyObject_CallFunction((PyObject*) &PyRange_Type, \"lll\",\n" " start, stop, step);" msgstr "" +"range = PyObject_CallFunction((PyObject*) &PyRange_Type, \"lll\",\n" +" start, stop, step);" #: ../../whatsnew/2.5.rst:2208 msgid "Port-Specific Changes" @@ -4066,19 +4583,23 @@ msgstr "ポート特有の変更" #: ../../whatsnew/2.5.rst:2210 msgid "" -"MacOS X (10.3 and higher): dynamic loading of modules now uses the :c:func:" -"`dlopen` function instead of MacOS-specific functions." +"MacOS X (10.3 and higher): dynamic loading of modules now uses " +"the :c:func:`dlopen` function instead of MacOS-specific functions." msgstr "" -"MacOS X (10.3 以上): モジュールの動的ロードに、MacOS 固有の関数ではなく :c:" -"func:`dlopen` 関数を使うようになりました。" +"MacOS X (10.3 以上): モジュールの動的ロードに、MacOS 固有の関数ではな" +"く :c:func:`dlopen` 関数を使うようになりました。" -#: ../../whatsnew/2.5.rst:2213 msgid "" -"MacOS X: an :option:`!--enable-universalsdk` switch was added to the :" -"program:`configure` script that compiles the interpreter as a universal " +"MacOS X: an :option:`!--enable-universalsdk` switch was added to " +"the :program:`configure` script that compiles the interpreter as a universal " "binary able to run on both PowerPC and Intel processors. (Contributed by " "Ronald Oussoren; :issue:`2573`.)" msgstr "" +"MacOS X: :program:`configure` スクリプトに :option:`!--enable-universalsdk` " +"オプションが加わりました。\n" +"PowerPC と Intel の両プロセッサーで動作するユニバーサルバイナリとしてインター" +"プリタをコンパイルします。\n" +"(Ronald Oussoren による貢献です。:issue:`2573`。)" #: ../../whatsnew/2.5.rst:2218 msgid "" @@ -4117,8 +4638,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2238 msgid "" "Previously, the :attr:`gi_frame` attribute of a generator was always a frame " -"object. Because of the :pep:`342` changes described in section :ref:" -"`pep-342`, it's now possible for :attr:`gi_frame` to be ``None``." +"object. Because of the :pep:`342` changes described in " +"section :ref:`pep-342`, it's now possible for :attr:`gi_frame` to be " +"``None``." msgstr "" "以前はジェネレータの :attr:`gi_frame` 属性は常にフレームオブジェクトでした" "が、 :ref:`pep-342` で説明した :pep:`342` での変更により、 :attr:`gi_frame` " @@ -4133,8 +4655,8 @@ msgid "" msgstr "" "Unicode 文字列とデフォルトの ASCII エンコーディングで Unicode に変換出来ない " "8 ビット文字列との比較を試みると、新しい警告 :class:`UnicodeWarning` が引き起" -"こされるようになっています。以前はそのような比較では :class:" -"`UnicodeDecodeError` 例外を起こしていました。" +"こされるようになっています。以前はそのような比較で" +"は :class:`UnicodeDecodeError` 例外を起こしていました。" #: ../../whatsnew/2.5.rst:2247 msgid "" @@ -4159,44 +4681,55 @@ msgstr "" "が、Python 2.5 からは正確に一つの、ほかに周りをテキストで囲まれていない %文字" "指定子でなければなりません。" -#: ../../whatsnew/2.5.rst:2256 msgid "" "Library: The :mod:`pickle` and :mod:`!cPickle` modules no longer accept a " "return value of ``None`` from the :meth:`~object.__reduce__` method; the " "method must return a tuple of arguments instead. The modules also no longer " "accept the deprecated *bin* keyword parameter." msgstr "" +"ライブラリ: :mod:`pickle` と :mod:`!cPickle` モジュール" +"は、:meth:`~object.__reduce__` メソッドの戻り値として ``None`` を受け付けなく" +"なりました。\n" +"代わりに引数のタプルを返す必要があります。\n" +"また、非推奨だったキーワード引数 *bin* も受け付けなくなりました。" #: ../../whatsnew/2.5.rst:2261 msgid "" -"Library: The :mod:`SimpleXMLRPCServer ` and :mod:" -"`DocXMLRPCServer ` classes now have a :attr:`rpc_paths` " -"attribute that constrains XML-RPC operations to a limited set of URL paths; " -"the default is to allow only ``'/'`` and ``'/RPC2'``. Setting :attr:" -"`rpc_paths` to ``None`` or an empty tuple disables this path checking." +"Library: The :mod:`SimpleXMLRPCServer ` " +"and :mod:`DocXMLRPCServer ` classes now have " +"a :attr:`rpc_paths` attribute that constrains XML-RPC operations to a " +"limited set of URL paths; the default is to allow only ``'/'`` and ``'/" +"RPC2'``. Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables " +"this path checking." msgstr "" -#: ../../whatsnew/2.5.rst:2267 msgid "" "C API: Many functions now use :c:type:`Py_ssize_t` instead of :c:expr:`int` " "to allow processing more data on 64-bit machines. Extension code may need " "to make the same change to avoid warnings and to support 64-bit machines. " "See the earlier section :ref:`pep-353` for a discussion of this change." msgstr "" +"C API: 64 ビットマシンでより多くのデータを処理できるよう、多数の関数" +"が :c:expr:`int` の代わりに :c:type:`Py_ssize_t` を使うようになりました。\n" +"警告を避け、64 ビットマシンに対応するために、拡張コードにも同じ変更が必要にな" +"る場合があります。\n" +"詳しくは前述の :ref:`pep-353` を参照してください。" -#: ../../whatsnew/2.5.rst:2272 msgid "" "C API: The obmalloc changes mean that you must be careful to not mix usage " "of the ``PyMem_*`` and ``PyObject_*`` families of functions. Memory " "allocated with one family's ``*_Malloc`` must be freed with the " "corresponding family's ``*_Free`` function." msgstr "" +"C API: obmalloc の変更により、``PyMem_*`` 系と ``PyObject_*`` 系の関数を混在" +"させないよう注意する必要があります。\n" +"一方の系統の ``*_Malloc`` で割り当てたメモリは、同じ系統の ``*_Free`` 関数で" +"解放しなければなりません。" #: ../../whatsnew/2.5.rst:2281 msgid "Acknowledgements" msgstr "謝辞" -#: ../../whatsnew/2.5.rst:2283 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " @@ -4206,11 +4739,17 @@ msgid "" "Paul Prescod, James Pryor, Mike Rovner, Scott Weikart, Barry Warsaw, Thomas " "Wouters." msgstr "" +"本稿の草稿に対して提案、訂正、支援を提供してくださった次の方々に感謝しま" +"す。\n" +"Georg Brandl、Nick Coghlan、Phillip J. Eby、Lars Gustäbel、Raymond " +"Hettinger、Ralf W. Grosse-Kunstleve、Kent Johnson、Iain Lowe、Martin von " +"Löwis、Fredrik Lundh、Andrew McNamara、Skip Montanaro、Gustavo Niemeyer、" +"Paul Prescod、James Pryor、Mike Rovner、Scott Weikart、Barry Warsaw、Thomas " +"Wouters。" #: ../../whatsnew/2.5.rst:1342 msgid "universal newlines" msgstr "universal newlines" -#: ../../whatsnew/2.5.rst:1342 msgid "What's new" -msgstr "" +msgstr "新機能" diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index b1908076b..2cd3d5cb6 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 @@ -34,11 +34,13 @@ msgstr "著者" msgid "A.M. Kuchling (amk at amk.ca)" msgstr "A.M. Kuchling (amk at amk.ca)" -#: ../../whatsnew/2.6.rst:50 msgid "" "This article explains the new features in Python 2.6, released on October 1, " "2008. The release schedule is described in :pep:`361`." msgstr "" +"この記事では、2008 年 10 月 1 日にリリースされた Python 2.6 の新機能を説明し" +"ます。\n" +"リリース日程は :pep:`361` に記載されています。" #: ../../whatsnew/2.6.rst:53 msgid "" @@ -47,16 +49,17 @@ msgid "" "incorporates new features and syntax from 3.0 while remaining compatible " "with existing code by not removing older features or syntax. When it's not " "possible to do that, Python 2.6 tries to do what it can, adding " -"compatibility functions in a :mod:`future_builtins` module and a :option:" -"`!-3` switch to warn about usages that will become unsupported in 3.0." +"compatibility functions in a :mod:`future_builtins` module and " +"a :option:`!-3` switch to warn about usages that will become unsupported in " +"3.0." msgstr "" "Python 2.6 の主要なテーマは、大幅な言語の再設計となる Python 3.0 移行への道筋" "を準備することです。可能な場合にはいつでも、Python 2.6 は、古い機能や文法を削" "除することなく既存のコードの互換性を保てるようにしながら、3.0 より新機能と新" "文法を組み込んでいます。そうすることが出来ない場合には、Python 2.6 は、出来る" "ことを出来るだけ試みました。それには :mod:`future_builtins` モジュールに互換" -"関数を、また、Python 3 でサポートされなくなる用法についての警告を出すための :" -"option:`!-3` スイッチ を追加しています。" +"関数を、また、Python 3 でサポートされなくなる用法についての警告を出すため" +"の :option:`!-3` スイッチ を追加しています。" #: ../../whatsnew/2.6.rst:62 msgid "" @@ -138,8 +141,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:106 msgid "" -"The addition of :func:`functools.reduce` as a synonym for the built-in :func:" -"`reduce` function." +"The addition of :func:`functools.reduce` as a synonym for the built-" +"in :func:`reduce` function." msgstr "" "組み込み関数 :func:`reduce` への別名としての :func:`functools.reduce` の追" "加。" @@ -154,28 +157,32 @@ msgid "" "future_builtins import hex, map`` as necessary." msgstr "" "Python 3.0 はいくつかの新しい組み込み関数を追加し、また、いくつかの既存の組み" -"込み関数では意味を変更しています。Python 3.0 での新しい組み込み関数、例えば :" -"func:`bin` などは単純に 2.6 に追加されましたが、既存のものはそうせずに、代わ" -"りに :mod:`future_builtins` モジュールに 3.0 版のものを追加しています。3.0 と" -"互換性を持ちたいコードでは、必要に応じて ``from future_builtins import hex, " -"map`` などとすることが出来ます。" +"込み関数では意味を変更しています。Python 3.0 での新しい組み込み関数、例え" +"ば :func:`bin` などは単純に 2.6 に追加されましたが、既存のものはそうせずに、" +"代わりに :mod:`future_builtins` モジュールに 3.0 版のものを追加しています。" +"3.0 と互換性を持ちたいコードでは、必要に応じて ``from future_builtins import " +"hex, map`` などとすることが出来ます。" #: ../../whatsnew/2.6.rst:117 msgid "" "A new command-line switch, :option:`!-3`, enables warnings about features " "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " -"switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." +"switch is available to Python code as the boolean " +"variable :data:`sys.py3kwarning`, and to C extension code as :c:data:`!" +"Py_Py3kWarningFlag`." msgstr "" -#: ../../whatsnew/2.6.rst:126 msgid "" -"The 3\\ *xxx* series of PEPs, which contains proposals for Python 3.0. :pep:" -"`3000` describes the development process for Python 3.0. Start with :pep:" -"`3100` that describes the general goals for Python 3.0, and then explore the " -"higher-numbered PEPs that propose specific features." +"The 3\\ *xxx* series of PEPs, which contains proposals for Python " +"3.0. :pep:`3000` describes the development process for Python 3.0. Start " +"with :pep:`3100` that describes the general goals for Python 3.0, and then " +"explore the higher-numbered PEPs that propose specific features." msgstr "" +"3\\ *xxx* 番台の PEP には Python 3.0 への提案が含まれています。\n" +":pep:`3000` は Python 3.0 の開発プロセスを説明しています。\n" +"まず全般的な目標を説明する :pep:`3100` を読み、次に具体的な機能を提案する、そ" +"れ以降の番号の PEP を調べてください。" #: ../../whatsnew/2.6.rst:134 msgid "Changes to the Development Process" @@ -209,19 +216,29 @@ msgstr "" "イズの余地がなく、たとえば課題のライフサイクルをカスタマイズ出来ませんでし" "た。" -#: ../../whatsnew/2.6.rst:150 msgid "" "The infrastructure committee of the Python Software Foundation therefore " "posted a call for issue trackers, asking volunteers to set up different " "products and import some of the bugs and patches from SourceForge. Four " "different trackers were examined: `Jira `__, `Launchpad `__, `Roundup `__, and `Trac `__. The " +"jira/>`__, `Launchpad `__, `Roundup `__, and `Trac `__. The " "committee eventually settled on Jira and Roundup as the two candidates. " "Jira is a commercial product that offers no-cost hosted instances to free-" "software projects; Roundup is an open-source project that requires " "volunteers to administer it and a server to host it." msgstr "" +"そこで Python Software Foundation のインフラストラクチャ委員会は課題追跡シス" +"テムを公募し、ボランティアに各種製品をセットアップして SourceForge から一部の" +"バグやパッチを取り込むよう依頼しました。\n" +"`Jira `__、`Launchpad `__、`Roundup `__、`Trac " +"`__ の 4 製品が検討され、最終的に Jira と " +"Roundup の 2 つに絞られました。\n" +"Jira は商用製品で、フリーソフトウェアプロジェクトには無償のホスティング環境を" +"提供します。\n" +"Roundup はオープンソースのプロジェクトで、管理するボランティアとホスト用サー" +"バーが必要です。" #: ../../whatsnew/2.6.rst:164 msgid "" @@ -240,15 +257,22 @@ msgstr "" "ディションでは、それぞれの変更についてのバグ/パッチの Roundup アイテムにリン" "クします。" -#: ../../whatsnew/2.6.rst:172 msgid "" "Hosting of the Python bug tracker is kindly provided by `Upfront Systems " "`__ of Stellenbosch, South Africa. Martin " "von Löwis put a lot of effort into importing existing bugs and patches from " -"SourceForge; his scripts for this import operation are at ``https://svn." -"python.org/view/tracker/importer/`` and may be useful to other projects " +"SourceForge; his scripts for this import operation are at ``https://" +"svn.python.org/view/tracker/importer/`` and may be useful to other projects " "wishing to move from SourceForge to Roundup." msgstr "" +"Python のバグトラッカーのホスティングは、南アフリカのステレンボッシュにある " +"`Upfront Systems `__ が親切に提供していま" +"す。\n" +"Martin von Löwis は SourceForge から既存のバグやパッチを取り込むために多大な" +"労力を費やしました。\n" +"取り込み用のスクリプトは ``https://svn.python.org/view/tracker/importer/`` に" +"あり、SourceForge から Roundup へ移行したいほかのプロジェクトにも役立つかもし" +"れません。" #: ../../whatsnew/2.6.rst:182 msgid "https://bugs.python.org" @@ -260,7 +284,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 +292,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 +300,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 "" @@ -325,12 +348,15 @@ msgstr "" "良い変換を達成することにとらわれて、誰一人として仕事を完遂させようと時間を捧" "げることはしませんでした。" -#: ../../whatsnew/2.6.rst:215 msgid "" "During the 2.6 development cycle, Georg Brandl put a lot of effort into " "building a new toolchain for processing the documentation. The resulting " "package is called Sphinx, and is available from https://www.sphinx-doc.org/." msgstr "" +"2.6 の開発中、Georg Brandl は文書を処理する新しいツール群の構築に多大な労力を" +"費やしました。\n" +"その成果は Sphinx というパッケージで、https://www.sphinx-doc.org/ から入手で" +"きます。" #: ../../whatsnew/2.6.rst:220 msgid "" @@ -347,14 +373,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:226 msgid "" "Sphinx is a standalone package that can be used for writing, and almost two " -"dozen other projects (`listed on the Sphinx web site `__) have adopted Sphinx as their documentation " -"tool." +"dozen other projects (`listed on the Sphinx web site `__) have adopted Sphinx as their " +"documentation tool." msgstr "" "Sphinx は執筆に使えるスタンドアロンのパッケージです。そして 2 ダースに届かん" -"ばかりのプロジェクト (`Sphinx ウェブサイトのリスト `__) が Sphinx をドキュメンテーションツールとして" -"採用しました。" +"ばかりのプロジェクト (`Sphinx ウェブサイトのリスト `__) が Sphinx をドキュメンテーションツールと" +"して採用しました。" #: ../../whatsnew/2.6.rst:233 msgid "`Documenting Python `__" @@ -364,17 +390,15 @@ msgstr "`Documenting Python `__" msgid "Describes how to write for Python's documentation." msgstr "Python ドキュメントの書き方について書いています。" -#: ../../whatsnew/2.6.rst:236 msgid "`Sphinx `__" -msgstr "" +msgstr "`Sphinx `__" #: ../../whatsnew/2.6.rst:237 msgid "Documentation and code for the Sphinx toolchain." msgstr "Sphinx ツールチェインのドキュメントとコードです。" -#: ../../whatsnew/2.6.rst:239 msgid "`Docutils `__" -msgstr "" +msgstr "`Docutils `__" #: ../../whatsnew/2.6.rst:240 msgid "The underlying reStructuredText parser and toolset." @@ -423,33 +447,42 @@ msgid "" msgstr "" "':keyword:`with`' ステートメントは基本構造が以下となる制御フロー構造です::" -#: ../../whatsnew/2.6.rst:266 msgid "" "with expression [as variable]:\n" " with-block" msgstr "" +"with expression [as variable]:\n" +" with-block" -#: ../../whatsnew/2.6.rst:269 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods)." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods)." msgstr "" +"式を評価した結果は、コンテキスト管理プロトコルに対応するオブジェクトである必" +"要があります (つまり、:meth:`~object.__enter__` メソッド" +"と :meth:`~object.__exit__` メソッドを備えている必要があります)。" -#: ../../whatsnew/2.6.rst:273 msgid "" "The object's :meth:`~object.__enter__` is called before *with-block* is " "executed and therefore can run set-up code. It also may return a value that " "is bound to the name *variable*, if given. (Note carefully that *variable* " "is *not* assigned the result of *expression*.)" msgstr "" +"*with-block* を実行する前にオブジェクトの :meth:`~object.__enter__` が呼ばれ" +"るため、そこで準備のコードを実行できます。\n" +"値を返すこともでき、*variable* が指定されていればその名前に束縛されます。\n" +"(*variable* に代入されるのは *expression* の結果では *ない* 点に注意してくだ" +"さい。)" -#: ../../whatsnew/2.6.rst:278 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" +"*with-block* の実行が終わると、ブロックが例外を送出した場合も含めて、オブジェ" +"クトの :meth:`~object.__exit__` メソッドが呼ばれるので、そこで後始末のコード" +"を実行できます。" #: ../../whatsnew/2.6.rst:282 msgid "" @@ -461,13 +494,16 @@ msgstr "" "していて、 ':keyword:`with`' とともに使えます。ファイルオブジェクトがその一例" "です::" -#: ../../whatsnew/2.6.rst:285 msgid "" "with open('/etc/passwd', 'r') as f:\n" " for line in f:\n" " print line\n" " ... more processing code ..." msgstr "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... more processing code ..." #: ../../whatsnew/2.6.rst:290 msgid "" @@ -479,11 +515,12 @@ msgstr "" "は、たとえ :keyword:`for` ループが道半ばにして例外と成り果てても、自動的にク" "ローズされます。" -#: ../../whatsnew/2.6.rst:296 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" +"この場合、:meth:`~object.__enter__` が *self* を返すので、*f* " +"は :func:`open` が作ったオブジェクトそのものです。" #: ../../whatsnew/2.6.rst:299 msgid "" @@ -493,13 +530,16 @@ msgstr "" ":mod:`threading` モジュールのロック・条件変数でも ':keyword:`with`' ステート" "メントの恩恵にあずかれます::" -#: ../../whatsnew/2.6.rst:302 msgid "" "lock = threading.Lock()\n" "with lock:\n" " # Critical section of code\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with lock:\n" +" # コードのクリティカルセクション\n" +" ..." #: ../../whatsnew/2.6.rst:307 msgid "" @@ -519,7 +559,6 @@ msgstr "" "ンテキスト (計算の望みの精度と丸め特性をカプセル化しています) を保存しておい" "てあとで元に戻すのを簡単にしてくれます::" -#: ../../whatsnew/2.6.rst:314 msgid "" "from decimal import Decimal, Context, localcontext\n" "\n" @@ -532,6 +571,16 @@ msgid "" " # The original context is restored on exiting the block.\n" " print v.sqrt()" msgstr "" +"from decimal import Decimal, Context, localcontext\n" +"\n" +"# デフォルトの精度である 28 桁で表示\n" +"v = Decimal('578')\n" +"print v.sqrt()\n" +"\n" +"with localcontext(Context(prec=16)):\n" +" # このブロック内のコードはすべて 16 桁の精度を使う。\n" +" # ブロックを抜けると元のコンテキストに戻る。\n" +" print v.sqrt()" #: ../../whatsnew/2.6.rst:329 msgid "Writing Context Managers" @@ -555,42 +604,56 @@ msgstr "" msgid "A high-level explanation of the context management protocol is:" msgstr "コンテキスト管理プロトコルの高度な説明はこんなです:" -#: ../../whatsnew/2.6.rst:339 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" +"式を評価した結果は、「コンテキストマネージャー」と呼ばれるオブジェクトである" +"必要があります。\n" +"コンテキストマネージャーには :meth:`~object.__enter__` " +"と :meth:`~object.__exit__` の両メソッドが必要です。" -#: ../../whatsnew/2.6.rst:343 msgid "" "The context manager's :meth:`~object.__enter__` method is called. The value " "returned is assigned to *VAR*. If no ``as VAR`` clause is present, the " "value is simply discarded." msgstr "" +"コンテキストマネージャーの :meth:`~object.__enter__` メソッドが呼ばれ、その戻" +"り値が *VAR* に代入されます。\n" +"``as VAR`` 節がなければ、値は単に捨てられます。" #: ../../whatsnew/2.6.rst:347 msgid "The code in *BLOCK* is executed." msgstr "*BLOCK* 内のコードが実行されます。" -#: ../../whatsnew/2.6.rst:349 msgid "" -"If *BLOCK* raises an exception, the context manager's :meth:`~object." -"__exit__` method is called with three arguments, the exception details " -"(``type, value, traceback``, the same values returned by :func:`sys." -"exc_info`, which can also be ``None`` if no exception occurred). The " -"method's return value controls whether an exception is re-raised: any false " -"value re-raises the exception, and ``True`` will result in suppressing it. " -"You'll only rarely want to suppress the exception, because if you do the " -"author of the code containing the ':keyword:`with`' statement will never " -"realize anything went wrong." +"If *BLOCK* raises an exception, the context " +"manager's :meth:`~object.__exit__` method is called with three arguments, " +"the exception details (``type, value, traceback``, the same values returned " +"by :func:`sys.exc_info`, which can also be ``None`` if no exception " +"occurred). The method's return value controls whether an exception is re-" +"raised: any false value re-raises the exception, and ``True`` will result in " +"suppressing it. You'll only rarely want to suppress the exception, because " +"if you do the author of the code containing the ':keyword:`with`' statement " +"will never realize anything went wrong." msgstr "" +"*BLOCK* が例外を送出した場合、コンテキストマネージャー" +"の :meth:`~object.__exit__` が例外の詳細を表す 3 つの引数で呼ばれます。\n" +"これは ``type, value, traceback`` という :func:`sys.exc_info` と同じ値で、例" +"外がなければ ``None`` にもなります。\n" +"メソッドの戻り値で例外を再送出するかどうかが決まり、偽の値なら再送出し、" +"``True`` なら抑制します。\n" +"例外を抑制すべき場合はまれです。\n" +"抑制すると、:keyword:`with` 文を含むコードの作者は、何か問題が起きたことを知" +"る手段を失うからです。" -#: ../../whatsnew/2.6.rst:358 msgid "" "If *BLOCK* didn't raise an exception, the :meth:`~object.__exit__` method " "is still called, but *type*, *value*, and *traceback* are all ``None``." msgstr "" +"*BLOCK* が例外を送出しなかった場合も :meth:`~object.__exit__` メソッドは呼ば" +"れますが、*type*、*value*、*traceback* はすべて ``None`` になります。" #: ../../whatsnew/2.6.rst:361 msgid "" @@ -624,7 +687,6 @@ msgstr "" "データベース接続を表現するオブジェクトがあると仮定しましょう。私たちの目標" "は、そのオブジェクトのユーザがこのように書けるようになることです::" -#: ../../whatsnew/2.6.rst:373 msgid "" "db_connection = DatabaseConnection()\n" "with db_connection as cursor:\n" @@ -632,18 +694,22 @@ msgid "" " cursor.execute('delete from ...')\n" " # ... more operations ..." msgstr "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... その他の操作 ..." #: ../../whatsnew/2.6.rst:379 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" "トランザクションはブロック内のコードがつつがなく終了すればコミットし、例外が" -"発生すればロールバックすべきです。私が思い描いている :class:" -"`DatabaseConnection` の基本的なインターフェイスはこんなです::" +"発生すればロールバックすべきです。私が思い描いてい" +"る :class:`DatabaseConnection` の基本的なインターフェイスはこんなです::" -#: ../../whatsnew/2.6.rst:383 msgid "" "class DatabaseConnection:\n" " # Database interface\n" @@ -654,8 +720,15 @@ msgid "" " def rollback(self):\n" " \"Rolls back current transaction\"" msgstr "" +"class DatabaseConnection:\n" +" # データベースのインターフェース\n" +" def cursor(self):\n" +" \"新しいトランザクションを開始し、カーソルオブジェクトを返す\"\n" +" def commit(self):\n" +" \"現在のトランザクションをコミットする\"\n" +" def rollback(self):\n" +" \"現在のトランザクションをロールバックする\"" -#: ../../whatsnew/2.6.rst:392 msgid "" "The :meth:`~object.__enter__` method is pretty easy, having only to start a " "new transaction. For this application the resulting cursor object would be " @@ -663,8 +736,13 @@ msgid "" "cursor`` to their ':keyword:`with`' statement to bind the cursor to a " "variable name. ::" msgstr "" +":meth:`~object.__enter__` メソッドは、新しいトランザクションを開始するだけな" +"ので簡単です。\n" +"この用途では、作成したカーソルオブジェクトを返すと便利なので、メソッドの戻り" +"値にします。\n" +"利用者は :keyword:`with` 文に ``as cursor`` を追加して、カーソルを変数名に束" +"縛できます。 ::" -#: ../../whatsnew/2.6.rst:397 msgid "" "class DatabaseConnection:\n" " ...\n" @@ -673,14 +751,23 @@ msgid "" " cursor = self.cursor()\n" " return cursor" msgstr "" +"class DatabaseConnection:\n" +" ...\n" +" def __enter__(self):\n" +" # 新しいトランザクションを開始するコード\n" +" cursor = self.cursor()\n" +" return cursor" -#: ../../whatsnew/2.6.rst:404 msgid "" "The :meth:`~object.__exit__` method is the most complicated because it's " "where most of the work has to be done. The method has to check if an " "exception occurred. If there was no exception, the transaction is " "committed. The transaction is rolled back if there was an exception." msgstr "" +":meth:`~object.__exit__` メソッドは処理の大部分を担うため、最も複雑になりま" +"す。\n" +"このメソッドは例外が発生したかどうかを確認する必要があります。\n" +"例外がなければトランザクションをコミットし、例外があればロールバックします。" #: ../../whatsnew/2.6.rst:409 msgid "" @@ -694,7 +781,6 @@ msgstr "" "望むならもっと明示的に、コメントでマークした部分で :keyword:`return` 文を書い" "てもよろしいです::" -#: ../../whatsnew/2.6.rst:414 msgid "" "class DatabaseConnection:\n" " ...\n" @@ -707,6 +793,16 @@ msgid "" " self.rollback()\n" " # return False" msgstr "" +"class DatabaseConnection:\n" +" ...\n" +" def __exit__(self, type, value, tb):\n" +" if tb is None:\n" +" # 例外がないのでコミット\n" +" self.commit()\n" +" else:\n" +" # 例外が発生したのでロールバック。\n" +" self.rollback()\n" +" # return False" #: ../../whatsnew/2.6.rst:429 msgid "The contextlib module" @@ -726,8 +822,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`!yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -741,7 +837,6 @@ msgstr "" "このデコレータを使って、前セクションの私たちのデータベースの例はこのように書" "けます::" -#: ../../whatsnew/2.6.rst:446 msgid "" "from contextlib import contextmanager\n" "\n" @@ -760,6 +855,22 @@ msgid "" "with db_transaction(db) as cursor:\n" " ..." msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction(connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." #: ../../whatsnew/2.6.rst:463 msgid "" @@ -770,17 +881,19 @@ msgid "" "lock::" msgstr "" ":mod:`contextlib` モジュールには ``nested(mgr1, mgr2, ...)`` 関数もあり、この" -"関数はたくさんのコンテキストマネージャを組み合わせることができて、入れ子の ':" -"keyword:`with`' を書く必要性をなくしてくれます。この例では、単一の ':keyword:" -"`!with`' でデータベーストランザクション開始とスレッドのロック獲得の両方をやっ" -"てのけています::" +"関数はたくさんのコンテキストマネージャを組み合わせることができて、入れ子の " +"':keyword:`with`' を書く必要性をなくしてくれます。この例では、単一の " +"':keyword:`!with`' でデータベーストランザクション開始とスレッドのロック獲得の" +"両方をやってのけています::" -#: ../../whatsnew/2.6.rst:468 msgid "" "lock = threading.Lock()\n" "with nested (db_transaction(db), lock) as (cursor, locked):\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." #: ../../whatsnew/2.6.rst:472 msgid "" @@ -792,7 +905,6 @@ msgstr "" "束縛出来るようにし、かつブロックの終了で、与えた引数が持つ ``.close()`` を呼" "び出します::" -#: ../../whatsnew/2.6.rst:476 msgid "" "import urllib, sys\n" "from contextlib import closing\n" @@ -801,6 +913,12 @@ msgid "" " for line in f:\n" " sys.stdout.write(line)" msgstr "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" #: ../../whatsnew/2.6.rst:486 msgid ":pep:`343` - The \"with\" statement" @@ -836,32 +954,42 @@ msgstr "" "す。パッケージ内のモジュールを実行する際に、相対インポートが正しく動作してい" "ませんでした。" -#: ../../whatsnew/2.6.rst:505 msgid "" "The fix for Python 2.6 adds a :attr:`module.__package__` attribute. When " "this attribute is present, relative imports will be relative to the value of " "this attribute instead of the :attr:`~module.__name__` attribute." msgstr "" +"Python 2.6 では、この問題の修正として :attr:`module.__package__` 属性が追加さ" +"れました。\n" +"この属性があれば、相対インポートは :attr:`~module.__name__` ではなく、この属" +"性の値を基準に行われます。" -#: ../../whatsnew/2.6.rst:510 msgid "" "PEP 302-style importers can then set :attr:`~module.__package__` as " "necessary. The :mod:`runpy` module that implements the :option:`-m` switch " "now does this, so relative imports will now work correctly in scripts " "running from inside a package." msgstr "" +"PEP 302 形式のインポーターは、必要に応じて :attr:`~module.__package__` を設定" +"できます。\n" +":option:`-m` オプションを実装する :mod:`runpy` モジュールもこれを設定するよう" +"になり、パッケージ内から実行するスクリプトで相対インポートが正しく動作するよ" +"うになりました。" #: ../../whatsnew/2.6.rst:520 msgid "PEP 370: Per-user ``site-packages`` Directory" msgstr "PEP 370: ユーザごとの ``site-packages`` ディレクトリ" -#: ../../whatsnew/2.6.rst:522 msgid "" "When you run Python, the module search path ``sys.path`` usually includes a " "directory whose path ends in ``\"site-packages\"``. This directory is " "intended to hold locally installed packages available to all users using a " "machine or a particular site installation." msgstr "" +"Python の実行時、モジュール検索パス ``sys.path`` には通常、パスの末尾が " +"``\"site-packages\"`` のディレクトリが含まれます。\n" +"このディレクトリは、マシンや特定のサイトの Python 環境の全ユーザーが利用でき" +"る、ローカルにインストールしたパッケージを置くためのものです。" #: ../../whatsnew/2.6.rst:527 msgid "" @@ -886,17 +1014,17 @@ msgid "" "site-packages` on Windows." msgstr "" "このディレクトリ内にはバージョン固有のサブディレクトリが入ります。Unix/Mac " -"OS では :file:`lib/python2.6/site-packages` のように、Windows では :file:" -"`Python26/site-packages` のように。" +"OS では :file:`lib/python2.6/site-packages` のように、Windows で" +"は :file:`Python26/site-packages` のように。" #: ../../whatsnew/2.6.rst:537 msgid "" "If you don't like the default directory, it can be overridden by an " "environment variable. :envvar:`PYTHONUSERBASE` sets the root directory used " "for all Python versions supporting this feature. On Windows, the directory " -"for application-specific data can be changed by setting the :envvar:" -"`APPDATA` environment variable. You can also modify the :file:`site.py` " -"file for your Python installation." +"for application-specific data can be changed by setting " +"the :envvar:`APPDATA` environment variable. You can also modify " +"the :file:`site.py` file for your Python installation." msgstr "" "このデフォルトディレクトリが好きでないなら、この機能をサポートする全ての " "Python バージョンが使う環境変数 :envvar:`PYTHONUSERBASE` にルートディレクトリ" @@ -909,8 +1037,8 @@ msgid "" "The feature can be disabled entirely by running Python with the :option:`-s` " "option or setting the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -"この機能は Python 起動時に :option:`-s` オプションを付けるか、環境変数 :" -"envvar:`PYTHONNOUSERSITE` をセットすることで完全に無効に出来ます。" +"この機能は Python 起動時に :option:`-s` オプションを付けるか、環境変" +"数 :envvar:`PYTHONNOUSERSITE` をセットすることで完全に無効に出来ます。" #: ../../whatsnew/2.6.rst:550 msgid ":pep:`370` - Per-user ``site-packages`` Directory" @@ -939,24 +1067,25 @@ msgstr "" #: ../../whatsnew/2.6.rst:567 msgid "" -"The :mod:`multiprocessing` module started out as an exact emulation of the :" -"mod:`threading` module using processes instead of threads. That goal was " -"discarded along the path to Python 2.6, but the general approach of the " +"The :mod:`multiprocessing` module started out as an exact emulation of " +"the :mod:`threading` module using processes instead of threads. That goal " +"was discarded along the path to Python 2.6, but the general approach of the " "module is still similar. The fundamental class is the :class:`Process`, " -"which is passed a callable object and a collection of arguments. The :meth:" -"`start` method sets the callable running in a subprocess, after which you " -"can call the :meth:`is_alive` method to check whether the subprocess is " -"still running and the :meth:`join` method to wait for the process to exit." +"which is passed a callable object and a collection of arguments. " +"The :meth:`start` method sets the callable running in a subprocess, after " +"which you can call the :meth:`is_alive` method to check whether the " +"subprocess is still running and the :meth:`join` method to wait for the " +"process to exit." msgstr "" ":mod:`multiprocessing` モジュールは、 :mod:`threading` モジュールがスレッドの" "代わりにプロセスを使ようになるだけのような、完全な模倣となるよう開始されまし" "た。その目標は Python 2.6 へ向かう道のりを経て捨て去られはしましたが、モ" -"ジュールの一般的なアプローチはそれでも似ています。基礎的なクラスは :class:" -"`Process` です。これには呼び出し可能オブジェクトと引数のコレクションを渡しま" -"す。その :meth:`start` メソッドが渡された呼び出し可能オブジェクトをサブプロセ" -"スで実行するので、 :meth:`is_alive` メソッドを呼び出せばサブプロセスが実行中" -"かを知ることが出来、 :meth:`join` メソッドでそのプロセスが終了するのを待つこ" -"とが出来ます。" +"ジュールの一般的なアプローチはそれでも似ています。基礎的なクラス" +"は :class:`Process` です。これには呼び出し可能オブジェクトと引数のコレクショ" +"ンを渡します。その :meth:`start` メソッドが渡された呼び出し可能オブジェクトを" +"サブプロセスで実行するので、 :meth:`is_alive` メソッドを呼び出せばサブプロセ" +"スが実行中かを知ることが出来、 :meth:`join` メソッドでそのプロセスが終了する" +"のを待つことが出来ます。" #: ../../whatsnew/2.6.rst:577 msgid "" @@ -968,7 +1097,6 @@ msgstr "" "コリンに書かれていて、入力が 4 の倍数だととっても時間がかかるように仕組んであ" "ります。" -#: ../../whatsnew/2.6.rst:584 msgid "" "import time\n" "from multiprocessing import Process, Queue\n" @@ -1000,6 +1128,35 @@ msgid "" " result = queue.get()\n" " print 'Factorial', N, '=', result" msgstr "" +"import time\n" +"from multiprocessing import Process, Queue\n" +"\n" +"\n" +"def factorial(queue, N):\n" +" \"階乗を計算する。\"\n" +" # N が 4 の倍数なら、この関数は大幅に時間がかかる。\n" +" if (N % 4) == 0:\n" +" time.sleep(.05 * N/4)\n" +"\n" +" # 結果を計算\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # 結果をキューへ入れる\n" +" queue.put(fact)\n" +"\n" +"if __name__ == '__main__':\n" +" queue = Queue()\n" +"\n" +" N = 5\n" +"\n" +" p = Process(target=factorial, args=(queue, N))\n" +" p.start()\n" +" p.join()\n" +"\n" +" result = queue.get()\n" +" print 'Factorial', N, '=', result" #: ../../whatsnew/2.6.rst:614 msgid "" @@ -1010,22 +1167,22 @@ msgid "" "communicate. (If the parent were to change the value of the global " "variable, the child's value would be unaffected, and vice versa.)" msgstr "" -":class:`~queue.Queue` が factorial の結果を通信して返すのに使われています。 :" -"class:`~queue.Queue` オブジェクトはグローバル変数に格納されています。子プロセ" -"スは、子プロセスが作成された時点のその変数の値を使うことになります; :class:" -"`~queue.Queue` なので、親子はそのオブジェクトを通信のために使うことが出来ま" -"す。(プロセス作成後に親がグローバル変数 queue を差し替えても、子の値は左右さ" -"れませんし、逆もしかりです。)" +":class:`~queue.Queue` が factorial の結果を通信して返すのに使われていま" +"す。 :class:`~queue.Queue` オブジェクトはグローバル変数に格納されています。子" +"プロセスは、子プロセスが作成された時点のその変数の値を使うことになりま" +"す; :class:`~queue.Queue` なので、親子はそのオブジェクトを通信のために使うこ" +"とが出来ます。(プロセス作成後に親がグローバル変数 queue を差し替えても、子の" +"値は左右されませんし、逆もしかりです。)" #: ../../whatsnew/2.6.rst:622 msgid "" "Two other classes, :class:`Pool` and :class:`Manager`, provide higher-level " "interfaces. :class:`Pool` will create a fixed number of worker processes, " "and requests can then be distributed to the workers by calling :meth:`apply` " -"or :meth:`apply_async` to add a single request, and :meth:`map` or :meth:" -"`map_async` to add a number of requests. The following code uses a :class:" -"`Pool` to spread requests across 5 worker processes and retrieve a list of " -"results::" +"or :meth:`apply_async` to add a single request, and :meth:`map` " +"or :meth:`map_async` to add a number of requests. The following code uses " +"a :class:`Pool` to spread requests across 5 worker processes and retrieve a " +"list of results::" msgstr "" "2 つのほかのクラス :class:`Pool` と :class:`Manager` はハイレベルインターフェ" "イスです。 :class:`Pool` では固定数のワーカープロセスを作ってワーカープロセス" @@ -1052,7 +1209,6 @@ msgstr "" msgid "This produces the following output::" msgstr "これは以下のような出力をします::" -#: ../../whatsnew/2.6.rst:642 msgid "" "1\n" "39916800\n" @@ -1061,6 +1217,12 @@ msgid "" "33452526613163807108170062053440751665152000000000\n" "..." msgstr "" +"1\n" +"39916800\n" +"51090942171709440000\n" +"8222838654177922817725562880000000\n" +"33452526613163807108170062053440751665152000000000\n" +"..." #: ../../whatsnew/2.6.rst:649 msgid "" @@ -1083,7 +1245,6 @@ msgstr "" "は :meth:`Lock`, :meth:`RLock`, :meth:`Semaphore` メソッドも含まれていて、共" "有ロックを作るのに使えます。)" -#: ../../whatsnew/2.6.rst:661 msgid "" "import time\n" "from multiprocessing import Pool, Manager\n" @@ -1117,12 +1278,42 @@ msgid "" " for k, v in sorted(d.items()):\n" " print k, v" msgstr "" +"import time\n" +"from multiprocessing import Pool, Manager\n" +"\n" +"def factorial(N, dictionary):\n" +" \"階乗を計算する。\"\n" +" # 結果を計算\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # 結果を辞書に格納\n" +" dictionary[N] = fact\n" +"\n" +"if __name__ == '__main__':\n" +" p = Pool(5)\n" +" mgr = Manager()\n" +" d = mgr.dict() # 共有辞書を作成\n" +"\n" +" # プールを使ってタスクを実行\n" +" for N in range(1, 1000, 10):\n" +" p.apply_async(factorial, (N, d))\n" +"\n" +" # プールを閉じ、タスクの追加を終了する。\n" +" p.close()\n" +"\n" +" # タスクの終了を待つ\n" +" p.join()\n" +"\n" +" # 結果を出力\n" +" for k, v in sorted(d.items()):\n" +" print k, v" #: ../../whatsnew/2.6.rst:693 msgid "This will produce the output::" msgstr "これはこんな出力をするでしょう::" -#: ../../whatsnew/2.6.rst:695 msgid "" "1 1\n" "11 39916800\n" @@ -1131,6 +1322,12 @@ msgid "" "41 33452526613163807108170062053440751665152000000000\n" "51 15511187532873822802242430164693032110632597200169861120000..." msgstr "" +"1 1\n" +"11 39916800\n" +"21 51090942171709440000\n" +"31 8222838654177922817725562880000000\n" +"41 33452526613163807108170062053440751665152000000000\n" +"51 15511187532873822802242430164693032110632597200169861120000..." #: ../../whatsnew/2.6.rst:704 msgid "The documentation for the :mod:`multiprocessing` module." @@ -1151,22 +1348,25 @@ msgstr "" msgid "PEP 3101: Advanced String Formatting" msgstr ":pep:`3101`: 進化版文字列フォーマッティング" -#: ../../whatsnew/2.6.rst:718 msgid "" "In Python 3.0, the ``%`` operator is supplemented by a more powerful string " "formatting method, :meth:`format`. Support for the :meth:`str.format` " "method has been backported to Python 2.6." msgstr "" +"Python 3.0 では ``%`` 演算子に加え、より強力な文字列書式化メソッ" +"ド :meth:`format` が導入されます。\n" +":meth:`str.format` のサポートは Python 2.6 にも移植されました。" -#: ../../whatsnew/2.6.rst:722 msgid "" "In 2.6, both 8-bit and Unicode strings have a ``.format()`` method that " "treats the string as a template and takes the arguments to be formatted. The " "formatting template uses curly brackets (``{``, ``}``) as special " "characters::" msgstr "" +"2.6 では、8 ビット文字列と Unicode 文字列の両方に ``.format()`` メソッドがあ" +"り、文字列をテンプレートとして扱い、書式化する引数を受け取ります。\n" +"テンプレートでは波括弧 (``{``、``}``) を特殊文字として使います。 ::" -#: ../../whatsnew/2.6.rst:726 msgid "" ">>> # Substitute positional argument 0 into the string.\n" ">>> \"User ID: {0}\".format(\"root\")\n" @@ -1177,16 +1377,25 @@ msgid "" "... last_login = \"5 Mar 2008 07:20\")\n" "'User ID: root Last seen: 5 Mar 2008 07:20'" msgstr "" +">>> # 位置引数 0 を文字列へ埋め込む。\n" +">>> \"User ID: {0}\".format(\"root\")\n" +"'User ID: root'\n" +">>> # 名前を指定したキーワード引数を使う\n" +">>> \"User ID: {uid} Last seen: {last_login}\".format(\n" +"... uid=\"root\",\n" +"... last_login = \"5 Mar 2008 07:20\")\n" +"'User ID: root Last seen: 5 Mar 2008 07:20'" #: ../../whatsnew/2.6.rst:735 msgid "Curly brackets can be escaped by doubling them::" msgstr "波括弧自身は二重に書くことでエスケープ出来ます::" -#: ../../whatsnew/2.6.rst:737 msgid "" ">>> \"Empty dict: {{}}\".format()\n" "\"Empty dict: {}\"" msgstr "" +">>> \"Empty dict: {{}}\".format()\n" +"\"Empty dict: {}\"" #: ../../whatsnew/2.6.rst:740 msgid "" @@ -1198,11 +1407,10 @@ msgstr "" "ワード引数に対応する名前です。属性を読み出したり辞書のキーにアクセスするよう" "な合成フィールド名(compound field names)も与えることが出来ます::" -#: ../../whatsnew/2.6.rst:744 msgid "" ">>> import sys\n" -">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." -"format(sys)\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" "Platform: darwin\n" "Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" "[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" @@ -1211,6 +1419,16 @@ msgid "" ">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" "'Content-type: video/mp4'" msgstr "" +">>> import sys\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" +"Platform: darwin\n" +"Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" +"[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" +"\n" +">>> import mimetypes\n" +">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" +"'Content-type: video/mp4'" #: ../../whatsnew/2.6.rst:754 msgid "" @@ -1234,7 +1452,6 @@ msgstr "" "ました。フォーマッティングではさらに、コロンに続けて書式指定子を追加すること" "でコントロール可能です。例えば::" -#: ../../whatsnew/2.6.rst:764 msgid "" ">>> # Field 0: left justify, pad to 15 characters\n" ">>> # Field 1: right justify, pad to 6 characters\n" @@ -1246,12 +1463,20 @@ msgid "" ">>> fmt.format('Banquet', 125)\n" "'Banquet $ 125'" msgstr "" +">>> # フィールド 0: 左揃え、15 文字幅まで埋める\n" +">>> # フィールド 1: 右揃え、6 文字幅まで埋める\n" +">>> fmt = '{0:15} ${1:>6}'\n" +">>> fmt.format('Registration', 35)\n" +"'Registration $ 35'\n" +">>> fmt.format('Tutorial', 50)\n" +"'Tutorial $ 50'\n" +">>> fmt.format('Banquet', 125)\n" +"'Banquet $ 125'" #: ../../whatsnew/2.6.rst:774 msgid "Format specifiers can reference other fields through nesting::" msgstr "書式指定子として、ネストによる他フィールド参照が使えます::" -#: ../../whatsnew/2.6.rst:776 msgid "" ">>> fmt = '{0:{1}}'\n" ">>> width = 15\n" @@ -1261,6 +1486,13 @@ msgid "" ">>> fmt.format('Invoice #1234', width)\n" "'Invoice #1234 '" msgstr "" +">>> fmt = '{0:{1}}'\n" +">>> width = 15\n" +">>> fmt.format('Invoice #1234', width)\n" +"'Invoice #1234 '\n" +">>> width = 35\n" +">>> fmt.format('Invoice #1234', width)\n" +"'Invoice #1234 '" #: ../../whatsnew/2.6.rst:784 msgid "The alignment of a field within the desired width can be specified:" @@ -1316,13 +1548,16 @@ msgstr "" "するかです。たとえば浮動小数点数は普通の数値に、あるいは指数形式でフォーマッ" "ト出来ます::" -#: ../../whatsnew/2.6.rst:799 msgid "" ">>> '{0:g}'.format(3.75)\n" "'3.75'\n" ">>> '{0:e}'.format(3.75)\n" "'3.750000e+00'" msgstr "" +">>> '{0:g}'.format(3.75)\n" +"'3.75'\n" +">>> '{0:e}'.format(3.75)\n" +"'3.750000e+00'" #: ../../whatsnew/2.6.rst:804 msgid "" @@ -1430,11 +1665,10 @@ msgid "" "Classes and types can define a :meth:`__format__` method to control how " "they're formatted. It receives a single argument, the format specifier::" msgstr "" -"クラスと型は、自身がどのように書式化されるかをコントロールするために :meth:" -"`__format__` メソッドを定義出来ます。単一の引数として書式指定子を受け取りま" -"す::" +"クラスと型は、自身がどのように書式化されるかをコントロールするため" +"に :meth:`__format__` メソッドを定義出来ます。単一の引数として書式指定子を受" +"け取ります::" -#: ../../whatsnew/2.6.rst:830 msgid "" "def __format__(self, format_spec):\n" " if isinstance(format_spec, unicode):\n" @@ -1442,6 +1676,11 @@ msgid "" " else:\n" " return str(self)" msgstr "" +"def __format__(self, format_spec):\n" +" if isinstance(format_spec, unicode):\n" +" return unicode(str(self))\n" +" else:\n" +" return str(self)" #: ../../whatsnew/2.6.rst:836 msgid "" @@ -1451,11 +1690,12 @@ msgstr "" "ビルトインの :func:`format` もあって、単一の値をフォーマット出来ます。これは" "型の :meth:`__format__` メソッドを与えられた指定子とともに呼び出します::" -#: ../../whatsnew/2.6.rst:840 msgid "" ">>> format(75.6564, '.2f')\n" "'75.66'" msgstr "" +">>> format(75.6564, '.2f')\n" +"'75.66'" #: ../../whatsnew/2.6.rst:846 msgid ":ref:`formatstrings`" @@ -1495,19 +1735,19 @@ msgstr "" "Python 2.6 では ``__future__`` インポートで 言語構文としての ``print`` を取り" "除き、関数形式のものを代わりに使えるように出来ます。たとえば::" -#: ../../whatsnew/2.6.rst:866 msgid "" ">>> from __future__ import print_function\n" ">>> print('# of entries', len(dictionary), file=sys.stderr)" msgstr "" +">>> from __future__ import print_function\n" +">>> print('# of entries', len(dictionary), file=sys.stderr)" #: ../../whatsnew/2.6.rst:869 msgid "The signature of the new function is::" msgstr "この新しい関数のシグネチャは以下の通りです::" -#: ../../whatsnew/2.6.rst:871 msgid "def print(*args, sep=' ', end='\\n', file=None)" -msgstr "" +msgstr "def print(*args, sep=' ', end='\\n', file=None)" #: ../../whatsnew/2.6.rst:874 msgid "The parameters are:" @@ -1550,21 +1790,25 @@ msgid "" msgstr "" "Python プログラマが時折やらかしてしまう誤りの一つにこんなのがあります::" -#: ../../whatsnew/2.6.rst:897 msgid "" "try:\n" " ...\n" "except TypeError, ValueError: # Wrong!\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError, ValueError: # 誤り!\n" +" ..." #: ../../whatsnew/2.6.rst:902 msgid "" -"The author is probably trying to catch both :exc:`TypeError` and :exc:" -"`ValueError` exceptions, but this code actually does something different: it " -"will catch :exc:`TypeError` and bind the resulting exception object to the " -"local name ``\"ValueError\"``. The :exc:`ValueError` exception will not be " -"caught at all. The correct code specifies a tuple of exceptions::" +"The author is probably trying to catch both :exc:`TypeError` " +"and :exc:`ValueError` exceptions, but this code actually does something " +"different: it will catch :exc:`TypeError` and bind the resulting exception " +"object to the local name ``\"ValueError\"``. The :exc:`ValueError` " +"exception will not be caught at all. The correct code specifies a tuple of " +"exceptions::" msgstr "" "このコードの作者はきっと :exc:`TypeError` 例外と :exc:`ValueError` 例外の両方" "とっつかまえてやろうと思ったのでしょうが、このコードは実際にはちょっと違った" @@ -1572,13 +1816,16 @@ msgstr "" "ローカル名の例外オブジェクトに束縛します…。 :exc:`ValueError` 例外は決して捕" "捉されません。正しくは、例外のタプルで指定します::" -#: ../../whatsnew/2.6.rst:909 msgid "" "try:\n" " ...\n" "except (TypeError, ValueError):\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except (TypeError, ValueError):\n" +" ..." #: ../../whatsnew/2.6.rst:914 msgid "" @@ -1599,13 +1846,16 @@ msgstr "" "を捕捉して例外オブジェクトを ``exc`` に記憶するには、こう書かなければなりませ" "ん::" -#: ../../whatsnew/2.6.rst:922 msgid "" "try:\n" " ...\n" "except TypeError as exc:\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError as exc:\n" +" ..." #: ../../whatsnew/2.6.rst:927 msgid "" @@ -1635,10 +1885,10 @@ msgstr "PEP 3112: バイトリテラル" #: ../../whatsnew/2.6.rst:945 msgid "" "Python 3.0 adopts Unicode as the language's fundamental string type and " -"denotes 8-bit literals differently, either as ``b'string'`` or using a :" -"class:`bytes` constructor. For future compatibility, Python 2.6 adds :class:" -"`bytes` as a synonym for the :class:`str` type, and it also supports the " -"``b''`` notation." +"denotes 8-bit literals differently, either as ``b'string'`` or using " +"a :class:`bytes` constructor. For future compatibility, Python 2.6 " +"adds :class:`bytes` as a synonym for the :class:`str` type, and it also " +"supports the ``b''`` notation." msgstr "" "Python 3.0 は Unicode を言語の基本文字列型として採用し、8 ビットリテラルは異" "なった記法で指示します。それには ``b'string'`` とするか、 :class:`bytes` のコ" @@ -1650,8 +1900,8 @@ msgid "" "The 2.6 :class:`str` differs from 3.0's :class:`bytes` type in various ways; " "most notably, the constructor is completely different. In 3.0, ``bytes([65, " "66, 67])`` is 3 elements long, containing the bytes representing ``ABC``; in " -"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing the :" -"func:`str` of the list." +"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing " +"the :func:`str` of the list." msgstr "" "2.6 の :class:`str` 型は 3.0 の :class:`bytes` 型とは色んな意味で違います; 一" "番顕著なのは、コンストラクタがまったく異なることです。3.0 での ``bytes([65, " @@ -1664,16 +1914,16 @@ msgid "" "The primary use of :class:`bytes` in 2.6 will be to write tests of object " "type such as ``isinstance(x, bytes)``. This will help the 2to3 converter, " "which can't tell whether 2.x code intends strings to contain either " -"characters or 8-bit bytes; you can now use either :class:`bytes` or :class:" -"`str` to represent your intention exactly, and the resulting code will also " -"be correct in Python 3.0." +"characters or 8-bit bytes; you can now use either :class:`bytes` " +"or :class:`str` to represent your intention exactly, and the resulting code " +"will also be correct in Python 3.0." msgstr "" "2.6 での :class:`bytes` の主な使いみちはオブジェクトの型のテストに " "``isinstance(x, bytes)`` とすることでしょう。またこれは、 2.x コードが文字列" "として ASCII 文字と 8 ビットバイトのどちらを意図しているのか知ることが出来な" -"い 2to3 コンバータの助けになります; あなたは今や :class:`bytes` と :class:" -"`str` の区別を、あなたの意図を正確に表現するのに使えます。そして結果のコード" -"は Python 3.0 で正しいものに修正されるでしょう。" +"い 2to3 コンバータの助けになります; あなたは今や :class:`bytes` " +"と :class:`str` の区別を、あなたの意図を正確に表現するのに使えます。そして結" +"果のコードは Python 3.0 で正しいものに修正されるでしょう。" #: ../../whatsnew/2.6.rst:965 msgid "" @@ -1685,7 +1935,6 @@ msgstr "" "あります。これは Unicode 文字を含むのに ``\\u`` エスケープシーケンスを使える" "ことを意味します。" -#: ../../whatsnew/2.6.rst:970 msgid "" "from __future__ import unicode_literals\n" "\n" @@ -1694,27 +1943,35 @@ msgid "" "\n" "print len(s) # 12 Unicode characters" msgstr "" +"from __future__ import unicode_literals\n" +"\n" +"s = ('\\u751f\\u3080\\u304e\\u3000\\u751f\\u3054'\n" +" '\\u3081\\u3000\\u751f\\u305f\\u307e\\u3054')\n" +"\n" +"print len(s) # 12 個の Unicode 文字" -#: ../../whatsnew/2.6.rst:977 msgid "" "At the C level, Python 3.0 will rename the existing 8-bit string type, " "called :c:type:`!PyStringObject` in Python 2.x, to :c:type:`PyBytesObject`. " -"Python 2.6 uses ``#define`` to support using the names :c:func:" -"`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:" -"`PyBytes_FromStringAndSize`, and all the other functions and macros used " -"with strings." +"Python 2.6 uses ``#define`` to support using the " +"names :c:func:`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`, " +"and all the other functions and macros used with strings." msgstr "" +"C レベルでは、Python 3.0 で 8 ビット文字列型の名前が、Python 2.x " +"の :c:type:`!PyStringObject` から :c:type:`PyBytesObject` に変わります。\n" +"Python 2.6 は ``#define`` によっ" +"て :c:func:`PyBytesObject`、:c:func:`PyBytes_Check`、:c:func:`PyBytes_FromStringAndSize` " +"など、文字列に関連するすべての関数やマクロの名前を使えるようにしています。" #: ../../whatsnew/2.6.rst:984 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 "" ">>> bytearray([65, 66, 67])\n" "bytearray(b'ABC')\n" @@ -1727,18 +1984,29 @@ msgid "" ">>> unicode(str(b), 'utf-8')\n" "u'\\u31ef \\u3244'" msgstr "" +">>> bytearray([65, 66, 67])\n" +"bytearray(b'ABC')\n" +">>> b = bytearray(u'\\u21ef\\u3244', 'utf-8')\n" +">>> b\n" +"bytearray(b'\\xe2\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> b[0] = '\\xe3'\n" +">>> b\n" +"bytearray(b'\\xe3\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> unicode(str(b), 'utf-8')\n" +"u'\\u31ef \\u3244'" #: ../../whatsnew/2.6.rst:999 msgid "" -"Byte arrays support most of the methods of string types, such as :meth:" -"`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some of the " -"methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`." +"Byte arrays support most of the methods of string types, such " +"as :meth:`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some " +"of the methods of lists, such as :meth:`append`, :meth:`pop`, " +"and :meth:`reverse`." msgstr "" -":class:`bytearray` は :meth:`startswith`/:meth:`endswith`, :meth:`find`/:" -"meth:`rfind` のような文字列型のほとんどのメソッド、 :meth:`append`, :meth:" -"`pop`, :meth:`reverse` のようなリストのいくつかのメソッドをサポートします。" +":class:`bytearray` " +"は :meth:`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind` のような文" +"字列型のほとんどのメソッド、 :meth:`append`, :meth:`pop`, :meth:`reverse` の" +"ようなリストのいくつかのメソッドをサポートします。" -#: ../../whatsnew/2.6.rst:1006 msgid "" ">>> b = bytearray('ABC')\n" ">>> b.append('d')\n" @@ -1746,14 +2014,21 @@ msgid "" ">>> b\n" "bytearray(b'ABCde')" msgstr "" +">>> b = bytearray('ABC')\n" +">>> b.append('d')\n" +">>> b.append(ord('e'))\n" +">>> b\n" +"bytearray(b'ABCde')" #: ../../whatsnew/2.6.rst:1012 msgid "" -"There's also a corresponding C API, with :c:func:`PyByteArray_FromObject`, :" -"c:func:`PyByteArray_FromStringAndSize`, and various other functions." +"There's also a corresponding C API, " +"with :c:func:`PyByteArray_FromObject`, :c:func:`PyByteArray_FromStringAndSize`, " +"and various other functions." msgstr "" -"対応する C API もあります。 :c:func:`PyByteArray_FromObject`, :c:func:" -"`PyByteArray_FromStringAndSize` や色々その他関数です。" +"対応する C API もありま" +"す。 :c:func:`PyByteArray_FromObject`, :c:func:`PyByteArray_FromStringAndSize` " +"や色々その他関数です。" #: ../../whatsnew/2.6.rst:1019 msgid ":pep:`3112` - Bytes literals in Python 3000" @@ -1771,18 +2046,18 @@ msgstr "PEP 3116: 新しい I/O ライブラリ" msgid "" "Python's built-in file objects support a number of methods, but file-like " "objects don't necessarily support all of them. Objects that imitate files " -"usually support :meth:`read` and :meth:`write`, but they may not support :" -"meth:`readline`, for example. Python 3.0 introduces a layered I/O library " -"in the :mod:`io` module that separates buffering and text-handling features " -"from the fundamental read and write operations." +"usually support :meth:`read` and :meth:`write`, but they may not " +"support :meth:`readline`, for example. Python 3.0 introduces a layered I/O " +"library in the :mod:`io` module that separates buffering and text-handling " +"features from the fundamental read and write operations." msgstr "" "Python ビルトインのファイルオブジェクトはたくさんのメソッドをサポートしていま" "すが、ファイルライクなオブジェクトは必ずしもそのすべてをサポートする必要はあ" -"りません。ファイルのまねごとをするオブジェクトは大抵 :meth:`read` と :meth:" -"`write` をサポートしますが、 :meth:`readline` はサポートしないかもしれませ" -"ん、例えば。Python 3.0 は :mod:`io` モジュールに、階層化された I/O ライブラリ" -"を導入しています。それは基礎的な読み書き操作からバッファリング機能とテキスト" -"処理を分離しています。" +"りません。ファイルのまねごとをするオブジェクトは大抵 :meth:`read` " +"と :meth:`write` をサポートしますが、 :meth:`readline` はサポートしないかもし" +"れません、例えば。Python 3.0 は :mod:`io` モジュールに、階層化された I/O ライ" +"ブラリを導入しています。それは基礎的な読み書き操作からバッファリング機能とテ" +"キスト処理を分離しています。" #: ../../whatsnew/2.6.rst:1037 msgid "" @@ -1794,18 +2069,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:1040 msgid "" -":class:`RawIOBase` defines raw I/O operations: :meth:`read`, :meth:" -"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " +":class:`RawIOBase` defines raw I/O " +"operations: :meth:`read`, :meth:`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " "and :meth:`close`. Most of the methods of this class will often map to a " -"single system call. There are also :meth:`readable`, :meth:`writable`, and :" -"meth:`seekable` methods for determining what operations a given object will " -"allow." +"single system call. There are also :meth:`readable`, :meth:`writable`, " +"and :meth:`seekable` methods for determining what operations a given object " +"will allow." msgstr "" -":class:`RawIOBase` は剥き身の I/O 操作を定義します: :meth:`read`, :meth:" -"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, :" -"meth:`close` 。このクラスのほとんどのメソッドが多くの場合単一のシステムコール" -"に対応するでしょう。 :meth:`readable`, :meth:`writable`, :meth:`seekable` メ" -"ソッドも利用可能で、オブジェクトでどの操作が許されるのかを知るのに使えます。" +":class:`RawIOBase` は剥き身の I/O 操作を定義しま" +"す: :meth:`read`, :meth:`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, :meth:`close` 。" +"このクラスのほとんどのメソッドが多くの場合単一のシステムコールに対応するで" +"しょう。 :meth:`readable`, :meth:`writable`, :meth:`seekable` メソッドも利用" +"可能で、オブジェクトでどの操作が許されるのかを知るのに使えます。" #: ../../whatsnew/2.6.rst:1048 msgid "" @@ -1820,40 +2095,40 @@ msgstr "" msgid "" ":class:`BufferedIOBase` is an abstract base class that buffers data in " "memory to reduce the number of system calls used, making I/O processing more " -"efficient. It supports all of the methods of :class:`RawIOBase`, and adds a :" -"attr:`raw` attribute holding the underlying raw object." +"efficient. It supports all of the methods of :class:`RawIOBase`, and adds " +"a :attr:`raw` attribute holding the underlying raw object." msgstr "" ":class:`BufferedIOBase` はデータをメモリにバッファすることでシステムコール使" -"用回数を減らし、I/O 処理をより効率的に行うための抽象基底クラスです。 :class:" -"`RawIOBase` の全てのメソッドをサポートし、追加で基底の剥き身のオブジェクトを" -"保持する :attr:`raw` 属性を持ちます。" +"用回数を減らし、I/O 処理をより効率的に行うための抽象基底クラスで" +"す。 :class:`RawIOBase` の全てのメソッドをサポートし、追加で基底の剥き身のオ" +"ブジェクトを保持する :attr:`raw` 属性を持ちます。" #: ../../whatsnew/2.6.rst:1058 msgid "" -"There are five concrete classes implementing this ABC. :class:" -"`BufferedWriter` and :class:`BufferedReader` are for objects that support " -"write-only or read-only usage that have a :meth:`seek` method for random " -"access. :class:`BufferedRandom` objects support read and write access upon " -"the same underlying stream, and :class:`BufferedRWPair` is for objects such " -"as TTYs that have both read and write operations acting upon unconnected " -"streams of data. The :class:`BytesIO` class supports reading, writing, and " -"seeking over an in-memory buffer." -msgstr "" -"5 つの具象クラスがこの ABC を実装しています。 :class:`BufferedWriter` と :" -"class:`BufferedReader` はランダムアクセスのための :meth:`seek` を持ち、書き込" -"み専用または読み出し専用の用途をサポートするオブジェクトのためのものです。 :" -"class:`BufferedRandom` オブジェクトはこれらと同じ前提のストリームでの読み書き" -"アクセスをサポートし、 :class:`BufferedRWPair` は、TTY のような、連続していな" -"いデータのストリームの上で読み書き操作両方を演じるオブジェクトのためのもので" -"す。 :class:`BytesIO` クラスはインメモリのバッファ上での読み、書き、シークを" -"サポートします。" +"There are five concrete classes implementing this " +"ABC. :class:`BufferedWriter` and :class:`BufferedReader` are for objects " +"that support write-only or read-only usage that have a :meth:`seek` method " +"for random access. :class:`BufferedRandom` objects support read and write " +"access upon the same underlying stream, and :class:`BufferedRWPair` is for " +"objects such as TTYs that have both read and write operations acting upon " +"unconnected streams of data. The :class:`BytesIO` class supports reading, " +"writing, and seeking over an in-memory buffer." +msgstr "" +"5 つの具象クラスがこの ABC を実装しています。 :class:`BufferedWriter` " +"と :class:`BufferedReader` はランダムアクセスのための :meth:`seek` を持ち、書" +"き込み専用または読み出し専用の用途をサポートするオブジェクトのためのもので" +"す。 :class:`BufferedRandom` オブジェクトはこれらと同じ前提のストリームでの読" +"み書きアクセスをサポートし、 :class:`BufferedRWPair` は、TTY のような、連続し" +"ていないデータのストリームの上で読み書き操作両方を演じるオブジェクトのための" +"ものです。 :class:`BytesIO` クラスはインメモリのバッファ上での読み、書き、" +"シークをサポートします。" #: ../../whatsnew/2.6.rst:1071 msgid "" ":class:`TextIOBase`: Provides functions for reading and writing strings " -"(remember, strings will be Unicode in Python 3.0), and supporting :term:" -"`universal newlines`. :class:`TextIOBase` defines the :meth:`readline` " -"method and supports iteration upon objects." +"(remember, strings will be Unicode in Python 3.0), and " +"supporting :term:`universal newlines`. :class:`TextIOBase` defines " +"the :meth:`readline` method and supports iteration upon objects." msgstr "" ":class:`TextIOBase`: 文字列 (忘れないで、Python 3.0 では文字列は Unicode にな" "ります) の読み書き関数を提供し、 :term:`universal newlines` をサポートしま" @@ -1864,17 +2139,16 @@ msgstr "" msgid "" "There are two concrete implementations. :class:`TextIOWrapper` wraps a " "buffered I/O object, supporting all of the methods for text I/O and adding " -"a :attr:`buffer` attribute for access to the underlying object. :class:" -"`StringIO` simply buffers everything in memory without ever writing anything " -"to disk." +"a :attr:`buffer` attribute for access to the underlying " +"object. :class:`StringIO` simply buffers everything in memory without ever " +"writing anything to disk." msgstr "" "2 つの具象実装があります。 :class:`TextIOWrapper` はバッファ化 I/O オブジェク" "トをラップし、テキスト I/O の全てのメソッドをサポートし、追加で元となるオブ" -"ジェクトへのアクセスのための :attr:`buffer` 属性を持ちます。 :class:" -"`StringIO` はディスクへの一切の書き込みをせずに単純にメモリ内に全てをバッファ" -"します。" +"ジェクトへのアクセスのための :attr:`buffer` 属性を持ちま" +"す。 :class:`StringIO` はディスクへの一切の書き込みをせずに単純にメモリ内に全" +"てをバッファします。" -#: ../../whatsnew/2.6.rst:1083 msgid "" "(In Python 2.6, :class:`io.StringIO` is implemented in pure Python, so it's " "pretty slow. You should therefore stick with the existing :mod:`!StringIO` " @@ -1882,6 +2156,12 @@ msgid "" "module will be rewritten into C for speed, and perhaps the C implementation " "will be backported to the 2.x releases.)" msgstr "" +"(Python 2.6 の :class:`io.StringIO` は Python だけで実装されているため、かな" +"り低速です。\n" +"当面は既存の :mod:`!StringIO` や :mod:`!cStringIO` モジュールを使い続けるとよ" +"いでしょう。\n" +"いずれ Python 3.0 の :mod:`io` は高速化のために C で書き直され、その実装が " +"2.x にも移植されるかもしれません。)" #: ../../whatsnew/2.6.rst:1089 msgid "" @@ -1968,21 +2248,24 @@ msgstr "" ":c:func:`PyObject_GetBuffer` への *flags* 引数は返されるメモリについての制約" "条件を指定します。いくつかの例として:" -#: ../../whatsnew/2.6.rst:1135 msgid ":c:macro:`PyBUF_WRITABLE` indicates that the memory must be writable." msgstr "" +":c:macro:`PyBUF_WRITABLE` は、メモリが書き込み可能である必要があることを示し" +"ます。" #: ../../whatsnew/2.6.rst:1137 msgid "" ":c:macro:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory." msgstr "" -#: ../../whatsnew/2.6.rst:1139 msgid "" ":c:macro:`PyBUF_C_CONTIGUOUS` and :c:macro:`PyBUF_F_CONTIGUOUS` requests a C-" "contiguous (last dimension varies the fastest) or Fortran-contiguous (first " "dimension varies the fastest) array layout." msgstr "" +":c:macro:`PyBUF_C_CONTIGUOUS` と :c:macro:`PyBUF_F_CONTIGUOUS` は、それぞれ " +"C 連続 (最後の次元が最も速く変化) と Fortran 連続 (最初の次元が最も速く変化) " +"の配列配置を要求します。" #: ../../whatsnew/2.6.rst:1143 msgid "" @@ -2021,10 +2304,11 @@ msgstr "" "合やサポートするアクセスプロトコルを宣言するための「インターフェイス」をサ" "ポートしています。抽象基底クラス (ABCs=Abstract Base Classes)は Python でのこ" "れと等価な機能です。ABC サポートは、 :class:`ABCMeta` と呼ばれるメタクラスを" -"含む :mod:`abc` モジュール、ビルトイン :func:`isinstance` と :func:" -"`issubclass` のそのメタクラスについての特殊処理、それに Python 開発者が広範囲" -"にわたって使えると考えた基礎的な ABCs のコレクションから成ります。たぶん将来" -"のバージョンの Python ではもっとたくさんの ABCs が追加されると思います。" +"含む :mod:`abc` モジュール、ビルトイン :func:`isinstance` " +"と :func:`issubclass` のそのメタクラスについての特殊処理、それに Python 開発" +"者が広範囲にわたって使えると考えた基礎的な ABCs のコレクションから成ります。" +"たぶん将来のバージョンの Python ではもっとたくさんの ABCs が追加されると思い" +"ます。" #: ../../whatsnew/2.6.rst:1170 msgid "" @@ -2033,26 +2317,26 @@ msgid "" "It probably means that accessing items with ``obj[1]`` works. Does it imply " "that setting items with ``obj[2] = value`` works? Or that the object will " "have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about " -"the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:" -"`update`? Iterating over the object with :func:`iter`?" +"the iterative variants such as :meth:`iterkeys`? :meth:`copy` " +"and :meth:`update`? Iterating over the object with :func:`iter`?" msgstr "" "あなたがなにか特別なクラスを持っていて、辞書スタイルのアクセスをサポートする" "のか知りたいとしましょう。「辞書スタイル」ってなんでしょうね、それにしても。" "たぶんアイテムにアクセスするのに ``obj[1]`` が使えるでしょう。それは " -"``obj[2] = value`` のように値をセットするのも含まれるでしょうね? あるいは :" -"meth:`keys`, :meth:`values`, :meth:`items` メソッドを持ちますかね? :meth:" -"`iterkeys` みたいな列挙系はいかがでしょう? :meth:`copy` と :meth:`update` " -"は? オブジェクトを巡回するのに :func:`iter` で出来ます?" +"``obj[2] = value`` のように値をセットするのも含まれるでしょうね? あるい" +"は :meth:`keys`, :meth:`values`, :meth:`items` メソッドを持ちますか" +"ね? :meth:`iterkeys` みたいな列挙系はいかがでしょう? :meth:`copy` " +"と :meth:`update` は? オブジェクトを巡回するのに :func:`iter` で出来ます?" #: ../../whatsnew/2.6.rst:1178 msgid "" "The Python 2.6 :mod:`collections` module includes a number of different ABCs " "that represent these distinctions. :class:`Iterable` indicates that a class " -"defines :meth:`__iter__`, and :class:`Container` means the class defines a :" -"meth:`__contains__` method and therefore supports ``x in y`` expressions. " -"The basic dictionary interface of getting items, setting items, and :meth:" -"`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:" -"`MutableMapping` ABC." +"defines :meth:`__iter__`, and :class:`Container` means the class defines " +"a :meth:`__contains__` method and therefore supports ``x in y`` " +"expressions. The basic dictionary interface of getting items, setting " +"items, and :meth:`keys`, :meth:`values`, and :meth:`items`, is defined by " +"the :class:`MutableMapping` ABC." msgstr "" "Python 2.6 の :mod:`collections` モジュールには、この手の区別を表現出来るたく" "さんの ABCs が含まれています。 :class:`Iterable` は :meth:`__iter__` を定義し" @@ -2070,13 +2354,16 @@ msgstr "" "あなた自身のクラスを特定の ABC から派生して、ABC のインターフェイスをサポート" "することを示せます::" -#: ../../whatsnew/2.6.rst:1190 msgid "" "import collections\n" "\n" "class Storage(collections.MutableMapping):\n" " ..." msgstr "" +"import collections\n" +"\n" +"class Storage(collections.MutableMapping):\n" +" ..." #: ../../whatsnew/2.6.rst:1196 msgid "" @@ -2084,10 +2371,9 @@ msgid "" "ABC and instead register the class by calling the ABC's :meth:`register` " "method::" msgstr "" -"別の方法としては、望みの ABC から派生するのではなく、その ABC の :meth:" -"`register` メソッドを呼び出して登録することでも出来ます::" +"別の方法としては、望みの ABC から派生するのではなく、その ABC " +"の :meth:`register` メソッドを呼び出して登録することでも出来ます::" -#: ../../whatsnew/2.6.rst:1200 msgid "" "import collections\n" "\n" @@ -2096,14 +2382,20 @@ msgid "" "\n" "collections.MutableMapping.register(Storage)" msgstr "" +"import collections\n" +"\n" +"class Storage:\n" +" ...\n" +"\n" +"collections.MutableMapping.register(Storage)" #: ../../whatsnew/2.6.rst:1207 msgid "" -"For classes that you write, deriving from the ABC is probably clearer. The :" -"meth:`register` method is useful when you've written a new ABC that can " -"describe an existing type or class, or if you want to declare that some " -"third-party class implements an ABC. For example, if you defined a :class:" -"`PrintableType` ABC, it's legal to do::" +"For classes that you write, deriving from the ABC is probably clearer. " +"The :meth:`register` method is useful when you've written a new ABC that " +"can describe an existing type or class, or if you want to declare that some " +"third-party class implements an ABC. For example, if you defined " +"a :class:`PrintableType` ABC, it's legal to do::" msgstr "" "あなたが書くクラスでは ABC から派生するのが、たぶん綺麗で良いと思います。既存" "の型やクラスを記述出来る新しい ABC が書けた場合や、なにかサードパーティのクラ" @@ -2111,13 +2403,16 @@ msgstr "" "す。例えば、 :class:`PrintableType` ABC を定義したのなら、今がそのとき、で" "す::" -#: ../../whatsnew/2.6.rst:1214 msgid "" "# Register Python's types\n" "PrintableType.register(int)\n" "PrintableType.register(float)\n" "PrintableType.register(str)" msgstr "" +"# Python の型を登録\n" +"PrintableType.register(int)\n" +"PrintableType.register(float)\n" +"PrintableType.register(str)" #: ../../whatsnew/2.6.rst:1219 msgid "" @@ -2137,12 +2432,14 @@ msgstr "" "オブジェクトが特定のインターフェイスをサポートするかどうかをチェックするのに" "は、今やこう書けます::" -#: ../../whatsnew/2.6.rst:1226 msgid "" "def func(d):\n" " if not isinstance(d, collections.MutableMapping):\n" " raise ValueError(\"Mapping object expected, not %r\" % d)" msgstr "" +"def func(d):\n" +" if not isinstance(d, collections.MutableMapping):\n" +" raise ValueError(\"Mapping object expected, not %r\" % d)" #: ../../whatsnew/2.6.rst:1230 msgid "" @@ -2168,7 +2465,6 @@ msgstr "" "あなた自身の ABCs を書くには、クラス定義内のメタクラスとして ``abc.ABCMeta`` " "を使います::" -#: ../../whatsnew/2.6.rst:1240 msgid "" "from abc import ABCMeta, abstractmethod\n" "\n" @@ -2187,37 +2483,53 @@ msgid "" " def draw(self, x, y, scale):\n" " ..." msgstr "" +"from abc import ABCMeta, abstractmethod\n" +"\n" +"class Drawable():\n" +" __metaclass__ = ABCMeta\n" +"\n" +" @abstractmethod\n" +" def draw(self, x, y, scale=1.0):\n" +" pass\n" +"\n" +" def draw_doubled(self, x, y):\n" +" self.draw(x, y, scale=2.0)\n" +"\n" +"\n" +"class Square(Drawable):\n" +" def draw(self, x, y, scale):\n" +" ..." #: ../../whatsnew/2.6.rst:1258 msgid "" "In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders " "the object at twice its size and can be implemented in terms of other " "methods described in :class:`Drawable`. Classes implementing this ABC " -"therefore don't need to provide their own implementation of :meth:" -"`draw_doubled`, though they can do so. An implementation of :meth:`draw` is " -"necessary, though; the ABC can't provide a useful generic implementation." +"therefore don't need to provide their own implementation " +"of :meth:`draw_doubled`, though they can do so. An implementation " +"of :meth:`draw` is necessary, though; the ABC can't provide a useful generic " +"implementation." msgstr "" "上の :class:`Drawable` ABC では、 :meth:`draw_doubled` メソッドがオブジェクト" "をその 2 倍のサイズで描画しますが、 :class:`Drawable` で示されたほかのメソッ" -"ドのやり方で実現されるのでしょう。この ABC を実装するクラスは :meth:" -"`draw_doubled` のそれ自身の実装を提供する必要はないわけですが、実装しても良い" -"です。一方 :meth:`draw` の実装は必要です。その ABC が役に立つ汎用的な実装が提" -"供出来ていないので。" +"ドのやり方で実現されるのでしょう。この ABC を実装するクラス" +"は :meth:`draw_doubled` のそれ自身の実装を提供する必要はないわけですが、実装" +"しても良いです。一方 :meth:`draw` の実装は必要です。その ABC が役に立つ汎用的" +"な実装が提供出来ていないので。" #: ../../whatsnew/2.6.rst:1266 msgid "" -"You can apply the ``@abstractmethod`` decorator to methods such as :meth:" -"`draw` that must be implemented; Python will then raise an exception for " -"classes that don't define the method. Note that the exception is only raised " -"when you actually try to create an instance of a subclass lacking the " -"method::" +"You can apply the ``@abstractmethod`` decorator to methods such " +"as :meth:`draw` that must be implemented; Python will then raise an " +"exception for classes that don't define the method. Note that the exception " +"is only raised when you actually try to create an instance of a subclass " +"lacking the method::" msgstr "" ":meth:`draw` のような、実装が必須のメソッドに対して ``@abstractmethod`` デコ" "レータを適用することが出来ます; Python はそのメソッドを実装しないクラスに例外" "を喰らわせます。サブクラスにそのメソッドが欠けていたとしても、インスタンスを" "実際に作ろうと試みてはじめて例外となることに注意しましょう::" -#: ../../whatsnew/2.6.rst:1272 msgid "" ">>> class Circle(Drawable):\n" "... pass\n" @@ -2229,6 +2541,15 @@ msgid "" "draw\n" ">>>" msgstr "" +">>> class Circle(Drawable):\n" +"... pass\n" +"...\n" +">>> c = Circle()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: Can't instantiate abstract class Circle with abstract methods " +"draw\n" +">>>" #: ../../whatsnew/2.6.rst:1281 msgid "" @@ -2236,7 +2557,6 @@ msgid "" "decorator::" msgstr "抽象データ属性を ``@abstractproperty`` を使って宣言出来ます::" -#: ../../whatsnew/2.6.rst:1284 msgid "" "from abc import abstractproperty\n" "...\n" @@ -2245,6 +2565,12 @@ msgid "" "def readonly(self):\n" " return self._x" msgstr "" +"from abc import abstractproperty\n" +"...\n" +"\n" +"@abstractproperty\n" +"def readonly(self):\n" +" return self._x" #: ../../whatsnew/2.6.rst:1291 msgid "Subclasses must then define a :meth:`readonly` property." @@ -2287,13 +2613,16 @@ msgstr "" "Python 2.6 は先行するゼロの形式での 8 進数サポートをやめませんが、 \"0o\" と " "\"0b\" は追加サポートします::" -#: ../../whatsnew/2.6.rst:1315 msgid "" ">>> 0o21, 2*8 + 1\n" "(17, 17)\n" ">>> 0b101111\n" "47" msgstr "" +">>> 0o21, 2*8 + 1\n" +"(17, 17)\n" +">>> 0b101111\n" +"47" #: ../../whatsnew/2.6.rst:1320 msgid "" @@ -2304,7 +2633,6 @@ msgstr "" "ビルトイン関数 :func:`oct` はまだ先行ゼロ形式での表現を返します。新しいビルト" "イン関数 :func:`bin` は数値の 2 進数表現を返します::" -#: ../../whatsnew/2.6.rst:1324 msgid "" ">>> oct(42)\n" "'052'\n" @@ -2313,6 +2641,12 @@ msgid "" ">>> bin(173)\n" "'0b10101101'" msgstr "" +">>> oct(42)\n" +"'052'\n" +">>> future_builtins.oct(42)\n" +"'0o52'\n" +">>> bin(173)\n" +"'0b10101101'" #: ../../whatsnew/2.6.rst:1331 msgid "" @@ -2326,7 +2660,6 @@ msgstr "" "ぞれ許容するようになりました(基数 *base* = 0 は文字列から基数を決めるべきであ" "ることを指示します)::" -#: ../../whatsnew/2.6.rst:1336 msgid "" ">>> int ('0o52', 0)\n" "42\n" @@ -2336,7 +2669,15 @@ msgid "" "13\n" ">>> int('0b1101', 0)\n" "13" -msgstr "" +msgstr "" +">>> int ('0o52', 0)\n" +"42\n" +">>> int('1101', 2)\n" +"13\n" +">>> int('0b1101', 2)\n" +"13\n" +">>> int('0b1101', 0)\n" +"13" #: ../../whatsnew/2.6.rst:1348 msgid ":pep:`3127` - Integer Literal Support and Syntax" @@ -2358,25 +2699,31 @@ msgstr "" "デコレータが拡張されて関数だけでなクラスにも使えるようになりました。今やこの" "ように書くのは合法です::" -#: ../../whatsnew/2.6.rst:1362 msgid "" "@foo\n" "@bar\n" "class A:\n" " pass" msgstr "" +"@foo\n" +"@bar\n" +"class A:\n" +" pass" #: ../../whatsnew/2.6.rst:1367 msgid "This is equivalent to::" msgstr "これは次と等価です::" -#: ../../whatsnew/2.6.rst:1369 msgid "" "class A:\n" " pass\n" "\n" "A = foo(bar(A))" msgstr "" +"class A:\n" +" pass\n" +"\n" +"A = foo(bar(A))" #: ../../whatsnew/2.6.rst:1376 msgid ":pep:`3129` - Class Decorators" @@ -2393,8 +2740,8 @@ msgstr "PEP 3141: 数値の型階層" #: ../../whatsnew/2.6.rst:1386 msgid "" "Python 3.0 adds several abstract base classes for numeric types inspired by " -"Scheme's numeric tower. These classes were backported to 2.6 as the :mod:" -"`numbers` module." +"Scheme's numeric tower. These classes were backported to 2.6 as " +"the :mod:`numbers` module." msgstr "" "Python 3.0 では Scheme の numeric tower に触発された、いくつかの数値型のため" "の抽象基底クラスを追加しています。これらのクラスは :mod:`numbers` モジュール " @@ -2437,15 +2784,16 @@ msgstr "" msgid "" ":class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` " "and :attr:`denominator` properties, and can be converted to floats. Python " -"2.6 adds a simple rational-number class, :class:`Fraction`, in the :mod:" -"`fractions` module. (It's called :class:`Fraction` instead of :class:" -"`Rational` to avoid a name clash with :class:`numbers.Rational`.)" +"2.6 adds a simple rational-number class, :class:`Fraction`, in " +"the :mod:`fractions` module. (It's called :class:`Fraction` instead " +"of :class:`Rational` to avoid a name clash with :class:`numbers.Rational`.)" msgstr "" -":class:`Rational` 数は :class:`Real` からの派生で、プロパティ :attr:" -"`numerator`, :attr:`denominator` を持ち、浮動小数点数への変換が出来ます。" -"Python 2.6 は単純な有理数クラス :class:`Fraction` を :mod:`fractions` モ" -"ジュールに追加しています。(:class:`Rational` ではなく :class:`Fraction` なの" -"は、 :class:`numbers.Rational` と名前が衝突するのを避けるためです。)" +":class:`Rational` 数は :class:`Real` からの派生で、プロパ" +"ティ :attr:`numerator`, :attr:`denominator` を持ち、浮動小数点数への変換が出" +"来ます。Python 2.6 は単純な有理数クラス :class:`Fraction` " +"を :mod:`fractions` モジュールに追加しています。(:class:`Rational` ではな" +"く :class:`Fraction` なのは、 :class:`numbers.Rational` と名前が衝突するのを" +"避けるためです。)" #: ../../whatsnew/2.6.rst:1412 msgid "" @@ -2460,17 +2808,17 @@ msgstr "" #: ../../whatsnew/2.6.rst:1417 msgid "" -"In Python 3.0, the PEP slightly redefines the existing builtins :func:" -"`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new one, :func:" -"`math.trunc`, that's been backported to Python 2.6. :func:`math.trunc` " -"rounds toward zero, returning the closest :class:`Integral` that's between " -"the function's argument and zero." +"In Python 3.0, the PEP slightly redefines the existing " +"builtins :func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a " +"new one, :func:`math.trunc`, that's been backported to Python " +"2.6. :func:`math.trunc` rounds toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero." msgstr "" -"Python 3.0 では、その PEP は少し既存のビルトイン :func:`round`, :func:`math." -"floor`, :func:`math.ceil` を再定義していて、また、Python 2.6 にバックポートさ" -"れている新しい :func:`math.trunc` を追加しています。 :func:`math.trunc` はゼ" -"ロに向かう方向の丸めで、引数とゼロの間で一番近い :class:`Integral` を返しま" -"す。" +"Python 3.0 では、その PEP は少し既存のビルトイ" +"ン :func:`round`, :func:`math.floor`, :func:`math.ceil` を再定義していて、ま" +"た、Python 2.6 にバックポートされている新しい :func:`math.trunc` を追加してい" +"ます。 :func:`math.trunc` はゼロに向かう方向の丸めで、引数とゼロの間で一番近" +"い :class:`Integral` を返します。" #: ../../whatsnew/2.6.rst:1425 msgid ":pep:`3141` - A Type Hierarchy for Numbers" @@ -2488,12 +2836,13 @@ msgstr "" "Guile マニュアルの `Scheme's numerical tower `__ 。" -#: ../../whatsnew/2.6.rst:1430 msgid "" "`Scheme's number datatypes `__ from the R5RS " "Scheme specification." msgstr "" +"R5RS Scheme 仕様の `Scheme の数値データ型 `__。" #: ../../whatsnew/2.6.rst:1434 msgid "The :mod:`fractions` Module" @@ -2519,7 +2868,6 @@ msgstr "" ":class:`Fraction` のコンストラクタは 2 つの :class:`Integral` 値を取り、それ" "らはそれぞれ結果の分数の分子と分母になります。::" -#: ../../whatsnew/2.6.rst:1445 msgid "" ">>> from fractions import Fraction\n" ">>> a = Fraction(2, 3)\n" @@ -2531,6 +2879,15 @@ msgid "" ">>> a/b\n" "Fraction(5, 3)" msgstr "" +">>> from fractions import Fraction\n" +">>> a = Fraction(2, 3)\n" +">>> b = Fraction(2, 5)\n" +">>> float(a), float(b)\n" +"(0.66666666666666663, 0.40000000000000002)\n" +">>> a+b\n" +"Fraction(16, 15)\n" +">>> a/b\n" +"Fraction(5, 3)" #: ../../whatsnew/2.6.rst:1455 msgid "" @@ -2539,7 +2896,6 @@ msgid "" "denominator for a fraction that evaluates to the same floating-point value::" msgstr "" -#: ../../whatsnew/2.6.rst:1460 msgid "" ">>> (2.5) .as_integer_ratio()\n" "(5, 2)\n" @@ -2548,6 +2904,12 @@ msgid "" ">>> (1./3) .as_integer_ratio()\n" "(6004799503160661L, 18014398509481984L)" msgstr "" +">>> (2.5) .as_integer_ratio()\n" +"(5, 2)\n" +">>> (3.1415) .as_integer_ratio()\n" +"(7074029114692207L, 2251799813685248L)\n" +">>> (1./3) .as_integer_ratio()\n" +"(6004799503160661L, 18014398509481984L)" #: ../../whatsnew/2.6.rst:1467 msgid "" @@ -2588,18 +2950,18 @@ msgstr "" ":file:`__main__.py` を含んだディレクトリ名と zip アーカイブ名をインタプリタに" "渡して直接実行出来るようになりました。そのディレクトリと zip アーカイブは自動" "的に sys.path エントリの先頭に追加されます。(Suggestion and initial patch by " -"Andy Chu, subsequently revised by Phillip J. Eby and Nick Coghlan; :issue:" -"`1739468`.)" +"Andy Chu, subsequently revised by Phillip J. Eby and Nick " +"Coghlan; :issue:`1739468`.)" #: ../../whatsnew/2.6.rst:1490 msgid "" "The :func:`hasattr` function was catching and ignoring all errors, under the " "assumption that they meant a :meth:`__getattr__` method was failing somehow " "and the return value of :func:`hasattr` would therefore be ``False``. This " -"logic shouldn't be applied to :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit`, however; Python 2.6 will no longer discard such exceptions " -"when :func:`hasattr` encounters them. (Fixed by Benjamin Peterson; :issue:" -"`2196`.)" +"logic shouldn't be applied to :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit`, however; Python 2.6 will no longer discard such " +"exceptions when :func:`hasattr` encounters them. (Fixed by Benjamin " +"Peterson; :issue:`2196`.)" msgstr "" ":func:`hasattr` 関数は :meth:`__getattr__` メソッドが例外を起こすと何か失敗し" "たのだと仮定して、全て捕捉して無視して ``False`` を返していました。ですがその" @@ -2617,7 +2979,6 @@ msgstr "" "書を使う必要はありません; 任意のマッピングプロトコルをサポートするオブジェク" "トで今では動作します::" -#: ../../whatsnew/2.6.rst:1502 msgid "" ">>> def f(**kw):\n" "... print sorted(kw)\n" @@ -2628,6 +2989,14 @@ msgid "" ">>> f(**ud)\n" "['a', 'b']" msgstr "" +">>> def f(**kw):\n" +"... print sorted(kw)\n" +"...\n" +">>> ud=UserDict.UserDict()\n" +">>> ud['a'] = 1\n" +">>> ud['b'] = 'string'\n" +">>> f(**ud)\n" +"['a', 'b']" #: ../../whatsnew/2.6.rst:1511 msgid "(Contributed by Alexander Belopolsky; :issue:`1686487`.)" @@ -2641,7 +3010,6 @@ msgstr "" "同時に、 ``*args`` 引数のあとでキーワード引数を与える関数呼び出しも今では合法" "です。::" -#: ../../whatsnew/2.6.rst:1516 msgid "" ">>> def f(*args, **kw):\n" "... print args, kw\n" @@ -2649,6 +3017,11 @@ msgid "" ">>> f(1,2,3, *(4,5,6), keyword=13)\n" "(1, 2, 3, 4, 5, 6) {'keyword': 13}" msgstr "" +">>> def f(*args, **kw):\n" +"... print args, kw\n" +"...\n" +">>> f(1,2,3, *(4,5,6), keyword=13)\n" +"(1, 2, 3, 4, 5, 6) {'keyword': 13}" #: ../../whatsnew/2.6.rst:1522 msgid "" @@ -2662,8 +3035,9 @@ msgstr "" msgid "" "A new builtin, ``next(iterator, [default])`` returns the next item from the " "specified iterator. If the *default* argument is supplied, it will be " -"returned if *iterator* has been exhausted; otherwise, the :exc:" -"`StopIteration` exception will be raised. (Backported in :issue:`2719`.)" +"returned if *iterator* has been exhausted; otherwise, " +"the :exc:`StopIteration` exception will be raised. (Backported " +"in :issue:`2719`.)" msgstr "" "新しいビルトイン ``next(iterator, [default])`` は指定したイテレータより次のア" "イテムを返します。 *iterator* が使い果たされている場合、 *default* 引数が与え" @@ -2678,7 +3052,6 @@ msgstr "" "タプルがリストと同じく :meth:`index` と :meth:`count` メソッドを持つように" "なっています::" -#: ../../whatsnew/2.6.rst:1534 msgid "" ">>> t = (0,1,2,3,4,0,1,2)\n" ">>> t.index(3)\n" @@ -2686,6 +3059,11 @@ msgid "" ">>> t.count(0)\n" "2" msgstr "" +">>> t = (0,1,2,3,4,0,1,2)\n" +">>> t.index(3)\n" +"3\n" +">>> t.count(0)\n" +"2" #: ../../whatsnew/2.6.rst:1540 msgid "(Contributed by Raymond Hettinger)" @@ -2704,17 +3082,16 @@ msgstr "" #: ../../whatsnew/2.6.rst:1549 msgid "" -"Properties now have three attributes, :attr:`getter`, :attr:`setter` and :" -"attr:`deleter`, that are decorators providing useful shortcuts for adding a " -"getter, setter or deleter function to an existing property. You would use " -"them like this::" +"Properties now have three attributes, :attr:`getter`, :attr:`setter` " +"and :attr:`deleter`, that are decorators providing useful shortcuts for " +"adding a getter, setter or deleter function to an existing property. You " +"would use them like this::" msgstr "" "property に :attr:`getter`, :attr:`setter`, :attr:`deleter` が追加されていま" "す。取得関数(getter)、設定関数(setter)、削除関数(deleter)を既存のプロパティに" "追加するための便利なショートカットとして使えるデコレータです。これらはこのよ" "うに使えます::" -#: ../../whatsnew/2.6.rst:1554 msgid "" "class C(object):\n" " @property\n" @@ -2738,18 +3115,39 @@ msgid "" " def x(self, value):\n" " self._x = value / 2" msgstr "" +"class C(object):\n" +" @property\n" +" def x(self):\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x\n" +"\n" +"class D(C):\n" +" @C.x.getter\n" +" def x(self):\n" +" return self._x * 2\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value / 2" #: ../../whatsnew/2.6.rst:1576 msgid "" -"Several methods of the built-in set types now accept multiple iterables: :" -"meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:" -"`update`, :meth:`difference` and :meth:`difference_update`." +"Several methods of the built-in set types now accept multiple " +"iterables: :meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:`update`, :meth:`difference` " +"and :meth:`difference_update`." msgstr "" "ビルトインの set 型のいくつかのメソッドが複数イテラブルを受け付けるようになっ" -"ています: :meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :" -"meth:`update`, :meth:`difference`, :meth:`difference_update` です。" +"ていま" +"す: :meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:`update`, :meth:`difference`, :meth:`difference_update` " +"です。" -#: ../../whatsnew/2.6.rst:1584 msgid "" ">>> s=set('1234567890')\n" ">>> s.intersection('abc123', 'cdf246') # Intersection between all inputs\n" @@ -2757,6 +3155,11 @@ msgid "" ">>> s.difference('246', '789')\n" "set(['1', '0', '3', '5'])" msgstr "" +">>> s=set('1234567890')\n" +">>> s.intersection('abc123', 'cdf246') # すべての入力の共通部分\n" +"set(['2'])\n" +">>> s.difference('246', '789')\n" +"set(['1', '0', '3', '5'])" #: ../../whatsnew/2.6.rst:1590 ../../whatsnew/2.6.rst:1875 #: ../../whatsnew/2.6.rst:1896 @@ -2768,20 +3171,20 @@ msgid "" "Many floating-point features were added. The :func:`float` function will " "now turn the string ``nan`` into an IEEE 754 Not A Number value, and " "``+inf`` and ``-inf`` into positive or negative infinity. This works on any " -"platform with IEEE 754 semantics. (Contributed by Christian Heimes; :issue:" -"`1635`.)" +"platform with IEEE 754 semantics. (Contributed by Christian " +"Heimes; :issue:`1635`.)" msgstr "" "たくさんの浮動小数点数機能が追加されました。 :func:`float` 関数は文字列 " "``nan`` を IEEE 754 非数 (Not A Number) 値に変換し、 ``+inf`` と ``-inf`` は" "正あるいは負の無限大に変換します。これは IEEE 754 セマンティクスのあらゆるプ" -"ラットフォームで動作します。 (Contributed by Christian Heimes; :issue:" -"`1635`.)" +"ラットフォームで動作します。 (Contributed by Christian " +"Heimes; :issue:`1635`.)" #: ../../whatsnew/2.6.rst:1598 msgid "" "Other functions in the :mod:`math` module, :func:`isinf` and :func:`isnan`, " -"return true if their floating-point argument is infinite or Not A Number. (:" -"issue:`1640`)" +"return true if their floating-point argument is infinite or Not A Number. " +"(:issue:`1640`)" msgstr "" "ほか :mod:`math` モジュールに :func:`isinf` と :func:`isnan` が追加されていま" "す; 浮動小数点数が、前者は無限大ならば、後者は非数ならばそれぞれ真を返しま" @@ -2796,13 +3199,12 @@ msgid "" "that returns a string representation, and the ``float.fromhex()`` method " "converts a string back into a number::" msgstr "" -"浮動小数点数を 16 進表記文字列に変換する変換関数が追加されています (:issue:" -"`3008`)。これら関数は 10 進と 2 進との間の変換で起こる丸め誤差を持ち込まずに" -"浮動小数点数と文字列表現の相互変換をします。浮動小数点数は文字列表現を返す :" -"meth:`hex` メソッドを持ち、また、 ``float.fromhex()`` メソッドが文字列から浮" -"動小数点数に戻します::" +"浮動小数点数を 16 進表記文字列に変換する変換関数が追加されています " +"(:issue:`3008`)。これら関数は 10 進と 2 進との間の変換で起こる丸め誤差を持ち" +"込まずに浮動小数点数と文字列表現の相互変換をします。浮動小数点数は文字列表現" +"を返す :meth:`hex` メソッドを持ち、また、 ``float.fromhex()`` メソッドが文字" +"列から浮動小数点数に戻します::" -#: ../../whatsnew/2.6.rst:1610 msgid "" ">>> a = 3.75\n" ">>> a.hex()\n" @@ -2813,6 +3215,14 @@ msgid "" ">>> b.hex()\n" "'0x1.5555555555555p-2'" msgstr "" +">>> a = 3.75\n" +">>> a.hex()\n" +"'0x1.e000000000000p+1'\n" +">>> float.fromhex('0x1.e000000000000p+1')\n" +"3.75\n" +">>> b=1./3\n" +">>> b.hex()\n" +"'0x1.5555555555555p-2'" #: ../../whatsnew/2.6.rst:1619 msgid "" @@ -2844,9 +3254,9 @@ msgid "" "objects have a default hash method that uses ``id(obj)`` as the hash value. " "There's no tidy way to remove the :meth:`__hash__` method inherited from a " "parent class, so assigning ``None`` was implemented as an override. At the " -"C level, extensions can set ``tp_hash`` to :c:func:" -"`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury Forgeot " -"d'Arc; :issue:`2235`.)" +"C level, extensions can set ``tp_hash`` " +"to :c:func:`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury " +"Forgeot d'Arc; :issue:`2235`.)" msgstr "" ":meth:`__cmp__` か :meth:`__eq__` を定義するのにその比較にオブジェクトの身元" "ではなくその値を使ったならば、あなたはこれをすべきです。全てのオブジェクトは" @@ -2871,8 +3281,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1646 msgid "" "Generator objects now have a :attr:`gi_code` attribute that refers to the " -"original code object backing the generator. (Contributed by Collin Winter; :" -"issue:`1473257`.)" +"original code object backing the generator. (Contributed by Collin " +"Winter; :issue:`1473257`.)" msgstr "" "ジェネレータオブジェクトが、そのジェネレータを返すオリジナルのコードオブジェ" "クトを参照する :attr:`gi_code` 属性を持つようになりました。 (Contributed by " @@ -2890,21 +3300,21 @@ msgstr "" msgid "" "The :func:`complex` constructor now accepts strings containing parenthesized " "complex numbers, meaning that ``complex(repr(cplx))`` will now round-trip " -"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). (:" -"issue:`1491866`)" +"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). " +"(:issue:`1491866`)" msgstr "" ":func:`complex` コンストラクタが括弧で囲まれた複素数表現文字列を受け付けるよ" "うになっています。 ``complex(repr(cplx))`` で元に戻せるということです。例え" -"ば ``complex('(3+4j)')`` は今では値 ``(3+4j)`` を返します。 (:issue:" -"`1491866`)" +"ば ``complex('(3+4j)')`` は今では値 ``(3+4j)`` を返します。 " +"(:issue:`1491866`)" #: ../../whatsnew/2.6.rst:1659 msgid "" "The string :meth:`translate` method now accepts ``None`` as the translation " "table parameter, which is treated as the identity transformation. This " "makes it easier to carry out operations that only delete characters. " -"(Contributed by Bengt Richter and implemented by Raymond Hettinger; :issue:" -"`1193128`.)" +"(Contributed by Bengt Richter and implemented by Raymond " +"Hettinger; :issue:`1193128`.)" msgstr "" "文字列の :meth:`translate` メソッドが変形テーブルパラメータとして ``None`` を" "受け付けるようになりました。そのまま同じものを返す変形として扱われます。これ" @@ -2916,9 +3326,9 @@ msgid "" "The built-in :func:`dir` function now checks for a :meth:`__dir__` method on " "the objects it receives. This method must return a list of strings " "containing the names of valid attributes for the object, and lets the object " -"control the value that :func:`dir` produces. Objects that have :meth:" -"`__getattr__` or :meth:`__getattribute__` methods can use this to advertise " -"pseudo-attributes they will honor. (:issue:`1591665`)" +"control the value that :func:`dir` produces. Objects that " +"have :meth:`__getattr__` or :meth:`__getattribute__` methods can use this to " +"advertise pseudo-attributes they will honor. (:issue:`1591665`)" msgstr "" "ビルトインの :func:`dir` 関数が、受け取ったオブジェクトの :meth:`__dir__` メ" "ソッドをチェックするようになりました。このメソッドはそのオブジェクトで妥当な" @@ -2927,21 +3337,25 @@ msgstr "" "ソッドを使うオブジェクトはこれを使うことで、約束するつもりの擬似属性を公表出" "来ます。 (:issue:`1591665`)" -#: ../../whatsnew/2.6.rst:1673 msgid "" "Instance method objects have new attributes for the object and function " -"comprising the method; the new synonym for :attr:`!im_self` is :attr:" -"`~method.__self__`, and :attr:`!im_func` is also available as :attr:`~method." -"__func__`. The old names are still supported in Python 2.6, but are gone in " -"3.0." +"comprising the method; the new synonym for :attr:`!im_self` " +"is :attr:`~method.__self__`, and :attr:`!im_func` is also available " +"as :attr:`~method.__func__`. The old names are still supported in Python " +"2.6, but are gone in 3.0." msgstr "" +"インスタンスメソッドオブジェクトに、それを構成するオブジェクトと関数を表す新" +"しい属性名が加わりました。\n" +":attr:`!im_self` は :attr:`~method.__self__`、:attr:`!im_func` " +"は :attr:`~method.__func__` という名前でも使えます。\n" +"古い名前は Python 2.6 では引き続きサポートされますが、3.0 ではなくなります。" #: ../../whatsnew/2.6.rst:1679 msgid "" -"An obscure change: when you use the :func:`locals` function inside a :" -"keyword:`class` statement, the resulting dictionary no longer returns free " -"variables. (Free variables, in this case, are variables referenced in the :" -"keyword:`!class` statement that aren't attributes of the class.)" +"An obscure change: when you use the :func:`locals` function inside " +"a :keyword:`class` statement, the resulting dictionary no longer returns " +"free variables. (Free variables, in this case, are variables referenced in " +"the :keyword:`!class` statement that aren't attributes of the class.)" msgstr "" "目立たない変更: :func:`locals` 関数を :keyword:`class` ステートメント内で使う" "際、結果の辞書はもはや自由変数を返しません。(この場合、自由変数は :keyword:`!" @@ -2955,8 +3369,8 @@ msgstr "最適化" msgid "" "The :mod:`warnings` module has been rewritten in C. This makes it possible " "to invoke warnings from the parser, and may also make the interpreter's " -"startup faster. (Contributed by Neal Norwitz and Brett Cannon; :issue:" -"`1631171`.)" +"startup faster. (Contributed by Neal Norwitz and Brett " +"Cannon; :issue:`1631171`.)" msgstr "" ":mod:`warnings` モジュールが C で書き直されました。これにより警告をパーサから" "発行出来、また、インタプリタの起動が高速化しています。 (Contributed by Neal " @@ -3010,8 +3424,8 @@ msgid "" msgstr "" "キーワード引数を使う関数呼び出しが、素早くポインタで比較することで顕著に高速" "化しています。これは常に文字列丸ごとを比較する時間を省きます。 (Contributed " -"by Raymond Hettinger, after an initial implementation by Antoine Pitrou; :" -"issue:`1819`.)" +"by Raymond Hettinger, after an initial implementation by Antoine " +"Pitrou; :issue:`1819`.)" #: ../../whatsnew/2.6.rst:1721 msgid "" @@ -3035,20 +3449,23 @@ msgstr "" #: ../../whatsnew/2.6.rst:1729 msgid "" "Unicode strings now use faster code for detecting whitespace and line " -"breaks; this speeds up the :meth:`split` method by about 25% and :meth:" -"`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory usage is " -"reduced by using pymalloc for the Unicode string's data." +"breaks; this speeds up the :meth:`split` method by about 25% " +"and :meth:`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory " +"usage is reduced by using pymalloc for the Unicode string's data." msgstr "" "Unicode 文字列が、空白文字と改行を検出するためのコードにより高速な実装を使う" -"ようになりました; :meth:`split` メソッドでおよそ 25% の速度向上、 :meth:" -"`splitlines` メソッドでは 35% です。(Contributed by Antoine Pitrou.) Unicode " -"文字列データのために pymalloc を使うことでメモリ使用が減りました。" +"ようになりました; :meth:`split` メソッドでおよそ 25% の速度向" +"上、 :meth:`splitlines` メソッドでは 35% です。(Contributed by Antoine " +"Pitrou.) Unicode 文字列データのために pymalloc を使うことでメモリ使用が減りま" +"した。" -#: ../../whatsnew/2.6.rst:1735 msgid "" "The ``with`` statement now stores the :meth:`~object.__exit__` method on the " "stack, producing a small speedup. (Implemented by Jeffrey Yasskin.)" msgstr "" +"``with`` 文が :meth:`~object.__exit__` メソッドをスタックに格納するようにな" +"り、少し高速になりました。\n" +"(Jeffrey Yasskin による実装です。)" #: ../../whatsnew/2.6.rst:1738 msgid "" @@ -3064,7 +3481,6 @@ msgstr "" msgid "Interpreter Changes" msgstr "インタプリタの変更" -#: ../../whatsnew/2.6.rst:1749 msgid "" "Two command-line options have been reserved for use by other Python " "implementations. The :option:`!-J` switch has been reserved for use by " @@ -3074,6 +3490,14 @@ msgid "" "If either option is used with Python 2.6, the interpreter will report that " "the option isn't currently used." msgstr "" +"ほかの Python 実装のために、2 つのコマンドラインオプションが予約されまし" +"た。\n" +":option:`!-J` は、基盤となる JVM に渡すオプションなど、Jython 固有のオプショ" +"ンのために予約されました。\n" +":option:`-X` は CPython、Jython、IronPython など、特定の Python 実装に固有の" +"オプションのためのものです。\n" +"Python 2.6 でどちらかを使うと、現在そのオプションは使われていないというメッ" +"セージが出ます。" #: ../../whatsnew/2.6.rst:1757 msgid "" @@ -3086,11 +3510,11 @@ msgid "" "and Georg Brandl.)" msgstr "" "Python インタプリタに :option:`-B` スイッチを渡すか、インタプリタ実行前に環境" -"変数 :envvar:`PYTHONDONTWRITEBYTECODE` をセットするかのどちらかで、 :file:`." -"pyc` や :file:`.pyo` が作られないようにすることが出来るようになりました。この" -"設定は Python プログラムから ``sys.dont_write_bytecode`` 変数として利用可能" -"で、Python コードはこの変数を変更してインタプリタの振る舞いを変えることが出来" -"ます。 (Contributed by Neal Norwitz and Georg Brandl.)" +"変数 :envvar:`PYTHONDONTWRITEBYTECODE` をセットするかのどちらか" +"で、 :file:`.pyc` や :file:`.pyo` が作られないようにすることが出来るようにな" +"りました。この設定は Python プログラムから ``sys.dont_write_bytecode`` 変数と" +"して利用可能で、Python コードはこの変数を変更してインタプリタの振る舞いを変え" +"ることが出来ます。 (Contributed by Neal Norwitz and Georg Brandl.)" #: ../../whatsnew/2.6.rst:1765 msgid "" @@ -3129,12 +3553,15 @@ msgstr "" "内の :file:`Misc/NEWS` ファイルか、全ての完全な詳細が入っている Subversion の" "ログを参照してください。" -#: ../../whatsnew/2.6.rst:1786 msgid "" "The :mod:`!asyncore` and :mod:`!asynchat` modules are being actively " "maintained again, and a number of patches and bugfixes were applied. " "(Maintained by Josiah Carlson; see :issue:`1736190` for one patch.)" msgstr "" +":mod:`!asyncore` と :mod:`!asynchat` の活発な保守が再開され、多数のパッチやバ" +"グ修正が適用されました。\n" +"(保守担当は Josiah Carlson です。パッチの一例は :issue:`1736190` を参照してく" +"ださい。)" #: ../../whatsnew/2.6.rst:1791 msgid "" @@ -3162,20 +3589,24 @@ msgstr "" "なく利用出来る一番高いプロトコルバージョンを使うようになりました。" "(Contributed by W. Barnes.)" -#: ../../whatsnew/2.6.rst:1803 msgid "" "The :mod:`!cgi` module will now read variables from the query string of an " "HTTP POST request. This makes it possible to use form actions with URLs " "that include query strings such as \"/cgi-bin/add.py?category=1\". " "(Contributed by Alexandre Fiori and Nubis; :issue:`1817`.)" msgstr "" +":mod:`!cgi` モジュールが、HTTP POST リクエストのクエリー文字列からも変数を読" +"むようになりました。\n" +"これにより、\"/cgi-bin/add.py?category=1\" のようにクエリー文字列を含む URL " +"をフォームの送信先にできます。\n" +"(Alexandre Fiori と Nubis による貢献です。:issue:`1817`。)" #: ../../whatsnew/2.6.rst:1809 msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " "from the :mod:`!cgi` module to the :mod:`urlparse ` module. " -"The versions still available in the :mod:`!cgi` module will trigger :exc:" -"`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." +"The versions still available in the :mod:`!cgi` module will " +"trigger :exc:`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" #: ../../whatsnew/2.6.rst:1815 @@ -3227,17 +3658,17 @@ msgid "" "The revisions also improved the numerical soundness of the :mod:`cmath` " "module. For all functions, the real and imaginary parts of the results are " "accurate to within a few units of least precision (ulps) whenever possible. " -"See :issue:`1381` for the details. The branch cuts for :func:`asinh`, :func:" -"`atanh`: and :func:`atan` have also been corrected." +"See :issue:`1381` for the details. The branch cuts " +"for :func:`asinh`, :func:`atanh`: and :func:`atan` have also been corrected." msgstr "" "その改訂では、 :mod:`cmath` モジュールの数値的安定性も改善されました。全ての" "関数で、結果の実数部、虚数部は最小精度単位で少しの範囲内で、可能な限り正確で" -"す。詳細は :issue:`1381` を見てください。 :func:`asinh`, :func:`atanh`:, :" -"func:`atan` に対する分岐截線 (branch cut) も修正されています。\\ \\ (--- 訳" -"注: units of least precision に対する枯れた訳語はないようなので最小精度単位と" -"していますが仮数部の最下位ビットのことです。ので、within a few ulps は下位数" -"ビットという意味。分岐截線 (branch cut) は一般的な訳語かどうかはわかりません" -"が、wikipedia から採りました。---)" +"す。詳細は :issue:`1381` を見てくださ" +"い。 :func:`asinh`, :func:`atanh`:, :func:`atan` に対する分岐截線 (branch " +"cut) も修正されています。\\ \\ (--- 訳注: units of least precision に対する枯" +"れた訳語はないようなので最小精度単位としていますが仮数部の最下位ビットのこと" +"です。ので、within a few ulps は下位数ビットという意味。分岐截線 (branch " +"cut) は一般的な訳語かどうかはわかりませんが、wikipedia から採りました。---)" #: ../../whatsnew/2.6.rst:1841 msgid "" @@ -3257,14 +3688,16 @@ msgstr "" "浮動小数点例外を、C99 標準の付録 'G' での一貫性のある方法で処理するようになり" "ました。" -#: ../../whatsnew/2.6.rst:1848 msgid "" "A new data type in the :mod:`collections` module: ``namedtuple(typename, " "fieldnames)`` is a factory function that creates subclasses of the standard " "tuple whose fields are accessible by name as well as index. For example::" msgstr "" +":mod:`collections` モジュールに新しいデータ型が加わりました。\n" +"``namedtuple(typename, fieldnames)`` は、フィールドへインデックスだけでなく名" +"前でもアクセスできる、標準のタプルのサブクラスを作るファクトリー関数です。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/2.6.rst:1852 msgid "" ">>> var_type = collections.namedtuple('variable',\n" "... 'id name type size')\n" @@ -3284,13 +3717,30 @@ msgid "" ">>> v2\n" "variable(id=1, name='amplitude', type='int', size=4)" msgstr "" +">>> var_type = collections.namedtuple('variable',\n" +"... 'id name type size')\n" +">>> # 名前はスペースまたはカンマで区切る。\n" +">>> # 'id, name, type, size' でもよい。\n" +">>> var_type._fields\n" +"('id', 'name', 'type', 'size')\n" +"\n" +">>> var = var_type(1, 'frequency', 'int', 4)\n" +">>> print var[0], var.id # 同じ意味\n" +"1 1\n" +">>> print var[2], var.type # 同じ意味\n" +"int int\n" +">>> var._asdict()\n" +"{'size': 4, 'type': 'int', 'id': 1, 'name': 'frequency'}\n" +">>> v2 = var._replace(name='amplitude')\n" +">>> v2\n" +"variable(id=1, name='amplitude', type='int', size=4)" #: ../../whatsnew/2.6.rst:1870 msgid "" "Several places in the standard library that returned tuples have been " -"modified to return :func:`namedtuple` instances. For example, the :meth:" -"`Decimal.as_tuple` method now returns a named tuple with :attr:`sign`, :attr:" -"`digits`, and :attr:`exponent` fields." +"modified to return :func:`namedtuple` instances. For example, " +"the :meth:`Decimal.as_tuple` method now returns a named tuple " +"with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields." msgstr "" #: ../../whatsnew/2.6.rst:1877 @@ -3305,7 +3755,6 @@ msgstr "" "deque のサイズが要素数 *maxlen* を超えないように制限されます。お腹いっぱいの " "deque にさらに要素を追加すると、古いものから捨てられます。" -#: ../../whatsnew/2.6.rst:1885 msgid "" ">>> from collections import deque\n" ">>> dq=deque(maxlen=3)\n" @@ -3318,15 +3767,29 @@ msgid "" ">>> dq\n" "deque([2, 3, 4], maxlen=3)" msgstr "" +">>> from collections import deque\n" +">>> dq=deque(maxlen=3)\n" +">>> dq\n" +"deque([], maxlen=3)\n" +">>> dq.append(1); dq.append(2); dq.append(3)\n" +">>> dq\n" +"deque([1, 2, 3], maxlen=3)\n" +">>> dq.append(4)\n" +">>> dq\n" +"deque([2, 3, 4], maxlen=3)" -#: ../../whatsnew/2.6.rst:1898 msgid "" "The :mod:`Cookie ` module's :class:`~http.cookies.Morsel` " "objects now support an :attr:`~http.cookies.Morsel.httponly` attribute. In " "some browsers. cookies with this attribute set cannot be accessed or " -"manipulated by JavaScript code. (Contributed by Arvin Schnell; :issue:" -"`1638033`.)" +"manipulated by JavaScript code. (Contributed by Arvin " +"Schnell; :issue:`1638033`.)" msgstr "" +":mod:`Cookie ` モジュールの :class:`~http.cookies.Morsel` " +"が、:attr:`~http.cookies.Morsel.httponly` 属性に対応しました。\n" +"一部のブラウザーでは、この属性を設定したクッキーに JavaScript からアクセスし" +"たり、変更したりすることができません。\n" +"(Arvin Schnell による貢献です。:issue:`1638033`。)" #: ../../whatsnew/2.6.rst:1903 msgid "" @@ -3337,31 +3800,33 @@ msgstr "" ":mod:`curses` モジュールの新しい window メソッド :meth:`chgat` は、一行での指" "定数ぶん文字の表示属性を変更します。 (Contributed by Fabian Kreutz.)" -#: ../../whatsnew/2.6.rst:1909 msgid "" "# Boldface text starting at y=0,x=21\n" "# and affecting the rest of the line.\n" "stdscr.chgat(0, 21, curses.A_BOLD)" msgstr "" +"# y=0,x=21 から行末までを\n" +"# 太字にする。\n" +"stdscr.chgat(0, 21, curses.A_BOLD)" #: ../../whatsnew/2.6.rst:1913 msgid "" "The :class:`Textbox` class in the :mod:`curses.textpad` module now supports " "editing in insert mode as well as overwrite mode. Insert mode is enabled by " -"supplying a true value for the *insert_mode* parameter when creating the :" -"class:`Textbox` instance." +"supplying a true value for the *insert_mode* parameter when creating " +"the :class:`Textbox` instance." msgstr "" ":mod:`curses.textpad` モジュールの :class:`Textbox` クラスが上書きモードのほ" -"かに挿入モード編集をサポートするようになりました。挿入モードは :class:" -"`Textbox` インスタンス構築時に *insert_mode* パラメータを真にすることで有効に" -"なります。" +"かに挿入モード編集をサポートするようになりました。挿入モード" +"は :class:`Textbox` インスタンス構築時に *insert_mode* パラメータを真にするこ" +"とで有効になります。" #: ../../whatsnew/2.6.rst:1918 msgid "" "The :mod:`datetime` module's :meth:`strftime` methods now support a ``%f`` " "format code that expands to the number of microseconds in the object, zero-" -"padded on the left to six places. (Contributed by Skip Montanaro; :issue:" -"`1158`.)" +"padded on the left to six places. (Contributed by Skip " +"Montanaro; :issue:`1158`.)" msgstr "" ":mod:`datetime` モジュールの :meth:`strftime` メソッドが ``%f`` 書式化コード" "をサポートするようになりました。これはオブジェクトのマイクロ秒をミリ秒として" @@ -3379,7 +3844,6 @@ msgid "" "as :meth:`exp` and :meth:`log10`::" msgstr "" -#: ../../whatsnew/2.6.rst:1928 msgid "" ">>> Decimal(1).exp()\n" "Decimal(\"2.718281828459045235360287471\")\n" @@ -3388,15 +3852,21 @@ msgid "" ">>> Decimal(1000).log10()\n" "Decimal(\"3\")" msgstr "" +">>> Decimal(1).exp()\n" +"Decimal(\"2.718281828459045235360287471\")\n" +">>> Decimal(\"2.7182818\").ln()\n" +"Decimal(\"0.9999999895305022877376682436\")\n" +">>> Decimal(1000).log10()\n" +"Decimal(\"3\")" #: ../../whatsnew/2.6.rst:1935 msgid "" "The :meth:`as_tuple` method of :class:`Decimal` objects now returns a named " "tuple with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields." msgstr "" -":class:`Decimal` クラスの :meth:`as_tuple` メソッドが :attr:`sign`, :attr:" -"`digits`, :attr:`exponent` フィールドを持った名前付きタプルを返すようになりま" -"した。" +":class:`Decimal` クラスの :meth:`as_tuple` メソッド" +"が :attr:`sign`, :attr:`digits`, :attr:`exponent` フィールドを持った名前付き" +"タプルを返すようになりました。" #: ../../whatsnew/2.6.rst:1938 msgid "" @@ -3412,18 +3882,19 @@ msgid "" "tuples representing matches, with :attr:`a`, :attr:`b`, and :attr:`size` " "attributes. (Contributed by Raymond Hettinger.)" msgstr "" -":mod:`difflib` モジュールの :class:`SequenceMatcher` クラスが、マッチを :" -"attr:`a`, :attr:`b`, :attr:`size` 属性を持つ名前付きタプルで返すようになりま" -"した。 (Contributed by Raymond Hettinger.)" +":mod:`difflib` モジュールの :class:`SequenceMatcher` クラスが、マッチ" +"を :attr:`a`, :attr:`b`, :attr:`size` 属性を持つ名前付きタプルで返すようにな" +"りました。 (Contributed by Raymond Hettinger.)" #: ../../whatsnew/2.6.rst:1946 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`ftplib.FTP` class constructor as well as the :meth:" -"`connect` method. (Added by Facundo Batista.) Also, the :class:`FTP` " -"class's :meth:`storbinary` and :meth:`storlines` now take an optional " -"*callback* parameter that will be called with each block of data after the " -"data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.)" +"was added to the :class:`ftplib.FTP` class constructor as well as " +"the :meth:`connect` method. (Added by Facundo Batista.) Also, " +"the :class:`FTP` class's :meth:`storbinary` and :meth:`storlines` now take " +"an optional *callback* parameter that will be called with each block of data " +"after the data has been sent. (Contributed by Phil " +"Schwartz; :issue:`1221598`.)" msgstr "" ":class:`ftplib.FTP` クラスのコンストラクタと :meth:`connect` メソッドに省略可" "能 ``timeout`` パラメータが追加されました。タイムアウトを秒で指定します。" @@ -3434,11 +3905,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:1954 msgid "" -"The :func:`reduce` built-in function is also available in the :mod:" -"`functools` module. In Python 3.0, the builtin has been dropped and :func:" -"`reduce` is only available from :mod:`functools`; currently there are no " -"plans to drop the builtin in the 2.x series. (Patched by Christian Heimes; :" -"issue:`1739906`.)" +"The :func:`reduce` built-in function is also available in " +"the :mod:`functools` module. In Python 3.0, the builtin has been dropped " +"and :func:`reduce` is only available from :mod:`functools`; currently there " +"are no plans to drop the builtin in the 2.x series. (Patched by Christian " +"Heimes; :issue:`1739906`.)" msgstr "" "ビルトイン関数の :func:`reduce` が :mod:`functools` モジュールでも利用可能で" "す。Python 3.0 ではビルトイン関数は削除されて :mod:`functools` のものだけが使" @@ -3464,12 +3935,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:1966 msgid "" "The :func:`glob.glob` function can now return Unicode filenames if a Unicode " -"path was used and Unicode filenames are matched within the directory. (:" -"issue:`1001604`)" +"path was used and Unicode filenames are matched within the directory. " +"(:issue:`1001604`)" msgstr "" ":func:`glob.glob` 関数が、Unicode パスが使われるかディレクトリ内に Unicode " -"ファイル名がマッチすると Unicode ファイル名を返すようになりました。 (:issue:" -"`1001604`)" +"ファイル名がマッチすると Unicode ファイル名を返すようになりました。 " +"(:issue:`1001604`)" #: ../../whatsnew/2.6.rst:1970 msgid "" @@ -3486,11 +3957,12 @@ msgstr "" "ても並べ替えられるわけではありません。リファレンスにはここはきちんと書かれて" "います。---)。例えば::" -#: ../../whatsnew/2.6.rst:1975 msgid "" ">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" "[1, 2, 3, 5, 8, 9, 16]" msgstr "" +">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" +"[1, 2, 3, 5, 8, 9, 16]" #: ../../whatsnew/2.6.rst:1978 msgid "" @@ -3506,22 +3978,27 @@ msgstr "" #: ../../whatsnew/2.6.rst:1983 msgid "" ":mod:`heapq` is now implemented to only use less-than comparison, instead of " -"the less-than-or-equal comparison it previously used. This makes :mod:" -"`heapq`'s usage of a type match the :meth:`list.sort` method. (Contributed " -"by Raymond Hettinger.)" +"the less-than-or-equal comparison it previously used. This " +"makes :mod:`heapq`'s usage of a type match the :meth:`list.sort` method. " +"(Contributed by Raymond Hettinger.)" msgstr "" ":mod:`heapq` は以前使っていた「以下(``<=``)」比較ではなく「より小さい" "(``<``)」比較だけを使って実装されています。これにより :mod:`heapq` に格納する" "型の要件が :meth:`list.sort` メソッドに合致します。 (Contributed by Raymond " "Hettinger.)" -#: ../../whatsnew/2.6.rst:1989 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`httplib.HTTPConnection ` and :class:`HTTPSConnection ` " -"class constructors. (Added by Facundo Batista.)" +"was added to the :class:`httplib.HTTPConnection " +"` and :class:`HTTPSConnection " +"` class constructors. (Added by Facundo " +"Batista.)" msgstr "" +":class:`httplib.HTTPConnection ` " +"と :class:`HTTPSConnection ` のコンストラクター" +"に、タイムアウトを秒単位で指定する省略可能な ``timeout`` パラメーターが加わり" +"ました。\n" +"(Facundo Batista が追加しました。)" #: ../../whatsnew/2.6.rst:1994 msgid "" @@ -3537,11 +4014,13 @@ msgstr "" #: ../../whatsnew/2.6.rst:2000 msgid "" -"Some new functions in the module include :func:`isgenerator`, :func:" -"`isgeneratorfunction`, and :func:`isabstract`." +"Some new functions in the module " +"include :func:`isgenerator`, :func:`isgeneratorfunction`, " +"and :func:`isabstract`." msgstr "" -"モジュールには :func:`isgenerator`, :func:`isgeneratorfunction`, :func:" -"`isabstract` を含むいくつかの新しい関数が追加されています。" +"モジュールに" +"は :func:`isgenerator`, :func:`isgeneratorfunction`, :func:`isabstract` を含" +"むいくつかの新しい関数が追加されています。" #: ../../whatsnew/2.6.rst:2004 msgid "The :mod:`itertools` module gained several new functions." @@ -3557,11 +4036,12 @@ msgstr "" "を生成します; イテラブルの要素数がほかのものより短ければ欠落値として " "*fillvalue* が埋められます。例えば::" -#: ../../whatsnew/2.6.rst:2010 msgid "" ">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" "((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" msgstr "" +">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" +"((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" #: ../../whatsnew/2.6.rst:2013 msgid "" @@ -3573,13 +4053,16 @@ msgstr "" "(Cartesian product)、つまりそれぞれのイテラブルから返るその要素たちの全てのあ" "りうる組み合わせを含むタプルの集合を返します。::" -#: ../../whatsnew/2.6.rst:2017 msgid "" ">>> list(itertools.product([1,2,3], [4,5,6]))\n" "[(1, 4), (1, 5), (1, 6),\n" " (2, 4), (2, 5), (2, 6),\n" " (3, 4), (3, 5), (3, 6)]" msgstr "" +">>> list(itertools.product([1,2,3], [4,5,6]))\n" +"[(1, 4), (1, 5), (1, 6),\n" +" (2, 4), (2, 5), (2, 6),\n" +" (3, 4), (3, 5), (3, 6)]" #: ../../whatsnew/2.6.rst:2022 msgid "" @@ -3591,18 +4074,19 @@ msgstr "" "が *N* 個、複数あればそのセットが *N* 回与えられたとみなします。単一のイテラ" "ブルに対しては *N* 要素タプルのリストで返ります::" -#: ../../whatsnew/2.6.rst:2027 msgid "" ">>> list(itertools.product([1,2], repeat=3))\n" "[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" " (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" msgstr "" +">>> list(itertools.product([1,2], repeat=3))\n" +"[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" +" (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" #: ../../whatsnew/2.6.rst:2031 msgid "With two iterables, *2N*-tuples are returned. ::" msgstr "2 つのイテラブルであれば *2N* 要素タプルのリストで返ります::" -#: ../../whatsnew/2.6.rst:2033 msgid "" ">>> list(itertools.product([1,2], [3,4], repeat=2))\n" "[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n" @@ -3610,6 +4094,11 @@ msgid "" " (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" " (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" msgstr "" +">>> list(itertools.product([1,2], [3,4], repeat=2))\n" +"[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n" +" (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),\n" +" (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" +" (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" #: ../../whatsnew/2.6.rst:2039 msgid "" @@ -3620,7 +4109,6 @@ msgstr "" "部分列を返します (---訳注: 数学の初等組み合わせ論の「組合せ (combination)」 " "---)::" -#: ../../whatsnew/2.6.rst:2042 msgid "" ">>> list(itertools.combinations('123', 2))\n" "[('1', '2'), ('1', '3'), ('2', '3')]\n" @@ -3630,6 +4118,13 @@ msgid "" "[('1', '2', '3'), ('1', '2', '4'),\n" " ('1', '3', '4'), ('2', '3', '4')]" msgstr "" +">>> list(itertools.combinations('123', 2))\n" +"[('1', '2'), ('1', '3'), ('2', '3')]\n" +">>> list(itertools.combinations('123', 3))\n" +"[('1', '2', '3')]\n" +">>> list(itertools.combinations('1234', 3))\n" +"[('1', '2', '3'), ('1', '2', '4'),\n" +" ('1', '3', '4'), ('2', '3', '4')]" #: ../../whatsnew/2.6.rst:2050 msgid "" @@ -3644,7 +4139,6 @@ msgstr "" "両方出てきていますが、高校教育で習う用語で「順列」が伝わりやすいのでここでは" "「順列」としています。 ---)::" -#: ../../whatsnew/2.6.rst:2054 msgid "" ">>> list(itertools.permutations([1,2,3,4], 2))\n" "[(1, 2), (1, 3), (1, 4),\n" @@ -3652,26 +4146,33 @@ msgid "" " (3, 1), (3, 2), (3, 4),\n" " (4, 1), (4, 2), (4, 3)]" msgstr "" +">>> list(itertools.permutations([1,2,3,4], 2))\n" +"[(1, 2), (1, 3), (1, 4),\n" +" (2, 1), (2, 3), (2, 4),\n" +" (3, 1), (3, 2), (3, 4),\n" +" (4, 1), (4, 2), (4, 3)]" #: ../../whatsnew/2.6.rst:2060 msgid "" "``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` " -"that gained a new constructor in Python 2.6. ``itertools.chain." -"from_iterable(iterable)`` takes a single iterable that should return other " -"iterables. :func:`chain` will then return all the elements of the first " -"iterable, then all the elements of the second, and so on. ::" +"that gained a new constructor in Python 2.6. " +"``itertools.chain.from_iterable(iterable)`` takes a single iterable that " +"should return other iterables. :func:`chain` will then return all the " +"elements of the first iterable, then all the elements of the second, and so " +"on. ::" msgstr "" "``itertools.chain(*iterables)`` は :mod:`itertools` に元々いたものですが、新" -"しい構築方法が出来ました。Python 2.6 では、 ``itertools.chain." -"from_iterable(iterable)`` でほかのイテラブルを返す単一のイテラブルを取り、 :" -"func:`chain` は、最初のイテラブルからの全要素、次のイテラブルからの全要" -"素、…、のように返します::" +"しい構築方法が出来ました。Python 2.6 では、 " +"``itertools.chain.from_iterable(iterable)`` でほかのイテラブルを返す単一のイ" +"テラブルを取り、 :func:`chain` は、最初のイテラブルからの全要素、次のイテラブ" +"ルからの全要素、…、のように返します::" -#: ../../whatsnew/2.6.rst:2067 msgid "" ">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" "[1, 2, 3, 4, 5, 6]" msgstr "" +">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" +"[1, 2, 3, 4, 5, 6]" #: ../../whatsnew/2.6.rst:2070 msgid "(All contributed by Raymond Hettinger.)" @@ -3679,18 +4180,18 @@ msgstr "(All contributed by Raymond Hettinger.)" #: ../../whatsnew/2.6.rst:2072 msgid "" -"The :mod:`logging` module's :class:`FileHandler` class and its subclasses :" -"class:`WatchedFileHandler`, :class:`RotatingFileHandler`, and :class:" -"`TimedRotatingFileHandler` now have an optional *delay* parameter to their " -"constructors. If *delay* is true, opening of the log file is deferred until " -"the first :meth:`emit` call is made. (Contributed by Vinay Sajip.)" -msgstr "" -":mod:`logging` モジュールの :class:`FileHandler` クラスとそのサブクラスの :" -"class:`WatchedFileHandler`, :class:`RotatingFileHandler`, :class:" -"`TimedRotatingFileHandler` がそのコンストラクタで省略可能 *delay* パラメータ" -"を受け取るようになりました。 *delay* が真の場合、ログファイルのオープンは最初" -"の :meth:`emit` が呼び出されるまで延期されます。 (Contributed by Vinay " +"The :mod:`logging` module's :class:`FileHandler` class and its " +"subclasses :class:`WatchedFileHandler`, :class:`RotatingFileHandler`, " +"and :class:`TimedRotatingFileHandler` now have an optional *delay* parameter " +"to their constructors. If *delay* is true, opening of the log file is " +"deferred until the first :meth:`emit` call is made. (Contributed by Vinay " "Sajip.)" +msgstr "" +":mod:`logging` モジュールの :class:`FileHandler` クラスとそのサブクラス" +"の :class:`WatchedFileHandler`, :class:`RotatingFileHandler`, :class:`TimedRotatingFileHandler` " +"がそのコンストラクタで省略可能 *delay* パラメータを受け取るようになりまし" +"た。 *delay* が真の場合、ログファイルのオープンは最初の :meth:`emit` が呼び出" +"されるまで延期されます。 (Contributed by Vinay Sajip.)" #: ../../whatsnew/2.6.rst:2079 msgid "" @@ -3757,9 +4258,10 @@ msgstr ":func:`~math.log1p` は *1+x* の自然対数 (底 *e* の対数) を #: ../../whatsnew/2.6.rst:2108 msgid "" -":func:`trunc` rounds a number toward zero, returning the closest :class:" -"`Integral` that's between the function's argument and zero. Added as part of " -"the backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__." +":func:`trunc` rounds a number toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero. " +"Added as part of the backport of `PEP 3141's type hierarchy for numbers " +"<#pep-3141>`__." msgstr "" ":func:`trunc` はゼロに向かう方向に丸めを行い、与えられた引数とゼロに最も近" "い :class:`Integral` を返します。これは `PEP 3141: 数値の型階層 " @@ -3783,17 +4285,17 @@ msgid "" "``sqrt(float('NaN'))`` should return a NaN on all IEEE 754 platforms. Where " "Annex 'F' of the C99 standard recommends signaling 'divide-by-zero' or " "'invalid', Python will raise :exc:`ValueError`. Where Annex 'F' of the C99 " -"standard recommends signaling 'overflow', Python will raise :exc:" -"`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" +"standard recommends signaling 'overflow', Python will " +"raise :exc:`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" msgstr "" "可能な場合にはいつでもこのモジュールは 754 の特殊値について、C99 標準の勧告に" -"従います。例えば、 ``sqrt(-1.)`` は今ではほとんど全てのプラットフォームで :" -"exc:`ValueError` となるはずで、 ``sqrt(float('NaN'))`` は全ての IEEE 754 プ" -"ラットフォームで NaN を返すはずです。C99 標準の付録 'F' で 'divide-by-zero' " -"または 'invalid' を伝えることを勧告している箇所では Python は :exc:" -"`ValueError` を投げます。C99 標準の付録 'F' で 'overflow' を伝えることを勧告" -"している箇所では Python は :exc:`OverflowError` を投げます。 (See :issue:" -"`711019` and :issue:`1640`.)" +"従います。例えば、 ``sqrt(-1.)`` は今ではほとんど全てのプラットフォーム" +"で :exc:`ValueError` となるはずで、 ``sqrt(float('NaN'))`` は全ての IEEE 754 " +"プラットフォームで NaN を返すはずです。C99 標準の付録 'F' で 'divide-by-" +"zero' または 'invalid' を伝えることを勧告している箇所では Python " +"は :exc:`ValueError` を投げます。C99 標準の付録 'F' で 'overflow' を伝えるこ" +"とを勧告している箇所では Python は :exc:`OverflowError` を投げます。 " +"(See :issue:`711019` and :issue:`1640`.)" #: ../../whatsnew/2.6.rst:2127 msgid "(Contributed by Christian Heimes and Mark Dickinson.)" @@ -3821,13 +4323,16 @@ msgstr "" "前と省略可能な引数を与えると、渡したその任意の引数でその名前の関数を呼び出す" "呼び出し可能オブジェクトを返します。例えば::" -#: ../../whatsnew/2.6.rst:2140 msgid "" ">>> # Equivalent to lambda s: s.replace('old', 'new')\n" ">>> replacer = operator.methodcaller('replace', 'old', 'new')\n" ">>> replacer('old wine in old bottles')\n" "'new wine in new bottles'" msgstr "" +">>> # lambda s: s.replace('old', 'new') と同じ\n" +">>> replacer = operator.methodcaller('replace', 'old', 'new')\n" +">>> replacer('old wine in old bottles')\n" +"'new wine in new bottles'" #: ../../whatsnew/2.6.rst:2145 msgid "(Contributed by Georg Brandl, after a suggestion by Gregory Petrosyan.)" @@ -3842,7 +4347,6 @@ msgstr "" ":func:`attrgetter` 関数がドット付きの名前を受け付け、対応する属性ルックアップ" "をするようになりました::" -#: ../../whatsnew/2.6.rst:2150 msgid "" ">>> inst_name = operator.attrgetter(\n" "... '__class__.__name__')\n" @@ -3851,6 +4355,12 @@ msgid "" ">>> inst_name(help)\n" "'_Helper'" msgstr "" +">>> inst_name = operator.attrgetter(\n" +"... '__class__.__name__')\n" +">>> inst_name('')\n" +"'str'\n" +">>> inst_name(help)\n" +"'_Helper'" #: ../../whatsnew/2.6.rst:2157 msgid "(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)" @@ -3926,8 +4436,8 @@ msgid "" "In the :mod:`os.path` module, the :func:`splitext` function has been changed " "to not split on leading period characters. This produces better results when " "operating on Unix's dot-files. For example, ``os.path.splitext('.ipython')`` " -"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. (:issue:" -"`1115886`)" +"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. " +"(:issue:`1115886`)" msgstr "" ":mod:`os.path` モジュールの :func:`splitext` 関数が、先行するピリオドで分割し" "ないように変更されています。これにより Unix のドットファイルの処理結果がよく" @@ -3938,8 +4448,8 @@ msgstr "" msgid "" "A new function, ``os.path.relpath(path, start='.')``, returns a relative " "path from the ``start`` path, if it's supplied, or from the current working " -"directory to the destination ``path``. (Contributed by Richard Barran; :" -"issue:`1339796`.)" +"directory to the destination ``path``. (Contributed by Richard " +"Barran; :issue:`1339796`.)" msgstr "" "新規関数 ``os.path.relpath(path, start='.')`` は、与えられれば ``start`` から" "の、与えられなければカレントディレクトリからの、目的地 ``path`` への相対パス" @@ -3978,8 +4488,8 @@ msgid "" msgstr "" "トレースバックのデバッグを開始するのに使われる :func:`pdb.post_mortem` が、ト" "レースバックが与えられない場合に :func:`sys.exc_info` からの戻り値のトレース" -"バックを使うようになりました。 (Contributed by Facundo Batista; :issue:" -"`1106316`.)" +"バックを使うようになりました。 (Contributed by Facundo " +"Batista; :issue:`1106316`.)" #: ../../whatsnew/2.6.rst:2216 msgid "" @@ -4002,7 +4512,6 @@ msgstr "" "ストールされている Python パッケージに含まれるリソースファイルの内容を返しま" "す。例えば::" -#: ../../whatsnew/2.6.rst:2225 msgid "" ">>> import pkgutil\n" ">>> print pkgutil.get_data('test', 'exception_hierarchy.txt')\n" @@ -4015,6 +4524,16 @@ msgid "" " +-- StandardError\n" " ..." msgstr "" +">>> import pkgutil\n" +">>> print pkgutil.get_data('test', 'exception_hierarchy.txt')\n" +"BaseException\n" +" +-- SystemExit\n" +" +-- KeyboardInterrupt\n" +" +-- GeneratorExit\n" +" +-- Exception\n" +" +-- StopIteration\n" +" +-- StandardError\n" +" ..." #: ../../whatsnew/2.6.rst:2236 msgid "(Contributed by Paul Moore; :issue:`2439`.)" @@ -4022,13 +4541,14 @@ msgstr "(Contributed by Paul Moore; :issue:`2439`.)" #: ../../whatsnew/2.6.rst:2238 msgid "" -"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting their :" -"attr:`buffer_size` attribute to change the size of the buffer used to hold " -"character data. (Contributed by Achim Gaedke; :issue:`1137`.)" +"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting " +"their :attr:`buffer_size` attribute to change the size of the buffer used to " +"hold character data. (Contributed by Achim Gaedke; :issue:`1137`.)" msgstr "" -":mod:`pyexpat` モジュールの :class:`Parser` オブジェクトで、 :attr:" -"`buffer_size` 属性の設定により文字データの保持に使うバッファのサイズを変更出" -"来るようになりました。 (Contributed by Achim Gaedke; :issue:`1137`.)" +":mod:`pyexpat` モジュールの :class:`Parser` オブジェクト" +"で、 :attr:`buffer_size` 属性の設定により文字データの保持に使うバッファのサイ" +"ズを変更出来るようになりました。 (Contributed by Achim " +"Gaedke; :issue:`1137`.)" #: ../../whatsnew/2.6.rst:2243 msgid "" @@ -4055,8 +4575,8 @@ msgstr "" ":mod:`random` モジュールの :class:`Random` が、今では 32 ビットシステムで " "pickle 出来、64 ビットシステムで unpickle 出来、逆も出来ます。残念ながらこの" "変更は Python 2.6 の :class:`Random` オブジェクトを以前の Python で正しく " -"unpickle 出来ないことを意味します。 (Contributed by Shawn Ligocki; :issue:" -"`1727780`.)" +"unpickle 出来ないことを意味します。 (Contributed by Shawn " +"Ligocki; :issue:`1727780`.)" #: ../../whatsnew/2.6.rst:2257 msgid "" @@ -4107,15 +4627,16 @@ msgstr "" #: ../../whatsnew/2.6.rst:2280 msgid "" -"The :mod:`sched` module's :class:`scheduler` instances now have a read-only :" -"attr:`queue` attribute that returns the contents of the scheduler's queue, " -"represented as a list of named tuples with the fields ``(time, priority, " -"action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.)" +"The :mod:`sched` module's :class:`scheduler` instances now have a read-" +"only :attr:`queue` attribute that returns the contents of the scheduler's " +"queue, represented as a list of named tuples with the fields ``(time, " +"priority, action, argument)``. (Contributed by Raymond " +"Hettinger; :issue:`1861`.)" msgstr "" -":mod:`sched` モジュールの :class:`scheduler` インスタンスが読み出し専用の :" -"attr:`queue` 属性を持つようになりました。これはスケジューラのキュー内容を名前" -"付きタプル ``(time, priority, action, argument)`` で返します。 (Contributed " -"by Raymond Hettinger; :issue:`1861`.)" +":mod:`sched` モジュールの :class:`scheduler` インスタンスが読み出し専用" +"の :attr:`queue` 属性を持つようになりました。これはスケジューラのキュー内容を" +"名前付きタプル ``(time, priority, action, argument)`` で返します。 " +"(Contributed by Raymond Hettinger; :issue:`1861`.)" #: ../../whatsnew/2.6.rst:2286 msgid "" @@ -4148,18 +4669,19 @@ msgid "" "example copies a directory tree, but skips both :file:`.svn` directories and " "Emacs backup files, which have names ending with '~'::" msgstr "" -":mod:`shutil` モジュールでは同時に、この新たなパラメータのために使える :func:" -"`ignore_patterns` も提供しています。 :func:`ignore_patterns` は任意の数の " -"glob スタイルのパターンを取り、これらパターンに合致する任意のファイルとディレ" -"クトリを無視する呼び出し可能オブジェクトを返します。以下は、 :file:`.svn` " -"ディレクトリと '~' で終わるファイル名を持つ Emacs のバックアップファイルをス" -"キップしてディレクトリコピーをする例です::" +":mod:`shutil` モジュールでは同時に、この新たなパラメータのために使え" +"る :func:`ignore_patterns` も提供しています。 :func:`ignore_patterns` は任意" +"の数の glob スタイルのパターンを取り、これらパターンに合致する任意のファイル" +"とディレクトリを無視する呼び出し可能オブジェクトを返します。以下" +"は、 :file:`.svn` ディレクトリと '~' で終わるファイル名を持つ Emacs のバック" +"アップファイルをスキップしてディレクトリコピーをする例です::" -#: ../../whatsnew/2.6.rst:2307 msgid "" "shutil.copytree('Doc/library', '/tmp/library',\n" " ignore=shutil.ignore_patterns('*~', '.svn'))" msgstr "" +"shutil.copytree('Doc/library', '/tmp/library',\n" +" ignore=shutil.ignore_patterns('*~', '.svn'))" #: ../../whatsnew/2.6.rst:2310 msgid "(Contributed by Tarek Ziadé; :issue:`2663`.)" @@ -4188,11 +4710,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2322 msgid "" "Event loops will use this by opening a pipe to create two descriptors, one " -"for reading and one for writing. The writable descriptor will be passed to :" -"func:`set_wakeup_fd`, and the readable descriptor will be added to the list " -"of descriptors monitored by the event loop via :c:func:`!select` or :c:func:" -"`!poll`. On receiving a signal, a byte will be written and the main event " -"loop will be woken up, avoiding the need to poll." +"for reading and one for writing. The writable descriptor will be passed " +"to :func:`set_wakeup_fd`, and the readable descriptor will be added to the " +"list of descriptors monitored by the event loop via :c:func:`!select` " +"or :c:func:`!poll`. On receiving a signal, a byte will be written and the " +"main event loop will be woken up, avoiding the need to poll." msgstr "" #: ../../whatsnew/2.6.rst:2330 @@ -4242,8 +4764,8 @@ msgstr "" msgid "" "An implementation of the LMTP protocol (:rfc:`2033`) was also added to the " "module. LMTP is used in place of SMTP when transferring e-mail between " -"agents that don't manage a mail queue. (LMTP implemented by Leif Hedstrom; :" -"issue:`957003`.)" +"agents that don't manage a mail queue. (LMTP implemented by Leif " +"Hedstrom; :issue:`957003`.)" msgstr "" "LMTP プロトコル (:rfc:`2033`) 実装もモジュールに追加されています。LMTP はメー" "ルキューを管理しないエージェント間で e-mail を転送する際に、SMTP の代わりに使" @@ -4259,13 +4781,16 @@ msgstr "" "で得たのでないサーバから得られるいかなる知識も記憶しません。(Patch " "contributed by Bill Fenner; :issue:`829951`.)" -#: ../../whatsnew/2.6.rst:2361 msgid "" "The :mod:`socket` module now supports TIPC (https://tipc.sourceforge.net/), " "a high-performance non-IP-based protocol designed for use in clustered " "environments. TIPC addresses are 4- or 5-tuples. (Contributed by Alberto " "Bertogli; :issue:`1646`.)" msgstr "" +":mod:`socket` が、クラスター環境向けに設計された、IP を使わない高性能プロトコ" +"ル TIPC (https://tipc.sourceforge.net/) に対応しました。\n" +"TIPC アドレスは 4 要素または 5 要素のタプルです。\n" +"(Alberto Bertogli による貢献です。:issue:`1646`。)" #: ../../whatsnew/2.6.rst:2366 msgid "" @@ -4279,21 +4804,29 @@ msgstr "" "新規の :func:`create_connection` 関数はアドレスを取り、省略可能なタイムアウト" "値を使って接続を行い、接続されたソケットオブジェクトを返します。この関数は同" "時に、アドレスのタイプを調べて IPv4 と IPv6 の相応しい方を使って接続します。" -"あなたのコードが ``socket(socket.AF_INET, ...)`` を使う代わりに :func:" -"`create_connection` に乗り換えることは、それが IPv6 対応で必要なこと全て、と" -"なるでしょう。" +"あなたのコードが ``socket(socket.AF_INET, ...)`` を使う代わり" +"に :func:`create_connection` に乗り換えることは、それが IPv6 対応で必要なこと" +"全て、となるでしょう。" -#: ../../whatsnew/2.6.rst:2374 msgid "" "The base classes in the :mod:`SocketServer ` module now " "support calling a :meth:`~socketserver.BaseServer.handle_timeout` method " -"after a span of inactivity specified by the server's :attr:`~socketserver." -"BaseServer.timeout` attribute. (Contributed by Michael Pomraning.) The :" -"meth:`~socketserver.BaseServer.serve_forever` method now takes an optional " -"poll interval measured in seconds, controlling how often the server will " -"check for a shutdown request. (Contributed by Pedro Werneck and Jeffrey " -"Yasskin; :issue:`742598`, :issue:`1193577`.)" -msgstr "" +"after a span of inactivity specified by the " +"server's :attr:`~socketserver.BaseServer.timeout` attribute. (Contributed " +"by Michael Pomraning.) The :meth:`~socketserver.BaseServer.serve_forever` " +"method now takes an optional poll interval measured in seconds, controlling " +"how often the server will check for a shutdown request. (Contributed by " +"Pedro Werneck and Jeffrey Yasskin; :issue:`742598`, :issue:`1193577`.)" +msgstr "" +":mod:`SocketServer ` の基底クラスは、サーバー" +"の :attr:`~socketserver.BaseServer.timeout` が指定する時間だけ活動がない" +"と、:meth:`~socketserver.BaseServer.handle_timeout` を呼ぶようになりまし" +"た。\n" +"(Michael Pomraning による貢献です。)\n" +":meth:`~socketserver.BaseServer.serve_forever` には秒単位のポーリング間隔を指" +"定する省略可能な引数が加わり、終了要求を確認する頻度を制御できます。\n" +"(Pedro Werneck と Jeffrey Yasskin による貢献で" +"す。:issue:`742598`、:issue:`1193577`。)" #: ../../whatsnew/2.6.rst:2383 msgid "" @@ -4303,36 +4836,46 @@ msgstr "" "Gerhard Häring により保守されている :mod:`sqlite3` モジュールが、Python 2.5 " "時のバージョン 2.3.2 からバージョン 2.4.1 に更新されました。" -#: ../../whatsnew/2.6.rst:2387 msgid "" "The :mod:`struct` module now supports the C99 :c:expr:`_Bool` type, using " "the format character ``'?'``. (Contributed by David Remahl.)" msgstr "" +":mod:`struct` が、書式文字 ``'?'`` で C99 の :c:expr:`_Bool` 型に対応しまし" +"た。\n" +"(David Remahl による貢献です。)" -#: ../../whatsnew/2.6.rst:2391 msgid "" "The :class:`~subprocess.Popen` objects provided by the :mod:`subprocess` " -"module now have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess." -"Popen.kill`, and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :" -"meth:`!send_signal` only supports the :py:const:`~signal.SIGTERM` signal, " -"and all these methods are aliases for the Win32 API function :c:func:`!" +"module now " +"have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess.Popen.kill`, " +"and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :meth:`!" +"send_signal` only supports the :py:const:`~signal.SIGTERM` signal, and all " +"these methods are aliases for the Win32 API function :c:func:`!" "TerminateProcess`. (Contributed by Christian Heimes.)" msgstr "" +":mod:`subprocess` の :class:`~subprocess.Popen` " +"に、:meth:`~subprocess.Popen.terminate`、:meth:`~subprocess.Popen.kill`、:meth:`~subprocess.Popen.send_signal` " +"メソッドが加わりました。\n" +"Windows の :meth:`!send_signal` が対応するシグナル" +"は :py:const:`~signal.SIGTERM` だけで、これらはすべて Win32 API の :c:func:`!" +"TerminateProcess` に相当します。\n" +"(Christian Heimes による貢献です。)" #: ../../whatsnew/2.6.rst:2398 msgid "" "A new variable in the :mod:`sys` module, :attr:`float_info`, is an object " "containing information derived from the :file:`float.h` file about the " -"platform's floating-point support. Attributes of this object include :attr:" -"`mant_dig` (number of digits in the mantissa), :attr:`epsilon` (smallest " -"difference between 1.0 and the next largest value representable), and " -"several others. (Contributed by Christian Heimes; :issue:`1534`.)" -msgstr "" -":mod:`sys` モジュールに新たに追加された変数 :attr:`float_info` は、 :file:" -"`float.h` に由来するプラットフォームの浮動小数点数サポートについての情報を含" -"んだオブジェクトです。このオブジェクトの属性としては、 :attr:`mant_dig` (仮数" -"部の桁数)、 :attr:`epsilon` (1.0 と、それより大きい表現可能な最小値との差)な" -"どがあります。 (Contributed by Christian Heimes; :issue:`1534`.)" +"platform's floating-point support. Attributes of this object " +"include :attr:`mant_dig` (number of digits in the mantissa), :attr:`epsilon` " +"(smallest difference between 1.0 and the next largest value representable), " +"and several others. (Contributed by Christian Heimes; :issue:`1534`.)" +msgstr "" +":mod:`sys` モジュールに新たに追加された変数 :attr:`float_info` " +"は、 :file:`float.h` に由来するプラットフォームの浮動小数点数サポートについて" +"の情報を含んだオブジェクトです。このオブジェクトの属性として" +"は、 :attr:`mant_dig` (仮数部の桁数)、 :attr:`epsilon` (1.0 と、それより大き" +"い表現可能な最小値との差)などがあります。 (Contributed by Christian " +"Heimes; :issue:`1534`.)" #: ../../whatsnew/2.6.rst:2406 msgid "" @@ -4348,10 +4891,10 @@ msgstr "" "もう一つの新たな変数 :attr:`dont_write_bytecode` は Python がモジュールイン" "ポート時に :file:`.pyc` や :file:`.pyo` を作るかどうかを制御します。この変数" "が真ならば、コンパイル済みファイルは作られません。この変数は Python インタプ" -"リタを :option:`-B` スイッチ付きで起動するか環境変数 :envvar:" -"`PYTHONDONTWRITEBYTECODE` をセットすることで初期設定されます。Python コードは" -"このあとでこの変数の値を変更することで、バイトコードファイルを作るかどうかを" -"制御出来ます。 (Contributed by Neal Norwitz and Georg Brandl.)" +"リタを :option:`-B` スイッチ付きで起動するか環境変" +"数 :envvar:`PYTHONDONTWRITEBYTECODE` をセットすることで初期設定されます。" +"Python コードはこのあとでこの変数の値を変更することで、バイトコードファイルを" +"作るかどうかを制御出来ます。 (Contributed by Neal Norwitz and Georg Brandl.)" #: ../../whatsnew/2.6.rst:2417 msgid "" @@ -4361,19 +4904,19 @@ msgid "" "was executed in verbose mode, :attr:`debug` is true in debugging mode, etc. " "These attributes are all read-only. (Contributed by Christian Heimes.)" msgstr "" -"Python インタプリタに与えられたコマンドライン引数についての情報を、 ``sys." -"flags`` として利用可能な名前付きタプルで知ることが出来ます。例えば Python が" -"冗長モードで起動された場合は :attr:`verbose` 属性は真となり、デバッグモードで" -"は :attr:`debug` 属性が真、などです。これら属性は全て読み出し専用です。 " -"(Contributed by Christian Heimes.)" +"Python インタプリタに与えられたコマンドライン引数についての情報を、 " +"``sys.flags`` として利用可能な名前付きタプルで知ることが出来ます。例えば " +"Python が冗長モードで起動された場合は :attr:`verbose` 属性は真となり、デバッ" +"グモードでは :attr:`debug` 属性が真、などです。これら属性は全て読み出し専用で" +"す。 (Contributed by Christian Heimes.)" #: ../../whatsnew/2.6.rst:2425 msgid "" "A new function, :func:`getsizeof`, takes a Python object and returns the " "amount of memory used by the object, measured in bytes. Built-in objects " -"return correct results; third-party extensions may not, but can define a :" -"meth:`__sizeof__` method to return the object's size. (Contributed by Robert " -"Schuppenies; :issue:`2898`.)" +"return correct results; third-party extensions may not, but can define " +"a :meth:`__sizeof__` method to return the object's size. (Contributed by " +"Robert Schuppenies; :issue:`2898`.)" msgstr "" "新しい関数 :func:`getsizeof` が追加されました。 Python オブジェクトを受け取" "り、そのオブジェクトが利用しているメモリサイズをバイト単位で返します。\n" @@ -4388,9 +4931,9 @@ msgid "" "calling :func:`sys.getprofile` and :func:`sys.gettrace`. (Contributed by " "Georg Brandl; :issue:`1648`.)" msgstr "" -"現在動作中のプロファイラとトレーサーを、 :func:`sys.getprofile` と :func:" -"`sys.gettrace` で知ることが出来るようになりました。 (Contributed by Georg " -"Brandl; :issue:`1648`.)" +"現在動作中のプロファイラとトレーサーを、 :func:`sys.getprofile` " +"と :func:`sys.gettrace` で知ることが出来るようになりました。 (Contributed by " +"Georg Brandl; :issue:`1648`.)" #: ../../whatsnew/2.6.rst:2436 msgid "" @@ -4404,11 +4947,12 @@ msgstr "" "た。デフォルトは GNU tar です; これと違うフォーマットでファイルを開くには " "``format`` パラメータで指定します::" -#: ../../whatsnew/2.6.rst:2441 msgid "" "tar = tarfile.open(\"output.tar\", \"w\",\n" " format=tarfile.PAX_FORMAT)" msgstr "" +"tar = tarfile.open(\"output.tar\", \"w\",\n" +" format=tarfile.PAX_FORMAT)" #: ../../whatsnew/2.6.rst:2444 msgid "" @@ -4439,12 +4983,14 @@ msgstr "" msgid "(All changes contributed by Lars Gustäbel)." msgstr "(All changes contributed by Lars Gustäbel)." -#: ../../whatsnew/2.6.rst:2462 msgid "" -"An optional ``timeout`` parameter was added to the :class:`!telnetlib." -"Telnet` class constructor, specifying a timeout measured in seconds. (Added " -"by Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!" +"telnetlib.Telnet` class constructor, specifying a timeout measured in " +"seconds. (Added by Facundo Batista.)" msgstr "" +":class:`!telnetlib.Telnet` のコンストラクターに、秒単位のタイムアウトを指定す" +"る省略可能な ``timeout`` が加わりました。\n" +"(Facundo Batista が追加しました。)" #: ../../whatsnew/2.6.rst:2466 msgid "" @@ -4473,22 +5019,26 @@ msgstr "" #: ../../whatsnew/2.6.rst:2476 msgid "" "The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes " -"both work as context managers, so you can write ``with tempfile." -"NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander Belopolsky; :" -"issue:`2021`.)" +"both work as context managers, so you can write ``with " +"tempfile.NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander " +"Belopolsky; :issue:`2021`.)" msgstr "" ":class:`NamedTemporaryFile` と :class:`SpooledTemporaryFile` のともにコンテキ" "ストマネージャとして動作しますので、 ``with tempfile.NamedTemporaryFile() as " "tmp: ...`` のように書くことが出来ます。 (Contributed by Alexander " "Belopolsky; :issue:`2021`.)" -#: ../../whatsnew/2.6.rst:2481 msgid "" "The :mod:`test.test_support ` module gained a number of " -"context managers useful for writing tests. :func:`~test.support.os_helper." -"EnvironmentVarGuard` is a context manager that temporarily changes " -"environment variables and automatically restores them to their old values." +"context managers useful for writing " +"tests. :func:`~test.support.os_helper.EnvironmentVarGuard` is a context " +"manager that temporarily changes environment variables and automatically " +"restores them to their old values." msgstr "" +":mod:`test.test_support ` に、テストに便利なコンテキストマネー" +"ジャーが加わりました。\n" +":func:`~test.support.os_helper.EnvironmentVarGuard` は、環境変数を一時的に変" +"更し、自動的に元へ戻すコンテキストマネージャーです。" #: ../../whatsnew/2.6.rst:2487 msgid "" @@ -4509,13 +5059,16 @@ msgstr "" "す。---)。例えば、ネットワークのテストでは外部のウェブサイトとの接続時の特定" "の失敗を無視するでしょう::" -#: ../../whatsnew/2.6.rst:2493 msgid "" "with test_support.TransientResource(IOError,\n" " errno=errno.ETIMEDOUT):\n" " f = urllib.urlopen('https://sf.net')\n" " ..." msgstr "" +"with test_support.TransientResource(IOError,\n" +" errno=errno.ETIMEDOUT):\n" +" f = urllib.urlopen('https://sf.net')\n" +" ..." #: ../../whatsnew/2.6.rst:2498 msgid "" @@ -4527,7 +5080,6 @@ msgstr "" "リセットして、全ての引き起こされる警告メッセージを記録するオブジェクトを返し" "ます (:issue:`3781`)::" -#: ../../whatsnew/2.6.rst:2502 msgid "" "with test_support.check_warnings() as wrec:\n" " warnings.simplefilter(\"always\")\n" @@ -4535,19 +5087,24 @@ msgid "" " assert str(wrec.message) == \"function is outdated\"\n" " assert len(wrec.warnings) == 1, \"Multiple warnings raised\"" msgstr "" +"with test_support.check_warnings() as wrec:\n" +" warnings.simplefilter(\"always\")\n" +" # ... 警告を発生させるコード ...\n" +" assert str(wrec.message) == \"function is outdated\"\n" +" assert len(wrec.warnings) == 1, \"Multiple warnings raised\"" #: ../../whatsnew/2.6.rst:2508 msgid "(Contributed by Brett Cannon.)" msgstr "(Contributed by Brett Cannon.)" -#: ../../whatsnew/2.6.rst:2510 msgid "" "The :mod:`textwrap` module can now preserve existing whitespace at the " "beginnings and ends of the newly created lines by specifying " "``drop_whitespace=False`` as an argument::" msgstr "" +":mod:`textwrap` に ``drop_whitespace=False`` を渡すと、新しく作る行の先頭と末" +"尾にある既存の空白を保持できるようになりました。 ::" -#: ../../whatsnew/2.6.rst:2515 msgid "" ">>> S = \"\"\"This sentence has a bunch of\n" "... extra whitespace.\"\"\"\n" @@ -4563,6 +5120,19 @@ msgid "" " whitespace.\n" ">>>" msgstr "" +">>> S = \"\"\"This sentence has a bunch of\n" +"... extra whitespace.\"\"\"\n" +">>> print textwrap.fill(S, width=15)\n" +"This sentence\n" +"has a bunch\n" +"of extra\n" +"whitespace.\n" +">>> print textwrap.fill(S, drop_whitespace=False, width=15)\n" +"This sentence\n" +" has a bunch\n" +" of extra\n" +" whitespace.\n" +">>>" #: ../../whatsnew/2.6.rst:2529 msgid "(Contributed by Dwayne Bailey; :issue:`1581073`.)" @@ -4570,15 +5140,15 @@ msgstr "(Contributed by Dwayne Bailey; :issue:`1581073`.)" #: ../../whatsnew/2.6.rst:2531 msgid "" -"The :mod:`threading` module API is being changed to use properties such as :" -"attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, and " -"some methods have been renamed to use underscores instead of camel-case; for " -"example, the :meth:`activeCount` method is renamed to :meth:`active_count`. " -"Both the 2.6 and 3.0 versions of the module support the same properties and " -"renamed methods, but don't remove the old methods. No date has been set for " -"the deprecation of the old APIs in Python 3.x; the old APIs won't be removed " -"in any 2.x version. (Carried out by several people, most notably Benjamin " -"Peterson.)" +"The :mod:`threading` module API is being changed to use properties such " +"as :attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, " +"and some methods have been renamed to use underscores instead of camel-case; " +"for example, the :meth:`activeCount` method is renamed " +"to :meth:`active_count`. Both the 2.6 and 3.0 versions of the module " +"support the same properties and renamed methods, but don't remove the old " +"methods. No date has been set for the deprecation of the old APIs in Python " +"3.x; the old APIs won't be removed in any 2.x version. (Carried out by " +"several people, most notably Benjamin Peterson.)" msgstr "" ":mod:`threading` モジュールの API が、 :meth:`setDaemon`, :meth:`isDaemon` メ" "ソッドではなく :attr:`daemon` のようにプロパティを使うように変更中です。ま" @@ -4593,9 +5163,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2542 msgid "" -"The :mod:`threading` module's :class:`Thread` objects gained an :attr:" -"`ident` property that returns the thread's identifier, a nonzero integer. " -"(Contributed by Gregory P. Smith; :issue:`2871`.)" +"The :mod:`threading` module's :class:`Thread` objects gained " +"an :attr:`ident` property that returns the thread's identifier, a nonzero " +"integer. (Contributed by Gregory P. Smith; :issue:`2871`.)" msgstr "" ":mod:`threading` モジュールの :class:`Thread` オブジェクトに :attr:`ident` プ" "ロパティが追加されています。スレッドの識別子を非ゼロの整数で返します。 " @@ -4607,12 +5177,12 @@ msgid "" "statement being timed and for the setup code. Two convenience functions were " "added for creating :class:`Timer` instances: ``repeat(stmt, setup, time, " "repeat, number)`` and ``timeit(stmt, setup, time, number)`` create an " -"instance and call the corresponding method. (Contributed by Erik Demaine; :" -"issue:`1533909`.)" +"instance and call the corresponding method. (Contributed by Erik " +"Demaine; :issue:`1533909`.)" msgstr "" ":mod:`timeit` モジュールが、計測されるステートメントとセットアップコードとし" -"て、文字列だけでなく呼び出し可能オブジェクトを渡せるようになりました。 :" -"class:`Timer` インスタンスを作成する 2 つの便利関数が追加されています: " +"て、文字列だけでなく呼び出し可能オブジェクトを渡せるようになりまし" +"た。 :class:`Timer` インスタンスを作成する 2 つの便利関数が追加されています: " "``repeat(stmt, setup, time, repeat, number)`` と ``timeit(stmt, setup, time, " "number)`` で、インスタンスを作成して対応するメソッドを呼びます。 " "(Contributed by Erik Demaine; :issue:`1533909`.)" @@ -4740,14 +5310,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2607 msgid "" -"The XML-RPC :class:`SimpleXMLRPCServer ` and :class:" -"`DocXMLRPCServer ` classes can now be prevented from " -"immediately opening and binding to their socket by passing ``False`` as the " -"*bind_and_activate* constructor parameter. This can be used to modify the " -"instance's :attr:`allow_reuse_address` attribute before calling the :meth:" -"`server_bind` and :meth:`server_activate` methods to open the socket and " -"begin listening for connections. (Contributed by Peter Parente; :issue:" -"`1599845`.)" +"The XML-RPC :class:`SimpleXMLRPCServer ` " +"and :class:`DocXMLRPCServer ` classes can now be prevented " +"from immediately opening and binding to their socket by passing ``False`` as " +"the *bind_and_activate* constructor parameter. This can be used to modify " +"the instance's :attr:`allow_reuse_address` attribute before calling " +"the :meth:`server_bind` and :meth:`server_activate` methods to open the " +"socket and begin listening for connections. (Contributed by Peter " +"Parente; :issue:`1599845`.)" msgstr "" #: ../../whatsnew/2.6.rst:2616 @@ -4771,14 +5341,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2624 msgid "" "The :mod:`xmlrpclib ` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime ` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`) The code can also handle dates before 1900 " -"(contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented " -"by using ```` in XML-RPC responses (contributed by Riku Lindblad; :issue:" -"`2985`)." +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime ` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also " +"handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-" +"bit integers represented by using ```` in XML-RPC responses (contributed " +"by Riku Lindblad; :issue:`2985`)." msgstr "" #: ../../whatsnew/2.6.rst:2634 @@ -4792,7 +5362,6 @@ msgstr "" "一ファイル、全てのファイルを、カレントディレクトリか指定のディレクトリに展開" "します::" -#: ../../whatsnew/2.6.rst:2639 msgid "" "z = zipfile.ZipFile('python-251.zip')\n" "\n" @@ -4803,6 +5372,14 @@ msgid "" "# Unpack all the files in the archive.\n" "z.extractall()" msgstr "" +"z = zipfile.ZipFile('python-251.zip')\n" +"\n" +"# 単一のファイルを /tmp ディレクトリからの\n" +"# 相対パスへ展開する。\n" +"z.extract('Python/sysmodule.c', '/tmp')\n" +"\n" +"# アーカイブのすべてのファイルを展開する。\n" +"z.extractall()" #: ../../whatsnew/2.6.rst:2648 msgid "(Contributed by Alan McIntyre; :issue:`467924`.)" @@ -4815,10 +5392,10 @@ msgid "" "archive accidentally contains a duplicated filename. (Contributed by Graham " "Horler; :issue:`1775025`.)" msgstr "" -":meth:`open`, :meth:`read`, :meth:`extract` メソッドはファイル名か :class:" -"`ZipInfo` オブジェクトのどちらかを受け取れるようになっています。これは誤って" -"重複したファイル名を含んでいるアーカイブで有用でしょう。 (Contributed by " -"Graham Horler; :issue:`1775025`.)" +":meth:`open`, :meth:`read`, :meth:`extract` メソッドはファイル名" +"か :class:`ZipInfo` オブジェクトのどちらかを受け取れるようになっています。こ" +"れは誤って重複したファイル名を含んでいるアーカイブで有用でしょう。 " +"(Contributed by Graham Horler; :issue:`1775025`.)" #: ../../whatsnew/2.6.rst:2655 msgid "" @@ -4826,10 +5403,10 @@ msgid "" "files. (Contributed by Alexey Borzenkov; :issue:`1734346`.)" msgstr "" "最後に、 :mod:`zipfile` がアーカイブするファイルのファイル名として Unicode の" -"使用をサポートするようになりました。 (Contributed by Alexey Borzenkov; :" -"issue:`1734346`.) (---訳注: リファレンスに注意事項として書かれていますが、" -"zip ファイルのファイル名標準は存在しないのでこれは問題を起こすことがありま" -"す。---)" +"使用をサポートするようになりました。 (Contributed by Alexey " +"Borzenkov; :issue:`1734346`.) (---訳注: リファレンスに注意事項として書かれて" +"いますが、zip ファイルのファイル名標準は存在しないのでこれは問題を起こすこと" +"があります。---)" #: ../../whatsnew/2.6.rst:2662 msgid "The :mod:`ast` module" @@ -4849,13 +5426,13 @@ msgstr "" #: ../../whatsnew/2.6.rst:2671 msgid "" -"The :func:`parse` function takes an expression and returns an AST. The :func:" -"`dump` function outputs a representation of a tree, suitable for debugging::" +"The :func:`parse` function takes an expression and returns an AST. " +"The :func:`dump` function outputs a representation of a tree, suitable for " +"debugging::" msgstr "" ":func:`parse` 関数は式を受け取り AST を返します。 :func:`dump` 関数はツリー表" "現をデバッギングに相応しい出力をします::" -#: ../../whatsnew/2.6.rst:2675 msgid "" "import ast\n" "\n" @@ -4867,12 +5444,20 @@ msgid "" "\"\"\")\n" "print ast.dump(t)" msgstr "" +"import ast\n" +"\n" +"t = ast.parse(\"\"\"\n" +"d = {}\n" +"for i in 'abcdefghijklm':\n" +" d[i + i] = ord(i) - ord('a') + 1\n" +"print d\n" +"\"\"\")\n" +"print ast.dump(t)" #: ../../whatsnew/2.6.rst:2685 msgid "This outputs a deeply nested tree::" msgstr "これの出力は深くネストされたツリーです::" -#: ../../whatsnew/2.6.rst:2687 msgid "" "Module(body=[\n" " Assign(targets=[\n" @@ -4905,6 +5490,36 @@ msgid "" " ], nl=True)\n" " ])" msgstr "" +"Module(body=[\n" +" Assign(targets=[\n" +" Name(id='d', ctx=Store())\n" +" ], value=Dict(keys=[], values=[]))\n" +" For(target=Name(id='i', ctx=Store()),\n" +" iter=Str(s='abcdefghijklm'), body=[\n" +" Assign(targets=[\n" +" Subscript(value=\n" +" Name(id='d', ctx=Load()),\n" +" slice=\n" +" Index(value=\n" +" BinOp(left=Name(id='i', ctx=Load()), op=Add(),\n" +" right=Name(id='i', ctx=Load()))), ctx=Store())\n" +" ], value=\n" +" BinOp(left=\n" +" BinOp(left=\n" +" Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Name(id='i', ctx=Load())\n" +" ], keywords=[], starargs=None, kwargs=None),\n" +" op=Sub(), right=Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Str(s='a')\n" +" ], keywords=[], starargs=None, kwargs=None)),\n" +" op=Add(), right=Num(n=1)))\n" +" ], orelse=[])\n" +" Print(dest=None, values=[\n" +" Name(id='d', ctx=Load())\n" +" ], nl=True)\n" +" ])" #: ../../whatsnew/2.6.rst:2718 msgid "" @@ -4922,7 +5537,6 @@ msgstr "" "リスクを許容出来ないということであれば、 :func:`literal_eval` がそれを安全に" "処理してくれます::" -#: ../../whatsnew/2.6.rst:2726 msgid "" ">>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n" ">>> print ast.literal_eval(literal)\n" @@ -4932,6 +5546,13 @@ msgid "" " ...\n" "ValueError: malformed string" msgstr "" +">>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n" +">>> print ast.literal_eval(literal)\n" +"('a', 'b', {1: 2, 2: 4, 3: 8})\n" +">>> print ast.literal_eval('\"a\" + \"b\"')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed string" #: ../../whatsnew/2.6.rst:2734 msgid "" @@ -4939,9 +5560,9 @@ msgid "" "classes for traversing and modifying an AST, and functions for common " "transformations such as changing line numbers." msgstr "" -"モジュールには、AST を横断し、修正するための :class:`NodeVisitor` と :class:" -"`NodeTransformer` クラス、例えば行番号の変更などの共通的な変形を行う関数群が" -"含まれています。" +"モジュールには、AST を横断し、修正するための :class:`NodeVisitor` " +"と :class:`NodeTransformer` クラス、例えば行番号の変更などの共通的な変形を行" +"う関数群が含まれています。" #: ../../whatsnew/2.6.rst:2742 msgid "The :mod:`future_builtins` module" @@ -4956,9 +5577,9 @@ msgid "" "compatible code." msgstr "" "Python 3.0 はビルトイン関数のレポジトリにたくさんの変更を加えていて、そのほと" -"んどが互換性を破壊するため Python 2.x シリーズには導入出来ません。 :mod:" -"`future_builtins` モジュールは 3.0 互換コードを書くのにインポート出来る 3.0 " -"互換関数セットです。" +"んどが互換性を破壊するため Python 2.x シリーズには導入出来ませ" +"ん。 :mod:`future_builtins` モジュールは 3.0 互換コードを書くのにインポート出" +"来る 3.0 互換関数セットです。" #: ../../whatsnew/2.6.rst:2751 msgid "The functions in this module currently include:" @@ -4970,9 +5591,9 @@ msgid "" "will return a Unicode string, while :func:`ascii` will return a pure ASCII " "bytestring." msgstr "" -"``ascii(obj)``: 2.x の :func:`repr` と同じことをします。Python 3.0 では :" -"func:`repr` は Unicode 文字列を返すようになっていて、一方 :func:`ascii` は純" -"粋な ASCII バイト文字列を返します。" +"``ascii(obj)``: 2.x の :func:`repr` と同じことをします。Python 3.0 で" +"は :func:`repr` は Unicode 文字列を返すようになっていて、一方 :func:`ascii` " +"は純粋な ASCII バイト文字列を返します。" #: ../../whatsnew/2.6.rst:2757 msgid "" @@ -4985,8 +5606,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2761 msgid "" -"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` or :" -"meth:`__oct__` methods, these versions will call the :meth:`__index__` " +"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` " +"or :meth:`__oct__` methods, these versions will call the :meth:`__index__` " "method and convert the result to hexadecimal or octal. :func:`oct` will use " "the new ``0o`` notation for its result." msgstr "" @@ -5020,7 +5641,6 @@ msgstr "" "ングサポートを備えています。以下の例は辞書のエンコードとデコードをしていま" "す::" -#: ../../whatsnew/2.6.rst:2780 msgid "" ">>> import json\n" ">>> data = {\"spam\": \"foo\", \"parrot\": 42}\n" @@ -5030,6 +5650,13 @@ msgid "" ">>> json.loads(in_json) # Decode into a Python object\n" "{\"spam\": \"foo\", \"parrot\": 42}" msgstr "" +">>> import json\n" +">>> data = {\"spam\": \"foo\", \"parrot\": 42}\n" +">>> in_json = json.dumps(data) # データをエンコード\n" +">>> in_json\n" +"'{\"parrot\": 42, \"spam\": \"foo\"}'\n" +">>> json.loads(in_json) # Python オブジェクトへデコード\n" +"{\"spam\": \"foo\", \"parrot\": 42}" #: ../../whatsnew/2.6.rst:2788 msgid "" @@ -5128,16 +5755,16 @@ msgstr "" #: ../../whatsnew/2.6.rst:2853 msgid "" -"All :mod:`ctypes` data types now support :meth:`from_buffer` and :meth:" -"`from_buffer_copy` methods that create a ctypes instance based on a provided " -"buffer object. :meth:`from_buffer_copy` copies the contents of the object, " -"while :meth:`from_buffer` will share the same memory area." +"All :mod:`ctypes` data types now support :meth:`from_buffer` " +"and :meth:`from_buffer_copy` methods that create a ctypes instance based on " +"a provided buffer object. :meth:`from_buffer_copy` copies the contents of " +"the object, while :meth:`from_buffer` will share the same memory area." msgstr "" -"全ての :mod:`ctypes` データ型が :meth:`from_buffer`, :meth:" -"`from_buffer_copy` メソッドをサポートするようになりました。これは与えられた " -"buffer オブジェクトに基く ctypes インスタンスを作ります。 :meth:" -"`from_buffer_copy` はそのオブジェクトの内容をコピーし、 :meth:`from_buffer` " -"はその同じメモリ領域を共有します。" +"全ての :mod:`ctypes` データ型" +"が :meth:`from_buffer`, :meth:`from_buffer_copy` メソッドをサポートするように" +"なりました。これは与えられた buffer オブジェクトに基く ctypes インスタンスを" +"作ります。 :meth:`from_buffer_copy` はそのオブジェクトの内容をコピー" +"し、 :meth:`from_buffer` はその同じメモリ領域を共有します。" #: ../../whatsnew/2.6.rst:2860 msgid "" @@ -5159,13 +5786,13 @@ msgid "" msgstr "" "Unix ``errno`` 変数を関数呼び出し後に抽出できるようになっています。ラップされ" "た関数を作る際、 ``use_errno=True`` を :func:`DLL` 関数へのキーワード引数とし" -"て渡すことが出来、それによりモジュールレベル関数の :meth:`set_errno` と :" -"meth:`get_errno` を、 errno 値を設定・取得するのに呼び出せます。" +"て渡すことが出来、それによりモジュールレベル関数の :meth:`set_errno` " +"と :meth:`get_errno` を、 errno 値を設定・取得するのに呼び出せます。" #: ../../whatsnew/2.6.rst:2870 msgid "" -"The Win32 LastError variable is similarly supported by the :func:`DLL`, :" -"func:`OleDLL`, and :func:`WinDLL` functions. You supply " +"The Win32 LastError variable is similarly supported by " +"the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions. You supply " "``use_last_error=True`` as a keyword parameter and then call the module-" "level methods :meth:`set_last_error` and :meth:`get_last_error`." msgstr "" @@ -5215,8 +5842,8 @@ msgstr "" "この新たなモジュールを使うには、まず最初にいつものやり方で TCP コネクションを" "作らなければなりません。そしてその上でそれを :func:`ssl.wrap_socket` 関数に渡" "します (---訳注: 2.7.9 ではさらに進化した ``SSLContext.wrap_socket`` が使えま" -"す ---)。証明書が必要かどうかを指定することが出来、証明書の情報を :meth:" -"`getpeercert` メソッドで取得することも出来ます。" +"す ---)。証明書が必要かどうかを指定することが出来、証明書の情報" +"を :meth:`getpeercert` メソッドで取得することも出来ます。" #: ../../whatsnew/2.6.rst:2901 msgid "The documentation for the :mod:`ssl` module." @@ -5228,18 +5855,21 @@ msgstr "非推奨と削除" #: ../../whatsnew/2.6.rst:2908 ../../whatsnew/2.6.rst:3262 msgid "" -"String exceptions have been removed. Attempting to use them raises a :exc:" -"`TypeError`." +"String exceptions have been removed. Attempting to use them raises " +"a :exc:`TypeError`." msgstr "" -"文字列を例外として送出することは出来なくなりました。これをすると :exc:" -"`TypeError` を起こします。" +"文字列を例外として送出することは出来なくなりました。これをする" +"と :exc:`TypeError` を起こします。" -#: ../../whatsnew/2.6.rst:2911 msgid "" "Changes to the :class:`Exception` interface as dictated by :pep:`352` " "continue to be made. For 2.6, the :attr:`!message` attribute is being " "deprecated in favor of the :attr:`~BaseException.args` attribute." msgstr "" +":pep:`352` に従った :class:`Exception` のインターフェースの変更が続いていま" +"す。\n" +"2.6 では :attr:`!message` が非推奨となり、代わり" +"に :attr:`~BaseException.args` を使います。" #: ../../whatsnew/2.6.rst:2916 msgid "" @@ -5251,60 +5881,70 @@ msgstr "" "ものも名前変更するような標準ライブラリの再編成が特色となります。Python 2.6 " "を 3.0 警告モードで動かすと、それらがインポートされる際に警告が励起されます。" -#: ../../whatsnew/2.6.rst:2921 msgid "" -"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!bgenlocations`, :" -"mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!Canvas`, :mod:`!compiler`, :" -"mod:`!dircache`, :mod:`!dl`, :mod:`!fpformat`, :mod:`!gensuitemodule`, :mod:" -"`!ihooks`, :mod:`!imageop`, :mod:`!imgfile`, :mod:`!linuxaudiodev`, :mod:`!" -"mhlib`, :mod:`!mimetools`, :mod:`!multifile`, :mod:`!new`, :mod:`!pure`, :" -"mod:`!statvfs`, :mod:`!sunaudiodev`, :mod:`!test.testall`, and :mod:`!" -"toaiff`." +"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!" +"bgenlocations`, :mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!" +"Canvas`, :mod:`!compiler`, :mod:`!dircache`, :mod:`!dl`, :mod:`!" +"fpformat`, :mod:`!gensuitemodule`, :mod:`!ihooks`, :mod:`!imageop`, :mod:`!" +"imgfile`, :mod:`!linuxaudiodev`, :mod:`!mhlib`, :mod:`!mimetools`, :mod:`!" +"multifile`, :mod:`!new`, :mod:`!pure`, :mod:`!statvfs`, :mod:`!" +"sunaudiodev`, :mod:`!test.testall`, and :mod:`!toaiff`." msgstr "" +"非推奨となるモジュールは次のとおりです: :mod:`!audiodev`, :mod:`!" +"bgenlocations`, :mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!" +"Canvas`, :mod:`!compiler`, :mod:`!dircache`, :mod:`!dl`, :mod:`!" +"fpformat`, :mod:`!gensuitemodule`, :mod:`!ihooks`, :mod:`!imageop`, :mod:`!" +"imgfile`, :mod:`!linuxaudiodev`, :mod:`!mhlib`, :mod:`!mimetools`, :mod:`!" +"multifile`, :mod:`!new`, :mod:`!pure`, :mod:`!statvfs`, :mod:`!" +"sunaudiodev`, :mod:`!test.testall`, と :mod:`!toaiff`." -#: ../../whatsnew/2.6.rst:2946 msgid "The :mod:`!gopherlib` module has been removed." -msgstr "" +msgstr ":mod:`!gopherlib` モジュールが削除されました。" -#: ../../whatsnew/2.6.rst:2948 msgid "" "The :mod:`!MimeWriter` module and :mod:`!mimify` module have been " "deprecated; use the :mod:`email` package instead." msgstr "" +":mod:`!MimeWriter` と :mod:`!mimify` が非推奨となりました。\n" +"代わりに :mod:`email` を使ってください。" -#: ../../whatsnew/2.6.rst:2952 msgid "" "The :mod:`!md5` module has been deprecated; use the :mod:`hashlib` module " "instead." msgstr "" +":mod:`!md5` が非推奨となりました。\n" +"代わりに :mod:`hashlib` を使ってください。" -#: ../../whatsnew/2.6.rst:2955 msgid "" "The :mod:`!posixfile` module has been deprecated; :func:`fcntl.lockf` " "provides better locking." msgstr "" +":mod:`!posixfile` が非推奨となりました。\n" +":func:`fcntl.lockf` がより適切なロックを提供します。" -#: ../../whatsnew/2.6.rst:2958 msgid "" "The :mod:`!popen2` module has been deprecated; use the :mod:`subprocess` " "module." msgstr "" +":mod:`!popen2` が非推奨となりました。\n" +":mod:`subprocess` を使ってください。" -#: ../../whatsnew/2.6.rst:2961 msgid "The :mod:`!rgbimg` module has been removed." -msgstr "" +msgstr ":mod:`!rgbimg` モジュールが削除されました。" -#: ../../whatsnew/2.6.rst:2963 msgid "" "The :mod:`!sets` module has been deprecated; it's better to use the built-" "in :class:`set` and :class:`frozenset` types." msgstr "" +":mod:`!sets` が非推奨となりました。\n" +"組み込みの :class:`set` と :class:`frozenset` を使う方がよいでしょう。" -#: ../../whatsnew/2.6.rst:2966 msgid "" "The :mod:`!sha` module has been deprecated; use the :mod:`hashlib` module " "instead." msgstr "" +":mod:`!sha` が非推奨となりました。\n" +"代わりに :mod:`hashlib` を使ってください。" #: ../../whatsnew/2.6.rst:2974 msgid "Build and C API Changes" @@ -5314,13 +5954,16 @@ msgstr "ビルドならびに C API の変更" msgid "Changes to Python's build process and to the C API include:" msgstr "Python のビルド過程と C API の変更は以下の通りです:" -#: ../../whatsnew/2.6.rst:2978 msgid "" "Python now must be compiled with C89 compilers (after 19 years!). This " -"means that the Python source tree has dropped its own implementations of :c:" -"func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " +"means that the Python source tree has dropped its own implementations " +"of :c:func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " "library." msgstr "" +"Python のコンパイルには C89 コンパイラーが必須になりました (19 年を経て、よう" +"やくです!)。\n" +"そのため、C89 標準ライブラリに含まれる :c:func:`!memmove` と :c:func:`!" +"strerror` の独自実装が Python のソースツリーから削除されました。" #: ../../whatsnew/2.6.rst:2983 msgid "" @@ -5334,11 +5977,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2988 msgid "" -"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. The :" -"program:`configure` script can take a :option:`!--with-universal-archs=[32-" -"bit|64-bit|all]` switch, controlling whether the binaries are built for 32-" -"bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both. " -"(Contributed by Ronald Oussoren.)" +"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. " +"The :program:`configure` script can take a :option:`!--with-universal-" +"archs=[32-bit|64-bit|all]` switch, controlling whether the binaries are " +"built for 32-bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), " +"or both. (Contributed by Ronald Oussoren.)" msgstr "" "Mac OS X では、Python 2.6 は 4 種類のユニバーサルビルドでコンパイル出来ま" "す。 :program:`configure` スクリプトは :option:`!--with-universal-archs=[32-" @@ -5346,15 +5989,16 @@ msgstr "" "bit (x86-64 and PPC-64), あるいは両方のバイナリをビルド出来ます。 " "(Contributed by Ronald Oussoren.)" -#: ../../whatsnew/2.6.rst:2995 msgid "" "A new function added in Python 2.6.6, :c:func:`!PySys_SetArgvEx`, sets the " "value of ``sys.argv`` and can optionally update ``sys.path`` to include the " "directory containing the script named by ``sys.argv[0]`` depending on the " "value of an *updatepath* parameter." msgstr "" +"Python 2.6.6 で追加された :c:func:`!PySys_SetArgvEx` は ``sys.argv`` を設定" +"し、*updatepath* の値に応じて、``sys.argv[0]`` が示すスクリプトのディレクトリ" +"を ``sys.path`` に追加することもできます。" -#: ../../whatsnew/2.6.rst:3000 msgid "" "This function was added to close a security hole for applications that embed " "Python. The old function, :c:func:`!PySys_SetArgv`, would always update " @@ -5364,8 +6008,15 @@ msgid "" "(say, a file named :file:`os.py`) that your application would then import " "and run." msgstr "" +"この関数は、Python を組み込むアプリケーションのセキュリティホールを塞ぐために" +"追加されました。\n" +"従来の :c:func:`!PySys_SetArgv` は常に ``sys.path`` を更新し、現在のディレク" +"トリを追加する場合がありました。\n" +"そのため、他人が管理するディレクトリで Python を組み込んだアプリケーションを" +"実行すると、攻撃者がそこへトロイの木馬のようなモジュール (例え" +"ば :file:`os.py`) を置き、アプリケーションにインポート・実行させることができ" +"ました。" -#: ../../whatsnew/2.6.rst:3008 msgid "" "If you maintain a C/C++ application that embeds Python, check whether you're " "calling :c:func:`!PySys_SetArgv` and carefully consider whether the " @@ -5376,22 +6027,32 @@ msgid "" "and call ``PyRun_SimpleString(\"sys.path.pop(0)\\n\")`` afterwards to " "discard the first ``sys.path`` component." msgstr "" +"Python を組み込む C/C++ アプリケーションの保守担当者は、:c:func:`!" +"PySys_SetArgv` を呼んでいるか確認し、*updatepath* を偽にした :c:func:`!" +"PySys_SetArgvEx` を使うべきか慎重に検討してください。\n" +"ただし、この関数を使うと Python 2.6.5 以前との互換性がなくなります。\n" +"以前のバージョンにも対応する必要があれば、:c:func:`!PySys_SetArgv` はそのまま" +"にし、その後 ``PyRun_SimpleString(\"sys.path.pop(0)\\n\")`` を呼んで " +"``sys.path`` の先頭要素を取り除けます。" -#: ../../whatsnew/2.6.rst:3018 msgid "" "Security issue reported as :cve:`2008-5983`; discussed in :gh:`50003`, and " "fixed by Antoine Pitrou." msgstr "" +"このセキュリティ問題は :cve:`2008-5983` として報告され、:gh:`50003` で議論さ" +"れ、Antoine Pitrou が修正しました。" #: ../../whatsnew/2.6.rst:3021 msgid "" -"The BerkeleyDB module now has a C API object, available as ``bsddb.db." -"api``. This object can be used by other C extensions that wish to use the :" -"mod:`bsddb` module for their own purposes. (Contributed by Duncan Grisby.)" +"The BerkeleyDB module now has a C API object, available as " +"``bsddb.db.api``. This object can be used by other C extensions that wish " +"to use the :mod:`bsddb` module for their own purposes. (Contributed by " +"Duncan Grisby.)" msgstr "" -"BerkeleyDB モジュールが C API オブジェクトを公開しています。 ``bsddb.db." -"api`` として利用可能です。このモジュールは :mod:`bsddb` モジュールを自身の独" -"自の目的で使いたいほかの C 拡張で使えます。 (Contributed by Duncan Grisby.)" +"BerkeleyDB モジュールが C API オブジェクトを公開しています。 " +"``bsddb.db.api`` として利用可能です。このモジュールは :mod:`bsddb` モジュール" +"を自身の独自の目的で使いたいほかの C 拡張で使えます。 (Contributed by Duncan " +"Grisby.)" #: ../../whatsnew/2.6.rst:3026 msgid "" @@ -5403,7 +6064,6 @@ msgstr "" "前述の新しいバッファインターフェイスのために、 :c:func:`PyObject_GetBuffer` " "と :c:func:`PyBuffer_Release` とほか少しの関数が追加されました。" -#: ../../whatsnew/2.6.rst:3031 msgid "" "Python's use of the C stdio library is now thread-safe, or at least as " "thread-safe as the underlying library is. A long-standing potential bug " @@ -5417,15 +6077,26 @@ msgid "" "immediately after the GIL is re-acquired. (Contributed by Antoine Pitrou and " "Gregory P. Smith.)" msgstr "" +"Python の C stdio ライブラリの使用が、スレッドセーフになりました。\n" +"少なくとも、基盤となるライブラリと同程度にはスレッドセーフです。\n" +"これまでは、一つのスレッドがファイルオブジェクトを閉じる間に別のスレッドが読" +"み書きすると起きる潜在的なバグが、長く残っていました。\n" +"2.6 のファイルオブジェクトには、:c:func:`!PyFile_IncUseCount` と :c:func:`!" +"PyFile_DecUseCount` で操作する参照カウントがあり、ゼロでなければ閉じられませ" +"ん。\n" +"``FILE *`` で I/O を行う前、まだ GIL を保持している間に :c:func:`!" +"PyFile_IncUseCount` を呼び、GIL を再取得した直後に :c:func:`!" +"PyFile_DecUseCount` を呼ぶ必要があります。\n" +"(Antoine Pitrou と Gregory P. Smith による貢献です。)" #: ../../whatsnew/2.6.rst:3044 msgid "" "Importing modules simultaneously in two different threads no longer " -"deadlocks; it will now raise an :exc:`ImportError`. A new API function, :c:" -"func:`PyImport_ImportModuleNoBlock`, will look for a module in ``sys." -"modules`` first, then try to import it after acquiring an import lock. If " -"the import lock is held by another thread, an :exc:`ImportError` is raised. " -"(Contributed by Christian Heimes.)" +"deadlocks; it will now raise an :exc:`ImportError`. A new API " +"function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a module in " +"``sys.modules`` first, then try to import it after acquiring an import " +"lock. If the import lock is held by another thread, an :exc:`ImportError` " +"is raised. (Contributed by Christian Heimes.)" msgstr "" "異なるスレッドから同時にモジュールをインポートすることでデッドロックが発生す" "ることはなくなりました; 今では :exc:`ImportError` になります。新たな API 関" @@ -5457,8 +6128,8 @@ msgstr "" ":c:func:`PyComplex_AsCComplex` を使う C 関数とメソッドが :meth:`__complex__` " "メソッドを持つ引数を受け付けるようになっています。特に、 :mod:`cmath` モ" "ジュールにある関数は、このメソッドを持つオブジェクトを受け付けます。これは " -"Python 3.0 での変更のバックポートです。 (Contributed by Mark Dickinson; :" -"issue:`1675423`.)" +"Python 3.0 での変更のバックポートです。 (Contributed by Mark " +"Dickinson; :issue:`1675423`.)" #: ../../whatsnew/2.6.rst:3070 msgid "" @@ -5468,16 +6139,16 @@ msgid "" msgstr "" "Python C API に 2 つの大文字小文字を区別しない文字列比較関数 " "``PyOS_stricmp(char*, char*)`` と ``PyOS_strnicmp(char*, char*, " -"Py_ssize_t)`` が追加されました。 (Contributed by Christian Heimes; :issue:" -"`1635`.)" +"Py_ssize_t)`` が追加されました。 (Contributed by Christian " +"Heimes; :issue:`1635`.)" #: ../../whatsnew/2.6.rst:3075 msgid "" "Many C extensions define their own little macro for adding integers and " "strings to the module's dictionary in the ``init*`` function. Python 2.6 " -"finally defines standard macros for adding values to a module, :c:macro:" -"`PyModule_AddStringMacro` and :c:macro:`PyModule_AddIntMacro()`. " -"(Contributed by Christian Heimes.)" +"finally defines standard macros for adding values to a " +"module, :c:macro:`PyModule_AddStringMacro` " +"and :c:macro:`PyModule_AddIntMacro()`. (Contributed by Christian Heimes.)" msgstr "" "多くの C 拡張が、 ``init*`` 関数内でモジュール辞書に整数と文字列定数を追加す" "るために独自の小さなマクロを定義しています。 Python 2.6 ではついにモジュール" @@ -5485,24 +6156,31 @@ msgstr "" "と :c:macro:`PyModule_AddIntMacro()` です。 (Contributed by Christian " "Heimes.)" -#: ../../whatsnew/2.6.rst:3082 msgid "" "Some macros were renamed in both 3.0 and 2.6 to make it clearer that they " -"are macros, not functions. :c:macro:`!Py_Size()` became :c:macro:" -"`Py_SIZE()`, :c:macro:`!Py_Type()` became :c:macro:`Py_TYPE()`, and :c:macro:" -"`!Py_Refcnt()` became :c:macro:`Py_REFCNT()`. The mixed-case macros are " -"still available in Python 2.6 for backward compatibility. (:issue:`1629`)" -msgstr "" +"are macros, not functions. :c:macro:`!Py_Size()` " +"became :c:macro:`Py_SIZE()`, :c:macro:`!Py_Type()` " +"became :c:macro:`Py_TYPE()`, and :c:macro:`!Py_Refcnt()` " +"became :c:macro:`Py_REFCNT()`. The mixed-case macros are still available in " +"Python 2.6 for backward compatibility. (:issue:`1629`)" +msgstr "" +"関数ではなくマクロであることを明確にするため、3.0 と 2.6 の両方でいくつかのマ" +"クロが改名されました。\n" +":c:macro:`!Py_Size()` は :c:macro:`Py_SIZE()`、:c:macro:`!Py_Type()` " +"は :c:macro:`Py_TYPE()`、:c:macro:`!Py_Refcnt()` は :c:macro:`Py_REFCNT()` に" +"なりました。\n" +"Python 2.6 では後方互換性のため、大小文字が混在する旧名も使えます。\n" +"(:issue:`1629`)" #: ../../whatsnew/2.6.rst:3091 msgid "" "Distutils now places C extensions it builds in a different directory when " -"running on a debug version of Python. (Contributed by Collin Winter; :issue:" -"`1530959`.)" +"running on a debug version of Python. (Contributed by Collin " +"Winter; :issue:`1530959`.)" msgstr "" "Distutils は C 拡張を、デバッグバージョンの Python 実行時に別のディレクトリに" -"ビルドするようになりました。 (Contributed by Collin Winter; :issue:" -"`1530959`.)" +"ビルドするようになりました。 (Contributed by Collin " +"Winter; :issue:`1530959`.)" #: ../../whatsnew/2.6.rst:3095 msgid "" @@ -5575,7 +6253,6 @@ msgstr "" "PGO ビルドは通常ビルドに較べておよそ 10% 高速化になります。 (Contributed by " "Christian Heimes with help from Amaury Forgeot d'Arc and Martin von Löwis.)" -#: ../../whatsnew/2.6.rst:3131 msgid "" "The :mod:`msvcrt` module now supports both the normal and wide char variants " "of the console I/O API. The :func:`~msvcrt.getwch` function reads a " @@ -5583,6 +6260,12 @@ msgid "" "function. The :func:`~msvcrt.putwch` function takes a Unicode character and " "writes it to the console. (Contributed by Christian Heimes.)" msgstr "" +":mod:`msvcrt` が、コンソール I/O API の通常版とワイド文字版の両方に対応しまし" +"た。\n" +":func:`~msvcrt.getwch` と :func:`~msvcrt.getwche` はキー入力を読んで Unicode " +"値を返し、:func:`~msvcrt.putwch` は Unicode 文字を受け取ってコンソールへ書き" +"込みます。\n" +"(Christian Heimes による貢献です。)" #: ../../whatsnew/2.6.rst:3138 msgid "" @@ -5596,35 +6279,46 @@ msgstr "" #: ../../whatsnew/2.6.rst:3142 msgid "" -"The :mod:`socket` module's socket objects now have an :meth:`~socket.socket." -"ioctl` method that provides a limited interface to the :c:func:`WSAIoctl` " -"system interface." +"The :mod:`socket` module's socket objects now have " +"an :meth:`~socket.socket.ioctl` method that provides a limited interface to " +"the :c:func:`WSAIoctl` system interface." msgstr "" -#: ../../whatsnew/2.6.rst:3146 msgid "" -"The :mod:`_winreg ` module now has a function, :func:`~winreg." -"ExpandEnvironmentStrings`, that expands environment variable references such " -"as ``%NAME%`` in an input string. The handle objects provided by this " -"module now support the context protocol, so they can be used in :keyword:" -"`with` statements. (Contributed by Christian Heimes.)" +"The :mod:`_winreg ` module now has a " +"function, :func:`~winreg.ExpandEnvironmentStrings`, that expands environment " +"variable references such as ``%NAME%`` in an input string. The handle " +"objects provided by this module now support the context protocol, so they " +"can be used in :keyword:`with` statements. (Contributed by Christian Heimes.)" msgstr "" +":mod:`_winreg ` に :func:`~winreg.ExpandEnvironmentStrings` が加わ" +"り、入力文字列の ``%NAME%`` などの環境変数参照を展開できます。\n" +"このモジュールのハンドルオブジェクトはコンテキストプロトコルにも対応" +"し、:keyword:`with` 文で使えます。\n" +"(Christian Heimes による貢献です。)" -#: ../../whatsnew/2.6.rst:3153 msgid "" ":mod:`_winreg ` also has better support for x64 systems, exposing " -"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` functions, " -"which enable and disable registry reflection for 32-bit processes running on " -"64-bit systems. (:issue:`1753245`)" +"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` functions, which enable and disable " +"registry reflection for 32-bit processes running on 64-bit systems. " +"(:issue:`1753245`)" msgstr "" +":mod:`_winreg ` の x64 対応も改善さ" +"れ、:func:`~winreg.DisableReflectionKey`、:func:`~winreg.EnableReflectionKey`、:func:`~winreg.QueryReflectionKey` " +"が公開されました。\n" +"64 ビット環境で動く 32 ビットプロセスのレジストリリフレクションを有効・無効に" +"するための関数です。\n" +"(:issue:`1753245`)" -#: ../../whatsnew/2.6.rst:3159 msgid "" "The :mod:`!msilib` module's :class:`!Record` object gained :meth:`!" "GetInteger` and :meth:`!GetString` methods that return field values as an " "integer or a string. (Contributed by Floris Bruynooghe; :issue:`2125`.)" msgstr "" +":mod:`!msilib` の :class:`!Record` に、フィールド値を整数や文字列で返" +"す :meth:`!GetInteger` と :meth:`!GetString` が加わりました。\n" +"(Floris Bruynooghe による貢献です。:issue:`2125`。)" #: ../../whatsnew/2.6.rst:3167 msgid "Port-Specific Changes: Mac OS X" @@ -5640,42 +6334,63 @@ msgstr "" "リプトに :option:`!--with-framework-name` オプションでフレームワーク名を指定" "出来るようになりました。" -#: ../../whatsnew/2.6.rst:3174 msgid "" -"The :mod:`!macfs` module has been removed. This in turn required the :func:" -"`!macostools.touched` function to be removed because it depended on the :mod:" -"`!macfs` module. (:issue:`1490190`)" +"The :mod:`!macfs` module has been removed. This in turn required " +"the :func:`!macostools.touched` function to be removed because it depended " +"on the :mod:`!macfs` module. (:issue:`1490190`)" msgstr "" +":mod:`!macfs` が削除されました。\n" +"それに伴い、:mod:`!macfs` に依存していた :func:`!macostools.touched` も削除さ" +"れました。\n" +"(:issue:`1490190`)" -#: ../../whatsnew/2.6.rst:3178 msgid "" "Many other Mac OS modules have been deprecated and will be removed in Python " "3.0: :mod:`!_builtinSuites`, :mod:`!aepack`, :mod:`!aetools`, :mod:`!" -"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!appletrunner`, :" -"mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!autoGIL`, :mod:`!Carbon`, :" -"mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!ColorPicker`, :mod:`!" -"EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!FrameWork`, :mod:`!" -"findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!icopen`, :mod:`!" -"macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!macostools`, :mod:`!" -"macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!Netscape`, :mod:`!" -"OSATerminology`, :mod:`!pimp`, :mod:`!PixMapWrapper`, :mod:`!StdSuites`, :" -"mod:`!SystemEvents`, :mod:`!Terminal`, and :mod:`!terminalcommand`." -msgstr "" +"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!" +"appletrunner`, :mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!" +"autoGIL`, :mod:`!Carbon`, :mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!" +"ColorPicker`, :mod:`!EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!" +"FrameWork`, :mod:`!findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!" +"icopen`, :mod:`!macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!" +"macostools`, :mod:`!macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!" +"Netscape`, :mod:`!OSATerminology`, :mod:`!pimp`, :mod:`!" +"PixMapWrapper`, :mod:`!StdSuites`, :mod:`!SystemEvents`, :mod:`!Terminal`, " +"and :mod:`!terminalcommand`." +msgstr "" +"そのほか、多数の Mac OS 用モジュールが非推奨となり、Python 3.0 で削除されま" +"す: :mod:`!_builtinSuites`, :mod:`!aepack`, :mod:`!aetools`, :mod:`!" +"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!" +"appletrunner`, :mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!" +"autoGIL`, :mod:`!Carbon`, :mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!" +"ColorPicker`, :mod:`!EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!" +"FrameWork`, :mod:`!findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!" +"icopen`, :mod:`!macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!" +"macostools`, :mod:`!macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!" +"Netscape`, :mod:`!OSATerminology`, :mod:`!pimp`, :mod:`!" +"PixMapWrapper`, :mod:`!StdSuites`, :mod:`!SystemEvents`, :mod:`!Terminal`, " +"と :mod:`!terminalcommand`." #: ../../whatsnew/2.6.rst:3221 msgid "Port-Specific Changes: IRIX" msgstr "ポート特有の変更: IRIX" -#: ../../whatsnew/2.6.rst:3223 msgid "" "A number of old IRIX-specific modules were deprecated and will be removed in " "Python 3.0: :mod:`!al` and :mod:`!AL`, :mod:`!cd`, :mod:`!cddb`, :mod:`!" "cdplayer`, :mod:`!CL` and :mod:`!cl`, :mod:`!DEVICE`, :mod:`!ERRNO`, :mod:`!" -"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!GET`, :mod:" -"`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!IOCTL`, :mod:`!" -"jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` and :mod:`!sv`, :mod:" -"`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." -msgstr "" +"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!" +"GET`, :mod:`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!" +"IOCTL`, :mod:`!jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` " +"and :mod:`!sv`, :mod:`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." +msgstr "" +"多数の古い IRIX 専用モジュールが非推奨となり、Python 3.0 で削除されま" +"す: :mod:`!al` と :mod:`!AL`, :mod:`!cd`, :mod:`!cddb`, :mod:`!" +"cdplayer`, :mod:`!CL` と :mod:`!cl`, :mod:`!DEVICE`, :mod:`!ERRNO`, :mod:`!" +"FILE`, :mod:`!FL` と :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!" +"GET`, :mod:`!GLWS`, :mod:`!GL` と :mod:`!gl`, :mod:`!IN`, :mod:`!" +"IOCTL`, :mod:`!jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` " +"と :mod:`!sv`, :mod:`!torgb`, :mod:`!videoreader`, と :mod:`!WAIT`." #: ../../whatsnew/2.6.rst:3253 msgid "Porting to Python 2.6" @@ -5720,21 +6435,21 @@ msgstr "" ":meth:`object.__init__` は以前は任意の引数とキーワード引数を受け取り、そして" "無視していました。Python 2.6 ではもうこれは許されません。 :exc:`TypeError` を" "起こします。これは結果的に :class:`object` の対応するメソッドを呼ぶ(おそら" -"く :func:`super` を介して) :meth:`__init__` メソッドに影響します。 :issue:" -"`1683368` の議論を参照して下さい。" +"く :func:`super` を介して) :meth:`__init__` メソッドに影響しま" +"す。 :issue:`1683368` の議論を参照して下さい。" #: ../../whatsnew/2.6.rst:3277 msgid "" "The :class:`Decimal` constructor now accepts leading and trailing whitespace " "when passed a string. Previously it would raise an :exc:`InvalidOperation` " -"exception. On the other hand, the :meth:`create_decimal` method of :class:" -"`Context` objects now explicitly disallows extra whitespace, raising a :exc:" -"`ConversionSyntax` exception." +"exception. On the other hand, the :meth:`create_decimal` method " +"of :class:`Context` objects now explicitly disallows extra whitespace, " +"raising a :exc:`ConversionSyntax` exception." msgstr "" ":class:`Decimal` のコンストラクタは今では先頭と末尾の空白が含まれる文字列を許" -"容します。以前は :exc:`InvalidOperation` となっていました。他方で、 :class:" -"`Context` オブジェクトの :meth:`create_decimal` メソッドは余分な空白を明示的" -"に拒絶するようになり、 :exc:`ConversionSyntax` を投げます。" +"容します。以前は :exc:`InvalidOperation` となっていました。他方" +"で、 :class:`Context` オブジェクトの :meth:`create_decimal` メソッドは余分な" +"空白を明示的に拒絶するようになり、 :exc:`ConversionSyntax` を投げます。" #: ../../whatsnew/2.6.rst:3284 msgid "" @@ -5763,15 +6478,15 @@ msgid "" "C API: extension data types that shouldn't be hashable should define their " "``tp_hash`` slot to :c:func:`PyObject_HashNotImplemented`." msgstr "" -"C API: ハッシュされるべきではない拡張データ型は、 ``tp_hash`` スロットを :c:" -"func:`PyObject_HashNotImplemented` と定義すべきです。" +"C API: ハッシュされるべきではない拡張データ型は、 ``tp_hash`` スロット" +"を :c:func:`PyObject_HashNotImplemented` と定義すべきです。" #: ../../whatsnew/2.6.rst:3298 msgid "" -"The :mod:`socket` module exception :exc:`socket.error` now inherits from :" -"exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but " -"now it is, through :exc:`IOError`. (Implemented by Gregory P. Smith; :issue:" -"`1706815`.)" +"The :mod:`socket` module exception :exc:`socket.error` now inherits " +"from :exc:`IOError`. Previously it wasn't a subclass " +"of :exc:`StandardError` but now it is, through :exc:`IOError`. (Implemented " +"by Gregory P. Smith; :issue:`1706815`.)" msgstr "" ":mod:`socket` モジュールの例外 :exc:`socket.error` が :exc:`IOError` 派生に" "なっています。以前は :exc:`StandardError` のサブクラスではありませんでしたが" @@ -5781,11 +6496,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:3303 msgid "" "The :mod:`xmlrpclib ` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime ` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`)" +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime ` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`)" msgstr "" #: ../../whatsnew/2.6.rst:3310 @@ -5821,7 +6536,6 @@ msgstr "" msgid "For applications that embed Python:" msgstr "Python を埋め込んだアプリケーションでは:" -#: ../../whatsnew/2.6.rst:3325 msgid "" "The :c:func:`!PySys_SetArgvEx` function was added in Python 2.6.6, letting " "applications close a security hole when the existing :c:func:`!" @@ -5829,6 +6543,10 @@ msgid "" "PySys_SetArgv` and carefully consider whether the application should be " "using :c:func:`!PySys_SetArgvEx` with *updatepath* set to false." msgstr "" +"Python 2.6.6 で :c:func:`!PySys_SetArgvEx` が追加され、従来の :c:func:`!" +"PySys_SetArgv` を使った場合のセキュリティホールを塞げるようになりました。\n" +":c:func:`!PySys_SetArgv` を呼んでいるか確認し、*updatepath* を偽にし" +"た :c:func:`!PySys_SetArgvEx` を使うべきか慎重に検討してください。" #: ../../whatsnew/2.6.rst:3338 msgid "Acknowledgements" @@ -5850,6 +6568,5 @@ msgstr "" msgid "universal newlines" msgstr "universal newlines" -#: ../../whatsnew/2.6.rst:1068 msgid "What's new" -msgstr "" +msgstr "新機能" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 3e3d82254..6b54b366a 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 @@ -49,11 +49,11 @@ msgstr "" msgid "" "Numeric handling has been improved in many ways, for both floating-point " "numbers and for the :class:`~decimal.Decimal` class. There are some useful " -"additions to the standard library, such as a greatly enhanced :mod:" -"`unittest` module, the :mod:`argparse` module for parsing command-line " -"options, convenient :class:`~collections.OrderedDict` and :class:" -"`~collections.Counter` classes in the :mod:`collections` module, and many " -"other improvements." +"additions to the standard library, such as a greatly " +"enhanced :mod:`unittest` module, the :mod:`argparse` module for parsing " +"command-line options, convenient :class:`~collections.OrderedDict` " +"and :class:`~collections.Counter` classes in the :mod:`collections` module, " +"and many other improvements." msgstr "" "数値周りの扱いが、浮動小数点数でも :class:`~decimal.Decimal` クラスでもいろい" "ろな点で改良されました、標準ライブラリにいくつかの有用な追加が行われまし" @@ -79,16 +79,16 @@ msgid "" "features, but instead provides a convenient overview. For full details, you " "should refer to the documentation for Python 2.7 at https://docs.python.org. " "If you want to understand the rationale for the design and implementation, " -"refer to the PEP for a particular new feature or the issue on https://bugs." -"python.org in which a change was discussed. Whenever possible, \"What's New " -"in Python\" links to the bug/patch item for each change." +"refer to the PEP for a particular new feature or the issue on https://" +"bugs.python.org in which a change was discussed. Whenever possible, " +"\"What's New in Python\" links to the bug/patch item for each change." msgstr "" "このドキュメントは新機能の完全な詳細を提供するのではなくて、簡易な概要を提供" -"することを目的にしています。完全な詳細が知りたければ、 https://docs.python." -"org の Python 2.7 のドキュメントを参照してください。設計と実装の根拠を理解し" -"たい場合は、新機能に関する PEP を参照するか、 https://bugs.python.org に議論" -"したい機能について登録してください。可能な限り、 \"What's New in Python\" は" -"各変更の bug や patch に対してリンクしています。" +"することを目的にしています。完全な詳細が知りたければ、 https://" +"docs.python.org の Python 2.7 のドキュメントを参照してください。設計と実装の" +"根拠を理解したい場合は、新機能に関する PEP を参照するか、 https://" +"bugs.python.org に議論したい機能について登録してください。可能な限り、 " +"\"What's New in Python\" は各変更の bug や patch に対してリンクしています。" #: ../../whatsnew/2.7.rst:80 msgid "The Future for Python 2.x" @@ -226,8 +226,8 @@ msgstr "" "Python 2.7 では開発者向けの警告をデフォルトで抑止するポリシーが取られまし" "た。 :exc:`DeprecationWarning` とそれを継承した警告は、指定されない限りは無視" "され、アプリケーションのユーザーがその警告を見ないですむようになりました。こ" -"の変更は Python 3.2 ブランチにも適用されました。 (stdlib-sig で討議され、 :" -"issue:`7319` になりました)" +"の変更は Python 3.2 ブランチにも適用されました。 (stdlib-sig で討議さ" +"れ、 :issue:`7319` になりました)" #: ../../whatsnew/2.7.rst:146 msgid "" @@ -242,10 +242,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:151 msgid "" "However, there are increasingly many users of Python-based applications who " -"are not directly involved in the development of those applications. :exc:" -"`DeprecationWarning` messages are irrelevant to such users, making them " -"worry about an application that's actually working correctly and burdening " -"application developers with responding to these concerns." +"are not directly involved in the development of those " +"applications. :exc:`DeprecationWarning` messages are irrelevant to such " +"users, making them worry about an application that's actually working " +"correctly and burdening application developers with responding to these " +"concerns." msgstr "" "しかし、 Python で開発されたアプリケーションの利用者であって開発には携わって" "いない人がどんどん増えてきました。 :exc:`DeprecationWarning` メッセージはそれ" @@ -263,8 +264,8 @@ msgstr "" ":exc:`DeprecationWarning` メッセージの表示を有効にするには、 :option:`-" "Wdefault <-W>` (短い形式: :option:`-Wd <-W>`) スイッチか、Python を実行する前" "に :envvar:`PYTHONWARNINGS` 環境変数を ``\"default\"`` (か、 ``\"d\"``)に設" -"定します。 Python コードから有効にする場合は ``warnings." -"simplefilter('default')`` とします。" +"定します。 Python コードから有効にする場合は " +"``warnings.simplefilter('default')`` とします。" #: ../../whatsnew/2.7.rst:165 msgid "" @@ -343,8 +344,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:192 msgid "" -"Float-to-string and string-to-float conversions are correctly rounded. The :" -"func:`round` function is also now correctly rounded." +"Float-to-string and string-to-float conversions are correctly rounded. " +"The :func:`round` function is also now correctly rounded." msgstr "" "float から文字列、文字列から float への変換が正しく丸められるようになりまし" "た。 :func:`round` 関数も正しく丸めるようになりました。" @@ -389,13 +390,13 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, 2.7 introduces a new :class:" -"`~collections.OrderedDict` class in the :mod:`collections` module." +"the experiences from those implementations, 2.7 introduces a " +"new :class:`~collections.OrderedDict` class in the :mod:`collections` module." msgstr "" "通常の Python 辞書は、 key/value ペアを不定の順序でイテレートします。何年にも" "わたり、いろいろな人が key の挿入順を保存する辞書の別実装を書いてきました。そ" -"の経験に基づき、 2.7 は :mod:`collections` モジュールに新しい :class:" -"`~collections.OrderedDict` クラスを追加しました。" +"の経験に基づき、 2.7 は :mod:`collections` モジュールに新し" +"い :class:`~collections.OrderedDict` クラスを追加しました。" #: ../../whatsnew/2.7.rst:222 msgid "" @@ -407,7 +408,6 @@ msgstr "" "供していますが、 key/value をイテレートするときに key が最初に挿入された順番" "になることが保証されています。 ::" -#: ../../whatsnew/2.7.rst:226 msgid "" ">>> from collections import OrderedDict\n" ">>> d = OrderedDict([('first', 1),\n" @@ -416,6 +416,12 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 2), ('third', 3)]" msgstr "" +">>> from collections import OrderedDict\n" +">>> d = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> d.items()\n" +"[('first', 1), ('second', 2), ('third', 3)]" #: ../../whatsnew/2.7.rst:233 msgid "" @@ -425,24 +431,29 @@ msgstr "" "新しいエントリが既存のエントリを上書きした場合は、元の挿入順序が保持されま" "す。::" -#: ../../whatsnew/2.7.rst:236 msgid "" ">>> d['second'] = 4\n" ">>> d.items()\n" "[('first', 1), ('second', 4), ('third', 3)]" msgstr "" +">>> d['second'] = 4\n" +">>> d.items()\n" +"[('first', 1), ('second', 4), ('third', 3)]" #: ../../whatsnew/2.7.rst:240 msgid "Deleting an entry and reinserting it will move it to the end::" msgstr "エントリを削除して再挿入すると、順序は一番最後に移動します。::" -#: ../../whatsnew/2.7.rst:242 msgid "" ">>> del d['second']\n" ">>> d['second'] = 5\n" ">>> d.items()\n" "[('first', 1), ('third', 3), ('second', 5)]" msgstr "" +">>> del d['second']\n" +">>> d['second'] = 5\n" +">>> d.items()\n" +"[('first', 1), ('third', 3), ('second', 5)]" #: ../../whatsnew/2.7.rst:247 msgid "" @@ -455,7 +466,6 @@ msgstr "" "を持ち、でフォルトで ``True`` になっています。 *last* が真の場合、一番最近に" "追加された key が返され、削除されます。偽の場合、最も古い key が選ばれます::" -#: ../../whatsnew/2.7.rst:252 msgid "" ">>> od = OrderedDict([(x,0) for x in range(20)])\n" ">>> od.popitem()\n" @@ -467,6 +477,15 @@ msgid "" ">>> od.popitem(last=False)\n" "(1, 0)" msgstr "" +">>> od = OrderedDict([(x,0) for x in range(20)])\n" +">>> od.popitem()\n" +"(19, 0)\n" +">>> od.popitem()\n" +"(18, 0)\n" +">>> od.popitem(last=False)\n" +"(0, 0)\n" +">>> od.popitem(last=False)\n" +"(1, 0)" #: ../../whatsnew/2.7.rst:262 msgid "" @@ -476,7 +495,6 @@ msgstr "" "2つの順序付き辞書を比較するときは、key/value だけでなく、挿入順も比較されま" "す。::" -#: ../../whatsnew/2.7.rst:265 msgid "" ">>> od1 = OrderedDict([('first', 1),\n" "... ('second', 2),\n" @@ -491,6 +509,18 @@ msgid "" ">>> od1 == od2\n" "True" msgstr "" +">>> od1 = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> od2 = OrderedDict([('third', 3),\n" +"... ('first', 1),\n" +"... ('second', 2)])\n" +">>> od1 == od2\n" +"False\n" +">>> # キー 'third' を末尾へ移す\n" +">>> del od2['third']; od2['third'] = 3\n" +">>> od1 == od2\n" +"True" #: ../../whatsnew/2.7.rst:278 msgid "" @@ -500,7 +530,6 @@ msgstr "" ":class:`~collections.OrderedDict` を通常の辞書と比較すると、挿入順は無視され" "て単に key/value だけが比較されます。" -#: ../../whatsnew/2.7.rst:281 msgid "" "How does the :class:`~collections.OrderedDict` work? It maintains a doubly " "linked list of keys, appending new keys to the list as they're inserted. A " @@ -508,6 +537,11 @@ msgid "" "doesn't have to traverse the entire linked list and therefore remains *O*\\ " "(1)." msgstr "" +":class:`~collections.OrderedDict` はどのように動くのでしょうか。\n" +"キーの双方向連結リストを保持し、新しいキーが挿入されるたびにリストの末尾へ追" +"加します。\n" +"別の辞書でキーとリストのノードを対応付けるため、削除時に連結リスト全体を走査" +"する必要がなく、計算量は *O*\\ (1) のままです。" #: ../../whatsnew/2.7.rst:287 msgid "" @@ -517,27 +551,34 @@ msgstr "" "標準ライブラリのいくつかのモジュールで、順序付き辞書の利用がサポートされてい" "ます。" -#: ../../whatsnew/2.7.rst:290 msgid "" "The :mod:`ConfigParser ` module uses them by default, meaning " "that configuration files can now be read, modified, and then written back in " "their original order." msgstr "" +":mod:`ConfigParser ` がデフォルトでこれを使うため、設定ファイル" +"を読み、変更してから、元の順序のまま書き戻せるようになりました。" -#: ../../whatsnew/2.7.rst:294 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns an ordered dictionary with the values " -"appearing in the same order as the underlying tuple indices." +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns an ordered dictionary with " +"the values appearing in the same order as the underlying tuple indices." msgstr "" +":func:`collections.namedtuple` " +"の :meth:`~collections.somenamedtuple._asdict` は、タプルのインデックスと同じ" +"順序に値が並ぶ順序付き辞書を返すようになりました。" -#: ../../whatsnew/2.7.rst:298 msgid "" "The :mod:`json` module's :class:`~json.JSONDecoder` class constructor was " "extended with an *object_pairs_hook* parameter to allow :class:`OrderedDict` " "instances to be built by the decoder. Support was also added for third-party " "tools like `PyYAML `_." msgstr "" +":mod:`json` の :class:`~json.JSONDecoder` のコンストラクターに " +"*object_pairs_hook* が加わり、デコーダーで :class:`OrderedDict` のインスタン" +"スを作れるようになりました。\n" +"`PyYAML `_ などのサードパーティーのツールにも対応が追加" +"されました。" #: ../../whatsnew/2.7.rst:306 msgid ":pep:`372` - Adding an ordered dictionary to collections" @@ -588,11 +629,12 @@ msgstr "" "のミニ言語に追加されました。浮動小数点数をフォーマットする場合、シンプルにカ" "ンマを幅と精度の間に置きます。" -#: ../../whatsnew/2.7.rst:330 msgid "" ">>> '{:20,.2f}'.format(18446744073709551616.0)\n" "'18,446,744,073,709,551,616.00'" msgstr "" +">>> '{:20,.2f}'.format(18446744073709551616.0)\n" +"'18,446,744,073,709,551,616.00'" #: ../../whatsnew/2.7.rst:333 msgid "When formatting an integer, include the comma after the width:" @@ -626,21 +668,29 @@ msgid "" "The :mod:`argparse` module for parsing command-line arguments was added as a " "more powerful replacement for the :mod:`optparse` module." msgstr "" -"コマンドライン引数の解析のための :mod:`argparse` モジュールが、 :mod:" -"`optparse` モジュールのより強力な代替として追加されました。" +"コマンドライン引数の解析のための :mod:`argparse` モジュール" +"が、 :mod:`optparse` モジュールのより強力な代替として追加されました。" -#: ../../whatsnew/2.7.rst:355 msgid "" "This means Python now supports three different modules for parsing command-" -"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. The :" -"mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " +"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. " +"The :mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " "function, so it remains useful if you're writing a Python prototype that " "will eventually be rewritten in C. :mod:`optparse` becomes redundant, but " "there are no plans to remove it because there are many scripts still using " -"it, and there's no automated way to update these scripts. (Making the :mod:" -"`argparse` API consistent with :mod:`optparse`'s interface was discussed but " -"rejected as too messy and difficult.)" -msgstr "" +"it, and there's no automated way to update these scripts. (Making " +"the :mod:`argparse` API consistent with :mod:`optparse`'s interface was " +"discussed but rejected as too messy and difficult.)" +msgstr "" +"これで Python には、コマンドライン引数を解析す" +"る :mod:`getopt`、:mod:`optparse`、:mod:`argparse` という 3 つのモジュールが" +"そろいました。\n" +":mod:`getopt` は C ライブラリの :c:func:`!getopt` に非常に近いため、最終的に " +"C で書き直すプロトタイプを Python で書く場合には今も有用です。\n" +":mod:`optparse` は役割が重なりますが、使っているスクリプトが多く、自動的に更" +"新する方法もないため、削除する予定はありません。\n" +"(:mod:`argparse` の API を :mod:`optparse` に合わせる案も議論されましたが、複" +"雑で難しすぎるため却下されました。)" #: ../../whatsnew/2.7.rst:366 msgid "" @@ -655,7 +705,6 @@ msgstr "" msgid "Here's an example::" msgstr "以下はこの使用例です::" -#: ../../whatsnew/2.7.rst:372 msgid "" "import argparse\n" "\n" @@ -678,6 +727,26 @@ msgid "" "args = parser.parse_args()\n" "print args.__dict__" msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(description='Command-line example.')\n" +"\n" +"# オプションを追加\n" +"parser.add_argument('-v', action='store_true', dest='is_verbose',\n" +" help='produce verbose output')\n" +"parser.add_argument('-o', action='store', dest='output',\n" +" metavar='FILE',\n" +" help='direct output to FILE instead of stdout')\n" +"parser.add_argument('-C', action='store', type=int, dest='context',\n" +" metavar='NUM', default=0,\n" +" help='display NUM lines of added context')\n" +"\n" +"# 任意の数の追加の引数を許す。\n" +"parser.add_argument(nargs='*', action='store', dest='inputs',\n" +" help='input filenames (default is stdin)')\n" +"\n" +"args = parser.parse_args()\n" +"print args.__dict__" #: ../../whatsnew/2.7.rst:393 msgid "" @@ -687,7 +756,6 @@ msgstr "" "オーバーライドしない限り、 :option:`!-h` と :option:`!--help` スイッチが自動" "的に追加され、綺麗にフォーマットした出力を生成します。 ::" -#: ../../whatsnew/2.7.rst:396 msgid "" "-> ./python.exe argparse-example.py --help\n" "usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs " @@ -704,6 +772,20 @@ msgid "" " -o FILE direct output to FILE instead of stdout\n" " -C NUM display NUM lines of added context" msgstr "" +"-> ./python.exe argparse-example.py --help\n" +"usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs " +"[inputs ...]]\n" +"\n" +"Command-line example.\n" +"\n" +"positional arguments:\n" +" inputs input filenames (default is stdin)\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -v produce verbose output\n" +" -o FILE direct output to FILE instead of stdout\n" +" -C NUM display NUM lines of added context" #: ../../whatsnew/2.7.rst:410 msgid "" @@ -713,7 +795,6 @@ msgstr "" ":mod:`optparse` と同じく、コマンドラインスイッチと引数は、 *dest* 引数の名前" "の属性をもったオブジェクトとして返されます。 ::" -#: ../../whatsnew/2.7.rst:413 msgid "" "-> ./python.exe argparse-example.py -v\n" "{'output': None,\n" @@ -727,6 +808,17 @@ msgid "" " 'context': 4,\n" " 'inputs': ['file1', 'file2']}" msgstr "" +"-> ./python.exe argparse-example.py -v\n" +"{'output': None,\n" +" 'is_verbose': True,\n" +" 'context': 0,\n" +" 'inputs': []}\n" +"\n" +"-> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2\n" +"{'output': '/tmp/output',\n" +" 'is_verbose': True,\n" +" 'context': 4,\n" +" 'inputs': ['file1', 'file2']}" #: ../../whatsnew/2.7.rst:425 msgid "" @@ -735,9 +827,9 @@ msgid "" "passing ``'*'``, 1 or more by passing ``'+'``, or an optional argument with " "``'?'``. A top-level parser can contain sub-parsers to define subcommands " "that have different sets of switches, as in ``svn commit``, ``svn " -"checkout``, etc. You can specify an argument's type as :class:`~argparse." -"FileType`, which will automatically open files for you and understands that " -"``'-'`` means standard input or output." +"checkout``, etc. You can specify an argument's type " +"as :class:`~argparse.FileType`, which will automatically open files for you " +"and understands that ``'-'`` means standard input or output." msgstr "" ":mod:`argparse` は :mod:`optparse` よりも多くの便利なバリデーションを持ってい" "ます。引数の正確な数を整数で指定したり、 ``'*'`` で0以上の数を指定したり、 " @@ -761,8 +853,8 @@ msgstr ":ref:`upgrading-optparse-code`" #: ../../whatsnew/2.7.rst:441 msgid "" -"Part of the Python documentation, describing how to convert code that uses :" -"mod:`optparse`." +"Part of the Python documentation, describing how to convert code that " +"uses :mod:`optparse`." msgstr "" ":mod:`optparse` を使うコードを変換する方法を説明した Python のドキュメントの" "一部" @@ -791,17 +883,21 @@ msgstr "" "フィルターし、異なるフォーマットを行い、メッセージを沢山の種類のハンドラーに" "渡します。" -#: ../../whatsnew/2.7.rst:455 msgid "" "All this flexibility can require a lot of configuration. You can write " "Python statements to create objects and set their properties, but a complex " -"set-up requires verbose but boring code. :mod:`logging` also supports a :" -"func:`~logging.config.fileConfig` function that parses a file, but the file " -"format doesn't support configuring filters, and it's messier to generate " -"programmatically." -msgstr "" +"set-up requires verbose but boring code. :mod:`logging` also supports " +"a :func:`~logging.config.fileConfig` function that parses a file, but the " +"file format doesn't support configuring filters, and it's messier to " +"generate programmatically." +msgstr "" +"これだけの柔軟性があると、設定の量も多くなりがちです。\n" +"Python の文でオブジェクトを作り、プロパティを設定できますが、複雑な構成には長" +"く単調なコードが必要です。\n" +":mod:`logging` にはファイルを解析する :func:`~logging.config.fileConfig` もあ" +"りますが、その形式ではフィルターを設定できず、プログラムで生成するのも煩雑で" +"す。" -#: ../../whatsnew/2.7.rst:462 msgid "" "Python 2.7 adds a :func:`~logging.config.dictConfig` function that uses a " "dictionary to configure logging. There are many ways to produce a " @@ -809,6 +905,11 @@ msgid "" "containing JSON; or use a YAML parsing library if one is installed. For " "more information see :ref:`logging-config-api`." msgstr "" +"Python 2.7 に、辞書でログを設定する :func:`~logging.config.dictConfig` が加わ" +"りました。\n" +"辞書の作り方はいろいろあり、コードで組み立てたり、JSON ファイルを解析したり、" +"インストール済みの YAML 解析ライブラリを使ったりできます。\n" +"詳しくは :ref:`logging-config-api` を参照してください。" #: ../../whatsnew/2.7.rst:468 msgid "" @@ -824,7 +925,6 @@ msgstr "" "テートされる\n" ":file:`network.log` ファイルに書きこまれます。" -#: ../../whatsnew/2.7.rst:476 msgid "" "import logging\n" "import logging.config\n" @@ -868,6 +968,47 @@ msgid "" "netlogger = logging.getLogger('network')\n" "netlogger.error('Connection failed')" msgstr "" +"import logging\n" +"import logging.config\n" +"\n" +"configdict = {\n" +" 'version': 1, # 使う設定スキーマ。現時点では 1 に限る\n" +" 'formatters': {\n" +" 'standard': {\n" +" 'format': ('%(asctime)s %(name)-15s '\n" +" '%(levelname)-8s %(message)s')}},\n" +"\n" +" 'handlers': {'netlog': {'backupCount': 10,\n" +" 'class': 'logging.handlers.RotatingFileHandler',\n" +" 'filename': '/logs/network.log',\n" +" 'formatter': 'standard',\n" +" 'level': 'INFO',\n" +" 'maxBytes': 1000000},\n" +" 'syslog': {'class': 'logging.handlers.SysLogHandler',\n" +" 'formatter': 'standard',\n" +" 'level': 'ERROR'}},\n" +"\n" +" # 下位のすべてのロガーを指定\n" +" 'loggers': {\n" +" 'network': {\n" +" 'handlers': ['netlog']\n" +" }\n" +" },\n" +" # ルートロガーのプロパティを指定\n" +" 'root': {\n" +" 'handlers': ['syslog']\n" +" },\n" +"}\n" +"\n" +"# 設定を適用\n" +"logging.config.dictConfig(configdict)\n" +"\n" +"# 例として 2 つのエラーメッセージを記録\n" +"logger = logging.getLogger('/')\n" +"logger.error('Database not found')\n" +"\n" +"netlogger = logging.getLogger('network')\n" +"netlogger.error('Connection failed')" #: ../../whatsnew/2.7.rst:518 msgid "" @@ -881,34 +1022,38 @@ msgstr "" msgid "" "The :class:`~logging.handlers.SysLogHandler` class now supports syslogging " "over TCP. The constructor has a *socktype* parameter giving the type of " -"socket to use, either :const:`socket.SOCK_DGRAM` for UDP or :const:`socket." -"SOCK_STREAM` for TCP. The default protocol remains UDP." +"socket to use, either :const:`socket.SOCK_DGRAM` for UDP " +"or :const:`socket.SOCK_STREAM` for TCP. The default protocol remains UDP." msgstr "" ":class:`~logging.handlers.SysLogHandler` クラスは TCP 経由の syslog をサポー" "トします。コンストラクタの *socktype* 引数は使用するソケットの種類として、 " -"UDP を使う :const:`socket.SOCK_DGRAM` と TCP を使う :const:`socket." -"SOCK_STREAM` のどちらかを取ります。デフォルトはUDPのままです。" +"UDP を使う :const:`socket.SOCK_DGRAM` と TCP を使" +"う :const:`socket.SOCK_STREAM` のどちらかを取ります。デフォルトはUDPのままで" +"す。" #: ../../whatsnew/2.7.rst:529 msgid "" ":class:`~logging.Logger` instances gained a :meth:`~logging.Logger.getChild` " "method that retrieves a descendant logger using a relative path. For " "example, once you retrieve a logger by doing ``log = getLogger('app')``, " -"calling ``log.getChild('network.listen')`` is equivalent to ``getLogger('app." -"network.listen')``." +"calling ``log.getChild('network.listen')`` is equivalent to " +"``getLogger('app.network.listen')``." msgstr "" ":class:`~logging.Logger` インスタンスに :meth:`~logging.Logger.getChild` メ" "ソッドが追加されました。これは、相対パスで下位の logger を返します。 例え" -"ば、 ``log = getLogger('app')`` として logger を取得した後、 ``log." -"getChild('network.listen')`` は ``getLogger('app.network.listen')`` と同じに" -"なります。" +"ば、 ``log = getLogger('app')`` として logger を取得した後、 " +"``log.getChild('network.listen')`` は ``getLogger('app.network.listen')`` と" +"同じになります。" -#: ../../whatsnew/2.7.rst:535 msgid "" -"The :class:`~logging.LoggerAdapter` class gained an :meth:`~logging.Logger." -"isEnabledFor` method that takes a *level* and returns whether the underlying " -"logger would process a message of that level of importance." +"The :class:`~logging.LoggerAdapter` class gained " +"an :meth:`~logging.Logger.isEnabledFor` method that takes a *level* and " +"returns whether the underlying logger would process a message of that level " +"of importance." msgstr "" +":class:`~logging.LoggerAdapter` に、*level* を受け取り、基盤となるロガーがそ" +"の重要度のメッセージを処理するかを返す :meth:`~logging.Logger.isEnabledFor` " +"が加わりました。" #: ../../whatsnew/2.7.rst:544 msgid ":pep:`391` - Dictionary-Based Configuration For Logging" @@ -924,23 +1069,27 @@ msgstr "PEP 3106: 辞書 View" #: ../../whatsnew/2.7.rst:550 msgid "" -"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:" -"`~dict.items` are different in Python 3.x. They return an object called a :" -"dfn:`view` instead of a fully materialized list." +"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` are different in Python 3.x. They return an object " +"called a :dfn:`view` instead of a fully materialized list." msgstr "" "辞書の :meth:`~dict.keys`, :meth:`~dict.values`, :meth:`~dict.items` メソッド" -"は Python 3.x では動作が代わり、完全に実体化されたリストの代わりに、 :dfn:" -"`view` と呼ばれるオブジェクトを返すようになりました。" +"は Python 3.x では動作が代わり、完全に実体化されたリストの代わり" +"に、 :dfn:`view` と呼ばれるオブジェクトを返すようになりました。" -#: ../../whatsnew/2.7.rst:554 msgid "" -"It's not possible to change the return values of :meth:`~dict.keys`, :meth:" -"`~dict.values`, and :meth:`~dict.items` in Python 2.7 because too much code " -"would break. Instead the 3.x versions were added under the new names :meth:" -"`!viewkeys`, :meth:`!viewvalues`, and :meth:`!viewitems`." +"It's not possible to change the return values " +"of :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:`~dict.items` in " +"Python 2.7 because too much code would break. Instead the 3.x versions were " +"added under the new names :meth:`!viewkeys`, :meth:`!viewvalues`, " +"and :meth:`!viewitems`." msgstr "" +"Python 2.7 で :meth:`~dict.keys`、:meth:`~dict.values`、:meth:`~dict.items` " +"の戻り値を変更すると、あまりに多くのコードが動かなくなるため変更できませ" +"ん。\n" +"代わりに 3.x 版が :meth:`!viewkeys`、:meth:`!viewvalues`、:meth:`!viewitems` " +"という新しい名前で追加されました。" -#: ../../whatsnew/2.7.rst:562 msgid "" ">>> d = dict((i*10, chr(65+i)) for i in range(26))\n" ">>> d\n" @@ -948,6 +1097,11 @@ msgid "" ">>> d.viewkeys()\n" "dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" msgstr "" +">>> d = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d\n" +"{0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}\n" +">>> d.viewkeys()\n" +"dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" #: ../../whatsnew/2.7.rst:568 msgid "" @@ -957,7 +1111,6 @@ msgstr "" "View はイテレートするだけでなく、set と似た利用をすることもできます。``&`` 演" "算子で共通部分集合を、``|`` 演算子で話集合を取ることができます。" -#: ../../whatsnew/2.7.rst:572 msgid "" ">>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n" ">>> d2 = dict((i**.5, i) for i in range(1000))\n" @@ -966,6 +1119,12 @@ msgid "" ">>> d1.viewkeys() | range(0, 30)\n" "set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" msgstr "" +">>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d2 = dict((i**.5, i) for i in range(1000))\n" +">>> d1.viewkeys() & d2.viewkeys()\n" +"set([0.0, 10.0, 20.0, 30.0])\n" +">>> d1.viewkeys() | range(0, 30)\n" +"set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" #: ../../whatsnew/2.7.rst:579 msgid "" @@ -973,7 +1132,6 @@ msgid "" "dictionary is modified::" msgstr "view は辞書とその辞書の変化に追随しています。::" -#: ../../whatsnew/2.7.rst:582 msgid "" ">>> vk = d.viewkeys()\n" ">>> vk\n" @@ -982,6 +1140,12 @@ msgid "" ">>> vk\n" "dict_keys([0, 130, 260, 10, ..., 250])" msgstr "" +">>> vk = d.viewkeys()\n" +">>> vk\n" +"dict_keys([0, 130, 10, ..., 250])\n" +">>> d[260] = '&'\n" +">>> vk\n" +"dict_keys([0, 130, 260, 10, ..., 250])" #: ../../whatsnew/2.7.rst:589 msgid "" @@ -991,7 +1155,6 @@ msgstr "" "ただし、view をイテレートしている間に key の追加や削除ができないことに気を付" "けてください。::" -#: ../../whatsnew/2.7.rst:592 msgid "" ">>> for k in vk:\n" "... d[k*2] = k\n" @@ -1000,16 +1163,22 @@ msgid "" " File \"\", line 1, in \n" "RuntimeError: dictionary changed size during iteration" msgstr "" +">>> for k in vk:\n" +"... d[k*2] = k\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"RuntimeError: dictionary changed size during iteration" #: ../../whatsnew/2.7.rst:599 msgid "" "You can use the view methods in Python 2.x code, and the 2to3 converter will " -"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, and :" -"meth:`~dict.items` methods." +"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` methods." msgstr "" -"Python 2.x で view メソッドを利用すると、 2to3 が自動的にそれを通常の :meth:" -"`~dict.keys`, :meth:`~dict.values`, :meth:`~dict.items` メソッドに書き換えて" -"くれます。" +"Python 2.x で view メソッドを利用すると、 2to3 が自動的にそれを通常" +"の :meth:`~dict.keys`, :meth:`~dict.values`, :meth:`~dict.items` メソッドに書" +"き換えてくれます。" #: ../../whatsnew/2.7.rst:605 msgid ":pep:`3106` - Revamping dict.keys(), .values() and .items()" @@ -1017,11 +1186,11 @@ msgstr ":pep:`3106` - Revamping dict.keys(), .values() and .items()" #: ../../whatsnew/2.7.rst:606 msgid "" -"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre Vassalotti; :" -"issue:`1967`." +"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre " +"Vassalotti; :issue:`1967`." msgstr "" -"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre Vassalotti; :" -"issue:`1967`." +"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre " +"Vassalotti; :issue:`1967`." #: ../../whatsnew/2.7.rst:611 msgid "PEP 3137: The memoryview Object" @@ -1032,10 +1201,9 @@ msgid "" "The :class:`memoryview` object provides a view of another object's memory " "content that matches the :class:`bytes` type's interface." msgstr "" -":class:`memoryview` オブジェクトは、他のオブジェクトのメモリの内容に対する :" -"class:`bytes` 型のインターフェースに合わせた view を提供します。" +":class:`memoryview` オブジェクトは、他のオブジェクトのメモリの内容に対す" +"る :class:`bytes` 型のインターフェースに合わせた view を提供します。" -#: ../../whatsnew/2.7.rst:616 msgid "" ">>> import string\n" ">>> m = memoryview(string.letters)\n" @@ -1049,6 +1217,17 @@ msgid "" ">>> m2\n" "" msgstr "" +">>> import string\n" +">>> m = memoryview(string.letters)\n" +">>> m\n" +"\n" +">>> len(m) # 基盤となるオブジェクトの長さを返す\n" +"52\n" +">>> m[0], m[25], m[26] # インデックス指定で 1 バイトを返す\n" +"('a', 'z', 'A')\n" +">>> m2 = m[0:26] # スライスで別の memoryview を返す\n" +">>> m2\n" +"" #: ../../whatsnew/2.7.rst:631 msgid "" @@ -1056,7 +1235,6 @@ msgid "" "integers:" msgstr "view の内容は bytes 型の文字列か整数のリストに変換することができます。" -#: ../../whatsnew/2.7.rst:634 msgid "" ">>> m2.tobytes()\n" "'abcdefghijklmnopqrstuvwxyz'\n" @@ -1064,6 +1242,11 @@ msgid "" "[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" ">>>" msgstr "" +">>> m2.tobytes()\n" +"'abcdefghijklmnopqrstuvwxyz'\n" +">>> m2.tolist()\n" +"[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" +">>>" #: ../../whatsnew/2.7.rst:643 msgid "" @@ -1073,7 +1256,6 @@ msgstr "" ":class:`memoryview` オブジェクトは、対象となる背後のオブジェクトが変更可能 " "(mutable) な場合は、その変更を許可しています。" -#: ../../whatsnew/2.7.rst:646 msgid "" ">>> m2[0] = 75\n" "Traceback (most recent call last):\n" @@ -1088,6 +1270,18 @@ msgid "" "bytearray(b'*bcde')\n" ">>>" msgstr "" +">>> m2[0] = 75\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot modify read-only memory\n" +">>> b = bytearray(string.letters) # ミュータブルなオブジェクトを作る\n" +">>> b\n" +"bytearray(b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')\n" +">>> mb = memoryview(b)\n" +">>> mb[0] = '*' # ビューへの代入で bytearray を変更する。\n" +">>> b[0:5] # bytearray が変更されている。\n" +"bytearray(b'*bcde')\n" +">>>" #: ../../whatsnew/2.7.rst:664 msgid ":pep:`3137` - Immutable Bytes and Mutable Buffer" @@ -1122,7 +1316,6 @@ msgstr "" "value が存在しないことで行われます。なので、``{}`` は引き続き空の dict になり" "ます。空の set を作るときには ``set()`` を使ってください。" -#: ../../whatsnew/2.7.rst:683 msgid "" ">>> {1, 2, 3, 4, 5}\n" "set([1, 2, 3, 4, 5])\n" @@ -1131,6 +1324,12 @@ msgid "" ">>> {} # empty dict\n" "{}" msgstr "" +">>> {1, 2, 3, 4, 5}\n" +"set([1, 2, 3, 4, 5])\n" +">>> set() # 空の集合\n" +"set([])\n" +">>> {} # 空の辞書\n" +"{}" #: ../../whatsnew/2.7.rst:693 msgid "Backported by Alexandre Vassalotti; :issue:`2335`." @@ -1145,13 +1344,16 @@ msgstr "" "dict と set の内包表記も Python 3.x からバックポートされました。list と " "generator の内包表記を set と dict にも使えるように一般化させています。" -#: ../../whatsnew/2.7.rst:699 msgid "" ">>> {x: x*x for x in range(6)}\n" "{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n" ">>> {('a'*x) for x in range(6)}\n" "set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" msgstr "" +">>> {x: x*x for x in range(6)}\n" +"{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n" +">>> {('a'*x) for x in range(6)}\n" +"set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" #: ../../whatsnew/2.7.rst:707 msgid "Backported by Alexandre Vassalotti; :issue:`2333`." @@ -1164,31 +1366,35 @@ msgid "" "is treated as beginning a new :keyword:`!with` statement. This means that::" msgstr "" ":keyword:`with` 文が1つの文で複数のコンテキストマネージャーを使えるようになり" -"ました。コンテキストマネージャーは左から右へ処理され、それぞれが新しい :" -"keyword:`!with` 文の開始となるように扱われます。つまり::" +"ました。コンテキストマネージャーは左から右へ処理され、それぞれが新し" +"い :keyword:`!with` 文の開始となるように扱われます。つまり::" -#: ../../whatsnew/2.7.rst:714 msgid "" "with A() as a, B() as b:\n" " ... suite of statements ..." msgstr "" +"with A() as a, B() as b:\n" +" ... suite of statements ..." #: ../../whatsnew/2.7.rst:717 msgid "is equivalent to::" msgstr "は、以下と同じです ::" -#: ../../whatsnew/2.7.rst:719 msgid "" "with A() as a:\n" " with B() as b:\n" " ... suite of statements ..." msgstr "" +"with A() as a:\n" +" with B() as b:\n" +" ... suite of statements ..." -#: ../../whatsnew/2.7.rst:723 msgid "" "The :func:`!contextlib.nested` function provides a very similar function, so " "it's no longer necessary and has been deprecated." msgstr "" +":func:`!contextlib.nested` は非常に似た機能を提供していましたが、不要になった" +"ため非推奨となりました。" #: ../../whatsnew/2.7.rst:726 msgid "" @@ -1202,11 +1408,12 @@ msgstr "" msgid "" "Conversions between floating-point numbers and strings are now correctly " "rounded on most platforms. These conversions occur in many different " -"places: :func:`str` on floats and complex numbers; the :class:`float` and :" -"class:`complex` constructors; numeric formatting; serializing and " -"deserializing floats and complex numbers using the :mod:`marshal`, :mod:" -"`pickle` and :mod:`json` modules; parsing of float and imaginary literals in " -"Python code; and :class:`~decimal.Decimal`-to-float conversion." +"places: :func:`str` on floats and complex numbers; the :class:`float` " +"and :class:`complex` constructors; numeric formatting; serializing and " +"deserializing floats and complex numbers using " +"the :mod:`marshal`, :mod:`pickle` and :mod:`json` modules; parsing of float " +"and imaginary literals in Python code; and :class:`~decimal.Decimal`-to-" +"float conversion." msgstr "" "浮動小数点数と文字列の間の変換がほとんどのプラットフォームで正しく丸められる" "ようになりました。この変換はいろいろな場面で発生します: float 型や complex 型" @@ -1238,17 +1445,17 @@ msgid "" msgstr "" "丸めライブラリが、この改善が Windows や gcc, icc, suncc を使った Unix 環境で" "動かす役目をおっています。このライブラリの正確な動作が保証できない少しの環境" -"があるので、そういったシステムではこのライブラリは利用されません。 :data:" -"`sys.float_repr_style` が ``short`` なら新しいコードが利用されていて、 " -"``legacy`` なら利用されていません。" +"があるので、そういったシステムではこのライブラリは利用されませ" +"ん。 :data:`sys.float_repr_style` が ``short`` なら新しいコードが利用されてい" +"て、 ``legacy`` なら利用されていません。" #: ../../whatsnew/2.7.rst:757 msgid "" -"Implemented by Eric Smith and Mark Dickinson, using David Gay's :file:`dtoa." -"c` library; :issue:`7117`." +"Implemented by Eric Smith and Mark Dickinson, using David " +"Gay's :file:`dtoa.c` library; :issue:`7117`." msgstr "" -"Implemented by Eric Smith and Mark Dickinson, using David Gay's :file:`dtoa." -"c` library; :issue:`7117`." +"Implemented by Eric Smith and Mark Dickinson, using David " +"Gay's :file:`dtoa.c` library; :issue:`7117`." #: ../../whatsnew/2.7.rst:760 msgid "" @@ -1265,7 +1472,6 @@ msgstr "" "場合に関係します。Python 2.7 はより正確に近似するようになりました。例えば、" "Python 2.6 では次のように計算されていました::" -#: ../../whatsnew/2.7.rst:767 msgid "" ">>> n = 295147905179352891391\n" ">>> float(n)\n" @@ -1273,6 +1479,11 @@ msgid "" ">>> n - long(float(n))\n" "65535L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935283e+20\n" +">>> n - long(float(n))\n" +"65535L" #: ../../whatsnew/2.7.rst:773 msgid "" @@ -1282,7 +1493,6 @@ msgstr "" "Python 2.7 の浮動小数点への変換結果は元の数値より大きくなりますが、元の値によ" "り近くなっています::" -#: ../../whatsnew/2.7.rst:776 msgid "" ">>> n = 295147905179352891391\n" ">>> float(n)\n" @@ -1290,6 +1500,11 @@ msgid "" ">>> n - long(float(n))\n" "-1L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935289e+20\n" +">>> n - long(float(n))\n" +"-1L" #: ../../whatsnew/2.7.rst:782 msgid "(Implemented by Mark Dickinson; :issue:`3166`.)" @@ -1304,12 +1519,14 @@ msgstr "" "division``) の結果もより正確になりました。 (Also implemented by Mark " "Dickinson; :issue:`1811`.)" -#: ../../whatsnew/2.7.rst:787 msgid "" "Implicit coercion for complex numbers has been removed; the interpreter will " "no longer ever attempt to call a :meth:`!__coerce__` method on complex " "objects. (Removed by Meador Inge and Mark Dickinson; :issue:`5211`.)" msgstr "" +"複素数の暗黙の型変換が廃止され、インタープリタは複素数オブジェクトの :meth:`!" +"__coerce__` を呼ぼうとしなくなりました。\n" +"(Meador Inge と Mark Dickinson が削除しました。:issue:`5211`。)" #: ../../whatsnew/2.7.rst:791 msgid "" @@ -1321,13 +1538,16 @@ msgstr "" "するようになりました。これにより :meth:`str.format` をより ``%s`` と同じよう" "に使えるようになりました。 ::" -#: ../../whatsnew/2.7.rst:795 msgid "" ">>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n" "'2009:4:Sunday'\n" ">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" "'2009:4:Sunday'" msgstr "" +">>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n" +"'2009:4:Sunday'\n" +">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" +"'2009:4:Sunday'" #: ../../whatsnew/2.7.rst:800 msgid "" @@ -1343,8 +1563,8 @@ msgstr "" "次の引数を利用します。自動ナンバリングと明示的なナンバリングを混ぜて使うこと" "はできず、全ての置換指定に手動でナンバリングするか、全てを自動ナンバリングに" "任せなければなりません。ただし、上の例の2つめのように、自動ナンバリングと名前" -"フィールドを混ぜて使うことは可能です。 (Contributed by Eric Smith; :issue:" -"`5237`.)" +"フィールドを混ぜて使うことは可能です。 (Contributed by Eric " +"Smith; :issue:`5237`.)" #: ../../whatsnew/2.7.rst:807 msgid "" @@ -1370,9 +1590,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:818 msgid "" -"A low-level change: the :meth:`object.__format__` method now triggers a :exc:" -"`PendingDeprecationWarning` if it's passed a format string, because the :" -"meth:`!__format__` method for :class:`object` converts the object to a " +"A low-level change: the :meth:`object.__format__` method now triggers " +"a :exc:`PendingDeprecationWarning` if it's passed a format string, because " +"the :meth:`!__format__` method for :class:`object` converts the object to a " "string representation and formats that. Previously the method silently " "applied the format string to the string representation, but that could hide " "mistakes in Python code. If you're supplying formatting information such as " @@ -1380,13 +1600,13 @@ msgid "" "applied in some object-specific way. (Fixed by Eric Smith; :issue:`7994`.)" msgstr "" -#: ../../whatsnew/2.7.rst:828 msgid "" "The :func:`int` and :func:`!long` types gained a ``bit_length`` method that " "returns the number of bits necessary to represent its argument in binary::" msgstr "" +":func:`int` と :func:`!long` に、二進数で表すのに必要なビット数を返す " +"``bit_length`` メソッドが加わりました。 ::" -#: ../../whatsnew/2.7.rst:832 msgid "" ">>> n = 37\n" ">>> bin(n)\n" @@ -1399,6 +1619,16 @@ msgid "" ">>> (n+1).bit_length()\n" "124" msgstr "" +">>> n = 37\n" +">>> bin(n)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" #: ../../whatsnew/2.7.rst:843 msgid "(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)" @@ -1416,22 +1646,24 @@ msgstr "" "またま動いていただけの :keyword:`!import` 文を動かなくしてしまう可能性があり" "ます。(Fixed by Meador Inge; :issue:`7902`.)" -#: ../../whatsnew/2.7.rst:851 msgid "" "It's now possible for a subclass of the built-in :class:`!unicode` type to " -"override the :meth:`!__unicode__` method. (Implemented by Victor Stinner; :" -"issue:`1583863`.)" +"override the :meth:`!__unicode__` method. (Implemented by Victor " +"Stinner; :issue:`1583863`.)" msgstr "" +"組み込みの :class:`!unicode` 型のサブクラスで :meth:`!__unicode__` をオーバー" +"ライドできるようになりました。\n" +"(Victor Stinner による実装です。:issue:`1583863`。)" #: ../../whatsnew/2.7.rst:855 msgid "" "The :class:`bytearray` type's :meth:`~bytearray.translate` method now " -"accepts ``None`` as its first argument. (Fixed by Georg Brandl; :issue:" -"`4759`.)" +"accepts ``None`` as its first argument. (Fixed by Georg " +"Brandl; :issue:`4759`.)" msgstr "" ":class:`bytearray` 型の :meth:`~bytearray.translate` メソッドが第一引数に " -"``None`` を受け入れるようになりました。 (Fixed by Georg Brandl; :issue:" -"`4759`.)" +"``None`` を受け入れるようになりました。 (Fixed by Georg " +"Brandl; :issue:`4759`.)" #: ../../whatsnew/2.7.rst:861 msgid "" @@ -1456,28 +1688,33 @@ msgstr "" msgid "" "Two new encodings are now supported: \"cp720\", used primarily for Arabic " "text; and \"cp858\", a variant of CP 850 that adds the euro symbol. (CP720 " -"contributed by Alexander Belchenko and Amaury Forgeot d'Arc in :issue:" -"`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" +"contributed by Alexander Belchenko and Amaury Forgeot d'Arc " +"in :issue:`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" msgstr "" "2つの新しいエンコーディングが追加されました: \"cp720\" は主にアラビア文字に使" "われます。 \"cp858\" は cp850 の一種ですが、ユーロ記号を追加しています。 " -"(CP720 contributed by Alexander Belchenko and Amaury Forgeot d'Arc in :issue:" -"`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" +"(CP720 contributed by Alexander Belchenko and Amaury Forgeot d'Arc " +"in :issue:`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" -#: ../../whatsnew/2.7.rst:879 msgid "" "The :class:`!file` object will now set the :attr:`!filename` attribute on " "the :exc:`IOError` exception when trying to open a directory on POSIX " "platforms (noted by Jan Kaliszewski; :issue:`4764`), and now explicitly " "checks for and forbids writing to read-only file objects instead of trusting " -"the C library to catch and report the error (fixed by Stefan Krah; :issue:" -"`5677`)." +"the C library to catch and report the error (fixed by Stefan " +"Krah; :issue:`5677`)." msgstr "" +":class:`!file` オブジェクトは、POSIX でディレクトリを開こうとしたと" +"き、:exc:`IOError` の :attr:`!filename` を設定するようになりました (Jan " +"Kaliszewski が指摘、:issue:`4764`)。\n" +"また、読み出し専用のファイルへの書き込みを C ライブラリのエラー検出・報告に任" +"せず、明示的に確認して禁止するようになりました (Stefan Krah が修" +"正、:issue:`5677`)。" #: ../../whatsnew/2.7.rst:886 msgid "" -"The Python tokenizer now translates line endings itself, so the :func:" -"`compile` built-in function now accepts code using any line-ending " +"The Python tokenizer now translates line endings itself, so " +"the :func:`compile` built-in function now accepts code using any line-ending " "convention. Additionally, it no longer requires that the code end in a " "newline." msgstr "" @@ -1500,22 +1737,22 @@ msgstr "" #: ../../whatsnew/2.7.rst:896 msgid "" "It's now possible to create weak references to old-style class objects. New-" -"style classes were always weak-referenceable. (Fixed by Antoine Pitrou; :" -"issue:`8268`.)" +"style classes were always weak-referenceable. (Fixed by Antoine " +"Pitrou; :issue:`8268`.)" msgstr "" "古いスタイルのクラスのオブジェクトに対して弱参照を作れるようになりました。新" -"スタイルクラスには以前から弱参照を利用できます。(Fixed by Antoine Pitrou; :" -"issue:`8268`.)" +"スタイルクラスには以前から弱参照を利用できます。(Fixed by Antoine " +"Pitrou; :issue:`8268`.)" #: ../../whatsnew/2.7.rst:900 msgid "" "When a module object is garbage-collected, the module's dictionary is now " -"only cleared if no one else is holding a reference to the dictionary (:issue:" -"`7140`)." +"only cleared if no one else is holding a reference to the dictionary " +"(:issue:`7140`)." msgstr "" "モジュールオブジェクトがGCされたとき、モジュールの辞書は、他にその辞書への参" -"照を持っているものがない場合にのみクリアされるようになりました。(:issue:" -"`7140`)." +"照を持っているものがない場合にのみクリアされるようになりました。" +"(:issue:`7140`)." #: ../../whatsnew/2.7.rst:909 msgid "Interpreter Changes" @@ -1530,20 +1767,21 @@ msgid "" msgstr "" "新しい環境変数 :envvar:`PYTHONWARNINGS` を使って警告を制御できるようになりま" "した。この環境変数には、 :option:`-W` スイッチに使われる警告の設定を、カンマ" -"区切りの文字列として指定します。 (Contributed by Brian Curtin; :issue:" -"`7301`.)" +"区切りの文字列として指定します。 (Contributed by Brian " +"Curtin; :issue:`7301`.)" -#: ../../whatsnew/2.7.rst:917 msgid "" "For example, the following setting will print warnings every time they " "occur, but turn warnings from the :mod:`Cookie ` module into " "an error. (The exact syntax for setting an environment variable varies " "across operating systems and shells.)" msgstr "" +"例えば次の設定では、警告を発生のたびに表示しますが、:mod:`Cookie " +"` からの警告はエラーにします。\n" +"(環境変数の設定構文は OS やシェルによって異なります。)" -#: ../../whatsnew/2.7.rst:924 msgid "export PYTHONWARNINGS=all,error:::Cookie:0" -msgstr "" +msgstr "export PYTHONWARNINGS=all,error:::Cookie:0" #: ../../whatsnew/2.7.rst:930 msgid "Optimizations" @@ -1553,12 +1791,14 @@ msgstr "最適化" msgid "Several performance enhancements have been added:" msgstr "いくつかの場面でパフォーマンスが向上しています。" -#: ../../whatsnew/2.7.rst:934 msgid "" "A new opcode was added to perform the initial setup for :keyword:`with` " -"statements, looking up the :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods. (Contributed by Benjamin Peterson.)" +"statements, looking up the :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods. (Contributed by Benjamin Peterson.)" msgstr "" +":keyword:`with` 文の初期設定を行い、:meth:`~object.__enter__` " +"と :meth:`~object.__exit__` を検索する新しいオペコードが追加されました。\n" +"(Benjamin Peterson による貢献です。)" #: ../../whatsnew/2.7.rst:938 msgid "" @@ -1594,10 +1834,9 @@ msgstr "" "Python 2.7 では、アトミックな型(整数、文字列など)のみを含むタプルと辞書は追跡" "されません。推移的に、アトミックな型のみを含むタプルを含む辞書も、同じく追跡" "されません。これにより、GCによって巡回されチェックされるオブジェクトの数が減" -"るので、 GCのコストを減らすことができます。 (Contributed by Antoine Pitrou; :" -"issue:`4688`.)" +"るので、 GCのコストを減らすことができます。 (Contributed by Antoine " +"Pitrou; :issue:`4688`.)" -#: ../../whatsnew/2.7.rst:958 msgid "" "Long integers are now stored internally either in base ``2**15`` or in base " "``2**30``, the base being determined at build time. Previously, they were " @@ -1608,8 +1847,16 @@ msgid "" "new configure option :option:`!--enable-big-digits` that can be used to " "override this default." msgstr "" +"長整数は内部で、ビルド時に選ぶ ``2**15`` または ``2**30`` を基数として格納さ" +"れるようになりました。\n" +"以前は常に ``2**15`` でした。\n" +"``2**30`` を使うと 64 ビットマシンで大幅に高速化しますが、32 ビットでのベンチ" +"マーク結果はまちまちでした。\n" +"そのため、デフォルトでは 64 ビットで ``2**30``、32 ビットで ``2**15`` を使い" +"ます。\n" +"Unix では、新しい configure オプション :option:`!--enable-big-digits` でこの" +"デフォルトを上書きできます。" -#: ../../whatsnew/2.7.rst:967 msgid "" "Apart from the performance improvements this change should be invisible to " "end users, with one exception: for testing and debugging purposes there's a " @@ -1617,13 +1864,20 @@ msgid "" "internal format, giving the number of bits per digit and the size in bytes " "of the C type used to store each digit::" msgstr "" +"性能の改善を除けば、この変更は利用者には見えないはずですが、例外が一つありま" +"す。\n" +"テストやデバッグ向けの新しい structseq :data:`!sys.long_info` で内部形式の情" +"報を得られ、1 桁あたりのビット数や、各桁の格納に使う C 型のサイズをバイト単位" +"で確認できます。 ::" -#: ../../whatsnew/2.7.rst:974 msgid "" ">>> import sys\n" ">>> sys.long_info\n" "sys.long_info(bits_per_digit=30, sizeof_digit=4)" msgstr "" +">>> import sys\n" +">>> sys.long_info\n" +"sys.long_info(bits_per_digit=30, sizeof_digit=4)" #: ../../whatsnew/2.7.rst:978 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" @@ -1669,8 +1923,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:999 msgid "" "List comprehensions with an ``if`` condition are compiled into faster " -"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey Yasskin; :" -"issue:`4715`.)" +"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey " +"Yasskin; :issue:`4715`.)" msgstr "" "``if`` 条件付きのリスト内包表記がより高速なバイトコードにコンパイルされるよう" "になりました。(Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey " @@ -1686,7 +1940,6 @@ msgstr "" "関数を使う代わりに10進数に特殊化した処理を行うことで高速化しました。 (Patch " "by Gawain Bolton; :issue:`6713`.)" -#: ../../whatsnew/2.7.rst:1008 msgid "" "The :meth:`!split`, :meth:`!replace`, :meth:`!rindex`, :meth:`!rpartition`, " "and :meth:`!rsplit` methods of string-like types (strings, Unicode strings, " @@ -1694,20 +1947,30 @@ msgid "" "instead of a character-by-character scan. This is sometimes faster by a " "factor of 10. (Added by Florent Xicluna; :issue:`7462` and :issue:`7622`.)" msgstr "" +"文字列風の型 (文字列、Unicode 文字列、:class:`bytearray`) の :meth:`!" +"split`、:meth:`!replace`、:meth:`!rindex`、:meth:`!rpartition`、:meth:`!" +"rsplit` が、1 文字ずつの走査ではなく高速な逆方向検索アルゴリズムを使うように" +"なりました。\n" +"場合によっては 10 倍高速になります。\n" +"(Florent Xicluna が追加しました。:issue:`7462`、:issue:`7622`。)" -#: ../../whatsnew/2.7.rst:1015 msgid "" "The :mod:`pickle` and :mod:`!cPickle` modules now automatically intern the " "strings used for attribute names, reducing memory usage of the objects " "resulting from unpickling. (Contributed by Jake McGuire; :issue:`5084`.)" msgstr "" +":mod:`pickle` と :mod:`!cPickle` は、属性名に使う文字列を自動的にインターン化" +"するようになり、復元したオブジェクトのメモリ使用量が減りました。\n" +"(Jake McGuire による貢献です。:issue:`5084`。)" -#: ../../whatsnew/2.7.rst:1020 msgid "" "The :mod:`!cPickle` module now special-cases dictionaries, nearly halving " -"the time required to pickle them. (Contributed by Collin Winter; :issue:" -"`5670`.)" +"the time required to pickle them. (Contributed by Collin " +"Winter; :issue:`5670`.)" msgstr "" +":mod:`!cPickle` が辞書を特別に扱うようになり、pickle 化にかかる時間がほぼ半分" +"になりました。\n" +"(Collin Winter による貢献です。:issue:`5670`。)" #: ../../whatsnew/2.7.rst:1027 msgid "New and Improved Modules" @@ -1733,15 +1996,15 @@ msgid "" "feature for skipping modules. The constructor now takes an iterable " "containing glob-style patterns such as ``django.*``; the debugger will not " "step into stack frames from a module that matches one of these patterns. " -"(Contributed by Maru Newby after a suggestion by Senthil Kumaran; :issue:" -"`5142`.)" +"(Contributed by Maru Newby after a suggestion by Senthil " +"Kumaran; :issue:`5142`.)" msgstr "" ":mod:`bdb` モジュールの基底デバッガクラス :class:`~bdb.Bdb` に、モジュールを" "スキップする機能が追加されました。コンストラクタは ``django.*`` のような " "glob スタイルのパターンをもった iterable を引数として受け取ります。デバッガは" "パターンのどれかにマッチするスタックフレームにステップインしません。 " -"(Contributed by Maru Newby after a suggestion by Senthil Kumaran; :issue:" -"`5142`.)" +"(Contributed by Maru Newby after a suggestion by Senthil " +"Kumaran; :issue:`5142`.)" #: ../../whatsnew/2.7.rst:1043 msgid "" @@ -1749,11 +2012,11 @@ msgid "" "with :class:`memoryview` instances and other similar buffer objects. " "(Backported from 3.x by Florent Xicluna; :issue:`7703`.)" msgstr "" -":mod:`binascii` モジュールが buffer API をサポートするようになり、 :class:" -"`memoryview` インスタンスやその他のバッファオブジェクトともに利用できるように" -"なりました。 (Backported from 3.x by Florent Xicluna; :issue:`7703`.)" +":mod:`binascii` モジュールが buffer API をサポートするようにな" +"り、 :class:`memoryview` インスタンスやその他のバッファオブジェクトともに利用" +"できるようになりました。 (Backported from 3.x by Florent " +"Xicluna; :issue:`7703`.)" -#: ../../whatsnew/2.7.rst:1047 msgid "" "Updated module: the :mod:`!bsddb` module has been updated from 4.7.2devel9 " "to version 4.8.4 of `the pybsddb package `__ の 4.7.2devel9 から 4.8.4 に更新されました。\n" +"Python 3.x との互換性改善、各種バグ修正、BerkeleyDB の新しいフラグやメソッド" +"の追加が含まれます。\n" +"(Jesús Cea Avión が更新しました。:issue:`8156`。\n" +"pybsddb の変更履歴は https://hg.jcea.es/pybsddb/file/tip/ChangeLog で読めま" +"す。)" #: ../../whatsnew/2.7.rst:1055 msgid "" @@ -1771,8 +2041,8 @@ msgid "" msgstr "" ":mod:`bz2` モジュールの :class:`~bz2.BZ2File` がコンテキストマネージャープロ" "トコルをサポートするようになりました。これにより、 ``with bz2.BZ2File(...) " -"as f:`` といった書き方ができます。 (Contributed by Hagen Fürstenau; :issue:" -"`3860`.)" +"as f:`` といった書き方ができます。 (Contributed by Hagen " +"Fürstenau; :issue:`3860`.)" #: ../../whatsnew/2.7.rst:1059 msgid "" @@ -1783,10 +2053,9 @@ msgid "" msgstr "" ":mod:`collections` モジュールの新しい :class:`~collections.Counter` クラス" "は、データの数え上げをするときに便利です。 :class:`~collections.Counter` イン" -"スタンスは辞書のように振る舞いますが、キーが存在しなかったときに :exc:" -"`KeyError` 例外を発生させる代わりに 0 を返します。" +"スタンスは辞書のように振る舞いますが、キーが存在しなかったとき" +"に :exc:`KeyError` 例外を発生させる代わりに 0 を返します。" -#: ../../whatsnew/2.7.rst:1064 msgid "" ">>> from collections import Counter\n" ">>> c = Counter()\n" @@ -1802,26 +2071,38 @@ msgid "" ">>> c['z']\n" "0" msgstr "" +">>> from collections import Counter\n" +">>> c = Counter()\n" +">>> for letter in 'here is a sample of english text':\n" +"... c[letter] += 1\n" +"...\n" +">>> c\n" +"Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" +"'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" +"'p': 1, 'r': 1, 'x': 1})\n" +">>> c['e']\n" +"5\n" +">>> c['z']\n" +"0" #: ../../whatsnew/2.7.rst:1081 msgid "" -"There are three additional :class:`~collections.Counter` methods. :meth:" -"`~collections.Counter.most_common` returns the N most common elements and " -"their counts. :meth:`~collections.Counter.elements` returns an iterator " -"over the contained elements, repeating each element as many times as its " -"count. :meth:`~collections.Counter.subtract` takes an iterable and subtracts " -"one for each element instead of adding; if the argument is a dictionary or " -"another :class:`Counter`, the counts are subtracted. ::" +"There are three additional :class:`~collections.Counter` " +"methods. :meth:`~collections.Counter.most_common` returns the N most common " +"elements and their counts. :meth:`~collections.Counter.elements` returns an " +"iterator over the contained elements, repeating each element as many times " +"as its count. :meth:`~collections.Counter.subtract` takes an iterable and " +"subtracts one for each element instead of adding; if the argument is a " +"dictionary or another :class:`Counter`, the counts are subtracted. ::" msgstr "" -":class:`~collections.Counter` には追加の3つのメソッドがあります。 :meth:" -"`~collections.Counter.most_common` はカウントが最も多い N 要素とそのカウント" -"を返します。 :meth:`~collections.Counter.elements` はカウントしている要素を、" -"そのカウント数だけ繰り返すイテレータを返します。 :meth:`~collections.Counter." -"subtract` はイテレート可能型を受け取り、その各要素を足すのではなく引いて行き" -"ます。引数が辞書か他の :class:`Counter` だった場合は、そのカウントが引かれま" -"す。 ::" +":class:`~collections.Counter` には追加の3つのメソッドがありま" +"す。 :meth:`~collections.Counter.most_common` はカウントが最も多い N 要素とそ" +"のカウントを返します。 :meth:`~collections.Counter.elements` はカウントしてい" +"る要素を、そのカウント数だけ繰り返すイテレータを返しま" +"す。 :meth:`~collections.Counter.subtract` はイテレート可能型を受け取り、その" +"各要素を足すのではなく引いて行きます。引数が辞書か他の :class:`Counter` だっ" +"た場合は、そのカウントが引かれます。 ::" -#: ../../whatsnew/2.7.rst:1091 msgid "" ">>> c.most_common(5)\n" "[(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)]\n" @@ -1836,6 +2117,18 @@ msgid "" ">>> c['e'] # Count is now lower\n" "-1" msgstr "" +">>> c.most_common(5)\n" +"[(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)]\n" +">>> c.elements() ->\n" +" 'a', 'a', ' ', ' ', ' ', ' ', ' ', ' ',\n" +" 'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',\n" +" 'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',\n" +" 's', 's', 'r', 't', 't', 'x'\n" +">>> c['e']\n" +"5\n" +">>> c.subtract('very heavy on the letter e')\n" +">>> c['e'] # 回数が減っている\n" +"-1" #: ../../whatsnew/2.7.rst:1104 msgid "Contributed by Raymond Hettinger; :issue:`1696199`." @@ -1851,20 +2144,21 @@ msgstr "" #: ../../whatsnew/2.7.rst:1111 msgid "" -"New method: The :class:`~collections.deque` data type now has a :meth:" -"`~collections.deque.count` method that returns the number of contained " -"elements equal to the supplied argument *x*, and a :meth:`~collections.deque." -"reverse` method that reverses the elements of the deque in-place. :class:" -"`~collections.deque` also exposes its maximum length as the read-only :attr:" -"`~collections.deque.maxlen` attribute. (Both features added by Raymond " -"Hettinger.)" -msgstr "" -"メソッドが追加されました。:class:`~collections.deque` データ型の :meth:" -"`~collections.deque.count` メソッドは、引数で指定された *x* と等しい要素が何" -"個入っているかを返します。 :meth:`~collections.deque.reverse` メソッドは " -"deque 内の要素をインプレースで逆順にします。 :class:`~collections.deque` はま" -"た、最大長を返す読み出し専用の属性 :attr:`~collections.deque.maxlen` を持ちま" -"す。 (Both features added by Raymond Hettinger.)" +"New method: The :class:`~collections.deque` data type now has " +"a :meth:`~collections.deque.count` method that returns the number of " +"contained elements equal to the supplied argument *x*, and " +"a :meth:`~collections.deque.reverse` method that reverses the elements of " +"the deque in-place. :class:`~collections.deque` also exposes its maximum " +"length as the read-only :attr:`~collections.deque.maxlen` attribute. (Both " +"features added by Raymond Hettinger.)" +msgstr "" +"メソッドが追加されました。:class:`~collections.deque` データ型" +"の :meth:`~collections.deque.count` メソッドは、引数で指定された *x* と等し" +"い要素が何個入っているかを返します。 :meth:`~collections.deque.reverse` メ" +"ソッドは deque 内の要素をインプレースで逆順にしま" +"す。 :class:`~collections.deque` はまた、最大長を返す読み出し専用の属" +"性 :attr:`~collections.deque.maxlen` を持ちます。 (Both features added by " +"Raymond Hettinger.)" #: ../../whatsnew/2.7.rst:1119 msgid "" @@ -1882,21 +2176,26 @@ msgstr "" msgid "(Added by Raymond Hettinger; :issue:`1818`.)" msgstr "(Added by Raymond Hettinger; :issue:`1818`.)" -#: ../../whatsnew/2.7.rst:1132 msgid "" "Finally, the :class:`~collections.abc.Mapping` abstract base class now " "returns :data:`NotImplemented` if a mapping is compared to another type that " "isn't a :class:`Mapping`. (Fixed by Daniel Stutzbach; :issue:`8729`.)" msgstr "" +"最後に、抽象基底クラス :class:`~collections.abc.Mapping` " +"は、:class:`Mapping` でない型との比較で :data:`NotImplemented` を返すようにな" +"りました。\n" +"(Daniel Stutzbach が修正しました。:issue:`8729`。)" -#: ../../whatsnew/2.7.rst:1137 msgid "" "Constructors for the parsing classes in the :mod:`ConfigParser " "` module now take an *allow_no_value* parameter, defaulting to " "false; if true, options without values will be allowed. For example::" msgstr "" +":mod:`ConfigParser ` の解析用クラスのコンストラクターに、デフォ" +"ルトで偽の *allow_no_value* が加わりました。\n" +"真なら、値のないオプションを許します。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/2.7.rst:1141 msgid "" ">>> import ConfigParser, StringIO\n" ">>> sample_config = \"\"\"\n" @@ -1916,25 +2215,46 @@ msgid "" " ...\n" "NoOptionError: No option 'unknown' in section: 'mysqld'" msgstr "" +">>> import ConfigParser, StringIO\n" +">>> sample_config = \"\"\"\n" +"... [mysqld]\n" +"... user = mysql\n" +"... pid-file = /var/run/mysqld/mysqld.pid\n" +"... skip-bdb\n" +"... \"\"\"\n" +">>> config = ConfigParser.RawConfigParser(allow_no_value=True)\n" +">>> config.readfp(StringIO.StringIO(sample_config))\n" +">>> config.get('mysqld', 'user')\n" +"'mysql'\n" +">>> print config.get('mysqld', 'skip-bdb')\n" +"None\n" +">>> print config.get('mysqld', 'unknown')\n" +"Traceback (most recent call last):\n" +" ...\n" +"NoOptionError: No option 'unknown' in section: 'mysqld'" #: ../../whatsnew/2.7.rst:1159 msgid "(Contributed by Mats Kindahl; :issue:`7005`.)" msgstr "(Contributed by Mats Kindahl; :issue:`7005`.)" -#: ../../whatsnew/2.7.rst:1161 msgid "" "Deprecated function: :func:`!contextlib.nested`, which allows handling more " "than one context manager with a single :keyword:`with` statement, has been " "deprecated, because the :keyword:`!with` statement now supports multiple " "context managers." msgstr "" +"非推奨の関数: 一つの :keyword:`with` 文で複数のコンテキストマネージャーを扱" +"う :func:`!contextlib.nested` が非推奨となりました。\n" +":keyword:`!with` 文自体が複数のコンテキストマネージャーに対応したためです。" -#: ../../whatsnew/2.7.rst:1166 msgid "" "The :mod:`cookielib ` module now ignores cookies that have " "an invalid version field, one that doesn't contain an integer value. (Fixed " "by John J. Lee; :issue:`3924`.)" msgstr "" +":mod:`cookielib ` は、version フィールドが整数でない不正な" +"クッキーを無視するようになりました。\n" +"(John J. Lee が修正しました。:issue:`3924`。)" #: ../../whatsnew/2.7.rst:1170 msgid "" @@ -1942,16 +2262,17 @@ msgid "" "copy bound instance methods. (Implemented by Robert Collins; :issue:`1515`.)" msgstr "" ":mod:`copy` モジュールの :func:`~copy.deepcopy` 関数が、束縛ずみインスタンス" -"メソッドを正しくコピーするようになりました。(Implemented by Robert Collins; :" -"issue:`1515`.)" +"メソッドを正しくコピーするようになりました。(Implemented by Robert " +"Collins; :issue:`1515`.)" #: ../../whatsnew/2.7.rst:1174 msgid "" "The :mod:`ctypes` module now always converts ``None`` to a C ``NULL`` " -"pointer for arguments declared as pointers. (Changed by Thomas Heller; :" -"issue:`4606`.) The underlying `libffi library `__ has been updated to version 3.0.9, containing various fixes for " -"different platforms. (Updated by Matthias Klose; :issue:`8142`.)" +"pointer for arguments declared as pointers. (Changed by Thomas " +"Heller; :issue:`4606`.) The underlying `libffi library `__ has been updated to version 3.0.9, containing " +"various fixes for different platforms. (Updated by Matthias " +"Klose; :issue:`8142`.)" msgstr "" ":mod:`ctypes` モジュールが、ポインタとして宣言された引数に対して ``None`` が" "渡された場合常に C の ``NULL`` ポインタに変換するようになりました。(Changed " @@ -1964,26 +2285,34 @@ msgstr "" msgid "" "New method: the :mod:`datetime` module's :class:`~datetime.timedelta` class " "gained a :meth:`~datetime.timedelta.total_seconds` method that returns the " -"number of seconds in the duration. (Contributed by Brian Quinlan; :issue:" -"`5788`.)" +"number of seconds in the duration. (Contributed by Brian " +"Quinlan; :issue:`5788`.)" msgstr "" "新しいメソッド: :mod:`datetime` モジュールの :class:`~datetime.timedelta` ク" "ラスに :meth:`~datetime.timedelta.total_seconds` メソッドが追加されました。こ" "れはその期間の秒数を返します。(Contributed by Brian Quinlan; :issue:`5788`.)" -#: ../../whatsnew/2.7.rst:1185 msgid "" -"New method: the :class:`~decimal.Decimal` class gained a :meth:`~decimal." -"Decimal.from_float` class method that performs an exact conversion of a " -"floating-point number to a :class:`!Decimal`. This exact conversion strives " -"for the closest decimal approximation to the floating-point representation's " -"value; the resulting decimal value will therefore still include the " -"inaccuracy, if any. For example, ``Decimal.from_float(0.1)`` returns " +"New method: the :class:`~decimal.Decimal` class gained " +"a :meth:`~decimal.Decimal.from_float` class method that performs an exact " +"conversion of a floating-point number to a :class:`!Decimal`. This exact " +"conversion strives for the closest decimal approximation to the floating-" +"point representation's value; the resulting decimal value will therefore " +"still include the inaccuracy, if any. For example, " +"``Decimal.from_float(0.1)`` returns " "``Decimal('0.1000000000000000055511151231257827021181583404541015625')``. " "(Implemented by Raymond Hettinger; :issue:`4796`.)" msgstr "" +"新メソッド: :class:`~decimal.Decimal` にクラスメソッ" +"ド :meth:`~decimal.Decimal.from_float` が加わり、浮動小数点数を :class:`!" +"Decimal` へ正確に変換できます。\n" +"浮動小数点表現の値を可能な限り近い十進数に変換するため、元の値に誤差があれ" +"ば、その誤差も結果に含まれます。\n" +"例えば ``Decimal.from_float(0.1)`` は " +"``Decimal('0.1000000000000000055511151231257827021181583404541015625')`` を返" +"します。\n" +"(Raymond Hettinger による実装です。:issue:`4796`。)" -#: ../../whatsnew/2.7.rst:1196 msgid "" "Comparing instances of :class:`~decimal.Decimal` with floating-point numbers " "now produces sensible results based on the numeric values of the operands. " @@ -1994,13 +2323,21 @@ msgid "" "how to convert between float and :class:`!Decimal`. (Fixed by Mark " "Dickinson; :issue:`2531`.)" msgstr "" +":class:`~decimal.Decimal` と浮動小数点数の比較が、オペランドの数値に基づく適" +"切な結果を返すようになりました。\n" +"これまでは、Python のデフォルトのオブジェクト比較規則に従い、型によって恣意的" +"な結果になっていました。\n" +"ただし、加算などのほかの演算で :class:`!Decimal` と浮動小数点数を混在させるこ" +"とは、引き続きできません。\n" +"float と :class:`!Decimal` の変換方法を明示的に選ぶ必要があるためです。\n" +"(Mark Dickinson が修正しました。:issue:`2531`。)" #: ../../whatsnew/2.7.rst:1205 msgid "" "The constructor for :class:`~decimal.Decimal` now accepts floating-point " "numbers (added by Raymond Hettinger; :issue:`8257`) and non-European Unicode " -"characters such as Arabic-Indic digits (contributed by Mark Dickinson; :" -"issue:`6595`)." +"characters such as Arabic-Indic digits (contributed by Mark " +"Dickinson; :issue:`6595`)." msgstr "" ":class:`~decimal.Decimal` のコンストラクタが浮動小数点数を受け入れるようにな" "りました。 (added by Raymond Hettinger; :issue:`8257`) また、アラビア・インド" @@ -2011,20 +2348,22 @@ msgstr "" msgid "" "Most of the methods of the :class:`~decimal.Context` class now accept " "integers as well as :class:`~decimal.Decimal` instances; the only exceptions " -"are the :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context." -"is_canonical` methods. (Patch by Juan José Conti; :issue:`7633`.)" +"are the :meth:`~decimal.Context.canonical` " +"and :meth:`~decimal.Context.is_canonical` methods. (Patch by Juan José " +"Conti; :issue:`7633`.)" msgstr "" -":class:`~decimal.Context` クラスのほとんどのメソッドが :class:`~decimal." -"Decimal` インスタンスと同じく整数を受け入れるようになりました。例外は :meth:" -"`~decimal.Context.canonical` と :meth:`~decimal.Context.is_canonical` メソッ" -"ドだけです。 (Patch by Juan José Conti; :issue:`7633`.)" +":class:`~decimal.Context` クラスのほとんどのメソッド" +"が :class:`~decimal.Decimal` インスタンスと同じく整数を受け入れるようになりま" +"した。例外は :meth:`~decimal.Context.canonical` " +"と :meth:`~decimal.Context.is_canonical` メソッドだけです。 (Patch by Juan " +"José Conti; :issue:`7633`.)" #: ../../whatsnew/2.7.rst:1215 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:`~str." -"format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which is more sensible for numeric " -"types. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`~str.format` method, the default alignment was previously " +"left-alignment. This has been changed to right-alignment, which is more " +"sensible for numeric types. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" ":class:`~decimal.Decimal` インスタンスを文字列の :meth:`~str.format` メソッド" "で利用した場合、デフォルトのアライメントが左揃えから、数値型に適した右揃えに" @@ -2032,10 +2371,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1220 ../../whatsnew/2.7.rst:2484 msgid "" -"Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:" -"`~decimal.InvalidOperation` instead of silently returning a true or false " -"value depending on the comparison operator. Quiet NaN values (or ``NaN``) " -"are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" +"Comparisons involving a signaling NaN value (or ``sNAN``) now " +"signal :const:`~decimal.InvalidOperation` instead of silently returning a " +"true or false value depending on the comparison operator. Quiet NaN values " +"(or ``NaN``) are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" msgstr "" "signaling NaN (あるいは ``sNAN``) との比較は、暗黙に比較演算に応じて真偽値を" "返すのではなく、 :const:`~decimal.InvalidOperation` 例外を発生させるようにな" @@ -2051,8 +2390,8 @@ msgid "" msgstr "" ":mod:`difflib` モジュールの出力が、ファイル名を含むヘッダのセパレータにスペー" "スではなくタブ文字を使うようになり、最近の :command:`diff`/:command:`patch` " -"ツールとの互換性が高くなりました。(Fixed by Anatoly Techtonik; :issue:" -"`7585`.)" +"ツールとの互換性が高くなりました。(Fixed by Anatoly " +"Techtonik; :issue:`7585`.)" #: ../../whatsnew/2.7.rst:1232 msgid "" @@ -2066,32 +2405,37 @@ msgstr "" "まれるようにするために、毎回 :file:`MANIFEST` ファイルを再生成するようになり" "ました。 (Fixed by Tarek Ziadé; :issue:`8688`.)" -#: ../../whatsnew/2.7.rst:1238 msgid "" "The :mod:`doctest` module's :const:`~doctest.IGNORE_EXCEPTION_DETAIL` flag " "will now ignore the name of the module containing the exception being " "tested. (Patch by Lennart Regebro; :issue:`7490`.)" msgstr "" +":mod:`doctest` の :const:`~doctest.IGNORE_EXCEPTION_DETAIL` が、テスト対象の" +"例外を定義するモジュール名も無視するようになりました。\n" +"(Lennart Regebro によるパッチです。:issue:`7490`。)" -#: ../../whatsnew/2.7.rst:1242 msgid "" "The :mod:`email` module's :class:`~email.message.Message` class will now " "accept a Unicode-valued payload, automatically converting the payload to the " -"encoding specified by :attr:`!output_charset`. (Added by R. David Murray; :" -"issue:`1368247`.)" +"encoding specified by :attr:`!output_charset`. (Added by R. David " +"Murray; :issue:`1368247`.)" msgstr "" +":mod:`email` の :class:`~email.message.Message` が Unicode のペイロードを受け" +"付け、:attr:`!output_charset` が指定するエンコーディングへ自動的に変換するよ" +"うになりました。\n" +"(R. David Murray が追加しました。:issue:`1368247`。)" #: ../../whatsnew/2.7.rst:1247 msgid "" -"The :class:`~fractions.Fraction` class now accepts a single float or :class:" -"`~decimal.Decimal` instance, or two rational numbers, as arguments to its " -"constructor. (Implemented by Mark Dickinson; rationals added in :issue:" -"`5812`, and float/decimal in :issue:`8294`.)" +"The :class:`~fractions.Fraction` class now accepts a single float " +"or :class:`~decimal.Decimal` instance, or two rational numbers, as arguments " +"to its constructor. (Implemented by Mark Dickinson; rationals added " +"in :issue:`5812`, and float/decimal in :issue:`8294`.)" msgstr "" ":class:`~fractions.Fraction` クラスが、コンストラクタの引数として、 1つの " "float 値、 :class:`~decimal.Decimal` インスタンス、 2つの有理数を受け入れるよ" -"うになりました。(Implemented by Mark Dickinson; rationals added in :issue:" -"`5812`, and float/decimal in :issue:`8294`.)" +"うになりました。(Implemented by Mark Dickinson; rationals added " +"in :issue:`5812`, and float/decimal in :issue:`8294`.)" #: ../../whatsnew/2.7.rst:1253 msgid "" @@ -2099,16 +2443,16 @@ msgid "" "complex numbers now raise a :exc:`TypeError`. This fixes an oversight, " "making the :class:`~fractions.Fraction` match the other numeric types." msgstr "" -"fraction と complex 数の間の順序比較演算 (``<``, ``<=``, ``>``, ``>=``)が :" -"exc:`TypeError` 例外を発生させるようになりました。これは過失を修正し、 :" -"class:`~fractions.Fraction` を他の数値型とマッチさせます。" +"fraction と complex 数の間の順序比較演算 (``<``, ``<=``, ``>``, ``>=``)" +"が :exc:`TypeError` 例外を発生させるようになりました。これは過失を修正" +"し、 :class:`~fractions.Fraction` を他の数値型とマッチさせます。" #: ../../whatsnew/2.7.rst:1260 msgid "" "New class: :class:`~ftplib.FTP_TLS` in the :mod:`ftplib` module provides " "secure FTP connections using TLS encapsulation of authentication as well as " -"subsequent control and data transfers. (Contributed by Giampaolo Rodola; :" -"issue:`2054`.)" +"subsequent control and data transfers. (Contributed by Giampaolo " +"Rodola; :issue:`2054`.)" msgstr "" "新しいクラス: :class:`~ftplib.FTP_TLS` が :mod:`ftplib` に追加されました。認" "証とその後の制御・データ転送をTLSカプセル化することでセキュアなFTP接続を提供" @@ -2117,8 +2461,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1266 msgid "" "The :meth:`~ftplib.FTP.storbinary` method for binary uploads can now restart " -"uploads thanks to an added *rest* parameter (patch by Pablo Mouzo; :issue:" -"`6845`.)" +"uploads thanks to an added *rest* parameter (patch by Pablo " +"Mouzo; :issue:`6845`.)" msgstr "" "バイナリデータのアップロードを行う :meth:`~ftplib.FTP.storbinary` に *rest* " "引数が追加され、アップロードのリスタートができるようになりました。 (patch by " @@ -2126,23 +2470,24 @@ msgstr "" #: ../../whatsnew/2.7.rst:1270 msgid "" -"New class decorator: :func:`~functools.total_ordering` in the :mod:" -"`functools` module takes a class that defines an :meth:`~object.__eq__` " -"method and one of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:" -"`~object.__gt__`, or :meth:`~object.__ge__`, and generates the missing " -"comparison methods. Since the :meth:`!__cmp__` method is being deprecated " -"in Python 3.x, this decorator makes it easier to define ordered classes. " -"(Added by Raymond Hettinger; :issue:`5479`.)" +"New class decorator: :func:`~functools.total_ordering` in " +"the :mod:`functools` module takes a class that defines " +"an :meth:`~object.__eq__` method and one " +"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"or :meth:`~object.__ge__`, and generates the missing comparison methods. " +"Since the :meth:`!__cmp__` method is being deprecated in Python 3.x, this " +"decorator makes it easier to define ordered classes. (Added by Raymond " +"Hettinger; :issue:`5479`.)" msgstr "" #: ../../whatsnew/2.7.rst:1278 msgid "" "New function: :func:`~functools.cmp_to_key` will take an old-style " "comparison function that expects two arguments and return a new callable " -"that can be used as the *key* parameter to functions such as :func:" -"`sorted`, :func:`min` and :func:`max`, etc. The primary intended use is to " -"help with making code compatible with Python 3.x. (Added by Raymond " -"Hettinger.)" +"that can be used as the *key* parameter to functions such " +"as :func:`sorted`, :func:`min` and :func:`max`, etc. The primary intended " +"use is to help with making code compatible with Python 3.x. (Added by " +"Raymond Hettinger.)" msgstr "" "新しい関数: :func:`~functools.cmp_to_key` 関数は、古いスタイルの2引数を受け取" "る比較関数を受け取り、 :func:`sorted`, :func:`min`, :func:`max` などの *key* " @@ -2164,21 +2509,22 @@ msgstr "" msgid "" "The :mod:`gzip` module's :class:`~gzip.GzipFile` now supports the context " "management protocol, so you can write ``with gzip.GzipFile(...) as f:`` " -"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements the :" -"class:`io.BufferedIOBase` ABC, so you can wrap it with :class:`io." -"BufferedReader` for faster processing (contributed by Nir Aides; :issue:" -"`7471`). It's also now possible to override the modification time recorded " -"in a gzipped file by providing an optional timestamp to the constructor. " -"(Contributed by Jacques Frechet; :issue:`4272`.)" +"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements " +"the :class:`io.BufferedIOBase` ABC, so you can wrap it " +"with :class:`io.BufferedReader` for faster processing (contributed by Nir " +"Aides; :issue:`7471`). It's also now possible to override the modification " +"time recorded in a gzipped file by providing an optional timestamp to the " +"constructor. (Contributed by Jacques Frechet; :issue:`4272`.)" msgstr "" ":mod:`gzip` モジュールの :class:`~gzip.GzipFile` がコンテキストマネージャープ" "ロトコルをサポートしました。 ``with gzip.GzipFile(...) as f:`` と書くことがで" -"きます。(contributed by Hagen Fürstenau; :issue:`3860` また、 :class:`io." -"BufferedIOBase` ABC を実装しています。なので、より高速な処理のために :class:" -"`io.BufferedReader` でラップすることができます。 (contributed by Nir Aides; :" -"issue:`7471`). さらに、コンストラクタにオプションのタイムスタンプを指定するこ" -"とで、 gzip ファイル内の変更時間レコードをオーバーライドすることができるよう" -"になりました。 (Contributed by Jacques Frechet; :issue:`4272`.)" +"きます。(contributed by Hagen Fürstenau; :issue:`3860` ま" +"た、 :class:`io.BufferedIOBase` ABC を実装しています。なので、より高速な処理" +"のために :class:`io.BufferedReader` でラップすることができます。 " +"(contributed by Nir Aides; :issue:`7471`). さらに、コンストラクタにオプション" +"のタイムスタンプを指定することで、 gzip ファイル内の変更時間レコードをオー" +"バーライドすることができるようになりました。 (Contributed by Jacques " +"Frechet; :issue:`4272`.)" #: ../../whatsnew/2.7.rst:1299 msgid "" @@ -2190,37 +2536,50 @@ msgstr "" "ようになりました。 :mod:`gzip` モジュールは末尾のゼロバイトを消費します。" "(Fixed by Tadek Pietraszek and Brian Curtin; :issue:`2846`.)" -#: ../../whatsnew/2.7.rst:1303 msgid "" "New attribute: the :mod:`hashlib` module now has an :attr:`!algorithms` " "attribute containing a tuple naming the supported algorithms. In Python 2.7, " "``hashlib.algorithms`` contains ``('md5', 'sha1', 'sha224', 'sha256', " "'sha384', 'sha512')``. (Contributed by Carl Chenet; :issue:`7418`.)" msgstr "" +"新属性: :mod:`hashlib` に、対応するアルゴリズム名のタプルを保持する :attr:`!" +"algorithms` が加わりました。\n" +"Python 2.7 の ``hashlib.algorithms`` は ``('md5', 'sha1', 'sha224', " +"'sha256', 'sha384', 'sha512')`` です。\n" +"(Carl Chenet による貢献です。:issue:`7418`。)" -#: ../../whatsnew/2.7.rst:1309 msgid "" -"The default :class:`~http.client.HTTPResponse` class used by the :mod:" -"`httplib ` module now supports buffering, resulting in much faster " -"reading of HTTP responses. (Contributed by Kristján Valur Jónsson; :issue:" -"`4879`.)" +"The default :class:`~http.client.HTTPResponse` class used by " +"the :mod:`httplib ` module now supports buffering, resulting in much " +"faster reading of HTTP responses. (Contributed by Kristján Valur " +"Jónsson; :issue:`4879`.)" msgstr "" +":mod:`httplib ` がデフォルトで使う :class:`~http.client.HTTPResponse` " +"がバッファリングに対応し、HTTP 応答の読み取りが大幅に高速化しました。\n" +"(Kristján Valur Jónsson による貢献です。:issue:`4879`。)" -#: ../../whatsnew/2.7.rst:1313 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now support a *source_address* parameter, a " -"``(host, port)`` 2-tuple giving the source address that will be used for the " -"connection. (Contributed by Eldon Ziegler; :issue:`3972`.)" +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now support a " +"*source_address* parameter, a ``(host, port)`` 2-tuple giving the source " +"address that will be used for the connection. (Contributed by Eldon " +"Ziegler; :issue:`3972`.)" msgstr "" +":class:`~http.client.HTTPConnection` " +"と :class:`~http.client.HTTPSConnection` に、接続元アドレスを ``(host, " +"port)`` の 2 要素タプルで指定する *source_address* が加わりました。\n" +"(Eldon Ziegler による貢献です。:issue:`3972`。)" -#: ../../whatsnew/2.7.rst:1318 msgid "" "The :mod:`!ihooks` module now supports relative imports. Note that :mod:`!" "ihooks` is an older module for customizing imports, superseded by the :mod:`!" "imputil` module added in Python 2.0. (Relative import support added by Neil " "Schemenauer.)" msgstr "" +":mod:`!ihooks` が相対インポートに対応しました。\n" +":mod:`!ihooks` はインポートをカスタマイズする古いモジュールで、Python 2.0 で" +"追加された :mod:`!imputil` に置き換えられています。\n" +"(Neil Schemenauer が相対インポート対応を追加しました。)" #: ../../whatsnew/2.7.rst:1325 msgid "" @@ -2242,7 +2601,6 @@ msgstr "" "数がどの実引数を受け取るかを計算し、引数名から値へマップする辞書を返します。" "例えば::" -#: ../../whatsnew/2.7.rst:1333 msgid "" ">>> from inspect import getcallargs\n" ">>> def f(a, b=1, *pos, **named):\n" @@ -2257,37 +2615,55 @@ msgid "" "...\n" "TypeError: f() takes at least 1 argument (0 given)" msgstr "" +">>> from inspect import getcallargs\n" +">>> def f(a, b=1, *pos, **named):\n" +"... pass\n" +"...\n" +">>> getcallargs(f, 1, 2, 3)\n" +"{'a': 1, 'b': 2, 'pos': (3,), 'named': {}}\n" +">>> getcallargs(f, a=2, x=4)\n" +"{'a': 2, 'b': 1, 'pos': (), 'named': {'x': 4}}\n" +">>> getcallargs(f)\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: f() takes at least 1 argument (0 given)" #: ../../whatsnew/2.7.rst:1346 msgid "Contributed by George Sakkis; :issue:`3135`." msgstr "Contributed by George Sakkis; :issue:`3135`." -#: ../../whatsnew/2.7.rst:1348 msgid "" "Updated module: The :mod:`io` library has been upgraded to the version " "shipped with Python 3.1. For 3.1, the I/O library was entirely rewritten in " "C and is 2 to 20 times faster depending on the task being performed. The " "original Python version was renamed to the :mod:`!_pyio` module." msgstr "" +"モジュール更新: :mod:`io` が Python 3.1 に同梱された版に更新されました。\n" +"3.1 では I/O ライブラリ全体が C で書き直され、処理内容に応じて 2〜20 倍高速に" +"なっています。\n" +"元の Python 実装は :mod:`!_pyio` に改名されました。" -#: ../../whatsnew/2.7.rst:1353 msgid "" -"One minor resulting change: the :class:`io.TextIOBase` class now has an :" -"attr:`~io.TextIOBase.errors` attribute giving the error setting used for " +"One minor resulting change: the :class:`io.TextIOBase` class now has " +"an :attr:`~io.TextIOBase.errors` attribute giving the error setting used for " "encoding and decoding errors (one of ``'strict'``, ``'replace'``, " "``'ignore'``)." msgstr "" +"これに伴う小さな変更として、:class:`io.TextIOBase` " +"に :attr:`~io.TextIOBase.errors` が加わりました。\n" +"エンコードやデコードのエラー処理設定 (``'strict'``、``'replace'``、" +"``'ignore'`` のいずれか) を示します。" #: ../../whatsnew/2.7.rst:1358 msgid "" "The :class:`io.FileIO` class now raises an :exc:`OSError` when passed an " -"invalid file descriptor. (Implemented by Benjamin Peterson; :issue:" -"`4991`.) The :meth:`~io.IOBase.truncate` method now preserves the file " -"position; previously it would change the file position to the end of the new " -"file. (Fixed by Pascal Chambon; :issue:`6939`.)" +"invalid file descriptor. (Implemented by Benjamin " +"Peterson; :issue:`4991`.) The :meth:`~io.IOBase.truncate` method now " +"preserves the file position; previously it would change the file position to " +"the end of the new file. (Fixed by Pascal Chambon; :issue:`6939`.)" msgstr "" -":class:`io.FileIO` クラスは、無効なファイルディスクリプタを渡されたときに :" -"exc:`OSError` を送出するようになりました。(Implemented by Benjamin " +":class:`io.FileIO` クラスは、無効なファイルディスクリプタを渡されたとき" +"に :exc:`OSError` を送出するようになりました。(Implemented by Benjamin " "Peterson; :issue:`4991`.) :meth:`~io.IOBase.truncate` メソッドは、ファイル位" "置を保存するようになりました。以前は、ファイル位置を新しいファイルの末尾に変" "更しました。(Fixed by Pascal Chambon; :issue:`6939`.)" @@ -2301,11 +2677,12 @@ msgstr "" "新しい関数: ``itertools.compress(data, selectors)`` は、2 つのイテレータを取" "ります。*data* の要素は、*selectors* の対応する値が真であれば返されます::" -#: ../../whatsnew/2.7.rst:1368 msgid "" "itertools.compress('ABCDEF', [1,0,1,0,1,1]) =>\n" " A, C, E, F" msgstr "" +"itertools.compress('ABCDEF', [1,0,1,0,1,1]) =>\n" +" A, C, E, F" #: ../../whatsnew/2.7.rst:1373 msgid "" @@ -2315,16 +2692,18 @@ msgid "" "repeated in the generated combinations::" msgstr "" "新しい関数: ``itertools.combinations_with_replacement(iter, r)`` は、 *iter* " -"から、すべての可能な長さ *r* の要素の組合せを返します。 :func:`~itertools." -"combinations` とは異なり、生成された組合せに個別の要素が繰り返し出現できま" -"す::" +"から、すべての可能な長さ *r* の要素の組合せを返しま" +"す。 :func:`~itertools.combinations` とは異なり、生成された組合せに個別の要素" +"が繰り返し出現できます::" -#: ../../whatsnew/2.7.rst:1378 msgid "" "itertools.combinations_with_replacement('abc', 2) =>\n" " ('a', 'a'), ('a', 'b'), ('a', 'c'),\n" " ('b', 'b'), ('b', 'c'), ('c', 'c')" msgstr "" +"itertools.combinations_with_replacement('abc', 2) =>\n" +" ('a', 'a'), ('a', 'b'), ('a', 'c'),\n" +" ('b', 'b'), ('b', 'c'), ('c', 'c')" #: ../../whatsnew/2.7.rst:1382 msgid "" @@ -2338,9 +2717,9 @@ msgstr "" msgid "" "The :func:`itertools.count` function now has a *step* argument that allows " "incrementing by values other than 1. :func:`~itertools.count` also now " -"allows keyword arguments, and using non-integer values such as floats or :" -"class:`~decimal.Decimal` instances. (Implemented by Raymond Hettinger; :" -"issue:`5032`.)" +"allows keyword arguments, and using non-integer values such as floats " +"or :class:`~decimal.Decimal` instances. (Implemented by Raymond " +"Hettinger; :issue:`5032`.)" msgstr "" ":func:`itertools.count` 関数は、1 以外の値を増分できるように、 *step* 引数を" "追加しました。 :func:`~itertools.count` はまた、キーワード引数に対応し、さら" @@ -2376,10 +2755,10 @@ msgid "" "any object literal that decodes to a list of pairs. (Contributed by Raymond " "Hettinger; :issue:`5381`.)" msgstr "" -"新しい :class:`collections.OrderedDict` 型をサポートするために、 :func:`json." -"load` はオプションとして、任意のオブジェクトリテラルに対して呼び出され、ペア" -"のリストにデコードする *object_pairs_hook* パラメタを追加しました。" -"(Contributed by Raymond Hettinger; :issue:`5381`.)" +"新しい :class:`collections.OrderedDict` 型をサポートするため" +"に、 :func:`json.load` はオプションとして、任意のオブジェクトリテラルに対して" +"呼び出され、ペアのリストにデコードする *object_pairs_hook* パラメタを追加しま" +"した。(Contributed by Raymond Hettinger; :issue:`5381`.)" #: ../../whatsnew/2.7.rst:1406 msgid "" @@ -2392,34 +2771,36 @@ msgstr "" ":mod:`mailbox` モジュールの :class:`~mailbox.Maildir` クラスは、読み込むディ" "レクトリのタイムスタンプを記録し、その後に更新時刻が変わった場合にのみ再読み" "込みするようになりました。これは不必要なディレクトリ走査を避けることでパ" -"フォーマンスを向上させます。(Fixed by A.M. Kuchling and Antoine Pitrou; :" -"issue:`1607951`, :issue:`6896`.)" +"フォーマンスを向上させます。(Fixed by A.M. Kuchling and Antoine " +"Pitrou; :issue:`1607951`, :issue:`6896`.)" #: ../../whatsnew/2.7.rst:1412 msgid "" -"New functions: the :mod:`math` module gained :func:`~math.erf` and :func:" -"`~math.erfc` for the error function and the complementary error function, :" -"func:`~math.expm1` which computes ``e**x - 1`` with more precision than " -"using :func:`~math.exp` and subtracting 1, :func:`~math.gamma` for the Gamma " -"function, and :func:`~math.lgamma` for the natural log of the Gamma " -"function. (Contributed by Mark Dickinson and nirinA raseliarison; :issue:" -"`3366`.)" +"New functions: the :mod:`math` module gained :func:`~math.erf` " +"and :func:`~math.erfc` for the error function and the complementary error " +"function, :func:`~math.expm1` which computes ``e**x - 1`` with more " +"precision than using :func:`~math.exp` and subtracting " +"1, :func:`~math.gamma` for the Gamma function, and :func:`~math.lgamma` for " +"the natural log of the Gamma function. (Contributed by Mark Dickinson and " +"nirinA raseliarison; :issue:`3366`.)" msgstr "" -"新しい関数: :mod:`math` モジュールは、誤差関数と相補誤差関数 :func:`~math." -"erf` および :func:`~math.erfc` 、 ``e**x - 1`` を :func:`~math.exp` から 1 を" -"引くのよりも高い精度で計算する :func:`~math.expm1` 、ガンマ関数 :func:`~math." -"gamma` 、そしてガンマ関数の自然対数 :func:`~math.lgamma` を追加しました。 " -"(Contributed by Mark Dickinson and nirinA raseliarison; :issue:`3366`.)" +"新しい関数: :mod:`math` モジュールは、誤差関数と相補誤差関" +"数 :func:`~math.erf` および :func:`~math.erfc` 、 ``e**x - 1`` " +"を :func:`~math.exp` から 1 を引くのよりも高い精度で計算す" +"る :func:`~math.expm1` 、ガンマ関数 :func:`~math.gamma` 、そしてガンマ関数の" +"自然対数 :func:`~math.lgamma` を追加しました。 (Contributed by Mark " +"Dickinson and nirinA raseliarison; :issue:`3366`.)" -#: ../../whatsnew/2.7.rst:1420 msgid "" "The :mod:`multiprocessing` module's :class:`!Manager*` classes can now be " "passed a callable that will be called whenever a subprocess is started, " "along with a set of arguments that will be passed to the callable. " "(Contributed by lekma; :issue:`5585`.)" msgstr "" +":mod:`multiprocessing` の :class:`!Manager*` クラスに、サブプロセスの起動ごと" +"に呼ぶ呼び出し可能オブジェクトと、その引数群を渡せるようになりました。\n" +"(lekma による貢献です。:issue:`5585`。)" -#: ../../whatsnew/2.7.rst:1426 msgid "" "The :class:`~multiprocessing.pool.Pool` class, which controls a pool of " "worker processes, now has an optional *maxtasksperchild* parameter. Worker " @@ -2428,22 +2809,31 @@ msgid "" "memory or other resources, or if some tasks will cause the worker to become " "very large. (Contributed by Charles Cazabon; :issue:`6963`.)" msgstr "" +"ワーカープロセスのプールを管理する :class:`~multiprocessing.pool.Pool` に、省" +"略可能な *maxtasksperchild* が加わりました。\n" +"ワーカーは指定数のタスクを処理すると終了し、:class:`!Pool` は新しいワーカーを" +"起動します。\n" +"タスクがメモリなどのリソースを漏らす可能性がある場合や、ワーカーを非常に大き" +"くするタスクがある場合に便利です。\n" +"(Charles Cazabon による貢献です。:issue:`6963`。)" -#: ../../whatsnew/2.7.rst:1434 msgid "" "The :mod:`!nntplib` module now supports IPv6 addresses. (Contributed by " "Derek Morr; :issue:`1664`.)" msgstr "" +":mod:`!nntplib` が IPv6 アドレスに対応しました。\n" +"(Derek Morr による貢献です。:issue:`1664`。)" #: ../../whatsnew/2.7.rst:1437 msgid "" -"New functions: the :mod:`os` module wraps the following POSIX system calls: :" -"func:`~os.getresgid` and :func:`~os.getresuid`, which return the real, " -"effective, and saved GIDs and UIDs; :func:`~os.setresgid` and :func:`~os." -"setresuid`, which set real, effective, and saved GIDs and UIDs to new " -"values; :func:`~os.initgroups`, which initialize the group access list for " -"the current process. (GID/UID functions contributed by Travis H.; :issue:" -"`6508`. Support for initgroups added by Jean-Paul Calderone; :issue:`7333`.)" +"New functions: the :mod:`os` module wraps the following POSIX system " +"calls: :func:`~os.getresgid` and :func:`~os.getresuid`, which return the " +"real, effective, and saved GIDs and UIDs; :func:`~os.setresgid` " +"and :func:`~os.setresuid`, which set real, effective, and saved GIDs and " +"UIDs to new values; :func:`~os.initgroups`, which initialize the group " +"access list for the current process. (GID/UID functions contributed by " +"Travis H.; :issue:`6508`. Support for initgroups added by Jean-Paul " +"Calderone; :issue:`7333`.)" msgstr "" "新しい関数: :mod:`os` モジュールは、以下の POSIX システムコールをラップしま" "す: real, effective, および saved GID と UID を返す、 :func:`~os.getresgid` " @@ -2465,17 +2855,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:1451 msgid "" -"In the :mod:`os.path` module, the :func:`~os.path.normpath` and :func:`~os." -"path.abspath` functions now preserve Unicode; if their input path is a " -"Unicode string, the return value is also a Unicode string. (:meth:`~os.path." -"normpath` fixed by Matt Giuca in :issue:`5827`; :meth:`~os.path.abspath` " -"fixed by Ezio Melotti in :issue:`3426`.)" +"In the :mod:`os.path` module, the :func:`~os.path.normpath` " +"and :func:`~os.path.abspath` functions now preserve Unicode; if their input " +"path is a Unicode string, the return value is also a Unicode string. " +"(:meth:`~os.path.normpath` fixed by Matt Giuca " +"in :issue:`5827`; :meth:`~os.path.abspath` fixed by Ezio Melotti " +"in :issue:`3426`.)" msgstr "" -":mod:`os.path` モジュールの、 :func:`~os.path.normpath` および :func:`~os." -"path.abspath` 関数は、Unicode を保存するようになりました。入力パスが Unicode " -"なら、戻り値も Unicode 文字列になります。 (:meth:`~os.path.normpath` fixed " -"by Matt Giuca in :issue:`5827`; :meth:`~os.path.abspath` fixed by Ezio " -"Melotti in :issue:`3426`.)" +":mod:`os.path` モジュールの、 :func:`~os.path.normpath` およ" +"び :func:`~os.path.abspath` 関数は、Unicode を保存するようになりました。入力" +"パスが Unicode なら、戻り値も Unicode 文字列になります。 " +"(:meth:`~os.path.normpath` fixed by Matt Giuca " +"in :issue:`5827`; :meth:`~os.path.abspath` fixed by Ezio Melotti " +"in :issue:`3426`.)" #: ../../whatsnew/2.7.rst:1457 msgid "" @@ -2489,39 +2881,41 @@ msgstr "" #: ../../whatsnew/2.7.rst:1461 msgid "" -"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, and :func:`~re." -"subn` now accept an optional *flags* argument, for consistency with the " -"other functions in the module. (Added by Gregory P. Smith.)" +"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` now accept an optional *flags* argument, for " +"consistency with the other functions in the module. (Added by Gregory P. " +"Smith.)" msgstr "" -":mod:`re` モジュールの :func:`~re.split`, :func:`~re.sub`, および :func:`~re." -"subn` は、モジュールの他の関数との一貫性のため、オプションの *flags* 引数を受" -"け付けるようになりました。 (Added by Gregory P. Smith.)" +":mod:`re` モジュールの :func:`~re.split`, :func:`~re.sub`, およ" +"び :func:`~re.subn` は、モジュールの他の関数との一貫性のため、オプションの " +"*flags* 引数を受け付けるようになりました。 (Added by Gregory P. Smith.)" #: ../../whatsnew/2.7.rst:1465 msgid "" "New function: :func:`~runpy.run_path` in the :mod:`runpy` module will " "execute the code at a provided *path* argument. *path* can be the path of a " -"Python source file (:file:`example.py`), a compiled bytecode file (:file:" -"`example.pyc`), a directory (:file:`./package/`), or a zip archive (:file:" -"`example.zip`). If a directory or zip path is provided, it will be added to " -"the front of ``sys.path`` and the module :mod:`__main__` will be imported. " -"It's expected that the directory or zip contains a :file:`__main__.py`; if " -"it doesn't, some other :file:`__main__.py` might be imported from a location " -"later in ``sys.path``. This makes more of the machinery of :mod:`runpy` " -"available to scripts that want to mimic the way Python's command line " -"processes an explicit path name. (Added by Nick Coghlan; :issue:`6816`.)" +"Python source file (:file:`example.py`), a compiled bytecode file " +"(:file:`example.pyc`), a directory (:file:`./package/`), or a zip archive " +"(:file:`example.zip`). If a directory or zip path is provided, it will be " +"added to the front of ``sys.path`` and the module :mod:`__main__` will be " +"imported. It's expected that the directory or zip contains " +"a :file:`__main__.py`; if it doesn't, some other :file:`__main__.py` might " +"be imported from a location later in ``sys.path``. This makes more of the " +"machinery of :mod:`runpy` available to scripts that want to mimic the way " +"Python's command line processes an explicit path name. (Added by Nick " +"Coghlan; :issue:`6816`.)" msgstr "" "新しい関数: :mod:`runpy` モジュールの :func:`~runpy.run_path` は、与えられた " -"*path* 引数のコードを実行します。 *path* は Python ソースファイルのパス (:" -"file:`example.py`)、コンパイル済みバイトコードファイル (:file:`example." -"pyc`)、ディレクトリ (:file:`./package/`)、または zip アーカイブ (:file:" -"`example.zip`) にできます。ディレクトリか zip パスが与えられると、それが " -"``sys.path`` の最初に加えられ、モジュール :mod:`__main__` が import されま" -"す。これは、ディレクトリや zip が :file:`__main__.py` を含むことを期待しま" -"す。なければ、他の :file:`__main__.py` が ``sys.path`` の後の部分から import " -"されることがあります。これにより、Python のコマンドラインが明示的なパス名を処" -"理する方法を真似たいようなスクリプトに、 :mod:`runpy` のより多くの機構が利用" -"できるようになります。 (Added by Nick Coghlan; :issue:`6816`.)" +"*path* 引数のコードを実行します。 *path* は Python ソースファイルのパス " +"(:file:`example.py`)、コンパイル済みバイトコードファイル " +"(:file:`example.pyc`)、ディレクトリ (:file:`./package/`)、または zip アーカイ" +"ブ (:file:`example.zip`) にできます。ディレクトリか zip パスが与えられると、" +"それが ``sys.path`` の最初に加えられ、モジュール :mod:`__main__` が import さ" +"れます。これは、ディレクトリや zip が :file:`__main__.py` を含むことを期待し" +"ます。なければ、他の :file:`__main__.py` が ``sys.path`` の後の部分から " +"import されることがあります。これにより、Python のコマンドラインが明示的なパ" +"ス名を処理する方法を真似たいようなスクリプトに、 :mod:`runpy` のより多くの機" +"構が利用できるようになります。 (Added by Nick Coghlan; :issue:`6816`.)" #: ../../whatsnew/2.7.rst:1479 msgid "" @@ -2544,17 +2938,17 @@ msgid "" "indefinitely. (Fixed by Antoine Pitrou; :issue:`3002`.)" msgstr "" ":mod:`shutil` の :func:`~shutil.copyfile` および :func:`~shutil.copytree` 関" -"数は、名前付きパイプのコピーを求められたときに :exc:`~shutil." -"SpecialFileError` 例外を送出する様になりました。以前は、コードは、名前付きパ" -"イプを、通常のファイルのように読み込み用に開いて扱い、いつまでもブロックして" -"いました。 (Fixed by Antoine Pitrou; :issue:`3002`.)" +"数は、名前付きパイプのコピーを求められたとき" +"に :exc:`~shutil.SpecialFileError` 例外を送出する様になりました。以前は、コー" +"ドは、名前付きパイプを、通常のファイルのように読み込み用に開いて扱い、いつま" +"でもブロックしていました。 (Fixed by Antoine Pitrou; :issue:`3002`.)" #: ../../whatsnew/2.7.rst:1490 msgid "" "The :mod:`signal` module no longer re-installs the signal handler unless " "this is truly necessary, which fixes a bug that could make it impossible to " -"catch the EINTR signal robustly. (Fixed by Charles-Francois Natali; :issue:" -"`8354`.)" +"catch the EINTR signal robustly. (Fixed by Charles-Francois " +"Natali; :issue:`8354`.)" msgstr "" ":mod:`signal` モジュールは、シグナルハンドラを本当に必要でない限り再インス" "トールしなくなりました。これで、EINTR シグナルを確実に捕えられないバグが修正" @@ -2564,26 +2958,27 @@ msgstr "" msgid "" "New functions: in the :mod:`site` module, three new functions return various " "site- and user-specific paths. :func:`~site.getsitepackages` returns a list " -"containing all global site-packages directories, :func:`~site." -"getusersitepackages` returns the path of the user's site-packages directory, " -"and :func:`~site.getuserbase` returns the value of the :data:`~site." -"USER_BASE` environment variable, giving the path to a directory that can be " -"used to store data. (Contributed by Tarek Ziadé; :issue:`6693`.)" +"containing all global site-packages " +"directories, :func:`~site.getusersitepackages` returns the path of the " +"user's site-packages directory, and :func:`~site.getuserbase` returns the " +"value of the :data:`~site.USER_BASE` environment variable, giving the path " +"to a directory that can be used to store data. (Contributed by Tarek " +"Ziadé; :issue:`6693`.)" msgstr "" "新しい関数: :mod:`site` モジュールの、新しい関数群は様々なサイトおよびユーザ" "に特有のパスを返します。 :func:`~site.getsitepackages` は、全てのグローバル " -"site-packages ディレクトリを含むリストを返します。 :func:`~site." -"getusersitepackages` は、ユーザの site-packages ディレクトリのパスを返しま" -"す。そして、 :func:`~site.getuserbase` は、データの保存に使えるディレクトリへ" -"のパスを与える、 :data:`~site.USER_BASE` 環境変数の値を返します。 " -"(Contributed by Tarek Ziadé; :issue:`6693`.)" +"site-packages ディレクトリを含むリストを返しま" +"す。 :func:`~site.getusersitepackages` は、ユーザの site-packages ディレクト" +"リのパスを返します。そして、 :func:`~site.getuserbase` は、データの保存に使え" +"るディレクトリへのパスを与える、 :data:`~site.USER_BASE` 環境変数の値を返しま" +"す。 (Contributed by Tarek Ziadé; :issue:`6693`.)" #: ../../whatsnew/2.7.rst:1506 msgid "" -"The :mod:`site` module now reports exceptions occurring when the :mod:" -"`sitecustomize` module is imported, and will no longer catch and swallow " -"the :exc:`KeyboardInterrupt` exception. (Fixed by Victor Stinner; :issue:" -"`3137`.)" +"The :mod:`site` module now reports exceptions occurring when " +"the :mod:`sitecustomize` module is imported, and will no longer catch and " +"swallow the :exc:`KeyboardInterrupt` exception. (Fixed by Victor " +"Stinner; :issue:`3137`.)" msgstr "" ":mod:`site` モジュールは :mod:`sitecustomize` モジュールが import されたとき" "に例外を報告するようになり、 :exc:`KeyboardInterrupt` 例外が捕捉されて飲み込" @@ -2601,29 +2996,31 @@ msgstr "" #: ../../whatsnew/2.7.rst:1516 msgid "" -"The :meth:`~socket.socket.recv_into` and :meth:`~socket.socket." -"recvfrom_into` methods will now write into objects that support the buffer " -"API, most usefully the :class:`bytearray` and :class:`memoryview` objects. " -"(Implemented by Antoine Pitrou; :issue:`8104`.)" +"The :meth:`~socket.socket.recv_into` " +"and :meth:`~socket.socket.recvfrom_into` methods will now write into objects " +"that support the buffer API, most usefully the :class:`bytearray` " +"and :class:`memoryview` objects. (Implemented by Antoine " +"Pitrou; :issue:`8104`.)" msgstr "" ":meth:`~socket.socket.recv_into` および :meth:`~socket.socket.recvfrom_into` " -"メソッドは、バッファ API をサポートするオブジェクト、最も便利なのは :class:" -"`bytearray` や :class:`memoryview` 、に書きこむようになりました。 " +"メソッドは、バッファ API をサポートするオブジェクト、最も便利なの" +"は :class:`bytearray` や :class:`memoryview` 、に書きこむようになりました。 " "(Implemented by Antoine Pitrou; :issue:`8104`.)" #: ../../whatsnew/2.7.rst:1521 msgid "" -"The :mod:`SocketServer ` module's :class:`~socketserver." -"TCPServer` class now supports socket timeouts and disabling the Nagle " -"algorithm. The :attr:`!disable_nagle_algorithm` class attribute defaults to " -"``False``; if overridden to be true, new request connections will have the " -"TCP_NODELAY option set to prevent buffering many small sends into a single " -"TCP packet. The :attr:`~socketserver.BaseServer.timeout` class attribute can " -"hold a timeout in seconds that will be applied to the request socket; if no " -"request is received within that time, :meth:`~socketserver.BaseServer." -"handle_timeout` will be called and :meth:`~socketserver.BaseServer." -"handle_request` will return. (Contributed by Kristján Valur Jónsson; :issue:" -"`6192` and :issue:`6267`.)" +"The :mod:`SocketServer ` " +"module's :class:`~socketserver.TCPServer` class now supports socket timeouts " +"and disabling the Nagle algorithm. The :attr:`!disable_nagle_algorithm` " +"class attribute defaults to ``False``; if overridden to be true, new request " +"connections will have the TCP_NODELAY option set to prevent buffering many " +"small sends into a single TCP packet. " +"The :attr:`~socketserver.BaseServer.timeout` class attribute can hold a " +"timeout in seconds that will be applied to the request socket; if no request " +"is received within that " +"time, :meth:`~socketserver.BaseServer.handle_timeout` will be called " +"and :meth:`~socketserver.BaseServer.handle_request` will return. " +"(Contributed by Kristján Valur Jónsson; :issue:`6192` and :issue:`6267`.)" msgstr "" #: ../../whatsnew/2.7.rst:1533 @@ -2632,9 +3029,9 @@ msgid "" "of the `pysqlite package `__. Version " "2.6.0 includes a number of bugfixes, and adds the ability to load SQLite " "extensions from shared libraries. Call the ``enable_load_extension(True)`` " -"method to enable extensions, and then call :meth:`~sqlite3.Connection." -"load_extension` to load a particular shared library. (Updated by Gerhard " -"Häring.)" +"method to enable extensions, and then " +"call :meth:`~sqlite3.Connection.load_extension` to load a particular shared " +"library. (Updated by Gerhard Häring.)" msgstr "" "更新されたモジュール: :mod:`sqlite3` モジュールが `pysqlite パッケージ " "`__ のバージョン 2.6.0 にアップデートさ" @@ -2647,10 +3044,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1540 msgid "" "The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the " -"buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:" -"`7133`) and automatically set OpenSSL's :c:macro:`!SSL_MODE_AUTO_RETRY`, " -"which will prevent an error code being returned from :meth:`recv` operations " -"that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`)." +"buffer API, which fixed a test suite failure (fix by Antoine " +"Pitrou; :issue:`7133`) and automatically set OpenSSL's :c:macro:`!" +"SSL_MODE_AUTO_RETRY`, which will prevent an error code being returned " +"from :meth:`recv` operations that trigger an SSL renegotiation (fix by " +"Antoine Pitrou; :issue:`8222`)." msgstr "" #: ../../whatsnew/2.7.rst:1547 @@ -2674,15 +3072,19 @@ msgstr "" "証できないものもあり、\"unknown algorithm\" エラーを報告します。 (Reported " "by Beda Kosata, and fixed by Antoine Pitrou; :issue:`8484`.)" -#: ../../whatsnew/2.7.rst:1560 msgid "" -"The version of OpenSSL being used is now available as the module attributes :" -"const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl.OPENSSL_VERSION_INFO` (a " -"5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by " -"Antoine Pitrou; :issue:`8321`.)" +"The version of OpenSSL being used is now available as the module " +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by Antoine " +"Pitrou; :issue:`8321`.)" msgstr "" +"使用中の OpenSSL のバージョンを、モジュール属性 :const:`ssl.OPENSSL_VERSION` " +"(文字列)、:const:`ssl.OPENSSL_VERSION_INFO` (5 要素タプ" +"ル)、:const:`ssl.OPENSSL_VERSION_NUMBER` (整数) で取得できるようになりまし" +"た。\n" +"(Antoine Pitrou が追加しました。:issue:`8321`。)" -#: ../../whatsnew/2.7.rst:1566 msgid "" "The :mod:`struct` module will no longer silently ignore overflow errors when " "a value is too large for a particular integer format code (one of " @@ -2692,20 +3094,28 @@ msgid "" "pack non-integers before trying the :meth:`~object.__int__` method or " "reporting an error. (Changed by Mark Dickinson; :issue:`8300`.)" msgstr "" +":mod:`struct` は、値が整数の書式コード (``bBhHiIlLqQ`` のいずれか) に収まらな" +"い場合にオーバーフローを黙って無視せず、常に :exc:`struct.error` を送出するよ" +"うになりました。\n" +"(Mark Dickinson が変更しました。:issue:`1523`。)\n" +":func:`~struct.pack` は整数以外を変換・パックする際、:meth:`~object.__int__` " +"を試したりエラーにしたりする前に、:meth:`~object.__index__` を使おうとするよ" +"うになりました。\n" +"(Mark Dickinson が変更しました。:issue:`8300`。)" #: ../../whatsnew/2.7.rst:1575 msgid "" -"New function: the :mod:`subprocess` module's :func:`~subprocess." -"check_output` runs a command with a specified set of arguments and returns " -"the command's output as a string when the command runs without error, or " -"raises a :exc:`~subprocess.CalledProcessError` exception otherwise." +"New function: the :mod:`subprocess` " +"module's :func:`~subprocess.check_output` runs a command with a specified " +"set of arguments and returns the command's output as a string when the " +"command runs without error, or raises " +"a :exc:`~subprocess.CalledProcessError` exception otherwise." msgstr "" "新しい関数: :mod:`subprocess` モジュールの :func:`~subprocess.check_output` " "は、指定された引数群でコマンドを実行し、コマンドがエラーを起こさずに実行した" -"らコマンドの出力を文字列として返し、そうでなければ :exc:`~subprocess." -"CalledProcessError` 例外を送出します。" +"らコマンドの出力を文字列として返し、そうでなけれ" +"ば :exc:`~subprocess.CalledProcessError` 例外を送出します。" -#: ../../whatsnew/2.7.rst:1582 msgid "" ">>> subprocess.check_output(['df', '-h', '.'])\n" "'Filesystem Size Used Avail Capacity Mounted on\\n\n" @@ -2716,6 +3126,14 @@ msgid "" "subprocess.CalledProcessError: Command '['df', '-h', '/bogus']' returned non-" "zero exit status 1" msgstr "" +">>> subprocess.check_output(['df', '-h', '.'])\n" +"'Filesystem Size Used Avail Capacity Mounted on\\n\n" +"/dev/disk0s2 52G 49G 3.0G 94% /\\n'\n" +"\n" +">>> subprocess.check_output(['df', '-h', '/bogus'])\n" +" ...\n" +"subprocess.CalledProcessError: Command '['df', '-h', '/bogus']' returned non-" +"zero exit status 1" #: ../../whatsnew/2.7.rst:1590 msgid "(Contributed by Gregory P. Smith.)" @@ -2730,14 +3148,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:1596 msgid "" -"New function: :func:`~symtable.Symbol.is_declared_global` in the :mod:" -"`symtable` module returns true for variables that are explicitly declared to " -"be global, false for ones that are implicitly global. (Contributed by Jeremy " -"Hylton.)" +"New function: :func:`~symtable.Symbol.is_declared_global` in " +"the :mod:`symtable` module returns true for variables that are explicitly " +"declared to be global, false for ones that are implicitly global. " +"(Contributed by Jeremy Hylton.)" msgstr "" -"新しい関数: :mod:`symtable` モジュールの :func:`~symtable.Symbol." -"is_declared_global` は、明示的に global と宣言された引数には真、暗示的に " -"global である引数には偽を返します。(Contributed by Jeremy Hylton.)" +"新しい関数: :mod:`symtable` モジュール" +"の :func:`~symtable.Symbol.is_declared_global` は、明示的に global と宣言され" +"た引数には真、暗示的に global である引数には偽を返します。(Contributed by " +"Jeremy Hylton.)" #: ../../whatsnew/2.7.rst:1601 ../../whatsnew/2.7.rst:2500 msgid "" @@ -2749,21 +3168,28 @@ msgstr "" "``'python'`` の値ではなく、 ``sys.argv[0]`` の値を使うようになりました。 " "(Changed by Sean Reifschneider; :issue:`8451`.)" -#: ../../whatsnew/2.7.rst:1605 msgid "" "The :data:`sys.version_info` value is now a named tuple, with attributes " "named :attr:`!major`, :attr:`!minor`, :attr:`!micro`, :attr:`!releaselevel`, " "and :attr:`!serial`. (Contributed by Ross Light; :issue:`4285`.)" msgstr "" +":data:`sys.version_info` が、:attr:`!major`、:attr:`!minor`、:attr:`!" +"micro`、:attr:`!releaselevel`、:attr:`!serial` 属性を持つ名前付きタプルになり" +"ました。\n" +"(Ross Light による貢献です。:issue:`4285`。)" -#: ../../whatsnew/2.7.rst:1610 msgid "" ":func:`sys.getwindowsversion` also returns a named tuple, with attributes " -"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!platform`, :" -"attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" +"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!" +"platform`, :attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" "service_pack_minor`, :attr:`!suite_mask`, and :attr:`!product_type`. " "(Contributed by Brian Curtin; :issue:`7766`.)" msgstr "" +":func:`sys.getwindowsversion` も、:attr:`!major`、:attr:`!minor`、:attr:`!" +"build`、:attr:`!platform`、:attr:`!service_pack`、:attr:`!" +"service_pack_major`、:attr:`!service_pack_minor`、:attr:`!" +"suite_mask`、:attr:`!product_type` 属性を持つ名前付きタプルを返します。\n" +"(Brian Curtin による貢献です。:issue:`7766`。)" #: ../../whatsnew/2.7.rst:1616 ../../whatsnew/2.7.rst:2504 msgid "" @@ -2791,19 +3217,20 @@ msgid "" "file will be excluded from the resulting archive. This is more powerful " "than the existing *exclude* argument, which has therefore been deprecated. " "(Added by Lars Gustäbel; :issue:`6856`.) The :class:`~tarfile.TarFile` class " -"also now supports the context management protocol. (Added by Lars Gustäbel; :" -"issue:`7232`.)" +"also now supports the context management protocol. (Added by Lars " +"Gustäbel; :issue:`7232`.)" msgstr "" ":mod:`tarfile` は、tar ファイルに追加される :class:`~tarfile.TarInfo` オブ" -"ジェクトのフィルタリングをサポートするようになりました。 :meth:`~tarfile." -"TarFile.add` を呼び出したとき、オプションの呼び出し可能オブジェクトである " -"*filter* 引数を与えることができます。 *filter* オブジェクトには、ファイルが追" -"加される度に :class:`~tarfile.TarInfo` を渡され、これを変形して返せます。この" -"オブジェクトが ``None`` を返したら、そのファイルは結果のアーカイブから除かれ" -"ます。これは既存の *exclude* 引数より強力で、それゆえこれは非推奨となります。" -"(Added by Lars Gustäbel; :issue:`6856`.) :class:`~tarfile.TarFile` クラスはま" -"た、コンテキストマネージャプロトコルもサポートするようになりました。(Added " -"by Lars Gustäbel; :issue:`7232`.)" +"ジェクトのフィルタリングをサポートするようになりまし" +"た。 :meth:`~tarfile.TarFile.add` を呼び出したとき、オプションの呼び出し可能" +"オブジェクトである *filter* 引数を与えることができます。 *filter* オブジェク" +"トには、ファイルが追加される度に :class:`~tarfile.TarInfo` を渡され、これを変" +"形して返せます。このオブジェクトが ``None`` を返したら、そのファイルは結果の" +"アーカイブから除かれます。これは既存の *exclude* 引数より強力で、それゆえこれ" +"は非推奨となります。(Added by Lars " +"Gustäbel; :issue:`6856`.) :class:`~tarfile.TarFile` クラスはまた、コンテキス" +"トマネージャプロトコルもサポートするようになりました。(Added by Lars " +"Gustäbel; :issue:`7232`.)" #: ../../whatsnew/2.7.rst:1636 msgid "" @@ -2818,26 +3245,25 @@ msgstr "" "終了時に内部フラグを返すようになりました。 :meth:`~threading.Event.wait` は内" "部フラグが真になるまでブロックすることを想定されているため、この関数は通常真" "を返すことになります。この戻り値は、タイムアウトが与えられ、オペレーションが" -"タイムアウトした時のみ偽になります。 (Contributed by Tim Lesher; :issue:" -"`1674032`.)" +"タイムアウトした時のみ偽になります。 (Contributed by Tim " +"Lesher; :issue:`1674032`.)" #: ../../whatsnew/2.7.rst:1643 msgid "" "The Unicode database provided by the :mod:`unicodedata` module is now used " "internally to determine which characters are numeric, whitespace, or " -"represent line breaks. The database also includes information from the :" -"file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury Forgeot " -"d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 (updated by " -"Florent Xicluna; :issue:`8024`)." +"represent line breaks. The database also includes information from " +"the :file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury " +"Forgeot d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 " +"(updated by Florent Xicluna; :issue:`8024`)." msgstr "" ":mod:`unicodedata` モジュールに提供される Unicode データベースは、どの文字が" "数字や空白文字か、または改行を表すかを決定するために、内部で使われるようにな" "りました。このデータベースはまた、 :file:`Unihan.txt` データファイルからの情" -"報も含みます (patch by Anders Chrigström and Amaury Forgeot d'Arc; :issue:" -"`1571184`)。また、バージョン 5.2.0 にアップデートされました (updated by " -"Florent Xicluna; :issue:`8024`)。" +"報も含みます (patch by Anders Chrigström and Amaury Forgeot " +"d'Arc; :issue:`1571184`)。また、バージョン 5.2.0 にアップデートされました " +"(updated by Florent Xicluna; :issue:`8024`)。" -#: ../../whatsnew/2.7.rst:1651 ../../whatsnew/2.7.rst:2512 msgid "" "The :mod:`urlparse ` module's :func:`~urllib.parse.urlsplit` " "now handles unknown URL schemes in a fashion compliant with :rfc:`3986`: if " @@ -2846,24 +3272,34 @@ msgid "" "doesn't know about. This change may break code that worked around the old " "behaviour. For example, Python 2.6.4 or 2.5 will return the following:" msgstr "" +":mod:`urlparse ` の :func:`~urllib.parse.urlsplit` は、不明な " +"URL スキームを :rfc:`3986` に従って扱うようになりました。\n" +"URL が ``\"://...\"`` の形式なら、モジュールが知らない独自のスキー" +"ムでも ``://`` より前の部分をスキームとみなします。\n" +"この変更で、以前の動作への回避策を含むコードが動かなくなる場合があります。\n" +"例えば Python 2.6.4 や 2.5 では次のようになります。" -#: ../../whatsnew/2.7.rst:1659 ../../whatsnew/2.7.rst:2520 msgid "" ">>> import urlparse\n" ">>> urlparse.urlsplit('invented://host/filename?query')\n" "('invented', '', '//host/filename?query', '', '')" msgstr "" +">>> import urlparse\n" +">>> urlparse.urlsplit('invented://host/filename?query')\n" +"('invented', '', '//host/filename?query', '', '')" #: ../../whatsnew/2.7.rst:1666 ../../whatsnew/2.7.rst:2527 msgid "Python 2.7 (and Python 2.6.5) will return:" msgstr "Python 2.7 (や Python 2.6.5) は以下を返します:" -#: ../../whatsnew/2.7.rst:1668 ../../whatsnew/2.7.rst:2529 msgid "" ">>> import urlparse\n" ">>> urlparse.urlsplit('invented://host/filename?query')\n" "('invented', 'host', '/filename?query', '', '')" msgstr "" +">>> import urlparse\n" +">>> urlparse.urlsplit('invented://host/filename?query')\n" +"('invented', 'host', '/filename?query', '', '')" #: ../../whatsnew/2.7.rst:1675 ../../whatsnew/2.7.rst:2536 msgid "" @@ -2873,19 +3309,22 @@ msgstr "" "(Python 2.7 では、これは普通のタプルではなく名前付きタプルを返すので、実際は" "微妙に異なる出力をします。)" -#: ../../whatsnew/2.7.rst:1678 msgid "" "The :mod:`urlparse ` module also supports IPv6 literal " -"addresses as defined by :rfc:`2732` (contributed by Senthil Kumaran; :issue:" -"`2987`)." +"addresses as defined by :rfc:`2732` (contributed by Senthil " +"Kumaran; :issue:`2987`)." msgstr "" +":mod:`urlparse ` は、:rfc:`2732` が定義する IPv6 リテラルアドレ" +"スにも対応しました (Senthil Kumaran による貢献、:issue:`2987`)。" -#: ../../whatsnew/2.7.rst:1681 msgid "" ">>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo')\n" "ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]',\n" " path='/foo', params='', query='', fragment='')" msgstr "" +">>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo')\n" +"ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]',\n" +" path='/foo', params='', query='', fragment='')" #: ../../whatsnew/2.7.rst:1688 msgid "" @@ -2900,25 +3339,35 @@ msgstr "" "次第除去されます。 (Originally implemented in Python 3.x by Raymond " "Hettinger, and backported to 2.7 by Michael Foord.)" -#: ../../whatsnew/2.7.rst:1694 msgid "" "The :mod:`xml.etree.ElementTree` library, no longer escapes ampersands and " "angle brackets when outputting an XML processing instruction (which looks " "like ````) or comment (which looks like " "````). (Patch by Neil Muller; :issue:`2746`.)" msgstr "" +":mod:`xml.etree.ElementTree` は、XML の処理命令 (```` のような形式) やコメント (```` のような" +"形式) の出力で、アンパサンドや山括弧をエスケープしなくなりました。\n" +"(Neil Muller によるパッチです。:issue:`2746`。)" -#: ../../whatsnew/2.7.rst:1700 msgid "" -"The XML-RPC client and server, provided by the :mod:`xmlrpclib ` and :mod:`SimpleXMLRPCServer ` modules, have " +"The XML-RPC client and server, provided by the :mod:`xmlrpclib " +"` and :mod:`SimpleXMLRPCServer ` modules, have " "improved performance by supporting HTTP/1.1 keep-alive and by optionally " "using gzip encoding to compress the XML being exchanged. The gzip " -"compression is controlled by the :attr:`!encode_threshold` attribute of :" -"class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size in " -"bytes; responses larger than this will be compressed. (Contributed by " +"compression is controlled by the :attr:`!encode_threshold` attribute " +"of :class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size " +"in bytes; responses larger than this will be compressed. (Contributed by " "Kristján Valur Jónsson; :issue:`6267`.)" msgstr "" +":mod:`xmlrpclib ` と :mod:`SimpleXMLRPCServer " +"` が提供する XML-RPC のクライアントとサーバーは、HTTP/1.1 の " +"keep-alive と、必要に応じた gzip による XML の圧縮に対応し、性能が向上しまし" +"た。\n" +"gzip 圧縮は :class:`~xmlrpc.server.SimpleXMLRPCRequestHandler` の :attr:`!" +"encode_threshold` で制御します。\n" +"このバイト数より大きな応答が圧縮されます。\n" +"(Kristján Valur Jónsson による貢献です。:issue:`6267`。)" #: ../../whatsnew/2.7.rst:1709 msgid "" @@ -2930,14 +3379,18 @@ msgstr "" "メントプロトコルをサポートし、 ``with zipfile.ZipFile(...) as f:`` と書けるよ" "うになりました。 (Contributed by Brian Curtin; :issue:`5511`.)" -#: ../../whatsnew/2.7.rst:1713 msgid "" ":mod:`zipfile` now also supports archiving empty directories and extracts " "them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) Reading files out " -"of an archive is faster, and interleaving :meth:`read() ` and :meth:`readline() ` now works correctly. " -"(Contributed by Nir Aides; :issue:`7610`.)" +"of an archive is faster, and interleaving :meth:`read() " +"` and :meth:`readline() ` now " +"works correctly. (Contributed by Nir Aides; :issue:`7610`.)" msgstr "" +":mod:`zipfile` が空のディレクトリのアーカイブと正しい展開に対応しました " +"(Kuba Wieczorek が修正、:issue:`4710`)。\n" +"アーカイブ内のファイルの読み取りが高速化され、:meth:`read() " +"` と :meth:`readline() ` を交互に" +"使っても正しく動作します (Nir Aides による貢献、:issue:`7610`)。" #: ../../whatsnew/2.7.rst:1720 msgid "" @@ -2965,16 +3418,22 @@ msgstr "" msgid "New module: importlib" msgstr "新しいモジュール: importlib" -#: ../../whatsnew/2.7.rst:1739 msgid "" "Python 3.1 includes the :mod:`importlib` package, a re-implementation of the " "logic underlying Python's :keyword:`import` statement. :mod:`importlib` is " "useful for implementers of Python interpreters and to users who wish to " "write new importers that can participate in the import process. Python 2.7 " "doesn't contain the complete :mod:`importlib` package, but instead has a " -"tiny subset that contains a single function, :func:`~importlib." -"import_module`." +"tiny subset that contains a single " +"function, :func:`~importlib.import_module`." msgstr "" +"Python 3.1 の :mod:`importlib` は、Python の :keyword:`import` 文の基盤となる" +"処理を実装し直したパッケージです。\n" +":mod:`importlib` は Python インタープリタの実装者や、インポート処理に参加する" +"新しいインポーターを書きたい利用者に役立ちます。\n" +"Python 2.7 には完全な :mod:`importlib` ではな" +"く、:func:`~importlib.import_module` という一つの関数だけを含む、ごく小さな部" +"分が用意されています。" #: ../../whatsnew/2.7.rst:1747 msgid "" @@ -2990,15 +3449,14 @@ msgstr "" "はモジュールまたはパッケージの名前を含む文字列です。 ``..utils.errors`` のよ" "うに ``.`` 文字で始まる文字列を与えることで、相対 import も可能です。相対 " "import では、 *package* 引数は必ず与えられなければならず、相対 import のアン" -"カーとして使われるパッケージの名前でなければなりません。 :func:`~importlib." -"import_module` は、 import されたモジュールを ``sys.modules`` に挿入し、モ" -"ジュールオブジェクトを返すこともします。" +"カーとして使われるパッケージの名前でなければなりませ" +"ん。 :func:`~importlib.import_module` は、 import されたモジュールを " +"``sys.modules`` に挿入し、モジュールオブジェクトを返すこともします。" #: ../../whatsnew/2.7.rst:1756 msgid "Here are some examples::" msgstr "ここに例があります::" -#: ../../whatsnew/2.7.rst:1758 msgid "" ">>> from importlib import import_module\n" ">>> anydbm = import_module('anydbm') # Standard absolute import\n" @@ -3009,6 +3467,14 @@ msgid "" ">>> file_util\n" "" msgstr "" +">>> from importlib import import_module\n" +">>> anydbm = import_module('anydbm') # 通常の絶対インポート\n" +">>> anydbm\n" +"\n" +">>> # 相対インポート\n" +">>> file_util = import_module('..file_util', 'distutils.command')\n" +">>> file_util\n" +"" #: ../../whatsnew/2.7.rst:1767 msgid "" @@ -3045,8 +3511,8 @@ msgid "" ":func:`~sysconfig.get_config_var` returns variables from Python's Makefile " "and the :file:`pyconfig.h` file." msgstr "" -":func:`~sysconfig.get_config_var` は、Python の Makefile と :file:`pyconfig." -"h` ファイルから変数を返します。" +":func:`~sysconfig.get_config_var` は、Python の Makefile " +"と :file:`pyconfig.h` ファイルから変数を返します。" #: ../../whatsnew/2.7.rst:1785 msgid "" @@ -3110,7 +3576,6 @@ msgstr "" "たが、Tcl/Tck リリース 8.5 への追加の際に (\"themed Tk\" を略して) Ttk に改名" "されました。" -#: ../../whatsnew/2.7.rst:1811 msgid "" "To learn more, read the :mod:`~tkinter.ttk` module documentation. You may " "also wish to read the Tcl/Tk manual page describing the Ttk theme engine, " @@ -3118,21 +3583,29 @@ msgid "" "screenshots of the Python/Ttk code in use are at https://code.google.com/" "archive/p/python-ttk/wikis/Screenshots.wiki." msgstr "" +"詳しくは :mod:`~tkinter.ttk` の文書を読んでください。\n" +"Ttk テーマエンジンを説明する Tcl/Tk のマニュアル https://www.tcl.tk/man/" +"tcl8.5/TkCmd/ttk_intro.html も参考になるでしょう。\n" +"Python/Ttk の使用例のスクリーンショットは https://code.google.com/archive/p/" +"python-ttk/wikis/Screenshots.wiki にあります。" -#: ../../whatsnew/2.7.rst:1818 msgid "" -"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added in :" -"issue:`2983`. An alternate version called ``Tile.py``, written by Martin " -"Franklin and maintained by Kevin Walzer, was proposed for inclusion in :" -"issue:`2618`, but the authors argued that Guilherme Polo's work was more " +"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added " +"in :issue:`2983`. An alternate version called ``Tile.py``, written by " +"Martin Franklin and maintained by Kevin Walzer, was proposed for inclusion " +"in :issue:`2618`, but the authors argued that Guilherme Polo's work was more " "comprehensive." msgstr "" +":mod:`tkinter.ttk` は Guilherme Polo が書き、:issue:`2983` で追加されまし" +"た。\n" +"Martin Franklin が書き、Kevin Walzer が保守する ``Tile.py`` という別の版" +"も :issue:`2618` で提案されましたが、その作者たちも Guilherme Polo の実装の方" +"が包括的だと判断しました。" #: ../../whatsnew/2.7.rst:1828 msgid "Updated module: unittest" msgstr "更新されたモジュール: unittest" -#: ../../whatsnew/2.7.rst:1830 msgid "" "The :mod:`unittest` module was greatly enhanced; many new features were " "added. Most of these features were implemented by Michael Foord, unless " @@ -3140,8 +3613,11 @@ msgid "" "separately for use with Python versions 2.4 to 2.6, packaged as the :mod:`!" "unittest2` package, from :pypi:`unittest2`." msgstr "" +":mod:`unittest` が大幅に拡張され、多数の機能が加わりました。\n" +"特に記載がない限り、そのほとんどは Michael Foord が実装しました。\n" +"この拡張版は Python 2.4〜2.6 用の :mod:`!unittest2` パッケージとして" +"も、:pypi:`unittest2` から別途入手できます。" -#: ../../whatsnew/2.7.rst:1836 msgid "" "When used from the command line, the module can automatically discover " "tests. It's not as fancy as `py.test `__ or `nose " @@ -3150,10 +3626,15 @@ msgid "" "command will search the :file:`test/` subdirectory for any importable test " "files named ``test*.py``::" msgstr "" +"コマンドラインから使う場合、テストを自動的に検出できます。\n" +"`py.test `__ や `nose `__ " +"ほど高機能ではありませんが、パッケージのディレクトリ群にあるテストを簡単に実" +"行できます。\n" +"例えば次のコマンドは、:file:`test/` 以下で ``test*.py`` という名前のインポー" +"ト可能なテストファイルを探します。 ::" -#: ../../whatsnew/2.7.rst:1843 msgid "python -m unittest discover -s test" -msgstr "" +msgstr "python -m unittest discover -s test" #: ../../whatsnew/2.7.rst:1845 msgid "" @@ -3211,8 +3692,8 @@ msgstr "" msgid "" ":option:`-f ` or :option:`!--failfast` makes test execution " "stop immediately when a test fails instead of continuing to execute further " -"tests. (Suggested by Cliff Dyer and implemented by Michael Foord; :issue:" -"`8074`.)" +"tests. (Suggested by Cliff Dyer and implemented by Michael " +"Foord; :issue:`8074`.)" msgstr "" ":option:`-f ` や :option:`!--failfast` は、テストが失敗したと" "き、他のテストを続けるのではなく、テストの実行を即座に停止します。 " @@ -3238,20 +3719,20 @@ msgstr "" #: ../../whatsnew/2.7.rst:1881 msgid "" -"The error messages for :meth:`~unittest.TestCase.assertEqual`, :meth:" -"`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse` " -"failures now provide more information. If you set the :attr:`~unittest." -"TestCase.longMessage` attribute of your :class:`~unittest.TestCase` classes " -"to true, both the standard error message and any additional message you " -"provide will be printed for failures. (Added by Michael Foord; :issue:" -"`5663`.)" -msgstr "" -":meth:`~unittest.TestCase.assertEqual`, :meth:`~unittest.TestCase." -"assertTrue`, および :meth:`~unittest.TestCase.assertFalse` 失敗のメッセージ" -"は、提供する情報量が増えました。 :class:`~unittest.TestCase` クラスの :attr:" -"`~unittest.TestCase.longMessage` 属性を真に設定すると、失敗時に、標準のエラー" -"メッセージと追加して提供したメッセージの両方が表示されます。(Added by " -"Michael Foord; :issue:`5663`.)" +"The error messages " +"for :meth:`~unittest.TestCase.assertEqual`, :meth:`~unittest.TestCase.assertTrue`, " +"and :meth:`~unittest.TestCase.assertFalse` failures now provide more " +"information. If you set the :attr:`~unittest.TestCase.longMessage` " +"attribute of your :class:`~unittest.TestCase` classes to true, both the " +"standard error message and any additional message you provide will be " +"printed for failures. (Added by Michael Foord; :issue:`5663`.)" +msgstr "" +":meth:`~unittest.TestCase.assertEqual`, :meth:`~unittest.TestCase.assertTrue`, " +"および :meth:`~unittest.TestCase.assertFalse` 失敗のメッセージは、提供する情" +"報量が増えました。 :class:`~unittest.TestCase` クラス" +"の :attr:`~unittest.TestCase.longMessage` 属性を真に設定すると、失敗時に、標" +"準のエラーメッセージと追加して提供したメッセージの両方が表示されます。(Added " +"by Michael Foord; :issue:`5663`.)" #: ../../whatsnew/2.7.rst:1888 msgid "" @@ -3263,11 +3744,12 @@ msgstr "" "ジェクトを与えずに呼び出されたとき、コンテキストハンドラを返すようになりまし" "た。例えば、こう書くことができます::" -#: ../../whatsnew/2.7.rst:1892 msgid "" "with self.assertRaises(KeyError):\n" " {}['foo']" msgstr "" +"with self.assertRaises(KeyError):\n" +" {}['foo']" #: ../../whatsnew/2.7.rst:1895 msgid "(Implemented by Antoine Pitrou; :issue:`4444`.)" @@ -3276,37 +3758,40 @@ msgstr "(Implemented by Antoine Pitrou; :issue:`4444`.)" #: ../../whatsnew/2.7.rst:1899 msgid "" "Module- and class-level setup and teardown fixtures are now supported. " -"Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest." -"tearDownModule` functions. Classes can have :meth:`~unittest.TestCase." -"setUpClass` and :meth:`~unittest.TestCase.tearDownClass` methods that must " -"be defined as class methods (using ``@classmethod`` or equivalent). These " -"functions and methods are invoked when the test runner switches to a test " -"case in a different module or class." +"Modules can contain :func:`~unittest.setUpModule` " +"and :func:`~unittest.tearDownModule` functions. Classes can " +"have :meth:`~unittest.TestCase.setUpClass` " +"and :meth:`~unittest.TestCase.tearDownClass` methods that must be defined as " +"class methods (using ``@classmethod`` or equivalent). These functions and " +"methods are invoked when the test runner switches to a test case in a " +"different module or class." msgstr "" "モジュールレベルおよびクラスレベルの設定と、ティアダウンフィクスチャがサポー" -"トされました。モジュールは、 :func:`~unittest.setUpModule` および :func:" -"`~unittest.tearDownModule` 関数を含むことができます。クラスは :meth:" -"`~unittest.TestCase.setUpClass` および :meth:`~unittest.TestCase." -"tearDownClass` メソッドを含むことができ、これらは (``@classmethod`` や透過な" -"ものを使って) クラスメソッドとして定義しなければなりません。これらの関数とメ" -"ソッドは、テストランナーが別のモジュールやクラスのテストケースに切り替えると" -"きに呼び出されます。" +"トされました。モジュールは、 :func:`~unittest.setUpModule` およ" +"び :func:`~unittest.tearDownModule` 関数を含むことができます。クラス" +"は :meth:`~unittest.TestCase.setUpClass` およ" +"び :meth:`~unittest.TestCase.tearDownClass` メソッドを含むことができ、これら" +"は (``@classmethod`` や透過なものを使って) クラスメソッドとして定義しなければ" +"なりません。これらの関数とメソッドは、テストランナーが別のモジュールやクラス" +"のテストケースに切り替えるときに呼び出されます。" #: ../../whatsnew/2.7.rst:1907 msgid "" -"The methods :meth:`~unittest.TestCase.addCleanup` and :meth:`~unittest." -"TestCase.doCleanups` were added. :meth:`~unittest.TestCase.addCleanup` lets " -"you add cleanup functions that will be called unconditionally (after :meth:" -"`~unittest.TestCase.setUp` if :meth:`~unittest.TestCase.setUp` fails, " -"otherwise after :meth:`~unittest.TestCase.tearDown`). This allows for much " -"simpler resource allocation and deallocation during tests (:issue:`5679`)." -msgstr "" -"メソッド :meth:`~unittest.TestCase.addCleanup` および :meth:`~unittest." -"TestCase.doCleanups` が追加されました。 :meth:`~unittest.TestCase." -"addCleanup` で、無条件に呼び出されるクリーンアップ関数を (:meth:`~unittest." -"TestCase.setUp` が失敗したら :meth:`~unittest.TestCase.setUp` の後に、そうで" -"なければ :meth:`~unittest.TestCase.tearDown` の後に) 追加できるようにします。" -"これにより、テスト中のリソースの配置と解放が簡潔になります。(:issue:`5679`)." +"The methods :meth:`~unittest.TestCase.addCleanup` " +"and :meth:`~unittest.TestCase.doCleanups` were " +"added. :meth:`~unittest.TestCase.addCleanup` lets you add cleanup functions " +"that will be called unconditionally (after :meth:`~unittest.TestCase.setUp` " +"if :meth:`~unittest.TestCase.setUp` fails, otherwise " +"after :meth:`~unittest.TestCase.tearDown`). This allows for much simpler " +"resource allocation and deallocation during tests (:issue:`5679`)." +msgstr "" +"メソッド :meth:`~unittest.TestCase.addCleanup` およ" +"び :meth:`~unittest.TestCase.doCleanups` が追加されまし" +"た。 :meth:`~unittest.TestCase.addCleanup` で、無条件に呼び出されるクリーン" +"アップ関数を (:meth:`~unittest.TestCase.setUp` が失敗した" +"ら :meth:`~unittest.TestCase.setUp` の後に、そうでなけれ" +"ば :meth:`~unittest.TestCase.tearDown` の後に) 追加できるようにします。これに" +"より、テスト中のリソースの配置と解放が簡潔になります。(:issue:`5679`)." #: ../../whatsnew/2.7.rst:1915 msgid "" @@ -3322,45 +3807,45 @@ msgstr "" #: ../../whatsnew/2.7.rst:1920 msgid "" -":meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase." -"assertIsNotNone` take one expression and verify that the result is or is not " -"``None``." +":meth:`~unittest.TestCase.assertIsNone` " +"and :meth:`~unittest.TestCase.assertIsNotNone` take one expression and " +"verify that the result is or is not ``None``." msgstr "" -":meth:`~unittest.TestCase.assertIsNone` および :meth:`~unittest.TestCase." -"assertIsNotNone` はひとつの式を取り、その結果が ``None`` であるか、またはない" -"かを確かめます。" +":meth:`~unittest.TestCase.assertIsNone` およ" +"び :meth:`~unittest.TestCase.assertIsNotNone` はひとつの式を取り、その結果が " +"``None`` であるか、またはないかを確かめます。" #: ../../whatsnew/2.7.rst:1923 msgid "" -":meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase." -"assertIsNot` take two values and check whether the two values evaluate to " -"the same object or not. (Added by Michael Foord; :issue:`2578`.)" +":meth:`~unittest.TestCase.assertIs` " +"and :meth:`~unittest.TestCase.assertIsNot` take two values and check whether " +"the two values evaluate to the same object or not. (Added by Michael " +"Foord; :issue:`2578`.)" msgstr "" -":meth:`~unittest.TestCase.assertIs` および :meth:`~unittest.TestCase." -"assertIsNot` は、2 つの値を取り、その評価が同一のオブジェクトであるか、または" -"ないかを確かめます。 (Added by Michael Foord; :issue:`2578`.)" +":meth:`~unittest.TestCase.assertIs` およ" +"び :meth:`~unittest.TestCase.assertIsNot` は、2 つの値を取り、その評価が同一" +"のオブジェクトであるか、またはないかを確かめます。 (Added by Michael " +"Foord; :issue:`2578`.)" #: ../../whatsnew/2.7.rst:1927 msgid "" -":meth:`~unittest.TestCase.assertIsInstance` and :meth:`~unittest.TestCase." -"assertNotIsInstance` check whether the resulting object is an instance of a " -"particular class, or of one of a tuple of classes. (Added by Georg Brandl; :" -"issue:`7031`.)" +":meth:`~unittest.TestCase.assertIsInstance` " +"and :meth:`~unittest.TestCase.assertNotIsInstance` check whether the " +"resulting object is an instance of a particular class, or of one of a tuple " +"of classes. (Added by Georg Brandl; :issue:`7031`.)" msgstr "" -":meth:`~unittest.TestCase.assertIsInstance` および :meth:`~unittest.TestCase." -"assertNotIsInstance` は、結果のオブジェクトが特定のクラス、またはタプルにある" -"クラスのいずれかのインスタンスであるかを調べます。(Added by Georg Brandl; :" -"issue:`7031`.)" +":meth:`~unittest.TestCase.assertIsInstance` およ" +"び :meth:`~unittest.TestCase.assertNotIsInstance` は、結果のオブジェクトが特" +"定のクラス、またはタプルにあるクラスのいずれかのインスタンスであるかを調べま" +"す。(Added by Georg Brandl; :issue:`7031`.)" #: ../../whatsnew/2.7.rst:1932 msgid "" -":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase." -"assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, and :meth:" -"`~unittest.TestCase.assertLessEqual` compare two quantities." +":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase.assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, " +"and :meth:`~unittest.TestCase.assertLessEqual` compare two quantities." msgstr "" -":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase." -"assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, および :meth:" -"`~unittest.TestCase.assertLessEqual` は、二つの量を比較します。" +":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase.assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, " +"および :meth:`~unittest.TestCase.assertLessEqual` は、二つの量を比較します。" #: ../../whatsnew/2.7.rst:1936 msgid "" @@ -3374,36 +3859,43 @@ msgstr "" "は、Unicode 文字列が :meth:`~unittest.TestCase.assertEqual` で比較されるとき" "のデフォルトに使われるようになりました。" -#: ../../whatsnew/2.7.rst:1941 msgid "" -":meth:`assertRegexpMatches() ` and :meth:" -"`assertNotRegexpMatches() ` checks whether " -"the first argument is a string matching or not matching the regular " -"expression provided as the second argument (:issue:`8038`)." +":meth:`assertRegexpMatches() ` " +"and :meth:`assertNotRegexpMatches() ` " +"checks whether the first argument is a string matching or not matching the " +"regular expression provided as the second argument (:issue:`8038`)." msgstr "" +":meth:`assertRegexpMatches() ` " +"と :meth:`assertNotRegexpMatches() ` は、" +"第 1 引数の文字列が第 2 引数の正規表現に一致するか、または一致しないかを確認" +"します (:issue:`8038`)。" -#: ../../whatsnew/2.7.rst:1946 msgid "" ":meth:`assertRaisesRegexp() ` checks " "whether a particular exception is raised, and then also checks that the " "string representation of the exception matches the provided regular " "expression." msgstr "" +":meth:`assertRaisesRegexp() ` は、指定し" +"た例外が送出されることと、その例外の文字列表現が正規表現に一致することを確認" +"します。" #: ../../whatsnew/2.7.rst:1951 msgid "" -":meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase." -"assertNotIn` tests whether *first* is or is not in *second*." +":meth:`~unittest.TestCase.assertIn` " +"and :meth:`~unittest.TestCase.assertNotIn` tests whether *first* is or is " +"not in *second*." msgstr "" -":meth:`~unittest.TestCase.assertIn` および :meth:`~unittest.TestCase." -"assertNotIn` は、 *first* が *second* に属するか、または属さないかを調べま" -"す。" +":meth:`~unittest.TestCase.assertIn` およ" +"び :meth:`~unittest.TestCase.assertNotIn` は、 *first* が *second* に属する" +"か、または属さないかを調べます。" -#: ../../whatsnew/2.7.rst:1954 msgid "" ":meth:`assertItemsEqual() ` tests " "whether two provided sequences contain the same elements." msgstr "" +":meth:`assertItemsEqual() ` は、2 つの" +"シーケンスに同じ要素が含まれているかを確認します。" #: ../../whatsnew/2.7.rst:1957 msgid "" @@ -3415,23 +3907,23 @@ msgstr "" #: ../../whatsnew/2.7.rst:1960 msgid "" -"Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest." -"TestCase.assertTupleEqual` compare the specified types and explain any " -"differences without necessarily printing their full values; these methods " -"are now used by default when comparing lists and tuples using :meth:" -"`~unittest.TestCase.assertEqual`. More generally, :meth:`~unittest.TestCase." -"assertSequenceEqual` compares two sequences and can optionally check whether " -"both sequences are of a particular type." -msgstr "" -"同様に、 :meth:`~unittest.TestCase.assertListEqual` および :meth:`~unittest." -"TestCase.assertTupleEqual` は、指定された型を比較し、差分を説明しますが、完全" -"な値を表示するとはかぎりません。これらのメソッドは、リストやタプルを :meth:" -"`~unittest.TestCase.assertEqual` で比較するときにデフォルトで使われるようにな" -"りました。より一般的には、 :meth:`~unittest.TestCase.assertSequenceEqual` は " -"2 つのシーケンスを比較し、必要なら両方のシーケンスが特定の型であるかを調べま" -"す。" +"Similarly, :meth:`~unittest.TestCase.assertListEqual` " +"and :meth:`~unittest.TestCase.assertTupleEqual` compare the specified types " +"and explain any differences without necessarily printing their full values; " +"these methods are now used by default when comparing lists and tuples " +"using :meth:`~unittest.TestCase.assertEqual`. More " +"generally, :meth:`~unittest.TestCase.assertSequenceEqual` compares two " +"sequences and can optionally check whether both sequences are of a " +"particular type." +msgstr "" +"同様に、 :meth:`~unittest.TestCase.assertListEqual` およ" +"び :meth:`~unittest.TestCase.assertTupleEqual` は、指定された型を比較し、差分" +"を説明しますが、完全な値を表示するとはかぎりません。これらのメソッドは、リス" +"トやタプルを :meth:`~unittest.TestCase.assertEqual` で比較するときにデフォル" +"トで使われるようになりました。より一般的に" +"は、 :meth:`~unittest.TestCase.assertSequenceEqual` は 2 つのシーケンスを比較" +"し、必要なら両方のシーケンスが特定の型であるかを調べます。" -#: ../../whatsnew/2.7.rst:1968 msgid "" ":meth:`~unittest.TestCase.assertDictEqual` compares two dictionaries and " "reports the differences; it's now used by default when you compare two " @@ -3439,51 +3931,59 @@ msgid "" "assertDictContainsSubset` checks whether all of the key/value pairs in " "*first* are found in *second*." msgstr "" +":meth:`~unittest.TestCase.assertDictEqual` は 2 つの辞書を比較して相違点を報" +"告し、:meth:`~unittest.TestCase.assertEqual` による辞書の比較でもデフォルトで" +"使われます。\n" +":meth:`!assertDictContainsSubset` は、*first* のすべてのキーと値の組が " +"*second* に含まれるかを確認します。" #: ../../whatsnew/2.7.rst:1973 msgid "" -":meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase." -"assertNotAlmostEqual` test whether *first* and *second* are approximately " -"equal. This method can either round their difference to an optionally " -"specified number of *places* (the default is 7) and compare it to zero, or " -"require the difference to be smaller than a supplied *delta* value." +":meth:`~unittest.TestCase.assertAlmostEqual` " +"and :meth:`~unittest.TestCase.assertNotAlmostEqual` test whether *first* and " +"*second* are approximately equal. This method can either round their " +"difference to an optionally specified number of *places* (the default is 7) " +"and compare it to zero, or require the difference to be smaller than a " +"supplied *delta* value." msgstr "" #: ../../whatsnew/2.7.rst:1979 msgid "" -":meth:`~unittest.TestLoader.loadTestsFromName` properly honors the :attr:" -"`~unittest.TestLoader.suiteClass` attribute of the :class:`~unittest." -"TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" +":meth:`~unittest.TestLoader.loadTestsFromName` properly honors " +"the :attr:`~unittest.TestLoader.suiteClass` attribute of " +"the :class:`~unittest.TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" msgstr "" -":meth:`~unittest.TestLoader.loadTestsFromName` は、 :class:`~unittest." -"TestLoader` の :attr:`~unittest.TestLoader.suiteClass` 属性を適切に受け入れま" -"す。(Fixed by Mark Roddy; :issue:`6866`.)" +":meth:`~unittest.TestLoader.loadTestsFromName` " +"は、 :class:`~unittest.TestLoader` " +"の :attr:`~unittest.TestLoader.suiteClass` 属性を適切に受け入れます。(Fixed " +"by Mark Roddy; :issue:`6866`.)" #: ../../whatsnew/2.7.rst:1983 msgid "" "A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method " -"to handle new data types. The :meth:`~unittest.TestCase." -"addTypeEqualityFunc` method takes a type object and a function. The function " -"will be used when both of the objects being compared are of the specified " -"type. This function should compare the two objects and raise an exception " -"if they don't match; it's a good idea for the function to provide additional " -"information about why the two objects aren't matching, much as the new " -"sequence comparison methods do." +"to handle new data types. " +"The :meth:`~unittest.TestCase.addTypeEqualityFunc` method takes a type " +"object and a function. The function will be used when both of the objects " +"being compared are of the specified type. This function should compare the " +"two objects and raise an exception if they don't match; it's a good idea for " +"the function to provide additional information about why the two objects " +"aren't matching, much as the new sequence comparison methods do." msgstr "" "新しいフックにより、 :meth:`~unittest.TestCase.assertEqual` メソッドを拡張し" -"て新しいデータ型を扱わせられます。 :meth:`~unittest.TestCase." -"addTypeEqualityFunc` メソッドは型オブジェクトと関数を取ります。この関数は、比" -"較される両方のオブジェクトが特定の型であるときに使われます。この関数は、2 つ" -"のオブジェクトを比較し、マッチしなければ例外を送出するべきです。この関数が、" -"新しいシーケンス比較メソッドがするように、2 つのオブジェクトがなぜマッチしな" -"いのかについて追加の情報を提供するのがいいアイデアです。" +"て新しいデータ型を扱わせられま" +"す。 :meth:`~unittest.TestCase.addTypeEqualityFunc` メソッドは型オブジェクト" +"と関数を取ります。この関数は、比較される両方のオブジェクトが特定の型であると" +"きに使われます。この関数は、2 つのオブジェクトを比較し、マッチしなければ例外" +"を送出するべきです。この関数が、新しいシーケンス比較メソッドがするように、2 " +"つのオブジェクトがなぜマッチしないのかについて追加の情報を提供するのがいいア" +"イデアです。" #: ../../whatsnew/2.7.rst:1992 msgid "" -":func:`unittest.main` now takes an optional ``exit`` argument. If false, :" -"func:`~unittest.main` doesn't call :func:`sys.exit`, allowing :func:" -"`~unittest.main` to be used from the interactive interpreter. (Contributed " -"by J. Pablo Fernández; :issue:`3379`.)" +":func:`unittest.main` now takes an optional ``exit`` argument. If " +"false, :func:`~unittest.main` doesn't call :func:`sys.exit`, " +"allowing :func:`~unittest.main` to be used from the interactive interpreter. " +"(Contributed by J. Pablo Fernández; :issue:`3379`.)" msgstr "" ":func:`unittest.main` はオプションの ``exit`` 引数を取るようになりました。偽" "の場合、 :func:`~unittest.main` は :func:`sys.exit` を呼び出さず、これにより" @@ -3492,15 +3992,16 @@ msgstr "" #: ../../whatsnew/2.7.rst:1997 msgid "" -":class:`~unittest.TestResult` has new :meth:`~unittest.TestResult." -"startTestRun` and :meth:`~unittest.TestResult.stopTestRun` methods that are " -"called immediately before and after a test run. (Contributed by Robert " +":class:`~unittest.TestResult` has " +"new :meth:`~unittest.TestResult.startTestRun` " +"and :meth:`~unittest.TestResult.stopTestRun` methods that are called " +"immediately before and after a test run. (Contributed by Robert " "Collins; :issue:`5728`.)" msgstr "" -":class:`~unittest.TestResult` に、テストランの直前と直後に呼び出される :meth:" -"`~unittest.TestResult.startTestRun` および :meth:`~unittest.TestResult." -"stopTestRun` が追加されました。 (Contributed by Robert Collins; :issue:" -"`5728`.)" +":class:`~unittest.TestResult` に、テストランの直前と直後に呼び出され" +"る :meth:`~unittest.TestResult.startTestRun` およ" +"び :meth:`~unittest.TestResult.stopTestRun` が追加されました。 (Contributed " +"by Robert Collins; :issue:`5728`.)" #: ../../whatsnew/2.7.rst:2001 msgid "" @@ -3519,6 +4020,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 "" @@ -3550,32 +4053,36 @@ msgstr "" "ンスを与える *parser* キーワード引数を取るようになりました。これにより、ファ" "イルの内部エンコーディングをオーバーライドできるようになりました::" -#: ../../whatsnew/2.7.rst:2024 msgid "" "p = ET.XMLParser(encoding='utf-8')\n" "t = ET.XML(\"\"\"\"\"\", parser=p)" msgstr "" +"p = ET.XMLParser(encoding='utf-8')\n" +"t = ET.XML(\"\"\"\"\"\", parser=p)" -#: ../../whatsnew/2.7.rst:2027 msgid "" "Errors in parsing XML now raise a :exc:`~xml.etree.ElementTree.ParseError` " "exception, whose instances have a :attr:`!position` attribute containing a " "(*line*, *column*) tuple giving the location of the problem." msgstr "" +"XML の解析エラーは :exc:`~xml.etree.ElementTree.ParseError` を送出するように" +"なりました。\n" +"そのインスタンスの :attr:`!position` 属性には、問題の位置を示す (*line*, " +"*column*) タプルが入ります。" #: ../../whatsnew/2.7.rst:2031 msgid "" "ElementTree's code for converting trees to a string has been significantly " -"reworked, making it roughly twice as fast in many cases. The :meth:" -"`ElementTree.write() ` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " +"reworked, making it roughly twice as fast in many cases. " +"The :meth:`ElementTree.write() ` " +"and :meth:`Element.write` methods now have a *method* parameter that can be " "\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " "elements as ```` instead of ````, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"skip over elements and only output the text chunks. If you set " +"the :attr:`~xml.etree.ElementTree.Element.tag` attribute of an element to " +"``None`` but leave its children in place, the element will be omitted when " +"the tree is written out, so you don't need to do more extensive " +"rearrangement to remove a single element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -3583,30 +4090,30 @@ msgid "" "Namespace handling has also been improved. All ``xmlns:`` " "declarations are now output on the root element, not scattered throughout " "the resulting XML. You can set the default namespace for a tree by setting " -"the :attr:`default_namespace` attribute and can register new prefixes with :" -"meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you can use " -"the true/false *xml_declaration* parameter to suppress the XML declaration." +"the :attr:`default_namespace` attribute and can register new prefixes " +"with :meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you " +"can use the true/false *xml_declaration* parameter to suppress the XML " +"declaration." msgstr "" "名前空間の操作も改善されました。すべての ``xmlns:`` 宣言は、結果の " -"XML に散らばるのではなく、ルート要素に出力されます。 :attr:" -"`default_namespace` 属性を設定することでデフォルトの名前空間を設定でき、 :" -"meth:`~xml.etree.ElementTree.register_namespace` で新しい接頭辞を登録できま" -"す。XML モードでは、XML 宣言を抑制するために真/偽の *xml_declaration* パラメ" -"タを使えます。" +"XML に散らばるのではなく、ルート要素に出力されま" +"す。 :attr:`default_namespace` 属性を設定することでデフォルトの名前空間を設定" +"でき、 :meth:`~xml.etree.ElementTree.register_namespace` で新しい接頭辞を登録" +"できます。XML モードでは、XML 宣言を抑制するために真/偽の *xml_declaration* " +"パラメタを使えます。" #: ../../whatsnew/2.7.rst:2052 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.extend` appends the items from a sequence to the " -"element's children. Elements themselves behave like sequences, so it's easy " -"to move children from one element to another::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.extend` appends the items from " +"a sequence to the element's children. Elements themselves behave like " +"sequences, so it's easy to move children from one element to another::" msgstr "" -"新しい :class:`~xml.etree.ElementTree.Element` メソッド: :meth:`~xml.etree." -"ElementTree.Element.extend` はシーケンスから項目の子に要素を追加します。要素" -"それ自体はシーケンスのように振る舞うので、子をある要素から別の要素に移すのが" -"簡単です::" +"新しい :class:`~xml.etree.ElementTree.Element` メソッ" +"ド: :meth:`~xml.etree.ElementTree.Element.extend` はシーケンスから項目の子に" +"要素を追加します。要素それ自体はシーケンスのように振る舞うので、子をある要素" +"から別の要素に移すのが簡単です::" -#: ../../whatsnew/2.7.rst:2058 msgid "" "from xml.etree import ElementTree as ET\n" "\n" @@ -3619,25 +4126,37 @@ msgid "" "# Outputs 1...\n" "print ET.tostring(new)" msgstr "" +"from xml.etree import ElementTree as ET\n" +"\n" +"t = ET.XML(\"\"\"\n" +" 1 2 3\n" +"\"\"\")\n" +"new = ET.XML('')\n" +"new.extend(t)\n" +"\n" +"# 1... を出力\n" +"print ET.tostring(new)" #: ../../whatsnew/2.7.rst:2069 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.iter` yields the children of the element as a " -"generator. It's also possible to write ``for child in elem:`` to loop over " -"an element's children. The existing method :meth:`!getiterator` is now " -"deprecated, as is :meth:`!getchildren` which constructs and returns a list " -"of children." +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.iter` yields the children of " +"the element as a generator. It's also possible to write ``for child in " +"elem:`` to loop over an element's children. The existing method :meth:`!" +"getiterator` is now deprecated, as is :meth:`!getchildren` which constructs " +"and returns a list of children." msgstr "" -#: ../../whatsnew/2.7.rst:2076 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.itertext` yields all chunks of text that are descendants " -"of the element. For example::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.itertext` yields all chunks of " +"text that are descendants of the element. For example::" msgstr "" +":class:`~xml.etree.ElementTree.Element` の新メソッ" +"ド :meth:`~xml.etree.ElementTree.Element.itertext` は、その要素の子孫にあるテ" +"キストの断片をすべて yield します。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/2.7.rst:2080 msgid "" "t = ET.XML(\"\"\"\n" " 1 2 3\n" @@ -3646,6 +4165,12 @@ msgid "" "# Outputs ['\\n ', '1', ' ', '2', ' ', '3', '\\n']\n" "print list(t.itertext())" msgstr "" +"t = ET.XML(\"\"\"\n" +" 1 2 3\n" +"\"\"\")\n" +"\n" +"# 出力: ['\\n ', '1', ' ', '2', ' ', '3', '\\n']\n" +"print list(t.itertext())" #: ../../whatsnew/2.7.rst:2087 msgid "" @@ -3662,14 +4187,18 @@ msgstr "" "引き起こすようになりました。コードでは、明示するべきです。子の数に興味がある" "なら ``len(elem) != 0`` と、または ``elem is not None`` と書いてください。" -#: ../../whatsnew/2.7.rst:2095 msgid "" "Fredrik Lundh develops ElementTree and produced the 1.3 version; you can " -"read his article describing 1.3 at https://web.archive.org/" -"web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " +"read his article describing 1.3 at https://web.archive.org/web/" +"20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " "Xicluna updated the version included with Python, after discussions on " "python-dev and in :issue:`6472`.)" msgstr "" +"ElementTree の開発者 Fredrik Lundh がバージョン 1.3 を作成しました。\n" +"1.3 の紹介記事は https://web.archive.org/web/20200703234532/http://" +"effbot.org/zone/elementtree-13-intro.htm にあります。\n" +"python-dev と :issue:`6472` での議論を経て、Florent Xicluna が Python に含ま" +"れる版を更新しました。" #: ../../whatsnew/2.7.rst:2105 msgid "Build and C API Changes" @@ -3679,7 +4208,6 @@ msgstr "ビルドならびに C API の変更" msgid "Changes to Python's build process and to the C API include:" msgstr "Python のビルド過程と C API の変更は以下の通りです:" -#: ../../whatsnew/2.7.rst:2109 msgid "" "The latest release of the GNU Debugger, GDB 7, can be `scripted using Python " "`__。\n" +"実行プログラム P のデバッグを始めると、GDB は ``P-gdb.py`` を探して自動的に読" +"みます。\n" +"Dave Malcolm が提供した :file:`python-gdb.py` は、Python 自体のデバッグに便利" +"なコマンドを追加します。\n" +"例えば ``py-up`` と ``py-down`` は、通常は複数の C フレームに対応する Python " +"のスタックフレームを一つ上下します。\n" +"``py-print`` は Python 変数の値を、``py-bt`` は Python のスタックトレースを表" +"示します。\n" +"(:issue:`8032` によって追加されました。)" #: ../../whatsnew/2.7.rst:2121 msgid "" @@ -3709,15 +4249,14 @@ msgstr "" msgid "" ":c:func:`Py_AddPendingCall` is now thread-safe, letting any worker thread " "submit notifications to the main Python thread. This is particularly useful " -"for asynchronous IO operations. (Contributed by Kristján Valur Jónsson; :" -"issue:`4293`.)" +"for asynchronous IO operations. (Contributed by Kristján Valur " +"Jónsson; :issue:`4293`.)" msgstr "" ":c:func:`Py_AddPendingCall` はスレッドセーフになり、ワーカスレッドがメイン " "Python スレッドに通知を投入することができるようになりました。これは特に、非同" -"時性の IO 処理に便利です。(Contributed by Kristján Valur Jónsson; :issue:" -"`4293`.)" +"時性の IO 処理に便利です。(Contributed by Kristján Valur " +"Jónsson; :issue:`4293`.)" -#: ../../whatsnew/2.7.rst:2131 msgid "" "New function: :c:func:`PyCode_NewEmpty` creates an empty code object; only " "the filename, function name, and first line number are required. This is " @@ -3725,6 +4264,11 @@ msgid "" "traceback stack. Previously such extensions needed to call :c:func:`!" "PyCode_New`, which had many more arguments. (Added by Jeffrey Yasskin.)" msgstr "" +"新関数: :c:func:`PyCode_NewEmpty` は、ファイル名、関数名、開始行番号だけで空" +"のコードオブジェクトを作ります。\n" +"より有用なトレースバックを組み立てたい拡張モジュールに便利です。\n" +"以前は、引数がはるかに多い :c:func:`!PyCode_New` を呼ぶ必要がありました。\n" +"(Jeffrey Yasskin が追加しました。)" #: ../../whatsnew/2.7.rst:2138 msgid "" @@ -3733,10 +4277,10 @@ msgid "" "extra ``char *`` argument containing the docstring for the new exception " "class. (Added by 'lekma' on the Python bug tracker; :issue:`7033`.)" msgstr "" -"新しい関数: :c:func:`PyErr_NewExceptionWithDoc` は、既存の :c:func:" -"`PyErr_NewException` と同じように新しい例外クラスを生成しますが、新しい例外ク" -"ラスの docstring を含む、追加の ``char *`` 引数を取ります。(Added by 'lekma' " -"on the Python bug tracker; :issue:`7033`.)" +"新しい関数: :c:func:`PyErr_NewExceptionWithDoc` は、既存" +"の :c:func:`PyErr_NewException` と同じように新しい例外クラスを生成しますが、" +"新しい例外クラスの docstring を含む、追加の ``char *`` 引数を取ります。" +"(Added by 'lekma' on the Python bug tracker; :issue:`7033`.)" #: ../../whatsnew/2.7.rst:2144 msgid "" @@ -3751,32 +4295,41 @@ msgstr "" "るバイトコード命令のインデクスを得て、それからそのアドレスに対応する行番号を" "探索する必要がありました。(Added by Jeffrey Yasskin.)" -#: ../../whatsnew/2.7.rst:2150 msgid "" -"New functions: :c:func:`PyLong_AsLongAndOverflow` and :c:func:" -"`PyLong_AsLongLongAndOverflow` approximates a Python long integer as a C :c:" -"expr:`long` or :c:expr:`long long`. If the number is too large to fit into " -"the output type, an *overflow* flag is set and returned to the caller. " -"(Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.)" +"New functions: :c:func:`PyLong_AsLongAndOverflow` " +"and :c:func:`PyLong_AsLongLongAndOverflow` approximates a Python long " +"integer as a C :c:expr:`long` or :c:expr:`long long`. If the number is too " +"large to fit into the output type, an *overflow* flag is set and returned to " +"the caller. (Contributed by Case Van Horsen; :issue:`7528` " +"and :issue:`7767`.)" msgstr "" +"新関数: :c:func:`PyLong_AsLongAndOverflow` " +"と :c:func:`PyLong_AsLongLongAndOverflow` は、Python の長整数を C " +"の :c:expr:`long` または :c:expr:`long long` に変換します。\n" +"出力型に収まらない場合は、*overflow* フラグを設定して呼び出し側へ返します。\n" +"(Case Van Horsen による貢献です。:issue:`7528`、:issue:`7767`。)" -#: ../../whatsnew/2.7.rst:2157 msgid "" "New function: stemming from the rewrite of string-to-float conversion, a " "new :c:func:`PyOS_string_to_double` function was added. The old :c:func:`!" "PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions are now " "deprecated." msgstr "" +"新関数: 文字列から浮動小数点数への変換の書き直しに伴" +"い、:c:func:`PyOS_string_to_double` が加わりました。\n" +"従来の :c:func:`!PyOS_ascii_strtod` と :c:func:`!PyOS_ascii_atof` は非推奨と" +"なりました。" -#: ../../whatsnew/2.7.rst:2162 msgid "" "New function: :c:func:`!PySys_SetArgvEx` sets the value of ``sys.argv`` and " "can optionally update ``sys.path`` to include the directory containing the " "script named by ``sys.argv[0]`` depending on the value of an *updatepath* " "parameter." msgstr "" +"新関数: :c:func:`!PySys_SetArgvEx` は ``sys.argv`` を設定し、*updatepath* の" +"値に応じて、``sys.argv[0]`` が示すスクリプトのディレクトリを ``sys.path`` に" +"追加することもできます。" -#: ../../whatsnew/2.7.rst:2167 msgid "" "This function was added to close a security hole for applications that embed " "Python. The old function, :c:func:`!PySys_SetArgv`, would always update " @@ -3786,55 +4339,69 @@ msgid "" "(say, a file named :file:`os.py`) that your application would then import " "and run." msgstr "" +"この関数は、Python を組み込むアプリケーションのセキュリティホールを塞ぐために" +"追加されました。\n" +"従来の :c:func:`!PySys_SetArgv` は常に ``sys.path`` を更新し、現在のディレク" +"トリを追加する場合がありました。\n" +"そのため、他人が管理するディレクトリで Python を組み込んだアプリケーションを" +"実行すると、攻撃者がそこへトロイの木馬のようなモジュール (例え" +"ば :file:`os.py`) を置き、アプリケーションにインポート・実行させることができ" +"ました。" -#: ../../whatsnew/2.7.rst:2175 msgid "" "If you maintain a C/C++ application that embeds Python, check whether you're " "calling :c:func:`!PySys_SetArgv` and carefully consider whether the " "application should be using :c:func:`!PySys_SetArgvEx` with *updatepath* set " "to false." msgstr "" +"Python を組み込む C/C++ アプリケーションの保守担当者は、:c:func:`!" +"PySys_SetArgv` を呼んでいるか確認し、*updatepath* を偽にした :c:func:`!" +"PySys_SetArgvEx` を使うべきか慎重に検討してください。" -#: ../../whatsnew/2.7.rst:2180 msgid "" "Security issue reported as :cve:`2008-5983`; discussed in :issue:`5753`, and " "fixed by Antoine Pitrou." msgstr "" +"このセキュリティ問題は :cve:`2008-5983` として報告され、:issue:`5753` で議論" +"され、Antoine Pitrou が修正しました。" #: ../../whatsnew/2.7.rst:2183 msgid "" -"New macros: the Python header files now define the following macros: :c:" -"macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:" -"`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:" -"`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, and :c:macro:`Py_TOUPPER`. All of " -"these functions are analogous to the C standard macros for classifying " -"characters, but ignore the current locale setting, because in several places " -"Python needs to analyze characters in a locale-independent way. (Added by " -"Eric Smith; :issue:`5793`.)" -msgstr "" -"新しいマクロ: Python ヘッダファイルは、以下のマクロを定義しました: :c:macro:" -"`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:" -"`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:" -"`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, および :c:macro:`Py_TOUPPER` 。これらす" -"べての関数は、文字を分類する C の標準マクロと類似ですが、Python は文字をロ" -"ケールに依らず文字を分析したいときがあるため、現在のロケール設定を無視しま" -"す。(Added by Eric Smith; :issue:`5793`.)" - -#: ../../whatsnew/2.7.rst:2201 +"New macros: the Python header files now define the following " +"macros: :c:macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, " +"and :c:macro:`Py_TOUPPER`. All of these functions are analogous to the C " +"standard macros for classifying characters, but ignore the current locale " +"setting, because in several places Python needs to analyze characters in a " +"locale-independent way. (Added by Eric Smith; :issue:`5793`.)" +msgstr "" +"新しいマクロ: Python ヘッダファイルは、以下のマクロを定義しまし" +"た: :c:macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, " +"および :c:macro:`Py_TOUPPER` 。これらすべての関数は、文字を分類する C の標準" +"マクロと類似ですが、Python は文字をロケールに依らず文字を分析したいときがある" +"ため、現在のロケール設定を無視します。(Added by Eric Smith; :issue:`5793`.)" + msgid "" "Removed function: :c:func:`!PyEval_CallObject` is now only available as a " "macro. A function version was being kept around to preserve ABI linking " "compatibility, but that was in 1997; it can certainly be deleted by now. " "(Removed by Antoine Pitrou; :issue:`8276`.)" msgstr "" +"削除された関数: :c:func:`!PyEval_CallObject` はマクロとしてのみ利用できま" +"す。\n" +"ABI のリンク互換性のため関数版も残されていましたが、それは 1997 年の話なの" +"で、もう削除してもよいでしょう。\n" +"(Antoine Pitrou が削除しました。:issue:`8276`。)" -#: ../../whatsnew/2.7.rst:2206 msgid "" "New format codes: the :c:func:`!PyString_FromFormat`, :c:func:`!" "PyString_FromFormatV`, and :c:func:`PyErr_Format` functions now accept " "``%lld`` and ``%llu`` format codes for displaying C's :c:expr:`long long` " "types. (Contributed by Mark Dickinson; :issue:`7228`.)" msgstr "" +"新しい書式コード: :c:func:`!PyString_FromFormat`、:c:func:`!" +"PyString_FromFormatV`、:c:func:`PyErr_Format` が、C の :c:expr:`long long` を" +"表示する ``%lld`` と ``%llu`` に対応しました。\n" +"(Mark Dickinson による貢献です。:issue:`7228`。)" #: ../../whatsnew/2.7.rst:2212 msgid "" @@ -3847,14 +4414,14 @@ msgid "" "nothing would ever release the lock, since the other threads weren't " "replicated, and the child process would no longer be able to perform imports." msgstr "" -"スレッドとプロセスのフォークの間の複雑な相互関係が変更されました。以前は、 :" -"func:`os.fork` によって生成された子プロセスは失敗していました。これは、子は動" -"作しているスレッド 1 つだけで生成され、そのスレッドが :func:`os.fork` を処理" -"するからです。他のスレッドが、Python のインポートロックのような、ロックを保持" -"していたら、フォークが実行されたとき、ロックは新しいプロセスでも \"held\" と" -"してマークされたままです。しかし、子プロセスでは、他のスレッドは複製されない" -"ため、ロックを解放するものは何もないので、子プロセスは import の実行を続ける" -"ことができません。" +"スレッドとプロセスのフォークの間の複雑な相互関係が変更されました。以前" +"は、 :func:`os.fork` によって生成された子プロセスは失敗していました。これは、" +"子は動作しているスレッド 1 つだけで生成され、そのスレッドが :func:`os.fork` " +"を処理するからです。他のスレッドが、Python のインポートロックのような、ロック" +"を保持していたら、フォークが実行されたとき、ロックは新しいプロセスでも " +"\"held\" としてマークされたままです。しかし、子プロセスでは、他のスレッドは複" +"製されないため、ロックを解放するものは何もないので、子プロセスは import の実" +"行を続けることができません。" #: ../../whatsnew/2.7.rst:2222 msgid "" @@ -3863,27 +4430,30 @@ msgid "" "C extension modules that have internal locks, or that call :c:func:`fork()` " "themselves, will not benefit from this clean-up." msgstr "" -"Python 2.7 は、 :func:`os.fork` を実行する前に import ロックを取得し、また :" -"mod:`threading` モジュールを使って生成された全てのロックをクリーンアップしま" -"す。内部ロックを持っていたり、自身で :c:func:`fork()` を呼び出したりするよう" -"な C 拡張モジュールは、このクリーンアップの恩恵を受けません。" +"Python 2.7 は、 :func:`os.fork` を実行する前に import ロックを取得し、ま" +"た :mod:`threading` モジュールを使って生成された全てのロックをクリーンアップ" +"します。内部ロックを持っていたり、自身で :c:func:`fork()` を呼び出したりする" +"ような C 拡張モジュールは、このクリーンアップの恩恵を受けません。" #: ../../whatsnew/2.7.rst:2228 msgid "(Fixed by Thomas Wouters; :issue:`1590864`.)" msgstr "(Fixed by Thomas Wouters; :issue:`1590864`.)" -#: ../../whatsnew/2.7.rst:2230 msgid "" -"The :c:func:`Py_Finalize` function now calls the internal :func:`!threading." -"_shutdown` function; this prevents some exceptions from being raised when an " -"interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.)" +"The :c:func:`Py_Finalize` function now calls the internal :func:`!" +"threading._shutdown` function; this prevents some exceptions from being " +"raised when an interpreter shuts down. (Patch by Adam " +"Olsen; :issue:`1722344`.)" msgstr "" +":c:func:`Py_Finalize` が内部の :func:`!threading._shutdown` を呼ぶようにな" +"り、インタープリタ終了時の一部の例外が起きなくなりました。\n" +"(Adam Olsen によるパッチです。:issue:`1722344`。)" #: ../../whatsnew/2.7.rst:2235 msgid "" "When using the :c:type:`PyMemberDef` structure to define attributes of a " -"type, Python will no longer let you try to delete or set a :c:macro:" -"`T_STRING_INPLACE` attribute." +"type, Python will no longer let you try to delete or set " +"a :c:macro:`T_STRING_INPLACE` attribute." msgstr "" #: ../../whatsnew/2.7.rst:2241 @@ -3892,24 +4462,27 @@ msgid "" "``Py``, or with ``_ctypes``. (Implemented by Thomas Heller; :issue:`3102`.)" msgstr "" ":mod:`ctypes` によって定義されたグローバルシンボルには、 ``Py`` または " -"``_ctypes`` が接頭されるようになりました。(Implemented by Thomas Heller; :" -"issue:`3102`.)" +"``_ctypes`` が接頭されるようになりました。(Implemented by Thomas " +"Heller; :issue:`3102`.)" -#: ../../whatsnew/2.7.rst:2245 msgid "" "New configure option: the :option:`!--with-system-expat` switch allows " "building the :mod:`pyexpat ` module to use the system " -"Expat library. (Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:" -"`7609`.)" +"Expat library. (Contributed by Arfrever Frehtes Taifersar " +"Arahesis; :issue:`7609`.)" msgstr "" +"新しい configure オプション: :option:`!--with-system-expat` を指定すると、シ" +"ステムの Expat ライブラリを使うよう :mod:`pyexpat ` をビル" +"ドできます。\n" +"(Arfrever Frehtes Taifersar Arahesis による貢献です。:issue:`7609`。)" #: ../../whatsnew/2.7.rst:2249 msgid "" "New configure option: the :option:`!--with-valgrind` option will now disable " "the pymalloc allocator, which is difficult for the Valgrind memory-error " "detector to analyze correctly. Valgrind will therefore be better at " -"detecting memory leaks and overruns. (Contributed by James Henstridge; :" -"issue:`2422`.)" +"detecting memory leaks and overruns. (Contributed by James " +"Henstridge; :issue:`2422`.)" msgstr "" "新しい設定オプション: :option:`!--with-valgrind` オプションは、 Valgrind メモ" "リエラー検出器が正しく分析するのが難しい pymalloc アロケータを無効にするよう" @@ -3931,8 +4504,8 @@ msgid "" "The :program:`configure` script now checks for floating-point rounding bugs " "on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` " "preprocessor definition. No code currently uses this definition, but it's " -"available if anyone wishes to use it. (Added by Mark Dickinson; :issue:" -"`2937`.)" +"available if anyone wishes to use it. (Added by Mark " +"Dickinson; :issue:`2937`.)" msgstr "" ":program:`configure` スクリプトは、ある種の 32-bit Intel チップ上の浮動小数点" "丸めバグを調べ、 :c:macro:`X87_DOUBLE_ROUNDING` プリプロセッサ定義を定義しま" @@ -3973,23 +4546,22 @@ msgstr "カプセル" msgid "" "Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API " "to an extension module. A capsule is essentially the holder of a C ``void " -"*`` pointer, and is made available as a module attribute; for example, the :" -"mod:`socket` module's API is exposed as ``socket.CAPI``, and :mod:" -"`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can import the " -"module, access its dictionary to get the capsule object, and then get the " -"``void *`` pointer, which will usually point to an array of pointers to the " -"module's various API functions." -msgstr "" -"Python 3.1 は、拡張モジュールに C API を提供する新しい C データ型 :c:type:" -"`PyCapsule` を追加しました。カプセルは、本質的には C の ``void *`` ポインタの" -"ホルダであり、モジュール属性として利用できるようになります。例えば、 :mod:" -"`socket` モジュールの API は ``socket.CAPI`` として公開されていて、 :mod:" -"`unicodedata` は ``ucnhash_CAPI`` を公開しています。その他の拡張はモジュール" -"を import し、辞書にアクセスしてカプセルオブジェクトを取得し、そしてモジュー" -"ルの様々な API 関数へのポインタの配列を指す ``void *`` ポインタを取得できま" -"す。" +"*`` pointer, and is made available as a module attribute; for example, " +"the :mod:`socket` module's API is exposed as ``socket.CAPI``, " +"and :mod:`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can " +"import the module, access its dictionary to get the capsule object, and then " +"get the ``void *`` pointer, which will usually point to an array of pointers " +"to the module's various API functions." +msgstr "" +"Python 3.1 は、拡張モジュールに C API を提供する新しい C データ" +"型 :c:type:`PyCapsule` を追加しました。カプセルは、本質的には C の ``void " +"*`` ポインタのホルダであり、モジュール属性として利用できるようになります。例" +"えば、 :mod:`socket` モジュールの API は ``socket.CAPI`` として公開されてい" +"て、 :mod:`unicodedata` は ``ucnhash_CAPI`` を公開しています。その他の拡張は" +"モジュールを import し、辞書にアクセスしてカプセルオブジェクトを取得し、そし" +"てモジュールの様々な API 関数へのポインタの配列を指す ``void *`` ポインタを取" +"得できます。" -#: ../../whatsnew/2.7.rst:2292 msgid "" "There is an existing data type already used for this, :c:type:`!PyCObject`, " "but it doesn't provide type safety. Evil code written in pure Python could " @@ -3998,6 +4570,12 @@ msgid "" "Capsules know their own name, and getting the pointer requires providing the " "name:" msgstr "" +"この目的には既に :c:type:`!PyCObject` が使われていましたが、型安全性がありま" +"せんでした。\n" +"Python だけで書いた悪意あるコードでも、モジュール A の :c:type:`!PyCObject` " +"を何らかの方法でモジュール B の :c:type:`!PyCObject` の代わりに渡すと、セグメ" +"ンテーション違反を起こせました。\n" +"カプセルは自分の名前を持ち、ポインターの取得にはその名前の指定が必要です。" #: ../../whatsnew/2.7.rst:2299 msgid "" @@ -4023,14 +4601,18 @@ msgstr "" "らのオブジェクトの使用について、より詳しい情報は、 :ref:`using-capsules` を参" "照してください。" -#: ../../whatsnew/2.7.rst:2315 msgid "" "Python 2.7 now uses capsules internally to provide various extension-module " "APIs, but the :c:func:`!PyCObject_AsVoidPtr` was modified to handle " "capsules, preserving compile-time compatibility with the :c:type:`!" -"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal a :" -"exc:`PendingDeprecationWarning`, which is silent by default." +"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal " +"a :exc:`PendingDeprecationWarning`, which is silent by default." msgstr "" +"Python 2.7 では各種拡張モジュールの API の提供に内部でカプセルを使います" +"が、:c:func:`!PyCObject_AsVoidPtr` もカプセルを扱えるよう変更され、:c:type:`!" +"PyCObject` インターフェースとのコンパイル時の互換性は保たれます。\n" +":c:func:`!PyCObject_AsVoidPtr` を使うと :exc:`PendingDeprecationWarning` が発" +"生しますが、デフォルトでは表示されません。" #: ../../whatsnew/2.7.rst:2322 msgid "" @@ -4044,41 +4626,60 @@ msgstr "" msgid "Port-Specific Changes: Windows" msgstr "ポート特有の変更: Windows" -#: ../../whatsnew/2.7.rst:2331 msgid "" -"The :mod:`msvcrt` module now contains some constants from the :file:" -"`crtassem.h` header file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:" -"`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, and :data:`~msvcrt." -"LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David Cournapeau; :issue:" -"`4365`.)" +"The :mod:`msvcrt` module now contains some constants from " +"the :file:`crtassem.h` header " +"file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, " +"and :data:`~msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David " +"Cournapeau; :issue:`4365`.)" msgstr "" +":mod:`msvcrt` に、:file:`crtassem.h` の定" +"数 :data:`~msvcrt.CRT_ASSEMBLY_VERSION`、:data:`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`、:data:`~msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX` " +"が加わりました。\n" +"(David Cournapeau による貢献です。:issue:`4365`。)" -#: ../../whatsnew/2.7.rst:2338 msgid "" "The :mod:`_winreg ` module for accessing the registry now implements " "the :func:`~winreg.CreateKeyEx` and :func:`~winreg.DeleteKeyEx` functions, " "extended versions of previously supported functions that take several extra " -"arguments. The :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` were also " -"tested and documented. (Implemented by Brian Curtin: :issue:`7347`.)" +"arguments. " +"The :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` were also tested and documented. " +"(Implemented by Brian Curtin: :issue:`7347`.)" msgstr "" +"レジストリにアクセスする :mod:`_winreg ` " +"に、:func:`~winreg.CreateKeyEx` と :func:`~winreg.DeleteKeyEx` が実装されまし" +"た。\n" +"従来の関数を拡張し、追加の引数を取る版です。\n" +":func:`~winreg.DisableReflectionKey`、:func:`~winreg.EnableReflectionKey`、:func:`~winreg.QueryReflectionKey` " +"のテストと文書も追加されました。\n" +"(Brian Curtin による実装です。:issue:`7347`。)" -#: ../../whatsnew/2.7.rst:2346 msgid "" "The new :c:func:`!_beginthreadex` API is used to start threads, and the " "native thread-local storage functions are now used. (Contributed by Kristján " "Valur Jónsson; :issue:`3582`.)" msgstr "" +"新しい :c:func:`!_beginthreadex` API でスレッドを起動し、ネイティブのスレッド" +"ローカルストレージ関数を使うようになりました。\n" +"(Kristján Valur Jónsson による貢献です。:issue:`3582`。)" -#: ../../whatsnew/2.7.rst:2350 msgid "" "The :func:`os.kill` function now works on Windows. The signal value can be " -"the constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal." -"CTRL_BREAK_EVENT`, or any integer. The first two constants will send :kbd:" -"`Control-C` and :kbd:`Control-Break` keystroke events to subprocesses; any " -"other value will use the :c:func:`!TerminateProcess` API. (Contributed by " -"Miki Tebeka; :issue:`1220212`.)" -msgstr "" +"the " +"constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal.CTRL_BREAK_EVENT`, " +"or any integer. The first two constants will send :kbd:`Control-C` " +"and :kbd:`Control-Break` keystroke events to subprocesses; any other value " +"will use the :c:func:`!TerminateProcess` API. (Contributed by Miki " +"Tebeka; :issue:`1220212`.)" +msgstr "" +":func:`os.kill` が Windows でも動作するようになりました。\n" +"シグナル値に" +"は :const:`~signal.CTRL_C_EVENT`、:const:`~signal.CTRL_BREAK_EVENT`、または任" +"意の整数を指定できます。\n" +"最初の 2 つはサブプロセスに :kbd:`Control-C` と :kbd:`Control-Break` のキーイ" +"ベントを送り、それ以外は :c:func:`!TerminateProcess` API を使います。\n" +"(Miki Tebeka による貢献です。:issue:`1220212`。)" #: ../../whatsnew/2.7.rst:2357 msgid "" @@ -4088,11 +4689,13 @@ msgstr "" ":func:`os.listdir` 関数は、空のパスに対してちゃんと失敗するようになりまし" "た。 (Fixed by Hirokazu Yamamoto; :issue:`5913`.)" -#: ../../whatsnew/2.7.rst:2360 msgid "" "The :mod:`mimetypes` module will now read the MIME database from the Windows " "registry when initializing. (Patch by Gabriel Genellina; :issue:`4969`.)" msgstr "" +":mod:`mimetypes` は初期化時に Windows レジストリから MIME データベースを読む" +"ようになりました。\n" +"(Gabriel Genellina によるパッチです。:issue:`4969`。)" #: ../../whatsnew/2.7.rst:2367 msgid "Port-Specific Changes: Mac OS X" @@ -4100,17 +4703,16 @@ msgstr "ポート特有の変更: Mac OS X" #: ../../whatsnew/2.7.rst:2369 msgid "" -"The path ``/Library/Python/2.7/site-packages`` is now appended to ``sys." -"path``, in order to share added packages between the system installation and " -"a user-installed copy of the same version. (Changed by Ronald Oussoren; :" -"issue:`4865`.)" +"The path ``/Library/Python/2.7/site-packages`` is now appended to " +"``sys.path``, in order to share added packages between the system " +"installation and a user-installed copy of the same version. (Changed by " +"Ronald Oussoren; :issue:`4865`.)" msgstr "" "追加されたパッケージを、システムインストレーションとユーザがインストールした" -"同じバージョンのコピーで共有するために、 ``sys.path`` に ``/Library/" -"Python/2.7/site-packages`` が追加されました。 (Changed by Ronald Oussoren; :" -"issue:`4865`.)" +"同じバージョンのコピーで共有するために、 ``sys.path`` に ``/Library/Python/" +"2.7/site-packages`` が追加されました。 (Changed by Ronald " +"Oussoren; :issue:`4865`.)" -#: ../../whatsnew/2.7.rst:2376 msgid "" "As of 2.7.13, this change was removed. ``/Library/Python/2.7/site-" "packages``, the site-packages directory used by the Apple-supplied system " @@ -4121,18 +4723,34 @@ msgid "" "installed for the system Python will no longer be shared with user-installed " "Pythons. (:issue:`28440`)" msgstr "" +"2.7.13 で、この変更は取り消されました。\n" +"Apple が提供するシステム Python 2.7 の site-packages ディレクトリ ``/Library/" +"Python/2.7/site-packages`` は、python.org のインストーラーなどで利用者がイン" +"ストールした Python の ``sys.path`` に追加されなくなりました。\n" +"macOS 10.12 で Apple がシステムの site-packages の構成方法を変更し、" +"setuptools などの pip 関連コンポーネントのインストールが失敗する可能性が生じ" +"たためです。\n" +"システム Python 用のパッケージは、利用者がインストールした Python と共有され" +"なくなります。\n" +"(:issue:`28440`)" #: ../../whatsnew/2.7.rst:2387 msgid "Port-Specific Changes: FreeBSD" msgstr "ポート特有の変更: FreeBSD" -#: ../../whatsnew/2.7.rst:2389 msgid "" -"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with the :func:`~socket." -"socket` methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket." -"setsockopt` to select an alternate routing table, is now available in the :" -"mod:`socket` module. (Added by Kyle VanderBeek; :issue:`8235`.)" +"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with " +"the :func:`~socket.socket` " +"methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket.setsockopt` " +"to select an alternate routing table, is now available in the :mod:`socket` " +"module. (Added by Kyle VanderBeek; :issue:`8235`.)" msgstr "" +"FreeBSD 7.1 の :const:`!SO_SETFIB` が :mod:`socket` で利用できるようになりま" +"した。\n" +":func:`~socket.socket` の :func:`~socket.socket.getsockopt` " +"や :func:`~socket.socket.setsockopt` で別のルーティングテーブルを選ぶために使" +"います。\n" +"(Kyle VanderBeek が追加しました。:issue:`8235`。)" #: ../../whatsnew/2.7.rst:2395 msgid "Other Changes and Fixes" @@ -4147,22 +4765,21 @@ msgid "" "measure computing throughput, thread switching latency, and IO processing " "bandwidth when performing several tasks using a varying number of threads." msgstr "" -"ベンチマークスクリプトの 2 つ、 :file:`iobench` および :file:`ccbench`, が :" -"file:`Tools` ディレクトリに追加されました。 :file:`iobench` は、様々な演算を" -"実行している間 :func:`open` によって返された組み込みファイル I/O オブジェクト" -"の速度を計測し、 :file:`ccbench` は、変化する数のスレッドを使っていくつかのタ" -"スクを処理するときの計算スループット、スレッド切り替えレイテンシ、IO 処理バン" -"ド幅の計測を試みる同時実行ベンチマークです。" +"ベンチマークスクリプトの 2 つ、 :file:`iobench` および :file:`ccbench`, " +"が :file:`Tools` ディレクトリに追加されました。 :file:`iobench` は、様々な演" +"算を実行している間 :func:`open` によって返された組み込みファイル I/O オブジェ" +"クトの速度を計測し、 :file:`ccbench` は、変化する数のスレッドを使っていくつか" +"のタスクを処理するときの計算スループット、スレッド切り替えレイテンシ、IO 処理" +"バンド幅の計測を試みる同時実行ベンチマークです。" #: ../../whatsnew/2.7.rst:2405 msgid "" -"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms in :" -"file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" +"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms " +"in :file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" msgstr "" ":file:`Tools/i18n/msgfmt.py` スクリプトは、複数の形式の :file:`.po` ファイル" "を理解できるようになりました。(Fixed by Martin von Löwis; :issue:`5464`.)" -#: ../../whatsnew/2.7.rst:2409 msgid "" "When importing a module from a :file:`.pyc` or :file:`.pyo` file with an " "existing :file:`.py` counterpart, the :attr:`~codeobject.co_filename` " @@ -4171,13 +4788,18 @@ msgid "" "or is accessed through different paths. (Patch by Ziga Seilnacht and Jean-" "Paul Calderone; :issue:`1180193`.)" msgstr "" +"対応する :file:`.py` が存在する :file:`.pyc` や :file:`.pyo` からモジュールを" +"インポートする際、元のファイル名が古ければ、生成されたコードオブジェクト" +"の :attr:`~codeobject.co_filename` を上書きするようになりました。\n" +"これはファイルの改名、移動、別経路からのアクセスなどで起こります。\n" +"(Ziga Seilnacht と Jean-Paul Calderone によるパッチです。:issue:`1180193`。)" #: ../../whatsnew/2.7.rst:2416 msgid "" "The :file:`regrtest.py` script now takes a :option:`!--randseed=` switch " -"that takes an integer that will be used as the random seed for the :option:" -"`!-r` option that executes tests in random order. The :option:`!-r` option " -"also reports the seed that was used (Added by Collin Winter.)" +"that takes an integer that will be used as the random seed for " +"the :option:`!-r` option that executes tests in random order. The :option:`!-" +"r` option also reports the seed that was used (Added by Collin Winter.)" msgstr "" ":file:`regrtest.py` スクリプトは、テストを乱順に実行する :option:`!-r` オプ" "ションの、ランダムシードに使われる整数を取る :option:`!--randseed=` スイッチ" @@ -4196,11 +4818,11 @@ msgid "" msgstr "" "もう一つの :file:`regrtest.py` スイッチは :option:`!-j` で、いくつのテストを" "並行して実行するかを指定する整数です。これにより、マルチコア機での合計実行時" -"間を短縮できます。このオプションは、実行時間を長くすることで知られている :" -"option:`!-R` スイッチなど、いくつかの他のオプションと互換です。 (Added by " -"Antoine Pitrou, :issue:`6152`.) これはまた、選ばれたテストを失敗するまでルー" -"プして実行する :option:`!-F` スイッチとも同時に使えます。(Added by Antoine " -"Pitrou; :issue:`7312`.)" +"間を短縮できます。このオプションは、実行時間を長くすることで知られてい" +"る :option:`!-R` スイッチなど、いくつかの他のオプションと互換です。 (Added " +"by Antoine Pitrou, :issue:`6152`.) これはまた、選ばれたテストを失敗するまで" +"ループして実行する :option:`!-F` スイッチとも同時に使えます。(Added by " +"Antoine Pitrou; :issue:`7312`.)" #: ../../whatsnew/2.7.rst:2431 msgid "" @@ -4224,25 +4846,26 @@ msgstr "" "このセクションでは前述の変更とバグフィックスにより必要となるかもしれないコー" "ドの変更を列挙します:" -#: ../../whatsnew/2.7.rst:2444 msgid "" "The :func:`range` function processes its arguments more consistently; it " "will now call :meth:`~object.__int__` on non-float, non-integer arguments " "that are supplied to it. (Fixed by Alexander Belopolsky; :issue:`1533`.)" msgstr "" +":func:`range` の引数処理がより一貫したものとなり、浮動小数点数でも整数でもな" +"い引数には :meth:`~object.__int__` を呼ぶようになりました。\n" +"(Alexander Belopolsky が修正しました。:issue:`1533`。)" #: ../../whatsnew/2.7.rst:2449 msgid "" "The string :meth:`format` method changed the default precision used for " "floating-point and complex numbers from 6 decimal places to 12, which " -"matches the precision used by :func:`str`. (Changed by Eric Smith; :issue:" -"`5920`.)" +"matches the precision used by :func:`str`. (Changed by Eric " +"Smith; :issue:`5920`.)" msgstr "" "文字列 :meth:`format` メソッドは浮動小数点数および複素数に使われるデフォルト" "の精度を、 :func:`str` で使われる精度に合わせ、小数第 6 位から 12 位に変更し" "ました。 (Changed by Eric Smith; :issue:`5920`.)" -#: ../../whatsnew/2.7.rst:2454 msgid "" "Because of an optimization for the :keyword:`with` statement, the special " "methods :meth:`~object.__enter__` and :meth:`~object.__exit__` must belong " @@ -4250,14 +4873,22 @@ msgid "" "instance. This affects new-style classes (derived from :class:`object`) and " "C extension types. (:issue:`6101`.)" msgstr "" +":keyword:`with` 文の最適化により、特殊メソッド :meth:`~object.__enter__` " +"と :meth:`~object.__exit__` はオブジェクトの型に属している必要があり、インス" +"タンスに直接取り付けることはできなくなりました。\n" +"これは :class:`object` を継承する新スタイルクラスと、C 拡張型に影響します。\n" +"(:issue:`6101`)" -#: ../../whatsnew/2.7.rst:2460 msgid "" -"Due to a bug in Python 2.6, the *exc_value* parameter to :meth:`~object." -"__exit__` methods was often the string representation of the exception, not " -"an instance. This was fixed in 2.7, so *exc_value* will be an instance as " -"expected. (Fixed by Florent Xicluna; :issue:`7853`.)" +"Due to a bug in Python 2.6, the *exc_value* parameter " +"to :meth:`~object.__exit__` methods was often the string representation of " +"the exception, not an instance. This was fixed in 2.7, so *exc_value* will " +"be an instance as expected. (Fixed by Florent Xicluna; :issue:`7853`.)" msgstr "" +"Python 2.6 のバグにより、:meth:`~object.__exit__` の *exc_value* は例外のイン" +"スタンスでなく、その文字列表現になっていることがありました。\n" +"2.7 で修正され、*exc_value* は期待どおりインスタンスになります。\n" +"(Florent Xicluna が修正しました。:issue:`7853`。)" #: ../../whatsnew/2.7.rst:2470 msgid "In the standard library:" @@ -4266,35 +4897,38 @@ msgstr "標準ライブラリでは:" #: ../../whatsnew/2.7.rst:2472 msgid "" "Operations with :class:`~datetime.datetime` instances that resulted in a " -"year falling outside the supported range didn't always raise :exc:" -"`OverflowError`. Such errors are now checked more carefully and will now " -"raise the exception. (Reported by Mark Leander, patch by Anand B. Pillai and " -"Alexander Belopolsky; :issue:`7150`.)" +"year falling outside the supported range didn't always " +"raise :exc:`OverflowError`. Such errors are now checked more carefully and " +"will now raise the exception. (Reported by Mark Leander, patch by Anand B. " +"Pillai and Alexander Belopolsky; :issue:`7150`.)" msgstr "" "年がサポートされている範囲外にはみ出るような :class:`~datetime.datetime` イン" "スタンスの演算が、 :exc:`OverflowError` を送出しないことがありました。このよ" "うなエラーはより注意深く調べられ、例外を送出するようになりました。(Reported " -"by Mark Leander, patch by Anand B. Pillai and Alexander Belopolsky; :issue:" -"`7150`.)" +"by Mark Leander, patch by Anand B. Pillai and Alexander " +"Belopolsky; :issue:`7150`.)" #: ../../whatsnew/2.7.rst:2478 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:" -"`format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which might change the output of your " -"programs. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`format` method, the default alignment was previously left-" +"alignment. This has been changed to right-alignment, which might change the " +"output of your programs. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" ":class:`~decimal.Decimal` インスタンスを文字列の :meth:`format` メソッドに使" "うとき、デフォルトの揃えは以前は左揃えでした。これは右揃えに変更され、プログ" "ラムの出力が変わるかもしれません。(Changed by Mark Dickinson; :issue:`6857`.)" -#: ../../whatsnew/2.7.rst:2490 msgid "" "The :mod:`xml.etree.ElementTree` library no longer escapes ampersands and " "angle brackets when outputting an XML processing instruction (which looks " "like ````) or comment (which looks like " "````). (Patch by Neil Muller; :issue:`2746`.)" msgstr "" +":mod:`xml.etree.ElementTree` は、XML の処理命令 (```` のような形式) やコメント (```` のような" +"形式) の出力で、アンパサンドや山括弧をエスケープしなくなりました。\n" +"(Neil Muller によるパッチです。:issue:`2746`。)" #: ../../whatsnew/2.7.rst:2496 msgid "" @@ -4313,22 +4947,22 @@ msgid "" "of functions will now raise a :exc:`TypeError` exception instead of " "triggering a :exc:`DeprecationWarning` (:issue:`5080`)." msgstr "" -"``PyArg_Parse*`` 系統の関数で整数フォーマットコードを使う C 拡張は、 :exc:" -"`DeprecationWarning` を引き起こすのではなく、 :exc:`TypeError` 例外を送出する" -"ようになりました。(:issue:`5080`)" +"``PyArg_Parse*`` 系統の関数で整数フォーマットコードを使う C 拡張" +"は、 :exc:`DeprecationWarning` を引き起こすのではなく、 :exc:`TypeError` 例外" +"を送出するようになりました。(:issue:`5080`)" -#: ../../whatsnew/2.7.rst:2545 msgid "" -"Use the new :c:func:`PyOS_string_to_double` function instead of the old :c:" -"func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, which " -"are now deprecated." +"Use the new :c:func:`PyOS_string_to_double` function instead of the " +"old :c:func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, " +"which are now deprecated." msgstr "" +"非推奨となった :c:func:`!PyOS_ascii_strtod` と :c:func:`!PyOS_ascii_atof` の" +"代わりに、新しい :c:func:`PyOS_string_to_double` を使ってください。" #: ../../whatsnew/2.7.rst:2549 msgid "For applications that embed Python:" msgstr "Python を埋め込んだアプリケーションでは:" -#: ../../whatsnew/2.7.rst:2551 msgid "" "The :c:func:`!PySys_SetArgvEx` function was added, letting applications " "close a security hole when the existing :c:func:`!PySys_SetArgv` function " @@ -4336,6 +4970,10 @@ msgid "" "carefully consider whether the application should be using :c:func:`!" "PySys_SetArgvEx` with *updatepath* set to false." msgstr "" +":c:func:`!PySys_SetArgvEx` が追加され、従来の :c:func:`!PySys_SetArgv` を使っ" +"た場合のセキュリティホールを塞げるようになりました。\n" +":c:func:`!PySys_SetArgv` を呼んでいるか確認し、*updatepath* を偽にし" +"た :c:func:`!PySys_SetArgvEx` を使うべきか慎重に検討してください。" #: ../../whatsnew/2.7.rst:2564 msgid "New Features Added to Python 2.7 Maintenance Releases" @@ -4368,21 +5006,27 @@ msgstr "" msgid "Two new environment variables for debug mode" msgstr "デバッグモード用の2つの新しい環境変数" -#: ../../whatsnew/2.7.rst:2580 msgid "" -"In debug mode, the ``[xxx refs]`` statistic is not written by default, the :" -"envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " +"In debug mode, the ``[xxx refs]`` statistic is not written by default, " +"the :envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " "(Contributed by Victor Stinner; :issue:`31733`.)" msgstr "" +"デバッグモードでも、デフォルトでは ``[xxx refs]`` の統計を出力しなくなりまし" +"た。\n" +"環境変数 :envvar:`!PYTHONSHOWREFCOUNT` も設定する必要があります。\n" +"(Victor Stinner による貢献です。:issue:`31733`。)" -#: ../../whatsnew/2.7.rst:2584 msgid "" "When Python is compiled with ``COUNT_ALLOC`` defined, allocation counts are " "no longer dumped by default anymore: the :envvar:`!PYTHONSHOWALLOCCOUNT` " "environment variable must now also be set. Moreover, allocation counts are " -"now dumped into stderr, rather than stdout. (Contributed by Victor Stinner; :" -"issue:`31692`.)" +"now dumped into stderr, rather than stdout. (Contributed by Victor " +"Stinner; :issue:`31692`.)" msgstr "" +"``COUNT_ALLOC`` を定義してコンパイルした場合も、割り当て数はデフォルトで出力" +"されなくなり、環境変数 :envvar:`!PYTHONSHOWALLOCCOUNT` も必要になりました。\n" +"また、出力先が標準出力から標準エラーへ変わりました。\n" +"(Victor Stinner による貢献です。:issue:`31692`。)" #: ../../whatsnew/2.7.rst:2593 msgid "PEP 434: IDLE Enhancement Exception for All Branches" @@ -4442,8 +5086,8 @@ msgid "" "python.org. (Contributed by Zachary Ware; :issue:`21462`.)" msgstr "" "python.org で公開される公式 Windows インストーラのビルドに使う OpenSSL が " -"1.0.1g にアップグレードされました . (Contributed by Zachary Ware; :issue:" -"`21462`.)" +"1.0.1g にアップグレードされました . (Contributed by Zachary " +"Ware; :issue:`21462`.)" #: ../../whatsnew/2.7.rst:2620 msgid ":pep:`466` related features added in Python 2.7.8:" @@ -4457,15 +5101,17 @@ msgid "" msgstr "" ":func:`hashlib.pbkdf2_hmac` が Python 3 からバックポートされました。これによ" "り Python 2 アプリケーションでも、安全なパスワード格納に広範に使うのに相応し" -"いハッシュアルゴリズムが利用できます (Contributed by Alex Gaynor; :issue:" -"`21304`.)" +"いハッシュアルゴリズムが利用できます (Contributed by Alex " +"Gaynor; :issue:`21304`.)" -#: ../../whatsnew/2.7.rst:2626 msgid "" "OpenSSL 1.0.1h was upgraded for the official Windows installers published on " -"python.org. (Contributed by Zachary Ware in :issue:`21671` for :cve:" -"`2014-0224`.)" +"python.org. (Contributed by Zachary Ware in :issue:`21671` " +"for :cve:`2014-0224`.)" msgstr "" +"python.org で公開する公式 Windows インストーラーの OpenSSL が 1.0.1h に更新さ" +"れました。\n" +"(:cve:`2014-0224` のため、Zachary Ware が :issue:`21671` で対応しました。)" #: ../../whatsnew/2.7.rst:2629 msgid ":pep:`466` related features added in Python 2.7.9:" @@ -4503,15 +5149,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:2643 msgid "" -":data:`hashlib.algorithms_guaranteed` and :data:`hashlib." -"algorithms_available` were backported from Python 3 to make it easier for " -"Python 2 applications to select the strongest available hash algorithm. " -"(Contributed by Alex Gaynor in :issue:`21307`)" +":data:`hashlib.algorithms_guaranteed` " +"and :data:`hashlib.algorithms_available` were backported from Python 3 to " +"make it easier for Python 2 applications to select the strongest available " +"hash algorithm. (Contributed by Alex Gaynor in :issue:`21307`)" msgstr "" -":data:`hashlib.algorithms_guaranteed` と :data:`hashlib." -"algorithms_available` が Python 3 からバックポートされました。これにより " -"Python 2 アプリケーションが可能な限り最強のハッシュアルゴリズムを選択するのが" -"容易になります (Contributed by Alex Gaynor in :issue:`21307`)" +":data:`hashlib.algorithms_guaranteed` " +"と :data:`hashlib.algorithms_available` が Python 3 からバックポートされまし" +"た。これにより Python 2 アプリケーションが可能な限り最強のハッシュアルゴリズ" +"ムを選択するのが容易になります (Contributed by Alex Gaynor in :issue:`21307`)" #: ../../whatsnew/2.7.rst:2650 msgid "PEP 477: Backport ensurepip (PEP 453) to Python 2.7" @@ -4584,7 +5230,6 @@ msgstr "" "ない場合でも Windows のための Python ランチャで ``py -m pip`` のようにすれば" "良いです。" -#: ../../whatsnew/2.7.rst:2683 msgid "" "As :pep:`discussed in the PEP <0477#disabling-ensurepip-by-downstream-" "distributors>`, platform packagers may choose not to install these commands " @@ -4592,6 +5237,12 @@ msgid "" "directions on how to install them on that platform (usually using the system " "package manager)." msgstr "" +":pep:`PEP の説明 <0477#disabling-ensurepip-by-downstream-distributors>` にあ" +"るとおり、プラットフォームのパッケージ作成者は、これらのコマンドをデフォルト" +"でインストールしないこともできます。\n" +"ただし、その場合はコマンドの実行時に、そのプラットフォームでのインストール方" +"法 (通常はシステムのパッケージマネージャーを使う方法) を明確かつ簡単に案内す" +"る必要があります。" #: ../../whatsnew/2.7.rst:2690 msgid "Documentation Changes" @@ -4613,12 +5264,13 @@ msgstr "" "Python Packaging Authority に移動されて、独立したプロジェクトのドキュメンテー" "ションになっています。" -#: ../../whatsnew/2.7.rst:2700 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" +"ただし移行はまだ完了していないため、従来版のガイドは :ref:`install-index` " +"と :ref:`setuptools-index` として引き続き利用できます。" #: ../../whatsnew/2.7.rst:2706 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" @@ -4639,15 +5291,21 @@ msgid "" msgstr "" "PEP 476: stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化" -#: ../../whatsnew/2.7.rst:2713 msgid "" -":pep:`476` updated :mod:`httplib ` and modules which use it, such as :" -"mod:`urllib2 ` and :mod:`xmlrpclib `, to now " -"verify that the server presents a certificate which is signed by a " +":pep:`476` updated :mod:`httplib ` and modules which use it, such " +"as :mod:`urllib2 ` and :mod:`xmlrpclib `, to " +"now verify that the server presents a certificate which is signed by a " "Certificate Authority in the platform trust store and whose hostname matches " "the hostname being requested by default, significantly improving security " "for many applications. This change was made in the Python 2.7.9 release." msgstr "" +":pep:`476` によって :mod:`httplib ` と、それを使う :mod:`urllib2 " +"` や :mod:`xmlrpclib ` などが更新されまし" +"た。\n" +"デフォルトで、サーバーの証明書がプラットフォームの信頼ストアにある認証局に" +"よって署名され、ホスト名が要求先と一致することを検証するようになり、多くのア" +"プリケーションの安全性が大幅に向上しました。\n" +"この変更は Python 2.7.9 で行われました。" #: ../../whatsnew/2.7.rst:2721 msgid "" @@ -4657,7 +5315,6 @@ msgstr "" "以前の古い振る舞いが必要なアプリケーションでは、代わりとなるコンテキストを渡" "せます::" -#: ../../whatsnew/2.7.rst:2724 msgid "" "import urllib2\n" "import ssl\n" @@ -4671,12 +5328,22 @@ msgid "" "\n" "urllib2.urlopen(\"https://invalid-cert\", context=context)" msgstr "" +"import urllib2\n" +"import ssl\n" +"\n" +"# すべての検証を無効にする\n" +"context = ssl._create_unverified_context()\n" +"\n" +"# 信頼ストアになくても、ホスト用の特定の証明書を\n" +"# 使用できるようにする\n" +"context = ssl.create_default_context(cafile=\"/path/to/file.crt\")\n" +"\n" +"urllib2.urlopen(\"https://invalid-cert\", context=context)" #: ../../whatsnew/2.7.rst:2738 msgid "PEP 493: HTTPS verification migration tools for Python 2.7" msgstr "PEP 493: HTTPS verification migration tools for Python 2.7" -#: ../../whatsnew/2.7.rst:2740 msgid "" ":pep:`493` provides additional migration tools to support a more incremental " "infrastructure upgrade process for environments containing applications and " @@ -4684,72 +5351,83 @@ msgid "" "certificates when establishing client HTTPS connections. These additions " "were made in the Python 2.7.12 release." msgstr "" +":pep:`493` は、クライアントの HTTPS 接続時にサーバー証明書を厳しく検証しな" +"かった従来の動作に依存するアプリケーションやサービスを含む環境で、インフラを" +"段階的に更新するための移行ツールを追加します。\n" +"これらは Python 2.7.12 で追加されました。" -#: ../../whatsnew/2.7.rst:2746 msgid "" "These tools are intended for use in cases where affected applications and " "services can't be modified to explicitly pass a more permissive SSL context " "when establishing the connection." msgstr "" +"これらのツールは、接続時により寛容な SSL コンテキストを明示的に渡すよう、対象" +"のアプリケーションやサービスを変更できない場合のためのものです。" -#: ../../whatsnew/2.7.rst:2750 msgid "" "For applications and services which can't be modified at all, the new " "``PYTHONHTTPSVERIFY`` environment variable may be set to ``0`` to revert an " "entire Python process back to the default permissive behaviour of Python " "2.7.8 and earlier." msgstr "" +"アプリケーションやサービスをまったく変更できない場合、新しい環境変数 " +"``PYTHONHTTPSVERIFY`` を ``0`` にすると、Python プロセス全体を Python 2.7.8 " +"以前の寛容なデフォルト動作に戻せます。" -#: ../../whatsnew/2.7.rst:2755 msgid "" "For cases where the connection establishment code can't be modified, but the " "overall application can be, the new :func:`!ssl._https_verify_certificates` " "function can be used to adjust the default behaviour at runtime." msgstr "" +"接続を確立するコードは変えられなくても、アプリケーション全体は変更できる場" +"合、新しい :func:`!ssl._https_verify_certificates` で実行時にデフォルトの動作" +"を調整できます。" -#: ../../whatsnew/2.7.rst:2761 msgid "New ``make regen-all`` build target" -msgstr "" +msgstr "新しいビルドターゲット ``make regen-all``" -#: ../../whatsnew/2.7.rst:2763 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " "available, the autotools-based build system no longer attempts to implicitly " "recompile generated files based on file modification times." msgstr "" +"クロスコンパイルを簡単にし、既存の Python がなくても CPython を確実にコンパイ" +"ルできるようにするため、autotools ベースのビルドシステムは、更新日時に基づい" +"て生成ファイルを暗黙に再コンパイルしなくなりました。" -#: ../../whatsnew/2.7.rst:2768 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" +"代わりに、必要なときにこれらのファイルを強制的に再生成する ``make regen-" +"all`` コマンドが追加されました (例えば、あらかじめ生成されたファイルを使って" +"最初の Python をビルドした後など)。" -#: ../../whatsnew/2.7.rst:2772 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" +"対象を絞った再生成用ターゲットも定義されています。\n" +"詳しくは :source:`Makefile.pre.in` を参照してください。" -#: ../../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" -msgstr "" +msgstr "ビルドターゲット ``make touch`` の削除" -#: ../../whatsnew/2.7.rst:2783 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" +"生成ファイルの更新日時を変更して暗黙の再生成を要求するために使われていた " +"``make touch`` ビルドターゲットが削除されました。" -#: ../../whatsnew/2.7.rst:2786 msgid "It has been replaced by the new ``make regen-all`` target." -msgstr "" +msgstr "代わりに新しい ``make regen-all`` ターゲットを使ってください。" #: ../../whatsnew/2.7.rst:2797 msgid "Acknowledgements" diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 3745df5fb..63b2ef3bf 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 @@ -114,7 +114,6 @@ msgstr "" "``print`` 文は :func:`print` 関数に置き換えられ、古い ``print`` 文の特殊な文" "法の殆どがキーワード引数で置き換えられています (:pep:`3105`)。 例::" -#: ../../whatsnew/3.0.rst:101 msgid "" "Old: print \"The answer is\", 2*2\n" "New: print(\"The answer is\", 2*2)\n" @@ -131,22 +130,34 @@ msgid "" "Old: print (x, y) # prints repr((x, y))\n" "New: print((x, y)) # Not the same as print(x, y)!" msgstr "" +"旧: print \"The answer is\", 2*2\n" +"新: print(\"The answer is\", 2*2)\n" +"\n" +"旧: print x, # 末尾のカンマで改行を抑制\n" +"新: print(x, end=\" \") # 改行の代わりにスペースを追加\n" +"\n" +"旧: print # 改行を出力\n" +"新: print() # 関数を呼び出す必要があります\n" +"\n" +"旧: print >>sys.stderr, \"fatal error\"\n" +"新: print(\"fatal error\", file=sys.stderr)\n" +"\n" +"旧: print (x, y) # repr((x, y)) を表示\n" +"新: print((x, y)) # print(x, y) とは異なります" #: ../../whatsnew/3.0.rst:116 msgid "You can also customize the separator between items, e.g.::" msgstr "項目間の区切りをカスタマイズすることもできます。例::" -#: ../../whatsnew/3.0.rst:118 msgid "print(\"There are <\", 2**32, \"> possibilities!\", sep=\"\")" -msgstr "" +msgstr "print(\"There are <\", 2**32, \"> possibilities!\", sep=\"\")" #: ../../whatsnew/3.0.rst:120 msgid "which produces:" msgstr "これは以下を出力します :" -#: ../../whatsnew/3.0.rst:122 msgid "There are <4294967296> possibilities!" -msgstr "" +msgstr "There are <4294967296> possibilities!" #: ../../whatsnew/3.0.rst:126 msgid "Note:" @@ -192,61 +203,65 @@ msgstr "いくつかの良く使われている API はもはやリストを返 #: ../../whatsnew/3.0.rst:147 msgid "" -":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict." -"values` return \"views\" instead of lists. For example, this no longer " -"works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` instead (this " -"works in Python 2.5 too and is just as efficient)." +":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` " +"and :meth:`dict.values` return \"views\" instead of lists. For example, " +"this no longer works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` " +"instead (this works in Python 2.5 too and is just as efficient)." msgstr "" -":class:`dict` の :meth:`dict.keys`, :meth:`dict.items` そして :meth:`dict." -"values` メソッドはリストの代わりに \"views\" を返します。 例えば: ``k = d." -"keys(); k.sort()`` は上手く動きません。 代わりに ``k = sorted(d)`` を使ってく" -"ださい (これは Python 2.5 でも動作し、効率的です)。" +":class:`dict` の :meth:`dict.keys`, :meth:`dict.items` そし" +"て :meth:`dict.values` メソッドはリストの代わりに \"views\" を返します。 例え" +"ば: ``k = d.keys(); k.sort()`` は上手く動きません。 代わりに ``k = " +"sorted(d)`` を使ってください (これは Python 2.5 でも動作し、効率的です)。" -#: ../../whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!dict." -"itervalues` methods are no longer supported." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!" +"dict.itervalues` methods are no longer supported." msgstr "" +":meth:`!dict.iterkeys`、 :meth:`!dict.iteritems`、 :meth:`!dict.itervalues` " +"メソッドはもうサポートされません。" #: ../../whatsnew/3.0.rst:156 msgid "" ":func:`map` and :func:`filter` return iterators. If you really need a list " -"and the input sequences are all of equal length, a quick fix is to wrap :" -"func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix is " -"often to use a list comprehension (especially when the original code uses :" -"keyword:`lambda`), or rewriting the code so it doesn't need a list at all. " -"Particularly tricky is :func:`map` invoked for the side effects of the " +"and the input sequences are all of equal length, a quick fix is to " +"wrap :func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix " +"is often to use a list comprehension (especially when the original code " +"uses :keyword:`lambda`), or rewriting the code so it doesn't need a list at " +"all. Particularly tricky is :func:`map` invoked for the side effects of the " "function; the correct transformation is to use a regular :keyword:`for` loop " "(since creating a list would just be wasteful)." msgstr "" ":func:`map` と :func:`filter` はイテレータを返します。もしも本物のリストが必" -"要で、全ての入力シーケンスが同じ長さの場合であれば、簡単に直すなら :func:" -"`map` を :func:`list` で包みます。例えば ``list(map(...))`` という具合。です" -"がより良いのは、大抵はリスト内包を使うことです (特に元々のコードが :keyword:" -"`lambda` を使っている場合)。あるいはコードを、リストを全く必要としないように" -"書き換えましょう。とりわけトリッキーなのは、関数に副作用を起こさせるために呼" -"び出される :func:`map` です; この場合確実な変換は普通に :keyword:`for` ループ" -"を使うことです (そもそもリストを作ること自体が無駄遣いでしょう)。" +"要で、全ての入力シーケンスが同じ長さの場合であれば、簡単に直すな" +"ら :func:`map` を :func:`list` で包みます。例えば ``list(map(...))`` という具" +"合。ですがより良いのは、大抵はリスト内包を使うことです (特に元々のコード" +"が :keyword:`lambda` を使っている場合)。あるいはコードを、リストを全く必要と" +"しないように書き換えましょう。とりわけトリッキーなのは、関数に副作用を起こさ" +"せるために呼び出される :func:`map` です; この場合確実な変換は普通" +"に :keyword:`for` ループを使うことです (そもそもリストを作ること自体が無駄遣" +"いでしょう)。" #: ../../whatsnew/3.0.rst:167 msgid "" "If the input sequences are not of equal length, :func:`map` will stop at the " -"termination of the shortest of the sequences. For full compatibility with :" -"func:`map` from Python 2.x, also wrap the sequences in :func:`itertools." -"zip_longest`, e.g. ``map(func, *sequences)`` becomes ``list(map(func, " -"itertools.zip_longest(*sequences)))``." +"termination of the shortest of the sequences. For full compatibility " +"with :func:`map` from Python 2.x, also wrap the sequences " +"in :func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes " +"``list(map(func, itertools.zip_longest(*sequences)))``." msgstr "" "入力シーケンスの長さが同じとは限らないならば、 :func:`map` は最も短いシーケン" "スが消費されつくすと処理をやめます。Python 2.x での :func:`map` 用法と全く互" "換にするにはシーケンスを :func:`itertools.zip_longest` で包んでください。例え" -"ば ``map(func, *sequences)`` を ``list(map(func, itertools." -"zip_longest(*sequences)))`` とします。" +"ば ``map(func, *sequences)`` を ``list(map(func, " +"itertools.zip_longest(*sequences)))`` とします。" -#: ../../whatsnew/3.0.rst:173 msgid "" ":func:`range` now behaves like :func:`!xrange` used to behave, except it " "works with values of arbitrary size. The latter no longer exists." msgstr "" +":func:`range` は、任意の大きさの値に対応する点を除き、以前の :func:`!xrange` " +"と同様に動作するようになりました。\n" +"xrange は削除されました。" #: ../../whatsnew/3.0.rst:177 msgid ":func:`zip` now returns an iterator." @@ -280,14 +295,16 @@ msgstr "" "子には適用されないことに注意してください: 別々の比較不可能な型のオブジェクト" "を比較すると常に、互いに等しくないと評価されます。" -#: ../../whatsnew/3.0.rst:195 msgid "" ":meth:`sorted` and :meth:`list.sort` no longer accept the *cmp* argument " "providing a comparison function. Use the *key* argument instead. N.B. the " "*key* and *reverse* arguments are now \"keyword-only\"." msgstr "" +":meth:`sorted` と :meth:`list.sort` は、比較関数を渡す *cmp* 引数を受け付けな" +"くなりました。\n" +"代わりに *key* 引数を使ってください。\n" +"なお、*key* と *reverse* はキーワード専用引数になりました。" -#: ../../whatsnew/3.0.rst:200 msgid "" "The :func:`!cmp` function should be treated as gone, and the :meth:`!" "__cmp__` special method is no longer supported. Use :meth:`~object.__lt__` " @@ -296,17 +313,26 @@ msgid "" "functionality, you could use the expression ``(a > b) - (a < b)`` as the " "equivalent for ``cmp(a, b)``.)" msgstr "" +":func:`!cmp` 関数はなくなったものとして扱うべきで、特殊メソッド :meth:`!" +"__cmp__` もサポートされなくなりました。\n" +"ソートには :meth:`~object.__lt__`、:meth:`~object.__hash__` とともに使う比較" +"には :meth:`~object.__eq__` を使い、必要に応じて他の豊富な比較演算を使ってく" +"ださい。\n" +"(:func:`!cmp` の機能がどうしても必要なら、``cmp(a, b)`` と同等の式 ``(a > b) " +"- (a < b)`` を使えます。)" #: ../../whatsnew/3.0.rst:207 msgid "Integers" msgstr "整数" -#: ../../whatsnew/3.0.rst:209 msgid "" ":pep:`237`: Essentially, :class:`!long` renamed to :class:`int`. That is, " "there is only one built-in integral type, named :class:`int`; but it behaves " "mostly like the old :class:`!long` type." msgstr "" +":pep:`237`: 基本的には、 :class:`!long` は :class:`int` に改名されました。\n" +"これは、整数型の唯一の組み込み型になり、 :class:`int` と名付けられています" +"が、古い :class:`!long` 型とほぼ同じように振る舞います。" #: ../../whatsnew/3.0.rst:213 msgid "" @@ -318,15 +344,20 @@ msgstr "" " ``1//2`` を使ってください。 (後者の構文は少なくとも Python 2.2 からありま" "す。)" -#: ../../whatsnew/3.0.rst:217 msgid "" "The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " -"the implementation's \"natural\" integer size and is typically the same as :" -"data:`!sys.maxint` in previous releases on the same platform (assuming the " -"same build options)." +"the implementation's \"natural\" integer size and is typically the same " +"as :data:`!sys.maxint` in previous releases on the same platform (assuming " +"the same build options)." msgstr "" +"整数の上限がなくなったため、:data:`!sys.maxint` 定数は削除されました。\n" +"しかしながら、通常のリストや文字列の添え字よりも大きい整数とし" +"て :data:`sys.maxsize` を使うことができます。\n" +"``sys.maxsize`` は実装の \"自然な\" 整数の大きさに一致し、同じプラットフォー" +"ムでは (同じビルドオプションなら) 過去のリリースの :data:`!sys.maxint` と普通" +"は同じです。" #: ../../whatsnew/3.0.rst:224 msgid "" @@ -358,14 +389,14 @@ msgstr "バイナリと Unicode について知っていると思っている全 msgid "" "Python 3.0 uses the concepts of *text* and (binary) *data* instead of " "Unicode strings and 8-bit strings. All text is Unicode; however *encoded* " -"Unicode is represented as binary data. The type used to hold text is :class:" -"`str`, the type used to hold data is :class:`bytes`. The biggest difference " -"with the 2.x situation is that any attempt to mix text and data in Python " -"3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode and 8-bit " -"strings in Python 2.x, it would work if the 8-bit string happened to contain " -"only 7-bit (ASCII) bytes, but you would get :exc:`UnicodeDecodeError` if it " -"contained non-ASCII values. This value-specific behavior has caused " -"numerous sad faces over the years." +"Unicode is represented as binary data. The type used to hold text " +"is :class:`str`, the type used to hold data is :class:`bytes`. The biggest " +"difference with the 2.x situation is that any attempt to mix text and data " +"in Python 3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode " +"and 8-bit strings in Python 2.x, it would work if the 8-bit string happened " +"to contain only 7-bit (ASCII) bytes, but you would " +"get :exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-" +"specific behavior has caused numerous sad faces over the years." msgstr "" "Python 3.0 でのコンセプトは、Unicode 文字列と 8 ビット文字列、という対比では" "なくて、 *テキスト* と (バイナリ) *データ* の違いと考える、というものです。全" @@ -378,16 +409,23 @@ msgstr "" "ば :exc:`UnicodeDecodeError` となっていたでしょう。この、データ値に依存した振" "る舞いが、何年にも渡って夥しい数の悲劇を生み出していました。" -#: ../../whatsnew/3.0.rst:250 msgid "" "As a consequence of this change in philosophy, pretty much all code that " "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`!unicode` for all unencoded text, and :class:" -"`str` for binary or encoded data only. Then the ``2to3`` tool will do most " -"of the work for you." -msgstr "" +"Python 2.x, start using :class:`!unicode` for all unencoded text, " +"and :class:`str` for binary or encoded data only. Then the ``2to3`` tool " +"will do most of the work for you." +msgstr "" +"この方針の変更に伴い、Unicode、エンコーディング、バイナリデータを使うほとんど" +"すべてのコードは変更が必要になるでしょう。\n" +"2.x ではエンコード済みと未エンコードのテキストを混在させることによるバグが多" +"数あったため、これは改善のための変更です。\n" +"Python 2.x で準備するには、未エンコードのテキストにはすべて :class:`!" +"unicode` を使い、:class:`str` はバイナリデータやエンコード済みデータだけに" +"使ってください。\n" +"そうすれば ``2to3`` ツールが大部分の作業を処理してくれます。" #: ../../whatsnew/3.0.rst:258 msgid "" @@ -401,25 +439,31 @@ msgstr "" #: ../../whatsnew/3.0.rst:261 msgid "" "As the :class:`str` and :class:`bytes` types cannot be mixed, you must " -"always explicitly convert between them. Use :meth:`str.encode` to go from :" -"class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go from :class:" -"`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)`` and " -"``str(b, encoding=...)``, respectively." +"always explicitly convert between them. Use :meth:`str.encode` to go " +"from :class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go " +"from :class:`bytes` to :class:`str`. You can also use ``bytes(s, " +"encoding=...)`` and ``str(b, encoding=...)``, respectively." msgstr "" ":class:`str` 型と :class:`bytes` 型を混ぜて使うことは出来ませんから、それらは" "いつでも明示的に変換しなければいけません。 :class:`str` から :class:`bytes` " -"にするには :meth:`str.encode` を使ってください。そして :class:`bytes` から :" -"class:`str` にするには :meth:`bytes.decode` を使います。それぞれ ``bytes(s, " -"encoding=...)`` 、 ``str(b, encoding=...)`` を使うことも出来ます。" +"にするには :meth:`str.encode` を使ってください。そして :class:`bytes` か" +"ら :class:`str` にするには :meth:`bytes.decode` を使います。それぞれ " +"``bytes(s, encoding=...)`` 、 ``str(b, encoding=...)`` を使うことも出来ます。" -#: ../../whatsnew/3.0.rst:268 msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence `." +"The mutable API is based on :class:`collections.MutableSequence " +"`." msgstr "" +":class:`str` と同様、:class:`bytes` 型はイミュータブルです。\n" +"バッファーされたバイナリデータを保持するために、別の *ミュータブルな* " +"型 :class:`bytearray` があります。\n" +":class:`bytes` を受け付ける API のほとんどは :class:`bytearray` も受け付けま" +"す。\n" +"ミュータブルな API は :class:`collections.MutableSequence " +"` に基づいています。" #: ../../whatsnew/3.0.rst:274 msgid "" @@ -437,14 +481,19 @@ msgstr "" "(無論この変更は raw 文字列リテラルについてだけのもので、ユーロ文字は Python " "3.0 で ``'\\u20ac'`` です。)" -#: ../../whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`!basestring` abstract type was removed. Use :class:" -"`str` instead. The :class:`str` and :class:`bytes` types don't have " -"functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`!basestring` with :" -"class:`str`." +"The built-in :class:`!basestring` abstract type was removed. " +"Use :class:`str` instead. The :class:`str` and :class:`bytes` types don't " +"have functionality enough in common to warrant a shared base class. The " +"``2to3`` tool (see below) replaces every occurrence of :class:`!basestring` " +"with :class:`str`." msgstr "" +"組み込みの抽象型 :class:`!basestring` は削除されました。\n" +"代わりに :class:`str` を使ってください。\n" +":class:`str` と :class:`bytes` には、共通の基底クラスを設けるほど共通の機能が" +"ありません。\n" +"``2to3`` ツール (後述) は、すべての :class:`!basestring` を :class:`str` に置" +"き換えます。" #: ../../whatsnew/3.0.rst:287 msgid "" @@ -482,15 +531,15 @@ msgstr "" #: ../../whatsnew/3.0.rst:304 msgid "" -"The initial values of :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." -"stderr` are now unicode-only text files (i.e., they are instances of :class:" -"`io.TextIOBase`). To read and write bytes data with these streams, you need " -"to use their :data:`io.TextIOBase.buffer` attribute." +"The initial values of :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr` are now unicode-only text files (i.e., they are " +"instances of :class:`io.TextIOBase`). To read and write bytes data with " +"these streams, you need to use their :data:`io.TextIOBase.buffer` attribute." msgstr "" ":data:`sys.stdin`, :data:`sys.stdout`, :data:`sys.stderr` の初期値はいまでは " "Unicode のみのテキストファイルです (つまりそれらは :class:`io.TextIOBase` の" -"インスタンスです)。バイト列データをそれらのストリームで読み書きするには、 :" -"data:`io.TextIOBase.buffer` 属性を使う必要があります。" +"インスタンスです)。バイト列データをそれらのストリームで読み書きするに" +"は、 :data:`io.TextIOBase.buffer` 属性を使う必要があります。" #: ../../whatsnew/3.0.rst:310 msgid "" @@ -498,14 +547,14 @@ msgid "" "can present platform-specific problems because on some platforms filenames " "are arbitrary byte strings. (On the other hand, on Windows filenames are " "natively stored as Unicode.) As a work-around, most APIs (e.g. :func:`open` " -"and many functions in the :mod:`os` module) that take filenames accept :" -"class:`bytes` objects as well as strings, and a few APIs have a way to ask " -"for a :class:`bytes` return value. Thus, :func:`os.listdir` returns a list " -"of :class:`bytes` instances if the argument is a :class:`bytes` instance, " -"and :func:`os.getcwdb` returns the current working directory as a :class:" -"`bytes` instance. Note that when :func:`os.listdir` returns a list of " -"strings, filenames that cannot be decoded properly are omitted rather than " -"raising :exc:`UnicodeError`." +"and many functions in the :mod:`os` module) that take filenames " +"accept :class:`bytes` objects as well as strings, and a few APIs have a way " +"to ask for a :class:`bytes` return value. Thus, :func:`os.listdir` returns " +"a list of :class:`bytes` instances if the argument is a :class:`bytes` " +"instance, and :func:`os.getcwdb` returns the current working directory as " +"a :class:`bytes` instance. Note that when :func:`os.listdir` returns a list " +"of strings, filenames that cannot be decoded properly are omitted rather " +"than raising :exc:`UnicodeError`." msgstr "" "ファイル名は、API へは (Unicode) 文字列を渡し、 (Unicode) 文字列が返ります。" "これにはプラットフォーム特有の問題があるかもしれません。というのも、いくつか" @@ -514,11 +563,11 @@ msgstr "" "て、ほとんどの API (たとえば :func:`open` と :mod:`os` モジュール内の多くの関" "数) はファイル名として、文字列だけでなく :class:`bytes` を受け付け、そして少" "しの API は :class:`bytes` を返すかどうかを要求出来る手段を持っています。それ" -"ゆえに :func:`os.listdir` は引数が :class:`bytes` インスタンスであれば :" -"class:`bytes` のリストで返し、 :func:`os.getcwdb` はカレントディレクトリを :" -"class:`bytes` で返します。 :func:`os.listdir` が文字列のリストで返す際、適切" -"にデコード出来ないファイル名は :exc:`UnicodeError` とはせずに無視されることに" -"ご注意ください。" +"ゆえに :func:`os.listdir` は引数が :class:`bytes` インスタンスであれ" +"ば :class:`bytes` のリストで返し、 :func:`os.getcwdb` はカレントディレクトリ" +"を :class:`bytes` で返します。 :func:`os.listdir` が文字列のリストで返す際、" +"適切にデコード出来ないファイル名は :exc:`UnicodeError` とはせずに無視されるこ" +"とにご注意ください。" #: ../../whatsnew/3.0.rst:325 msgid "" @@ -559,12 +608,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:340 msgid "" "The :mod:`!StringIO` and :mod:`!cStringIO` modules are gone. Instead, " -"import the :mod:`io` module and use :class:`io.StringIO` or :class:`io." -"BytesIO` for text and data respectively." +"import the :mod:`io` module and use :class:`io.StringIO` " +"or :class:`io.BytesIO` for text and data respectively." msgstr "" ":mod:`!StringIO` および :mod:`!cStringIO` モジュールは廃止されました。その代" -"わり :mod:`io` モジュールをインポートして、テキストやデータには :class:`io." -"StringIO` や :class:`io.BytesIO` を使用してください。" +"わり :mod:`io` モジュールをインポートして、テキストやデータに" +"は :class:`io.StringIO` や :class:`io.BytesIO` を使用してください。" #: ../../whatsnew/3.0.rst:344 msgid "See also the :ref:`unicode-howto`, which was updated for Python 3.0." @@ -587,7 +636,6 @@ msgstr "" msgid "New Syntax" msgstr "新たな構文" -#: ../../whatsnew/3.0.rst:356 msgid "" ":pep:`3107`: Function argument and return value annotations. This provides " "a standardized way of annotating a function's parameters and return value. " @@ -596,6 +644,12 @@ msgid "" "attribute. The intent is to encourage experimentation through metaclasses, " "decorators or frameworks." msgstr "" +":pep:`3107`: 関数の引数と戻り値のアノテーション。\n" +"関数のパラメータと戻り値に注釈を付ける標準的な方法を提供します。\n" +"アノテーションは実行時に :attr:`~object.__annotations__` 属性で調べられること" +"以外に、特定の意味を持ちません。\n" +"メタクラス、デコレーター、フレームワークを通じた実験を促すことを意図していま" +"す。" #: ../../whatsnew/3.0.rst:363 msgid "" @@ -630,8 +684,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:374 msgid "" ":pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can " -"now assign directly to a variable in an outer (but non-global) scope. :" -"keyword:`!nonlocal` is a new reserved word." +"now assign directly to a variable in an outer (but non-global) " +"scope. :keyword:`!nonlocal` is a new reserved word." msgstr "" ":pep:`3104`: :keyword:`nonlocal` 文。 ``nonlocal x`` を使うと外側の (ただしグ" "ローバルでない) スコープから、直接変数を代入することが出来るようになりま" @@ -649,9 +703,8 @@ msgstr "" "も出来ます。 ``rest`` オブジェクトは常に (空かもしれなくても) リストです; 右" "辺には任意のイテラブルを置けます。例えば::" -#: ../../whatsnew/3.0.rst:383 msgid "(a, *rest, b) = range(5)" -msgstr "" +msgstr "(a, *rest, b) = range(5)" #: ../../whatsnew/3.0.rst:385 msgid "This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``." @@ -700,8 +753,8 @@ msgid "" "Bytes literals are introduced with a leading ``b`` or ``B``, and there is a " "new corresponding built-in function, :func:`bytes`." msgstr "" -"``b`` または ``B`` で始まるバイトリテラルと、関連する新しい組み込み関数 :" -"func:`bytes` が導入されました。" +"``b`` または ``B`` で始まるバイトリテラルと、関連する新しい組み込み関" +"数 :func:`bytes` が導入されました。" #: ../../whatsnew/3.0.rst:406 msgid "Changed Syntax" @@ -709,11 +762,11 @@ msgstr "変更された構文" #: ../../whatsnew/3.0.rst:408 msgid "" -":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement syntax: :samp:" -"`raise [{expr} [from {expr}]]`. See below." +":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement " +"syntax: :samp:`raise [{expr} [from {expr}]]`. See below." msgstr "" -":pep:`3109` と :pep:`3134`: 新たな :keyword:`raise` 文のシンタックス: :samp:" -"`raise [{expr} [from {expr}]]`。以下を参照してください。" +":pep:`3109` と :pep:`3134`: 新たな :keyword:`raise` 文のシンタック" +"ス: :samp:`raise [{expr} [from {expr}]]`。以下を参照してください。" #: ../../whatsnew/3.0.rst:411 msgid "" @@ -730,39 +783,47 @@ msgstr "" "``True``、``False``、および ``None`` が予約語になりました。(2.6 では既に " "``None`` が部分的に制限されていました)" -#: ../../whatsnew/3.0.rst:417 msgid "" -"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` *exc* :" -"keyword:`!as` *var*. See :pep:`3110`." +"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` " +"*exc* :keyword:`!as` *var*. See :pep:`3110`." msgstr "" +":keyword:`except` *exc*, *var* から :keyword:`!except` *exc* :keyword:`!as` " +"*var* に変更されました。\n" +":pep:`3110` を参照してください。" #: ../../whatsnew/3.0.rst:420 msgid ":pep:`3115`: New Metaclass Syntax. Instead of::" msgstr ":pep:`3115`: 新たなメタクラスのシンタックス.以下の;" -#: ../../whatsnew/3.0.rst:422 msgid "" "class C:\n" " __metaclass__ = M\n" " ..." msgstr "" +"class C:\n" +" __metaclass__ = M\n" +" ..." #: ../../whatsnew/3.0.rst:426 msgid "you must now use::" msgstr "代わりに次のようにしてください:" -#: ../../whatsnew/3.0.rst:428 msgid "" "class C(metaclass=M):\n" " ..." msgstr "" +"class C(metaclass=M):\n" +" ..." -#: ../../whatsnew/3.0.rst:431 msgid "" "The module-global :data:`!__metaclass__` variable is no longer supported. " "(It was a crutch to make it easier to default to new-style classes without " "deriving every class from :class:`object`.)" msgstr "" +"モジュールのグローバル変数 :data:`!__metaclass__` はサポートされなくなりまし" +"た。\n" +"(これは、すべてのクラスを :class:`object` から派生させなくても、デフォルトで" +"新スタイルクラスにするための補助手段でした。)" #: ../../whatsnew/3.0.rst:436 msgid "" @@ -883,9 +944,9 @@ msgid "" "and no longer needs to be imported from the :mod:`__future__`. Also check " "out :ref:`new-26-context-managers` and :ref:`new-module-contextlib`." msgstr "" -":ref:`pep-0343`. :keyword:`with` 文は今では標準機能となったので、 :mod:" -"`__future__` からインポートする必要はもうありません。 :ref:`new-26-context-" -"managers` と :ref:`new-module-contextlib` も見てください。" +":ref:`pep-0343`. :keyword:`with` 文は今では標準機能となったの" +"で、 :mod:`__future__` からインポートする必要はもうありません。 :ref:`new-26-" +"context-managers` と :ref:`new-module-contextlib` も見てください。" #: ../../whatsnew/3.0.rst:493 msgid "" @@ -907,9 +968,10 @@ msgstr ":ref:`pep-0371`." msgid "" ":ref:`pep-3101`. Note: the 2.6 description mentions the :meth:`format` " "method for both 8-bit and Unicode strings. In 3.0, only the :class:`str` " -"type (text strings with Unicode support) supports this method; the :class:" -"`bytes` type does not. The plan is to eventually make this the only API for " -"string formatting, and to start deprecating the ``%`` operator in Python 3.1." +"type (text strings with Unicode support) supports this method; " +"the :class:`bytes` type does not. The plan is to eventually make this the " +"only API for string formatting, and to start deprecating the ``%`` operator " +"in Python 3.1." msgstr "" ":ref:`pep-3101`. 注意: 2.6 の記述では :meth:`format` メソッドが 8 ビット文字" "列と Unicode 文字列両方について述べていますが、3.0 では :class:`str` 型 " @@ -929,12 +991,15 @@ msgstr "" "ンポートする必要はありません。詳細はこのドキュメントの上の方に書いてありま" "す。" -#: ../../whatsnew/3.0.rst:510 msgid "" ":ref:`pep-3110`. The :keyword:`except` *exc* :keyword:`!as` *var* syntax is " "now standard and :keyword:`!except` *exc*, *var* is no longer supported. " "(Of course, the :keyword:`!as` *var* part is still optional.)" msgstr "" +":ref:`pep-3110`. :keyword:`except` *exc* :keyword:`!as` *var* 構文が標準と" +"なり、 :keyword:`!except` *exc*, *var* はもうサポートされません。\n" +"(もちろん :keyword:`!as` *var* 部分は今でも省略可能です。\n" +")" #: ../../whatsnew/3.0.rst:515 msgid "" @@ -945,33 +1010,50 @@ msgstr "" ":ref:`pep-3112`. 文字列リテラル ``b\"...\"`` 表記 (とそのお仲間 ``b'...'``, " "``b\"\"\"...\"\"\"``, ``br\"...\"`` など) は今では :class:`bytes` 型です。" -#: ../../whatsnew/3.0.rst:519 msgid "" ":ref:`pep-3116`. The :mod:`io` module is now the standard way of doing file " "I/O. The built-in :func:`open` function is now an alias for :func:`io.open` " "and has additional keyword arguments *encoding*, *errors*, *newline* and " -"*closefd*. Also note that an invalid *mode* argument now raises :exc:" -"`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`!f.buffer` (but beware that the text " -"object maintains a buffer of itself in order to speed up the encoding and " -"decoding operations)." -msgstr "" +"*closefd*. Also note that an invalid *mode* argument now " +"raises :exc:`ValueError`, not :exc:`IOError`. The binary file object " +"underlying a text file object can be accessed as :attr:`!f.buffer` (but " +"beware that the text object maintains a buffer of itself in order to speed " +"up the encoding and decoding operations)." +msgstr "" +":ref:`pep-3116`. :mod:`io` モジュールが今ではファイル I/O の標準手段です。\n" +"組み込みの :func:`open` は今では :func:`io.open` へのエイリアスであり、また、" +"追加のキーワード引数 *encoding*, *errors*, *newline*, *closefd* を持ちま" +"す。\n" +"不正な *mode* 引数で :exc:`IOError` ではなく :exc:`ValueError` を投げるように" +"なったことにも注意してください。\n" +"テキストファイルオブジェクトの背後にあるバイナリファイルオブジェクトに" +"は、 :attr:`!f.buffer` でアクセスできます。\n" +"(ただしエンコーディング・デコーディング操作の高速化のために、テキストオブジェ" +"クトは自身のバッファを保守管理していることに注意してください。\n" +")" -#: ../../whatsnew/3.0.rst:529 msgid "" ":ref:`pep-3118`. The old builtin :func:`!buffer` is now really gone; the " "new builtin :func:`memoryview` provides (mostly) similar functionality." msgstr "" +":ref:`pep-3118`. 古いビルトインの :func:`!buffer` は本当になくなりました; 新" +"しいビルトイン :func:`memoryview` が (ほぼ) 同様の機能性を提供します。" -#: ../../whatsnew/3.0.rst:533 msgid "" -":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" -"`collections` module plays a somewhat more prominent role in the language " -"now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping ` and :class:`collections.MutableSequence ` ABCs, respectively." +":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in " +"the :mod:`collections` module plays a somewhat more prominent role in the " +"language now, and built-in collection types like :class:`dict` " +"and :class:`list` conform to the :class:`collections.MutableMapping " +"` and :class:`collections.MutableSequence " +"` ABCs, respectively." msgstr "" +":ref:`pep-3119`。\n" +":mod:`abc` モジュールと :mod:`collections` モジュールで定義される ABC が、言" +"語の中で以前より重要な役割を担うようになりました。\n" +":class:`dict` や :class:`list` などの組み込みコレクション型は、それぞ" +"れ :class:`collections.MutableMapping ` " +"と :class:`collections.MutableSequence ` の " +"ABC に従います。" #: ../../whatsnew/3.0.rst:539 msgid "" @@ -1029,14 +1111,18 @@ msgstr "" "で削除されました\n" "網羅的なリストは :pep:`3108` を参照してください。" -#: ../../whatsnew/3.0.rst:566 msgid "" "The :mod:`!bsddb3` package was removed because its presence in the core " "standard library has proved over time to be a particular burden for the core " "developers due to testing instability and Berkeley DB's release schedule. " -"However, the package is alive and well, externally maintained at https://www." -"jcea.es/programacion/pybsddb.htm." +"However, the package is alive and well, externally maintained at https://" +"www.jcea.es/programacion/pybsddb.htm." msgstr "" +":mod:`!bsddb3` パッケージは削除されました。\n" +"テストの不安定さと Berkeley DB のリリース日程のため、コアの標準ライブラリに含" +"めることがコア開発者の大きな負担になると、次第に明らかになったためです。\n" +"ただし、このパッケージは引き続き https://www.jcea.es/programacion/" +"pybsddb.htm で外部のプロジェクトとして保守されています。" #: ../../whatsnew/3.0.rst:572 msgid "" @@ -1118,7 +1204,6 @@ msgstr "test.test_support" msgid "test.support" msgstr "test.support" -#: ../../whatsnew/3.0.rst:588 msgid "" "A common pattern in Python 2.x is to have one version of a module " "implemented in pure Python, with an optional accelerated version implemented " @@ -1132,6 +1217,20 @@ msgid "" "The :mod:`profile` module is on the list for 3.1. The :mod:`!StringIO` " "module has been turned into a class in the :mod:`io` module." msgstr "" +"Python 2.x でのよくあるパターンは、ピュア Python で実装した版とともに、オプ" +"ショナルで、C 拡張として実装した「加速装置付き (accelerated)」版を持つ、とい" +"うものです。\n" +"例えば :mod:`pickle` と :mod:`!cPickle` がそうです。\n" +"それらモジュールの個々のユーザにとって、accelerated 版をインポートしてみてダ" +"メならピュア Python 版を使う、というのも重荷となるものです。\n" +"Python 3.0 では、 accelerated 版はピュア Python 版の実装の詳細と考えます。\n" +"ユーザは常に標準バージョンをインポートすべきです。\n" +"これ自身が accelerated 版のインポートを試みてダメならピュア Python 版を使うよ" +"うになっています。\n" +":mod:`pickle` / :mod:`!cPickle` のペアがこの対象になりました。\n" +":mod:`profile` モジュールは 3.1 でこれが予定されています。\n" +":mod:`!StringIO` モジュールは :mod:`io` モジュール内のクラスに変更されまし" +"た。" #: ../../whatsnew/3.0.rst:602 msgid "" @@ -1141,93 +1240,115 @@ msgstr "" "関連のあるモジュールのいくつかはパッケージにまとめられ、ふつうサブモジュール" "名は単純化されました。結果として以下のようなパッケージが出来ました:" -#: ../../whatsnew/3.0.rst:606 msgid "" -":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!dumbdbm`, :" -"mod:`!gdbm`, :mod:`!whichdb`)." +":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!" +"dumbdbm`, :mod:`!gdbm`, :mod:`!whichdb`)." msgstr "" +":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!" +"dumbdbm`, :mod:`!gdbm`, :mod:`!whichdb`)." -#: ../../whatsnew/3.0.rst:609 msgid ":mod:`html` (:mod:`!HTMLParser`, :mod:`!htmlentitydefs`)." -msgstr "" +msgstr ":mod:`html` (:mod:`!HTMLParser`, :mod:`!htmlentitydefs`)." -#: ../../whatsnew/3.0.rst:611 msgid "" ":mod:`http` (:mod:`!httplib`, :mod:`!BaseHTTPServer`, :mod:`!" "CGIHTTPServer`, :mod:`!SimpleHTTPServer`, :mod:`!Cookie`, :mod:`!cookielib`)." msgstr "" +":mod:`http` (:mod:`!httplib`, :mod:`!BaseHTTPServer`, :mod:`!" +"CGIHTTPServer`, :mod:`!SimpleHTTPServer`, :mod:`!Cookie`, :mod:`!cookielib`)." -#: ../../whatsnew/3.0.rst:615 msgid "" ":mod:`tkinter` (all ``Tkinter``-related modules except :mod:`turtle`). The " "target audience of :mod:`turtle` doesn't really care about :mod:`tkinter`. " "Also note that as of Python 2.6, the functionality of :mod:`turtle` has been " "greatly enhanced." msgstr "" +":mod:`tkinter` (:mod:`turtle` を除くすべての ``Tkinter`` 関連モジュール)。\n" +":mod:`turtle` の想定利用者は :mod:`tkinter` を特に意識しません。\n" +"また、Python 2.6 で :mod:`turtle` の機能が大幅に強化された点にも注意してくだ" +"さい。" -#: ../../whatsnew/3.0.rst:620 msgid "" ":mod:`urllib` (:mod:`!urllib`, :mod:`!urllib2`, :mod:`!urlparse`, :mod:`!" "robotparse`)." msgstr "" +":mod:`urllib` (:mod:`!urllib`, :mod:`!urllib2`, :mod:`!urlparse`, :mod:`!" +"robotparse`)." -#: ../../whatsnew/3.0.rst:623 msgid "" ":mod:`xmlrpc` (:mod:`!xmlrpclib`, :mod:`!DocXMLRPCServer`, :mod:`!" "SimpleXMLRPCServer`)." msgstr "" +":mod:`xmlrpc` (:mod:`!xmlrpclib`, :mod:`!DocXMLRPCServer`, :mod:`!" +"SimpleXMLRPCServer`)." #: ../../whatsnew/3.0.rst:626 msgid "" "Some other changes to standard library modules, not covered by :pep:`3108`:" msgstr ":pep:`3108` で取り上げられていない標準ライブラリーの他の変更:" -#: ../../whatsnew/3.0.rst:629 msgid "Killed :mod:`!sets`. Use the built-in :func:`set` class." msgstr "" +":mod:`!sets` は廃止されました。\n" +"組み込みの :func:`set` クラスを使用してください。" -#: ../../whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!sys." -"exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!sys." -"exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!" +"sys.exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!" +"sys.exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" +":mod:`sys` モジュールの整理: :func:`!sys.exitfunc`, :func:`!" +"sys.exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!" +"sys.exc_traceback` は削除されました。\n" +"(:data:`sys.last_type` 等はまだあります。\n" +")" -#: ../../whatsnew/3.0.rst:636 msgid "" "Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" -"write` methods are gone; use :meth:`~array.array.fromfile` and :meth:`~array." -"array.tofile` instead. Also, the ``'c'`` typecode for array is gone -- use " -"either ``'b'`` for bytes or ``'u'`` for Unicode characters." +"write` methods are gone; use :meth:`~array.array.fromfile` " +"and :meth:`~array.array.tofile` instead. Also, the ``'c'`` typecode for " +"array is gone -- use either ``'b'`` for bytes or ``'u'`` for Unicode " +"characters." msgstr "" +":class:`array.array` 型の整理: :meth:`!read` と :meth:`!write` は削除されまし" +"た。\n" +"代わりに :meth:`~array.array.fromfile` と :meth:`~array.array.tofile` を使っ" +"てください。\n" +"また、配列の型コード ``'c'`` は削除されました。\n" +"バイトには ``'b'``、Unicode 文字には ``'u'`` を使ってください。" -#: ../../whatsnew/3.0.rst:642 msgid "" "Cleanup of the :mod:`operator` module: removed :func:`!sequenceIncludes` " "and :func:`!isCallable`." msgstr "" +":mod:`operator` モジュールの整理: :func:`!sequenceIncludes` および :func:`!" +"isCallable` は削除されました。" -#: ../../whatsnew/3.0.rst:645 msgid "" "Cleanup of the :mod:`!thread` module: :func:`!acquire_lock` and :func:`!" -"release_lock` are gone; use :meth:`~threading.Lock.acquire` and :meth:" -"`~threading.Lock.release` instead." +"release_lock` are gone; use :meth:`~threading.Lock.acquire` " +"and :meth:`~threading.Lock.release` instead." msgstr "" +":mod:`!thread` モジュールの整理: :func:`!acquire_lock` と :func:`!" +"release_lock` は削除されました。\n" +"代わりに :meth:`~threading.Lock.acquire` と :meth:`~threading.Lock.release` " +"を使ってください。" -#: ../../whatsnew/3.0.rst:649 msgid "" "Cleanup of the :mod:`random` module: removed the :func:`!jumpahead` API." msgstr "" +":mod:`random` モジュールの整理: :func:`!jumpahead` API は削除されました。" -#: ../../whatsnew/3.0.rst:651 msgid "The :mod:`!new` module is gone." -msgstr "" +msgstr ":mod:`!new` モジュールは廃止されました。" -#: ../../whatsnew/3.0.rst:653 msgid "" -"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!os." -"tmpfile` have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!" +"os.tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" +":func:`!os.tmpnam`、:func:`!os.tempnam`、:func:`!os.tmpfile` は削除されまし" +"た。\n" +"代わりに :mod:`tempfile` モジュールを使ってください。" #: ../../whatsnew/3.0.rst:657 msgid "" @@ -1238,22 +1359,32 @@ msgstr "" "エントリポイントは generate_tokens から :func:`tokenize.tokenize` になりまし" "た。" -#: ../../whatsnew/3.0.rst:661 msgid "" -":data:`!string.letters` and its friends (:data:`!string.lowercase` and :data:" -"`!string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`!string.letters` and " -"friends had locale-specific behavior, which is a bad idea for such " +":data:`!string.letters` and its friends (:data:`!string.lowercase` " +"and :data:`!string.uppercase`) are gone. Use :data:`string.ascii_letters` " +"etc. instead. (The reason for the removal is that :data:`!string.letters` " +"and friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" +":data:`!string.letters` と関連する定数 (:data:`!string.lowercase` と :data:`!" +"string.uppercase`) は削除されました。\n" +"代わりに :data:`string.ascii_letters` などを使ってください。\n" +"(削除した理由は、:data:`!string.letters` などの動作がロケールに依存していたた" +"めです。\n" +"このように使いたくなる名前のグローバルな「定数」がロケール依存であるのは望ま" +"しくありません。)" -#: ../../whatsnew/3.0.rst:668 msgid "" "Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " "underscores, adding an 's'). The :data:`!__builtins__` variable found in " -"most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`!__builtins__`!" +"most global namespaces is unchanged. To modify a builtin, you should " +"use :mod:`builtins`, not :data:`!__builtins__`!" msgstr "" +"モジュール :mod:`!__builtin__` が :mod:`builtins` にリネームされました (アン" +"ダースコアの削除と 's' の追加)。\n" +"大半の大域名前空間における :data:`!__builtins__` 変数は変更されていません。\n" +"組み込みを変更するには :data:`!__builtins__` でなく :mod:`builtins` を使わな" +"ければなりません。" #: ../../whatsnew/3.0.rst:675 msgid ":pep:`3101`: A New Approach To String Formatting" @@ -1269,7 +1400,7 @@ msgstr "" "組み込みの新しい文字列書式化操作で、文字列の ``%`` 演算子を置き換えるもので" "す。(しかしながら ``%`` 演算子はまだサポートされます; Python 3.1 で非推奨とな" "り、将来のいつかの時点で削除されます。) 完全な詳細は :pep:`3101` をお読み下さ" -"い。 (--- 訳注: `Python 2.6 で既にあった変更`_ での対応する記述に書いた訳注を" +"い。 (--- 訳注: 「Python 2.6 で既にあった変更」での対応する記述に書いた訳注を" "参照。---)" #: ../../whatsnew/3.0.rst:685 @@ -1284,47 +1415,47 @@ msgstr "例外の送出や捕捉を行う API は整理され、 強力な新機 #: ../../whatsnew/3.0.rst:690 msgid "" -":pep:`352`: All exceptions must be derived (directly or indirectly) from :" -"exc:`BaseException`. This is the root of the exception hierarchy. This is " -"not new as a recommendation, but the *requirement* to inherit from :exc:" -"`BaseException` is new. (Python 2.6 still allowed classic classes to be " -"raised, and placed no restriction on what you can catch.) As a consequence, " -"string exceptions are finally truly and utterly dead." +":pep:`352`: All exceptions must be derived (directly or indirectly) " +"from :exc:`BaseException`. This is the root of the exception hierarchy. " +"This is not new as a recommendation, but the *requirement* to inherit " +"from :exc:`BaseException` is new. (Python 2.6 still allowed classic classes " +"to be raised, and placed no restriction on what you can catch.) As a " +"consequence, string exceptions are finally truly and utterly dead." msgstr "" ":pep:`352`: 全ての例外は (直接的にまたは間接的に) :exc:`BaseException` を継承" "しなければなりません。\n" ":exc:`BaseException` は例外階層の根です。\n" -"これは勧告としては新しくありませんが、:exc:`BaseException` 継承の *要求* は新" -"しいです。\n" +"これは勧告としては新しくありませんが、 ``BaseException`` 継承の *要求* は新し" +"いです。\n" "(Python 2.6 は依然として昔のクラスを送出するのを許容しており、捕捉するものに" "ついての制限はありません。)\n" "結果として文字列例外は終に本当の意味で、完全になくなりました。" #: ../../whatsnew/3.0.rst:698 msgid "" -"Almost all exceptions should actually derive from :exc:`Exception`; :exc:" -"`BaseException` should only be used as a base class for exceptions that " -"should only be handled at the top level, such as :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`. The recommended idiom for handling all exceptions " -"except for this latter category is to use :keyword:`except` :exc:`Exception`." +"Almost all exceptions should actually derive " +"from :exc:`Exception`; :exc:`BaseException` should only be used as a base " +"class for exceptions that should only be handled at the top level, such " +"as :exc:`SystemExit` or :exc:`KeyboardInterrupt`. The recommended idiom for " +"handling all exceptions except for this latter category is to " +"use :keyword:`except` :exc:`Exception`." msgstr "" -"ほとんど全ての例外は、実際は :exc:`Exception` を継承すべきです。 :exc:" -"`BaseException` は最上位で扱われるべき例外、例えば :exc:`SystemExit` や :exc:" -"`KeyboardInterrupt` の基底クラスとしてのみ使われるべきでしす。上記カテゴリー" -"を除く全ての例外を処理するのに推奨されるイディオムは :keyword:`except` :exc:" -"`Exception` です。" +"ほとんど全ての例外は、実際は :exc:`Exception` を継承すべきで" +"す。 :exc:`BaseException` は最上位で扱われるべき例外、例え" +"ば :exc:`SystemExit` や :exc:`KeyboardInterrupt` の基底クラスとしてのみ使われ" +"るべきでしす。上記カテゴリーを除く全ての例外を処理するのに推奨されるイディオ" +"ムは :keyword:`except` :exc:`Exception` です。" -#: ../../whatsnew/3.0.rst:705 msgid ":exc:`!StandardError` was removed." -msgstr "" +msgstr ":exc:`!StandardError` は削除されました。" -#: ../../whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`~BaseException." -"args` attribute instead." +"Exceptions no longer behave as sequences. Use " +"the :attr:`~BaseException.args` attribute instead." msgstr "" +"例外はシーケンスとして動作しなくなりました。\n" +"代わりに :attr:`~BaseException.args` 属性を使ってください。" -#: ../../whatsnew/3.0.rst:710 msgid "" ":pep:`3109`: Raising exceptions. You must now use :samp:`raise {Exception}" "({args})` instead of :samp:`raise {Exception}, {args}`. Additionally, you " @@ -1332,13 +1463,19 @@ msgid "" "this, you can assign directly to the :attr:`~BaseException.__traceback__` " "attribute (see below)." msgstr "" +":pep:`3109`: 例外の送出。\n" +":samp:`raise {Exception}, {args}` の代わりに :samp:`raise {Exception}" +"({args})` を使う必要があります。\n" +"また、トレースバックを明示的に指定できなくなりました。\n" +"どうしても指定する *必要がある* 場合は、:attr:`~BaseException.__traceback__` " +"属性に直接代入できます (後述)。" #: ../../whatsnew/3.0.rst:716 msgid "" ":pep:`3110`: Catching exceptions. You must now use :samp:`except " "{SomeException} as {variable}` instead of :samp:`except {SomeException}, " -"{variable}`. Moreover, the *variable* is explicitly deleted when the :" -"keyword:`except` block is left." +"{variable}`. Moreover, the *variable* is explicitly deleted when " +"the :keyword:`except` block is left." msgstr "" ":pep:`3110`: 例外の捕捉。\n" ":samp:`except {SomeException}, {variable}` ではなく :samp:`except " @@ -1346,7 +1483,6 @@ msgstr "" "その上 :keyword:`except` ブロックがある場合 *variable* は明示的に削除されま" "す。" -#: ../../whatsnew/3.0.rst:722 msgid "" ":pep:`3134`: Exception chaining. There are two cases: implicit chaining and " "explicit chaining. Implicit chaining happens when an exception is raised in " @@ -1356,31 +1492,50 @@ msgid "" "saved as the :attr:`~BaseException.__context__` attribute of the secondary " "exception. Explicit chaining is invoked with this syntax::" msgstr "" +":pep:`3134`: 例外の連鎖。\n" +"暗黙の連鎖と明示的な連鎖の二つがあります。\n" +"暗黙の連鎖は、:keyword:`except` または :keyword:`finally` のハンドラーブロッ" +"ク内で例外が送出されたときに発生します。\n" +"通常はハンドラーブロックのバグが原因で、この例外を *二次的な* 例外と呼びま" +"す。\n" +"この場合、処理中だった元の例外は、二次的な例外" +"の :attr:`~BaseException.__context__` 属性に保存されます。\n" +"明示的な連鎖は次の構文で指定します。 ::" -#: ../../whatsnew/3.0.rst:731 msgid "raise SecondaryException() from primary_exception" -msgstr "" +msgstr "raise SecondaryException() from primary_exception" -#: ../../whatsnew/3.0.rst:733 msgid "" "(where *primary_exception* is any expression that produces an exception " "object, probably an exception that was previously caught). In this case, the " "primary exception is stored on the :attr:`~BaseException.__cause__` " "attribute of the secondary exception. The traceback printed when an " -"unhandled exception occurs walks the chain of :attr:`!__cause__` and :attr:" -"`~BaseException.__context__` attributes and prints a separate traceback for " -"each component of the chain, with the primary exception at the top. (Java " -"users may recognize this behavior.)" -msgstr "" - -#: ../../whatsnew/3.0.rst:743 -msgid "" -":pep:`3134`: Exception objects now store their traceback as the :attr:" -"`~BaseException.__traceback__` attribute. This means that an exception " -"object now contains all the information pertaining to an exception, and " -"there are fewer reasons to use :func:`sys.exc_info` (though the latter is " -"not removed)." -msgstr "" +"unhandled exception occurs walks the chain of :attr:`!__cause__` " +"and :attr:`~BaseException.__context__` attributes and prints a separate " +"traceback for each component of the chain, with the primary exception at the " +"top. (Java users may recognize this behavior.)" +msgstr "" +"(*primary_exception* は例外オブジェクトを生成する任意の式で、通常はそれ以前に" +"捕捉した例外です。)\n" +"この場合、一次的な例外は二次的な例外の :attr:`~BaseException.__cause__` 属性" +"に保存されます。\n" +"未処理の例外が発生したときに表示されるトレースバックは、:attr:`!__cause__` " +"と :attr:`~BaseException.__context__` 属性の連鎖をたどり、\n" +"一次的な例外を先頭にして、連鎖の各例外のトレースバックを個別に表示します。\n" +"(Java の利用者には見覚えのある動作かもしれません。)" + +msgid "" +":pep:`3134`: Exception objects now store their traceback as " +"the :attr:`~BaseException.__traceback__` attribute. This means that an " +"exception object now contains all the information pertaining to an " +"exception, and there are fewer reasons to use :func:`sys.exc_info` (though " +"the latter is not removed)." +msgstr "" +":pep:`3134`: 例外オブジェクトが自身のトレースバック" +"を :attr:`~BaseException.__traceback__` 属性に保存するようになりました。\n" +"これにより、例外に関するすべての情報が例外オブジェクトに含まれるた" +"め、:func:`sys.exc_info` を使う必要が少なくなります (削除されたわけではありま" +"せん)。" #: ../../whatsnew/3.0.rst:749 msgid "" @@ -1404,8 +1559,8 @@ msgstr "演算子と特殊メソッド" #: ../../whatsnew/3.0.rst:761 msgid "" -"``!=`` now returns the opposite of ``==``, unless ``==`` returns :data:" -"`NotImplemented`." +"``!=`` now returns the opposite of ``==``, unless ``==`` " +"returns :data:`NotImplemented`." msgstr "" "``!=`` は ``==`` と逆の結果をかえします(``==`` が :data:`NotImplemented` を" "返さなければ)。" @@ -1419,48 +1574,59 @@ msgstr "" "「非束縛メソッド (unbound methods)」という概念は言語から削除されました。クラ" "ス属性としてのメソッドを参照しても今では普通の関数オブジェクトが得られます。" -#: ../../whatsnew/3.0.rst:768 msgid "" ":meth:`!__getslice__`, :meth:`!__setslice__` and :meth:`!__delslice__` were " "killed. The syntax ``a[i:j]`` now translates to ``a.__getitem__(slice(i, " "j))`` (or :meth:`~object.__setitem__` or :meth:`~object.__delitem__`, when " "used as an assignment or deletion target, respectively)." msgstr "" +":meth:`!__getslice__`、:meth:`!__setslice__`、:meth:`!__delslice__` は削除さ" +"れました。\n" +"構文 ``a[i:j]`` は ``a.__getitem__(slice(i, j))`` に変換されます。\n" +"代入や削除の対象として使われる場合は、それぞれ :meth:`~object.__setitem__` " +"や :meth:`~object.__delitem__` に変換されます。" #: ../../whatsnew/3.0.rst:774 msgid "" -":pep:`3114`: the standard :meth:`next` method has been renamed to :meth:" -"`~iterator.__next__`." +":pep:`3114`: the standard :meth:`next` method has been renamed " +"to :meth:`~iterator.__next__`." msgstr "" ":pep:`3114`: :meth:`next` 標準メソッドは :meth:`~iterator.__next__` に改名さ" "れました。" -#: ../../whatsnew/3.0.rst:777 msgid "" -"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed -- :" -"func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert the " -"argument to an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed " +"-- :func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert " +"the argument to an integer." msgstr "" +"特殊メソッド :meth:`!__oct__` と :meth:`!__hex__` は削除されました。\n" +":func:`oct` と :func:`hex` は、引数を整数に変換するため" +"に :meth:`~object.__index__` を使うようになりました。" -#: ../../whatsnew/3.0.rst:781 msgid "Removed support for :attr:`!__members__` and :attr:`!__methods__`." -msgstr "" +msgstr ":attr:`!__members__` と :attr:`!__methods__` は削除されました。" + +msgid "" +"The function attributes named :attr:`!func_X` have been renamed to use " +"the :attr:`!__X__` form, freeing up these names in the function attribute " +"namespace for user-defined attributes. To wit, :attr:`!" +"func_closure`, :attr:`!func_code`, :attr:`!func_defaults`, :attr:`!" +"func_dict`, :attr:`!func_doc`, :attr:`!func_globals`, :attr:`!func_name` " +"were renamed " +"to :attr:`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function.__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:`~function.__globals__`, :attr:`~function.__name__`, " +"respectively." +msgstr "" +"関数の :attr:`!func_X` という名前の属性は :attr:`!__X__` 形式に改名され、元の" +"名前はユーザー定義の属性に使えるようになりました。\n" +"具体的には、:attr:`!func_closure`、:attr:`!func_code`、:attr:`!" +"func_defaults`、:attr:`!func_dict`、:attr:`!func_doc`、:attr:`!" +"func_globals`、:attr:`!func_name` が、\n" +"それぞ" +"れ :attr:`~function.__closure__`、:attr:`~function.__code__`、:attr:`~function.__defaults__`、:attr:`~function.__dict__`、:attr:`~function.__doc__`、:attr:`~function.__globals__`、:attr:`~function.__name__` " +"に改名されました。" -#: ../../whatsnew/3.0.rst:783 -msgid "" -"The function attributes named :attr:`!func_X` have been renamed to use the :" -"attr:`!__X__` form, freeing up these names in the function attribute " -"namespace for user-defined attributes. To wit, :attr:`!func_closure`, :attr:" -"`!func_code`, :attr:`!func_defaults`, :attr:`!func_dict`, :attr:`!" -"func_doc`, :attr:`!func_globals`, :attr:`!func_name` were renamed to :attr:" -"`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function." -"__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:" -"`~function.__globals__`, :attr:`~function.__name__`, respectively." -msgstr "" - -#: ../../whatsnew/3.0.rst:794 msgid ":meth:`!__nonzero__` is now :meth:`~object.__bool__`." -msgstr "" +msgstr ":meth:`!__nonzero__` は :meth:`~object.__bool__` になりました。" #: ../../whatsnew/3.0.rst:797 msgid "Builtins" @@ -1479,7 +1645,6 @@ msgstr "" "内であると仮定して) 正しいクラスとインスタンスが自動的に選択されます。引数あ" "りの場合の :func:`super` の振る舞いには変更はありません。" -#: ../../whatsnew/3.0.rst:805 msgid "" ":pep:`3111`: :func:`!raw_input` was renamed to :func:`input`. That is, the " "new :func:`input` function reads a line from :data:`sys.stdin` and returns " @@ -1487,14 +1652,19 @@ msgid "" "input is terminated prematurely. To get the old behavior of :func:`input`, " "use ``eval(input())``." msgstr "" +":pep:`3111`: :func:`!raw_input` が :func:`input` にリネームされました。\n" +"つまり、新しい :func:`input` 関数は :data:`sys.stdin` から行を読み、末尾の改" +"行を取り除いて返します。\n" +"入力が時期尚早に終わってしまったら :exc:`EOFError` になります。\n" +"昔の :func:`input` の振る舞いが欲しければ ``eval(input())`` としてください。" #: ../../whatsnew/3.0.rst:811 msgid "" -"A new built-in function :func:`next` was added to call the :meth:`~iterator." -"__next__` method on an object." +"A new built-in function :func:`next` was added to call " +"the :meth:`~iterator.__next__` method on an object." msgstr "" -"新しい組み込み関数 :func:`next` が追加されました。 オブジェクトの :meth:" -"`~iterator.__next__` メソッドを呼び出します。" +"新しい組み込み関数 :func:`next` が追加されました。 オブジェクト" +"の :meth:`~iterator.__next__` メソッドを呼び出します。" #: ../../whatsnew/3.0.rst:814 msgid "" @@ -1515,55 +1685,67 @@ msgstr "" "単一引数で呼ばれた際に整数を返し、二つの引数で呼ばれた場合は ``x`` と同じ型の" "値として返します。" -#: ../../whatsnew/3.0.rst:823 msgid "Moved :func:`!intern` to :func:`sys.intern`." -msgstr "" +msgstr ":func:`!intern` は :func:`sys.intern` に移動しました。" -#: ../../whatsnew/3.0.rst:825 msgid "" "Removed: :func:`!apply`. Instead of ``apply(f, args)`` use ``f(*args)``." msgstr "" +":func:`!apply` は削除されました。\n" +"``apply(f, args)`` の代わりに ``f(*args)`` を使用してください。" -#: ../../whatsnew/3.0.rst:828 msgid "" "Removed :func:`callable`. Instead of ``callable(f)`` you can use " "``isinstance(f, collections.Callable)``. The :func:`!operator.isCallable` " "function is also gone." msgstr "" +":func:`callable` は削除されました。\n" +"``callable(f)`` のかわりに ``isinstance(f, collections.Callable)`` を使用して" +"ください。\n" +":func:`!operator.isCallable` も削除されました。" -#: ../../whatsnew/3.0.rst:832 msgid "" "Removed :func:`!coerce`. This function no longer serves a purpose now that " "classic classes are gone." msgstr "" +":func:`!coerce` は削除されました。\n" +"古い形式のクラスが削除されたため、この関数は必要ありません。" -#: ../../whatsnew/3.0.rst:835 msgid "" -"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." -"read())``." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use " +"``exec(open(fn).read())``." msgstr "" +":func:`!execfile` は削除されました。\n" +"``execfile(fn)`` の代わりに ``exec(open(fn).read())`` を使用してください。" -#: ../../whatsnew/3.0.rst:838 msgid "" "Removed the :class:`!file` type. Use :func:`open`. There are now several " "different kinds of streams that open can return in the :mod:`io` module." msgstr "" +":class:`!file` 型は削除されました。\n" +":func:`open` を使用してください。\n" +":mod:`io` モジュールには open が返すことの出来るいくつかの異なる種類のスト" +"リームがあります。" -#: ../../whatsnew/3.0.rst:841 msgid "" "Removed :func:`!reduce`. Use :func:`functools.reduce` if you really need " "it; however, 99 percent of the time an explicit :keyword:`for` loop is more " "readable." msgstr "" +":func:`!reduce` は削除されました。\n" +"本当に必要なら :func:`functools.reduce` を使ってください。\n" +"ただし、99% の場合は明示的な :keyword:`for` ループの方が読みやすくなります。" -#: ../../whatsnew/3.0.rst:845 msgid "Removed :func:`!reload`. Use :func:`!imp.reload`." msgstr "" +":func:`!reload` は削除されました。\n" +":func:`!imp.reload` を使用してください。" -#: ../../whatsnew/3.0.rst:847 msgid "" "Removed. :meth:`!dict.has_key` -- use the :keyword:`in` operator instead." msgstr "" +":meth:`!dict.has_key` は削除されました -- 代わりに :keyword:`in` 演算子を使用" +"してください。" #: ../../whatsnew/3.0.rst:854 msgid "Build and C API Changes" @@ -1599,21 +1781,23 @@ msgstr ":pep:`3123`: :c:macro:`PyObject_HEAD` を標準的な C に一致。" msgid "No more C API support for restricted execution." msgstr "制限付き実行 の C API サポートはこれ以上されません。" -#: ../../whatsnew/3.0.rst:870 msgid "" ":c:func:`!PyNumber_Coerce`, :c:func:`!PyNumber_CoerceEx`, :c:func:`!" "PyMember_Get`, and :c:func:`!PyMember_Set` C APIs are removed." msgstr "" +":c:func:`!PyNumber_Coerce`、:c:func:`!PyNumber_CoerceEx`、:c:func:`!" +"PyMember_Get`、および :c:func:`!PyMember_Set` C APIs は削除されました。" #: ../../whatsnew/3.0.rst:873 msgid "" -"New C API :c:func:`PyImport_ImportModuleNoBlock`, works like :c:func:" -"`PyImport_ImportModule` but won't block on the import lock (returning an " -"error instead)." +"New C API :c:func:`PyImport_ImportModuleNoBlock`, works " +"like :c:func:`PyImport_ImportModule` but won't block on the import lock " +"(returning an error instead)." msgstr "" -"新たな C API :c:func:`PyImport_ImportModuleNoBlock`、:c:func:" -"`PyImport_ImportModule` のように動きますが、インポートロックでブロックしませ" -"ん (代わりにエラーを返します)。" +"新たな C " +"API :c:func:`PyImport_ImportModuleNoBlock`、:c:func:`PyImport_ImportModule` " +"のように動きますが、インポートロックでブロックしません (代わりにエラーを返し" +"ます)。" #: ../../whatsnew/3.0.rst:877 msgid "" @@ -1623,11 +1807,12 @@ msgstr "" "ブール変換の C 水準のスロットとメソッドがリネームされました: ``nb_nonzero`` " "が ``nb_bool`` になりました。" -#: ../../whatsnew/3.0.rst:880 msgid "" "Removed :c:macro:`!METH_OLDARGS` and :c:macro:`!WITH_CYCLE_GC` from the C " "API." msgstr "" +"C API から :c:macro:`!METH_OLDARGS` と :c:macro:`!WITH_CYCLE_GC` が削除されま" +"した。" #: ../../whatsnew/3.0.rst:886 msgid "Performance" @@ -1654,9 +1839,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." @@ -1682,18 +1867,20 @@ msgstr "" "す。再びテストスイートを実行して、そして警告が出たコードをそれがなくなるまで" "修正し、全てのテストをパスさせます。" -#: ../../whatsnew/3.0.rst:915 msgid "" "Run the ``2to3`` source-to-source translator over your source code tree. " "Run the result of the translation under Python 3.0. Manually fix up any " "remaining issues, fixing problems until all tests pass again." msgstr "" +"``2to3`` のソース変換ツールをソースコードツリー全体に実行してください。\n" +"変換結果を Python 3.0 で実行してください。\n" +"残っている問題を手作業で修正し、すべてのテストが再び通るまで続けてください。" #: ../../whatsnew/3.0.rst:920 msgid "" "It is not recommended to try to write source code that runs unchanged under " -"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, e." -"g. avoiding ``print`` statements, metaclasses, and much more. If you are " +"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, " +"e.g. avoiding ``print`` statements, metaclasses, and much more. If you are " "maintaining a library that needs to support both Python 2.6 and Python 3.0, " "the best approach is to modify step 3 above by editing the 2.6 version of " "the source code and running the ``2to3`` translator again, rather than " @@ -1710,8 +1897,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..13862cca9 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 @@ -36,11 +36,12 @@ msgstr "著者" msgid "Raymond Hettinger" msgstr "Raymond Hettinger" -#: ../../whatsnew/3.1.rst:49 msgid "" "This article explains the new features in Python 3.1, compared to 3.0. " "Python 3.1 was released on June 27, 2009." msgstr "" +"この記事では Python 3.0 と比較した Python 3.1 の新機能を説明します。\n" +"Python 3.1 は 2009 年 6 月 27 日にリリースされました。" #: ../../whatsnew/3.1.rst:54 msgid "PEP 372: Ordered Dictionaries" @@ -51,8 +52,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, a new :class:`collections." -"OrderedDict` class has been introduced." +"the experiences from those implementations, a " +"new :class:`collections.OrderedDict` class has been introduced." msgstr "" "通常の Python 辞書は、 key/value ペアを不定の順序でイテレートします。何年にも" "わたり、いろいろな人が key の挿入順を保存する辞書の別実装を書いてきました。そ" @@ -86,11 +87,11 @@ msgid "" msgstr "" "標準ライブラリのいくつかのモジュールで、順序付き辞書の利用がサポートされてい" "ます。:mod:`configparser` モジュールはデフォルトで順序付き辞書を使います。設" -"定ファイルを読み込み、編集した後、元の順序で書きなおすことができます。:func:" -"`collections.namedtuple` の *_asdict()* メソッドは、タプルの順序と同じ順序の" -"順序付き辞書を返すようになりました。:mod:`json` モジュールのデコーダーが " -"OrderedDict をビルドするのをサポートするために、 :class:`~json.JSONDecoder` " -"クラスのコンストラクタに *object_pairs_hook* 引数が追加されました。 `PyYAML " +"定ファイルを読み込み、編集した後、元の順序で書きなおすことができま" +"す。:func:`collections.namedtuple` の *_asdict()* メソッドは、タプルの順序と" +"同じ順序の順序付き辞書を返すようになりました。:mod:`json` モジュールのデコー" +"ダーが OrderedDict をビルドするのをサポートするために、 ``JSONDecoder`` クラ" +"スのコンストラクタに *object_pairs_hook* 引数が追加されました。 `PyYAML " "`_ などの外部のライブラリでもサポートされています。" #: ../../whatsnew/3.1.rst:79 @@ -113,7 +114,6 @@ msgstr "" "順序付き辞書は挿入順序を記憶するので、ソートと組み合わせて使うことで、ソート" "された辞書を作れます::" -#: ../../whatsnew/3.1.rst:86 msgid "" ">>> # regular unsorted dictionary\n" ">>> d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2}\n" @@ -130,6 +130,20 @@ msgid "" ">>> OrderedDict(sorted(d.items(), key=lambda t: len(t[0])))\n" "OrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)])" msgstr "" +">>> # 通常のソートされていない辞書\n" +">>> d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2}\n" +"\n" +">>> # キーでソートした辞書\n" +">>> OrderedDict(sorted(d.items(), key=lambda t: t[0]))\n" +"OrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)])\n" +"\n" +">>> # 値でソートした辞書\n" +">>> OrderedDict(sorted(d.items(), key=lambda t: t[1]))\n" +"OrderedDict([('pear', 1), ('orange', 2), ('banana', 3), ('apple', 4)])\n" +"\n" +">>> # キー文字列の長さでソートした辞書\n" +">>> OrderedDict(sorted(d.items(), key=lambda t: len(t[0])))\n" +"OrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)])" #: ../../whatsnew/3.1.rst:101 msgid "" @@ -157,7 +171,6 @@ msgstr "" "れによって簡単にプログラムの出力を、その玄人ちっくな見た目を改善してひとさま" "にとって読みやすいものに出来ます::" -#: ../../whatsnew/3.1.rst:114 msgid "" ">>> format(1234567, ',d')\n" "'1,234,567'\n" @@ -168,14 +181,23 @@ msgid "" ">>> format(Decimal('1234567.89'), ',f')\n" "'1,234,567.89'" msgstr "" +">>> format(1234567, ',d')\n" +"'1,234,567'\n" +">>> format(1234567.89, ',.2f')\n" +"'1,234,567.89'\n" +">>> format(12345.6 + 8901234.12j, ',f')\n" +"'12,345.600000+8,901,234.120000j'\n" +">>> format(Decimal('1234567.89'), ',f')\n" +"'1,234,567.89'" #: ../../whatsnew/3.1.rst:123 msgid "" -"The supported types are :class:`int`, :class:`float`, :class:`complex` and :" -"class:`decimal.Decimal`." +"The supported types are :class:`int`, :class:`float`, :class:`complex` " +"and :class:`decimal.Decimal`." msgstr "" -"これをサポートする型は :class:`int`, :class:`float`, :class:`complex` , :" -"class:`decimal.Decimal` です。" +"これをサポートする型" +"は :class:`int`, :class:`float`, :class:`complex` , :class:`decimal.Decimal` " +"です。" #: ../../whatsnew/3.1.rst:126 msgid "" @@ -220,8 +242,8 @@ msgstr "" ":file:`__main__.py` を含むディレクトと zip アーカイブを、その名前をインタプリ" "タに渡すことで直接実行出来るようになりました。そのディレクトリと zip ファイル" "は自動的に sys.path エントリの先頭に挿入されます。(Suggestion and initial " -"patch by Andy Chu; revised patch by Phillip J. Eby and Nick Coghlan; :issue:" -"`1739468`.)" +"patch by Andy Chu; revised patch by Phillip J. Eby and Nick " +"Coghlan; :issue:`1739468`.)" #: ../../whatsnew/3.1.rst:149 msgid "" @@ -231,7 +253,6 @@ msgstr "" ":func:`int` 型に ``bit_length`` メソッドが追加されました。\n" "このメソッドはその値を二進数で表現するのに必要なビット数を返します::" -#: ../../whatsnew/3.1.rst:152 msgid "" ">>> n = 37\n" ">>> bin(37)\n" @@ -244,6 +265,16 @@ msgid "" ">>> (n+1).bit_length()\n" "124" msgstr "" +">>> n = 37\n" +">>> bin(37)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" #: ../../whatsnew/3.1.rst:163 msgid "" @@ -259,11 +290,12 @@ msgid "" msgstr "" ":func:`format` 文字列のフィールドに自動的に番号が振られるようになりました::" -#: ../../whatsnew/3.1.rst:169 msgid "" ">>> 'Sir {} of {}'.format('Gallahad', 'Camelot')\n" "'Sir Gallahad of Camelot'" msgstr "" +">>> 'Sir {} of {}'.format('Gallahad', 'Camelot')\n" +"'Sir Gallahad of Camelot'" #: ../../whatsnew/3.1.rst:172 msgid "" @@ -277,15 +309,22 @@ msgstr "" msgid "(Contributed by Eric Smith; :issue:`5237`.)" msgstr "(Contributed by Eric Smith; :issue:`5237`.)" -#: ../../whatsnew/3.1.rst:177 msgid "" "The :func:`!string.maketrans` function is deprecated and is replaced by new " "static methods, :meth:`bytes.maketrans` and :meth:`bytearray.maketrans`. " -"This change solves the confusion around which types were supported by the :" -"mod:`string` module. Now, :class:`str`, :class:`bytes`, and :class:" -"`bytearray` each have their own **maketrans** and **translate** methods with " -"intermediate translation tables of the appropriate type." +"This change solves the confusion around which types were supported by " +"the :mod:`string` module. Now, :class:`str`, :class:`bytes`, " +"and :class:`bytearray` each have their own **maketrans** and **translate** " +"methods with intermediate translation tables of the appropriate type." msgstr "" +":func:`!string.maketrans` 関数は非推奨となり、新しい静的メソッ" +"ド :meth:`bytes.maketrans` と :meth:`bytearray.maketrans` に置き換えられまし" +"た。\n" +"この変更により、:mod:`string` モジュールがどの型をサポートするかという混乱が" +"解消されます。\n" +":class:`str`、:class:`bytes`、:class:`bytearray` は、それぞれ適切な型の中間変" +"換テーブルを使う独自の **maketrans** メソッドと **translate** メソッドを持つ" +"ようになりました。" #: ../../whatsnew/3.1.rst:184 msgid "(Contributed by Georg Brandl; :issue:`5675`.)" @@ -299,19 +338,23 @@ msgstr "" ":keyword:`with` 文のシンタックスは一つの文で複数のコンテキストマネージャを使" "えるようになりました::" -#: ../../whatsnew/3.1.rst:189 msgid "" ">>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n" "... for line in infile:\n" "... if '' in line:\n" "... outfile.write(line)" msgstr "" +">>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n" +"... for line in infile:\n" +"... if '' in line:\n" +"... outfile.write(line)" -#: ../../whatsnew/3.1.rst:194 msgid "" "With the new syntax, the :func:`!contextlib.nested` function is no longer " "needed and is now deprecated." msgstr "" +"新しい構文により :func:`!contextlib.nested` 関数は不要となり、非推奨になりま" +"した。" #: ../../whatsnew/3.1.rst:197 msgid "" @@ -329,24 +372,26 @@ msgstr "" "``round(x, n)`` は *x* が整数の場合、整数を返すようになりました。以前は浮動小" "数点を返していました::" -#: ../../whatsnew/3.1.rst:203 msgid "" ">>> round(1123, -2)\n" "1100" msgstr "" +">>> round(1123, -2)\n" +"1100" #: ../../whatsnew/3.1.rst:206 msgid "(Contributed by Mark Dickinson; :issue:`4707`.)" msgstr "(Contributed by Mark Dickinson; :issue:`4707`.)" -#: ../../whatsnew/3.1.rst:208 msgid "" "Python now uses David Gay's algorithm for finding the shortest floating-" "point representation that doesn't change its value. This should help " "mitigate some of the confusion surrounding binary floating-point numbers." msgstr "" +"Python は、値を変えずに浮動小数点数を表せる最短の文字列表現を求める David " +"Gay のアルゴリズムを使うようになりました。\n" +"これにより、二進浮動小数点数にまつわる混乱がいくらか軽減されるはずです。" -#: ../../whatsnew/3.1.rst:213 msgid "" "The significance is easily seen with a number like ``1.1`` which does not " "have an exact equivalent in binary floating point. Since there is no exact " @@ -356,8 +401,14 @@ msgid "" "nearest value was and still is used in subsequent floating-point " "calculations." msgstr "" +"この変更の意味は、二進浮動小数点数で正確に表せない ``1.1`` のような数を見ると" +"分かります。\n" +"正確に表せないため、``float('1.1')`` のような式は表現できる最も近い値に評価さ" +"れます。\n" +"その値は十六進数では ``0x1.199999999999ap+0``、十進数では " +"``1.100000000000000088817841970012523233890533447265625`` です。\n" +"以降の浮動小数点演算には、以前も今もこの最も近い値が使われます。" -#: ../../whatsnew/3.1.rst:221 msgid "" "What is new is how the number gets displayed. Formerly, Python used a " "simple approach. The value of ``repr(1.1)`` was computed as ``format(1.1, " @@ -368,6 +419,14 @@ msgid "" "intrinsic limitations of binary floating-point representation as being a " "problem with Python itself)." msgstr "" +"新しくなったのは数値の表示方法です。\n" +"以前の Python は単純な方法を使っていました。\n" +"``repr(1.1)`` の値を ``format(1.1, '.17g')`` として計算し、" +"``'1.1000000000000001'`` を返していました。\n" +"17 桁を使う利点は、IEEE-754 の保証に基づき、``eval(repr(1.1))`` が正確に元の" +"値に戻ることを保証できる点でした。\n" +"欠点は、多くの人がこの出力に混乱したことです (二進浮動小数点表現に本来備わる" +"制限を Python 自体の問題と誤解していました)。" #: ../../whatsnew/3.1.rst:230 msgid "" @@ -390,13 +449,16 @@ msgstr "" "元の値を変更しません。ですから ``1.1 + 2.2 != 3.3`` は表示がどうであれ、今で" "も問題です。" -#: ../../whatsnew/3.1.rst:239 msgid "" "The new algorithm depends on certain features in the underlying floating-" "point implementation. If the required features are not found, the old " "algorithm will continue to be used. Also, the text pickle protocols assure " "cross-platform portability by using the old algorithm." msgstr "" +"新しいアルゴリズムは、基盤となる浮動小数点実装の特定の機能に依存します。\n" +"必要な機能がなければ、引き続き従来のアルゴリズムを使います。\n" +"また、テキスト形式の pickle プロトコルは、従来のアルゴリズムを使ってプラット" +"フォーム間の移植性を保証します。" #: ../../whatsnew/3.1.rst:244 msgid "(Contributed by Eric Smith and Mark Dickinson; :issue:`1580`)" @@ -411,14 +473,15 @@ msgid "" "Added a :class:`collections.Counter` class to support convenient counting of " "unique items in a sequence or iterable::" msgstr "" -"シーケンスまたはイテラブル内にある一意な要素を数え上げるのに便利な :class:" -"`collections.Counter` クラスが追加されました::" +"シーケンスまたはイテラブル内にある一意な要素を数え上げるのに便利" +"な :class:`collections.Counter` クラスが追加されました::" -#: ../../whatsnew/3.1.rst:252 msgid "" ">>> Counter(['red', 'blue', 'red', 'green', 'blue', 'blue'])\n" "Counter({'blue': 3, 'red': 2, 'green': 1})" msgstr "" +">>> Counter(['red', 'blue', 'red', 'green', 'blue', 'blue'])\n" +"Counter({'blue': 3, 'red': 2, 'green': 1})" #: ../../whatsnew/3.1.rst:255 msgid "(Contributed by Raymond Hettinger; :issue:`1696199`.)" @@ -431,9 +494,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`.)" @@ -447,12 +510,14 @@ msgstr "" ":class:`gzip.GzipFile` と :class:`bz2.BZ2File` クラスはコンテキストマネジメン" "トプロトコルをサポートするようになりました::" -#: ../../whatsnew/3.1.rst:266 msgid "" ">>> # Automatically close file after writing\n" ">>> with gzip.GzipFile(filename, \"wb\") as f:\n" "... f.write(b\"xxx\")" msgstr "" +">>> # 書き込み後にファイルを自動的に閉じる\n" +">>> with gzip.GzipFile(filename, \"wb\") as f:\n" +"... f.write(b\"xxx\")" #: ../../whatsnew/3.1.rst:270 msgid "(Contributed by Antoine Pitrou.)" @@ -468,11 +533,12 @@ msgstr "" "成するメソッドをサポートしました。\n" "変換は正確ですが時に意外なことがあります::" -#: ../../whatsnew/3.1.rst:276 msgid "" ">>> Decimal.from_float(1.1)\n" "Decimal('1.100000000000000088817841970012523233890533447265625')" msgstr "" +">>> Decimal.from_float(1.1)\n" +"Decimal('1.100000000000000088817841970012523233890533447265625')" #: ../../whatsnew/3.1.rst:279 msgid "" @@ -490,23 +556,23 @@ msgstr "(Contributed by Raymond Hettinger and Mark Dickinson.)" #: ../../whatsnew/3.1.rst:285 msgid "" -"The :mod:`itertools` module grew two new functions. The :func:`itertools." -"combinations_with_replacement` function is one of four for generating " -"combinatorics including permutations and Cartesian products. The :func:" -"`itertools.compress` function mimics its namesake from APL. Also, the " -"existing :func:`itertools.count` function now has an optional *step* " -"argument and can accept any type of counting sequence including :class:" -"`fractions.Fraction` and :class:`decimal.Decimal`::" +"The :mod:`itertools` module grew two new functions. " +"The :func:`itertools.combinations_with_replacement` function is one of four " +"for generating combinatorics including permutations and Cartesian products. " +"The :func:`itertools.compress` function mimics its namesake from APL. Also, " +"the existing :func:`itertools.count` function now has an optional *step* " +"argument and can accept any type of counting sequence " +"including :class:`fractions.Fraction` and :class:`decimal.Decimal`::" msgstr "" -":mod:`itertools` に 2 つの関数が追加されました。 :func:`itertools." -"combinations_with_replacement` 関数は、置換 (順列, permutation) や直積 " -"(Cartesian product) を含む組合せ論の 4 つの生成関数のうちの 1 つです。 :func:" -"`itertools.compress` 関数は `APL `_ の同名" -"機能の模倣品です。また、既存の :func:`itertools.count` 関数は新たにオプショナ" -"ルな *step* 引数を取るようになり、そして数え方に :class:`fractions.Fraction` " -"や :class:`decimal.Decimal` を含む任意の数値型を使えるようになりました。 ::" +":mod:`itertools` に 2 つの関数が追加されまし" +"た。 :func:`itertools.combinations_with_replacement` 関数は、置換 (順列, " +"permutation) や直積 (Cartesian product) を含む組合せ論の 4 つの生成関数のうち" +"の 1 つです。 :func:`itertools.compress` 関数は `APL `_ の同名機能の模倣品です。また、既存" +"の :func:`itertools.count` 関数は新たにオプショナルな *step* 引数を取るように" +"なり、そして数え方に :class:`fractions.Fraction` や :class:`decimal.Decimal` " +"を含む任意の数値型を使えるようになりました。 ::" -#: ../../whatsnew/3.1.rst:294 msgid "" ">>> [p+q for p,q in combinations_with_replacement('LOVE', 2)]\n" "['LL', 'LO', 'LV', 'LE', 'OO', 'OV', 'OE', 'VV', 'VE', 'EE']\n" @@ -518,6 +584,15 @@ msgid "" ">>> [next(c), next(c), next(c), next(c)]\n" "[Fraction(1, 2), Fraction(2, 3), Fraction(5, 6), Fraction(1, 1)]" msgstr "" +">>> [p+q for p,q in combinations_with_replacement('LOVE', 2)]\n" +"['LL', 'LO', 'LV', 'LE', 'OO', 'OV', 'OE', 'VV', 'VE', 'EE']\n" +"\n" +">>> list(compress(data=range(10), selectors=[0,0,1,1,0,1,0,1,0,0]))\n" +"[2, 3, 5, 7]\n" +"\n" +">>> c = count(start=Fraction(1,2), step=Fraction(1,6))\n" +">>> [next(c), next(c), next(c), next(c)]\n" +"[Fraction(1, 2), Fraction(2, 3), Fraction(5, 6), Fraction(1, 1)]" #: ../../whatsnew/3.1.rst:304 msgid "(Contributed by Raymond Hettinger.)" @@ -569,21 +644,23 @@ msgstr "(Contributed by Gregory Smith.)" #: ../../whatsnew/3.1.rst:330 msgid "" -"The :mod:`logging` module now implements a simple :class:`logging." -"NullHandler` class for applications that are not using logging but are " -"calling library code that does. Setting-up a null handler will suppress " -"spurious warnings such as \"No handlers could be found for logger foo\"::" +"The :mod:`logging` module now implements a " +"simple :class:`logging.NullHandler` class for applications that are not " +"using logging but are calling library code that does. Setting-up a null " +"handler will suppress spurious warnings such as \"No handlers could be found " +"for logger foo\"::" msgstr "" "logging を自身では使わずとも使用ライブラリがそうしているようなアプリケーショ" "ンのために、 :mod:`logging` モジュールが単純な :class:`logging.NullHandler` " "を実装しました。null ハンドラをセットアップすることは、 \"No handlers could " "be found for logger foo\" のような警告を抑制します。" -#: ../../whatsnew/3.1.rst:335 msgid "" ">>> h = logging.NullHandler()\n" ">>> logging.getLogger(\"foo\").addHandler(h)" msgstr "" +">>> h = logging.NullHandler()\n" +">>> logging.getLogger(\"foo\").addHandler(h)" #: ../../whatsnew/3.1.rst:338 msgid "(Contributed by Vinay Sajip; :issue:`4384`)." @@ -605,8 +682,8 @@ msgstr "(Contributed by Andi Vajda; :issue:`4195`.)" #: ../../whatsnew/3.1.rst:346 msgid "" -"The :mod:`pdb` module can now access and display source code loaded via :mod:" -"`zipimport` (or any other conformant :pep:`302` loader)." +"The :mod:`pdb` module can now access and display source code loaded " +"via :mod:`zipimport` (or any other conformant :pep:`302` loader)." msgstr "" ":mod:`pdb` モジュールが :mod:`zipimport` (あるいはなにかほかの :pep:`302` 準" "拠ローダ) でロードされたモジュールのソースコードにアクセスでき、表示できるよ" @@ -652,10 +729,9 @@ msgid "" msgstr "" ":mod:`unittest` に特定のテストメソッドやテストクラス全体をスキップする仕組み" "のサポートが追加されました。さらに、この機能はテスト結果を「意図的な失敗」と" -"することができ、テストが失敗しても :class:`TestResult` の失敗数にはカウントさ" -"れなくなります::" +"することができ、テストが失敗しても ``TestResult`` の失敗数にはカウントされな" +"くなります::" -#: ../../whatsnew/3.1.rst:366 msgid "" "class TestGizmo(unittest.TestCase):\n" "\n" @@ -668,6 +744,16 @@ msgid "" " def test_gimzo_without_required_library(self):\n" " ..." msgstr "" +"class TestGizmo(unittest.TestCase):\n" +"\n" +" @unittest.skipUnless(sys.platform.startswith(\"win\"), \"requires " +"Windows\")\n" +" def test_gizmo_on_windows(self):\n" +" ...\n" +"\n" +" @unittest.expectedFailure\n" +" def test_gimzo_without_required_library(self):\n" +" ..." #: ../../whatsnew/3.1.rst:376 msgid "" @@ -677,51 +763,59 @@ msgstr "" "また例外についてのテストが、 :keyword:`with` 文で使えるコンテキストマネージャ" "として増強されました::" -#: ../../whatsnew/3.1.rst:379 msgid "" "def test_division_by_zero(self):\n" " with self.assertRaises(ZeroDivisionError):\n" " x / 0" msgstr "" +"def test_division_by_zero(self):\n" +" with self.assertRaises(ZeroDivisionError):\n" +" x / 0" -#: ../../whatsnew/3.1.rst:383 msgid "" -"In addition, several new assertion methods were added including :meth:" -"`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase." -"assertDictEqual`, :meth:`!assertDictContainsSubset`, :meth:`~unittest." -"TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :" -"meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " -"`, :meth:`~unittest.TestCase." -"assertIsNone`, and :meth:`~unittest.TestCase.assertIsNotNone`." +"In addition, several new assertion methods were added " +"including :meth:`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase.assertDictEqual`, :meth:`!" +"assertDictContainsSubset`, :meth:`~unittest.TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " +"`, :meth:`~unittest.TestCase.assertIsNone`, " +"and :meth:`~unittest.TestCase.assertIsNotNone`." msgstr "" +"さら" +"に、:meth:`~unittest.TestCase.assertSetEqual`、:meth:`~unittest.TestCase.assertDictEqual`、:meth:`!" +"assertDictContainsSubset`、:meth:`~unittest.TestCase.assertListEqual`、:meth:`~unittest.TestCase.assertTupleEqual`、:meth:`~unittest.TestCase.assertSequenceEqual`、:meth:`assertRaisesRegexp() " +"`、:meth:`~unittest.TestCase.assertIsNone`、:meth:`~unittest.TestCase.assertIsNotNone` " +"など、新しいアサーションメソッドが追加されました。" #: ../../whatsnew/3.1.rst:394 msgid "(Contributed by Benjamin Peterson and Antoine Pitrou.)" msgstr "(Contributed by Benjamin Peterson and Antoine Pitrou.)" -#: ../../whatsnew/3.1.rst:396 msgid "" "The :mod:`io` module has three new constants for the :meth:`~io.IOBase.seek` " "method: :data:`~os.SEEK_SET`, :data:`~os.SEEK_CUR`, and :data:`~os.SEEK_END`." msgstr "" +":mod:`io` モジュールに :meth:`~io.IOBase.seek` メソッド用の三つの定" +"数 :data:`~os.SEEK_SET`、:data:`~os.SEEK_CUR`、:data:`~os.SEEK_END` が追加さ" +"れました。" #: ../../whatsnew/3.1.rst:399 msgid "The :data:`sys.version_info` tuple is now a named tuple::" msgstr ":data:`sys.version_info` タプルが名前付きタプルになりました。" -#: ../../whatsnew/3.1.rst:401 msgid "" ">>> sys.version_info\n" "sys.version_info(major=3, minor=1, micro=0, releaselevel='alpha', serial=2)" msgstr "" +">>> sys.version_info\n" +"sys.version_info(major=3, minor=1, micro=0, releaselevel='alpha', serial=2)" #: ../../whatsnew/3.1.rst:404 msgid "(Contributed by Ross Light; :issue:`4285`.)" msgstr "(Contributed by Ross Light; :issue:`4285`.)" -#: ../../whatsnew/3.1.rst:406 msgid "The :mod:`!nntplib` and :mod:`imaplib` modules now support IPv6." msgstr "" +":mod:`!nntplib` モジュールと :mod:`imaplib` モジュールが IPv6 をサポートする" +"ようになりました。" #: ../../whatsnew/3.1.rst:408 msgid "(Contributed by Derek Morr; :issue:`1655` and :issue:`1664`.)" @@ -748,7 +842,6 @@ msgstr "" "ります。この再マッピングはデフォルトで有効になりますが、 *fix_imports* オプ" "ションで無効に出来ます::" -#: ../../whatsnew/3.1.rst:420 msgid "" ">>> s = {1, 2, 3}\n" ">>> pickle.dumps(s, protocol=0)\n" @@ -756,6 +849,11 @@ msgid "" ">>> pickle.dumps(s, protocol=0, fix_imports=False)\n" "b'cbuiltins\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'" msgstr "" +">>> s = {1, 2, 3}\n" +">>> pickle.dumps(s, protocol=0)\n" +"b'c__builtin__\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'\n" +">>> pickle.dumps(s, protocol=0, fix_imports=False)\n" +"b'cbuiltins\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'" #: ../../whatsnew/3.1.rst:426 msgid "" @@ -801,7 +899,6 @@ msgstr "最適化" msgid "Major performance enhancements have been added:" msgstr "大きな性能向上がありました:" -#: ../../whatsnew/3.1.rst:447 msgid "" "The new I/O library (as defined in :pep:`3116`) was mostly written in Python " "and quickly proved to be a problematic bottleneck in Python 3.0. In Python " @@ -809,38 +906,50 @@ msgid "" "faster depending on the task at hand. The pure Python version is still " "available for experimentation purposes through the ``_pyio`` module." msgstr "" +":pep:`3116` で定義された新しい I/O ライブラリは、その大半が Python で書かれて" +"おり、Python 3.0 では早くから性能のボトルネックになると分かりました。\n" +"Python 3.1 では I/O ライブラリ全体が C で書き直され、処理の内容に応じて 2〜" +"20 倍高速になりました。\n" +"実験用に、Python だけで書かれたバージョンも ``_pyio`` モジュールとして引き続" +"き利用できます。" #: ../../whatsnew/3.1.rst:454 msgid "(Contributed by Amaury Forgeot d'Arc and Antoine Pitrou.)" msgstr "(Contributed by Amaury Forgeot d'Arc and Antoine Pitrou.)" -#: ../../whatsnew/3.1.rst:456 msgid "" "Added a heuristic so that tuples and dicts containing only untrackable " "objects are not tracked by the garbage collector. This can reduce the size " "of collections and therefore the garbage collection overhead on long-running " "programs, depending on their particular use of datatypes." msgstr "" +"追跡対象外のオブジェクトだけを含むタプルと辞書を、ガベージコレクタの追跡対象" +"から外す判定を追加しました。\n" +"これにより、長時間実行するプログラムではデータ型の使い方に応じて回収対象を減" +"らし、ガベージコレクションのオーバーヘッドを抑えられます。" #: ../../whatsnew/3.1.rst:461 msgid "(Contributed by Antoine Pitrou, :issue:`4688`.)" msgstr "(Contributed by Antoine Pitrou, :issue:`4688`.)" -#: ../../whatsnew/3.1.rst:463 msgid "" "Enabling a configure option named ``--with-computed-gotos`` on compilers " "that support it (notably: gcc, SunPro, icc), the bytecode evaluation loop is " "compiled with a new dispatch mechanism which gives speedups of up to 20%, " "depending on the system, the compiler, and the benchmark." msgstr "" +"対応するコンパイラ (特に gcc、SunPro、icc) で configure オプション ``--with-" +"computed-gotos`` を有効にすると、バイトコード評価ループが新しいディスパッチ方" +"式でコンパイルされます。\n" +"システム、コンパイラ、ベンチマークに応じて最大 20% 高速になります。" #: ../../whatsnew/3.1.rst:469 msgid "" -"(Contributed by Antoine Pitrou along with a number of other participants, :" -"issue:`4753`)." +"(Contributed by Antoine Pitrou along with a number of other " +"participants, :issue:`4753`)." msgstr "" -"(Contributed by Antoine Pitrou along with a number of other participants, :" -"issue:`4753`)." +"(Contributed by Antoine Pitrou along with a number of other " +"participants, :issue:`4753`)." #: ../../whatsnew/3.1.rst:472 msgid "" @@ -853,7 +962,6 @@ msgid "" "(Contributed by Antoine Pitrou and Amaury Forgeot d'Arc, :issue:`4868`.)" msgstr "(Antoine Pitrou と Amaury Forgeot d'Arc の貢献, :issue:`4868`.)" -#: ../../whatsnew/3.1.rst:477 msgid "" "The :mod:`json` module now has a C extension to substantially improve its " "performance. In addition, the API was modified so that json works only " @@ -861,6 +969,11 @@ msgid "" "closely match the `JSON specification `_ which is defined " "in terms of Unicode." msgstr "" +":mod:`json` モジュールに C 拡張が追加され、性能が大幅に改善されました。\n" +"また、API が変更され、json は :class:`bytes` ではなく :class:`str` だけを扱う" +"ようになりました。\n" +"これにより、Unicode を前提として定義されている `JSON 仕様 `_ により忠実なモジュールになりました。" #: ../../whatsnew/3.1.rst:483 msgid "" @@ -870,11 +983,13 @@ msgstr "" "(Contributed by Bob Ippolito and converted to Py3.1 by Antoine Pitrou and " "Benjamin Peterson; :issue:`4136`.)" -#: ../../whatsnew/3.1.rst:486 msgid "" "Unpickling now interns the attribute names of pickled objects. This saves " "memory and allows pickles to be smaller." msgstr "" +"unpickle 時に、pickle されたオブジェクトの属性名をインターン化するようになり" +"ました。\n" +"これによりメモリを節約し、pickle を小さくできます。" #: ../../whatsnew/3.1.rst:489 msgid "(Contributed by Jake McGuire and Antoine Pitrou; :issue:`5084`.)" @@ -941,12 +1056,14 @@ msgstr "" "加されましたが、これにより数字あたりのビット数と各数字の格納に使われる C の型" "のバイトサイズが分かります::" -#: ../../whatsnew/3.1.rst:519 msgid "" ">>> import sys\n" ">>> sys.int_info\n" "sys.int_info(bits_per_digit=30, sizeof_digit=4)" msgstr "" +">>> import sys\n" +">>> sys.int_info\n" +"sys.int_info(bits_per_digit=30, sizeof_digit=4)" #: ../../whatsnew/3.1.rst:523 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" @@ -957,8 +1074,9 @@ msgid "" "The :c:func:`PyLong_AsUnsignedLongLong()` function now handles a negative " "*pylong* by raising :exc:`OverflowError` instead of :exc:`TypeError`." msgstr "" -":c:func:`PyLong_AsUnsignedLongLong()` 関数は負の *pylong* に対し :exc:" -"`TypeError` ではなく :exc:`OverflowError` を送出するようになりました。" +":c:func:`PyLong_AsUnsignedLongLong()` 関数は負の *pylong* に対" +"し :exc:`TypeError` ではなく :exc:`OverflowError` を送出するようになりまし" +"た。" #: ../../whatsnew/3.1.rst:528 msgid "(Contributed by Mark Dickinson and Lisandro Dalcrin; :issue:`5175`.)" @@ -968,8 +1086,8 @@ msgstr "(Contributed by Mark Dickinson and Lisandro Dalcrin; :issue:`5175`.)" msgid "" "Deprecated :c:func:`!PyNumber_Int`. Use :c:func:`PyNumber_Long` instead." msgstr "" -":c:func:`!PyNumber_Int` が非推奨になりました。代わりに :c:func:" -"`PyNumber_Long` を使用してください。" +":c:func:`!PyNumber_Int` が非推奨になりました。代わり" +"に :c:func:`PyNumber_Long` を使用してください。" #: ../../whatsnew/3.1.rst:532 msgid "(Contributed by Mark Dickinson; :issue:`4910`.)" @@ -1018,13 +1136,14 @@ msgstr "" "このセクションでは前述の変更とバグフィックスにより必要となるかもしれないコー" "ドの変更を列挙します:" -#: ../../whatsnew/3.1.rst:553 msgid "" "The new floating-point string representations can break existing doctests. " "For example::" msgstr "" +"浮動小数点数の新しい文字列表現により、既存の doctest が失敗することがありま" +"す。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/3.1.rst:556 msgid "" "def e():\n" " '''Compute the base of natural logarithms.\n" @@ -1046,6 +1165,25 @@ msgid "" " 2.718281828459045\n" "**********************************************************************" msgstr "" +"def e():\n" +" '''自然対数の底を計算します。\n" +"\n" +" >>> e()\n" +" 2.7182818284590451\n" +"\n" +" '''\n" +" return sum(1/math.factorial(x) for x in reversed(range(30)))\n" +"\n" +"doctest.testmod()\n" +"\n" +"**********************************************************************\n" +"Failed example:\n" +" e()\n" +"Expected:\n" +" 2.7182818284590451\n" +"Got:\n" +" 2.718281828459045\n" +"**********************************************************************" #: ../../whatsnew/3.1.rst:576 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index b6bf3ffcf..e75977674 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 @@ -40,8 +40,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.10.rst:47 msgid "" "This article explains the new features in Python 3.10, compared to 3.9. " -"Python 3.10 was released on October 4, 2021. For full details, see the :ref:" -"`changelog `." +"Python 3.10 was released on October 4, 2021. For full details, see " +"the :ref:`changelog `." msgstr "" "この記事では Python 3.9 と比較した Python 3.10 の新機能を解説します。Python " "3.10 は2021年10月4日にリリースされました。全詳細については :ref:`変更履歴 " @@ -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`、Union型を 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,22 +215,28 @@ msgid "" "):\n" " ..." msgstr "" +"with (\n" +" CtxManager1() as example1,\n" +" CtxManager2() as example2,\n" +" CtxManager3() as example3,\n" +"):\n" +" ..." #: ../../whatsnew/3.10.rst:142 msgid "" -"This new syntax uses the non LL(1) capacities of the new parser. Check :pep:" -"`617` for more details." +"This new syntax uses the non LL(1) capacities of the new parser. " +"Check :pep:`617` for more details." msgstr "" -"この新しい構文は、新パーサーによるLL(1)以外の能力を使用しています。詳細は :" -"pep:`617` を参照してください。" +"この新しい構文は、新パーサーによるLL(1)以外の能力を使用しています。詳細" +"は :pep:`617` を参照してください。" #: ../../whatsnew/3.10.rst:145 msgid "" -"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in :" -"issue:`12782` and :issue:`40334`.)" +"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou " +"in :issue:`12782` and :issue:`40334`.)" msgstr "" -"(Guido van Rossum、Pablo Galindo、Lysandros Nikolaou の貢献による :issue:" -"`12782`、:issue:`40334`)" +"(Guido van Rossum、Pablo Galindo、Lysandros Nikolaou の貢献によ" +"る :issue:`12782`、:issue:`40334`)" #: ../../whatsnew/3.10.rst:150 msgid "Better error messages" @@ -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,29 +309,33 @@ 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 "" -"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in :" -"issue:`40176`.)" +"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya " +"in :issue:`40176`.)" msgstr "" -"(Pablo Galindoの貢献による :issue:`42864`、Batuhan Taskayaの貢献による :" -"issue:`40176`)" +"(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,38 +673,52 @@ 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 "" "The :attr:`~codeobject.co_lnotab` attribute of :ref:`code objects ` is deprecated and will be removed in 3.12. Code that needs to " -"convert from offset to line number should use the new :meth:`~codeobject." -"co_lines` method instead." +"convert from offset to line number should use the " +"new :meth:`~codeobject.co_lines` method instead." msgstr "" #: ../../whatsnew/3.10.rst:412 @@ -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`." +"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." +"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: 新しい Union型演算子" -#: ../../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 "" +"新しい Union型演算子を導入し、``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`::" +"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,45 @@ 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." +"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,99 +1506,128 @@ 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`." +"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`.)" +"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 " "other objects that can be converted to integers only with a loss (e.g. that " -"have the :meth:`~object.__int__` method but do not have the :meth:`~object." -"__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" +"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,34 +1635,44 @@ 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 "" -"Static methods (:func:`@staticmethod `) and class methods (:" -"func:`@classmethod `) now inherit the method attributes " +"Static methods (:func:`@staticmethod `) and class methods " +"(:func:`@classmethod `) now inherit the method attributes " "(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, " "``__annotations__``) and have a new ``__wrapped__`` attribute. Moreover, " "static methods are now callable as regular functions. (Contributed by Victor " "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`.)" +"__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,54 +1680,77 @@ 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`.)" +"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 " -"``0`` even though NaN values are not equal to one another. This caused " -"potentially quadratic runtime behavior due to excessive hash collisions when " -"creating dictionaries and sets containing multiple NaNs. (Contributed by " -"Raymond Hettinger in :issue:`43475`.)" +"Hashes of NaN values of both :class:`float` type " +"and :class:`decimal.Decimal` type now depend on object identity. Formerly, " +"they always hashed to ``0`` even though NaN values are not equal to one " +"another. This caused potentially quadratic runtime behavior due to excessive " +"hash collisions when 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`.)" +"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" @@ -1394,57 +1762,65 @@ msgstr "asyncio" #: ../../whatsnew/3.10.rst:904 msgid "" -"Add missing :meth:`~asyncio.events.AbstractEventLoop." -"connect_accepted_socket` method. (Contributed by Alex Grönholm in :issue:" -"`41332`.)" +"Add " +"missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " +"method. (Contributed by Alex Grönholm in :issue:`41332`.)" msgstr "" #: ../../whatsnew/3.10.rst:909 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,89 +1828,119 @@ 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`.)" +"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." -"Callable`. :class:`collections.abc.Callable` generic now flattens type " -"parameters, similar to what :data:`typing.Callable` currently does. This " -"means that ``collections.abc.Callable[[int, str], str]`` will have " -"``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " +"for :class:`collections.abc.Callable` are now consistent " +"with :data:`typing.Callable`. :class:`collections.abc.Callable` generic now " +"flattens type parameters, similar to what :data:`typing.Callable` currently " +"does. This means that ``collections.abc.Callable[[int, str], str]`` will " +"have ``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " "str)``. To allow this change, :class:`types.GenericAlias` can now be " -"subclassed, and a subclass will be returned when subscripting the :class:" -"`collections.abc.Callable` type. Note that a :exc:`TypeError` may be raised " -"for invalid forms of parameterizing :class:`collections.abc.Callable` which " -"may have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" -msgstr "" +"subclassed, and a subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Note that a :exc:`TypeError` " +"may be raised for invalid forms of " +"parameterizing :class:`collections.abc.Callable` which 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." -"init_pair`, and :func:`curses.pair_content`. A new function, :func:`curses." -"has_extended_color_support`, indicates whether extended color support is " -"provided by the underlying ncurses library. (Contributed by Jeffrey " -"Kintscher and Hans Petter Jansson in :issue:`36982`.)" +"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses.init_pair`, " +"and :func:`curses.pair_content`. A new " +"function, :func:`curses.has_extended_color_support`, indicates whether " +"extended color support is 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 +1956,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 +1979,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 +2004,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,57 +2042,83 @@ 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 " "completely replaced by third-party packages ``setuptools`` and " "``packaging``, and most other commonly used APIs are available elsewhere in " -"the standard library (such as :mod:`platform`, :mod:`shutil`, :mod:" -"`subprocess` or :mod:`sysconfig`). There are no plans to migrate any other " -"functionality from ``distutils``, and applications that are using other " -"functions should plan to make private copies of the code. Refer to :pep:" -"`632` for discussion." -msgstr "" +"the standard library (such " +"as :mod:`platform`, :mod:`shutil`, :mod:`subprocess` or :mod:`sysconfig`). " +"There are no plans to migrate any other functionality from ``distutils``, " +"and applications that are using other 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`.)" +"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" @@ -1679,10 +2126,11 @@ msgstr "enum" #: ../../whatsnew/3.10.rst:1093 msgid "" -":class:`~enum.Enum` :func:`~object.__repr__` now returns ``enum_name." -"member_name`` and :func:`~object.__str__` now returns ``member_name``. " -"Stdlib enums available as module constants have a :func:`repr` of " -"``module_name.member_name``. (Contributed by Ethan Furman in :issue:`40066`.)" +":class:`~enum.Enum` :func:`~object.__repr__` now returns " +"``enum_name.member_name`` and :func:`~object.__str__` now returns " +"``member_name``. Stdlib enums available as module constants have " +"a :func:`repr` of ``module_name.member_name``. (Contributed by Ethan Furman " +"in :issue:`40066`.)" msgstr "" #: ../../whatsnew/3.10.rst:1098 @@ -1695,111 +2143,141 @@ 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`.)" +"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`.)" +"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`.)" +"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`.)" +"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`.)" +"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 " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" -msgstr "" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new 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,96 +2287,145 @@ 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-" -"matching statements. However, this highlighting is not perfect and will be " -"incorrect in some rare cases, including some ``_``-s in ``case`` patterns. " -"(Contributed by Tal Einat in :issue:`44010`.)" +"Highlight the new :ref:`soft keywords ` :keyword:`match`, :keyword:`case `, and :keyword:`_ " +"` in pattern-matching statements. However, this " +"highlighting is not perfect and will be 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." +"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 " "annotations on various types of objects, and makes very few assumptions " "about the object it examines. :func:`inspect.get_annotations` can also " -"correctly un-stringize stringized annotations. :func:`inspect." -"get_annotations` is now considered best practice for accessing the " -"annotations dict defined on any Python object; for more information on best " -"practices for working with annotations, please see :ref:`annotations-howto`. " -"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature." -"from_callable`, and :func:`!inspect.Signature.from_function` now call :func:" -"`inspect.get_annotations` to retrieve annotations. This means :func:`inspect." -"signature` and :func:`inspect.Signature.from_callable` can also now un-" -"stringize stringized annotations. (Contributed by Larry Hastings in :issue:" -"`43817`.)" -msgstr "" +"correctly un-stringize stringized " +"annotations. :func:`inspect.get_annotations` is now considered best " +"practice for accessing the annotations dict defined on any Python object; " +"for more information on best practices for working with annotations, please " +"see :ref:`annotations-howto`. " +"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature.from_callable`, " +"and :func:`!inspect.Signature.from_function` now " +"call :func:`inspect.get_annotations` to retrieve annotations. This " +"means :func:`inspect.signature` and :func:`inspect.Signature.from_callable` " +"can also now un-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`.)" +"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 +2435,189 @@ 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`.)" +"``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`.)" +"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`.)" +"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`.)" +"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`.)" +"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`.)" +"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`.)" +"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,87 +2627,112 @@ 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`.)" +"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." -"OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and therefore " -"cannot warn about setting the flag again. The :ref:`deprecation section " -"` has a list of deprecated features. (Contributed by " -"Christian Heimes in :issue:`43880`.)" +"Deprecated function and use of deprecated constants now result in " +"a :exc:`DeprecationWarning`. :attr:`ssl.SSLContext.options` " +"has :data:`~ssl.OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and " +"therefore cannot warn about setting the flag again. The :ref:`deprecation " +"section ` 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 "" "The ssl module now has more secure default settings. Ciphers without forward " "secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits " -"weak RSA, DH, and ECC keys with less than 112 bits of security. :class:`~ssl." -"SSLContext` defaults to minimum protocol version TLS 1.2. Settings are based " -"on Hynek Schlawack's research. (Contributed by Christian Heimes in :issue:" -"`43998`.)" +"weak RSA, DH, and ECC keys with less than 112 bits of " +"security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS " +"1.2. Settings are based on Hynek Schlawack's research. (Contributed by " +"Christian Heimes in :issue:`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" @@ -2147,68 +2740,84 @@ msgstr "sqlite3" #: ../../whatsnew/3.10.rst:1401 msgid "" -"Add audit events for :func:`~sqlite3.connect/handle`, :meth:`~sqlite3." -"Connection.enable_load_extension`, and :meth:`~sqlite3.Connection." -"load_extension`. (Contributed by Erlend E. Aasland in :issue:`43762`.)" +"Add audit events for :func:`~sqlite3.connect/" +"handle`, :meth:`~sqlite3.Connection.enable_load_extension`, " +"and :meth:`~sqlite3.Connection.load_extension`. (Contributed by Erlend E. " +"Aasland in :issue:`43762`.)" msgstr "" #: ../../whatsnew/3.10.rst:1407 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`.)" +"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`.)" +"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" @@ -2216,52 +2825,58 @@ msgstr "types" #: ../../whatsnew/3.10.rst:1449 msgid "" -"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` and :data:" -"`types.NotImplementedType` classes, providing a new set of types readily " -"interpretable by type checkers. (Contributed by Bas van Beek in :issue:" -"`41810`.)" +"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` " +"and :data:`types.NotImplementedType` classes, providing a new set of types " +"readily interpretable by type checkers. (Contributed by Bas van Beek " +"in :issue:`41810`.)" msgstr "" #: ../../whatsnew/3.10.rst:1455 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." +"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,125 +2885,167 @@ 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`.)" +"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 "" "Subclasses of ``typing.Protocol`` which only have data variables declared " "will now raise a ``TypeError`` when checked with ``isinstance`` unless they " "are decorated with :func:`~typing.runtime_checkable`. Previously, these " -"checks passed silently. Users should decorate their subclasses with the :" -"func:`!runtime_checkable` decorator if they want runtime protocols. " +"checks passed silently. Users should decorate their subclasses with " +"the :func:`!runtime_checkable` decorator if they want runtime protocols. " "(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 " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules have been deprecated since " "Python 3.8 and will be removed in a future version of Python. Anything " "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:" -"`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " -"newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:`!" -"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " -"functions internally. For more details, please see their respective " -"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " -"in :issue:`42967`.)" -msgstr "" +"as query parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their " +"respective 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:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" -msgstr "" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such 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`.)" +"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`.)" +"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`.)" +"(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 -" -"I -m module-name`` imports 69 modules on Python 3.9, whereas it only imports " -"51 modules (-18) on Python 3.10. (Contributed by Victor Stinner in :issue:" -"`41006` and :issue:`41718`.)" +"name`` command startup time is 1.4x faster in average. On Linux, ``python3 " +"-I -m module-name`` imports 69 modules on Python 3.9, whereas it only " +"imports 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,29 +3053,47 @@ 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 " "speeds builds of the Python interpreter created with :option:`--enable-" -"shared` with ``gcc`` by up to 30%. See `this article `_ for more details. (Contributed by Victor Stinner " -"and Pablo Galindo in :issue:`38980`.)" -msgstr "" - -#: ../../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." -"DecompressReader`` class. bz2 decompression is now 1.09x ~ 1.17x faster, " -"lzma decompression 1.20x ~ 1.32x faster, ``GzipFile.read(-1)`` 1.11x ~ 1.18x " -"faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:" -"`41486`)" -msgstr "" +"shared` with ``gcc`` by up to 30%. See `this article `_ 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`。)" + +msgid "" +"Use a new output buffer management code " +"for :mod:`bz2` / :mod:`lzma` / :mod:`zlib` modules, and add ``.readall()`` " +"function to ``_compression.DecompressReader`` class. bz2 decompression is " +"now 1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster, " +"``GzipFile.read(-1)`` 1.11x ~ 1.18x 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,33 +3102,51 @@ 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`.)" +"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:" -"`reversed`, :func:`bool` and :func:`float`. (Contributed by Donghee Na and " -"Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:" -"`41873` and :issue:`41870`.)" +"vectorcall calling " +"convention: :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` " +"and :func:`float`. (Contributed by Donghee Na and 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,62 +3154,85 @@ 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 " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in this release, a " "deprecation warning is raised if the numeric literal is immediately followed " -"by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:" -"`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In future releases it " -"will be changed to syntax warning, and finally to syntax error. (Contributed " -"by Serhiy Storchaka in :issue:`43833`.)" -msgstr "" +"by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In future releases it 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 "" "Starting in this release, there will be a concerted effort to begin cleaning " "up old import semantics that were kept for Python 2.7 compatibility. " -"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded by :meth:" -"`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader." -"load_module` (superseded by :meth:`~importlib.abc.Loader.exec_module`), :" -"meth:`!module_repr` (which the import system takes care of for you), the " +"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded " +"by :meth:`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader.load_module` " +"(superseded by :meth:`~importlib.abc.Loader.exec_module`), :meth:`!" +"module_repr` (which the import system takes care of for you), the " "``__package__`` attribute (superseded by ``__spec__.parent``), the " "``__loader__`` attribute (superseded by ``__spec__.loader``), and the " "``__cached__`` attribute (superseded by ``__spec__.cached``) will slowly be " -"removed (as well as other classes and methods in :mod:`importlib`). :exc:" -"`ImportWarning` and/or :exc:`DeprecationWarning` will be raised as " -"appropriate to help identify code which needs updating during this " -"transition." +"removed (as well as other classes and methods " +"in :mod:`importlib`). :exc:`ImportWarning` and/or :exc:`DeprecationWarning` " +"will be raised as appropriate to help identify code which needs updating " +"during this 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`.)" +"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`.)" +"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 "" @@ -2528,11 +3244,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:1655 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " -"now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." -"exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" +"now triggers an :exc:`ImportWarning` " +"as :meth:`~importlib.abc.Loader.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,76 +3257,124 @@ 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." -"PathEntryFinder.find_spec` is preferred. You can use :func:`importlib.util." -"spec_from_loader` to help in porting. (Contributed by Brett Cannon in :issue:" -"`43672`.)" -msgstr "" - -#: ../../whatsnew/3.10.rst:1675 -msgid "" -"The various implementations of :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` ), and :meth:`!importlib.abc." -"PathEntryFinder.find_loader` ( :meth:`!importlib.machinery.FileFinder." -"find_loader` ) now raise :exc:`DeprecationWarning` and are slated for " -"removal in Python 3.12 (previously they were documented as deprecated in " -"Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" -msgstr "" - -#: ../../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:" -"`importlib.abc.PathEntryFinder` no longer inherit from the class. Users " -"should inherit from one of these two classes as appropriate instead. " +"system now triggers an :exc:`ImportWarning` " +"as :meth:`importlib.abc.PathEntryFinder.find_spec` is preferred. You can " +"use :func:`importlib.util.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`。)" + +msgid "" +"The various implementations of :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` ), and :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` ( :meth:`!" +"importlib.machinery.FileFinder.find_loader` ) now " +"raise :exc:`DeprecationWarning` and are slated for 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`。)" + +msgid "" +":class:`!importlib.abc.Finder` is deprecated (including its sole " +"method, :meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder` no longer inherit from the class. " +"Users 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." -"set_loader_wrapper`, :func:`!importlib.util.module_for_loader`, :class:`!" -"pkgutil.ImpImporter`, and :class:`!pkgutil.ImpLoader` have all been updated " -"to list Python 3.12 as the slated version of removal (they began raising :" -"exc:`DeprecationWarning` in previous versions of Python). (Contributed by " -"Brett Cannon in :issue:`43720`.)" -msgstr "" +"importlib.util.set_package_wrapper`, :func:`!" +"importlib.util.set_loader_wrapper`, :func:`!" +"importlib.util.module_for_loader`, :class:`!pkgutil.ImpImporter`, " +"and :class:`!pkgutil.ImpLoader` have all been updated to list Python 3.12 as " +"the slated version of removal (they began raising :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 "" -":meth:`!importlib.abc.Loader.module_repr`, :meth:`!importlib.machinery." -"FrozenLoader.module_repr`, and :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` are deprecated and slated for removal in Python 3.12. " -"(Contributed by Brett Cannon in :issue:`42136`.)" +":meth:`!importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.machinery.FrozenLoader.module_repr`, and :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` are deprecated and slated for " +"removal in Python 3.12. (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`.)" +"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,164 +3383,211 @@ 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`." +"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`" +":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." +"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 " -"version of Python. Anything belonging to these submodules should be " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules will be removed in a " +"future version of Python. Anything belonging to these 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 で削除される予定です。\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`.)" +"``__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 " "the only subclass of ``ParserBase`` and its ``error()`` implementation was " -"already removed in Python 3.5. (Contributed by Berker Peksag in :issue:" -"`31844`.)" +"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`.)" +"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 +3595,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`.)" +"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:" +"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 +3674,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 +3685,40 @@ 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`.)" +"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`.)" +":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 " @@ -2890,68 +3727,84 @@ msgid "" "accesses the arguments via :func:`typing.get_args` or ``__args__`` need to " "account for this change. Furthermore, :exc:`TypeError` may be raised for " "invalid forms of parameterizing :class:`collections.abc.Callable` which may " -"have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" -msgstr "" +"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`.)" +"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." +"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 "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " -"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` and :" -"func:`exec` functions. Defining a function with ``def function(...): ...`` " -"in Python is not affected, globals cannot be overridden with this syntax: it " -"also inherits the current builtins. (Contributed by Victor Stinner in :issue:" -"`42990`.)" +"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` " +"and :func:`exec` functions. Defining a function with ``def " +"function(...): ...`` in Python is not affected, globals cannot be overridden " +"with this syntax: it also inherits the current builtins. (Contributed by " +"Victor Stinner in :issue:`42990`.)" msgstr "" #: ../../whatsnew/3.10.rst:1940 msgid "Changes in the C API" msgstr "C API の変更" -#: ../../whatsnew/3.10.rst:1942 msgid "" "The C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -2959,39 +3812,55 @@ 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` " -"module with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :" -"c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`, as sketched below. " -"(Declarations and error handling are omitted.) ::" -msgstr "" +"module " +"with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :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 "" @@ -3011,57 +3880,69 @@ msgid "" "string. This means that this number needs to be multiplied by 2 to be used " "with APIs that expect a byte offset instead (like :c:func:`PyCode_Addr2Line` " "for example). Notice as well that the :attr:`!f_lasti` member of " -"``FrameObject`` objects is not considered stable: please use :c:func:" -"`PyFrame_GetLineNumber` instead." +"``FrameObject`` objects is not considered stable: please " +"use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" #: ../../whatsnew/3.10.rst:1982 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 +3950,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." +"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,414 +3989,558 @@ 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`.)" +"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`.)" +"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`.)" +"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`.)" +"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, " "the :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now " -"implemented as opaque function calls, rather than accessing directly the :c:" -"member:`PyObject.ob_refcnt` member, if Python is built in debug mode and the " -"``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became possible to " -"support the limited C API in debug mode because the :c:type:`PyObject` " -"structure is the same in release and debug mode since Python 3.8 (see :issue:" -"`36465`)." -msgstr "" +"implemented as opaque function calls, rather than accessing directly " +"the :c:member:`PyObject.ob_refcnt` member, if Python is built in debug mode " +"and the ``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became " +"possible to support the limited C API in debug mode because " +"the :c:type:`PyObject` 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`.)" +"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:" -"`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to test if " -"an object is, respectively, the ``None`` singleton, the ``True`` singleton " -"or the ``False`` singleton. (Contributed by Victor Stinner in :issue:" -"`43753`.)" +"the *y* object, the same as ``x is y`` in Python. Add also " +"the :c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions " +"to test if an object is, respectively, the ``None`` singleton, the ``True`` " +"singleton 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." +"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 ``#``: " -"``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. See :" -"ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner in :issue:" -"`40943`.)" +"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to " +"use :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use " +"``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. " +"See :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 "" -":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" -"func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" -"`Py_GetProgramName` functions now return ``NULL`` if called before :c:func:" -"`Py_Initialize` (before Python is initialized). Use the new :ref:`init-" -"config` API to get the :ref:`init-path-config`. (Contributed by Victor " -"Stinner in :issue:`42260`.)" +":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` " +"and :c:func:`Py_GetProgramName` functions now return ``NULL`` if called " +"before :c:func:`Py_Initialize` (before Python is initialized). Use the " +"new :ref:`init-config` API to get the :ref:`init-path-config`. (Contributed " +"by Victor 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 " -"example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) = " -"x`` now fail with a compiler error. It prevents bugs like ``if " +":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 example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) " +"= x`` now fail with a compiler error. It prevents bugs like ``if " "(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." -"h``, and ``pytime.h`` have been moved to the ``Include/cpython`` directory. " -"These files must not be included directly, as they are already included in " -"``Python.h``; see :ref:`api-includes`. If they have been included directly, " -"consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :" -"issue:`35134`.)" -msgstr "" +"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, " +"``pyfpe.h``, and ``pytime.h`` have been moved to the ``Include/cpython`` " +"directory. These files must not be included directly, as they are already " +"included in ``Python.h``; see :ref:`api-includes`. If they have been " +"included directly, 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 " "type object is mutable or not; check if :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` " -"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :" -"issue:`43908`.)" +"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`" +"``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`" +"``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`" +"``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`" +"``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`.)" +"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`.)" +"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`.)" +"``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`.)" +"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 +4550,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`.)" +"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,29 +4665,42 @@ 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 " "such text, it will warn and act as if a match was not found (or for test " -"commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" -"`98966`.)" +"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 +4710,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..efa0e6a08 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 @@ -44,8 +44,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.11.rst:47 msgid "" "This article explains the new features in Python 3.11, compared to 3.10. " -"Python 3.11 was released on October 24, 2022. For full details, see the :ref:" -"`changelog `." +"Python 3.11 was released on October 24, 2022. For full details, see " +"the :ref:`changelog `." msgstr "" "この記事では Python 3.10 と比較した Python 3.11 の新機能を解説します。Python " "3.11 は2022年10月24日にリリースされました。全詳細については :ref:`変更履歴 " @@ -58,12 +58,12 @@ msgstr "概要 -- リリースハイライト" #: ../../whatsnew/3.11.rst:60 msgid "" "Python 3.11 is between 10-60% faster than Python 3.10. On average, we " -"measured a 1.25x speedup on the standard benchmark suite. See :ref:" -"`whatsnew311-faster-cpython` for details." +"measured a 1.25x speedup on the standard benchmark suite. " +"See :ref:`whatsnew311-faster-cpython` for details." msgstr "" "Python 3.11 は Python 3.10 とくらべて 10-60% 高速です。平均的には、標準ベンチ" -"マークスイートでは 1.25倍の高速化を計測しました。詳細については :ref:" -"`whatsnew311-faster-cpython` を見てください。" +"マークスイートでは 1.25倍の高速化を計測しました。詳細について" +"は :ref:`whatsnew311-faster-cpython` を見てください。" #: ../../whatsnew/3.11.rst:66 msgid "New syntax features:" @@ -95,7 +95,7 @@ msgstr "" #: ../../whatsnew/3.11.rst:79 msgid "Interpreter improvements:" -msgstr "インタープリタの改善:" +msgstr "インタプリタの改善:" #: ../../whatsnew/3.11.rst:81 msgid ":ref:`whatsnew311-pep657`" @@ -108,8 +108,8 @@ msgid "" "unsafe paths ` to :data:`sys.path`" msgstr "" "新しい :option:`-P` コマンドライン引数と :envvar:`PYTHONSAFEPATH` 環境変数に" -"より、 :ref:`安全でない可能性のあるパス ` を :" -"data:`sys.path` に自動的に先頭に付加しないようにします。" +"より、 :ref:`安全でない可能性のあるパス ` " +"を :data:`sys.path` に自動的に先頭に付加しないようにします。" #: ../../whatsnew/3.11.rst:86 msgid "New typing features:" @@ -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,13 +248,18 @@ 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 "" "Additionally, the information used by the enhanced traceback feature is made " -"available via a general API, that can be used to correlate :term:`bytecode` :" -"ref:`instructions ` with source code location. This information " -"can be retrieved using:" +"available via a general API, that can be used to " +"correlate :term:`bytecode` :ref:`instructions ` with source code " +"location. This information can be retrieved using:" msgstr "" "さらに、強化されたトレースバック機能で使用される情報は、一般的な API を介して" "利用可能になり、 :term:`bytecode` :ref:`命令 ` とソースコードの場" @@ -259,20 +281,20 @@ 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 " "for compiled Python files. To avoid storing the extra information and " "deactivate printing the extra traceback information, use the :option:`-X " -"no_debug_ranges <-X>` command line option or the :envvar:" -"`PYTHONNODEBUGRANGES` environment variable." +"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*``" @@ -281,17 +303,18 @@ msgstr "PEP 654: 例外グループと ``except*``" #: ../../whatsnew/3.11.rst:185 msgid "" ":pep:`654` introduces language features that enable a program to raise and " -"handle multiple unrelated exceptions simultaneously. The builtin types :exc:" -"`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible to group " -"exceptions and raise them together, and the new :keyword:`except* " +"handle multiple unrelated exceptions simultaneously. The builtin " +"types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible " +"to group exceptions and raise them together, and the new :keyword:`except* " "` syntax generalizes :keyword:`except` to match subgroups of " "exception groups." msgstr "" ":pep:`654` では、プログラムが無関係な複数の例外を同時に送出させて処理できるよ" -"うにする言語機能が導入されています。組み込み型 :exc:`ExceptionGroup` と :exc:" -"`BaseExceptionGroup` を使用すると、例外をグループ化して一緒に送出することがで" -"きます。また、新しい :keyword:`except* ` 構文は、 :keyword:" -"`except` を例外グループのサブグループにマッチするように一般化したものです。" +"うにする言語機能が導入されています。組み込み型 :exc:`ExceptionGroup` " +"と :exc:`BaseExceptionGroup` を使用すると、例外をグループ化して一緒に送出する" +"ことができます。また、新しい :keyword:`except* ` 構文" +"は、 :keyword:`except` を例外グループのサブグループにマッチするように一般化し" +"たものです。" #: ../../whatsnew/3.11.rst:192 msgid "See :pep:`654` for more details." @@ -340,63 +363,79 @@ msgstr "Windows ``py.exe`` ランチャーの改善" #: ../../whatsnew/3.11.rst:219 msgid "" "The copy of the :ref:`launcher` included with Python 3.11 has been " -"significantly updated. It now supports company/tag syntax as defined in :pep:" -"`514` using the :samp:`-V:{}/{}` argument instead of the " -"limited :samp:`-{}.{}`. This allows launching distributions " -"other than ``PythonCore``, the one hosted on `python.org `_." +"significantly updated. It now supports company/tag syntax as defined " +"in :pep:`514` using the :samp:`-V:{}/{}` argument instead of " +"the limited :samp:`-{}.{}`. This allows launching " +"distributions other than ``PythonCore``, the one hosted on `python.org " +"`_." msgstr "" -"Python 3.11 に含まれる :ref:`launcher` のコピーが大幅に更新されました。 :pep:" -"`514` で定義されているように、制限付きの :samp:`-{}.{}` の代わ" -"りに :samp:`-V:{}/{}` 引数を使用した company/tag 構文をサポート" -"するようになりました。これにより、 `python.org `_ で" -"ホストされている ``PythonCore`` 以外のディストリビューションを起動できるよう" -"になります。" +"Python 3.11 に含まれる :ref:`launcher` のコピーが大幅に更新されまし" +"た。 :pep:`514` で定義されているように、制限付きの :samp:`-{}." +"{}` の代わりに :samp:`-V:{}/{}` 引数を使用した company/" +"tag 構文をサポートするようになりました。これにより、 `python.org `_ でホストされている ``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``." +"\"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:`-{}.{}-{}` " -"arguments, all existing behaviour should be preserved from past versions, " +"When using the legacy :samp:`-{}`, :samp:`-{}.{}" +"`, :samp:`-{}-{}` or :samp:`-{}.{}-{}" +"` arguments, all existing behaviour should be preserved from past versions, " "and only releases from ``PythonCore`` will be selected. However, the ``-64`` " "suffix now implies \"not 32-bit\" (not necessarily x86-64), as there are " "multiple supported 64-bit platforms. 32-bit runtimes are detected by " "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." +"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." -"TypeVarTuple`, enabling parameterisation with an *arbitrary* number of " -"types. In other words, a :data:`~typing.TypeVarTuple` is a *variadic* type " -"variable, enabling *variadic* generics." +"of generics parameterised with a single type. :pep:`646` " +"adds :data:`~typing.TypeVarTuple`, enabling parameterisation with an " +"*arbitrary* number of 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 +443,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." +"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 +499,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 +541,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``::" +"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 +570,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 +614,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,30 +647,29 @@ 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 "" ":data:`~typing.dataclass_transform` may be used to decorate a class, " "metaclass, or a function that is itself a decorator. The presence of " "``@dataclass_transform()`` tells a static type checker that the decorated " -"object performs runtime \"magic\" that transforms a class, giving it :func:" -"`dataclass `-like behaviors." +"object performs runtime \"magic\" that transforms a class, giving " +"it :func:`dataclass `-like behaviors." msgstr "" #: ../../whatsnew/3.11.rst:397 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 +687,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,65 +731,92 @@ 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 " -"objects that do not support the :term:`context manager` protocol, and in :" -"keyword:`async with` statements and :meth:`contextlib.AsyncExitStack." -"enter_async_context` for objects not supporting the :term:`asynchronous " -"context manager` protocol. (Contributed by Serhiy Storchaka in :issue:" -"`12022` and :issue:`44471`.)" +"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` " +"in :keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` " +"for objects that do not support the :term:`context manager` protocol, and " +"in :keyword:`async with` statements " +"and :meth:`contextlib.AsyncExitStack.enter_async_context` for objects not " +"supporting the :term:`asynchronous 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 " -"instances of subclasses of builtin types :class:`bytearray`, :class:`set`, :" -"class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections." -"deque`, :class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies " -"and pickles instance attributes implemented as :term:`slots <__slots__>`. " -"This change has an unintended side effect: It trips up a small minority of " -"existing Python projects not expecting :meth:`object.__getstate__` to exist. " -"See the later comments on :gh:`70766` for discussions of what workarounds " -"such code may need. (Contributed by Serhiy Storchaka in :issue:`26579`.)" -msgstr "" +"instances of subclasses of builtin " +"types :class:`bytearray`, :class:`set`, :class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections.deque`, :class:`weakref.WeakSet`, " +"and :class:`datetime.tzinfo` now copies and pickles instance attributes " +"implemented as :term:`slots <__slots__>`. This change has an unintended side " +"effect: It trips up a small minority of existing Python projects not " +"expecting :meth:`object.__getstate__` to exist. 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 "" "Added a :option:`-P` command line option and a :envvar:`PYTHONSAFEPATH` " -"environment variable, which disable the automatic prepending to :data:`sys." -"path` of the script's directory when running a script, or the current " -"directory when using :option:`-c` and :option:`-m`. This ensures only stdlib " -"and installed modules are picked up by :keyword:`import`, and avoids " -"unintentionally or maliciously shadowing modules with those in a local (and " -"typically user-writable) directory. (Contributed by Victor Stinner in :gh:" -"`57684`.)" +"environment variable, which disable the automatic prepending " +"to :data:`sys.path` of the script's directory when running a script, or the " +"current directory when using :option:`-c` and :option:`-m`. This ensures " +"only stdlib and installed modules are picked up by :keyword:`import`, and " +"avoids unintentionally or maliciously shadowing modules with those in a " +"local (and typically user-writable) directory. (Contributed by Victor " +"Stinner in :gh:`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 +825,30 @@ 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`.)" +"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,41 +857,65 @@ 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." -"exc_info()[1].__traceback__``. This means that changes made to the traceback " -"in the current :keyword:`except` clause are reflected in the re-raised " -"exception. (Contributed by Irit Katriel in :issue:`45711`.)" +"no parameters, the traceback attached to this exception is now always " +"``sys.exc_info()[1].__traceback__``. This means that changes made to the " +"traceback 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 +923,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 +940,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,98 +978,134 @@ 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 " -"for all of them upon exit. For new code this is recommended over using :func:" -"`~asyncio.create_task` and :func:`~asyncio.gather` directly. (Contributed by " -"Yury Selivanov and others in :gh:`90908`.)" +"for all of them upon exit. For new code this is recommended over " +"using :func:`~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`.)" +"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`." +"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`.)" +"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." -"sock_recvfrom_into`. These have implementations in :class:`~asyncio." -"SelectorEventLoop` and :class:`~asyncio.ProactorEventLoop`. (Contributed by " -"Alex Grönholm in :issue:`46805`.)" +"Added raw datagram socket functions to the event " +"loop: :meth:`~asyncio.loop.sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` " +"and :meth:`~asyncio.loop.sock_recvfrom_into`. These have implementations " +"in :class:`~asyncio.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`.)" +"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`.)" +"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,119 +1119,154 @@ 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)." +"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 " -"the same result as :meth:`Enum.__str__() `: for enums " -"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``)." +"Changed :meth:`Enum.__format__() ` (the default " +"for :func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always " +"produce the same result as :meth:`Enum.__str__() `: for " +"enums 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." +"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." +"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 "" -"Added the :func:`~enum.property` decorator, which works like :func:" -"`property` except for enums. Use this instead of :func:`types." -"DynamicClassAttribute`." +"Added the :func:`~enum.property` decorator, which works " +"like :func:`property` except for enums. Use this instead " +"of :func:`types.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 " -"their module rather than the enum class. For example, ``'re.ASCII'`` for " -"the :const:`~re.ASCII` member of :class:`re.RegexFlag` rather than " -"``'RegexFlag.ASCII'``." +"Added the :func:`~enum.global_enum` enum decorator, which " +"adjusts :meth:`~object.__repr__` and :meth:`~object.__str__` to show values " +"as members of their module rather than the enum class. For example, " +"``'re.ASCII'`` for 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 "" -"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration and :keyword:" -"`in`/:keyword:`not in` on its members. For example, the following now works: " -"``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" +"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration " +"and :keyword:`in`/:keyword:`not in` on its members. For example, the " +"following now works: ``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" @@ -1028,11 +1274,10 @@ msgstr "functools" #: ../../whatsnew/3.11.rst:743 msgid "" -":func:`functools.singledispatch` now supports :class:`types.UnionType` and :" -"class:`typing.Union` as annotations to the dispatch argument.::" +":func:`functools.singledispatch` now supports :class:`types.UnionType` " +"and :class:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -#: ../../whatsnew/3.11.rst:746 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -1056,38 +1301,68 @@ 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 :" -"func:`zlib.compress` operation. There is one side effect of this change: The " -"gzip file header contains an \"OS\" byte in its header. That was " -"traditionally always set to a value of 255 representing \"unknown\" by the :" -"mod:`gzip` module. Now, when using :func:`~gzip.compress` with **mtime=0**, " -"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 "" +"**mtime=0** argument as it delegates the compression entirely to a " +"single :func:`zlib.compress` operation. There is one side effect of this " +"change: The gzip file header contains an \"OS\" byte in its header. That was " +"traditionally always set to a value of 255 representing \"unknown\" by " +"the :mod:`gzip` module. Now, when using :func:`~gzip.compress` with " +"**mtime=0**, 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 +1370,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`.)" +"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,288 +1434,367 @@ 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 `." +"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 "" - -#: ../../whatsnew/3.11.rst:867 -msgid "" -"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" -"class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." -"createSocket() `. It is called " -"automatically during handler initialization and when emitting an event, if " -"there is no active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" -msgstr "" +"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` での貢献。)" + +msgid "" +"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method " +"to :class:`~logging.handlers.SysLogHandler`, to " +"match :meth:`SocketHandler.createSocket() " +"`. It is called 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, -" -"math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. Previously " -"they raised :exc:`ValueError`. (Contributed by Mark Dickinson in :issue:" -"`44339`.)" +"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, " +"-math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. " +"Previously 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`.)" +"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`.)" +"``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`.)" +"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`.)" +"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`.)" +"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`. " +"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`.)" +":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`.)" +"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`.)" +"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`.)" +"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`.)" +"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`.)" +"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 " "while it is being handled, the changes are reflected in the results of " -"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel in :" -"issue:`45711`.)" +"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`.)" +"(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,39 +1807,60 @@ 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 " "on file mode). This lets them work correctly with APIs that expect file-like " -"objects, such as compression modules. (Contributed by Carey Metcalfe in :gh:" -"`70363`.)" +"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 " "the monotonic clock (:const:`time.CLOCK_MONOTONIC`) for the timeout, rather " "than using the system clock (:const:`time.CLOCK_REALTIME`), to not be " -"affected by system clock changes. (Contributed by Victor Stinner in :issue:" -"`41710`.)" +"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,96 +1868,131 @@ 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 `_ which has a resolution of " "100 nanoseconds (10\\ :sup:`-7` seconds). Previously, it had a resolution of " "1 millisecond (10\\ :sup:`-3` seconds). (Contributed by Benjamin Szőke, " -"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` and :issue:" -"`45429`.)" +"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` " +"and :issue:`45429`.)" msgstr "" +"Windows 8.1 以降の :func:`time.sleep` は、`高分解能タイマー `_ に基づく待機可能タイマーを使うようになりました。\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`.)" +"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`.)" +"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 "" @@ -1579,50 +2004,64 @@ msgstr "" msgid "" "The :func:`typing.get_overloads` function can be used for introspecting the " "overloads of a function. :func:`typing.clear_overloads` can be used to clear " -"all registered overloads of a function. (Contributed by Jelle Zijlstra in :" -"gh:`89263`.)" +"all registered overloads of a function. (Contributed by Jelle Zijlstra " +"in :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`.)" +"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`.)" +":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,30 +2074,36 @@ 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 :" -"meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of class :class:" -"`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest." -"enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" +"Added methods :meth:`~unittest.TestCase.enterContext` " +"and :meth:`~unittest.TestCase.enterClassContext` of " +"class :class:`~unittest.TestCase`, " +"method :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of " +"class :class:`~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 " @@ -1666,127 +2111,175 @@ msgid "" "installation scheme is the default. That means that downstream distributors " "can change the default sysconfig install scheme without changing behavior of " "virtual environments. Third party code that also creates new virtual " -"environments should do the same. (Contributed by Miro Hrončok in :issue:" -"`45413`.)" -msgstr "" +"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`.)" +":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 " +"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`.)" +"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." +"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`.)" +"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`.)" +"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`.)" +"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 " -"rather than converting them to a :class:`list` first. This is twice as fast " -"and can save substantial memory. (Contributed by Raymond Hettinger in :gh:" -"`90415`.)" +"The :mod:`statistics` " +"functions :func:`~statistics.mean`, :func:`~statistics.variance` " +"and :func:`~statistics.stdev` now consume iterators in one pass rather than " +"converting them to a :class:`list` first. This is twice as fast 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,163 +2287,196 @@ 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:" -"`sys._getframe` and :func:`inspect.currentframe`. For most user code, no " -"frame objects are created at all. As a result, nearly all Python functions " -"calls have sped up significantly. We measured a 3-7% speedup in " +"requested by debuggers or by Python introspection functions such " +"as :func:`sys._getframe` and :func:`inspect.currentframe`. For most user " +"code, no frame objects are created at all. As a result, nearly all Python " +"functions 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 " "1.7x speedup. This also means recursive functions can recurse significantly " -"deeper (if the user increases the recursion limit with :func:`sys." -"setrecursionlimit`). We measured a 1-3% improvement in pyperformance." +"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 " "more specialized one. This specialized operation uses fast paths available " "only to those use cases/types, which generally outperform their generic " "counterparts. This also brings in another concept called *inline caching*, " -"where Python caches the results of expensive operations directly in the :" -"term:`bytecode`." +"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 +2485,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.)" +"(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,344 +2511,340 @@ 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." +"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." +"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`." +"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 " +"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`." +"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`.)" +"\"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 " "platforms. As a result, Python 3.11 executes the `pyperformance regular " -"expression benchmarks `_ up to 10% faster than Python 3.10. (Contributed by Brandt " -"Bucher in :gh:`91404`.)" -msgstr "" +"expression benchmarks `_ 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,500 +2853,495 @@ 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`." +":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 "" "Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " -"now deprecated. It can no longer be used to wrap other descriptors such as :" -"class:`property`. The core design of this feature was flawed and caused a " -"number of downstream problems. To \"pass-through\" a :class:`classmethod`, " -"consider using the :attr:`!__wrapped__` attribute that was added in Python " -"3.10. (Contributed by Raymond Hettinger in :gh:`89519`.)" +"now deprecated. It can no longer be used to wrap other descriptors such " +"as :class:`property`. The core design of this feature was flawed and caused " +"a number of downstream problems. To \"pass-through\" " +"a :class:`classmethod`, consider using the :attr:`!__wrapped__` attribute " +"that was added in Python 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`.)" +"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:`!" "__trunc__` but not :meth:`~object.__int__` or :meth:`~object.__index__` now " -"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz in :issue:" -"`44977`.)" +"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`.)" +"(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`.)" +"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` " "documentation. It now emits a :exc:`DeprecationWarning` and will be removed " -"in Python 3.13. Use :class:`configparser.BasicInterpolation` or :class:" -"`configparser.ExtendedInterpolation` instead. (Contributed by Hugo van " -"Kemenade in :issue:`46607`.)" +"in Python 3.13. Use :class:`configparser.BasicInterpolation` " +"or :class:`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`.)" +"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 " -"digits will now be accepted as a numerical reference, and the group name in :" -"class:`bytes` patterns and replacement strings can only contain ASCII " +"digits will now be accepted as a numerical reference, and the group name " +"in :class:`bytes` patterns and replacement strings can only contain ASCII " "letters, digits and underscores. For now, a deprecation warning is raised " -"for syntax violating these rules. (Contributed by Serhiy Storchaka in :gh:" -"`91760`.)" +"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,188 +3349,186 @@ 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:" -"`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " -"and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" -"issue:`45837`.)" +"emits a deprecation warning and will be removed in Python 3.13. " +"Use :func:`turtle.tiltangle` instead (it was earlier incorrectly marked as " +"deprecated, 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 " +"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 +3538,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,152 +3693,188 @@ 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:" -"`await` code. The function has been deprecated since Python 3.8 and the " -"removal was initially scheduled for Python 3.10. Use :keyword:`async def` " -"instead. (Contributed by Illia Volochii in :issue:`43216`.)" +"generator-based coroutines to be compatible " +"with :keyword:`async` / :keyword:`await` code. The function has been " +"deprecated since Python 3.8 and the 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 " -"entirely removed. This is because of the behavior of the socket option " -"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade in :issue:" -"`45129`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is " +"now entirely removed. This is because of the behavior of the socket option " +"``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`.)" +"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 :" -"func:`!bind_textdomain_codeset` function, the :meth:`!NullTranslations." -"output_charset` and :meth:`!NullTranslations.set_output_charset` methods, " -"and the *codeset* parameter of :func:`!translation` and :func:`!install`, " -"since they are only used for the :func:`!l*gettext` functions. (Contributed " -"by Donghee Na and Serhiy Storchaka in :issue:`44235`.)" -msgstr "" +"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed " +"the :func:`!bind_textdomain_codeset` function, the :meth:`!" +"NullTranslations.output_charset` and :meth:`!" +"NullTranslations.set_output_charset` methods, and the *codeset* parameter " +"of :func:`!translation` and :func:`!install`, 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." +"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." +"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." +"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`.)" +"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`.)" +"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,115 +3882,156 @@ 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 " -"mode. In Python 3, \"universal newline\" mode is used by default whenever a " -"file is opened in text mode, and the ``'U'`` flag has been deprecated since " -"Python 3.3. The :ref:`newline parameter ` to these " -"functions controls how universal newlines work. (Contributed by Victor " -"Stinner in :issue:`37330`.)" +":func:`open`, :func:`io.open`, :func:`codecs.open` " +"and :class:`fileinput.FileInput` no longer accept ``'U'`` (\"universal " +"newline\") in the file mode. In Python 3, \"universal newline\" mode is used " +"by default whenever a file is opened in text mode, and the ``'U'`` flag has " +"been deprecated since Python 3.3. The :ref:`newline parameter ` to these 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`)" +":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. " +":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 " -"supported. Also, if the sample size is larger than the population size, a :" -"exc:`ValueError` is raised. (Contributed by Raymond Hettinger in :issue:" -"`40465`.)" +"supported. Also, if the sample size is larger than the population size, " +"a :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 "" "The *random* optional parameter of :func:`random.shuffle` was removed. It " -"was previously an arbitrary random function to use for the shuffle; now, :" -"func:`random.random` (its previous default) will always be used." +"was previously an arbitrary random function to use for the shuffle; " +"now, :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`.)" +"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 " @@ -3447,43 +4042,65 @@ msgid "" "limited subset of POSIX APIs; Python standard libraries features and modules " "related to networking, processes, threading, signals, mmap, and users/groups " "are not available or don't work. (Emscripten contributed by Christian Heimes " -"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes in :" -"gh:`90473`; platforms promoted in :gh:`95085`)" -msgstr "" +"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 `_ are not required. " -"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` and :issue:" -"`46640`.)" +"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` " +"and :issue:`46640`.)" msgstr "" +"`C11 `_ コンパイラと標準ライブラリ。\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, " @@ -3491,202 +4108,245 @@ msgid "" "detected by `pkg-config `_ (when available). :mod:`tkinter` now requires a pkg-config " "command to detect development settings for `Tcl/Tk`_ headers and libraries. " -"(Contributed by Christian Heimes and Erlend Egeberg Aasland in :issue:" -"`45847`, :issue:`45747`, and :issue:`45763`.)" +"(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`.)" +"``--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 " "test modules can be linked statically into a main binary or library. " -"(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`, :issue:" -"`45570`, :issue:`45571`, and :issue:`43974`.)" +"(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 " "platforms with ``SIZEOF_VOID_P >= 8``, and 15-bit digits otherwise. It's " -"still possible to explicitly request use of 15-bit digits via either the :" -"option:`--enable-big-digits` option to the configure script or (for Windows) " -"the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but this option " -"may be removed at some point in the future. (Contributed by Mark Dickinson " -"in :issue:`45569`.)" -msgstr "" +"still possible to explicitly request use of 15-bit digits via either " +"the :option:`--enable-big-digits` option to the configure script or (for " +"Windows) the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but " +"this option 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 "" -"Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " -"resume tracing and profiling. (Contributed by Victor Stinner in :issue:" -"`43760`.)" +"Add new :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` functions to the limited C API to " +"suspend and resume tracing and profiling. (Contributed by Victor Stinner " +"in :issue:`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`.)" +"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" +":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`.)" +"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`." +"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`. " -"These are alternatives to :c:func:`PyErr_SetExcInfo()` and :c:func:" -"`PyErr_GetExcInfo()` which work with the legacy 3-tuple representation of " -"exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" +"Added two new functions to get and set the active exception " +"instance: :c:func:`PyErr_GetHandledException` " +"and :c:func:`PyErr_SetHandledException`. These are alternatives " +"to :c:func:`PyErr_SetExcInfo()` and :c:func:`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 +4357,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,27 +4416,40 @@ 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:" -"`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " +"``co_cellvars`` and ``co_freevars`` fields. Instead, " +"use :c:func:`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " "and :c:func:`PyCode_GetFreevars` respectively to access them via the C API. " "(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 +4463,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 +4476,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 +4510,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`.)" +"(: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`)" +"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 +4558,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,17 +4585,26 @@ 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 " -"set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " +"```` no longer includes the header files ````, " +"````, ```` and ```` when the ``Py_LIMITED_API`` " +"macro is set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " "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,179 +4614,185 @@ 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." +"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:`!" -"PyFrame_FastToLocalsWithError` or :c:func:`!PyFrame_LocalsToFast`, in fact " -"they should not call those functions. The necessary updating of the frame is " -"now managed by the virtual machine." +"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* " +"call :c:func:`PyFrame_GetLocals` instead. They no longer need to " +"call :c:func:`!PyFrame_FastToLocalsWithError` or :c:func:`!" +"PyFrame_LocalsToFast`, in fact 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 +4802,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 +4822,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`)." +"``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 +4885,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,107 +4925,135 @@ 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 " -"calculate default paths and then modify them, finish initialization and use :" -"c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " +"calculate default paths and then modify them, finish initialization and " +"use :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`.)" +"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 +5119,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 +5150,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`.)" +"``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 +5212,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 +5225,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 +5310,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 +5326,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 +5335,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 +5353,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..1daa412e2 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 @@ -35,7 +35,6 @@ msgstr "著者" msgid "Raymond Hettinger" msgstr "Raymond Hettinger" -#: ../../whatsnew/3.2.rst:51 msgid "" "This article explains the new features in Python 3.2 as compared to 3.1. " "Python 3.2 was released on February 20, 2011. It focuses on a few highlights " @@ -43,6 +42,12 @@ msgid "" "github.com/python/cpython/blob/076ca6c3c8df3030307e548d9be792ce3c1c6eea/Misc/" "NEWS>`__ file." msgstr "" +"この記事では Python 3.1 と比較した Python 3.2 の新機能を説明します。\n" +"Python 3.2 は 2011 年 2 月 20 日にリリースされました。\n" +"主な変更点をいくつか取り上げ、例を示します。\n" +"すべての詳細については `Misc/NEWS `__ ファイルを参照してくだ" +"さい。" #: ../../whatsnew/3.2.rst:60 msgid ":pep:`392` - Python 3.2 Release Schedule" @@ -77,11 +82,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 公式リリースごとに再ビルドする必要があるでしょう。" @@ -104,25 +109,25 @@ msgid "" "for positional arguments (not just options), subcommands, required options " "and other common patterns of specifying and validating options." msgstr "" -"コマンドライン解析のために、新たに :mod:`argparse` モジュールが :mod:" -"`optparse` の制限を克服するものとして導入されました。optparse には (オプショ" -"ンだけでなく) 位置引数のサポートはなく、サブコマンドも作れず、必須のオプショ" -"ンやその他オプション指定と検証に共通するパターンについてのサポートもありませ" -"んでした。" +"コマンドライン解析のために、新たに :mod:`argparse` モジュール" +"が :mod:`optparse` の制限を克服するものとして導入されました。optparse には " +"(オプションだけでなく) 位置引数のサポートはなく、サブコマンドも作れず、必須の" +"オプションやその他オプション指定と検証に共通するパターンについてのサポートも" +"ありませんでした。" #: ../../whatsnew/3.2.rst:95 msgid "" "This module has already had widespread success in the community as a third-" -"party module. Being more fully featured than its predecessor, the :mod:" -"`argparse` module is now the preferred module for command-line processing. " -"The older module is still being kept available because of the substantial " -"amount of legacy code that depends on it." +"party module. Being more fully featured than its predecessor, " +"the :mod:`argparse` module is now the preferred module for command-line " +"processing. The older module is still being kept available because of the " +"substantial amount of legacy code that depends on it." msgstr "" "このモジュールはコミュニティにおいて既に広く行き渡っていたサードパーティのモ" -"ジュールでした。その先駆者たちよりももっと完全な機能性を持ったことで、 :mod:" -"`argparse` モジュールは今ではコマンドライン解析での推奨モジュールとなりまし" -"た。古いモジュールは、それに依存しているレガシーなコードが大量にあるため、今" -"後も利用可能なまま保たれます。" +"ジュールでした。その先駆者たちよりももっと完全な機能性を持ったこと" +"で、 :mod:`argparse` モジュールは今ではコマンドライン解析での推奨モジュールと" +"なりました。古いモジュールは、それに依存しているレガシーなコードが大量にある" +"ため、今後も利用可能なまま保たれます。" #: ../../whatsnew/3.2.rst:101 msgid "" @@ -134,7 +139,6 @@ msgstr "" "表示を指定し、一つ以上の位置引数があるかを検証し、必須オプションを設けている" "実例になっています::" -#: ../../whatsnew/3.2.rst:105 msgid "" "import argparse\n" "parser = argparse.ArgumentParser(\n" @@ -155,12 +159,28 @@ msgid "" "argument\n" " help = 'login as user')" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser(\n" +" description = 'Manage servers', # ヘルプの主な説明\n" +" epilog = 'Tested on Solaris and Linux') # ヘルプの後に表示\n" +"parser.add_argument('action', # 引数名\n" +" choices = ['deploy', 'start', 'stop'], # 許可する三つの値\n" +" help = 'action on each target') # ヘルプメッセージ\n" +"parser.add_argument('targets',\n" +" metavar = 'HOSTNAME', # ヘルプメッセージ内の変" +"数名\n" +" nargs = '+', # 一つ以上の対象が必要\n" +" help = 'url for target machines') # ヘルプメッセージの説" +"明\n" +"parser.add_argument('-u', '--user', # -u または --user オプ" +"ション\n" +" required = True, # 必須の引数にする\n" +" help = 'login as user')" #: ../../whatsnew/3.2.rst:120 msgid "Example of calling the parser on a command string::" msgstr "コマンド文字列とともにこのパーサを呼び出してみます::" -#: ../../whatsnew/3.2.rst:122 msgid "" ">>> cmd = 'deploy sneezy.example.com sleepy.example.com -u skycaptain'\n" ">>> result = parser.parse_args(cmd.split())\n" @@ -171,12 +191,19 @@ msgid "" ">>> result.user\n" "'skycaptain'" msgstr "" +">>> cmd = 'deploy sneezy.example.com sleepy.example.com -u skycaptain'\n" +">>> result = parser.parse_args(cmd.split())\n" +">>> result.action\n" +"'deploy'\n" +">>> result.targets\n" +"['sneezy.example.com', 'sleepy.example.com']\n" +">>> result.user\n" +"'skycaptain'" #: ../../whatsnew/3.2.rst:131 msgid "Example of the parser's automatically generated help::" msgstr "このパーサが自動的に作り出したヘルプはこのようになります::" -#: ../../whatsnew/3.2.rst:133 msgid "" ">>> parser.parse_args('-h'.split())\n" "\n" @@ -195,6 +222,22 @@ msgid "" "\n" "Tested on Solaris and Linux" msgstr "" +">>> parser.parse_args('-h'.split())\n" +"\n" +"usage: manage_cloud.py [-h] -u USER\n" +" {deploy,start,stop} HOSTNAME [HOSTNAME ...]\n" +"\n" +"Manage servers\n" +"\n" +"positional arguments:\n" +" {deploy,start,stop} action on each target\n" +" HOSTNAME url for target machines\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -u USER, --user USER login as user\n" +"\n" +"Tested on Solaris and Linux" #: ../../whatsnew/3.2.rst:150 msgid "" @@ -204,7 +247,6 @@ msgstr "" ":mod:`argparse` 機能でとりわけ素晴らしいのはサブパーサを定義出来ることです。" "それらはそれぞれ自身固有の引数パターンを持ち、ヘルプ表示をします::" -#: ../../whatsnew/3.2.rst:153 msgid "" "import argparse\n" "parser = argparse.ArgumentParser(prog='HELM')\n" @@ -222,8 +264,22 @@ msgid "" "parser_m.add_argument('-c', '--course', type=int, required=True)\n" "parser_m.add_argument('-s', '--speed', type=int, default=0)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser(prog='HELM')\n" +"subparsers = parser.add_subparsers()\n" +"\n" +"parser_l = subparsers.add_parser('launch', help='Launch Control') # 最初の" +"サブグループ\n" +"parser_l.add_argument('-m', '--missiles', action='store_true')\n" +"parser_l.add_argument('-t', '--torpedos', action='store_true')\n" +"\n" +"parser_m = subparsers.add_parser('move', help='Move Vessel', # 二つ目" +"のサブグループ\n" +" aliases=('steer', 'turn')) # 同等の" +"名前\n" +"parser_m.add_argument('-c', '--course', type=int, required=True)\n" +"parser_m.add_argument('-s', '--speed', type=int, default=0)" -#: ../../whatsnew/3.2.rst:166 msgid "" "$ ./helm.py --help # top level help (launch and " "move)\n" @@ -232,6 +288,12 @@ msgid "" "torpedos=False\n" "$ ./helm.py steer --course 180 --speed 5 # set movement parameters" msgstr "" +"$ ./helm.py --help # 最上位のヘルプ (launch と " +"move)\n" +"$ ./helm.py launch --help # launch オプションのヘルプ\n" +"$ ./helm.py launch --missiles # missiles=True と torpedos=False " +"を設定\n" +"$ ./helm.py steer --course 180 --speed 5 # 移動のパラメータを設定" #: ../../whatsnew/3.2.rst:175 msgid ":pep:`389` - New Command Line Parsing Module" @@ -243,8 +305,8 @@ msgstr "PEP written by Steven Bethard." #: ../../whatsnew/3.2.rst:178 msgid "" -":ref:`upgrading-optparse-code` for details on the differences from :mod:" -"`optparse`." +":ref:`upgrading-optparse-code` for details on the differences " +"from :mod:`optparse`." msgstr "" ":ref:`upgrading-optparse-code` に :mod:`optparse` との違いが詳しく書かれてい" "ます。" @@ -253,7 +315,6 @@ msgstr "" msgid "PEP 391: Dictionary Based Configuration for Logging" msgstr "PEP 391: logging の辞書ベースの設定" -#: ../../whatsnew/3.2.rst:184 msgid "" "The :mod:`logging` module provided two kinds of configuration, one style " "with function calls for each option or another style driven by an external " @@ -262,27 +323,32 @@ msgid "" "they support incremental configuration, which is needed for specifying " "logger options from a command line." msgstr "" +":mod:`logging` モジュールには、オプションごとに関数を呼ぶ方法" +"と、:mod:`configparser` 形式で保存した外部ファイルを使う方法の二種類の設定方" +"法がありました。\n" +"これらは JSON や YAML ファイルから設定を作る柔軟性を備えておらず、コマンドラ" +"インからロガーのオプションを指定するために必要な、設定の段階的な変更もサポー" +"トしていませんでした。" #: ../../whatsnew/3.2.rst:191 msgid "" -"To support a more flexible style, the module now offers :func:`logging." -"config.dictConfig` for specifying logging configuration with plain Python " -"dictionaries. The configuration options include formatters, handlers, " -"filters, and loggers. Here's a working example of a configuration " -"dictionary::" +"To support a more flexible style, the module now " +"offers :func:`logging.config.dictConfig` for specifying logging " +"configuration with plain Python dictionaries. The configuration options " +"include formatters, handlers, filters, and loggers. Here's a working " +"example of a configuration dictionary::" msgstr "" -"もっと柔軟な設定をサポートするために、新たに :func:`logging.config." -"dictConfig` が追加されました。これはロギングの設定を通常の Python 辞書で指定" -"します。設定オプションにはフォーマッタ、ハンドラ、フィルタ、そしてロガーが含" -"まれます。以下は設定辞書の動作する実例です::" +"もっと柔軟な設定をサポートするために、新た" +"に :func:`logging.config.dictConfig` が追加されました。これはロギングの設定を" +"通常の Python 辞書で指定します。設定オプションにはフォーマッタ、ハンドラ、" +"フィルタ、そしてロガーが含まれます。以下は設定辞書の動作する実例です::" -#: ../../whatsnew/3.2.rst:197 msgid "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -298,6 +364,25 @@ msgid "" " \"root\": {\"level\": \"DEBUG\", \"handlers\": [\"console\", " "\"console_priority\"]}}" msgstr "" +"{\"version\": 1,\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" +" },\n" +" \"handlers\": {\"console\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"formatter\": \"brief\",\n" +" \"level\": \"INFO\",\n" +" \"stream\": \"ext://sys.stdout\"},\n" +" \"console_priority\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"formatter\": \"full\",\n" +" \"level\": \"ERROR\",\n" +" \"stream\": \"ext://sys.stderr\"}\n" +" },\n" +" \"root\": {\"level\": \"DEBUG\", \"handlers\": [\"console\", " +"\"console_priority\"]}}" #: ../../whatsnew/3.2.rst:215 msgid "" @@ -307,7 +392,6 @@ msgstr "" "その辞書が :file:`conf.json` ファイルに格納されているのであれば、コードからこ" "のように呼び出してロード出来ます::" -#: ../../whatsnew/3.2.rst:218 msgid "" ">>> import json, logging.config\n" ">>> with open('conf.json') as f:\n" @@ -319,6 +403,15 @@ msgid "" ">>> logging.critical(\"Abnormal termination\")\n" "2011-02-17 11:14:36,694 root CRITICAL Abnormal termination" msgstr "" +">>> import json, logging.config\n" +">>> with open('conf.json') as f:\n" +"... conf = json.load(f)\n" +"...\n" +">>> logging.config.dictConfig(conf)\n" +">>> logging.info(\"Transaction completed normally\")\n" +"INFO : root : Transaction completed normally\n" +">>> logging.critical(\"Abnormal termination\")\n" +"2011-02-17 11:14:36,694 root CRITICAL Abnormal termination" #: ../../whatsnew/3.2.rst:230 msgid ":pep:`391` - Dictionary Based Configuration for Logging" @@ -346,19 +439,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:241 msgid "" -"The design for :mod:`concurrent.futures` was inspired by the *java.util." -"concurrent* package. In that model, a running call and its result are " -"represented by a :class:`~concurrent.futures.Future` object that abstracts " -"features common to threads, processes, and remote procedure calls. That " -"object supports status checks (running or done), timeouts, cancellations, " -"adding callbacks, and access to results or exceptions." +"The design for :mod:`concurrent.futures` was inspired by the " +"*java.util.concurrent* package. In that model, a running call and its " +"result are represented by a :class:`~concurrent.futures.Future` object that " +"abstracts features common to threads, processes, and remote procedure " +"calls. That object supports status checks (running or done), timeouts, " +"cancellations, adding callbacks, and access to results or exceptions." msgstr "" ":mod:`concurrent.futures` の設計は Java の *java.util.concurrent* パッケージ" -"に触発されました。そのモデルでは、実行する呼び出しとその結果は :class:" -"`~concurrent.futures.Future` オブジェクトで表現され、これはスレッド、プロセ" -"ス、遠隔手続呼び出しの共通的な側面を抽象化しています。そのオブジェクトはス" -"テータスのチェック (実行中あるいは完了かどうか)、タイムアウト、キャンセル、" -"コールバックの追加、そして結果や例外へのアクセスをサポートします。" +"に触発されました。そのモデルでは、実行する呼び出しとその結果" +"は :class:`~concurrent.futures.Future` オブジェクトで表現され、これはスレッ" +"ド、プロセス、遠隔手続呼び出しの共通的な側面を抽象化しています。そのオブジェ" +"クトはステータスのチェック (実行中あるいは完了かどうか)、タイムアウト、キャン" +"セル、コールバックの追加、そして結果や例外へのアクセスをサポートします。" #: ../../whatsnew/3.2.rst:248 msgid "" @@ -390,33 +483,34 @@ msgstr "" #: ../../whatsnew/3.2.rst:260 msgid "" -"Both classes share a common interface with three methods: :meth:`~concurrent." -"futures.Executor.submit` for scheduling a callable and returning a :class:" -"`~concurrent.futures.Future` object; :meth:`~concurrent.futures.Executor." -"map` for scheduling many asynchronous calls at a time, and :meth:" -"`~concurrent.futures.Executor.shutdown` for freeing resources. The class is " -"a :term:`context manager` and can be used in a :keyword:`with` statement to " -"assure that resources are automatically released when currently pending " -"futures are done executing." +"Both classes share a common interface with three " +"methods: :meth:`~concurrent.futures.Executor.submit` for scheduling a " +"callable and returning a :class:`~concurrent.futures.Future` " +"object; :meth:`~concurrent.futures.Executor.map` for scheduling many " +"asynchronous calls at a time, " +"and :meth:`~concurrent.futures.Executor.shutdown` for freeing resources. " +"The class is a :term:`context manager` and can be used in a :keyword:`with` " +"statement to assure that resources are automatically released when currently " +"pending futures are done executing." msgstr "" "どちらの executor クラスとも 3 つのメソッドを持つ共通インターフェイスを持ちま" "す。 :meth:`~concurrent.futures.Executor.submit` メソッドは呼び出し可能オブ" "ジェクトをスケジュールし、 :class:`~concurrent.futures.Future` オブジェクトを" "返します。 :meth:`~concurrent.futures.Executor.map` メソッドは一気に複数の非" -"同期呼び出しをスケジュールします。 :meth:`~concurrent.futures.Executor." -"shutdown` メソッドはリソースを解放します。これらクラスは :term:`context " -"manager` なので :keyword:`with` 文とともに使うことが出来、現時点で保留中の " -"future が実行を終えた際にリソースが自動的に解放されることを保障出来ます。" +"同期呼び出しをスケジュールしま" +"す。 :meth:`~concurrent.futures.Executor.shutdown` メソッドはリソースを解放し" +"ます。これらクラスは :term:`context manager` なので :keyword:`with` 文ととも" +"に使うことが出来、現時点で保留中の future が実行を終えた際にリソースが自動的" +"に解放されることを保障出来ます。" #: ../../whatsnew/3.2.rst:269 msgid "" "A simple of example of :class:`~concurrent.futures.ThreadPoolExecutor` is a " "launch of four parallel threads for copying files::" msgstr "" -"以下はファイルコピーを行う 4 つの並列スレッドを実行する、 :class:" -"`~concurrent.futures.ThreadPoolExecutor` の単純な使用例です::" +"以下はファイルコピーを行う 4 つの並列スレッドを実行す" +"る、 :class:`~concurrent.futures.ThreadPoolExecutor` の単純な使用例です::" -#: ../../whatsnew/3.2.rst:272 msgid "" "import concurrent.futures, shutil\n" "with concurrent.futures.ThreadPoolExecutor(max_workers=4) as e:\n" @@ -425,6 +519,12 @@ msgid "" " e.submit(shutil.copy, 'src3.txt', 'dest3.txt')\n" " e.submit(shutil.copy, 'src3.txt', 'dest4.txt')" msgstr "" +"import concurrent.futures, shutil\n" +"with concurrent.futures.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, 'src3.txt', 'dest4.txt')" #: ../../whatsnew/3.2.rst:281 msgid ":pep:`3148` - Futures -- Execute Computations Asynchronously" @@ -445,8 +545,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:287 msgid "" ":ref:`Code for computing prime numbers in parallel`, an example demonstrating :class:`~concurrent.futures." -"ProcessPoolExecutor`." +"example>`, an example " +"demonstrating :class:`~concurrent.futures.ProcessPoolExecutor`." msgstr "" ":class:`~concurrent.futures.ProcessPoolExecutor` の実例を :ref:`並列で素数計" "算するコード例 ` として挙げています。" @@ -487,18 +587,19 @@ msgid "" "To solve this problem, Python's import machinery has been extended to use " "distinct filenames for each interpreter. Instead of Python 3.2 and Python " "3.3 and Unladen Swallow each competing for a file called \"mymodule.pyc\", " -"they will now look for \"mymodule.cpython-32.pyc\", \"mymodule.cpython-33." -"pyc\", and \"mymodule.unladen10.pyc\". And to prevent all of these new " -"files from cluttering source directories, the *pyc* files are now collected " -"in a \"__pycache__\" directory stored under the package directory." +"they will now look for \"mymodule.cpython-32.pyc\", " +"\"mymodule.cpython-33.pyc\", and \"mymodule.unladen10.pyc\". And to prevent " +"all of these new files from cluttering source directories, the *pyc* files " +"are now collected in a \"__pycache__\" directory stored under the package " +"directory." msgstr "" "この問題を解決するために、Python のインポート機構はそれぞれのインタプリタごと" "に区別された名前を使うように拡張されました。Python 3.2、Python 3.3、 Unladen " "Swallow でそれぞれ競合するファイル名 \"mymodule.pyc\" を使うのではなく、それ" -"ぞれ \"mymodule.cpython-32.pyc\", \"mymodule.cpython-33.pyc\", \"mymodule." -"unladen10.pyc\" を使うようになりました。同時にこれらの新しいファイルがソース" -"ディレクトリを散らかすのを防ぐために、 *pyc* ファイルはパッケージディレクトリ" -"の下の \"__pycache__\" ディレクトリに収集するようになりました。" +"ぞれ \"mymodule.cpython-32.pyc\", \"mymodule.cpython-33.pyc\", " +"\"mymodule.unladen10.pyc\" を使うようになりました。同時にこれらの新しいファイ" +"ルがソースディレクトリを散らかすのを防ぐために、 *pyc* ファイルはパッケージ" +"ディレクトリの下の \"__pycache__\" ディレクトリに収集するようになりました。" #: ../../whatsnew/3.2.rst:312 msgid "" @@ -514,18 +615,22 @@ msgid "" "stores the name of the actual file that was imported:" msgstr "" -#: ../../whatsnew/3.2.rst:322 msgid "" "The tag that is unique to each interpreter is accessible from the :mod:`!" "imp` module:" msgstr "" +"キャッシュファイル名を一意にするためのインタプリタ実装ごとのタグは :mod:`!" +"imp` モジュールからアクセス出来ます:" -#: ../../whatsnew/3.2.rst:329 msgid "" "Scripts that try to deduce source filename from the imported file now need " "to be smarter. It is no longer sufficient to simply strip the \"c\" from a " "\".pyc\" filename. Instead, use the new functions in the :mod:`!imp` module:" msgstr "" +"インポートされたファイルからソースファイル名を推測しようとするスクリプトは、" +"以前より賢くなる必要があります。\n" +"もはや \".pyc\" ファイル名から末尾の \"c\" を取り除くだけでは不十分です。\n" +"そうではなくて :mod:`!imp` モジュール内の新規関数を使いましょう:" #: ../../whatsnew/3.2.rst:338 msgid "" @@ -541,7 +646,6 @@ msgstr "" "とディレクトリのリストを指定します。 ``-b`` はバイトコードファイルを " "*__pycache__* ではなく伝統的な場所に書き出します。" -#: ../../whatsnew/3.2.rst:345 msgid "" "The :mod:`importlib.abc` module has been updated with new :term:`abstract " "base classes ` for loading bytecode files. The " @@ -549,6 +653,10 @@ msgid "" "deprecated (instructions on how to stay Python 3.1 compatible are included " "with the documentation)." msgstr "" +":mod:`importlib.abc` モジュールに、バイトコードファイルの読み込み用の新し" +"い :term:`抽象基底クラス ` が追加されました。\n" +"古い ABC の :class:`!PyLoader` と :class:`!PyPycLoader` は非推奨になりました " +"(Python 3.1 との互換性を保つ方法はドキュメントに記載されています)。" #: ../../whatsnew/3.2.rst:353 msgid ":pep:`3147` - PYC Repository Directories" @@ -589,21 +697,21 @@ msgstr "" "ケージ \"foo\" について、配布パッケージがインストールされるとこれらファイルは" "例えばこのような具合でしょう::" -#: ../../whatsnew/3.2.rst:370 msgid "" "/usr/share/pyshared/foo.cpython-32m.so\n" "/usr/share/pyshared/foo.cpython-33md.so" msgstr "" +"/usr/share/pyshared/foo.cpython-32m.so\n" +"/usr/share/pyshared/foo.cpython-33md.so" #: ../../whatsnew/3.2.rst:373 msgid "" -"In Python itself, the tags are accessible from functions in the :mod:" -"`sysconfig` module::" +"In Python itself, the tags are accessible from functions in " +"the :mod:`sysconfig` module::" msgstr "" "Python 自身からこのタグに、 :mod:`sysconfig` モジュールにある関数でアクセス出" "来ます::" -#: ../../whatsnew/3.2.rst:376 msgid "" ">>> import sysconfig\n" ">>> sysconfig.get_config_var('SOABI') # find the version tag\n" @@ -612,6 +720,12 @@ msgid "" "extension\n" "'.cpython-32mu.so'" msgstr "" +">>> import sysconfig\n" +">>> sysconfig.get_config_var('SOABI') # バージョンタグを取得\n" +"'cpython-32mu'\n" +">>> sysconfig.get_config_var('EXT_SUFFIX') # ファイル名の完全な拡張子を取" +"得\n" +"'.cpython-32mu.so'" #: ../../whatsnew/3.2.rst:384 msgid ":pep:`3149` - ABI Version Tagged .so Files" @@ -643,7 +757,6 @@ msgstr "" "イティブ文字列(native strings)* と、リクエストとレスポンスのボディに使われる " "*バイト列文字列(byte strings)* を区別します。" -#: ../../whatsnew/3.2.rst:400 msgid "" "The *native strings* are always of type :class:`str` but are restricted to " "code points between *U+0000* through *U+00FF* which are translatable to " @@ -653,6 +766,14 @@ msgid "" "respect to encoding. That is, they must either be *ISO-8859-1* characters or " "use :rfc:`2047` MIME encoding." msgstr "" +"*ネイティブ文字列* は常に :class:`str` 型ですが、コードポイント *U+0000* か" +"ら *U+00FF* までの間に制限され、これは *Latin-1* エンコーディングを使ったバイ" +"ト列に変換可能です。\n" +"これら文字列は環境変数辞書のキーと値や、 :func:`!start_response` 関数内でのレ" +"スポンスヘッダとステータスで使われます。\n" +"これらはエンコーディングに関して :rfc:`2616` に従わなければなりません。\n" +"つまりこれらは *ISO-8859-1* 文字であるか、 :rfc:`2047` MIME エンコーディング" +"を使わなければなりません。" #: ../../whatsnew/3.2.rst:408 msgid "" @@ -684,14 +805,17 @@ msgstr "" "変換する必要があります。(---訳注: この原文は h が元々 latin-1 で表現出来る文" "字セットであることを暗黙で仮定しているようです。---)" -#: ../../whatsnew/3.2.rst:418 msgid "" "Values yielded by an application or sent using the :meth:`!write` method " "must be byte strings. The :func:`!start_response` function and environ must " "use native strings. The two cannot be mixed." msgstr "" +"アプリケーションから生み出される値と :meth:`!write` メソッドで送信される値" +"は、バイト列文字列でなければなりません。\n" +":func:`!start_response` 関数と環境変数はネイティブ文字列を使わなければなりま" +"せん。\n" +"これら 2 つは混ぜこぜには出来ません。" -#: ../../whatsnew/3.2.rst:422 msgid "" "For server implementers writing CGI-to-WSGI pathways or other CGI-style " "protocols, the users must to be able access the environment using native " @@ -701,6 +825,13 @@ msgid "" "variables from :data:`os.environ` into native strings and returning a new " "dictionary." msgstr "" +"CGI-to-WSGI 経路やほかの CGI スタイルのプロトコルへの経路を書くサーバ実装者に" +"とっては、彼らのユーザは前提としているプラットフォームの慣習がどうであれネイ" +"ティブ文字列を使って環境変数にアクセス出来なければなりません。\n" +"この溝への橋渡しのために、 :mod:`wsgiref` モジュールに新規関" +"数 :func:`wsgiref.handlers.read_environ` が追加されました。\n" +"これは CGI 変数を :data:`os.environ` からネイティブ文字列に変換して、新しい辞" +"書として返します。" #: ../../whatsnew/3.2.rst:431 msgid ":pep:`3333` - Python Web Server Gateway Interface v1.0.1" @@ -743,22 +874,21 @@ msgid "" "There is also a new :meth:`str.format_map` method that extends the " "capabilities of the existing :meth:`str.format` method by accepting " "arbitrary :term:`mapping` objects. This new method makes it possible to use " -"string formatting with any of Python's many dictionary-like objects such as :" -"class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:" -"`~configparser.ConfigParser`, or :mod:`dbm`. It is also useful with custom :" -"class:`dict` subclasses that normalize keys before look-up or that supply a :" -"meth:`__missing__` method for unknown keys::" +"string formatting with any of Python's many dictionary-like objects such " +"as :class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:`~configparser.ConfigParser`, " +"or :mod:`dbm`. It is also useful with custom :class:`dict` subclasses that " +"normalize keys before look-up or that supply a :meth:`__missing__` method " +"for unknown keys::" msgstr "" "新たに追加された :meth:`str.format_map` メソッドも既存の :meth:`str.format` " "メソッドの能力を拡大します。これは任意の :term:`mapping` を受け付けます。この" "新規メソッドは Python の数多くの「辞書的な」オブジェクトとともに文字列書式化" -"を使うことを可能にします。たとえば :class:`~collections.defaultdict`, :class:" -"`~shelve.Shelf`, :class:`~configparser.ConfigParser`, あるいは :mod:`dbm` な" -"どで使えるということです。カスタムな :class:`dict` のサブクラスと一緒に使うの" -"も便利で、例えばルックアップの前にキーを正規化してみたり、未知のキーを :meth:" -"`__missing__` メソッドで補ってみたりなど出来ます::" +"を使うことを可能にします。たとえ" +"ば :class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:`~configparser.ConfigParser`, " +"あるいは :mod:`dbm` などで使えるということです。カスタムな :class:`dict` のサ" +"ブクラスと一緒に使うのも便利で、例えばルックアップの前にキーを正規化してみた" +"り、未知のキーを :meth:`__missing__` メソッドで補ってみたりなど出来ます::" -#: ../../whatsnew/3.2.rst:463 msgid "" ">>> import shelve\n" ">>> d = shelve.open('tmp.shl')\n" @@ -780,24 +910,46 @@ msgid "" ">>> 'Hello {name}, welcome to {location}'.format_map(PlaceholderDict())\n" "'Hello , welcome to '" msgstr "" +">>> import shelve\n" +">>> d = shelve.open('tmp.shl')\n" +">>> 'The {project_name} status is {status} as of {date}'.format_map(d)\n" +"'The testing project status is green as of February 15, 2011'\n" +"\n" +">>> class LowerCasedDict(dict):\n" +"... def __getitem__(self, key):\n" +"... return dict.__getitem__(self, key.lower())\n" +"...\n" +">>> lcd = LowerCasedDict(part='widgets', quantity=10)\n" +">>> 'There are {QUANTITY} {Part} in stock'.format_map(lcd)\n" +"'There are 10 widgets in stock'\n" +"\n" +">>> class PlaceholderDict(dict):\n" +"... def __missing__(self, key):\n" +"... return '<{}>'.format(key)\n" +"...\n" +">>> 'Hello {name}, welcome to {location}'.format_map(PlaceholderDict())\n" +"'Hello , welcome to '" #: ../../whatsnew/3.2.rst:483 msgid "" -"(Suggested by Raymond Hettinger and implemented by Eric Smith in :issue:" -"`6081`.)" +"(Suggested by Raymond Hettinger and implemented by Eric Smith " +"in :issue:`6081`.)" msgstr "" -"(Suggested by Raymond Hettinger and implemented by Eric Smith in :issue:" -"`6081`.)" +"(Suggested by Raymond Hettinger and implemented by Eric Smith " +"in :issue:`6081`.)" -#: ../../whatsnew/3.2.rst:486 msgid "" "The interpreter can now be started with a quiet option, ``-q``, to prevent " "the copyright and version information from being displayed in the " -"interactive mode. The option can be introspected using the :data:`sys." -"flags` attribute:" +"interactive mode. The option can be introspected using " +"the :data:`sys.flags` attribute:" msgstr "" +"インタープリタを静かに起動出来るようになりました。\n" +"``-q`` オプションを与えると対話モード起動時の著作権とバージョン情報表示を抑制" +"します。\n" +"このオプションは :data:`sys.flags` 属性で調べることが出来ます。\n" +":" -#: ../../whatsnew/3.2.rst:490 msgid "" "$ python -q\n" ">>> sys.flags\n" @@ -805,23 +957,35 @@ msgid "" "optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0,\n" "ignore_environment=0, verbose=0, bytes_warning=0, quiet=1)" msgstr "" +"$ python -q\n" +">>> sys.flags\n" +"sys.flags(debug=0, division_warning=0, inspect=0, interactive=0,\n" +"optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0,\n" +"ignore_environment=0, verbose=0, bytes_warning=0, quiet=1)" #: ../../whatsnew/3.2.rst:498 msgid "(Contributed by Marcin Wojdyr in :issue:`1772833`)." msgstr "(Contributed by Marcin Wojdyr in :issue:`1772833`)." -#: ../../whatsnew/3.2.rst:500 msgid "" "The :func:`hasattr` function works by calling :func:`getattr` and detecting " "whether an exception is raised. This technique allows it to detect methods " -"created dynamically by :meth:`~object.__getattr__` or :meth:`~object." -"__getattribute__` which would otherwise be absent from the class " -"dictionary. Formerly, *hasattr* would catch any exception, possibly masking " -"genuine errors. Now, *hasattr* has been tightened to only catch :exc:" -"`AttributeError` and let other exceptions pass through::" -msgstr "" +"created dynamically by :meth:`~object.__getattr__` " +"or :meth:`~object.__getattribute__` which would otherwise be absent from the " +"class dictionary. Formerly, *hasattr* would catch any exception, possibly " +"masking genuine errors. Now, *hasattr* has been tightened to only " +"catch :exc:`AttributeError` and let other exceptions pass through::" +msgstr "" +":func:`hasattr` 関数は :func:`getattr` を呼び出し、例外が発生するかどうかを調" +"べます。\n" +"これにより、クラスの辞書には存在しない、:meth:`~object.__getattr__` " +"や :meth:`~object.__getattribute__` によって動的に作成されるメソッドも検出で" +"きます。\n" +"以前の *hasattr* はすべての例外を捕捉し、実際のエラーを隠す可能性がありまし" +"た。\n" +"現在は *hasattr* が捕捉する例外を :exc:`AttributeError` だけに限定し、他の例" +"外をそのまま伝播するようにしています。 ::" -#: ../../whatsnew/3.2.rst:508 msgid "" ">>> class A:\n" "... @property\n" @@ -834,6 +998,16 @@ msgid "" " ...\n" "ZeroDivisionError: integer division or modulo by zero" msgstr "" +">>> class A:\n" +"... @property\n" +"... def f(self):\n" +"... return 1 // 0\n" +"...\n" +">>> a = A()\n" +">>> hasattr(a, 'f')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: integer division or modulo by zero" #: ../../whatsnew/3.2.rst:519 msgid "" @@ -843,28 +1017,31 @@ msgstr "" #: ../../whatsnew/3.2.rst:521 msgid "" -"The :func:`str` of a float or complex number is now the same as its :func:" -"`repr`. Previously, the :func:`str` form was shorter but that just caused " -"confusion and is no longer needed now that the shortest possible :func:" -"`repr` is displayed by default:" +"The :func:`str` of a float or complex number is now the same as " +"its :func:`repr`. Previously, the :func:`str` form was shorter but that just " +"caused confusion and is no longer needed now that the shortest " +"possible :func:`repr` is displayed by default:" 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`.)" msgstr "(Proposed and implemented by Mark Dickinson; :issue:`9337`.)" -#: ../../whatsnew/3.2.rst:534 msgid "" ":class:`memoryview` objects now have a :meth:`~memoryview.release` method " "and they also now support the context management protocol. This allows " "timely release of any resources that were acquired when requesting a buffer " "from the original object." msgstr "" +":class:`memoryview` オブジェクトに :meth:`~memoryview.release` メソッドが追加" +"され、コンテキスト管理プロトコルもサポートするようになりました。\n" +"これにより、元のオブジェクトからバッファーを要求するときに取得したリソース" +"を、適切なタイミングで解放できます。" #: ../../whatsnew/3.2.rst:543 msgid "(Added by Antoine Pitrou; :issue:`9757`.)" @@ -878,7 +1055,6 @@ msgstr "" "以前は、入れ子になったブロック内である名前が自由変数として現れる場合、局所名" "前空間からその名前を削除することは不正でした。" -#: ../../whatsnew/3.2.rst:548 msgid "" "def outer(x):\n" " def inner():\n" @@ -886,6 +1062,11 @@ msgid "" " inner()\n" " del x" msgstr "" +"def outer(x):\n" +" def inner():\n" +" return x\n" +" inner()\n" +" del x" #: ../../whatsnew/3.2.rst:554 msgid "" @@ -898,7 +1079,6 @@ msgstr "" "Python 2.6 では動き、Python 3.1 では :exc:`SyntaxError` を送出するこのコード" "は再び動きます::" -#: ../../whatsnew/3.2.rst:558 msgid "" "def f():\n" " def print_error():\n" @@ -909,20 +1089,34 @@ msgid "" " print_error()\n" " # implicit \"del e\" here" msgstr "" +"def f():\n" +" def print_error():\n" +" print(e)\n" +" try:\n" +" something\n" +" except Exception as e:\n" +" print_error()\n" +" # ここで暗黙に \"del e\"" #: ../../whatsnew/3.2.rst:567 msgid "(See :issue:`4617`.)" msgstr "(:issue:`4617` を参照してください。)" -#: ../../whatsnew/3.2.rst:569 msgid "" ":ref:`Struct sequence types ` are now subclasses of " -"tuple. This means that C structures like those returned by :func:`os.stat`, :" -"func:`time.gmtime`, and :data:`sys.version_info` now work like a :term:" -"`named tuple` and now work with functions and methods that expect a tuple as " -"an argument. This is a big step forward in making the C structures as " -"flexible as their pure Python counterparts:" -msgstr "" +"tuple. This means that C structures like those returned " +"by :func:`os.stat`, :func:`time.gmtime`, and :data:`sys.version_info` now " +"work like a :term:`named tuple` and now work with functions and methods that " +"expect a tuple as an argument. This is a big step forward in making the C " +"structures as flexible as their pure Python counterparts:" +msgstr "" +":ref:`構造体シーケンス型 ` がタプルのサブクラスにな" +"りました。\n" +"これにより、:func:`os.stat`、:func:`time.gmtime`、:data:`sys.version_info` が" +"返すような C 構造体が :term:`named tuple` として動作し、タプルを引数として受" +"け取る関数やメソッドで使えるようになります。\n" +"これは、C 構造体を Python で書かれた対応する型と同じくらい柔軟に使えるように" +"するための大きな前進です。" #: ../../whatsnew/3.2.rst:582 msgid "" @@ -937,21 +1131,22 @@ msgid "" "Warnings are now easier to control using the :envvar:`PYTHONWARNINGS` " "environment variable as an alternative to using ``-W`` at the command line:" msgstr "" -"警告の制御を以前より簡単に出来るようになりました。環境変数 :envvar:" -"`PYTHONWARNINGS` を使えば、コマンドラインで ``-W`` を使うより簡単です:" +"警告の制御を以前より簡単に出来るようになりました。環境変" +"数 :envvar:`PYTHONWARNINGS` を使えば、コマンドラインで ``-W`` を使うより簡単" +"です:" -#: ../../whatsnew/3.2.rst:588 msgid "" "$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" msgstr "" +"$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" #: ../../whatsnew/3.2.rst:592 msgid "" -"(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" -"`7301`.)" +"(Suggested by Barry Warsaw and implemented by Philip Jenvey " +"in :issue:`7301`.)" msgstr "" -"(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" -"`7301`.)" +"(Suggested by Barry Warsaw and implemented by Philip Jenvey " +"in :issue:`7301`.)" #: ../../whatsnew/3.2.rst:594 msgid "" @@ -964,16 +1159,22 @@ msgstr "" "新たな警告カテゴリ :exc:`ResourceWarning` が追加されました。これはリソース消" "費やクリーンアップについての潜在的な問題が検出されると発行されます。これは通" "常のリリースビルドではデフォルトでは黙殺しますが、 :mod:`warnings` モジュール" -"で意味付けを変更 (訳注: :ref:`warning-filter` 参照) するかコマンドラインオプ" -"ションで有効に出来ます。" +"で意味付けを変更 (訳注: 警告フィルタ参照) するかコマンドラインオプションで有" +"効に出来ます。" -#: ../../whatsnew/3.2.rst:600 msgid "" -"A :exc:`ResourceWarning` is issued at interpreter shutdown if the :data:`gc." -"garbage` list isn't empty, and if :const:`gc.DEBUG_UNCOLLECTABLE` is set, " -"all uncollectable objects are printed. This is meant to make the programmer " -"aware that their code contains object finalization issues." +"A :exc:`ResourceWarning` is issued at interpreter shutdown if " +"the :data:`gc.garbage` list isn't empty, and " +"if :const:`gc.DEBUG_UNCOLLECTABLE` is set, all uncollectable objects are " +"printed. This is meant to make the programmer aware that their code " +"contains object finalization issues." msgstr "" +":exc:`ResourceWarning` はインタプリタがシャットダウンする時点" +"で :data:`gc.garbage` リストが空でない場合に発行されます。\n" +"その際に :const:`gc.DEBUG_UNCOLLECTABLE` がセットされていれば、全ての回収不能" +"オブジェクトが印字されます。\n" +"このことによりプログラマは、自身のコードがオブジェクトのファイナライズに問題" +"を抱えていることに気付くことが出来ます。" #: ../../whatsnew/3.2.rst:605 msgid "" @@ -990,34 +1191,44 @@ msgstr "" "のデアロケートの遅れは様々な問題を産み落とし、とりわけ Windows でこれは顕著で" "す。コマンドラインからこの警告を有効にするには例えばこのようにします:" -#: ../../whatsnew/3.2.rst:612 msgid "" "$ python -q -Wdefault\n" ">>> f = open(\"foo\", \"wb\")\n" ">>> del f\n" "__main__:1: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>" msgstr "" +"$ python -q -Wdefault\n" +">>> f = open(\"foo\", \"wb\")\n" +">>> del f\n" +"__main__:1: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>" #: ../../whatsnew/3.2.rst:619 msgid "" -"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" -"`477863`.)" +"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` " +"and :issue:`477863`.)" msgstr "" -"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" -"`477863`.)" +"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` " +"and :issue:`477863`.)" -#: ../../whatsnew/3.2.rst:621 msgid "" ":class:`range` objects now support *index* and *count* methods. This is part " -"of an effort to make more objects fully implement the :class:`collections." -"Sequence ` :term:`abstract base class`. As a " -"result, the language will have a more uniform API. In addition, :class:" -"`range` objects now support slicing and negative indices, even with values " -"larger than :data:`sys.maxsize`. This makes *range* more interoperable with " -"lists::" -msgstr "" +"of an effort to make more objects fully implement " +"the :class:`collections.Sequence ` :term:`abstract " +"base class`. As a result, the language will have a more uniform API. In " +"addition, :class:`range` objects now support slicing and negative indices, " +"even with values larger than :data:`sys.maxsize`. This makes *range* more " +"interoperable with lists::" +msgstr "" +":class:`range` オブジェクトが *index* メソッド、 *count* メソッドをサポートす" +"るようになりました。\n" +"これは、もっと多くのオブジェクトに :term:`抽象基底クラス ` :class:`collections.Sequence ` を完全に実装" +"しようとする取り組みの一環です。\n" +"結果として言語はより統一的な API を持つようになりました。\n" +"加えて :class:`range` オブジェクトは今やスライシングをサポートし、負のインデ" +"クス、 :data:`sys.maxsize` を超えるインデクスもサポートします。\n" +"このことは *range* とリストの相互運用性を高めます。" -#: ../../whatsnew/3.2.rst:628 msgid "" ">>> range(0, 100, 2).count(10)\n" "1\n" @@ -1028,6 +1239,14 @@ msgid "" ">>> range(0, 100, 2)[0:5]\n" "range(0, 10, 2)" msgstr "" +">>> range(0, 100, 2).count(10)\n" +"1\n" +">>> range(0, 100, 2).index(10)\n" +"5\n" +">>> range(0, 100, 2)[5]\n" +"10\n" +">>> range(0, 100, 2)[0:5]\n" +"range(0, 10, 2)" #: ../../whatsnew/3.2.rst:637 msgid "" @@ -1077,13 +1296,17 @@ msgid "" "quality improvements." msgstr "Python の標準ライブラリは保守の努力と質の向上を大きく受けています。" -#: ../../whatsnew/3.2.rst:664 msgid "" -"The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " -"bytes/text model in Python 3. For the first time, there is correct handling " -"of messages with mixed encodings." +"The biggest news for Python 3.2 is that the :mod:`email` " +"package, :mod:`mailbox` module, and :mod:`!nntplib` modules now work " +"correctly with the bytes/text model in Python 3. For the first time, there " +"is correct handling of messages with mixed encodings." msgstr "" +"Python 3.2 での最大のニュースは、 :mod:`email` パッケージ、 :mod:`mailbox` モ" +"ジュール、 :mod:`!nntplib` モジュールが Python 3 の bytes/text モデルで正しく" +"動作するようになったことです。\n" +"エンコーディングが色々混ざったメッセージを正しく処理出来るようになったのは初" +"めてのことです。" #: ../../whatsnew/3.2.rst:669 msgid "" @@ -1122,10 +1345,10 @@ msgstr "email" msgid "" "The usability of the :mod:`email` package in Python 3 has been mostly fixed " "by the extensive efforts of R. David Murray. The problem was that emails " -"are typically read and stored in the form of :class:`bytes` rather than :" -"class:`str` text, and they may contain multiple encodings within a single " -"email. So, the email package had to be extended to parse and generate email " -"messages in bytes format." +"are typically read and stored in the form of :class:`bytes` rather " +"than :class:`str` text, and they may contain multiple encodings within a " +"single email. So, the email package had to be extended to parse and " +"generate email messages in bytes format." msgstr "" "R. David Murray による多大なる尽力により、Python 3 における :mod:`email` パッ" "ケージの適応可能性の問題は、ほとんど修正されました。問題は、email が典型的に" @@ -1136,15 +1359,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:690 msgid "" -"New functions :func:`~email.message_from_bytes` and :func:`~email." -"message_from_binary_file`, and new classes :class:`~email.parser." -"BytesFeedParser` and :class:`~email.parser.BytesParser` allow binary message " -"data to be parsed into model objects." +"New functions :func:`~email.message_from_bytes` " +"and :func:`~email.message_from_binary_file`, and new " +"classes :class:`~email.parser.BytesFeedParser` " +"and :class:`~email.parser.BytesParser` allow binary message data to be " +"parsed into model objects." msgstr "" -"新規関数 :func:`~email.message_from_bytes`, :func:`~email." -"message_from_binary_file` 、それに新規クラス :class:`~email.parser." -"BytesFeedParser`, :class:`~email.parser.BytesParser` が、バイナリメッセージ" -"データをパースしてモデルオブジェクトに読み込みます。" +"新規関" +"数 :func:`~email.message_from_bytes`, :func:`~email.message_from_binary_file` 、" +"それに新規クラ" +"ス :class:`~email.parser.BytesFeedParser`, :class:`~email.parser.BytesParser` " +"が、バイナリメッセージデータをパースしてモデルオブジェクトに読み込みます。" #: ../../whatsnew/3.2.rst:695 msgid "" @@ -1171,8 +1396,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:704 msgid "" -"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ -" -"encoded using the *unknown-8bit* character set." +"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ " +"-encoded using the *unknown-8bit* character set." msgstr "" "エンコードされていない非 ASCII バイト列を持つヘッダは *未知の 8 ビット* 文字" "セットを使った :rfc:`2047` エンコードであると見做されます。" @@ -1181,8 +1406,8 @@ msgstr "" msgid "" "A new class :class:`~email.generator.BytesGenerator` produces bytes as " "output, preserving any unchanged non-ASCII data that was present in the " -"input used to build the model, including message bodies with a :mailheader:" -"`Content-Transfer-Encoding` of *8bit*." +"input used to build the model, including message bodies with " +"a :mailheader:`Content-Transfer-Encoding` of *8bit*." msgstr "" "新規クラス :class:`~email.generator.BytesGenerator` は出力としてバイト列を生" "成します。これはモデルを構築するのに使った入力にあった非 ASCII データをそのま" @@ -1193,34 +1418,36 @@ msgstr "" msgid "" "The :mod:`smtplib` :class:`~smtplib.SMTP` class now accepts a byte string " "for the *msg* argument to the :meth:`~smtplib.SMTP.sendmail` method, and a " -"new method, :meth:`~smtplib.SMTP.send_message` accepts a :class:`~email." -"message.Message` object and can optionally obtain the *from_addr* and " -"*to_addrs* addresses directly from the object." -msgstr "" -":mod:`smtplib` モジュールの :class:`~smtplib.SMTP` クラスが :meth:`~smtplib." -"SMTP.sendmail` メソッドの *msg* 引数としてバイト列文字列を受け付けるようにな" -"りました。新しく追加されたメソッド :meth:`~smtplib.SMTP.send_message` は " -"*msg* 引数に :class:`~email.message.Message` オブジェクトを受け付けます。この" -"メソッドは *msg* にあたえたオブジェクトから *from_addr* アドレスと " -"*to_addrs* アドレスを直接取ることが出来ます。" +"new method, :meth:`~smtplib.SMTP.send_message` accepts " +"a :class:`~email.message.Message` object and can optionally obtain the " +"*from_addr* and *to_addrs* addresses directly from the object." +msgstr "" +":mod:`smtplib` モジュールの :class:`~smtplib.SMTP` クラス" +"が :meth:`~smtplib.SMTP.sendmail` メソッドの *msg* 引数としてバイト列文字列を" +"受け付けるようになりました。新しく追加されたメソッ" +"ド :meth:`~smtplib.SMTP.send_message` は *msg* 引数" +"に :class:`~email.message.Message` オブジェクトを受け付けます。このメソッド" +"は *msg* にあたえたオブジェクトから *from_addr* アドレスと *to_addrs* アドレ" +"スを直接取ることが出来ます。" #: ../../whatsnew/3.2.rst:718 msgid "" -"(Proposed and implemented by R. David Murray, :issue:`4661` and :issue:" -"`10321`.)" +"(Proposed and implemented by R. David Murray, :issue:`4661` " +"and :issue:`10321`.)" msgstr "" -"(Proposed and implemented by R. David Murray, :issue:`4661` and :issue:" -"`10321`.)" +"(Proposed and implemented by R. David Murray, :issue:`4661` " +"and :issue:`10321`.)" #: ../../whatsnew/3.2.rst:721 msgid "elementtree" msgstr "elementtree" -#: ../../whatsnew/3.2.rst:723 msgid "" -"The :mod:`xml.etree.ElementTree` package and its :mod:`!xml.etree." -"cElementTree` counterpart have been updated to version 1.3." +"The :mod:`xml.etree.ElementTree` package and its :mod:`!" +"xml.etree.cElementTree` counterpart have been updated to version 1.3." msgstr "" +":mod:`xml.etree.ElementTree` パッケージと :mod:`!xml.etree.cElementTree` の対" +"応するものがバージョン 1.3 にアップデートしました。" #: ../../whatsnew/3.2.rst:726 msgid "Several new and useful functions and methods have been added:" @@ -1289,21 +1516,25 @@ msgstr "" msgid "Two methods have been deprecated:" msgstr "2つのメソッドが非推奨になりました:" -#: ../../whatsnew/3.2.rst:746 msgid ":meth:`!xml.etree.ElementTree.getchildren` use ``list(elem)`` instead." msgstr "" +":meth:`!xml.etree.ElementTree.getchildren` 代わりに ``list(elem)`` を使用して" +"ください。" -#: ../../whatsnew/3.2.rst:747 msgid "" ":meth:`!xml.etree.ElementTree.getiterator` use ``Element.iter`` instead." msgstr "" +":meth:`!xml.etree.ElementTree.getiterator` 代わりに ``Element.iter`` を使用し" +"てください。" -#: ../../whatsnew/3.2.rst:749 msgid "" -"For details of the update, see `Introducing ElementTree `_ on " -"Fredrik Lundh's website." +"For details of the update, see `Introducing ElementTree `_ on Fredrik Lundh's website." msgstr "" +"更新の詳細については、Fredrik Lundh のウェブサイトの `Introducing " +"ElementTree `_ を参照してください。" #: ../../whatsnew/3.2.rst:753 msgid "(Contributed by Florent Xicluna and Fredrik Lundh, :issue:`6472`.)" @@ -1347,23 +1578,28 @@ msgstr "" "テーブル phonelist が更新されたのであれば、内容が古くなったキャッシュをクリア" "できます:" -#: ../../whatsnew/3.2.rst:786 msgid "" "(Contributed by Raymond Hettinger and incorporating design ideas from Jim " -"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 `_\\, `recipe " -"577479 `_\\, :issue:`10586`, and :issue:`10593`.)" -msgstr "" +"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 `_\\, " +"`recipe 577479 `_\\, :issue:`10586`, and :issue:`10593`.)" +msgstr "" +"(Raymond Hettinger が貢献し、Jim Baker、Miki Tebeka、Nick Coghlan の設計上の" +"アイデアを取り入れました。\n" +"`レシピ 498245 `_\\、`レシピ 577479 `_\\、:issue:`10586`、:issue:`10593` を参照" +"してください。)" #: ../../whatsnew/3.2.rst:792 msgid "" "The :func:`functools.wraps` decorator now adds a :attr:`__wrapped__` " "attribute pointing to the original callable function. This allows wrapped " -"functions to be introspected. It also copies :attr:`~function." -"__annotations__` if defined. And now it also gracefully skips over missing " -"attributes such as :attr:`~function.__doc__` which might not be defined for " -"the wrapped callable." +"functions to be introspected. It also " +"copies :attr:`~function.__annotations__` if defined. And now it also " +"gracefully skips over missing attributes such as :attr:`~function.__doc__` " +"which might not be defined for the wrapped callable." msgstr "" #: ../../whatsnew/3.2.rst:799 @@ -1374,17 +1610,17 @@ msgstr "上の例の場合、キャッシュは元の関数を復元すること #: ../../whatsnew/3.2.rst:804 msgid "" -"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and :issue:" -"`8814`.)" +"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, " +"and :issue:`8814`.)" msgstr "" -"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and :issue:" -"`8814`.)" +"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, " +"and :issue:`8814`.)" #: ../../whatsnew/3.2.rst:807 msgid "" -"To help write classes with rich comparison methods, a new decorator :func:" -"`functools.total_ordering` will use existing equality and inequality methods " -"to fill in the remaining methods." +"To help write classes with rich comparison methods, a new " +"decorator :func:`functools.total_ordering` will use existing equality and " +"inequality methods to fill in the remaining methods." msgstr "" "拡張比較 (rich comparison) メソッドを持つクラスを書く助けとなるよう、新たなデ" "コレータ :func:`functools.total_ordering` が追加されました。これは既存の等式" @@ -1392,13 +1628,13 @@ msgstr "" #: ../../whatsnew/3.2.rst:811 msgid "" -"For example, supplying *__eq__* and *__lt__* will enable :func:`~functools." -"total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::" +"For example, supplying *__eq__* and *__lt__* will " +"enable :func:`~functools.total_ordering` to fill-in *__le__*, *__gt__* and " +"*__ge__*::" msgstr "" "例えば *__eq__* と *__lt__* を与えると、 :func:`~functools.total_ordering` " "は *__le__*, *__gt__*, *__ge__* を補います::" -#: ../../whatsnew/3.2.rst:814 msgid "" "@total_ordering\n" "class Student:\n" @@ -1410,6 +1646,15 @@ msgid "" " return ((self.lastname.lower(), self.firstname.lower()) <\n" " (other.lastname.lower(), other.firstname.lower()))" msgstr "" +"@total_ordering\n" +"class Student:\n" +" def __eq__(self, other):\n" +" return ((self.lastname.lower(), self.firstname.lower()) ==\n" +" (other.lastname.lower(), other.firstname.lower()))\n" +"\n" +" def __lt__(self, other):\n" +" return ((self.lastname.lower(), self.firstname.lower()) <\n" +" (other.lastname.lower(), other.firstname.lower()))" #: ../../whatsnew/3.2.rst:824 msgid "" @@ -1439,7 +1684,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" @@ -1478,11 +1724,11 @@ msgstr "collections" msgid "" "The :class:`collections.Counter` class now has two forms of in-place " "subtraction, the existing *-=* operator for `saturating subtraction `_ and the new :meth:" -"`~collections.Counter.subtract` method for regular subtraction. The former " -"is suitable for `multisets `_ which " -"only have positive counts, and the latter is more suitable for use cases " -"that allow negative counts:" +"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the " +"new :meth:`~collections.Counter.subtract` method for regular subtraction. " +"The former is suitable for `multisets `_ which only have positive counts, and the latter is more suitable " +"for use cases that allow negative counts:" msgstr "" ":class:`collections.Counter` クラスに 2 つの形式のインプレイス減算が追加され" "ました。 `saturating subtraction `_ which is defined for only two threads." msgstr "" -"バリアは任意の数のスレッドに対して使えます。これは `Rendezvous `_ を一般化したもので、それは 2 つ" -"のスレッドに対してのみに定義されていました。" +"バリアは任意の数のスレッドに対して使えます。これは `Rendezvous `_ を一般化したもので、それは 2 " +"つのスレッドに対してのみに定義されていました。" #: ../../whatsnew/3.2.rst:933 msgid "" @@ -1576,7 +1824,6 @@ msgstr "" msgid "Example of using barriers::" msgstr "バリアは例えばこのように使います::" -#: ../../whatsnew/3.2.rst:940 msgid "" "from threading import Barrier, Thread\n" "\n" @@ -1591,6 +1838,17 @@ msgid "" "for site in sites:\n" " Thread(target=get_votes, args=(site,)).start()" msgstr "" +"from threading import Barrier, Thread\n" +"\n" +"def get_votes(site):\n" +" ballots = conduct_election(site)\n" +" all_polls_closed.wait() # すべての投票が終わるまで集計しない\n" +" totals = summarize(ballots)\n" +" publish(site, totals)\n" +"\n" +"all_polls_closed = Barrier(len(sites))\n" +"for site in sites:\n" +" Thread(target=get_votes, args=(site,)).start()" #: ../../whatsnew/3.2.rst:952 msgid "" @@ -1601,10 +1859,10 @@ msgid "" "barrier point is crossed." msgstr "" "この例ではバリアは、全ての投票所が閉じるまではどの投票サイトでも得票を数えな" -"いルールを強制しています。バリアを使ったソリューションが :meth:`threading." -"Thread.join` でのそれといかに似ているか気付くと思います。ですがバリアポイント" -"を通過した後に、スレッドは生き続けて (投票を集計する (summarizing ballots) と" -"いう) 仕事を続けます。" +"いルールを強制しています。バリアを使ったソリューション" +"が :meth:`threading.Thread.join` でのそれといかに似ているか気付くと思います。" +"ですがバリアポイントを通過した後に、スレッドは生き続けて (投票を集計する " +"(summarizing ballots) という) 仕事を続けます。" #: ../../whatsnew/3.2.rst:958 msgid "" @@ -1616,10 +1874,9 @@ msgid "" msgstr "" "いずれかの前任タスクがハングしたり遅延したりしうるのであれば、バリアを " "*timeout* 付きで作ることができます。全ての前任タスクがバリアポイントに到達す" -"る前にタイムアウトの期間が経過すると、全ての待機スレッドは解放されて :exc:" -"`~threading.BrokenBarrierError` 例外が発生します::" +"る前にタイムアウトの期間が経過すると、全ての待機スレッドは解放され" +"て :exc:`~threading.BrokenBarrierError` 例外が発生します::" -#: ../../whatsnew/3.2.rst:963 msgid "" "def get_votes(site):\n" " ballots = conduct_election(site)\n" @@ -1632,6 +1889,16 @@ msgid "" " totals = summarize(ballots)\n" " publish(site, totals)" msgstr "" +"def get_votes(site):\n" +" ballots = conduct_election(site)\n" +" try:\n" +" all_polls_closed.wait(timeout=midnight - time.now())\n" +" except BrokenBarrierError:\n" +" lockbox = seal_ballots(ballots)\n" +" queue.put(lockbox)\n" +" else:\n" +" totals = summarize(ballots)\n" +" publish(site, totals)" #: ../../whatsnew/3.2.rst:974 msgid "" @@ -1643,7 +1910,6 @@ msgstr "" "午前零時前に終了しなかった場合バリアがタイムアウトし、投票用紙は密封されて後" "の処理のためのキューに預けられます。" -#: ../../whatsnew/3.2.rst:978 msgid "" "See `Barrier Synchronization Patterns `_ for more examples " @@ -1652,6 +1918,12 @@ msgid "" "`_, " "*section 3.6*." msgstr "" +"並列計算でのバリアの使用例については `Barrier Synchronization Patterns " +"`_ を参照してください。\n" +"また、`The Little Book of Semaphores `_ の *3.6 節* に、簡潔で詳しいバリアの説明があり" +"ます。" #: ../../whatsnew/3.2.rst:984 msgid "" @@ -1682,8 +1954,8 @@ msgid "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" @@ -1691,14 +1963,14 @@ msgstr "" #: ../../whatsnew/3.2.rst:1003 msgid "" -"Also, :class:`~datetime.timedelta` objects can now be multiplied by :class:" -"`float` and divided by :class:`float` and :class:`int` objects. And :class:" -"`~datetime.timedelta` objects can now divide one another." +"Also, :class:`~datetime.timedelta` objects can now be multiplied " +"by :class:`float` and divided by :class:`float` and :class:`int` objects. " +"And :class:`~datetime.timedelta` objects can now divide one another." 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 "" @@ -1708,23 +1980,28 @@ msgstr "" ":meth:`datetime.date.strftime` メソッドにはもう 1900 年以降という制限はありま" "せん。新しくサポートされる年の範囲は 1000 以上 9999 以下です。" -#: ../../whatsnew/3.2.rst:1010 msgid "" "Whenever a two-digit year is used in a time tuple, the interpretation has " "been governed by :data:`!time.accept2dyear`. The default is ``True`` which " "means that for a two-digit year, the century is guessed according to the " "POSIX rules governing the ``%y`` strptime format." msgstr "" +"2 桁の年が time のタプルに使われている場合、その解釈は :data:`!" +"time.accept2dyear` 属性で決められてきました。\n" +"そのデフォルトは ``True`` で、この場合 ``%y`` strptime 書式を支配している " +"POSIX 規則によって世紀を推測します。" -#: ../../whatsnew/3.2.rst:1015 msgid "" -"Starting with Py3.2, use of the century guessing heuristic will emit a :exc:" -"`DeprecationWarning`. Instead, it is recommended that :data:`!time." -"accept2dyear` be set to ``False`` so that large date ranges can be used " +"Starting with Py3.2, use of the century guessing heuristic will emit " +"a :exc:`DeprecationWarning`. Instead, it is recommended that :data:`!" +"time.accept2dyear` be set to ``False`` so that large date ranges can be used " "without guesswork::" msgstr "" +"Python 3.2 より、その発見的手法での世紀推測を使う" +"と :exc:`DeprecationWarning` を発行するようになりました 代わりに :data:`!" +"time.accept2dyear` に ``False`` をセットして、そのような推測なく大きな日付範" +"囲を扱えるようにすることが推奨されます。 ::" -#: ../../whatsnew/3.2.rst:1020 msgid "" ">>> import time, warnings\n" ">>> warnings.resetwarnings() # remove the default warning filters\n" @@ -1740,25 +2017,42 @@ msgid "" ">>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\n" "'Fri Jan 1 12:34:56 11'" msgstr "" +">>> import time, warnings\n" +">>> warnings.resetwarnings() # デフォルトの警告フィルターを削除\n" +"\n" +">>> time.accept2dyear = True # 11 が 11 年か 2011 年かを推測\n" +">>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\n" +"Warning (from warnings module):\n" +" ...\n" +"DeprecationWarning: Century info guessed for a 2-digit year.\n" +"'Fri Jan 1 12:34:56 2011'\n" +"\n" +">>> time.accept2dyear = False # 許容される日付の全範囲を使う\n" +">>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\n" +"'Fri Jan 1 12:34:56 11'" -#: ../../whatsnew/3.2.rst:1034 msgid "" "Several functions now have significantly expanded date ranges. When :data:`!" "time.accept2dyear` is false, the :func:`time.asctime` function will accept " -"any year that fits in a C int, while the :func:`time.mktime` and :func:`time." -"strftime` functions will accept the full range supported by the " -"corresponding operating system functions." +"any year that fits in a C int, while the :func:`time.mktime` " +"and :func:`time.strftime` functions will accept the full range supported by " +"the corresponding operating system functions." msgstr "" +"いくつもの関数が今では日付範囲を大きく拡張しています。\n" +":data:`!time.accept2dyear` が偽である場合、 :func:`time.asctime` 関数は C " +"int の任意の整数を年として受け付け、 :func:`time.mktime` " +"と :func:`time.strftime` は対応する OS 関数でサポートされる完全な範囲を受け付" +"けます。" #: ../../whatsnew/3.2.rst:1040 msgid "" -"(Contributed by Alexander Belopolsky and Victor Stinner in :issue:" -"`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :" -"issue:`8013`, and :issue:`10827`.)" +"(Contributed by Alexander Belopolsky and Victor Stinner " +"in :issue:`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :issue:`8013`, " +"and :issue:`10827`.)" msgstr "" -"(Contributed by Alexander Belopolsky and Victor Stinner in :issue:" -"`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :" -"issue:`8013`, and :issue:`10827`.)" +"(Contributed by Alexander Belopolsky and Victor Stinner " +"in :issue:`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :issue:`8013`, " +"and :issue:`10827`.)" #: ../../whatsnew/3.2.rst:1047 msgid "math" @@ -1797,11 +2091,10 @@ msgid "" "error function `_. The " "complementary error function, :func:`~math.erfc`, is ``1 - erf(x)``:" msgstr "" -":func:`~math.erf` 関数は確率積分、すなわち `誤差関数 `_ を返します。 相補誤差関数 :" -"func:`~math.erfc` は ``1 - erf(x)`` です:" +":func:`~math.erf` 関数は確率積分、すなわち `誤差関数 `_ を返します。 相" +"補誤差関数 :func:`~math.erfc` は ``1 - erf(x)`` です:" -#: ../../whatsnew/3.2.rst:1072 msgid "" ">>> from math import erf, erfc, sqrt\n" ">>> erf(1.0/sqrt(2.0)) # portion of normal distribution within 1 standard " @@ -1813,6 +2106,13 @@ msgid "" ">>> erf(1.0/sqrt(2.0)) + erfc(1.0/sqrt(2.0))\n" "1.0" msgstr "" +">>> from math import erf, erfc, sqrt\n" +">>> erf(1.0/sqrt(2.0)) # 正規分布で標準偏差一つ分の範囲内にある割合\n" +"0.682689492137086\n" +">>> erfc(1.0/sqrt(2.0)) # 正規分布で標準偏差一つ分の範囲外にある割合\n" +"0.31731050786291404\n" +">>> erf(1.0/sqrt(2.0)) + erfc(1.0/sqrt(2.0))\n" +"1.0" #: ../../whatsnew/3.2.rst:1083 msgid "" @@ -1838,11 +2138,11 @@ msgstr "abc" #: ../../whatsnew/3.2.rst:1100 msgid "" -"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and :" -"func:`~abc.abstractstaticmethod`." +"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` " +"and :func:`~abc.abstractstaticmethod`." msgstr "" -":mod:`abc` モジュールは :func:`~abc.abstractclassmethod` と :func:`~abc." -"abstractstaticmethod` をサポートしました。" +":mod:`abc` モジュールは :func:`~abc.abstractclassmethod` " +"と :func:`~abc.abstractstaticmethod` をサポートしました。" #: ../../whatsnew/3.2.rst:1103 msgid "" @@ -1854,7 +2154,6 @@ msgstr "" "装する必要のある :term:`抽象基底クラス ` を定義すること" "が出来ます。" -#: ../../whatsnew/3.2.rst:1107 msgid "" "class Temperature(metaclass=abc.ABCMeta):\n" " @abc.abstractclassmethod\n" @@ -1864,6 +2163,13 @@ msgid "" " def from_celsius(cls, t):\n" " ..." msgstr "" +"class Temperature(metaclass=abc.ABCMeta):\n" +" @abc.abstractclassmethod\n" +" def from_fahrenheit(cls, t):\n" +" ...\n" +" @abc.abstractclassmethod\n" +" def from_celsius(cls, t):\n" +" ..." #: ../../whatsnew/3.2.rst:1115 msgid "(Patch submitted by Daniel Urban; :issue:`5867`.)" @@ -1886,7 +2192,6 @@ msgstr "" "バッファのランダムアクセスとスライス記法のサポートはインプレースな編集に適し" "ています::" -#: ../../whatsnew/3.2.rst:1125 msgid "" ">>> REC_LEN, LOC_START, LOC_LEN = 34, 7, 11\n" "\n" @@ -1909,6 +2214,26 @@ msgid "" "b'X7899 warehouse Reserve cog '\n" "b'L6988 receiving Primary sprocket'" msgstr "" +">>> REC_LEN, LOC_START, LOC_LEN = 34, 7, 11\n" +"\n" +">>> def change_location(buffer, record_number, location):\n" +"... start = record_number * REC_LEN + LOC_START\n" +"... buffer[start: start+LOC_LEN] = location\n" +"\n" +">>> import io\n" +"\n" +">>> byte_stream = io.BytesIO(\n" +"... b'G3805 storeroom Main chassis '\n" +"... b'X7899 shipping Reserve cog '\n" +"... b'L6988 receiving Primary sprocket'\n" +"... )\n" +">>> buffer = byte_stream.getbuffer()\n" +">>> change_location(buffer, 1, b'warehouse ')\n" +">>> change_location(buffer, 0, b'showroom ')\n" +">>> print(byte_stream.getvalue())\n" +"b'G3805 showroom Main chassis '\n" +"b'X7899 warehouse Reserve cog '\n" +"b'L6988 receiving Primary sprocket'" #: ../../whatsnew/3.2.rst:1146 msgid "(Contributed by Antoine Pitrou in :issue:`5506`.)" @@ -1918,14 +2243,17 @@ msgstr "(Contributed by Antoine Pitrou in :issue:`5506`.)" msgid "reprlib" msgstr "reprlib" -#: ../../whatsnew/3.2.rst:1151 msgid "" "When writing a :meth:`~object.__repr__` method for a custom container, it is " "easy to forget to handle the case where a member refers back to the " -"container itself. Python's builtin objects such as :class:`list` and :class:" -"`set` handle self-reference by displaying \"...\" in the recursive part of " -"the representation string." +"container itself. Python's builtin objects such as :class:`list` " +"and :class:`set` handle self-reference by displaying \"...\" in the " +"recursive part of the representation string." msgstr "" +"独自のコンテナーの :meth:`~object.__repr__` メソッドを書く際には、要素がコン" +"テナー自身を参照する場合の処理を忘れがちです。\n" +"Python の :class:`list` や :class:`set` などの組み込みオブジェクトは、表現文" +"字列の再帰する部分に \"...\" と表示して自己参照を処理します。" #: ../../whatsnew/3.2.rst:1157 msgid "" @@ -1935,7 +2263,6 @@ msgid "" "instead::" msgstr "" -#: ../../whatsnew/3.2.rst:1161 msgid "" ">>> class MyList(list):\n" "... @recursive_repr()\n" @@ -1948,6 +2275,16 @@ msgid "" ">>> print(m)\n" "<'a'|'b'|'c'|...|'x'>" msgstr "" +">>> class MyList(list):\n" +"... @recursive_repr()\n" +"... def __repr__(self):\n" +"... return '<' + '|'.join(map(repr, self)) + '>'\n" +"...\n" +">>> m = MyList('abc')\n" +">>> m.append(m)\n" +">>> m.append('x')\n" +">>> print(m)\n" +"<'a'|'b'|'c'|...|'x'>" #: ../../whatsnew/3.2.rst:1172 msgid "(Contributed by Raymond Hettinger in :issue:`9826` and :issue:`9840`.)" @@ -1959,8 +2296,8 @@ msgstr "logging" #: ../../whatsnew/3.2.rst:1177 msgid "" -"In addition to dictionary-based configuration described above, the :mod:" -"`logging` package has many other improvements." +"In addition to dictionary-based configuration described above, " +"the :mod:`logging` package has many other improvements." msgstr "" "上記の辞書ベースの設定に加え、:mod:`logging` パッケージには他にも多くの改良が" "あります。" @@ -1973,50 +2310,60 @@ msgid "" "These documents are the fastest way to learn about logging." msgstr "" "ロギングのドキュメントは :ref:`基本チュートリアル ` 、 :ref:`上級チュートリアル ` 、 :" -"ref:`クックブック ` により増強されてきました。ロギングにつ" -"いて学習するにはこれらのドキュメントが最速の方法です。" +"tutorial>` 、 :ref:`上級チュートリアル ` 、 :ref:`クックブック ` により増強されてきまし" +"た。ロギングについて学習するにはこれらのドキュメントが最速の方法です。" #: ../../whatsnew/3.2.rst:1185 msgid "" "The :func:`logging.basicConfig` set-up function gained a *style* argument to " "support three different types of string formatting. It defaults to \"%\" " -"for traditional %-formatting, can be set to \"{\" for the new :meth:`str." -"format` style, or can be set to \"$\" for the shell-style formatting " -"provided by :class:`string.Template`. The following three configurations " -"are equivalent::" +"for traditional %-formatting, can be set to \"{\" for the " +"new :meth:`str.format` style, or can be set to \"$\" for the shell-style " +"formatting provided by :class:`string.Template`. The following three " +"configurations are equivalent::" msgstr "" "セットアップ関数 :func:`logging.basicConfig` に *style* 引数が追加され、これ" "により異なる 3 つのタイプの文字列書式化がサポートされます。デフォルトは伝統的" -"な % 書式化を使う \"%\" で、 :meth:`str.format` スタイルの \"{\" 、 :class:" -"`string.Template` で提供されるシェルスタイルの \"$\" をセット出来ます。以下" -"の 3 つの設定は等価です::" +"な % 書式化を使う \"%\" で、 :meth:`str.format` スタイルの " +"\"{\" 、 :class:`string.Template` で提供されるシェルスタイルの \"$\" をセット" +"出来ます。以下の 3 つの設定は等価です::" -#: ../../whatsnew/3.2.rst:1191 msgid "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" msgstr "" +">>> from logging import basicConfig\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" +">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" +">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" -#: ../../whatsnew/3.2.rst:1196 msgid "" "If no configuration is set-up before a logging event occurs, there is now a " -"default configuration using a :class:`~logging.StreamHandler` directed to :" -"data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, an " -"event occurring before a configuration was set-up would either raise an " -"exception or silently drop the event depending on the value of :data:" -"`logging.raiseExceptions`. The new default handler is stored in :data:" -"`logging.lastResort`." -msgstr "" +"default configuration using a :class:`~logging.StreamHandler` directed " +"to :data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, " +"an event occurring before a configuration was set-up would either raise an " +"exception or silently drop the event depending on the value " +"of :data:`logging.raiseExceptions`. The new default handler is stored " +"in :data:`logging.lastResort`." +msgstr "" +"ロギングイベントが発生する前に設定がセットアップされていない場合は、 " +"``WARNING`` レベル以上について :data:`sys.stderr` に向けられ" +"た :class:`~logging.StreamHandler` をデフォルトで使うようになりました。\n" +"以前はこの場合は :data:`logging.raiseExceptions` 属性の設定に従って、例外が発" +"生するか黙って捨てられるかのいずれかでした。\n" +"この新しいデフォルトの振る舞いは、ハンドラを属性 :data:`logging.lastResort` " +"にセットすることで実現しています。" #: ../../whatsnew/3.2.rst:1204 msgid "" -"The use of filters has been simplified. Instead of creating a :class:" -"`~logging.Filter` object, the predicate can be any Python callable that " -"returns ``True`` or ``False``." +"The use of filters has been simplified. Instead of creating " +"a :class:`~logging.Filter` object, the predicate can be any Python callable " +"that returns ``True`` or ``False``." msgstr "" "フィルタの利用は単純になりました。 :class:`~logging.Filter` オブジェクトを作" "る代わりに、 ``True`` か ``False`` を返す任意の Python 呼び出し可能オブジェク" @@ -2037,10 +2384,10 @@ msgstr "csv" #: ../../whatsnew/3.2.rst:1215 msgid "" -"The :mod:`csv` module now supports a new dialect, :class:`~csv." -"unix_dialect`, which applies quoting for all fields and a traditional Unix " -"style with ``'\\n'`` as the line terminator. The registered dialect name is " -"``unix``." +"The :mod:`csv` module now supports a new " +"dialect, :class:`~csv.unix_dialect`, which applies quoting for all fields " +"and a traditional Unix style with ``'\\n'`` as the line terminator. The " +"registered dialect name is ``unix``." msgstr "" ":mod:`csv` モジュールは新たな方言 :class:`~csv.unix_dialect` をサポートしまし" "た。\n" @@ -2050,14 +2397,14 @@ msgstr "" #: ../../whatsnew/3.2.rst:1219 msgid "" -"The :class:`csv.DictWriter` has a new method, :meth:`~csv.DictWriter." -"writeheader` for writing-out an initial row to document the field names::" +"The :class:`csv.DictWriter` has a new " +"method, :meth:`~csv.DictWriter.writeheader` for writing-out an initial row " +"to document the field names::" msgstr "" ":class:`csv.DictWriter` に新たなメソッド :meth:`~csv.DictWriter.writeheader` " "が追加されました。\n" "最初の列をドキュメントのフィールド名に書き出すのに使用します::" -#: ../../whatsnew/3.2.rst:1223 msgid "" ">>> import csv, sys\n" ">>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix')\n" @@ -2069,6 +2416,15 @@ msgid "" "\"tom\",\"accounting\"\n" "\"susan\",\"sales\"" msgstr "" +">>> import csv, sys\n" +">>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix')\n" +">>> w.writeheader()\n" +"\"name\",\"dept\"\n" +">>> w.writerows([\n" +"... {'name': 'tom', 'dept': 'accounting'},\n" +"... {'name': 'susan', 'dept': 'Salesl'}])\n" +"\"tom\",\"accounting\"\n" +"\"susan\",\"sales\"" #: ../../whatsnew/3.2.rst:1233 msgid "" @@ -2084,18 +2440,19 @@ msgstr "contextlib" #: ../../whatsnew/3.2.rst:1239 msgid "" -"There is a new and slightly mind-blowing tool :class:`~contextlib." -"ContextDecorator` that is helpful for creating a :term:`context manager` " -"that does double duty as a function decorator." +"There is a new and slightly mind-blowing " +"tool :class:`~contextlib.ContextDecorator` that is helpful for creating " +"a :term:`context manager` that does double duty as a function decorator." msgstr "" -"新しく追加され、そして少しばかりハートを揺さぶるツール :class:`~contextlib." -"ContextDecorator` は、関数デコレータとしての任務も果たす :term:`context " -"manager` を作るのに役立つものです。" +"新しく追加され、そして少しばかりハートを揺さぶるツー" +"ル :class:`~contextlib.ContextDecorator` は、関数デコレータとしての任務も果た" +"す :term:`context manager` を作るのに役立つものです。" #: ../../whatsnew/3.2.rst:1243 msgid "" -"As a convenience, this new functionality is used by :func:`~contextlib." -"contextmanager` so that no extra effort is needed to support both roles." +"As a convenience, this new functionality is used " +"by :func:`~contextlib.contextmanager` so that no extra effort is needed to " +"support both roles." msgstr "" "利便性のためにこの新機能は :func:`~contextlib.contextmanager` で使われている" "ので、両方の役割をサポートするのにことさら労力は要しません。" @@ -2126,10 +2483,10 @@ msgid "" msgstr "" "たとえば関数やステートメントのグループをロガーで包んで、開始時刻と終了時刻を" "追跡できるようにするとしばしば便利です。このタスクをこなすために関数デコレー" -"タとコンテキストマネージャの両方を書く代わりに、 :func:`~contextlib." -"contextmanager` が単一の定義に両方の能力をもたらしてくれます::" +"タとコンテキストマネージャの両方を書く代わり" +"に、 :func:`~contextlib.contextmanager` が単一の定義に両方の能力をもたらして" +"くれます::" -#: ../../whatsnew/3.2.rst:1259 msgid "" "from contextlib import contextmanager\n" "import logging\n" @@ -2142,31 +2499,46 @@ msgid "" " yield\n" " logging.info('Exiting: %s', name)" msgstr "" +"from contextlib import contextmanager\n" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"@contextmanager\n" +"def track_entry_and_exit(name):\n" +" logging.info('Entering: %s', name)\n" +" yield\n" +" logging.info('Exiting: %s', name)" #: ../../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 "" @@ -2204,24 +2576,28 @@ msgid "" "actual values are equal (:issue:`8188`)::" msgstr "" "Mark Dickinson は、異なる数値データの型が実際の値が等しい場合は常に同じハッ" -"シュ値を持つことを保証する、エレガントで効率的なスキームを作り上げました (:" -"issue:`8188`)::" +"シュ値を持つことを保証する、エレガントで効率的なスキームを作り上げました " +"(:issue:`8188`)::" -#: ../../whatsnew/3.2.rst:1300 msgid "" "assert hash(Fraction(3, 2)) == hash(1.5) == \\\n" " hash(Decimal(\"1.5\")) == hash(complex(1.5, 0))" msgstr "" +"assert hash(Fraction(3, 2)) == hash(1.5) == \\\n" +" hash(Decimal(\"1.5\")) == hash(complex(1.5, 0))" -#: ../../whatsnew/3.2.rst:1303 msgid "" -"Some of the hashing details are exposed through a new attribute, :data:`sys." -"hash_info`, which describes the bit width of the hash value, the prime " -"modulus, the hash values for *infinity* and *nan*, and the multiplier used " -"for the imaginary part of a number:" +"Some of the hashing details are exposed through a new " +"attribute, :data:`sys.hash_info`, which describes the bit width of the hash " +"value, the prime modulus, the hash values for *infinity* and *nan*, and the " +"multiplier used for the imaginary part of a number:" msgstr "" +"いくつかのハッシュ化の詳細が、新規属性 :data:`sys.hash_info` で公開されまし" +"た。\n" +"これはハッシュ値のビット幅、数値ハッシュ計算に利用される素数の法 (prime " +"modulus)、 *infinity (無限大)* と *nan (非数)* に対して返されるハッシュ値、複" +"素数の虚部を表すための乗数について記述しています:" -#: ../../whatsnew/3.2.rst:1311 msgid "" "An early decision to limit the interoperability of various numeric types has " "been relaxed. It is still unsupported (and ill-advised) to have implicit " @@ -2231,12 +2607,19 @@ msgid "" "losslessly to either a decimal or rational representation, it makes sense to " "add them to the constructor and to support mixed-type comparisons." msgstr "" +"異なる数値型の相互運用を制限するという当初の方針が緩和されました。\n" +"``Decimal('1.1') + float('1.1')`` のように算術式で型を暗黙に混在させること" +"は、引き続きサポートされず、推奨もされません。\n" +"後者は二進浮動小数点数を構築する過程で情報を失うためです。\n" +"ただし、既存の浮動小数点値は、情報を失わずに十進表現や有理数表現に変換できる" +"ため、コンストラクターでの受け入れと型を混在させた比較のサポートには意味があ" +"ります。" #: ../../whatsnew/3.2.rst:1319 msgid "" "The :class:`decimal.Decimal` constructor now accepts :class:`float` objects " -"directly so there in no longer a need to use the :meth:`~decimal.Decimal." -"from_float` method (:issue:`8257`)." +"directly so there in no longer a need to use " +"the :meth:`~decimal.Decimal.from_float` method (:issue:`8257`)." msgstr "" ":class:`decimal.Decimal` コンストラクタに :class:`float` オブジェクトを直接渡" "せるようになりました。これにより :meth:`~decimal.Decimal.from_float` メソッド" @@ -2244,28 +2627,37 @@ msgstr "" #: ../../whatsnew/3.2.rst:1323 msgid "" -"Mixed type comparisons are now fully supported so that :class:`~decimal." -"Decimal` objects can be directly compared with :class:`float` and :class:" -"`fractions.Fraction` (:issue:`2531` and :issue:`8188`)." +"Mixed type comparisons are now fully supported so " +"that :class:`~decimal.Decimal` objects can be directly compared " +"with :class:`float` and :class:`fractions.Fraction` (:issue:`2531` " +"and :issue:`8188`)." msgstr "" "型違いの比較はいまでは完全にサポートされたので、 :class:`~decimal.Decimal` オ" "ブジェクトを直接 :class:`float` や :class:`fractions.Fraction` と比較出来ま" "す (:issue:`2531` and :issue:`8188`)。" -#: ../../whatsnew/3.2.rst:1327 msgid "" -"Similar changes were made to :class:`fractions.Fraction` so that the :meth:" -"`~fractions.Fraction.from_float` and :meth:`~fractions.Fraction." -"from_decimal` methods are no longer needed (:issue:`8294`):" +"Similar changes were made to :class:`fractions.Fraction` so that " +"the :meth:`~fractions.Fraction.from_float` " +"and :meth:`~fractions.Fraction.from_decimal` methods are no longer needed " +"(:issue:`8294`):" msgstr "" +":class:`fractions.Fraction` にも同様の変更が加えら" +"れ、:meth:`~fractions.Fraction.from_float` " +"と :meth:`~fractions.Fraction.from_decimal` は不要になりました " +"(:issue:`8294`)。" -#: ../../whatsnew/3.2.rst:1338 msgid "" -"Another useful change for the :mod:`decimal` module is that the :attr:" -"`Context.clamp ` attribute is now public. This is " -"useful in creating contexts that correspond to the decimal interchange " -"formats specified in IEEE 754 (see :issue:`8540`)." +"Another useful change for the :mod:`decimal` module is that " +"the :attr:`Context.clamp ` attribute is now public. " +"This is useful in creating contexts that correspond to the decimal " +"interchange formats specified in IEEE 754 (see :issue:`8540`)." msgstr "" +":mod:`decimal` モジュールへのもう一つの有用な変更は :attr:`Context.clamp " +"` 属性がいまではパブリックになったことです。\n" +"これは IEEE 754 で規定された固定幅十進交換形式に対応するコンテキストを作成す" +"るのに有用です。\n" +"(see :issue:`8540`)." #: ../../whatsnew/3.2.rst:1343 msgid "(Contributed by Mark Dickinson and Raymond Hettinger.)" @@ -2301,19 +2693,21 @@ msgstr "" #: ../../whatsnew/3.2.rst:1363 msgid "" -"Other file-like objects such as :class:`mmap.mmap` and :func:`fileinput." -"input` also grew auto-closing context managers::" +"Other file-like objects such as :class:`mmap.mmap` " +"and :func:`fileinput.input` also grew auto-closing context managers::" msgstr "" "ちなみに :class:`mmap.mmap` や :func:`fileinput.input` のようなほかのファイ" "ルライクなオブジェクトも自動クローズするコンテキスト管理プロトコルをサポート" "するようになっていたりします::" -#: ../../whatsnew/3.2.rst:1366 msgid "" "with fileinput.input(files=('log1.txt', 'log2.txt')) as f:\n" " for line in f:\n" " process(line)" msgstr "" +"with fileinput.input(files=('log1.txt', 'log2.txt')) as f:\n" +" for line in f:\n" +" process(line)" #: ../../whatsnew/3.2.rst:1370 msgid "" @@ -2345,31 +2739,34 @@ msgstr "popen" #: ../../whatsnew/3.2.rst:1382 msgid "" -"The :func:`os.popen` and :func:`subprocess.Popen` functions now support :" -"keyword:`with` statements for auto-closing of the file descriptors." +"The :func:`os.popen` and :func:`subprocess.Popen` functions now " +"support :keyword:`with` statements for auto-closing of the file descriptors." msgstr "" ":func:`os.popen` ならびに :func:`subprocess.Popen` 関数が自動的にファイル記述" "子を閉じる :keyword:`with` 文をサポートしました。" #: ../../whatsnew/3.2.rst:1385 msgid "" -"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` and :issue:" -"`10554`.)" +"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` " +"and :issue:`10554`.)" msgstr "" -"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` and :issue:" -"`10554`.)" +"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` " +"and :issue:`10554`.)" #: ../../whatsnew/3.2.rst:1389 msgid "select" msgstr "select" -#: ../../whatsnew/3.2.rst:1391 msgid "" -"The :mod:`select` module now exposes a new, constant attribute, :const:" -"`~select.PIPE_BUF`, which gives the minimum number of bytes which are " -"guaranteed not to block when :func:`select.select` says a pipe is ready for " -"writing." +"The :mod:`select` module now exposes a new, constant " +"attribute, :const:`~select.PIPE_BUF`, which gives the minimum number of " +"bytes which are guaranteed not to block when :func:`select.select` says a " +"pipe is ready for writing." msgstr "" +":mod:`select` モジュールに新規定数属性 :const:`~select.PIPE_BUF` が公開されま" +"した。\n" +"これは :func:`select.select` がパイプが書き込み準備が出来ていると主張した場合" +"に、操作がブロックされないことが保障される最小バイト数です。" #: ../../whatsnew/3.2.rst:1400 msgid "(Available on Unix systems. Patch by Sébastien Sablé in :issue:`9862`)" @@ -2381,10 +2778,10 @@ msgstr "gzip と zipfile" #: ../../whatsnew/3.2.rst:1405 msgid "" -":class:`gzip.GzipFile` now implements the :class:`io.BufferedIOBase` :term:" -"`abstract base class` (except for ``truncate()``). It also has a :meth:" -"`~gzip.GzipFile.peek` method and supports unseekable as well as zero-padded " -"file objects." +":class:`gzip.GzipFile` now implements " +"the :class:`io.BufferedIOBase` :term:`abstract base class` (except for " +"``truncate()``). It also has a :meth:`~gzip.GzipFile.peek` method and " +"supports unseekable as well as zero-padded file objects." msgstr "" ":class:`gzip.GzipFile` が :class:`io.BufferedIOBase` :term:`抽象基底クラス " "` を継承しました (``truncate()`` をのぞく)。\n" @@ -2393,14 +2790,14 @@ msgstr "" #: ../../whatsnew/3.2.rst:1410 msgid "" -"The :mod:`gzip` module also gains the :func:`~gzip.compress` and :func:" -"`~gzip.decompress` functions for easier in-memory compression and " +"The :mod:`gzip` module also gains the :func:`~gzip.compress` " +"and :func:`~gzip.decompress` functions for easier in-memory compression and " "decompression. Keep in mind that text needs to be encoded as :class:`bytes` " "before compressing and decompressing:" msgstr "" -"また、:mod:`gzip` モジュールにより簡便でインメモリな圧縮および解凍を行う :" -"func:`~gzip.compress` ならびに :func:`~gzip.decompress` 関数が追加されまし" -"た。\n" +"また、:mod:`gzip` モジュールにより簡便でインメモリな圧縮および解凍を行" +"う :func:`~gzip.compress` ならびに :func:`~gzip.decompress` 関数が追加されま" +"した。\n" "圧縮や解凍の前に :class:`bytes` としてエンコードしなければならない点に注意し" "てください:" @@ -2414,14 +2811,20 @@ msgstr "" "Aides and Brian Curtin in :issue:`9962`, :issue:`1675951`, :issue:`7471` " "and :issue:`2846`.)" -#: ../../whatsnew/3.2.rst:1431 msgid "" "Also, the :class:`zipfile.ZipExtFile ` class was " "reworked internally to represent files stored inside an archive. The new " -"implementation is significantly faster and can be wrapped in an :class:`io." -"BufferedReader` object for more speedups. It also solves an issue where " -"interleaved calls to *read* and *readline* gave the wrong results." -msgstr "" +"implementation is significantly faster and can be wrapped in " +"an :class:`io.BufferedReader` object for more speedups. It also solves an " +"issue where interleaved calls to *read* and *readline* gave the wrong " +"results." +msgstr "" +"さらに :class:`zipfile.ZipExtFile ` はアーカイブ内に格" +"納されるファイルを表現するように内部的に書き換えられました。\n" +"その新しい実装は顕著に高速となり、また :class:`io.BufferedReader` 内に包めば" +"さらにスピードアップ出来ます。\n" +"またこれは、 *read* や *readline* 呼び出しを挟み込むと誤った結果となっていた" +"問題も解決します。" #: ../../whatsnew/3.2.rst:1437 msgid "(Patch submitted by Nir Aides in :issue:`7610`.)" @@ -2448,24 +2851,40 @@ msgid "" "The new *filter* option replaces the older, less flexible *exclude* " "parameter which is now deprecated. If specified, the optional *filter* " "parameter needs to be a :term:`keyword argument`. The user-supplied filter " -"function accepts a :class:`~tarfile.TarInfo` object and returns an updated :" -"class:`~tarfile.TarInfo` object, or if it wants the file to be excluded, the " -"function can return ``None``::" +"function accepts a :class:`~tarfile.TarInfo` object and returns an " +"updated :class:`~tarfile.TarInfo` object, or if it wants the file to be " +"excluded, the function can return ``None``::" msgstr "" "*filter* オプションは古くて柔軟性に欠ける *exclude* パラメータを置き換えるも" -"のであり、 *exclude* は非推奨となりました。 *filter* を指定する場合は :term:" -"`keyword argument` として渡さなければなりません。ユーザ指定の filter 関数は :" -"class:`~tarfile.TarInfo` オブジェクトを受け取り、更新した :class:`~tarfile." -"TarInfo` オブジェクトを返すか、あるいはアーカイブから除外したければ ``None`` " -"を返してください。" +"のであり、 *exclude* は非推奨となりました。 *filter* を指定する場合" +"は :term:`keyword argument` として渡さなければなりません。ユーザ指定の " +"filter 関数は :class:`~tarfile.TarInfo` オブジェクトを受け取り、更新し" +"た :class:`~tarfile.TarInfo` オブジェクトを返すか、あるいはアーカイブから除外" +"したければ ``None`` を返してください。" -#: ../../whatsnew/3.2.rst:1454 msgid "" ">>> import tarfile, glob\n" "\n" ">>> def myfilter(tarinfo):\n" -"... if tarinfo.isfile(): # only save real files\n" -"... tarinfo.uname = 'monty' # redact the user name\n" +"... if tarinfo.isfile(): # only save real files\n" +"... tarinfo.uname = 'monty' # redact the user name\n" +"... return tarinfo\n" +"\n" +">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:\n" +"... for filename in glob.glob('*.txt'):\n" +"... tf.add(filename, filter=myfilter)\n" +"... tf.list()\n" +"-rw-r--r-- monty/501 902 2011-01-26 17:59:11 annotations.txt\n" +"-rw-r--r-- monty/501 123 2011-01-26 17:59:11 general_questions.txt\n" +"-rw-r--r-- monty/501 3514 2011-01-26 17:59:11 prion.txt\n" +"-rw-r--r-- monty/501 124 2011-01-26 17:59:11 py_todo.txt\n" +"-rw-r--r-- monty/501 1399 2011-01-26 17:59:11 semaphore_notes.txt" +msgstr "" +">>> import tarfile, glob\n" +"\n" +">>> def myfilter(tarinfo):\n" +"... if tarinfo.isfile(): # 通常のファイルだけを保存\n" +"... tarinfo.uname = 'monty' # ユーザー名を置き換える\n" "... return tarinfo\n" "\n" ">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:\n" @@ -2477,7 +2896,6 @@ msgid "" "-rw-r--r-- monty/501 3514 2011-01-26 17:59:11 prion.txt\n" "-rw-r--r-- monty/501 124 2011-01-26 17:59:11 py_todo.txt\n" "-rw-r--r-- monty/501 1399 2011-01-26 17:59:11 semaphore_notes.txt" -msgstr "" #: ../../whatsnew/3.2.rst:1471 msgid "" @@ -2499,7 +2917,6 @@ msgstr "" "可能であることが保障されているハッシュアルゴリズムのリストと、現在の実装で利" "用可能なそれらリストの 2 つです::" -#: ../../whatsnew/3.2.rst:1480 msgid "" ">>> import hashlib\n" "\n" @@ -2513,6 +2930,17 @@ msgid "" "'ecdsa-with-SHA1','md4', 'md5', 'sha1', 'DSA-SHA', 'sha224',\n" "'dsaEncryption', 'DSA', 'RIPEMD160', 'sha', 'MD5', 'sha384'}" msgstr "" +">>> import hashlib\n" +"\n" +">>> hashlib.algorithms_guaranteed\n" +"{'sha1', 'sha224', 'sha384', 'sha256', 'sha512', 'md5'}\n" +"\n" +">>> hashlib.algorithms_available\n" +"{'md2', 'SHA256', 'SHA512', 'dsaWithSHA', 'mdc2', 'SHA224', 'MD4', " +"'sha256',\n" +"'sha512', 'ripemd160', 'SHA1', 'MDC2', 'SHA', 'SHA384', 'MD2',\n" +"'ecdsa-with-SHA1','md4', 'md5', 'sha1', 'DSA-SHA', 'sha224',\n" +"'dsaEncryption', 'DSA', 'RIPEMD160', 'sha', 'MD5', 'sha384'}" #: ../../whatsnew/3.2.rst:1491 msgid "(Suggested by Carl Chenet in :issue:`7418`.)" @@ -2525,21 +2953,21 @@ msgstr "ast" #: ../../whatsnew/3.2.rst:1496 msgid "" "The :mod:`ast` module has a wonderful a general-purpose tool for safely " -"evaluating expression strings using the Python literal syntax. The :func:" -"`ast.literal_eval` function serves as a secure alternative to the builtin :" -"func:`eval` function which is easily abused. Python 3.2 adds :class:`bytes` " -"and :class:`set` literals to the list of supported types: strings, bytes, " -"numbers, tuples, lists, dicts, sets, booleans, and ``None``." +"evaluating expression strings using the Python literal syntax. " +"The :func:`ast.literal_eval` function serves as a secure alternative to the " +"builtin :func:`eval` function which is easily abused. Python 3.2 " +"adds :class:`bytes` and :class:`set` literals to the list of supported " +"types: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and " +"``None``." msgstr "" ":mod:`ast` モジュールには、Python リテラル構文を使った式文字列を安全に評価で" -"きる、汎用目的の素晴らしい道具が含まれています。その :func:`ast." -"literal_eval` 関数は、悪用されやすい組み込み関数 :func:`eval` の安全な代替品" -"として働いてくれます。Python 3.2 はこれのサポート型に :class:`bytes` と :" -"class:`set` を加えました。結果サポートする型は全部でこれらになりました: 文字" -"列型、バイト列文字列型、数値型、タプル型、リスト型、辞書型、集合型、真偽値" -"型、``None``。" +"きる、汎用目的の素晴らしい道具が含まれています。そ" +"の :func:`ast.literal_eval` 関数は、悪用されやすい組み込み関数 :func:`eval` " +"の安全な代替品として働いてくれます。Python 3.2 はこれのサポート型" +"に :class:`bytes` と :class:`set` を加えました。結果サポートする型は全部でこ" +"れらになりました: 文字列型、バイト列文字列型、数値型、タプル型、リスト型、辞" +"書型、集合型、真偽値型、``None``。" -#: ../../whatsnew/3.2.rst:1505 msgid "" ">>> from ast import literal_eval\n" "\n" @@ -2553,6 +2981,17 @@ msgid "" " ...\n" "ValueError: malformed node or string: <_ast.Call object at 0x101739a10>" msgstr "" +">>> from ast import literal_eval\n" +"\n" +">>> request = \"{'req': 3, 'func': 'pow', 'args': (2, 0.5)}\"\n" +">>> literal_eval(request)\n" +"{'args': (2, 0.5), 'req': 3, 'func': 'pow'}\n" +"\n" +">>> request = \"os.system('do something harmful')\"\n" +">>> literal_eval(request)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed node or string: <_ast.Call object at 0x101739a10>" #: ../../whatsnew/3.2.rst:1517 msgid "(Implemented by Benjamin Peterson and Georg Brandl.)" @@ -2565,20 +3004,23 @@ msgstr "os" #: ../../whatsnew/3.2.rst:1522 msgid "" "Different operating systems use various encodings for filenames and " -"environment variables. The :mod:`os` module provides two new functions, :" -"func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and decoding " -"filenames:" +"environment variables. The :mod:`os` module provides two new " +"functions, :func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and " +"decoding filenames:" msgstr "" -"ファイル名と環境変数に使われるエンコーディングは OS ごとに様々です。 :mod:" -"`os` モジュールは新たに 2 つの関数 :func:`~os.fsencode` と :func:`~os." -"fsdecode` を追加しました。それぞれファイル名のエンコード、デコードを行います:" +"ファイル名と環境変数に使われるエンコーディングは OS ごとに様々で" +"す。 :mod:`os` モジュールは新たに 2 つの関数 :func:`~os.fsencode` " +"と :func:`~os.fsdecode` を追加しました。それぞれファイル名のエンコード、デ" +"コードを行います:" -#: ../../whatsnew/3.2.rst:1532 msgid "" "Some operating systems allow direct access to encoded bytes in the " "environment. If so, the :const:`os.supports_bytes_environ` constant will be " "true." msgstr "" +"いくつかの OS では環境変数内のエンコードされたバイト列に直接アクセス出来ま" +"す。\n" +"もしそうであれば :const:`os.supports_bytes_environ` 定数は真です。" #: ../../whatsnew/3.2.rst:1536 msgid "" @@ -2586,9 +3028,9 @@ msgid "" "new :func:`os.getenvb` function or use :data:`os.environb` which is a bytes " "version of :data:`os.environ`." msgstr "" -"エンコードされた環境変数への直接アクセス (可能な場合) には、新規関数 :func:" -"`os.getenvb` または :data:`os.environb` を使ってください。これは :data:`os." -"environ` のバイト列バージョンです。" +"エンコードされた環境変数への直接アクセス (可能な場合) には、新規関" +"数 :func:`os.getenvb` または :data:`os.environb` を使ってください。これ" +"は :data:`os.environ` のバイト列バージョンです。" #: ../../whatsnew/3.2.rst:1540 msgid "(Contributed by Victor Stinner.)" @@ -2615,8 +3057,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1551 msgid "" -"*copy_function*: is a callable that will be used to copy files. :func:" -"`shutil.copy2` is used by default." +"*copy_function*: is a callable that will be used to copy " +"files. :func:`shutil.copy2` is used by default." msgstr "" "*copy_function*: これはファイルをコピーするのに使われる呼び出し可能オブジェク" "トです。デフォルトでは :func:`shutil.copy2` が使われます。" @@ -2641,20 +3083,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:1561 msgid "" -"The principal functions are :func:`~shutil.make_archive` and :func:`~shutil." -"unpack_archive`. By default, both operate on the current directory (which " -"can be set by :func:`os.chdir`) and on any sub-directories. The archive " -"filename needs to be specified with a full pathname. The archiving step is " -"non-destructive (the original files are left unchanged)." +"The principal functions are :func:`~shutil.make_archive` " +"and :func:`~shutil.unpack_archive`. By default, both operate on the current " +"directory (which can be set by :func:`os.chdir`) and on any sub-directories. " +"The archive filename needs to be specified with a full pathname. The " +"archiving step is non-destructive (the original files are left unchanged)." msgstr "" -"そのメインとなるのが :func:`~shutil.make_archive` と :func:`~shutil." -"unpack_archive` です。デフォルトではカレントディレクトリ (:func:`os.chdir` で" -"変えれます) とそのサブディレクトリの両方を処理します。アーカイブファイル名は" -"フルパス名で指定しなければなりません(訳注: これの真偽不明。リファレンスに対応" -"する記述なし)。アーカイブするステップは非破壊的です (つまりオリジナルのファイ" -"ルは変更されずにそのままにされます)。" +"そのメインとなるのが :func:`~shutil.make_archive` " +"と :func:`~shutil.unpack_archive` です。デフォルトではカレントディレクトリ " +"(:func:`os.chdir` で変えれます) とそのサブディレクトリの両方を処理します。" +"アーカイブファイル名はフルパス名で指定しなければなりません(訳注: これの真偽不" +"明。リファレンスに対応する記述なし)。アーカイブするステップは非破壊的です (つ" +"まりオリジナルのファイルは変更されずにそのままにされます)。" -#: ../../whatsnew/3.2.rst:1569 msgid "" ">>> import shutil, pprint\n" "\n" @@ -2679,6 +3120,29 @@ msgid "" "... description='xz compression'\n" "... )" msgstr "" +">>> import shutil, pprint\n" +"\n" +">>> os.chdir('mydata') # 元のディレクトリへ移動\n" +">>> f = shutil.make_archive('/var/backup/mydata',\n" +"... 'zip') # 現在のディレクトリをアーカイブ化\n" +">>> f # アーカイブの名前を表示\n" +"'/var/backup/mydata.zip'\n" +">>> os.chdir('tmp') # 展開先へ移動\n" +">>> shutil.unpack_archive('/var/backup/mydata.zip') # データを復元\n" +"\n" +">>> pprint.pprint(shutil.get_archive_formats()) # 認識する形式を表示\n" +"[('bztar', \"bzip2'ed tar-file\"),\n" +" ('gztar', \"gzip'ed tar-file\"),\n" +" ('tar', 'uncompressed tar file'),\n" +" ('zip', 'ZIP file')]\n" +"\n" +">>> shutil.register_archive_format( # 新しいアーカイブ形式を登録\n" +"... name='xz',\n" +"... function=xz.compress, # アーカイブを作る呼び出し可能な関" +"数\n" +"... extra_args=[('level', 8)], # 関数への引数\n" +"... description='xz compression'\n" +"... )" #: ../../whatsnew/3.2.rst:1595 msgid "sqlite3" @@ -2700,15 +3164,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:1602 msgid "" -"The :meth:`sqlite3.Connection.enable_load_extension` and :meth:`sqlite3." -"Connection.load_extension` methods allows you to load SQLite extensions from " -"\".so\" files. One well-known extension is the fulltext-search extension " -"distributed with SQLite." +"The :meth:`sqlite3.Connection.enable_load_extension` " +"and :meth:`sqlite3.Connection.load_extension` methods allows you to load " +"SQLite extensions from \".so\" files. One well-known extension is the " +"fulltext-search extension distributed with SQLite." msgstr "" -":meth:`sqlite3.Connection.enable_load_extension` メソッドと :meth:`sqlite3." -"Connection.load_extension` メソッドにより \".so\" ファイルから SQLite 拡張を" -"ロードできます。良く知られた拡張の一つとして、SQLite と一緒に配布されている全" -"文検索拡張があります。" +":meth:`sqlite3.Connection.enable_load_extension` メソッド" +"と :meth:`sqlite3.Connection.load_extension` メソッドにより \".so\" ファイル" +"から SQLite 拡張をロードできます。良く知られた拡張の一つとして、SQLite と一緒" +"に配布されている全文検索拡張があります。" #: ../../whatsnew/3.2.rst:1607 msgid "(Contributed by R. David Murray and Shashwat Anand; :issue:`8845`.)" @@ -2720,9 +3184,9 @@ msgstr "html" #: ../../whatsnew/3.2.rst:1612 msgid "" -"A new :mod:`html` module was introduced with only a single function, :func:" -"`~html.escape`, which is used for escaping reserved characters from HTML " -"markup:" +"A new :mod:`html` module was introduced with only a single " +"function, :func:`~html.escape`, which is used for escaping reserved " +"characters from HTML markup:" msgstr "" "ただ一つの関数 :func:`~html.escape` が提供される、新しい :mod:`html` モジュー" "ルが導入されました。これは HTML マークアップから予約されている文字をエスケー" @@ -2736,13 +3200,17 @@ msgstr "socket" msgid "The :mod:`socket` module has two new improvements." msgstr ":mod:`socket` モジュールに新たに二つの改善がありました。" -#: ../../whatsnew/3.2.rst:1625 msgid "" "Socket objects now have a :meth:`~socket.socket.detach` method which puts " "the socket into closed state without actually closing the underlying file " "descriptor. The latter can then be reused for other purposes. (Added by " "Antoine Pitrou; :issue:`8524`.)" msgstr "" +"ソケットオブジェクトに :meth:`~socket.socket.detach` メソッドが追加されまし" +"た。\n" +"基になるファイル記述子を実際には閉じずに、ソケットを閉じた状態にします。\n" +"そのファイル記述子は、他の目的に再利用できます。\n" +"(Antoine Pitrou が追加しました。:issue:`8524`。)" #: ../../whatsnew/3.2.rst:1630 msgid "" @@ -2754,10 +3222,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" @@ -2783,14 +3251,16 @@ msgstr "" "ソッド :meth:`~ssl.SSLContext.wrap_socket` を使うと、 SSL コンテキストから " "SSL ソケットを作れます。" -#: ../../whatsnew/3.2.rst:1646 msgid "" "A new function, :func:`!ssl.match_hostname`, supports server identity " "verification for higher-level protocols by implementing the rules of HTTPS " "(from :rfc:`2818`) which are also suitable for other protocols." msgstr "" +"新規関数 :func:`!ssl.match_hostname` はより高水準なプロトコルのためのサーバの" +"身元検証を、HTTPS のルール (:rfc:`2818` より) を実装することでサポートしま" +"す。\n" +"これはほかのプロトコルにも適切なものです。" -#: ../../whatsnew/3.2.rst:1650 msgid "" "The :func:`ssl.wrap_socket() ` constructor " "function now takes a *ciphers* argument. The *ciphers* string lists the " @@ -2798,6 +3268,11 @@ msgid "" "documentation `__." msgstr "" +"コンストラクター関数 :func:`ssl.wrap_socket() ` " +"が *ciphers* 引数を受け付けるようになりました。\n" +"*ciphers* 文字列には、`OpenSSL のドキュメント `__ で説明されている形式で、許可する暗" +"号アルゴリズムを列挙します。" #: ../../whatsnew/3.2.rst:1655 msgid "" @@ -2810,17 +3285,18 @@ msgstr "" "最新版の OpenSSL にリンクしていれば、 :mod:`ssl` モジュールは TLS プロトコル" "に対する Server Name Indication 拡張 (訳注: SNI, :rfc:`4366`) をサポートしま" "す。これは単一の IP ポートで異なった証明書を使った複数「バーチャルホスト」を" -"もたらすものです。この拡張はクライアントモードでのみサポートされ、 :meth:" -"`ssl.SSLContext.wrap_socket` の *server_hostname* を渡すことで活性化されま" -"す。" +"もたらすものです。この拡張はクライアントモードでのみサポートさ" +"れ、 :meth:`ssl.SSLContext.wrap_socket` の *server_hostname* を渡すことで活性" +"化されます。" #: ../../whatsnew/3.2.rst:1661 msgid "" -"Various options have been added to the :mod:`ssl` module, such as :data:" -"`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 protocol." +"Various options have been added to the :mod:`ssl` module, such " +"as :data:`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 " +"protocol." msgstr "" -":mod:`ssl` モジュールに色々オプションが追加されました。例えば :data:`~ssl." -"OP_NO_SSLv2` は安全でなく時代遅れの SSLv2 を無効にします。" +":mod:`ssl` モジュールに色々オプションが追加されました。例え" +"ば :data:`~ssl.OP_NO_SSLv2` は安全でなく時代遅れの SSLv2 を無効にします。" #: ../../whatsnew/3.2.rst:1665 msgid "" @@ -2832,48 +3308,58 @@ msgstr "" "す。SSL 証明書の中に検証できないものがある場合、\"unknown algorithm\" エラー" "を報告します。" -#: ../../whatsnew/3.2.rst:1669 msgid "" "The version of OpenSSL being used is now accessible using the module " -"attributes :const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl." -"OPENSSL_VERSION_INFO` (a 5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` " -"(an integer)." +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer)." msgstr "" +"使われている OpenSSL のバージョンを、モジュール属" +"性 :const:`ssl.OPENSSL_VERSION` (文字列)、 :const:`ssl.OPENSSL_VERSION_INFO` " +"(5-タプル)、および :const:`ssl.OPENSSL_VERSION_NUMBER` (整数) から取れるよう" +"になりました。" #: ../../whatsnew/3.2.rst:1674 msgid "" -"(Contributed by Antoine Pitrou in :issue:`8850`, :issue:`1589`, :issue:" -"`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, and :issue:`8321`.)" +"(Contributed by Antoine Pitrou " +"in :issue:`8850`, :issue:`1589`, :issue:`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, " +"and :issue:`8321`.)" msgstr "" -"(Contributed by Antoine Pitrou in :issue:`8850`, :issue:`1589`, :issue:" -"`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, and :issue:`8321`.)" +"(Contributed by Antoine Pitrou " +"in :issue:`8850`, :issue:`1589`, :issue:`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, " +"and :issue:`8321`.)" #: ../../whatsnew/3.2.rst:1678 msgid "nntp" msgstr "nntp" -#: ../../whatsnew/3.2.rst:1680 msgid "" "The :mod:`!nntplib` module has a revamped implementation with better bytes " "and text semantics as well as more practical APIs. These improvements break " "compatibility with the nntplib version in Python 3.1, which was partly " "dysfunctional in itself." msgstr "" +":mod:`!nntplib` モジュールが改造されて、より良い bytes とテキストについての意" +"味付けを行うようになり、またより実用的な API になりました。\n" +"これら実装は nntplib の Python 3.1 版との互換性を破壊しますが、もともとそれら" +"自身にいくぶん機能不全がありました。" -#: ../../whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`!nntplib." -"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " -"been added." +"Support for secure connections through both implicit (using :class:`!" +"nntplib.NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS " +"has also been added." msgstr "" +"セキュアな接続のサポートも追加されています。\n" +"(:class:`!nntplib.NNTP_SSL` を使う) 暗黙の TLS、(:meth:`!" +"nntplib.NNTP.starttls` を使う) 明示的な TLS ともにサポートされます。" #: ../../whatsnew/3.2.rst:1689 msgid "" -"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant in :issue:" -"`1926`.)" +"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant " +"in :issue:`1926`.)" msgstr "" -"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant in :issue:" -"`1926`.)" +"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant " +"in :issue:`1926`.)" #: ../../whatsnew/3.2.rst:1692 msgid "certificates" @@ -2886,12 +3372,12 @@ msgid "" "server certificate checking against a set of Certificate Authorities, as " "recommended in public uses of HTTPS." msgstr "" -":class:`http.client.HTTPSConnection`, :class:`urllib.request.HTTPSHandler` :" -"func:`urllib.request.urlopen` はサーバ証明書を証明書認証局 (Certification " -"Authority (CA)) セットと照合するためのオプショナル引数を取るようになりまし" -"た。これは HTTPS の公共利用で推奨されるものです。(---訳注: これは " -"*check_hostname* パラメータのことを指していますが、3.4.3 でこれの扱いが変わっ" -"ているのでリファレンスを注意深く読んで下さい。--)" +":class:`http.client.HTTPSConnection`, :class:`urllib.request.HTTPSHandler` :func:`urllib.request.urlopen` " +"はサーバ証明書を証明書認証局 (Certification Authority (CA)) セットと照合する" +"ためのオプショナル引数を取るようになりました。これは HTTPS の公共利用で推奨さ" +"れるものです。(---訳注: これは *check_hostname* パラメータのことを指していま" +"すが、3.4.3 でこれの扱いが変わっているのでリファレンスを注意深く読んで下さ" +"い。--)" #: ../../whatsnew/3.2.rst:1699 msgid "(Added by Antoine Pitrou, :issue:`9003`.)" @@ -2906,8 +3392,8 @@ msgid "" "Support for explicit TLS on standard IMAP4 connections has been added " "through the new :mod:`imaplib.IMAP4.starttls` method." msgstr "" -"標準 IMAP4 接続での明示的な TLS 使用を新規メソッド :mod:`imaplib.IMAP4." -"starttls` で出来るようになりました。" +"標準 IMAP4 接続での明示的な TLS 使用を新規メソッ" +"ド :mod:`imaplib.IMAP4.starttls` で出来るようになりました。" #: ../../whatsnew/3.2.rst:1707 msgid "(Contributed by Lorenzo M. Catucci and Antoine Pitrou, :issue:`4471`.)" @@ -2929,18 +3415,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:1716 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now have a *source_address* parameter for a (host, " -"port) tuple indicating where the HTTP connection is made from." +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now have a " +"*source_address* parameter for a (host, port) tuple indicating where the " +"HTTP connection is made from." msgstr "" -":class:`~http.client.HTTPConnection` クラスと :class:`~http.client." -"HTTPSConnection` クラスが *source_address* パラメータを取るようになりました。" -"これには HTTP(S) 接続の接続元を表す (host, port) のタプルを渡します。" +":class:`~http.client.HTTPConnection` クラス" +"と :class:`~http.client.HTTPSConnection` クラスが *source_address* パラメータ" +"を取るようになりました。これには HTTP(S) 接続の接続元を表す (host, port) のタ" +"プルを渡します。" #: ../../whatsnew/3.2.rst:1721 msgid "" -"Support for certificate checking and HTTPS virtual hosts were added to :" -"class:`~http.client.HTTPSConnection`." +"Support for certificate checking and HTTPS virtual hosts were added " +"to :class:`~http.client.HTTPSConnection`." msgstr "" ":class:`~http.client.HTTPSConnection` に、証明書検証と HTTPS バーチャルホスト" "のサポートが追加されました。" @@ -2963,27 +3451,27 @@ msgstr "" #: ../../whatsnew/3.2.rst:1731 msgid "" -"To establish an HTTPS connection through a proxy server, there is a new :" -"meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host and " -"port for HTTP Connect tunneling." +"To establish an HTTPS connection through a proxy server, there is a " +"new :meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host " +"and port for HTTP Connect tunneling." msgstr "" -"プロキシサーバ経由で HTTPS 接続を確立するために、新規メソッド :meth:`~http." -"client.HTTPConnection.set_tunnel` が追加されています。これにより HTTP 接続ト" -"ンネリングのためのホストとポートをセットします。" +"プロキシサーバ経由で HTTPS 接続を確立するために、新規メソッ" +"ド :meth:`~http.client.HTTPConnection.set_tunnel` が追加されています。これに" +"より HTTP 接続トンネリングのためのホストとポートをセットします。" #: ../../whatsnew/3.2.rst:1735 msgid "" "To match the behavior of :mod:`http.server`, the HTTP client library now " "also encodes headers with ISO-8859-1 (Latin-1) encoding. It was already " "doing that for incoming headers, so now the behavior is consistent for both " -"incoming and outgoing traffic. (See work by Armin Ronacher in :issue:" -"`10980`.)" +"incoming and outgoing traffic. (See work by Armin Ronacher " +"in :issue:`10980`.)" msgstr "" ":mod:`http.server` の振る舞いと合わせ、HTTP クライアントライブラリもヘッダを " "ISO-8859-1 (Latin-1) エンコーディングでエンコードするようになりました。これは" "既に incoming (外から来る方) ヘッダに対して行われていますが、今ではこの振る舞" -"いは incoming、outgoing (外へ向かう方) トラフィックの両方で一貫しています (:" -"issue:`10980` 内の Armin Ronacher による仕事を参照)。" +"いは incoming、outgoing (外へ向かう方) トラフィックの両方で一貫しています " +"(:issue:`10980` 内の Armin Ronacher による仕事を参照)。" #: ../../whatsnew/3.2.rst:1741 msgid "unittest" @@ -3001,7 +3489,6 @@ msgstr "" "ソッドが追加され、テスト失敗時の診断メッセージが改善され、そしてメソッド名が" "より良いものになりました。" -#: ../../whatsnew/3.2.rst:1748 msgid "" "The command-line call ``python -m unittest`` can now accept file paths " "instead of module names for running specific tests (:issue:`10620`). The " @@ -3010,37 +3497,47 @@ msgid "" "specified with the ``-t`` option, a pattern for matching files with ``-p``, " "and a directory to start discovery with ``-s``:" msgstr "" +"特定のテストを実行するコマンドラインの ``python -m unittest`` が、モジュール" +"名の代わりにファイルパスを受け付けるようになりました (:issue:`10620`)。\n" +"新しいテスト探索機能は、最上位ディレクトリからインポートできるテストをパッ" +"ケージ内から見つけられます。\n" +"最上位ディレクトリは ``-t``、ファイル名を照合するパターンは ``-p``、探索を開" +"始するディレクトリは ``-s`` オプションで指定できます。" -#: ../../whatsnew/3.2.rst:1755 msgid "$ python -m unittest discover -s my_proj_dir -p _test.py" -msgstr "" +msgstr "$ python -m unittest discover -s my_proj_dir -p _test.py" #: ../../whatsnew/3.2.rst:1759 ../../whatsnew/3.2.rst:1768 #: ../../whatsnew/3.2.rst:1924 msgid "(Contributed by Michael Foord.)" msgstr "(Contributed by Michael Foord.)" -#: ../../whatsnew/3.2.rst:1761 msgid "" -"Experimentation at the interactive prompt is now easier because the :class:" -"`unittest.TestCase` class can now be instantiated without arguments:" +"Experimentation at the interactive prompt is now easier because " +"the :class:`unittest.TestCase` class can now be instantiated without " +"arguments:" msgstr "" +":class:`unittest.TestCase` を引数なしでインスタンス化できるようになり、対話プ" +"ロンプトで実験しやすくなりました。" #: ../../whatsnew/3.2.rst:1770 msgid "" -"The :mod:`unittest` module has two new methods, :meth:`~unittest.TestCase." -"assertWarns` and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that " -"a given warning type is triggered by the code under test::" +"The :mod:`unittest` module has two new " +"methods, :meth:`~unittest.TestCase.assertWarns` " +"and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that a given " +"warning type is triggered by the code under test::" msgstr "" -":mod:`unittest` モジュールは 2 つの新メソッド :meth:`~unittest.TestCase." -"assertWarns` と :meth:`~unittest.TestCase.assertWarnsRegex` を持ちます。これ" -"らはテストのもとでコードによって所与の警告が発行されるかどうかを検証します::" +":mod:`unittest` モジュールは 2 つの新メソッ" +"ド :meth:`~unittest.TestCase.assertWarns` " +"と :meth:`~unittest.TestCase.assertWarnsRegex` を持ちます。これらはテストのも" +"とでコードによって所与の警告が発行されるかどうかを検証します::" -#: ../../whatsnew/3.2.rst:1775 msgid "" "with self.assertWarns(DeprecationWarning):\n" " legacy_function('XYZ')" msgstr "" +"with self.assertWarns(DeprecationWarning):\n" +" legacy_function('XYZ')" #: ../../whatsnew/3.2.rst:1778 msgid "(Contributed by Antoine Pitrou, :issue:`9754`.)" @@ -3057,11 +3554,12 @@ msgstr "" "テラブルを比較して、要素の出現回数が同じか (順序に関わらず同じ要素が同じ数だ" "け出現するかどうか) をテストします::" -#: ../../whatsnew/3.2.rst:1785 msgid "" "def test_anagram(self):\n" " self.assertCountEqual('algorithm', 'logarithm')" msgstr "" +"def test_anagram(self):\n" +" self.assertCountEqual('algorithm', 'logarithm')" #: ../../whatsnew/3.2.rst:1790 msgid "" @@ -3075,8 +3573,9 @@ msgstr "" "unittest モジュールの大事な特長は、テスト失敗時の有意義な診断を生成するよう腐" "心してくれることです。可能ならば失敗は期待値と実際の出力との差分と一緒に記録" "されます。これは失敗したテスト実行の解析に特に役に立ちますが、差分は時々とて" -"つもなく大きくもなりますので、新たに追加した属性 :attr:`~unittest.TestCase." -"maxDiff` に差分の最大長をセットすることで表示を制御できるようになりました。" +"つもなく大きくもなりますので、新たに追加した属" +"性 :attr:`~unittest.TestCase.maxDiff` に差分の最大長をセットすることで表示を" +"制御できるようになりました。" #: ../../whatsnew/3.2.rst:1797 msgid "" @@ -3084,15 +3583,23 @@ msgid "" "ups." msgstr "さらにモジュールのメソッド名に数多くのクリーンアップを行いました。" -#: ../../whatsnew/3.2.rst:1799 msgid "" -"For example, :meth:`~unittest.TestCase.assertRegex` is the new name for :" -"meth:`!assertRegexpMatches` which was misnamed because the test uses :func:" -"`re.search`, not :func:`re.match`. Other methods using regular expressions " -"are now named using short form \"Regex\" in preference to \"Regexp\" -- this " -"matches the names used in other unittest implementations, matches Python's " -"old name for the :mod:`re` module, and it has unambiguous camel-casing." +"For example, :meth:`~unittest.TestCase.assertRegex` is the new name " +"for :meth:`!assertRegexpMatches` which was misnamed because the test " +"uses :func:`re.search`, not :func:`re.match`. Other methods using regular " +"expressions are now named using short form \"Regex\" in preference to " +"\"Regexp\" -- this matches the names used in other unittest implementations, " +"matches Python's old name for the :mod:`re` module, and it has unambiguous " +"camel-casing." msgstr "" +"例えば、:meth:`!assertRegexpMatches` " +"は :meth:`~unittest.TestCase.assertRegex` に改名されました。\n" +"このテストは :func:`re.match` ではなく :func:`re.search` を使うため、以前の名" +"前は不適切でした。\n" +"正規表現を使う他のメソッドも、\"Regexp\" の代わりに短い \"Regex\" を名前に使" +"うようになりました。\n" +"これは他の unittest 実装で使われる名前や、Python の :mod:`re` モジュールの旧" +"名と一致し、キャメルケースの表記も明確になります。" #: ../../whatsnew/3.2.rst:1807 msgid "(Contributed by Raymond Hettinger and implemented by Ezio Melotti.)" @@ -3114,63 +3621,63 @@ msgstr "以前の名前" msgid "Preferred Name" msgstr "推奨名" -#: ../../whatsnew/3.2.rst:1815 msgid ":meth:`!assert_`" -msgstr "" +msgstr ":meth:`!assert_`" #: ../../whatsnew/3.2.rst:1815 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.2.rst:1816 msgid ":meth:`!assertEquals`" -msgstr "" +msgstr ":meth:`!assertEquals`" #: ../../whatsnew/3.2.rst:1816 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.2.rst:1817 msgid ":meth:`!assertNotEquals`" -msgstr "" +msgstr ":meth:`!assertNotEquals`" #: ../../whatsnew/3.2.rst:1817 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.2.rst:1818 msgid ":meth:`!assertAlmostEquals`" -msgstr "" +msgstr ":meth:`!assertAlmostEquals`" #: ../../whatsnew/3.2.rst:1818 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.2.rst:1819 msgid ":meth:`!assertNotAlmostEquals`" -msgstr "" +msgstr ":meth:`!assertNotAlmostEquals`" #: ../../whatsnew/3.2.rst:1819 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.2.rst:1822 msgid "" "Likewise, the ``TestCase.fail*`` methods deprecated in Python 3.1 are " "expected to be removed in Python 3.3." msgstr "" +"同様に、Python 3.1 で非推奨になった ``TestCase.fail*`` メソッドは Python 3.3 " +"で削除される予定です。" #: ../../whatsnew/3.2.rst:1825 msgid "(Contributed by Ezio Melotti; :issue:`9424`.)" msgstr "(Contributed by Ezio Melotti; :issue:`9424`.)" -#: ../../whatsnew/3.2.rst:1827 msgid "" "The :meth:`!assertDictContainsSubset` method was deprecated because it was " "misimplemented with the arguments in the wrong order. This created hard-to-" -"debug optical illusions where tests like ``TestCase()." -"assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." +"debug optical illusions where tests like " +"``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." msgstr "" +":meth:`!assertDictContainsSubset` メソッドは、引数の順序を逆にして実装されて" +"いたため、非推奨になりました。\n" +"そのため、``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` の" +"ようなテストが失敗し、一見した印象と動作が食い違ってデバッグが難しくなってい" +"ました。" #: ../../whatsnew/3.2.rst:1835 msgid "random" @@ -3183,18 +3690,18 @@ msgid "" "``int(n*random())`` which had a slight bias whenever *n* was not a power of " "two. Now, multiple selections are made from a range up to the next power of " "two and a selection is kept only when it falls within the range ``0 <= x < " -"n``. The functions and methods affected are :func:`~random.randrange`, :" -"func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` and :" -"func:`~random.sample`." +"n``. The functions and methods affected " +"are :func:`~random.randrange`, :func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` " +"and :func:`~random.sample`." msgstr "" ":mod:`random` モジュールの整数メソッドの一様分布の生成が改善されました。\n" "以前は ``int(n*random())`` を計算していました。\n" "この方法では *n* が2の冪乗でない限り僅かにバイアスがあります。\n" "現在の方法では次の2の冪乗の範囲まで複数の選択肢を作成し、``0 <= x < n`` の範" "囲に入ったもののみを保持します。\n" -"影響を受ける関数やメソッドは :func:`~random.randrange`、:func:`~random." -"randint`、:func:`~random.choice`、:func:`~random.shuffle` ならびに :func:" -"`~random.sample` です。" +"影響を受ける関数やメソッド" +"は :func:`~random.randrange`、:func:`~random.randint`、:func:`~random.choice`、:func:`~random.shuffle` " +"ならびに :func:`~random.sample` です。" #: ../../whatsnew/3.2.rst:1846 msgid "(Contributed by Raymond Hettinger; :issue:`9025`.)" @@ -3243,19 +3750,20 @@ msgstr "tempfile" #: ../../whatsnew/3.2.rst:1873 msgid "" -"The :mod:`tempfile` module has a new context manager, :class:`~tempfile." -"TemporaryDirectory` which provides easy deterministic cleanup of temporary " -"directories::" +"The :mod:`tempfile` module has a new context " +"manager, :class:`~tempfile.TemporaryDirectory` which provides easy " +"deterministic cleanup of temporary directories::" msgstr "" -":mod:`tempfile` モジュールに新たなコンテキストマネージャ :class:`~tempfile." -"TemporaryDirectory` が追加されました。一時ディレクトリの確実な後片付けを容易" -"に行えます::" +":mod:`tempfile` モジュールに新たなコンテキストマネー" +"ジャ :class:`~tempfile.TemporaryDirectory` が追加されました。一時ディレクトリ" +"の確実な後片付けを容易に行えます::" -#: ../../whatsnew/3.2.rst:1877 msgid "" "with tempfile.TemporaryDirectory() as tmpdirname:\n" " print('created temporary dir:', tmpdirname)" msgstr "" +"with tempfile.TemporaryDirectory() as tmpdirname:\n" +" print('created temporary dir:', tmpdirname)" #: ../../whatsnew/3.2.rst:1880 msgid "(Contributed by Neil Schemenauer and Nick Coghlan; :issue:`5178`.)" @@ -3267,18 +3775,17 @@ msgstr "inspect" #: ../../whatsnew/3.2.rst:1885 msgid "" -"The :mod:`inspect` module has a new function :func:`~inspect." -"getgeneratorstate` to easily identify the current state of a generator-" -"iterator::" +"The :mod:`inspect` module has a new " +"function :func:`~inspect.getgeneratorstate` to easily identify the current " +"state of a generator-iterator::" msgstr "" ":mod:`inspect` モジュールに新たな関数 :func:`~inspect.getgeneratorstate` が追" "加されました。これで簡単にジェネレータイテレータの現在状態を識別出来ます (---" "訳注: generator-iterator という用語を使っている箇所は Python ドキュメント全体" -"通して多くはないのですが 2.x の :ref:`yield` 説明中に登場します。ジェネレータ" -"と同じ意味です。なお getgeneratorstate はジェネレータでないイテレータには使え" -"ません。---)::" +"通して多くはないのですが 2.x の yield 文説明中に登場します。ジェネレータと同" +"じ意味です。なお getgeneratorstate はジェネレータでないイテレータには使えませ" +"ん。---)::" -#: ../../whatsnew/3.2.rst:1889 msgid "" ">>> from inspect import getgeneratorstate\n" ">>> def gen():\n" @@ -3295,6 +3802,20 @@ msgid "" ">>> getgeneratorstate(g)\n" "'GEN_CLOSED'" msgstr "" +">>> from inspect import getgeneratorstate\n" +">>> def gen():\n" +"... yield 'demo'\n" +"...\n" +">>> g = gen()\n" +">>> getgeneratorstate(g)\n" +"'GEN_CREATED'\n" +">>> next(g)\n" +"'demo'\n" +">>> getgeneratorstate(g)\n" +"'GEN_SUSPENDED'\n" +">>> next(g, None)\n" +">>> getgeneratorstate(g)\n" +"'GEN_CLOSED'" #: ../../whatsnew/3.2.rst:1904 msgid "(Contributed by Rodolpho Eckhardt and Nick Coghlan, :issue:`10220`.)" @@ -3303,16 +3824,15 @@ msgstr "(Contributed by Rodolpho Eckhardt and Nick Coghlan, :issue:`10220`.)" #: ../../whatsnew/3.2.rst:1906 msgid "" "To support lookups without the possibility of activating a dynamic " -"attribute, the :mod:`inspect` module has a new function, :func:`~inspect." -"getattr_static`. Unlike :func:`hasattr`, this is a true read-only search, " -"guaranteed not to change state while it is searching::" +"attribute, the :mod:`inspect` module has a new " +"function, :func:`~inspect.getattr_static`. Unlike :func:`hasattr`, this is a " +"true read-only search, guaranteed not to change state while it is searching::" msgstr "" -"動的な属性を活性化することなく検索するのをサポートするために、 :mod:" -"`inspect` モジュールに :func:`~inspect.getattr_static` 関数が追加されまし" -"た。 :func:`hasattr` とは違ってこれは本当に読み出しのみの検索であり、検索中に" -"状態変更しないことが保障されています::" +"動的な属性を活性化することなく検索するのをサポートするため" +"に、 :mod:`inspect` モジュールに :func:`~inspect.getattr_static` 関数が追加さ" +"れました。 :func:`hasattr` とは違ってこれは本当に読み出しのみの検索であり、検" +"索中に状態変更しないことが保障されています::" -#: ../../whatsnew/3.2.rst:1911 msgid "" ">>> class A:\n" "... @property\n" @@ -3327,21 +3847,35 @@ msgid "" ">>> inspect.getattr_static(a, 'f')\n" "" msgstr "" +">>> class A:\n" +"... @property\n" +"... def f(self):\n" +"... print('Running')\n" +"... return 10\n" +"...\n" +">>> a = A()\n" +">>> getattr(a, 'f')\n" +"Running\n" +"10\n" +">>> inspect.getattr_static(a, 'f')\n" +"" #: ../../whatsnew/3.2.rst:1927 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.2.rst:1929 msgid "" "The :mod:`pydoc` module now provides a much-improved web server interface, " "as well as a new command-line option ``-b`` to automatically open a browser " "window to display that server:" msgstr "" +":mod:`pydoc` モジュールのウェブサーバーインターフェースが大幅に改善されまし" +"た。\n" +"また、新しいコマンドラインオプション ``-b`` により、ブラウザーのウィンドウを" +"自動的に開いてサーバーを表示できます。" -#: ../../whatsnew/3.2.rst:1933 msgid "$ pydoc3.2 -b" -msgstr "" +msgstr "$ pydoc3.2 -b" #: ../../whatsnew/3.2.rst:1937 msgid "(Contributed by Ron Adam; :issue:`2001`.)" @@ -3353,17 +3887,18 @@ msgstr "dis" #: ../../whatsnew/3.2.rst:1942 msgid "" -"The :mod:`dis` module gained two new functions for inspecting code, :func:" -"`~dis.code_info` and :func:`~dis.show_code`. Both provide detailed code " -"object information for the supplied function, method, source code string or " -"code object. The former returns a string and the latter prints it::" +"The :mod:`dis` module gained two new functions for inspecting " +"code, :func:`~dis.code_info` and :func:`~dis.show_code`. Both provide " +"detailed code object information for the supplied function, method, source " +"code string or code object. The former returns a string and the latter " +"prints it::" msgstr "" -":mod:`dis` モジュールに、コードを調べるための 2 つの新しい関数 :func:`~dis." -"code_info` と :func:`~dis.show_code` が追加されました。ともに、与えられた関" -"数、メソッド、ソースコード文字列、コードオブジェクトについての詳細なコードオ" -"ブジェクト情報を提供します。前者はそれを文字列で返し、後者は印字します::" +":mod:`dis` モジュールに、コードを調べるための 2 つの新しい関" +"数 :func:`~dis.code_info` と :func:`~dis.show_code` が追加されました。とも" +"に、与えられた関数、メソッド、ソースコード文字列、コードオブジェクトについて" +"の詳細なコードオブジェクト情報を提供します。前者はそれを文字列で返し、後者は" +"印字します::" -#: ../../whatsnew/3.2.rst:1947 msgid "" ">>> import dis, random\n" ">>> dis.show_code(random.choice)\n" @@ -3388,6 +3923,28 @@ msgid "" " 1: seq\n" " 2: i" msgstr "" +">>> import dis, random\n" +">>> dis.show_code(random.choice)\n" +"Name: choice\n" +"Filename: /Library/Frameworks/Python.framework/Versions/3.2/lib/" +"python3.2/random.py\n" +"Argument count: 2\n" +"Kw-only arguments: 0\n" +"Number of locals: 3\n" +"Stack size: 11\n" +"Flags: OPTIMIZED, NEWLOCALS, NOFREE\n" +"Constants:\n" +" 0: 'Choose a random element from a non-empty sequence.'\n" +" 1: 'Cannot choose from an empty sequence'\n" +"Names:\n" +" 0: _randbelow\n" +" 1: len\n" +" 2: ValueError\n" +" 3: IndexError\n" +"Variable names:\n" +" 0: self\n" +" 1: seq\n" +" 2: i" #: ../../whatsnew/3.2.rst:1969 msgid "" @@ -3398,7 +3955,6 @@ msgstr "" "また、 :func:`~dis.dis` 関数が文字列引数を取れるようになり、これによって、よ" "くあるイディオム ``dis(compile(s, '', 'eval'))`` は ``dis(s)`` で一撃です::" -#: ../../whatsnew/3.2.rst:1973 msgid "" ">>> dis('3*x+1 if x%2==1 else x//2')\n" " 1 0 LOAD_NAME 0 (x)\n" @@ -3418,6 +3974,23 @@ msgid "" " 34 BINARY_FLOOR_DIVIDE\n" " 35 RETURN_VALUE" msgstr "" +">>> dis('3*x+1 if x%2==1 else x//2')\n" +" 1 0 LOAD_NAME 0 (x)\n" +" 3 LOAD_CONST 0 (2)\n" +" 6 BINARY_MODULO\n" +" 7 LOAD_CONST 1 (1)\n" +" 10 COMPARE_OP 2 (==)\n" +" 13 POP_JUMP_IF_FALSE 28\n" +" 16 LOAD_CONST 2 (3)\n" +" 19 LOAD_NAME 0 (x)\n" +" 22 BINARY_MULTIPLY\n" +" 23 LOAD_CONST 1 (1)\n" +" 26 BINARY_ADD\n" +" 27 RETURN_VALUE\n" +" >> 28 LOAD_NAME 0 (x)\n" +" 31 LOAD_CONST 0 (2)\n" +" 34 BINARY_FLOOR_DIVIDE\n" +" 35 RETURN_VALUE" #: ../../whatsnew/3.2.rst:1991 msgid "" @@ -3436,11 +4009,12 @@ msgstr "(Contributed by Nick Coghlan in :issue:`9147`.)" msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.2.rst:2000 msgid "" "All database modules now support the :meth:`!get` and :meth:`!setdefault` " "methods." msgstr "" +"全データベースモジュールが :meth:`!get` と :meth:`!setdefault` メソッドをサ" +"ポートしました。" #: ../../whatsnew/3.2.rst:2002 msgid "(Suggested by Ray Allen in :issue:`9523`.)" @@ -3493,7 +4067,6 @@ msgstr "" ":func:`~site.getusersitepackages` はユーザ固有の site-packages ディレクトリの" "パスを明らかにします。" -#: ../../whatsnew/3.2.rst:2025 msgid "" ">>> import site\n" ">>> site.getsitepackages()\n" @@ -3506,6 +4079,16 @@ msgid "" ">>> site.getusersitepackages()\n" "'/Users/raymondhettinger/Library/Python/3.2/lib/python/site-packages'" msgstr "" +">>> import site\n" +">>> site.getsitepackages()\n" +"['/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-" +"packages',\n" +" '/Library/Frameworks/Python.framework/Versions/3.2/lib/site-python',\n" +" '/Library/Python/3.2/site-packages']\n" +">>> site.getuserbase()\n" +"'/Users/raymondhettinger/Library/Python/3.2'\n" +">>> site.getusersitepackages()\n" +"'/Users/raymondhettinger/Library/Python/3.2/lib/python/site-packages'" #: ../../whatsnew/3.2.rst:2035 msgid "" @@ -3514,13 +4097,16 @@ msgid "" msgstr "" "便宜のために、いくつかの site の機能はコマンドラインから直接アクセス可能です:" -#: ../../whatsnew/3.2.rst:2038 msgid "" "$ python -m site --user-base\n" "/Users/raymondhettinger/.local\n" "$ python -m site --user-site\n" "/Users/raymondhettinger/.local/lib/python3.2/site-packages" msgstr "" +"$ python -m site --user-base\n" +"/Users/raymondhettinger/.local\n" +"$ python -m site --user-site\n" +"/Users/raymondhettinger/.local/lib/python3.2/site-packages" #: ../../whatsnew/3.2.rst:2045 msgid "(Contributed by Tarek Ziadé in :issue:`6693`.)" @@ -3563,12 +4149,15 @@ msgstr "" ":func:`~sysconfig.get_python_version` は Python バージョンを文字列で \"3.2\" " "のように返します。" -#: ../../whatsnew/3.2.rst:2062 msgid "" "It also provides access to the paths and variables corresponding to one of " "seven named schemes used by ``distutils``. Those include *posix_prefix*, " "*posix_home*, *posix_user*, *nt*, *nt_user*, *os2*, *os2_home*:" msgstr "" +"また、``distutils`` が使う七つの名前付きスキームのいずれかに対応するパスと変" +"数にもアクセスできます。\n" +"スキームには *posix_prefix*、*posix_home*、*posix_user*、*nt*、*nt_user*、" +"*os2*、*os2_home* があります。" #: ../../whatsnew/3.2.rst:2066 msgid "" @@ -3590,7 +4179,6 @@ msgstr "" msgid "There is also a convenient command-line interface:" msgstr "便利なコマンドラインインターフェースもあります:" -#: ../../whatsnew/3.2.rst:2073 msgid "" "C:\\Python32>python -m sysconfig\n" "Platform: \"win32\"\n" @@ -3628,6 +4216,41 @@ msgid "" " userbase = \"C:\\Documents and Settings\\Raymond\\Application " "Data\\Python\"" msgstr "" +"C:\\Python32>python -m sysconfig\n" +"Platform: \"win32\"\n" +"Python version: \"3.2\"\n" +"Current installation scheme: \"nt\"\n" +"\n" +"Paths:\n" +" data = \"C:\\Python32\"\n" +" include = \"C:\\Python32\\Include\"\n" +" platinclude = \"C:\\Python32\\Include\"\n" +" platlib = \"C:\\Python32\\Lib\\site-packages\"\n" +" platstdlib = \"C:\\Python32\\Lib\"\n" +" purelib = \"C:\\Python32\\Lib\\site-packages\"\n" +" scripts = \"C:\\Python32\\Scripts\"\n" +" stdlib = \"C:\\Python32\\Lib\"\n" +"\n" +"Variables:\n" +" BINDIR = \"C:\\Python32\"\n" +" BINLIBDEST = \"C:\\Python32\\Lib\"\n" +" EXE = \".exe\"\n" +" INCLUDEPY = \"C:\\Python32\\Include\"\n" +" LIBDEST = \"C:\\Python32\\Lib\"\n" +" SO = \".pyd\"\n" +" VERSION = \"32\"\n" +" abiflags = \"\"\n" +" base = \"C:\\Python32\"\n" +" exec_prefix = \"C:\\Python32\"\n" +" platbase = \"C:\\Python32\"\n" +" prefix = \"C:\\Python32\"\n" +" projectbase = \"C:\\Python32\"\n" +" py_version = \"3.2\"\n" +" py_version_nodot = \"32\"\n" +" py_version_short = \"3.2\"\n" +" srcdir = \"C:\\Python32\"\n" +" userbase = \"C:\\Documents and Settings\\Raymond\\Application " +"Data\\Python\"" #: ../../whatsnew/3.2.rst:2110 msgid "(Moved out of Distutils by Tarek Ziadé.)" @@ -3645,8 +4268,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2117 msgid "" -":file:`pdb.py` now has a ``-c`` option that executes commands as given in a :" -"file:`.pdbrc` script file." +":file:`pdb.py` now has a ``-c`` option that executes commands as given in " +"a :file:`.pdbrc` script file." msgstr "" ":file:`pdb.py` は ``-c`` オプションで指定した :file:`.pdbrc` スクリプトファイ" "ルを実行できるようになっています。" @@ -3659,10 +4282,11 @@ msgstr "" ":file:`.pdbrc` スクリプトファイルにはデバッグを継続する ``continue`` コマンド" "と ``next`` コマンドを含むことができます。" -#: ../../whatsnew/3.2.rst:2121 msgid "" "The :class:`~pdb.Pdb` class constructor now accepts a *nosigint* argument." msgstr "" +":class:`~pdb.Pdb` クラスのコンストラクターが *nosigint* 引数を受け付けるよう" +"になりました。" #: ../../whatsnew/3.2.rst:2122 msgid "" @@ -3700,23 +4324,28 @@ msgstr "(Contributed by Georg Brandl, Antonio Cuni and Ilya Sandler.)" msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.2.rst:2135 msgid "" "The :mod:`configparser` module was modified to improve usability and " -"predictability of the default parser and its supported INI syntax. The old :" -"class:`!ConfigParser` class was removed in favor of :class:`!" -"SafeConfigParser` which has in turn been renamed to :class:`~configparser." -"ConfigParser`. Support for inline comments is now turned off by default and " -"section or option duplicates are not allowed in a single configuration " -"source." -msgstr "" +"predictability of the default parser and its supported INI syntax. The " +"old :class:`!ConfigParser` class was removed in favor of :class:`!" +"SafeConfigParser` which has in turn been renamed " +"to :class:`~configparser.ConfigParser`. Support for inline comments is now " +"turned off by default and section or option duplicates are not allowed in a " +"single configuration source." +msgstr "" +":mod:`configparser` モジュールが、デフォルトパーサとそれがサポートする INI 構" +"文の使い勝手とわかりやすさを改善するために修正されました。\n" +"元のクラス :class:`!ConfigParser` が削除されて、代わりに昔から推奨だっ" +"た :class:`!SafeConfigParser` が新しい :class:`~configparser.ConfigParser` に" +"なりました。\n" +"インラインコメントはデフォルトでオフに変更され、また、単一の設定ソース内では" +"セクションとオプションの重複を禁止しています。" #: ../../whatsnew/3.2.rst:2142 msgid "Config parsers gained a new API based on the mapping protocol::" msgstr "" "Config parsers はマッピングプロトコルにもとづく新しい API を獲得しました::" -#: ../../whatsnew/3.2.rst:2144 msgid "" ">>> parser = ConfigParser()\n" ">>> parser.read_string(\"\"\"\n" @@ -3744,6 +4373,31 @@ msgid "" ">>> section['title']\n" "'Options (editable: no)'" msgstr "" +">>> parser = ConfigParser()\n" +">>> parser.read_string(\"\"\"\n" +"... [DEFAULT]\n" +"... location = upper left\n" +"... visible = yes\n" +"... editable = no\n" +"... color = blue\n" +"...\n" +"... [main]\n" +"... title = Main Menu\n" +"... color = green\n" +"...\n" +"... [options]\n" +"... title = Options\n" +"... \"\"\")\n" +">>> parser['main']['color']\n" +"'green'\n" +">>> parser['main']['editable']\n" +"'no'\n" +">>> section = parser['options']\n" +">>> section['title']\n" +"'Options'\n" +">>> section['title'] = 'Options (editable: %(editable)s)'\n" +">>> section['title']\n" +"'Options (editable: no)'" #: ../../whatsnew/3.2.rst:2170 msgid "" @@ -3769,10 +4423,9 @@ msgid "" "There is support for pluggable interpolation including an additional " "interpolation handler :class:`~configparser.ExtendedInterpolation`::" msgstr "" -"抜き挿し可能 (pluggable) な補間サポートがあって、これには追加の補間ハンドラ :" -"class:`~configparser.ExtendedInterpolation` が含まれています::" +"抜き挿し可能 (pluggable) な補間サポートがあって、これには追加の補間ハンド" +"ラ :class:`~configparser.ExtendedInterpolation` が含まれています::" -#: ../../whatsnew/3.2.rst:2180 msgid "" ">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" ">>> parser.read_dict({'buildout': {'directory': '/home/ambv/zope9'},\n" @@ -3804,6 +4457,35 @@ msgid "" ">>> instance['zope9-location']\n" "'/opt/zope'" msgstr "" +">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" +">>> parser.read_dict({'buildout': {'directory': '/home/ambv/zope9'},\n" +"... 'custom': {'prefix': '/usr/local'}})\n" +">>> parser.read_string(\"\"\"\n" +"... [buildout]\n" +"... parts =\n" +"... zope9\n" +"... instance\n" +"... find-links =\n" +"... ${buildout:directory}/downloads/dist\n" +"...\n" +"... [zope9]\n" +"... recipe = plone.recipe.zope9install\n" +"... location = /opt/zope\n" +"...\n" +"... [instance]\n" +"... recipe = plone.recipe.zope9instance\n" +"... zope9-location = ${zope9:location}\n" +"... zope-conf = ${custom:prefix}/etc/zope.conf\n" +"... \"\"\")\n" +">>> parser['buildout']['find-links']\n" +"'\\n/home/ambv/zope9/downloads/dist'\n" +">>> parser['instance']['zope-conf']\n" +"'/usr/local/etc/zope.conf'\n" +">>> instance = parser['instance']\n" +">>> instance['zope-conf']\n" +"'/usr/local/etc/zope.conf'\n" +">>> instance['zope9-location']\n" +"'/opt/zope'" #: ../../whatsnew/3.2.rst:2210 msgid "" @@ -3833,8 +4515,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2223 msgid "" -"The :func:`~urllib.parse.urlparse` function now supports `IPv6 `_ addresses as described in :rfc:`2732`:" +"The :func:`~urllib.parse.urlparse` function now supports `IPv6 `_ addresses as described in :rfc:`2732`:" msgstr "" ":func:`~urllib.parse.urlparse` 関数が :rfc:`2732` にて記述されている `IPv6 " "`_ アドレスをサポートするようになりまし" @@ -3847,7 +4529,6 @@ msgid "" msgstr "" ":func:`~urllib.parse.urldefrag` 関数は、今や :term:`named tuple` を返します::" -#: ../../whatsnew/3.2.rst:2237 msgid "" ">>> r = urllib.parse.urldefrag('http://python.org/about/#target')\n" ">>> r\n" @@ -3857,20 +4538,26 @@ msgid "" ">>> r.fragment\n" "'target'" msgstr "" +">>> r = urllib.parse.urldefrag('http://python.org/about/#target')\n" +">>> r\n" +"DefragResult(url='http://python.org/about/', fragment='target')\n" +">>> r[0]\n" +"'http://python.org/about/'\n" +">>> r.fragment\n" +"'target'" #: ../../whatsnew/3.2.rst:2245 msgid "" "And, the :func:`~urllib.parse.urlencode` function is now much more flexible, " "accepting either a string or bytes type for the *query* argument. If it is " -"a string, then the *safe*, *encoding*, and *error* parameters are sent to :" -"func:`~urllib.parse.quote_plus` for encoding::" +"a string, then the *safe*, *encoding*, and *error* parameters are sent " +"to :func:`~urllib.parse.quote_plus` for encoding::" msgstr "" "また、 :func:`~urllib.parse.urlencode` 関数はさらに柔軟になり、 *query* 引数" "としては文字列とバイト列のどちらも受け付けます。文字列で渡した場合、パラメー" -"タ *safe*, *encoding*, *error* がエンコードのために :func:`~urllib.parse." -"quote_plus` に送られます::" +"タ *safe*, *encoding*, *error* がエンコードのため" +"に :func:`~urllib.parse.quote_plus` に送られます::" -#: ../../whatsnew/3.2.rst:2250 msgid "" ">>> urllib.parse.urlencode([\n" "... ('type', 'telenovela'),\n" @@ -3878,28 +4565,33 @@ msgid "" "... encoding='latin-1')\n" "'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'" msgstr "" +">>> urllib.parse.urlencode([\n" +"... ('type', 'telenovela'),\n" +"... ('name', '¿Dónde Está Elisa?')],\n" +"... encoding='latin-1')\n" +"'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'" #: ../../whatsnew/3.2.rst:2256 msgid "" -"As detailed in :ref:`parsing-ascii-encoded-bytes`, all the :mod:`urllib." -"parse` functions now accept ASCII-encoded byte strings as input, so long as " -"they are not mixed with regular strings. If ASCII-encoded byte strings are " -"given as parameters, the return types will also be an ASCII-encoded byte " -"strings:" +"As detailed in :ref:`parsing-ascii-encoded-bytes`, all " +"the :mod:`urllib.parse` functions now accept ASCII-encoded byte strings as " +"input, so long as they are not mixed with regular strings. If ASCII-encoded " +"byte strings are given as parameters, the return types will also be an ASCII-" +"encoded byte strings:" msgstr "" -":ref:`parsing-ascii-encoded-bytes` に詳細に書きましたが、全ての :mod:`urllib." -"parse` 関数は今では ASCII エンコードされたバイト文字列を (通常の文字列と混ぜ" -"ない限り) 入力として受け付けます。ASCII エンコードされたバイト文字列がパラ" -"メータとして与えられると、戻り値の型も ASCII エンコードされたバイト文字列にな" -"ります:" +":ref:`parsing-ascii-encoded-bytes` に詳細に書きましたが、全て" +"の :mod:`urllib.parse` 関数は今では ASCII エンコードされたバイト文字列を (通" +"常の文字列と混ぜない限り) 入力として受け付けます。ASCII エンコードされたバイ" +"ト文字列がパラメータとして与えられると、戻り値の型も ASCII エンコードされたバ" +"イト文字列になります:" #: ../../whatsnew/3.2.rst:2265 msgid "" -"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`, :" -"issue:`5468`, and :issue:`9873`.)" +"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran " +"in :issue:`2987`, :issue:`5468`, and :issue:`9873`.)" msgstr "" -"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`, :" -"issue:`5468`, and :issue:`9873`.)" +"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran " +"in :issue:`2987`, :issue:`5468`, and :issue:`9873`.)" #: ../../whatsnew/3.2.rst:2269 msgid "mailbox" @@ -3925,14 +4617,13 @@ 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 "" -"As expected, the :meth:`~mailbox.Mailbox.add` method for :class:`mailbox." -"Mailbox` objects now accepts binary input." +"As expected, the :meth:`~mailbox.Mailbox.add` method " +"for :class:`mailbox.Mailbox` objects now accepts binary input." msgstr "" ":class:`mailbox.Mailbox` オブジェクトの :meth:`~mailbox.Mailbox.add` メソッド" "は、今や期待通りにバイナリ入力を受け付けます。" @@ -3949,11 +4640,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:2287 msgid "" -"There is also support for binary output. The :meth:`~mailbox.Mailbox." -"get_file` method now returns a file in the binary mode (where it used to " -"incorrectly set the file to text-mode). There is also a new :meth:`~mailbox." -"Mailbox.get_bytes` method that returns a :class:`bytes` representation of a " -"message corresponding to a given *key*." +"There is also support for binary output. " +"The :meth:`~mailbox.Mailbox.get_file` method now returns a file in the " +"binary mode (where it used to incorrectly set the file to text-mode). There " +"is also a new :meth:`~mailbox.Mailbox.get_bytes` method that returns " +"a :class:`bytes` representation of a message corresponding to a given *key*." msgstr "" "バイナリ出力のサポートもあります。 :meth:`~mailbox.Mailbox.get_file` メソッド" "は今ではバイナリモードのファイルを返します (これまでは不適切にテキストモード" @@ -3962,15 +4653,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:2293 msgid "" -"It is still possible to get non-binary output using the old API's :meth:" -"`~mailbox.Mailbox.get_string` method, but that approach is not very useful. " -"Instead, it is best to extract messages from a :class:`~mailbox.Message` " -"object or to load them from binary input." +"It is still possible to get non-binary output using the old " +"API's :meth:`~mailbox.Mailbox.get_string` method, but that approach is not " +"very useful. Instead, it is best to extract messages from " +"a :class:`~mailbox.Message` object or to load them from binary input." msgstr "" "今でも古い API の :meth:`~mailbox.Mailbox.get_string` を使って非バイナリ出力" -"は可能ですが、そのアプローチはあまり役に立ちません。そうではなく :class:" -"`~mailbox.Message` オブジェクトからメッセージを抽出するか、それらをバイナリ入" -"力からロードするのが最善です。" +"は可能ですが、そのアプローチはあまり役に立ちません。そうではな" +"く :class:`~mailbox.Message` オブジェクトからメッセージを抽出するか、それらを" +"バイナリ入力からロードするのが最善です。" #: ../../whatsnew/3.2.rst:2298 msgid "" @@ -3984,17 +4675,21 @@ msgstr "" msgid "turtledemo" msgstr "turtledemo" -#: ../../whatsnew/3.2.rst:2304 msgid "" "The demonstration code for the :mod:`turtle` module was moved from the " "*Demo* directory to main library. It includes over a dozen sample scripts " "with lively displays. Being on :data:`sys.path`, it can now be run directly " "from the command-line:" msgstr "" +":mod:`turtle` モジュールのデモが *Demo* からメインライブラリに移動しまし" +"た。\n" +"これには 1 ダースを超える、精力的な表示をするサンプルスクリプトが含まれていま" +"す。\n" +":data:`sys.path` 内に置かれるわけなので、今やコマンドラインから直接実行出来ま" +"す:" -#: ../../whatsnew/3.2.rst:2309 msgid "$ python -m turtledemo" -msgstr "" +msgstr "$ python -m turtledemo" #: ../../whatsnew/3.2.rst:2313 msgid "" @@ -4006,7 +4701,6 @@ msgstr "" msgid "Multi-threading" msgstr "マルチスレッディング" -#: ../../whatsnew/3.2.rst:2318 msgid "" "The mechanism for serializing execution of concurrently running Python " "threads (generally known as the :term:`GIL` or Global Interpreter Lock) has " @@ -4014,9 +4708,18 @@ msgid "" "intervals and reduced overhead due to lock contention and the number of " "ensuing system calls. The notion of a \"check interval\" to allow thread " "switches has been abandoned and replaced by an absolute duration expressed " -"in seconds. This parameter is tunable through :func:`sys." -"setswitchinterval`. It currently defaults to 5 milliseconds." -msgstr "" +"in seconds. This parameter is tunable " +"through :func:`sys.setswitchinterval`. It currently defaults to 5 " +"milliseconds." +msgstr "" +"並行実行される Python スレッドの実行を直列化する仕組み (一般に :term:`GIL`、" +"すなわちグローバルインタープリタロックと呼ばれます) が書き直されました。\n" +"目的には、スレッドの切り替え間隔を予測しやすくすることや、ロックの競合とそれ" +"に伴うシステムコールの回数によるオーバーヘッドを減らすことがありました。\n" +"スレッド切り替えを許可する「チェック間隔」の概念は廃止され、秒単位の時間の長" +"さに置き換えられました。\n" +"このパラメータは :func:`sys.setswitchinterval` で調整でき、現在のデフォルト" +"は 5 ミリ秒です。" #: ../../whatsnew/3.2.rst:2327 msgid "" @@ -4063,9 +4766,9 @@ msgid "" msgstr "" "通常のロックと再帰的なロックの獲得に、 Pthreads を使用するプラットフォームで" "シグナルが割り込めるようになりました。これでロック獲得時にデッドロックしてい" -"た Python プログラムは、プロセスに SIGINT (ほとんどのシェルでは :kbd:" -"`Ctrl+C` で) を繰り返し送ることで殺せます。(Contributed by Reid Kleckner; :" -"issue:`8844`.)" +"た Python プログラムは、プロセスに SIGINT (ほとんどのシェルで" +"は :kbd:`Ctrl+C` で) を繰り返し送ることで殺せます。(Contributed by Reid " +"Kleckner; :issue:`8844`.)" #: ../../whatsnew/3.2.rst:2350 msgid "Optimizations" @@ -4075,26 +4778,33 @@ msgstr "最適化" msgid "A number of small performance enhancements have been added:" msgstr "小さな性能向上が多く追加されました:" -#: ../../whatsnew/3.2.rst:2354 msgid "" "Python's peephole optimizer now recognizes patterns such ``x in {1, 2, 3}`` " "as being a test for membership in a set of constants. The optimizer recasts " "the :class:`set` as a :class:`frozenset` and stores the pre-built constant." msgstr "" +"Python ののぞき穴最適化が、``x in {1, 2, 3}`` のようなパターンを定数の集合へ" +"の帰属判定として認識するようになりました。\n" +"最適化処理は :class:`set` を :class:`frozenset` に変換し、あらかじめ構築した" +"定数を保存します。" -#: ../../whatsnew/3.2.rst:2358 msgid "" "Now that the speed penalty is gone, it is practical to start writing " "membership tests using set-notation. This style is both semantically clear " "and operationally fast::" msgstr "" +"速度上の不利がなくなったため、集合の記法で帰属判定を書くことが実用的になりま" +"した。\n" +"この書き方は意味が明確で、実行も高速です。 ::" -#: ../../whatsnew/3.2.rst:2362 msgid "" "extension = name.rpartition('.')[2]\n" "if extension in {'xml', 'html', 'xhtml', 'css'}:\n" " handle(name)" msgstr "" +"extension = name.rpartition('.')[2]\n" +"if extension in {'xml', 'html', 'xhtml', 'css'}:\n" +" handle(name)" #: ../../whatsnew/3.2.rst:2366 msgid "" @@ -4118,27 +4828,37 @@ msgstr "" "(Contributed by Alexandre Vassalotti, Antoine Pitrou and the Unladen Swallow " "team in :issue:`9410` and :issue:`3873`.)" -#: ../../whatsnew/3.2.rst:2374 msgid "" -"The `Timsort algorithm `_ used in :" -"meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " +"The `Timsort algorithm `_ used " +"in :meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " "when called with a :term:`key function`. Previously, every element of a " "list was wrapped with a temporary object that remembered the key value " "associated with each element. Now, two arrays of keys and values are sorted " "in parallel. This saves the memory consumed by the sort wrappers, and it " "saves time lost to delegating comparisons." msgstr "" +":meth:`list.sort` と :func:`sorted` で使われる `Timsort アルゴリズム " +"`_ が、:term:`key function` を指定した" +"場合に高速化され、メモリ使用量も減りました。\n" +"以前は、リストの各要素を、その要素に対応するキー値を記憶する一時オブジェクト" +"でラップしていました。\n" +"現在は、キーと値の二つの配列を並行してソートします。\n" +"これにより、ラッパーのメモリと、比較を委譲するために費やしていた時間を節約で" +"きます。" #: ../../whatsnew/3.2.rst:2382 msgid "(Patch by Daniel Stutzbach in :issue:`9915`.)" msgstr "(Patch by Daniel Stutzbach in :issue:`9915`.)" -#: ../../whatsnew/3.2.rst:2384 msgid "" "JSON decoding performance is improved and memory consumption is reduced " "whenever the same string is repeated for multiple keys. Also, JSON encoding " "now uses the C speedups when the ``sort_keys`` argument is true." msgstr "" +"複数のキーに同じ文字列が繰り返し現れる場合、JSON のデコード性能が改善され、メ" +"モリ消費量も減りました。\n" +"また、``sort_keys`` 引数が真の場合にも、JSON のエンコードで C による高速化を" +"使うようになりました。" #: ../../whatsnew/3.2.rst:2388 msgid "" @@ -4162,55 +4882,75 @@ msgstr "" msgid "(Contributed by Antoine Pitrou; :issue:`3001`.)" msgstr "(Contributed by Antoine Pitrou; :issue:`3001`.)" -#: ../../whatsnew/3.2.rst:2397 msgid "" -"The fast-search algorithm in stringlib is now used by the :meth:`~str." -"split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` and :meth:`~str." -"replace` methods on :class:`bytes`, :class:`bytearray` and :class:`str` " -"objects. Likewise, the algorithm is also used by :meth:`~str.rfind`, :meth:" -"`~str.rindex`, :meth:`~str.rsplit` and :meth:`~str.rpartition`." +"The fast-search algorithm in stringlib is now used by " +"the :meth:`~str.split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` " +"and :meth:`~str.replace` methods on :class:`bytes`, :class:`bytearray` " +"and :class:`str` objects. Likewise, the algorithm is also used " +"by :meth:`~str.rfind`, :meth:`~str.rindex`, :meth:`~str.rsplit` " +"and :meth:`~str.rpartition`." msgstr "" +"stringlib の高速検索アルゴリズム" +"が、:class:`bytes`、:class:`bytearray`、:class:`str` オブジェクト" +"の :meth:`~str.split`、:meth:`~str.rsplit`、:meth:`~str.splitlines`、:meth:`~str.replace` " +"メソッドで使われるようになりました。\n" +"同様" +"に、:meth:`~str.rfind`、:meth:`~str.rindex`、:meth:`~str.rsplit`、:meth:`~str.rpartition` " +"でも使われます。" #: ../../whatsnew/3.2.rst:2403 msgid "(Patch by Florent Xicluna in :issue:`7622` and :issue:`7462`.)" msgstr "(Patch by Florent Xicluna in :issue:`7622` and :issue:`7462`.)" -#: ../../whatsnew/3.2.rst:2406 msgid "" "Integer to string conversions now work two \"digits\" at a time, reducing " "the number of division and modulo operations." msgstr "" +"整数から文字列への変換を一度に 2 桁ずつ処理するようになり、除算と剰余演算の回" +"数が減りました。" #: ../../whatsnew/3.2.rst:2409 msgid "(:issue:`6713` by Gawain Bolton, Mark Dickinson, and Victor Stinner.)" msgstr "(:issue:`6713` by Gawain Bolton, Mark Dickinson, and Victor Stinner.)" -#: ../../whatsnew/3.2.rst:2411 msgid "" "There were several other minor optimizations. Set differencing now runs " "faster when one operand is much larger than the other (patch by Andress " "Bennetts in :issue:`8685`). The :meth:`!array.repeat` method has a faster " -"implementation (:issue:`1569291` by Alexander Belopolsky). The :class:`~http." -"server.BaseHTTPRequestHandler` has more efficient buffering (:issue:`3709` " -"by Andrew Schaaf). The :func:`operator.attrgetter` function has been sped-" -"up (:issue:`10160` by Christos Georgiou). And :class:`~configparser." -"ConfigParser` loads multi-line arguments a bit faster (:issue:`7113` by " -"Łukasz Langa)." -msgstr "" +"implementation (:issue:`1569291` by Alexander Belopolsky). " +"The :class:`~http.server.BaseHTTPRequestHandler` has more efficient " +"buffering (:issue:`3709` by Andrew Schaaf). The :func:`operator.attrgetter` " +"function has been sped-up (:issue:`10160` by Christos Georgiou). " +"And :class:`~configparser.ConfigParser` loads multi-line arguments a bit " +"faster (:issue:`7113` by Łukasz Langa)." +msgstr "" +"他にも小さな最適化がいくつか行われました。\n" +"集合の差分は、一方のオペランドが他方よりはるかに大きい場合に高速化されました " +"(Andress Bennetts による :issue:`8685` のパッチ)。\n" +":meth:`!array.repeat` メソッドの実装が高速化されました (Alexander Belopolsky " +"による :issue:`1569291`)。\n" +":class:`~http.server.BaseHTTPRequestHandler` のバッファリングが効率化されまし" +"た (Andrew Schaaf による :issue:`3709`)。\n" +":func:`operator.attrgetter` 関数が高速化されました (Christos Georgiou によ" +"る :issue:`10160`)。\n" +":class:`~configparser.ConfigParser` は複数行の引数を少し速く読み込めるように" +"なりました (Łukasz Langa による :issue:`7113`)。" #: ../../whatsnew/3.2.rst:2422 msgid "Unicode" msgstr "Unicode 文字列型" -#: ../../whatsnew/3.2.rst:2424 msgid "" "Python has been updated to `Unicode 6.0.0 `_. The update to the standard adds over 2,000 new characters " "including `emoji `_ symbols which are " "important for mobile phones." msgstr "" +"Python が `Unicode 6.0.0 `_ に更" +"新されました。\n" +"この規格の更新では、携帯電話で重要な `絵文字 `_ を含め、2,000 を超える新しい文字が追加されています。" -#: ../../whatsnew/3.2.rst:2429 msgid "" "In addition, the updated standard has altered the character properties for " "two Kannada characters (U+0CF1, U+0CF2) and one New Tai Lue numeric " @@ -4219,6 +4959,11 @@ msgid "" "Database Changes `_." msgstr "" +"また、更新された規格では、カンナダ文字の二文字 (U+0CF1、U+0CF2) と、新タイ・" +"ルー文字の数字一文字 (U+19DA) の文字特性が変更されました。\n" +"これにより、前者は識別子に使えるようになり、後者は使えなくなりました。\n" +"詳しくは `Unicode Character Database Changes `_ を参照してください。" #: ../../whatsnew/3.2.rst:2437 msgid "Codecs" @@ -4237,9 +4982,9 @@ msgid "" "unencodable character." msgstr "" "MBCS エンコーディングはもうエラーハンドラ引数を無視することはありません。デ" -"フォルトの strict モードでは、デコード出来ないバイト列に対して :exc:" -"`UnicodeDecodeError` を、エンコードできない文字に対して :exc:" -"`UnicodeEncodeError` を投げます。" +"フォルトの strict モードでは、デコード出来ないバイト列に対し" +"て :exc:`UnicodeDecodeError` を、エンコードできない文字に対し" +"て :exc:`UnicodeEncodeError` を投げます。" #: ../../whatsnew/3.2.rst:2446 msgid "" @@ -4293,10 +5038,10 @@ msgid "" "and memory jog without having to read all of the docs." msgstr "" ":ref:`built-in-funcs` のような長大なセクションには先頭にクイックリンクの表が" -"追加されました。 :mod:`itertools` のようなケースでは `cheatsheet `_ スタイルの表からリンクが張られていて、これ" -"で要約がわかりますし、ドキュメント全体を読む必要なく記憶を呼び覚ますことが出" -"来ます。" +"追加されました。 :mod:`itertools` のようなケースでは `cheatsheet `_ スタイルの表からリンクが張られていて、こ" +"れで要約がわかりますし、ドキュメント全体を読む必要なく記憶を呼び覚ますことが" +"出来ます。" #: ../../whatsnew/3.2.rst:2470 msgid "" @@ -4316,17 +5061,18 @@ msgstr "**ソースコード** :source:`Lib/functools.py`." #: ../../whatsnew/3.2.rst:2477 msgid "" -"(Contributed by Raymond Hettinger; see `rationale `_.)" +"(Contributed by Raymond Hettinger; see `rationale `_.)" msgstr "" -"(Contributed by Raymond Hettinger; see `rationale `_.)" +"(Contributed by Raymond Hettinger; see `rationale `_.)" #: ../../whatsnew/3.2.rst:2480 msgid "" "The docs now contain more examples and recipes. In particular, :mod:`re` " -"module has an extensive section, :ref:`re-examples`. Likewise, the :mod:" -"`itertools` module continues to be updated with new :ref:`itertools-recipes`." +"module has an extensive section, :ref:`re-examples`. Likewise, " +"the :mod:`itertools` module continues to be updated with new :ref:`itertools-" +"recipes`." msgstr "" "ドキュメントには今ではもっと実例とレシピが含まれています。特に :mod:`re` モ" "ジュールのものには大掛かりなセクション :ref:`re-examples` があります。同じよ" @@ -4393,31 +5139,35 @@ msgstr "" msgid "Code Repository" msgstr "コードリポジトリ" -#: ../../whatsnew/3.2.rst:2513 msgid "" -"In addition to the existing Subversion code repository at https://svn.python." -"org there is now a `Mercurial `_ repository " -"at https://hg.python.org/\\ ." +"In addition to the existing Subversion code repository at https://" +"svn.python.org there is now a `Mercurial `_ " +"repository at https://hg.python.org/\\ ." msgstr "" +"既存の Subversion コードリポジトリ https://svn.python.org に加え、https://" +"hg.python.org/ に `Mercurial `_ リポジトリが" +"用意されました。" #: ../../whatsnew/3.2.rst:2517 msgid "" "After the 3.2 release, there are plans to switch to Mercurial as the primary " "repository. This distributed version control system should make it easier " -"for members of the community to create and share external changesets. See :" -"pep:`385` for details." +"for members of the community to create and share external changesets. " +"See :pep:`385` for details." msgstr "" "3.2 のリリース後に、主要なリポジトリを Mercurial に移行する計画があります。\n" "この分散バージョン管理システムによってコミュニティメンバが容易に外部 " "changeset を作成したり共有したりすることが出来ます。\n" "詳細は :pep:`385` を参照してください。" -#: ../../whatsnew/3.2.rst:2522 msgid "" "To learn to use the new version control system, see the `Quick Start " "`_ or the `Guide to Mercurial " "Workflows `_." msgstr "" +"新しいバージョン管理システムの使い方については、`Quick Start `_ または `Guide to Mercurial " +"Workflows `_ を参照してください。" #: ../../whatsnew/3.2.rst:2528 msgid "Build and C API Changes" @@ -4456,12 +5206,14 @@ msgid "" msgstr "" "(Reported by Bupjoe Lee and fixed by Amaury Forgeot D'Arc; :issue:`5127`.)" -#: ../../whatsnew/3.2.rst:2544 msgid "" "Computed gotos are now enabled by default on supported compilers (which are " "detected by the configure script). They can still be disabled selectively " "by specifying ``--without-computed-gotos``." msgstr "" +"対応するコンパイラ (configure スクリプトで検出されます) では、computed goto " +"がデフォルトで有効になりました。\n" +"``--without-computed-gotos`` を指定すれば、引き続き個別に無効にできます。" #: ../../whatsnew/3.2.rst:2548 msgid "(Contributed by Antoine Pitrou; :issue:`9203`.)" @@ -4497,32 +5249,38 @@ msgstr "" #: ../../whatsnew/3.2.rst:2562 msgid "" -"(Suggested by Raymond Hettinger and implemented by Benjamin Peterson; :issue:" -"`9778`.)" +"(Suggested by Raymond Hettinger and implemented by Benjamin " +"Peterson; :issue:`9778`.)" msgstr "" -"(Suggested by Raymond Hettinger and implemented by Benjamin Peterson; :issue:" -"`9778`.)" +"(Suggested by Raymond Hettinger and implemented by Benjamin " +"Peterson; :issue:`9778`.)" -#: ../../whatsnew/3.2.rst:2565 msgid "" "A new macro :c:macro:`!Py_VA_COPY` copies the state of the variable argument " "list. It is equivalent to C99 *va_copy* but available on all Python " "platforms (:issue:`2443`)." msgstr "" +"新規マクロ :c:macro:`!Py_VA_COPY` は可変引数リストの状態をコピーします。\n" +"これは C99 の *va_copy* と等価ですが、全ての Python プラットフォームで利用出" +"来ます (:issue:`2443`)。" -#: ../../whatsnew/3.2.rst:2569 msgid "" "A new C API function :c:func:`!PySys_SetArgvEx` allows an embedded " "interpreter to set :data:`sys.argv` without also modifying :data:`sys.path` " "(:issue:`5753`)." msgstr "" +"新しい C API 関数 :c:func:`!PySys_SetArgvEx` を使うと、埋め込まれたインタープ" +"リタで :data:`sys.path` を変更せずに :data:`sys.argv` を設定できます " +"(:issue:`5753`)。" -#: ../../whatsnew/3.2.rst:2573 msgid "" ":c:func:`!PyEval_CallObject` is now only available in macro form. The " "function declaration, which was kept for backwards compatibility reasons, is " "now removed -- the macro was introduced in 1997 (:issue:`8276`)." msgstr "" +":c:func:`!PyEval_CallObject` はマクロ形式でのみ利用可能となりました。\n" +"関数宣言は後方互換のために残されていましたが削除されました。\n" +"-- マクロは 1997 年に導入されています (:issue:`8276`)。" #: ../../whatsnew/3.2.rst:2577 msgid "" @@ -4531,10 +5289,10 @@ msgid "" "Python :class:`int` into a native fixed-width type while providing detection " "of cases where the conversion won't fit (:issue:`7767`)." msgstr "" -":c:func:`PyLong_AsLongAndOverflow` の姉妹品の :c:func:" -"`PyLong_AsLongLongAndOverflow` 関数が追加されました。両方とも Python :class:" -"`int` を C ネイティブの固定幅型に変換しますが、変換が幅に合わないことを検出し" -"ます (:issue:`7767`)。" +":c:func:`PyLong_AsLongAndOverflow` の姉妹品" +"の :c:func:`PyLong_AsLongLongAndOverflow` 関数が追加されました。両方とも " +"Python :class:`int` を C ネイティブの固定幅型に変換しますが、変換が幅に合わな" +"いことを検出します (:issue:`7767`)。" #: ../../whatsnew/3.2.rst:2582 msgid "" @@ -4546,14 +5304,14 @@ msgstr "" #: ../../whatsnew/3.2.rst:2585 msgid "" -"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is like :c:" -"func:`PyErr_NewException` but allows a docstring to be specified. This lets " -"C exceptions have the same self-documenting capabilities as their pure " -"Python counterparts (:issue:`7033`)." +"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is " +"like :c:func:`PyErr_NewException` but allows a docstring to be specified. " +"This lets C exceptions have the same self-documenting capabilities as their " +"pure Python counterparts (:issue:`7033`)." msgstr "" -"新しい関数 :c:func:`PyErr_NewExceptionWithDoc` は :c:func:" -"`PyErr_NewException` と似ていますが、ドキュメンテーション文字列を受け付けま" -"す。これは C 拡張に、対応するピュア Python と同じ自己文書化 (self-" +"新しい関数 :c:func:`PyErr_NewExceptionWithDoc` " +"は :c:func:`PyErr_NewException` と似ていますが、ドキュメンテーション文字列を" +"受け付けます。これは C 拡張に、対応するピュア Python と同じ自己文書化 (self-" "documenting) 能力を与えます (:issue:`7033`)。" #: ../../whatsnew/3.2.rst:2590 @@ -4576,14 +5334,15 @@ msgstr "" "*PyArg_Parse* 関数から書式文字列 ``O?`` が削除されました。これはもう使われて" "いませんし、今まで一度も文書化されたことはありません (:issue:`8837`)。" -#: ../../whatsnew/3.2.rst:2598 msgid "" "There were a number of other small changes to the C-API. See the `Misc/NEWS " "`__ file for a " "complete list." msgstr "" +"他にも C API に多数の小さな変更がありました。\n" +"完全な一覧は `Misc/NEWS `__ ファイルを参照してください。" -#: ../../whatsnew/3.2.rst:2602 msgid "" "Also, there were a number of updates to the Mac OS X build, see `Mac/" "BuildScript/README.txt `_\\. See https://www.python." -"org/download/mac/tcltk/ for additional details." -msgstr "" +"https://www.activestate.com/activetcl/downloads>`_\\. See https://" +"www.python.org/download/mac/tcltk/ for additional details." +msgstr "" +"また、Mac OS X のビルドにも多数の更新がありました。\n" +"詳しくは `Mac/BuildScript/README.txt `_ を参照してください。\n" +"32/64 ビットビルドの利用者には、Mac OS X 10.6 のデフォルトの Tcl/Tk に既知の" +"問題があります。\n" +"そのため、`ActiveState Tcl/Tk 8.5.9 `_ のような更" +"新された代替版のインストールを推奨します。\n" +"追加の詳細は https://www.python.org/download/mac/tcltk/ を参照してください。" #: ../../whatsnew/3.2.rst:2611 msgid "Porting to Python 3.2" @@ -4607,47 +5375,53 @@ msgstr "" "このセクションでは前述の変更とバグフィックスにより必要となるかもしれないコー" "ドの変更を列挙します:" -#: ../../whatsnew/3.2.rst:2616 msgid "" "The :mod:`configparser` module has a number of clean-ups. The major change " "is to replace the old :class:`!ConfigParser` class with long-standing " "preferred alternative :class:`!SafeConfigParser`. In addition there are a " "number of smaller incompatibilities:" msgstr "" +":mod:`configparser` モジュールに大掃除が行われました。\n" +"最も大きな変更は、古い :class:`!ConfigParser` クラスを長年推奨の代替だっ" +"た :class:`!SafeConfigParser` に置き換えたことです。\n" +"加えて多くの小さな非互換があります:" #: ../../whatsnew/3.2.rst:2621 msgid "" -"The interpolation syntax is now validated on :meth:`~configparser." -"ConfigParser.get` and :meth:`~configparser.ConfigParser.set` operations. In " -"the default interpolation scheme, only two tokens with percent signs are " -"valid: ``%(name)s`` and ``%%``, the latter being an escaped percent sign." +"The interpolation syntax is now validated " +"on :meth:`~configparser.ConfigParser.get` " +"and :meth:`~configparser.ConfigParser.set` operations. In the default " +"interpolation scheme, only two tokens with percent signs are valid: ``%" +"(name)s`` and ``%%``, the latter being an escaped percent sign." msgstr "" "補間 (interpolation) の構文は今では :meth:`~configparser.ConfigParser.get` " "と :meth:`~configparser.ConfigParser.set` の操作で検証されます。デフォルトの" -"補間スキームでは、パーセント記号を使ったただ二つのトークンのみが正当です: " -"``%(name)s`` と ``%%`` 、後者はエスケープされたパーセント記号自身。" +"補間スキームでは、パーセント記号を使ったただ二つのトークンのみが正当です: ``%" +"(name)s`` と ``%%`` 、後者はエスケープされたパーセント記号自身。" #: ../../whatsnew/3.2.rst:2627 msgid "" -"The :meth:`~configparser.ConfigParser.set` and :meth:`~configparser." -"ConfigParser.add_section` methods now verify that values are actual " -"strings. Formerly, unsupported types could be introduced unintentionally." +"The :meth:`~configparser.ConfigParser.set` " +"and :meth:`~configparser.ConfigParser.add_section` methods now verify that " +"values are actual strings. Formerly, unsupported types could be introduced " +"unintentionally." msgstr "" -":meth:`~configparser.ConfigParser.set` メソッドと :meth:`~configparser." -"ConfigParser.add_section` メソッドは今ではその値が実際に文字列かどうかを検証" -"します。以前はサポートされない型が意図せず持ち込まれる可能性がありました。" +":meth:`~configparser.ConfigParser.set` メソッド" +"と :meth:`~configparser.ConfigParser.add_section` メソッドは今ではその値が実" +"際に文字列かどうかを検証します。以前はサポートされない型が意図せず持ち込まれ" +"る可能性がありました。" #: ../../whatsnew/3.2.rst:2632 msgid "" -"Duplicate sections or options from a single source now raise either :exc:" -"`~configparser.DuplicateSectionError` or :exc:`~configparser." -"DuplicateOptionError`. Formerly, duplicates would silently overwrite a " -"previous entry." +"Duplicate sections or options from a single source now raise " +"either :exc:`~configparser.DuplicateSectionError` " +"or :exc:`~configparser.DuplicateOptionError`. Formerly, duplicates would " +"silently overwrite a previous entry." msgstr "" -"単一ソースからのセクションまたはオプションの複製 (重複) に対し、今では :exc:" -"`~configparser.DuplicateSectionError` もしくは :exc:`~configparser." -"DuplicateOptionError` を投げます。以前は重複は黙って以前のエントリを上書きし" -"ていました。" +"単一ソースからのセクションまたはオプションの複製 (重複) に対し、今で" +"は :exc:`~configparser.DuplicateSectionError` もしく" +"は :exc:`~configparser.DuplicateOptionError` を投げます。以前は重複は黙って以" +"前のエントリを上書きしていました。" #: ../../whatsnew/3.2.rst:2637 msgid "" @@ -4676,27 +5450,32 @@ msgstr "" "``\"\"`` は今では合法な値なので、もはや自動的に空文字列に変換されることはあり" "ません。空文字列のためには行内で ``\"option =\"`` と書いてください。" -#: ../../whatsnew/3.2.rst:2647 msgid "" "The :mod:`!nntplib` module was reworked extensively, meaning that its APIs " "are often incompatible with the 3.1 APIs." msgstr "" +":mod:`!nntplib` モジュールが大幅に更新され、3.1 API とはしばしば互換性があり" +"ません。" #: ../../whatsnew/3.2.rst:2650 msgid "" ":class:`bytearray` objects can no longer be used as filenames; instead, they " "should be converted to :class:`bytes`." msgstr "" -":class:`bytearray` オブジェクトはもうファイル名には使えません。代わりに :" -"class:`bytes` に変換しなければいけません。" +":class:`bytearray` オブジェクトはもうファイル名には使えません。代わり" +"に :class:`bytes` に変換しなければいけません。" -#: ../../whatsnew/3.2.rst:2653 msgid "" "The :meth:`!array.tostring` and :meth:`!array.fromstring` have been renamed " -"to :meth:`array.tobytes() ` and :meth:`array." -"frombytes() ` for clarity. The old names have been " -"deprecated. (See :issue:`8990`.)" +"to :meth:`array.tobytes() ` " +"and :meth:`array.frombytes() ` for clarity. The old " +"names have been deprecated. (See :issue:`8990`.)" msgstr "" +":meth:`!array.tostring` と :meth:`!array.fromstring` は、分かりやすさのため" +"に :meth:`array.tobytes() ` と :meth:`array.frombytes() " +"` に改名されました。\n" +"古い名前は非推奨になりました。\n" +"(:issue:`8990` を参照してください。)" #: ../../whatsnew/3.2.rst:2658 msgid "``PyArg_Parse*()`` functions:" @@ -4712,48 +5491,59 @@ msgid "\"w\" and \"w#\" formats has been removed: use \"w*\" instead" msgstr "" "書式文字列 \"w\" および \"w#\" の削除: 代わりに \"w*\" を使ってください。" -#: ../../whatsnew/3.2.rst:2663 msgid "" "The :c:type:`!PyCObject` type, deprecated in 3.1, has been removed. To wrap " "opaque C pointers in Python objects, the :c:type:`PyCapsule` API should be " "used instead; the new type has a well-defined interface for passing typing " "safety information and a less complicated signature for calling a destructor." msgstr "" +"Python 3.1 で非推奨となった :c:type:`!PyCObject` が削除されました。\n" +"不透明な C ポインタを Python オブジェクトにラップするに" +"は :c:type:`PyCapsule` を代わりに使ってください。\n" +"この新しい型は、型安全に情報を渡すための良く定義されたインターフェイスを持" +"ち、また、デストラクタの呼び出しのシグネチャの複雑さが小さくなっています。" -#: ../../whatsnew/3.2.rst:2668 msgid "" "The :func:`!sys.setfilesystemencoding` function was removed because it had a " "flawed design." msgstr "" +":func:`!sys.setfilesystemencoding` 関数は削除されました。\n" +"設計に欠陥があったからです。" #: ../../whatsnew/3.2.rst:2671 msgid "" "The :func:`random.seed` function and method now salt string seeds with an " "sha512 hash function. To access the previous version of *seed* in order to " -"reproduce Python 3.1 sequences, set the *version* argument to *1*, ``random." -"seed(s, version=1)``." +"reproduce Python 3.1 sequences, set the *version* argument to *1*, " +"``random.seed(s, version=1)``." msgstr "" ":func:`random.seed` 関数とメソッドが、salt に文字列やバイト列を与えた場合に内" "部で sha512 ハッシュ関数を使うようになりました。Python 3.1 シーケンスを再現す" "るのに以前のバージョンの *seed* が必要であれば、 *version* 引数を *1* にして" "ください。 ``random.seed(s, version=1)`` のように。" -#: ../../whatsnew/3.2.rst:2676 msgid "" "The previously deprecated :func:`!string.maketrans` function has been " -"removed in favor of the static methods :meth:`bytes.maketrans` and :meth:" -"`bytearray.maketrans`. This change solves the confusion around which types " -"were supported by the :mod:`string` module. Now, :class:`str`, :class:" -"`bytes`, and :class:`bytearray` each have their own **maketrans** and " -"**translate** methods with intermediate translation tables of the " -"appropriate type." -msgstr "" +"removed in favor of the static methods :meth:`bytes.maketrans` " +"and :meth:`bytearray.maketrans`. This change solves the confusion around " +"which types were supported by the :mod:`string` module. " +"Now, :class:`str`, :class:`bytes`, and :class:`bytearray` each have their " +"own **maketrans** and **translate** methods with intermediate translation " +"tables of the appropriate type." +msgstr "" +"以前にそれぞれの静的メソッド :meth:`bytes.maketrans` " +"と :meth:`bytearray.maketrans` に置き換えられたために非推奨となった :func:`!" +"string.maketrans` 関数が削除されました。\n" +"この変更は、 :mod:`string` によってサポートされるのがどちらの型なのかにまつわ" +"る混乱を解決します。\n" +"今や :class:`str`, :class:`bytes`, :class:`bytearray` は、その適切な型の中間" +"変換テーブルを持つそれぞれの **maketrans** 、 **translate** メソッドを持って" +"います。" #: ../../whatsnew/3.2.rst:2684 msgid "(Contributed by Georg Brandl; :issue:`5675`.)" msgstr "(Contributed by Georg Brandl; :issue:`5675`.)" -#: ../../whatsnew/3.2.rst:2686 msgid "" "The previously deprecated :func:`!contextlib.nested` function has been " "removed in favor of a plain :keyword:`with` statement which can accept " @@ -4761,14 +5551,22 @@ msgid "" "built-in), and it does a better job finalizing multiple context managers " "when one of them raises an exception::" msgstr "" +"以前に非推奨となった :func:`!contextlib.nested` が削除されました。\n" +"普通の :keyword:`with` が複数のコンテキストマネージャを許容するように強化され" +"たからです。\n" +"これは (組み込みなので) 高速であり、複数コンテキストマネージャのうち一つが例" +"外を送出した際にそれらのファイナライズをとても上手く処理します。 ::" -#: ../../whatsnew/3.2.rst:2692 msgid "" "with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n" " for line in infile:\n" " if '' in line:\n" " outfile.write(line)" msgstr "" +"with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n" +" for line in infile:\n" +" if '' in line:\n" +" outfile.write(line)" #: ../../whatsnew/3.2.rst:2697 msgid "" @@ -4810,13 +5608,13 @@ msgstr "" #: ../../whatsnew/3.2.rst:2711 msgid "" -"The :class:`xml.etree.ElementTree` class now raises an :exc:`xml.etree." -"ElementTree.ParseError` when a parse fails. Previously it raised an :exc:" -"`xml.parsers.expat.ExpatError`." +"The :class:`xml.etree.ElementTree` class now raises " +"an :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it " +"raised an :exc:`xml.parsers.expat.ExpatError`." msgstr "" -"パース失敗時に :class:`xml.etree.ElementTree` クラスが :exc:`xml.etree." -"ElementTree.ParseError` を投げるようになりました。以前は :exc:`xml.parsers." -"expat.ExpatError` を投げていました。" +"パース失敗時に :class:`xml.etree.ElementTree` クラス" +"が :exc:`xml.etree.ElementTree.ParseError` を投げるようになりました。以前" +"は :exc:`xml.parsers.expat.ExpatError` を投げていました。" #: ../../whatsnew/3.2.rst:2715 msgid "" @@ -4842,13 +5640,13 @@ msgstr "" #: ../../whatsnew/3.2.rst:2725 msgid "" -"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` and :" -"mod:`http.client`. Such support is still present on the server side (in :" -"mod:`http.server`)." +"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` " +"and :mod:`http.client`. Such support is still present on the server side " +"(in :mod:`http.server`)." msgstr "" "レガシーな HTTP 0.9 のサポートが :mod:`urllib.request` と :mod:`http.client` " -"から削除されました。このサポートはサーバサイドではまだ健在です (:mod:`http." -"server` 内)。" +"から削除されました。このサポートはサーバサイドではまだ健在です " +"(:mod:`http.server` 内)。" #: ../../whatsnew/3.2.rst:2729 msgid "(Contributed by Antoine Pitrou, :issue:`10711`.)" @@ -4859,34 +5657,41 @@ msgid "" "SSL sockets in timeout mode now raise :exc:`socket.timeout` when a timeout " "occurs, rather than a generic :exc:`~ssl.SSLError`." msgstr "" -"タイムアウトモード時の SSL ソケットでタイムアウトした場合に、汎用の :exc:" -"`~ssl.SSLError` ではなく :exc:`socket.timeout` を投げるようになりました。" +"タイムアウトモード時の SSL ソケットでタイムアウトした場合に、汎用" +"の :exc:`~ssl.SSLError` ではなく :exc:`socket.timeout` を投げるようになりまし" +"た。" #: ../../whatsnew/3.2.rst:2734 msgid "(Contributed by Antoine Pitrou, :issue:`10272`.)" msgstr "(Contributed by Antoine Pitrou, :issue:`10272`.)" -#: ../../whatsnew/3.2.rst:2736 msgid "" "The misleading functions :c:func:`!PyEval_AcquireLock` and :c:func:`!" "PyEval_ReleaseLock` have been officially deprecated. The thread-state aware " -"APIs (such as :c:func:`PyEval_SaveThread` and :c:func:" -"`PyEval_RestoreThread`) should be used instead." +"APIs (such as :c:func:`PyEval_SaveThread` " +"and :c:func:`PyEval_RestoreThread`) should be used instead." msgstr "" +"誤解を招く関数 :c:func:`!PyEval_AcquireLock` と :c:func:`!" +"PyEval_ReleaseLock` が正式に非推奨になりました。\n" +"代わりに、:c:func:`PyEval_SaveThread` と :c:func:`PyEval_RestoreThread` な" +"ど、スレッド状態を扱う API を使ってください。" -#: ../../whatsnew/3.2.rst:2741 msgid "" "Due to security risks, :func:`!asyncore.handle_accept` has been deprecated, " "and a new function, :func:`!asyncore.handle_accepted`, was added to replace " "it." msgstr "" +"セキュリティリスクがあるので :func:`!asyncore.handle_accept` は非推奨となり、" +"それを置き換える新しい関数 :func:`!asyncore.handle_accepted` が追加されまし" +"た。" #: ../../whatsnew/3.2.rst:2744 msgid "(Contributed by Giampaolo Rodola in :issue:`6706`.)" msgstr "(Contributed by Giampaolo Rodola in :issue:`6706`.)" -#: ../../whatsnew/3.2.rst:2746 msgid "" "Due to the new :term:`GIL` implementation, :c:func:`!PyEval_InitThreads` " "cannot be called before :c:func:`Py_Initialize` anymore." msgstr "" +"新しい :term:`GIL` 実装により、:c:func:`Py_Initialize` の前に :c:func:`!" +"PyEval_InitThreads` を呼び出せなくなりました。" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index a08ce6cdf..1e8aca0cb 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 @@ -36,8 +36,8 @@ msgid "" "`changelog `_." msgstr "" "この記事では 3.2 と比較した Python 3.3 の新機能を解説します。 Python 3.3 は" -"2012年9月29日にリリースされました。全詳細については `変更履歴 `_ をご覧ください。" +"2012年9月29日にリリースされました。全詳細については `変更履歴 `_ をご覧ください。" #: ../../whatsnew/3.3.rst:51 msgid ":pep:`398` - Python 3.3 Release Schedule" @@ -128,8 +128,8 @@ msgstr ":ref:`decimal ` モジュールのCによる高速化" #: ../../whatsnew/3.3.rst:87 msgid "" -"Better unicode handling in the :ref:`email ` module (:term:" -"`provisional `)." +"Better unicode handling in the :ref:`email ` module " +"(:term:`provisional `)." msgstr "" ":ref:`email ` モジュールでのより良いユニコード処理 (:term:`暫定版 " "`)" @@ -197,8 +197,8 @@ msgstr "PEP 420: 暗黙的な名前空間パッケージ" msgid "" "Native support for package directories that don't require ``__init__.py`` " "marker files and can automatically span multiple path segments (inspired by " -"various third party approaches to namespace packages, as described in :pep:" -"`420`)" +"various third party approaches to namespace packages, as described " +"in :pep:`420`)" msgstr "" "``__init__.py`` マーカーファイルを必要としないパッケージディレクトリと、複数" "のモジュールパスをネイティブでサポートします(:pep:`420` に記載された様々な" @@ -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,15 +297,16 @@ 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 " +"'B', 'b', 'c' いずれかのフォーマットの hashable な (読み出し専用の) 型の1次元" +"メモリビューもまた、 hashable です。 (Contributed by Antoine Pitrou " "in :issue:`13411`.)" -#: ../../whatsnew/3.3.rst:176 msgid "" "Arbitrary slicing of any 1-D arrays type is supported. For example, it is " "now possible to reverse a memoryview in *O*\\ (1) by using a negative step." msgstr "" +"任意の型の 1 次元配列で任意のスライス操作を行えるようになりました。\n" +"例えば、負のステップを使うと *O*\\ (1) で memoryview を反転できます。" #: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1135 msgid "API changes" @@ -315,16 +314,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 +332,7 @@ msgid "" msgstr "" "フォーマット 'B' (unsigned bytes) での memoryview 要素へのアクセスは整数を返" "すようになりました (struct モジュールでの構文に従っています)。bytes オブジェ" -"クトが欲しければまずビューを 'c' で :meth:`~memoryview.cast` しなければなりま" -"せん。" +"クトが欲しければまずビューを 'c' で ``cast()`` しなければなりません。" #: ../../whatsnew/3.3.rst:191 msgid "" @@ -630,14 +627,15 @@ msgstr "OS エラーが送出する例外の階層が単純化され、粒度が #: ../../whatsnew/3.3.rst:332 msgid "" "You don't have to worry anymore about choosing the appropriate exception " -"type between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:" -"`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` or :exc:`select." -"error`. All these exception types are now only one: :exc:`OSError`. The " -"other names are kept as aliases for compatibility reasons." -msgstr "" -":exc:`OSError`、:exc:`IOError`、:exc:`EnvironmentError`、:exc:" -"`WindowsError`、:exc:`mmap.error`、:exc:`socket.error`、そして :exc:`select." -"error` の中から適切な例外の型を選ぶのに心配する必要はもうありません。\n" +"type " +"between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` " +"or :exc:`select.error`. All these exception types are now only " +"one: :exc:`OSError`. The other names are kept as aliases for compatibility " +"reasons." +msgstr "" +":exc:`OSError`、:exc:`IOError`、:exc:`EnvironmentError`、:exc:`WindowsError`、:exc:`mmap.error`、:exc:`socket.error`、" +"そして :exc:`select.error` の中から適切な例外の型を選ぶのに心配する必要はも" +"うありません。\n" "上記の例外の型は全てたった1つ :exc:`OSError` になりました。\n" ":exc:`OSError` 以外の名前は互換性のためにエイリアスとして残されています。" @@ -645,8 +643,9 @@ msgstr "" msgid "" "Also, it is now easier to catch a specific error condition. Instead of " "inspecting the ``errno`` attribute (or ``args[0]``) for a particular " -"constant from the :mod:`errno` module, you can catch the adequate :exc:" -"`OSError` subclass. The available subclasses are the following:" +"constant from the :mod:`errno` module, you can catch the " +"adequate :exc:`OSError` subclass. The available subclasses are the " +"following:" msgstr "" "また、特定のエラー条件を捕捉するのが容易になりました。\n" "``errno`` 属性 (または ``args[0]``) の特定の定数を :mod:`errno` モジュールか" @@ -726,7 +725,6 @@ msgstr "" "新たな例外のおかげで :mod:`errno` の一般的な使い方を避けることが出来ます。\n" "例えば、Python 3.2 向けに書かれた以下のコード::" -#: ../../whatsnew/3.3.rst:366 msgid "" "from errno import ENOENT, EACCES, EPERM\n" "\n" @@ -741,6 +739,18 @@ msgid "" " else:\n" " raise" msgstr "" +"from errno import ENOENT, EACCES, EPERM\n" +"\n" +"try:\n" +" with open(\"document.txt\") as f:\n" +" content = f.read()\n" +"except IOError as err:\n" +" if err.errno == ENOENT:\n" +" print(\"document.txt file is missing\")\n" +" elif err.errno in (EACCES, EPERM):\n" +" print(\"You are not allowed to read document.txt\")\n" +" else:\n" +" raise" #: ../../whatsnew/3.3.rst:379 msgid "" @@ -750,7 +760,6 @@ msgstr "" "は :mod:`errno` をインポートしたり手動で例外属性を調べたりせずに書くことが出" "来ます::" -#: ../../whatsnew/3.3.rst:382 msgid "" "try:\n" " with open(\"document.txt\") as f:\n" @@ -760,6 +769,13 @@ msgid "" "except PermissionError:\n" " print(\"You are not allowed to read document.txt\")" msgstr "" +"try:\n" +" with open(\"document.txt\") as f:\n" +" content = f.read()\n" +"except FileNotFoundError:\n" +" print(\"document.txt file is missing\")\n" +"except PermissionError:\n" +" print(\"You are not allowed to read document.txt\")" #: ../../whatsnew/3.3.rst:392 msgid ":pep:`3151` - Reworking the OS and IO Exception Hierarchy" @@ -804,7 +820,6 @@ msgstr "" "単純なイテレータに対して、 ``yield from iterable`` は本質的には ``for item " "in iterable: yield item`` への単なる速記法です::" -#: ../../whatsnew/3.3.rst:417 msgid "" ">>> def g(x):\n" "... yield from range(x, 0, -1)\n" @@ -813,6 +828,12 @@ msgid "" ">>> list(g(5))\n" "[5, 4, 3, 2, 1, 0, 1, 2, 3, 4]" msgstr "" +">>> def g(x):\n" +"... yield from range(x, 0, -1)\n" +"... yield from range(x)\n" +"...\n" +">>> list(g(5))\n" +"[5, 4, 3, 2, 1, 0, 1, 2, 3, 4]" #: ../../whatsnew/3.3.rst:424 msgid "" @@ -821,11 +842,9 @@ msgid "" "final value to the outer generator::" msgstr "" "ですが普通のループとは違って ``yield from`` ではサブジェネレータは、呼び出し" -"側スコープから :meth:`~generator.send` されたり :meth:`~generator.throw` され" -"た値を直接受け取ることができ、また、外側のジェネレータに最終的な値を返せま" -"す::" +"側スコープから ``send()`` されたり ``throw()`` された値を直接受け取ることがで" +"き、また、外側のジェネレータに最終的な値を返せます::" -#: ../../whatsnew/3.3.rst:428 msgid "" ">>> def accumulate():\n" "... tally = 0\n" @@ -854,6 +873,32 @@ msgid "" ">>> tallies\n" "[6, 10]" msgstr "" +">>> def accumulate():\n" +"... tally = 0\n" +"... while 1:\n" +"... next = yield\n" +"... if next is None:\n" +"... return tally\n" +"... tally += next\n" +"...\n" +">>> def gather_tallies(tallies):\n" +"... while 1:\n" +"... tally = yield from accumulate()\n" +"... tallies.append(tally)\n" +"...\n" +">>> tallies = []\n" +">>> acc = gather_tallies(tallies)\n" +">>> next(acc) # アキュムレータが値を受け取れる状態にする\n" +">>> for i in range(4):\n" +"... acc.send(i)\n" +"...\n" +">>> acc.send(None) # 最初の集計を終える\n" +">>> for i in range(5):\n" +"... acc.send(i)\n" +"...\n" +">>> acc.send(None) # 2 回目の集計を終える\n" +">>> tallies\n" +"[6, 10]" #: ../../whatsnew/3.3.rst:455 msgid "" @@ -895,7 +940,6 @@ msgstr "" "入します。これを使えば例外翻訳して投げ直すようなアプリケーションで、エラー" "メッセージをわかりやすくすることが出来ます::" -#: ../../whatsnew/3.3.rst:475 msgid "" ">>> class D:\n" "... def __init__(self, extra):\n" @@ -912,6 +956,20 @@ msgid "" " File \"\", line 8, in __getattr__\n" "AttributeError: x" msgstr "" +">>> class D:\n" +"... def __init__(self, extra):\n" +"... self._extra_attributes = extra\n" +"... def __getattr__(self, attr):\n" +"... try:\n" +"... return self._extra_attributes[attr]\n" +"... except KeyError:\n" +"... raise AttributeError(attr) from None\n" +"...\n" +">>> D({}).x\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 8, in __getattr__\n" +"AttributeError: x" #: ../../whatsnew/3.3.rst:490 msgid "" @@ -921,7 +979,6 @@ msgstr "" "元となる要因例外を抑制する ``from None`` を後置しなければ、もとの例外はデフォ" "ルトで表示されます::" -#: ../../whatsnew/3.3.rst:493 msgid "" ">>> class C:\n" "... def __init__(self, extra):\n" @@ -944,6 +1001,26 @@ msgid "" " File \"\", line 8, in __getattr__\n" "AttributeError: x" msgstr "" +">>> class C:\n" +"... def __init__(self, extra):\n" +"... self._extra_attributes = extra\n" +"... def __getattr__(self, attr):\n" +"... try:\n" +"... return self._extra_attributes[attr]\n" +"... except KeyError:\n" +"... raise AttributeError(attr)\n" +"...\n" +">>> C({}).x\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in __getattr__\n" +"KeyError: 'x'\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 8, in __getattr__\n" +"AttributeError: x" #: ../../whatsnew/3.3.rst:514 msgid "" @@ -955,7 +1032,6 @@ msgstr "" "ストは利用可能なままです。(例えば介在するライブラリが有益な背後の詳細を不適切" "に隠してしまっているなど、必要な場合はあるでしょう。)" -#: ../../whatsnew/3.3.rst:518 msgid "" ">>> try:\n" "... D({}).x\n" @@ -964,6 +1040,12 @@ msgid "" "...\n" "KeyError('x',)" msgstr "" +">>> try:\n" +"... D({}).x\n" +"... except AttributeError as exc:\n" +"... print(repr(exc.__context__))\n" +"...\n" +"KeyError('x',)" #: ../../whatsnew/3.3.rst:527 msgid ":pep:`409` - Suppressing exception context" @@ -1009,21 +1091,25 @@ msgstr "PEP written by Armin Ronacher." msgid "PEP 3155: Qualified name for classes and functions" msgstr "PEP 3155: クラスと関数の正規名" -#: ../../whatsnew/3.3.rst:552 msgid "" "Functions and class objects have a new :attr:`~definition.__qualname__` " "attribute representing the \"path\" from the module top-level to their " -"definition. For global functions and classes, this is the same as :attr:" -"`~definition.__name__`. For other functions and classes, it provides better " -"information about where they were actually defined, and how they might be " -"accessible from the global scope." -msgstr "" +"definition. For global functions and classes, this is the same " +"as :attr:`~definition.__name__`. For other functions and classes, it " +"provides better information about where they were actually defined, and how " +"they might be accessible from the global scope." +msgstr "" +"関数とクラスのオブジェクトに、モジュールのトップレベルからその定義までの「パ" +"ス」を表す :attr:`~definition.__qualname__` 属性が追加されました。\n" +"グローバルな関数やクラスでは :attr:`~definition.__name__` と同じ値になりま" +"す。\n" +"それ以外の関数やクラスでは、実際の定義場所やグローバルスコープからアクセスす" +"る方法をより詳しく示します。" #: ../../whatsnew/3.3.rst:560 msgid "Example with (non-bound) methods::" msgstr "(束縛されていない) メソッドでの例::" -#: ../../whatsnew/3.3.rst:562 msgid "" ">>> class C:\n" "... def meth(self):\n" @@ -1034,12 +1120,19 @@ msgid "" ">>> C.meth.__qualname__\n" "'C.meth'" msgstr "" +">>> class C:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.meth.__name__\n" +"'meth'\n" +">>> C.meth.__qualname__\n" +"'C.meth'" #: ../../whatsnew/3.3.rst:571 msgid "Example with nested classes::" msgstr "入れ子のクラスでの例::" -#: ../../whatsnew/3.3.rst:573 msgid "" ">>> class C:\n" "... class D:\n" @@ -1055,12 +1148,24 @@ msgid "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" msgstr "" +">>> class C:\n" +"... class D:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.D.__name__\n" +"'D'\n" +">>> C.D.__qualname__\n" +"'C.D'\n" +">>> C.D.meth.__name__\n" +"'meth'\n" +">>> C.D.meth.__qualname__\n" +"'C.D.meth'" #: ../../whatsnew/3.3.rst:587 msgid "Example with nested functions::" msgstr "入れ子の関数の例::" -#: ../../whatsnew/3.3.rst:589 msgid "" ">>> def outer():\n" "... def inner():\n" @@ -1072,6 +1177,15 @@ msgid "" ">>> outer().__qualname__\n" "'outer..inner'" msgstr "" +">>> def outer():\n" +"... def inner():\n" +"... pass\n" +"... return inner\n" +"...\n" +">>> outer().__name__\n" +"'inner'\n" +">>> outer().__qualname__\n" +"'outer..inner'" #: ../../whatsnew/3.3.rst:599 msgid "" @@ -1081,13 +1195,16 @@ msgstr "" "それらオブジェクトの文字列表現も、この新しくてより正確な情報を含むように変更" "されています::" -#: ../../whatsnew/3.3.rst:602 msgid "" ">>> str(C.D)\n" "\"\"\n" ">>> str(C.D.meth)\n" "''" msgstr "" +">>> str(C.D)\n" +"\"\"\n" +">>> str(C.D.meth)\n" +"''" #: ../../whatsnew/3.3.rst:609 msgid ":pep:`3155` - Qualified name for classes and functions" @@ -1128,22 +1245,23 @@ msgstr "PEP 362: 関数シグニチャオブジェクト" msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " -"supported: python functions, decorated or not, classes, and :func:`functools." -"partial` objects. New classes :class:`inspect.Signature`, :class:`inspect." -"Parameter` and :class:`inspect.BoundArguments` hold information about the " -"call signatures, such as, annotations, default values, parameters kinds, and " +"supported: python functions, decorated or not, classes, " +"and :func:`functools.partial` objects. New " +"classes :class:`inspect.Signature`, :class:`inspect.Parameter` " +"and :class:`inspect.BoundArguments` hold information about the call " +"signatures, such as, annotations, default values, parameters kinds, and " "bound arguments, which considerably simplifies writing decorators and any " "code that validates or amends calling signatures or arguments." msgstr "" "新たに追加された関数 :func:`inspect.signature` は、Python 呼び出し可能オブ" "ジェクト (callable) を調べることを簡単で直接的なものにしてくれます。幅広い " "callable をサポートしています:デコレートされているかどうかによらず関数、クラ" -"ス、 :func:`functools.partial` オブジェクト。新たに追加されたクラス群 :class:" -"`inspect.Signature`, :class:`inspect.Parameter`, :class:`inspect." -"BoundArguments` は、アノテーション、デフォルト値、パラメータの種類、束縛され" -"ている引数などのような呼び出しシグニチャについての情報を保持し、これによっ" -"て、デコレータを書いたりあるいは呼び出しシグニチャや引数を検証したり改訂した" -"りするコードを書くことが、非常に単純になります。" +"ス、 :func:`functools.partial` オブジェクト。新たに追加されたクラス" +"群 :class:`inspect.Signature`, :class:`inspect.Parameter`, :class:`inspect.BoundArguments` " +"は、アノテーション、デフォルト値、パラメータの種類、束縛されている引数などの" +"ような呼び出しシグニチャについての情報を保持し、これによって、デコレータを書" +"いたりあるいは呼び出しシグニチャや引数を検証したり改訂したりするコードを書く" +"ことが、非常に単純になります。" #: ../../whatsnew/3.3.rst:643 msgid ":pep:`362`: - Function Signature Object" @@ -1198,8 +1316,8 @@ msgid "" "control the caching behavior for modules." msgstr "" "標準ライブラリの移植性を改善した一例が ``cache_tag`` です。Python 3.3 以降は " -"``sys.implementation.cache_tag`` が :pep:`3147` をサポートするために :mod:" -"`importlib` により使われます。組み込みのインポートシステムのために " +"``sys.implementation.cache_tag`` が :pep:`3147` をサポートするため" +"に :mod:`importlib` により使われます。組み込みのインポートシステムのために " "``importlib`` を使う全ての Python 実装が、モジュールのキャッシュの振る舞いを" "制御するのに ``cache_tag`` を利用できます。" @@ -1211,17 +1329,18 @@ msgstr "SimpleNamespace" msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " -"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, like :" -"class:`object`. However, unlike ``object``, ``SimpleNamespace`` instances " -"are writable. This means that you can add, remove, and modify the namespace " -"through normal attribute access." -msgstr "" -"``sys.implementation`` の実現に伴って Python に新たな型 :class:`types." -"SimpleNamespace` が導入されることとなりました。 :class:`dict` のようなマッピ" -"ングベースの名前空間とは対照的に、 ``SimpleNamespace`` は :class:`object` の" -"ような属性ベースです。ですが ``object`` とは違って ``SimpleNamespace`` インス" -"タンスは書き込み可能です。つまり普通の属性アクセスを通じて名前空間に追加した" -"り削除したり修正したりできます。" +"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, " +"like :class:`object`. However, unlike ``object``, ``SimpleNamespace`` " +"instances are writable. This means that you can add, remove, and modify the " +"namespace through normal attribute access." +msgstr "" +"``sys.implementation`` の実現に伴って Python に新たな" +"型 :class:`types.SimpleNamespace` が導入されることとなりまし" +"た。 :class:`dict` のようなマッピングベースの名前空間とは対照的に、 " +"``SimpleNamespace`` は :class:`object` のような属性ベースです。ですが " +"``object`` とは違って ``SimpleNamespace`` インスタンスは書き込み可能です。つ" +"まり普通の属性アクセスを通じて名前空間に追加したり削除したり修正したりできま" +"す。" #: ../../whatsnew/3.3.rst:681 msgid ":pep:`421` - Adding sys.implementation" @@ -1235,24 +1354,28 @@ msgstr "PEP written and implemented by Eric Snow." msgid "Using importlib as the Implementation of Import" msgstr "インポート実装としての importlib の使用" -#: ../../whatsnew/3.3.rst:689 msgid "" ":issue:`2377` - Replace __import__ w/ importlib.__import__ :issue:`13959` - " "Re-implement parts of :mod:`!imp` in pure Python :issue:`14605` - Make " "import machinery explicit :issue:`14646` - Require loaders set __loader__ " "and __package__" msgstr "" +":issue:`2377` — __import__ を importlib.__import__ に置き換え。\n" +":issue:`13959` — :mod:`!imp` の一部を純粋な Python で再実装。\n" +":issue:`14605` — インポート機構を明示化。\n" +":issue:`14646` — ローダーに __loader__ と __package__ の設定を必須化。" #: ../../whatsnew/3.3.rst:694 msgid "" -"The :func:`__import__` function is now powered by :func:`importlib." -"__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " -"There are multiple benefits to this change. First, it has allowed for more " -"of the machinery powering import to be exposed instead of being implicit and " -"hidden within the C code. It also provides a single implementation for all " -"Python VMs supporting Python 3.3 to use, helping to end any VM-specific " -"deviations in import semantics. And finally it eases the maintenance of " -"import, allowing for future growth to occur." +"The :func:`__import__` function is now powered " +"by :func:`importlib.__import__`. This work leads to the completion of " +"\"phase 2\" of :pep:`302`. There are multiple benefits to this change. " +"First, it has allowed for more of the machinery powering import to be " +"exposed instead of being implicit and hidden within the C code. It also " +"provides a single implementation for all Python VMs supporting Python 3.3 to " +"use, helping to end any VM-specific deviations in import semantics. And " +"finally it eases the maintenance of import, allowing for future growth to " +"occur." msgstr "" ":func:`__import__` 関数を :func:`importlib.__import__` によって実現するように" "しました。これは :pep:`302` の「第二段階」を完了させるものです。この変更には" @@ -1288,40 +1411,50 @@ msgstr "" "ついて露になったことです。つまりかつては様々なインポータが暗黙で行っていたこ" "とが、今では完全に :mod:`importlib` パッケージの一部として公開されています。" -#: ../../whatsnew/3.3.rst:714 msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders ` " -"and :term:`path entry finders ` by introducing :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.PathEntryFinder`, " -"respectively. The old ABC of :class:`!importlib.abc.Finder` is now only " -"provided for backwards-compatibility and does not enforce any method " -"requirements." +"and :term:`path entry finders ` by " +"introducing :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder`, respectively. The old ABC " +"of :class:`!importlib.abc.Finder` is now only provided for backwards-" +"compatibility and does not enforce any method requirements." msgstr "" +":mod:`importlib.abc` で定義される抽象基底クラスは :term:`meta path finder` " +"と :term:`path entry finder` の差異を正確に表現するように拡張されて、それぞれ" +"順に :class:`importlib.abc.MetaPathFinder` " +"と :class:`importlib.abc.PathEntryFinder` が導入されました。\n" +"古い ABC である :class:`!importlib.abc.Finder` は後方互換性のためだけに残され" +"ますが、何かのメソッドの必要性を強制したりはしません。" -#: ../../whatsnew/3.3.rst:722 msgid "" "In terms of finders, :class:`importlib.machinery.FileFinder` exposes the " "mechanism used to search for source and bytecode files of a module. " "Previously this class was an implicit member of :data:`sys.path_hooks`." msgstr "" +"ファインダ (finder) の側面からは、 :class:`importlib.machinery.FileFinder` が" +"モジュールのソースファイルおよびバイトコードファイルの検索に使われる機構を公" +"開しています。\n" +"以前はこのクラスは :data:`sys.path_hooks` の暗黙のメンバでした。" #: ../../whatsnew/3.3.rst:726 msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " -"a module's code. The loader for source files (:class:`importlib.machinery." -"SourceFileLoader`), sourceless bytecode files (:class:`importlib.machinery." -"SourcelessFileLoader`), and extension modules (:class:`importlib.machinery." -"ExtensionFileLoader`) are now available for direct use." -msgstr "" -"ローダ (loader) については、新規の抽象基底クラス :class:`importlib.abc." -"FileLoader` が、モジュールのコードを格納する機構としてのファイルシステムを使" -"うローダを書く助けとなります。ソースファイルのローダ (:class:`importlib." -"machinery.SourceFileLoader`)、ソースを持たないバイトコードのためのローダ (:" -"class:`importlib.machinery.SourcelessFileLoader`)、そして拡張モジュールのため" -"のローダ (:class:`importlib.machinery.ExtensionFileLoader`) が今では直接的に" -"利用出来ます。" +"a module's code. The loader for source files " +"(:class:`importlib.machinery.SourceFileLoader`), sourceless bytecode files " +"(:class:`importlib.machinery.SourcelessFileLoader`), and extension modules " +"(:class:`importlib.machinery.ExtensionFileLoader`) are now available for " +"direct use." +msgstr "" +"ローダ (loader) については、新規の抽象基底クラ" +"ス :class:`importlib.abc.FileLoader` が、モジュールのコードを格納する機構とし" +"てのファイルシステムを使うローダを書く助けとなります。ソースファイルのローダ " +"(:class:`importlib.machinery.SourceFileLoader`)、ソースを持たないバイトコード" +"のためのローダ (:class:`importlib.machinery.SourcelessFileLoader`)、そして拡" +"張モジュールのためのローダ " +"(:class:`importlib.machinery.ExtensionFileLoader`) が今では直接的に利用出来ま" +"す。" #: ../../whatsnew/3.3.rst:734 msgid "" @@ -1335,12 +1468,15 @@ msgstr "" "れまでのようにモジュール名の末尾だけを与えるのではなく、モジュールの完全名を" "提供するようになりました。" -#: ../../whatsnew/3.3.rst:739 msgid "" "The :func:`importlib.invalidate_caches` function will now call the method " "with the same name on all finders cached in :data:`sys.path_importer_cache` " "to help clean up any stored state as necessary." msgstr "" +":func:`importlib.invalidate_caches` 関数が :data:`sys.path_importer_cache` 内" +"にキャッシュされている全てのファインダの同名メソッドを呼び出すようになりまし" +"た。\n" +"これにより必要に応じて記憶されている状態をクリーンアップ出来ます。" #: ../../whatsnew/3.3.rst:744 msgid "Visible Changes" @@ -1357,16 +1493,16 @@ msgstr "" #: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " -"visible changes to import. The biggest is that :data:`sys.meta_path` and :" -"data:`sys.path_hooks` now store all of the meta path finders and path entry " -"hooks used by import. Previously the finders were implicit and hidden " +"visible changes to import. The biggest is that :data:`sys.meta_path` " +"and :data:`sys.path_hooks` now store all of the meta path finders and path " +"entry hooks used by import. Previously the finders were implicit and hidden " "within the C code of import instead of being directly exposed. This means " "that one can now easily remove or change the order of the various finders to " "fit one's needs." msgstr "" ":mod:`importlib` によって公開されるものが拡がったことによる、インポートについ" -"てのほかの目に見える変化があります。最大の変化は :data:`sys.meta_path` と :" -"data:`sys.path_hooks` が、インポートで使われる meta path finder と path " +"てのほかの目に見える変化があります。最大の変化は :data:`sys.meta_path` " +"と :data:`sys.path_hooks` が、インポートで使われる meta path finder と path " "entry hook の全てを格納するようになったことです。以前はファインダは直接的に公" "開されるのではなく、インポートの C コード内に暗黙のものとして隠されていまし" "た。このことによって、今では望めば要件に合うようファインダを取り除いたり順序" @@ -1390,22 +1526,28 @@ msgstr "" #: ../../whatsnew/3.3.rst:762 msgid "" -"Loaders are also now expected to set the ``__package__`` attribute from :pep:" -"`366`. Once again, import itself is already setting this on all loaders " -"from :mod:`importlib` and import itself is setting the attribute post-load." +"Loaders are also now expected to set the ``__package__`` attribute " +"from :pep:`366`. Once again, import itself is already setting this on all " +"loaders from :mod:`importlib` and import itself is setting the attribute " +"post-load." msgstr "" "さらにローダが :pep:`366` よりの ``__package__`` 属性を設定することも期待出来" "るようになりました。繰り返しになりますがインポート処理自身が既にこれを全ての" "ローダで :mod:`importlib` より行っていて、また、インポート処理自身がこの属性" "をロードの後処理としてセットしています。" -#: ../../whatsnew/3.3.rst:766 msgid "" "``None`` is now inserted into :data:`sys.path_importer_cache` when no finder " "can be found on :data:`sys.path_hooks`. Since :class:`!imp.NullImporter` is " "not directly exposed on :data:`sys.path_hooks` it could no longer be relied " "upon to always be available to use as a value representing no finder found." msgstr "" +":data:`sys.path_hooks` にファインダが見つからない場合" +"に、 :data:`sys.path_importer_cache` に ``None`` が挿入されるようになりまし" +"た。\n" +":class:`!imp.NullImporter` は :data:`sys.path_hooks` に直接的に公開されないた" +"め、これはファインダが見つからないことの表現値としては当てにならないものにな" +"りました。" #: ../../whatsnew/3.3.rst:771 msgid "" @@ -1429,12 +1571,14 @@ msgstr "その他の言語変更" msgid "Some smaller changes made to the core Python language are:" msgstr "Python 言語コアに小さな変更がいくつか行われました:" -#: ../../whatsnew/3.3.rst:783 msgid "" -"Added support for Unicode name aliases and named sequences. Both :func:" -"`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" -"`unicodedata.lookup` resolves named sequences too." +"Added support for Unicode name aliases and named sequences. " +"Both :func:`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, " +"and :func:`unicodedata.lookup` resolves named sequences too." msgstr "" +"Unicode の名前の別名と名前付き文字列をサポートしました。\n" +":func:`unicodedata.lookup` と ``'\\N{...}'`` のどちらでも名前の別名を解決で" +"き、:func:`unicodedata.lookup` では名前付き文字列も解決できます。" #: ../../whatsnew/3.3.rst:787 msgid "(Contributed by Ezio Melotti in :issue:`12753`.)" @@ -1447,12 +1591,12 @@ msgstr "Unicode データベースを UCD バージョン 6.1.0 にアップグ #: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " -"the equality of the underlying sequences generated by those range objects. (:" -"issue:`13201`)" +"the equality of the underlying sequences generated by those range objects. " +"(:issue:`13201`)" msgstr "" ":func:`range` オブジェクトどうしの等値性比較が、それぞれの range オブジェクト" -"によって生成されるシーケンスの等値性を反映して行われるようになりました (:" -"issue:`13201`)。" +"によって生成されるシーケンスの等値性を反映して行われるようになりました " +"(:issue:`13201`)。" #: ../../whatsnew/3.3.rst:795 msgid "" @@ -1481,14 +1625,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " -"``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" -"`~collections.abc.MutableSequence` now also defines a :meth:`~collections." -"abc.MutableSequence.clear` method (:issue:`11388`)." +"``copy()`` and ``clear()`` (:issue:`10516`). " +"Consequently, :class:`~collections.abc.MutableSequence` now also defines " +"a :meth:`~collections.abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" ":class:`list` と :class:`bytearray` に新規メソッド ``copy()``, ``clear()`` が" -"追加されました (:issue:`10516`)。これに伴い :class:`~collections.abc." -"MutableSequence` にも :meth:`~collections.abc.MutableSequence.clear` メソッド" -"が追加されました (:issue:`11388`)。" +"追加されました (:issue:`10516`)。これに伴" +"い :class:`~collections.abc.MutableSequence` に" +"も :meth:`~collections.abc.MutableSequence.clear` メソッドが追加されました " +"(:issue:`11388`)。" #: ../../whatsnew/3.3.rst:810 msgid "" @@ -1536,8 +1681,8 @@ msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " "would trigger code execution in a different thread as a side-effect. Clumsy " -"workarounds were sometimes employed, such as the :c:func:" -"`PyImport_ImportModuleNoBlock` C API function." +"workarounds were sometimes employed, such as " +"the :c:func:`PyImport_ImportModuleNoBlock` C API function." msgstr "" "以前のバージョンの CPython では、常に大域的なインポートロックを当てにしていま" "した。このことは意図せず頭痛の種を持ち込むこと繋がっていました。たとえば、モ" @@ -1565,7 +1710,6 @@ msgstr "(Contributed by Antoine Pitrou in :issue:`9260`.)" msgid "Builtin functions and types" msgstr "組み込みの関数と型" -#: ../../whatsnew/3.3.rst:845 msgid "" ":func:`open` gets a new *opener* parameter: the underlying file descriptor " "for the file object is then obtained by calling *opener* with (*file*, " @@ -1573,6 +1717,14 @@ msgid "" "example. The ``'x'`` mode was added: open for exclusive creation, failing if " "the file already exists." msgstr "" +":func:`open` に新規パラメータ *opener* が追加されました。\n" +"背後のファイルオブジェクトのファイル記述子は *opener* を (*file*, *flags*) で" +"呼び出して得られます。\n" +"これは例えば :const:`os.O_CLOEXEC` のようなカスタムなフラグを用いるのに使えま" +"す。\n" +"/ ``'x'`` モードが追加されました。\n" +"排他的作成として開きます。\n" +"ファイルが既存の場合は失敗します。" #: ../../whatsnew/3.3.rst:850 msgid "" @@ -1584,11 +1736,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:852 msgid "" -":func:`hash`: hash randomization is enabled by default, see :meth:`object." -"__hash__` and :envvar:`PYTHONHASHSEED`." +":func:`hash`: hash randomization is enabled by default, " +"see :meth:`object.__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" -":func:`hash`: ハッシュのランダム化がデフォルトで有効になりました。 :meth:" -"`object.__hash__` と環境変数 :envvar:`PYTHONHASHSEED` を参照してください。" +":func:`hash`: ハッシュのランダム化がデフォルトで有効になりまし" +"た。 :meth:`object.__hash__` と環境変数 :envvar:`PYTHONHASHSEED` を参照してく" +"ださい。" #: ../../whatsnew/3.3.rst:854 msgid "" @@ -1604,13 +1757,13 @@ msgstr "" msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " -"documentation sections for the individual builtin sequence types (:issue:" -"`4966`)." +"documentation sections for the individual builtin sequence types " +"(:issue:`4966`)." msgstr "" "シーケンスについてのドキュメントを大幅に書き換えました。バイナリのシーケンス" "とテキストのシーケンスについての区別についてより良い説明を加え、また、個々の" -"組み込みシーケンスに関して個別のドキュメントを提供しています (:issue:" -"`4966`)。" +"組み込みシーケンスに関して個別のドキュメントを提供しています " +"(:issue:`4966`)。" #: ../../whatsnew/3.3.rst:864 msgid "New Modules" @@ -1625,25 +1778,25 @@ msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " "a timeout, or on a user signal. Call :func:`faulthandler.enable` to install " -"fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :" -"const:`SIGBUS`, and :const:`SIGILL` signals. You can also enable them at " -"startup by setting the :envvar:`PYTHONFAULTHANDLER` environment variable or " -"by using :option:`-X` ``faulthandler`` command line option." +"fault handlers for " +"the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, " +"and :const:`SIGILL` signals. You can also enable them at startup by setting " +"the :envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-" +"X` ``faulthandler`` command line option." msgstr "" "この新規モジュール :mod:`faulthandler` には、異常 (セグメンテーション違反のよ" "うなクラッシュ) 時、タイムアウト時、ユーザシグナルの発生時などのタイミングで " -"Python traceback を明示的にダンプするための関数が含まれています。シグナル :" -"const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, :const:" -"`SIGILL` に対するフォールトハンドラをインストールするには、 :func:" -"`faulthandler.enable` を呼び出してください。インタプリタ開始時点でも有効に出" -"来ます。それには環境変数 :envvar:`PYTHONFAULTHANDLER` をセットするか、コマン" -"ドラインオプション :option:`-X` ``faulthandler`` を与えます。" +"Python traceback を明示的にダンプするための関数が含まれています。シグナ" +"ル :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, :const:`SIGILL` " +"に対するフォールトハンドラをインストールするに" +"は、 :func:`faulthandler.enable` を呼び出してください。インタプリタ開始時点で" +"も有効に出来ます。それには環境変数 :envvar:`PYTHONFAULTHANDLER` をセットする" +"か、コマンドラインオプション :option:`-X` ``faulthandler`` を与えます。" #: ../../whatsnew/3.3.rst:877 msgid "Example of a segmentation fault on Linux:" msgstr "Linuxでのセグメンテーションフォールト時の例:" -#: ../../whatsnew/3.3.rst:879 msgid "" "$ python -q -X faulthandler\n" ">>> import ctypes\n" @@ -1656,6 +1809,16 @@ msgid "" " File \"\", line 1 in \n" "Segmentation fault" msgstr "" +"$ python -q -X faulthandler\n" +">>> import ctypes\n" +">>> ctypes.string_at(0)\n" +"Fatal Python error: Segmentation fault\n" +"\n" +"Current thread 0x00007fb899f39700:\n" +" File \"/home/python/cpython/Lib/ctypes/__init__.py\", line 486 in " +"string_at\n" +" File \"\", line 1 in \n" +"Segmentation fault" #: ../../whatsnew/3.3.rst:893 msgid "ipaddress" @@ -1679,12 +1842,13 @@ msgstr "(Contributed by Google and Peter Moody in :pep:`3144`.)" msgid "lzma" msgstr "lzma" -#: ../../whatsnew/3.3.rst:904 msgid "" "The newly added :mod:`lzma` module provides data compression and " "decompression using the LZMA algorithm, including support for the ``.xz`` " "and ``.lzma`` file formats." msgstr "" +"新しい :mod:`lzma` モジュールは LZMA アルゴリズムを使ったデータの圧縮と展開を" +"提供し、``.xz`` と ``.lzma`` ファイル形式にも対応しています。" #: ../../whatsnew/3.3.rst:908 msgid "(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`.)" @@ -1715,24 +1879,26 @@ msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractproperty` は非推奨となりました。代わりに :func:`abc." -"abstractmethod` に :class:`property` を渡して使ってください。" +":class:`abc.abstractproperty` は非推奨となりました。代わり" +"に :func:`abc.abstractmethod` に :class:`property` を渡して使ってください。" #: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" -":class:`abc.abstractclassmethod` has been deprecated, use :class:" -"`classmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractclassmethod` has been deprecated, " +"use :class:`classmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractclassmethod` は非推奨となりました。代わりに :func:`abc." -"abstractmethod` に :class:`classmethod` を渡して使ってください。" +":class:`abc.abstractclassmethod` は非推奨となりました。代わり" +"に :func:`abc.abstractmethod` に :class:`classmethod` を渡して使ってくださ" +"い。" #: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" -":class:`abc.abstractstaticmethod` has been deprecated, use :class:" -"`staticmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractstaticmethod` has been deprecated, " +"use :class:`staticmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractstaticmethod` は非推奨となりました。代わりに :func:`abc." -"abstractmethod` に :class:`staticmethod` を渡して使ってください。" +":class:`abc.abstractstaticmethod` は非推奨となりました。代わり" +"に :func:`abc.abstractmethod` に :class:`staticmethod` を渡して使ってくださ" +"い。" #: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" @@ -1744,18 +1910,19 @@ msgid "" "means it can now be used as a class decorator (:issue:`10868`)." msgstr "" ":meth:`abc.ABCMeta.register` が登録されたサブクラスを返すようになりました。つ" -"まりクラスデコレータとして使うことができるようになったということです (:issue:" -"`10868`)。" +"まりクラスデコレータとして使うことができるようになったということです " +"(:issue:`10868`)。" #: ../../whatsnew/3.3.rst:936 msgid "array" msgstr "array" -#: ../../whatsnew/3.3.rst:938 msgid "" "The :mod:`array` module supports the :c:expr:`long long` type using ``q`` " "and ``Q`` type codes." msgstr "" +":mod:`array` モジュールに型コード ``q`` と ``Q`` による :c:expr:`long long` " +"型サポートが追加されました。" #: ../../whatsnew/3.3.rst:941 msgid "(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`.)" @@ -1769,9 +1936,9 @@ msgstr "base64" #: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " -"the :mod:`base64` modern interface. For example, ``base64." -"b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin Iacob in :" -"issue:`13641`.)" +"the :mod:`base64` modern interface. For example, " +"``base64.b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin " +"Iacob in :issue:`13641`.)" msgstr "" ":mod:`base64` モジュールのモダンなインターフェイスのほうのデコード関数が、" "ASCII 文字のみで構成された Unicode 文字列を受け付けるようになりました。たとえ" @@ -1827,9 +1994,9 @@ msgstr "(Contributed by Nadeem Vawda in :issue:`5863`.)" #: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" -"stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" -"`bz2.BZ2File` can now also be used to create this type of file, using the " -"``'a'`` (append) mode." +"stream inputs (such as those produced by the :program:`pbzip2` " +"tool). :class:`bz2.BZ2File` can now also be used to create this type of " +"file, using the ``'a'`` (append) mode." msgstr "" ":class:`bz2.BZ2File` と :func:`bz2.decompress` が (:program:`pbzip2` ツールで" "生成されたような) マルチストリームの入力を展開出来るようになりました。同時" @@ -1856,15 +2023,15 @@ msgstr "codecs" #: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " -"``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" -"`~encodings.mbcs` codec now supports all error handlers, instead of only " -"``replace`` to encode and ``ignore`` to decode." +"``replace`` and ``ignore`` error handlers on all Windows versions. " +"The :mod:`~encodings.mbcs` codec now supports all error handlers, instead of " +"only ``replace`` to encode and ``ignore`` to decode." msgstr "" ":mod:`~encodings.mbcs` コーデックが、全ての Windows バージョンでエラーハンド" -"ラ ``replace`` と ``ignore`` を正しく処理するように書き換えられました。 :mod:" -"`~encodings.mbcs` コーデックは以前は、エンコードでは ``replace`` のみ、デコー" -"ドでは ``ignore`` のみでしたが、これにより全てのエラーハンドラがサポートされ" -"ます。" +"ラ ``replace`` と ``ignore`` を正しく処理するように書き換えられまし" +"た。 :mod:`~encodings.mbcs` コーデックは以前は、エンコードでは ``replace`` の" +"み、デコードでは ``ignore`` のみでしたが、これにより全てのエラーハンドラがサ" +"ポートされます。" #: ../../whatsnew/3.3.rst:993 msgid "" @@ -1873,22 +2040,23 @@ msgid "" "is used by ``sys.stdout`` if the console output code page is set to cp65001 " "(e.g., using ``chcp 65001`` command)." msgstr "" -"新たに Windows のみ用のコーデック ``cp65001`` が追加されました (:issue:" -"`13216`)。これは Windows コードページ 65001 (Windows UTF-8, ``CP_UTF8``) で" -"す。例えばこれはコンソール出力のコードページが (例えば ``chcp 65001`` コマン" -"ドを使って) cp65001 にセットされている場合に ``sys.stdout`` で使われます。" +"新たに Windows のみ用のコーデック ``cp65001`` が追加されました " +"(:issue:`13216`)。これは Windows コードページ 65001 (Windows UTF-8, " +"``CP_UTF8``) です。例えばこれはコンソール出力のコードページが (例えば ``chcp " +"65001`` コマンドを使って) cp65001 にセットされている場合に ``sys.stdout`` で" +"使われます。" #: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " -"byte of an invalid byte sequence. For example, ``b'\\xff\\n'." -"decode('gb2312', 'replace')`` now returns a ``\\n`` after the replacement " -"character." +"byte of an invalid byte sequence. For example, " +"``b'\\xff\\n'.decode('gb2312', 'replace')`` now returns a ``\\n`` after the " +"replacement character." msgstr "" "マルチバイト CJK デコーダの再同期が高速になりました。これは不正なバイトシーケ" -"ンスが最初のバイトであれば無視するだけです。例えば ``b'\\xff\\n'." -"decode('gb2312', 'replace')`` は文字置き換えののちに ``\\n`` を返すようになっ" -"ています。" +"ンスが最初のバイトであれば無視するだけです。例えば " +"``b'\\xff\\n'.decode('gb2312', 'replace')`` は文字置き換えののちに ``\\n`` を" +"返すようになっています。" #: ../../whatsnew/3.3.rst:1002 msgid "(:issue:`12016`)" @@ -1902,7 +2070,6 @@ msgstr "" "漸増的 CJK コーデックのエンコーダは以前は encode() メソッド呼び出しのたびにリ" "セットしていましたが、リセットしなくなりました。例えば::" -#: ../../whatsnew/3.3.rst:1007 msgid "" ">>> import codecs\n" ">>> encoder = codecs.getincrementalencoder('hz')('strict')\n" @@ -1910,6 +2077,11 @@ msgid "" "Bye.')\n" "b'~{NpJ)l6HK!#~} Bye.'" msgstr "" +">>> import codecs\n" +">>> encoder = codecs.getincrementalencoder('hz')('strict')\n" +">>> b''.join(encoder.encode(x) for x in '\\u52ff\\u65bd\\u65bc\\u4eba\\u3002 " +"Bye.')\n" +"b'~{NpJ)l6HK!#~} Bye.'" #: ../../whatsnew/3.3.rst:1012 msgid "" @@ -1934,19 +2106,19 @@ msgstr "collections" #: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " -"number of mappings as a single unit. (Written by Raymond Hettinger for :" -"issue:`11089`, made public in :issue:`11297`.)" +"number of mappings as a single unit. (Written by Raymond Hettinger " +"for :issue:`11089`, made public in :issue:`11297`.)" msgstr "" "新たに追加されたクラス :class:`~collections.ChainMap` は、複数のマッピングを" -"ひとまとまりに扱えるようにします。 (Written by Raymond Hettinger for :issue:" -"`11089`, made public in :issue:`11297`.)" +"ひとまとまりに扱えるようにします。 (Written by Raymond Hettinger " +"for :issue:`11089`, made public in :issue:`11297`.)" #: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " -"collections classes. Aliases for ABCs are still present in the :mod:" -"`collections` module to preserve existing imports. (:issue:`11085`)" +"collections classes. Aliases for ABCs are still present in " +"the :mod:`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" "抽象基底クラス群は新しいモジュール :mod:`collections.abc` に移動しました。抽" "象コレクションと具象コレクションを識別しやすくするためです。これをインポート" @@ -1994,11 +2166,12 @@ msgstr "(:issue:`13585`)" msgid "crypt" msgstr "crypt" -#: ../../whatsnew/3.3.rst:1057 msgid "" "Addition of salt and modular crypt format (hashing method) and the :func:`!" "mksalt` function to the :mod:`!crypt` module." msgstr "" +":mod:`!crypt` モジュールにソルトと modular crypt 形式 (ハッシュ方式) のサポー" +"ト、および :func:`!mksalt` 関数が追加されました。" #: ../../whatsnew/3.3.rst:1060 msgid "(:issue:`10924`)" @@ -2011,13 +2184,14 @@ msgstr "curses" #: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " -"functions when Unicode strings or characters are passed (e.g. :c:func:" -"`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." +"functions when Unicode strings or characters are passed " +"(e.g. :c:func:`waddwstr`), and bytes functions otherwise " +"(e.g. :c:func:`waddstr`)." msgstr "" ":mod:`curses` モジュールが ncursesw ライブラリとリンクしている場合に、 " -"Unicode 文字列や Unicode 文字が渡されれば Unicode 関数 (例えば :c:func:" -"`waddwstr`)、それ以外の場合はバイト列用関数 (例えば :c:func:`waddstr`) を呼び" -"出すようにしました。" +"Unicode 文字列や Unicode 文字が渡されれば Unicode 関数 (例え" +"ば :c:func:`waddwstr`)、それ以外の場合はバイト列用関数 (例え" +"ば :c:func:`waddstr`) を呼び出すようにしました。" #: ../../whatsnew/3.3.rst:1068 msgid "Use the locale encoding instead of ``utf-8`` to encode Unicode strings." @@ -2066,20 +2240,21 @@ msgstr "datetime" #: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " -"instances now return :const:`False` instead of raising :exc:`TypeError` (:" -"issue:`15006`)." +"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 "" "New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp " "corresponding to the :class:`~datetime.datetime` instance." msgstr "" -"新規メソッド :meth:`datetime.datetime.timestamp`: :class:`~datetime." -"datetime` インスタンスに対応する POSIX タイムスタンプを返します。" +"新規メソッ" +"ド :meth:`datetime.datetime.timestamp`: :class:`~datetime.datetime` インスタ" +"ンスに対応する POSIX タイムスタンプを返します。" #: ../../whatsnew/3.3.rst:1086 msgid "" @@ -2110,15 +2285,18 @@ msgstr ":issue:`7652` - decimal 算術演算の、高速なネイティブ 実 msgid "C-module and libmpdec written by Stefan Krah." msgstr "C-module and libmpdec written by Stefan Krah." -#: ../../whatsnew/3.3.rst:1101 msgid "" "The new C version of the decimal module integrates the high speed libmpdec " "library for arbitrary precision correctly rounded decimal floating-point " "arithmetic. libmpdec conforms to IBM's General Decimal Arithmetic " "Specification." msgstr "" +"decimal モジュールの新しい C 版には、高速な libmpdec ライブラリが組み込まれて" +"います。\n" +"これは任意精度で正しく丸められる十進浮動小数点演算を提供します。\n" +"libmpdec は IBM の General Decimal Arithmetic Specification に準拠していま" +"す。" -#: ../../whatsnew/3.3.rst:1105 msgid "" "Performance gains range from 10x for database applications to 100x for " "numerically intensive applications. These numbers are expected gains for " @@ -2126,12 +2304,19 @@ msgid "" "precision is user configurable, the exact figures may vary. For example, in " "integer bignum arithmetic the differences can be significantly higher." msgstr "" +"性能向上はデータベースアプリケーションで 10 倍、数値計算の多いアプリケーショ" +"ンで 100 倍に及びます。\n" +"これらは十進浮動小数点演算で使われる標準的な精度で期待される値です。\n" +"精度はユーザーが設定できるため、実際の数値は変わる可能性があります。\n" +"例えば、多倍長整数演算では性能の差がさらに大きくなることがあります。" -#: ../../whatsnew/3.3.rst:1111 msgid "" "The following table is meant as an illustration. Benchmarks are available at " "https://www.bytereef.org/mpdecimal/quickstart.html." msgstr "" +"次の表は一例を示したものです。\n" +"ベンチマークは https://www.bytereef.org/mpdecimal/quickstart.html で入手でき" +"ます。" #: ../../whatsnew/3.3.rst:1115 msgid "decimal.py" @@ -2198,16 +2383,18 @@ 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 "" "If Python is compiled without threads, the C version automatically disables " -"the expensive thread local context machinery. In this case, the variable :" -"const:`~decimal.HAVE_THREADS` is set to ``False``." +"the expensive thread local context machinery. In this case, the " +"variable :const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" +"Python がスレッド無しでコンパイルされている場合、C 版は自動的にコストがかかる" +"スレッドローカルなコンテキスト機構を使用不可にします。\n" +"この場合、 :const:`~decimal.HAVE_THREADS` が ``False`` にセットされます。" #: ../../whatsnew/3.3.rst:1137 msgid "" @@ -2253,58 +2440,68 @@ msgstr "``-425000000``" msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../whatsnew/3.3.rst:1150 msgid "" -"In the context templates (:const:`~decimal.DefaultContext`, :const:`~decimal." -"BasicContext` and :const:`~decimal.ExtendedContext`) the magnitude of :attr:" -"`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has changed to " -"``999999``." +"In the context templates " +"(:const:`~decimal.DefaultContext`, :const:`~decimal.BasicContext` " +"and :const:`~decimal.ExtendedContext`) the magnitude " +"of :attr:`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has " +"changed to ``999999``." msgstr "" +"コンテキストのテンプレート " +"(:const:`~decimal.DefaultContext`、:const:`~decimal.BasicContext`、:const:`~decimal.ExtendedContext`) " +"では、:attr:`~decimal.Context.Emax` と :attr:`~decimal.Context.Emin` の絶対値" +"が ``999999`` に変更されました。" #: ../../whatsnew/3.3.rst:1155 msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " "exactly. Since the C version has internal limits, the following scheme is " -"used: If possible, values are converted exactly, otherwise :exc:`~decimal." -"InvalidOperation` is raised and the result is NaN. In the latter case it is " -"always possible to use :meth:`~decimal.Context.create_decimal` in order to " -"obtain a rounded or inexact value." +"used: If possible, values are converted exactly, " +"otherwise :exc:`~decimal.InvalidOperation` is raised and the result is NaN. " +"In the latter case it is always possible to " +"use :meth:`~decimal.Context.create_decimal` in order to obtain a rounded or " +"inexact value." msgstr "" "decimal.py の :class:`~decimal.Decimal` コンストラクタは上記のコンテキスト制" "限に無知で、任意の指数や精度で正確に変換しようとします。C 版は内部の制限を" "持っていますので、次の規則が使われます: 可能ならば値は正確に変換され、そうで" "ない場合 :exc:`~decimal.InvalidOperation` が送出されて結果が NaN となります。" -"後者のケースは丸めあるいは不正確な値を得るために :meth:`~decimal.Context." -"create_decimal` を使うことでいつでも可能です。(---訳注: わかりにくい表現です" -"がコンテキストで InvalidOperation をトラップしていれば結果が NaN で受け取れて" -"(そうでなければ InvalidOperation が投げられて)、その制御は create_decimal で" -"明示的に行える、ということを言っています。---)" +"後者のケースは丸めあるいは不正確な値を得るため" +"に :meth:`~decimal.Context.create_decimal` を使うことでいつでも可能です。(---" +"訳注: わかりにくい表現ですがコンテキストで InvalidOperation をトラップしてい" +"れば結果が NaN で受け取れて(そうでなければ InvalidOperation が投げられて)、そ" +"の制御は create_decimal で明示的に行える、ということを言っています。---)" -#: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " -"version, it is defined in terms of the correctly rounded :meth:`~decimal." -"Decimal.exp` and :meth:`~decimal.Decimal.ln` functions, but the final result " -"is only \"almost always correctly rounded\"." +"version, it is defined in terms of the correctly " +"rounded :meth:`~decimal.Decimal.exp` and :meth:`~decimal.Decimal.ln` " +"functions, but the final result is only \"almost always correctly rounded\"." msgstr "" +"decimal.py のべき乗関数は常に正しく丸められます。\n" +"C 版では正しく丸められる :meth:`~decimal.Decimal.exp` " +"と :meth:`~decimal.Decimal.ln` 関数を使って定義されていますが、最終結果は「ほ" +"ぼ常に正しく丸められる」にとどまります。" #: ../../whatsnew/3.3.rst:1170 msgid "" -"In the C version, the context dictionary containing the signals is a :class:" -"`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." -"Context.flags` and :attr:`~decimal.Context.traps` always refer to the same :" -"class:`~collections.abc.MutableMapping` that the context was initialized " -"with. If a new signal dictionary is assigned, :attr:`~decimal.Context.flags` " -"and :attr:`~decimal.Context.traps` are updated with the new values, but they " -"do not reference the RHS dictionary." +"In the C version, the context dictionary containing the signals is " +"a :class:`~collections.abc.MutableMapping`. For speed " +"reasons, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"always refer to the same :class:`~collections.abc.MutableMapping` that the " +"context was initialized with. If a new signal dictionary is " +"assigned, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"are updated with the new values, but they do not reference the RHS " +"dictionary." msgstr "" "C 版ではシグナルを含む辞書は :class:`~collections.abc.MutableMapping` です。" -"速度的な理由により :attr:`~decimal.Context.flags` と :attr:`~decimal.Context." -"traps` はコンテキストが初期化された時点での :class:`~collections.abc." -"MutableMapping` を参照し続けます。新たなシグナル辞書を :attr:`~decimal." -"Context.flags` に :attr:`~decimal.Context.traps` 割り当てれば新しい値で更新は" -"されるものの、コンテキストはそれら右辺の辞書を参照しません。" +"速度的な理由により :attr:`~decimal.Context.flags` " +"と :attr:`~decimal.Context.traps` はコンテキストが初期化された時点で" +"の :class:`~collections.abc.MutableMapping` を参照し続けます。新たなシグナル" +"辞書を :attr:`~decimal.Context.flags` に :attr:`~decimal.Context.traps` 割り" +"当てれば新しい値で更新はされるものの、コンテキストはそれら右辺の辞書を参照し" +"ません。" #: ../../whatsnew/3.3.rst:1180 msgid "" @@ -2340,31 +2537,32 @@ msgstr "ポリシーフレームワーク" #: ../../whatsnew/3.3.rst:1200 msgid "" -"The email package now has a :mod:`~email.policy` framework. A :class:" -"`~email.policy.Policy` is an object with several methods and properties that " -"control how the email package behaves. The primary policy for Python 3.3 is " -"the :class:`~email.policy.Compat32` policy, which provides backward " -"compatibility with the email package in Python 3.2. A ``policy`` can be " -"specified when an email message is parsed by a :mod:`~email.parser`, or when " -"a :class:`~email.message.Message` object is created, or when an email is " -"serialized using a :mod:`~email.generator`. Unless overridden, a policy " -"passed to a ``parser`` is inherited by all the ``Message`` object and sub-" -"objects created by the ``parser``. By default a ``generator`` will use the " -"policy of the ``Message`` object it is serializing. The default policy is :" -"data:`~email.policy.compat32`." -msgstr "" -"email パッケージに :mod:`~email.policy` フレームワークが追加されました。 :" -"class:`~email.policy.Policy` は、 email パッケージがどのように振舞うのかを制" -"御するための多数のメソッドとプロパティを持つオブジェクトです。Python 3.3 のた" -"めの最初のポリシーは :class:`~email.policy.Compat32` で、これは Python 3.2 " -"の email パッケージとの後方互換性を提供します。 ``policy`` は、 :mod:`~email." -"parser` によって email メッセージが解析される際、あるいは :class:`~email." -"message.Message` オブジェクトを生成する際、あるいは :mod:`~email.generator` " -"を用いて email がシリアライズする際に指定出来ます。オーバライドしない限り" -"は、 ``parser`` に渡されたポリシーは全ての ``Message`` オブジェクトと " -"``parser`` が生成したサブオブジェクトに引き継がれます。デフォルトでは " -"``generator`` は、シリアライズしようとする ``Message`` オブジェクトのポリシー" -"を使います。デフォルトのポリシーは :data:`~email.policy.compat32` です。" +"The email package now has a :mod:`~email.policy` framework. " +"A :class:`~email.policy.Policy` is an object with several methods and " +"properties that control how the email package behaves. The primary policy " +"for Python 3.3 is the :class:`~email.policy.Compat32` policy, which provides " +"backward compatibility with the email package in Python 3.2. A ``policy`` " +"can be specified when an email message is parsed by a :mod:`~email.parser`, " +"or when a :class:`~email.message.Message` object is created, or when an " +"email is serialized using a :mod:`~email.generator`. Unless overridden, a " +"policy passed to a ``parser`` is inherited by all the ``Message`` object and " +"sub-objects created by the ``parser``. By default a ``generator`` will use " +"the policy of the ``Message`` object it is serializing. The default policy " +"is :data:`~email.policy.compat32`." +msgstr "" +"email パッケージに :mod:`~email.policy` フレームワークが追加されまし" +"た。 :class:`~email.policy.Policy` は、 email パッケージがどのように振舞うの" +"かを制御するための多数のメソッドとプロパティを持つオブジェクトです。Python " +"3.3 のための最初のポリシーは :class:`~email.policy.Compat32` で、これは " +"Python 3.2 の email パッケージとの後方互換性を提供します。 ``policy`` " +"は、 :mod:`~email.parser` によって email メッセージが解析される際、あるい" +"は :class:`~email.message.Message` オブジェクトを生成する際、あるい" +"は :mod:`~email.generator` を用いて email がシリアライズする際に指定出来ま" +"す。オーバライドしない限りは、 ``parser`` に渡されたポリシーは全ての " +"``Message`` オブジェクトと ``parser`` が生成したサブオブジェクトに引き継がれ" +"ます。デフォルトでは ``generator`` は、シリアライズしようとする ``Message`` " +"オブジェクトのポリシーを使います。デフォルトのポリシー" +"は :data:`~email.policy.compat32` です。" #: ../../whatsnew/3.3.rst:1213 msgid "The minimum set of controls implemented by all ``policy`` objects are:" @@ -2423,21 +2621,20 @@ msgstr "" #: ../../whatsnew/3.3.rst:1235 msgid "" -"A new policy instance, with new settings, is created using the :meth:`~email." -"policy.Policy.clone` method of policy objects. ``clone`` takes any of the " -"above controls as keyword arguments. Any control not specified in the call " -"retains its default value. Thus you can create a policy that uses " -"``\\r\\n`` linesep characters like this::" +"A new policy instance, with new settings, is created using " +"the :meth:`~email.policy.Policy.clone` method of policy objects. ``clone`` " +"takes any of the above controls as keyword arguments. Any control not " +"specified in the call retains its default value. Thus you can create a " +"policy that uses ``\\r\\n`` linesep characters like this::" msgstr "" -"新たな設定値を持つ新しいポリシーインスタンスは、ポリシーオブジェクトの :meth:" -"`~email.policy.Policy.clone` メソッドを使って作られます。 ``clone`` は任意の" -"上記制御値をキーワード引数として受け取ります。この呼び出しで指定されない制御" -"はデフォルトのまま残されます。ですので linesep 文字列として ``\\r\\n`` を使う" -"ポリシーをこのようにして作れます::" +"新たな設定値を持つ新しいポリシーインスタンスは、ポリシーオブジェクト" +"の :meth:`~email.policy.Policy.clone` メソッドを使って作られます。 ``clone`` " +"は任意の上記制御値をキーワード引数として受け取ります。この呼び出しで指定され" +"ない制御はデフォルトのまま残されます。ですので linesep 文字列として " +"``\\r\\n`` を使うポリシーをこのようにして作れます::" -#: ../../whatsnew/3.3.rst:1241 msgid "mypolicy = compat32.clone(linesep='\\r\\n')" -msgstr "" +msgstr "mypolicy = compat32.clone(linesep='\\r\\n')" #: ../../whatsnew/3.3.rst:1243 msgid "" @@ -2471,10 +2668,10 @@ msgid "" "for introducing it is to allow the creation of new policies that implement " "new features for the email package in a way that maintains backward " "compatibility for those who do not use the new policies. Because the new " -"policies introduce a new API, we are releasing them in Python 3.3 as a :term:" -"`provisional policy `. Backwards incompatible changes " -"(up to and including removal of the code) may occur if deemed necessary by " -"the core developers." +"policies introduce a new API, we are releasing them in Python 3.3 as " +"a :term:`provisional policy `. Backwards incompatible " +"changes (up to and including removal of the code) may occur if deemed " +"necessary by the core developers." msgstr "" "ポリシーフレームワーク単品でもまったくもって価値があるものではありますが、そ" "の導入の主たる動機は、それを使わないコードに対しての後方互換を壊さないやり方" @@ -2489,9 +2686,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" @@ -2543,7 +2740,6 @@ msgstr "" "解析済み日付にアクセス出来るよう、追加の属性群を持ちます。以下のように使えま" "す::" -#: ../../whatsnew/3.3.rst:1293 msgid "" ">>> m = Message(policy=SMTP)\n" ">>> m['To'] = 'Éric '\n" @@ -2557,34 +2753,53 @@ msgid "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" "To: =?utf-8?q?=C3=89ric?= \n" "Date: Fri, 25 May 2012 21:44:27 -0400" msgstr "" +">>> m = Message(policy=SMTP)\n" +">>> m['To'] = 'Éric '\n" +">>> m['to']\n" +"'Éric '\n" +">>> m['to'].addresses\n" +"(Address(display_name='Éric', username='foo', domain='example.com'),)\n" +">>> m['to'].addresses[0].username\n" +"'foo'\n" +">>> m['to'].addresses[0].display_name\n" +"'Éric'\n" +">>> m['Date'] = email.utils.localtime()\n" +">>> m['Date'].datetime\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +">>> m['Date']\n" +"'Fri, 25 May 2012 21:44:27 -0400'\n" +">>> print(m)\n" +"To: =?utf-8?q?=C3=89ric?= \n" +"Date: Fri, 25 May 2012 21:44:27 -0400" #: ../../whatsnew/3.3.rst:1312 msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " "accessed directly, you get the unicode version. This eliminates any need to " -"deal with the :mod:`email.header` :meth:`~email.header.decode_header` or :" -"meth:`~email.header.make_header` functions." +"deal with the :mod:`email.header` :meth:`~email.header.decode_header` " +"or :meth:`~email.header.make_header` functions." msgstr "" "Unicode の display name が、メッセージがシリアライズされる際に自動的に " "``utf-8`` (訳注: 実行例の場合は「の MIME ヘッダエンコード」) でエンコードさ" -"れ、ヘッダに直接アクセスすると Unicode で返ることに気付くと思います。つまり :" -"mod:`email.header` の :meth:`~email.header.decode_header` 関数や :meth:" -"`~email.header.make_header` 関数を取り扱う必要性を取り除いてくれています。" +"れ、ヘッダに直接アクセスすると Unicode で返ることに気付くと思います。つま" +"り :mod:`email.header` の :meth:`~email.header.decode_header` 関数" +"や :meth:`~email.header.make_header` 関数を取り扱う必要性を取り除いてくれてい" +"ます。" #: ../../whatsnew/3.3.rst:1318 msgid "You can also create addresses from parts::" msgstr "アドレスを部品から組み立てることも出来ます::" -#: ../../whatsnew/3.3.rst:1320 msgid "" ">>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n" "... Address('Sally', 'sally', 'example.com')]),\n" @@ -2595,17 +2810,27 @@ msgid "" "cc: pals: Bob , Sally ;, Bonzo " "" msgstr "" +">>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n" +"... Address('Sally', 'sally', 'example.com')]),\n" +"... Address('Bonzo', addr_spec='bonz@laugh.com')]\n" +">>> print(m)\n" +"To: =?utf-8?q?=C3=89ric?= \n" +"Date: Fri, 25 May 2012 21:44:27 -0400\n" +"cc: pals: Bob , Sally ;, Bonzo " +"" #: ../../whatsnew/3.3.rst:1328 msgid "Decoding to unicode is done automatically::" msgstr "Unicode へデコードするのは自動で行われます::" -#: ../../whatsnew/3.3.rst:1330 msgid "" ">>> m2 = message_from_string(str(m))\n" ">>> m2['to']\n" "'Éric '" msgstr "" +">>> m2 = message_from_string(str(m))\n" +">>> m2['to']\n" +"'Éric '" #: ../../whatsnew/3.3.rst:1334 msgid "" @@ -2616,7 +2841,6 @@ msgstr "" "メッセージ解析の際、グループと個々のアドレスにアクセスするのにヘッダオブジェ" "クトの ``addresses`` 属性と ``groups`` 属性を使えます::" -#: ../../whatsnew/3.3.rst:1338 msgid "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2626,9 +2850,19 @@ msgid "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" msgstr "" +">>> m2['cc'].addresses\n" +"(Address(display_name='Bob', username='bob', domain='example.com'), " +"Address(display_name='Sally', username='sally', domain='example.com'), " +"Address(display_name='Bonzo', username='bonz', domain='laugh.com'))\n" +">>> m2['cc'].groups\n" +"(Group(display_name='pals', addresses=(Address(display_name='Bob', " +"username='bob', domain='example.com'), Address(display_name='Sally', " +"username='sally', domain='example.com')), Group(display_name=None, " +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" #: ../../whatsnew/3.3.rst:1343 msgid "" @@ -2648,9 +2882,9 @@ msgstr "その他のAPIの変更" #: ../../whatsnew/3.3.rst:1351 msgid "" -"New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." -"parser` module to complement :class:`~email.parser.HeaderParser` and " -"complete the Bytes API." +"New :class:`~email.parser.BytesHeaderParser`, added to " +"the :mod:`~email.parser` module to " +"complement :class:`~email.parser.HeaderParser` and complete the Bytes API." msgstr "" ":class:`~email.parser.BytesHeaderParser` が :mod:`~email.parser` モジュールに" "追加されました。これは :class:`~email.parser.HeaderParser` を補足するものであ" @@ -2675,23 +2909,24 @@ 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 "" ":func:`~email.utils.localtime`: With no argument, returns the current local " -"time as an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`. Given an aware :class:`~datetime.datetime`, converts " -"it into an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`." -msgstr "" -":func:`~email.utils.localtime`: 引数なしで呼び出すと、ローカル :class:" -"`~datetime.timezone` を使った aware な :class:`~datetime.datetime` として現在" -"ローカル時間を返します。aware な :class:`~datetime.datetime` を渡して呼び出す" -"と、ローカル :class:`~datetime.timezone` を使った aware な :class:`~datetime." -"datetime` に変換します。" +"time as an aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`. Given an " +"aware :class:`~datetime.datetime`, converts it into an " +"aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`." +msgstr "" +":func:`~email.utils.localtime`: 引数なしで呼び出すと、ローカ" +"ル :class:`~datetime.timezone` を使った aware な :class:`~datetime.datetime` " +"として現在ローカル時間を返します。aware な :class:`~datetime.datetime` を渡し" +"て呼び出すと、ローカル :class:`~datetime.timezone` を使った aware " +"な :class:`~datetime.datetime` に変換します。" #: ../../whatsnew/3.3.rst:1372 msgid "ftplib" @@ -2701,37 +2936,39 @@ msgstr "ftplib" msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " -"when creating the outgoing socket. (Contributed by Giampaolo Rodolà in :" -"issue:`8594`.)" +"when creating the outgoing socket. (Contributed by Giampaolo Rodolà " +"in :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 "" -"The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." -"ccc` function to 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. (Contributed by Giampaolo Rodolà " -"in :issue:`12139`.)" +"The :class:`~ftplib.FTP_TLS` class now provides a " +"new :func:`~ftplib.FTP_TLS.ccc` function to 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. (Contributed " +"by Giampaolo Rodolà in :issue:`12139`.)" msgstr "" -":class:`~ftplib.FTP_TLS` クラスに、制御チャネルを平文に戻すための :func:" -"`~ftplib.FTP_TLS.ccc` 関数が追加されました。これは、固定ポートで開くことなく" -"非セキュア FTP で NAT を処理する方法を知っているファイアウォールを利用するの" -"に有用となりえます。(Contributed by Giampaolo Rodolà in :issue:`12139`.)" +":class:`~ftplib.FTP_TLS` クラスに、制御チャネルを平文に戻すため" +"の :func:`~ftplib.FTP_TLS.ccc` 関数が追加されました。これは、固定ポートで開く" +"ことなく非セキュア FTP で NAT を処理する方法を知っているファイアウォールを利" +"用するのに有用となりえます。(Contributed by Giampaolo Rodolà " +"in :issue:`12139`.)" #: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " -"listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." -"dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" +"listing format and deprecates :meth:`ftplib.FTP.nlst` " +"and :meth:`ftplib.FTP.dir`. (Contributed by Giampaolo Rodolà " +"in :issue:`11072`.)" msgstr "" "新規メソッド :meth:`ftplib.FTP.mlsd` は機械で読めるディレクトリリスティングの" "フォーマットを提供し、 :meth:`ftplib.FTP.nlst` と :meth:`ftplib.FTP.dir` に" -"取って代わるものとなりました。(Contributed by Giampaolo Rodolà in :issue:" -"`11072`.)" +"取って代わるものとなりました。(Contributed by Giampaolo Rodolà " +"in :issue:`11072`.)" #: ../../whatsnew/3.3.rst:1391 msgid "functools" @@ -2771,10 +3008,10 @@ msgid "" "channel attacks on digests through timing analysis. (Contributed by Nick " "Coghlan and Christian Heimes in :issue:`15061`.)" msgstr "" -"タイミング解析によるダイジェストに対する `サイドチャンネル攻撃 `_ からの防御のために、 :func:`~hmac." -"compare_digest` 関数が追加されました。(Contributed by Nick Coghlan and " -"Christian Heimes in :issue:`15061`.)" +"タイミング解析によるダイジェストに対する `サイドチャンネル攻撃 `_ からの防御のため" +"に、 :func:`~hmac.compare_digest` 関数が追加されました。(Contributed by Nick " +"Coghlan and Christian Heimes in :issue:`15061`.)" #: ../../whatsnew/3.3.rst:1415 msgid "http" @@ -2783,17 +3020,18 @@ msgstr "http" #: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " -"writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." -"end_headers` is called. A new method :meth:`~http.server." -"BaseHTTPRequestHandler.flush_headers` can be used to directly manage when " -"the accumulated headers are sent. (Contributed by Andrew Schaaf in :issue:" -"`3709`.)" +"writes them all at once " +"when :meth:`~http.server.BaseHTTPRequestHandler.end_headers` is called. A " +"new method :meth:`~http.server.BaseHTTPRequestHandler.flush_headers` can be " +"used to directly manage when the accumulated headers are sent. (Contributed " +"by Andrew Schaaf in :issue:`3709`.)" msgstr "" ":class:`http.server.BaseHTTPRequestHandler` がヘッダをバッファするようにな" "り、 :meth:`~http.server.BaseHTTPRequestHandler.end_headers` 呼び出し時に一度" -"に全てをまとめて書き出すようになりました。新規のメソッド :meth:`~http.server." -"BaseHTTPRequestHandler.flush_headers` は、集積したヘッダを送信する場合の管理" -"に直接使うことが出来ます。(Contributed by Andrew Schaaf in :issue:`3709`.)" +"に全てをまとめて書き出すようになりました。新規のメソッ" +"ド :meth:`~http.server.BaseHTTPRequestHandler.flush_headers` は、集積したヘッ" +"ダを送信する場合の管理に直接使うことが出来ます。(Contributed by Andrew " +"Schaaf in :issue:`3709`.)" #: ../../whatsnew/3.3.rst:1423 msgid "" @@ -2805,14 +3043,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:1426 msgid "" -":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." -"readinto` method, which means it can be used as an :class:`io.RawIOBase` " -"class. (Contributed by John Kuhn in :issue:`13464`.)" +":class:`http.client.HTTPResponse` now has " +"a :meth:`~http.client.HTTPResponse.readinto` method, which means it can be " +"used as an :class:`io.RawIOBase` class. (Contributed by John Kuhn " +"in :issue:`13464`.)" msgstr "" -":class:`http.client.HTTPResponse` にメソッド :meth:`~http.client." -"HTTPResponse.readinto` が追加されました。つまりこのクラスを :class:`io." -"RawIOBase` のように扱えるということです。 (Contributed by John Kuhn in :" -"issue:`13464`.)" +":class:`http.client.HTTPResponse` にメソッ" +"ド :meth:`~http.client.HTTPResponse.readinto` が追加されました。つまりこのク" +"ラスを :class:`io.RawIOBase` のように扱えるということです。 (Contributed by " +"John Kuhn in :issue:`13464`.)" #: ../../whatsnew/3.3.rst:1433 msgid "html" @@ -2821,24 +3060,20 @@ msgstr "html" #: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " -"raising errors, therefore the *strict* argument of the constructor and the :" -"exc:`~html.parser.HTMLParseError` exception are now deprecated. The ability " -"to parse broken markup is the result of a number of bug fixes that are also " -"available on the latest bug fix releases of Python 2.7/3.2. (Contributed by " -"Ezio Melotti in :issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:" -"`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :" -"issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:" -"`12888`, :issue:`7311`.)" +"raising errors, therefore the *strict* argument of the constructor and " +"the :exc:`~html.parser.HTMLParseError` exception are now deprecated. The " +"ability to parse broken markup is the result of a number of bug fixes that " +"are also available on the latest bug fix releases of Python 2.7/3.2. " +"(Contributed by Ezio Melotti in :issue:`15114`, " +"and :issue:`14538`, :issue:`13993`, :issue:`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`.)" msgstr "" ":class:`html.parser.HTMLParser` が壊れたマークアップをエラーなしで解析出来る" -"ようになりました。これによりコンストラクタの *strict* 引数と :exc:`~html." -"parser.HTMLParseError` 例外が撤廃されました。この壊れたマークアップを解析出来" -"る能力は数多くのバグフィックスからの結果であり、それらは Python 2.7/3.2 の最" -"新バグフィックスリリースでも利用可能です。(Contributed by Ezio Melotti in :" -"issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:`13960`, :issue:" -"`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :issue:`12629`, :" -"issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:" -"`7311`.)" +"ようになりました。これによりコンストラクタの *strict* 引数" +"と :exc:`~html.parser.HTMLParseError` 例外が撤廃されました。この壊れたマーク" +"アップを解析出来る能力は数多くのバグフィックスからの結果であり、それらは " +"Python 2.7/3.2 の最新バグフィックスリリースでも利用可能です。(Contributed by " +"Ezio Melotti in :issue:`15114`, " +"and :issue:`14538`, :issue:`13993`, :issue:`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`.)" #: ../../whatsnew/3.3.rst:1445 msgid "" @@ -2851,8 +3086,8 @@ msgstr "" ":mod:`html.entities` モジュールに、HTML5 名前付き文字参照と Unicode 文字(列) " "とを対応付ける :data:`~html.entities.html5` 辞書が追加されました (例: " "``html5['gt;'] == '>'``)。この辞書は既に :class:`~html.parser.HTMLParser` が" -"使っています。 (Contributed by Ezio Melotti in :issue:`11113` and :issue:" -"`15156`.)" +"使っています。 (Contributed by Ezio Melotti in :issue:`11113` " +"and :issue:`15156`.)" #: ../../whatsnew/3.3.rst:1453 msgid "imaplib" @@ -2928,16 +3163,16 @@ msgstr "(Contributed by David Townshend in :issue:`12760`.)" #: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " -"*write_through* optional argument. If *write_through* is ``True``, calls to :" -"meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any data " -"written on the :class:`~io.TextIOWrapper` object is immediately handled to " -"its underlying binary buffer." +"*write_through* optional argument. If *write_through* is ``True``, calls " +"to :meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any " +"data written on the :class:`~io.TextIOWrapper` object is immediately handled " +"to its underlying binary buffer." msgstr "" ":class:`~io.TextIOWrapper` のコンストラクタにオプショナルな引数 " -"*write_through* が追加されました。 *write_through* が ``True`` の場合、:" -"meth:`write` の呼び出しはバッファされないことが保証されます。 :class:" -"`TextIOWrapper` オブジェクトに書かれた全てのデータは直ちに下層のバイナリ " -"*buffer* に処理されます。" +"*write_through* が追加されました。 *write_through* が ``True`` の場" +"合、:meth:`write` の呼び出しはバッファされないことが保証されま" +"す。 :class:`TextIOWrapper` オブジェクトに書かれた全てのデータは直ちに下層の" +"バイナリ *buffer* に処理されます。" #: ../../whatsnew/3.3.rst:1495 msgid "itertools" @@ -2962,8 +3197,8 @@ msgid "" "logger." msgstr "" ":func:`~logging.basicConfig` 関数がオプショナルな ``handlers`` 引数をサポート" -"するようになりました。これはルートロガーに追加するハンドラ群の :term:`イテラ" -"ブル ` です。" +"するようになりました。これはルートロガーに追加するハンドラ群のイテラブルで" +"す。" #: ../../whatsnew/3.3.rst:1507 msgid "" @@ -2973,11 +3208,12 @@ msgid "" "for some daemons it is required while for others it is passed through to the " "log." msgstr "" -":class:`~logging.handlers.SysLogHandler` クラスに、クラスレベル属性の :attr:" -"`~logging.handlers.SysLogHandler.append_nul` が追加されました。これは syslog " -"レコードに ``NUL`` (``\\000``) バイトを追加するかどうかを制御します。これはあ" -"るデーモンはこれで終端することが必要な一方でほかはメッセージの一部として NUL " -"を通すという、デーモンによって振る舞いが異なることに対応するためです。" +":class:`~logging.handlers.SysLogHandler` クラスに、クラスレベル属性" +"の :attr:`~logging.handlers.SysLogHandler.append_nul` が追加されました。これ" +"は syslog レコードに ``NUL`` (``\\000``) バイトを追加するかどうかを制御しま" +"す。これはあるデーモンはこれで終端することが必要な一方でほかはメッセージの一" +"部として NUL を通すという、デーモンによって振る舞いが異なることに対応するため" +"です。" #: ../../whatsnew/3.3.rst:1515 msgid "math" @@ -3028,12 +3264,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " -"multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" -"`4892`.)" +"multiprocessing connections. (Contributed by Richard Oudkerk " +"in :issue:`4892`.)" msgstr "" -"プロセス間で (訳注: :meth:`Connection.send` と :meth:`Connection.recv` で) :" -"class:`multiprocessing.Connection` オブジェクトを相互に転送出来るようになりま" -"した。 (Contributed by Richard Oudkerk in :issue:`4892`.)" +"プロセス間で (訳注: :meth:`Connection.send` と :meth:`Connection.recv` " +"で) :class:`multiprocessing.Connection` オブジェクトを相互に転送出来るように" +"なりました。 (Contributed by Richard Oudkerk in :issue:`4892`.)" #: ../../whatsnew/3.3.rst:1543 msgid "" @@ -3058,39 +3294,51 @@ msgstr "" #: ../../whatsnew/3.3.rst:1552 msgid "" -"New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" -"`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " -"equivalents to the existing :meth:`multiprocessing.pool.Pool.map` and :meth:" -"`~multiprocessing.pool.Pool.map_async` functions. (Contributed by Hynek " -"Schlawack in :issue:`12708`.)" +"New methods :meth:`multiprocessing.pool.Pool.starmap` " +"and :meth:`~multiprocessing.pool.Pool.starmap_async` " +"provide :func:`itertools.starmap` equivalents to the " +"existing :meth:`multiprocessing.pool.Pool.map` " +"and :meth:`~multiprocessing.pool.Pool.map_async` functions. (Contributed by " +"Hynek Schlawack in :issue:`12708`.)" msgstr "" -":func:`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 " -"by Hynek Schlawack in :issue:`12708`.)" +"``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 by Hynek Schlawack in :issue:`12708`.)" #: ../../whatsnew/3.3.rst:1561 msgid "nntplib" msgstr "nntplib" -#: ../../whatsnew/3.3.rst:1563 msgid "" "The :class:`!nntplib.NNTP` class now supports the context management " "protocol to unconditionally consume :exc:`socket.error` exceptions and to " "close the NNTP connection when done::" msgstr "" +":class:`!nntplib.NNTP` クラスがコンテキスト管理プロトコルをサポートするように" +"なりました。\n" +"with ブロックを抜ける際に無条件に NNTP 接続をクローズします (クローズ処理で発" +"生する :exc:`socket.error` は無視されます)。\n" +"。 ::" -#: ../../whatsnew/3.3.rst:1567 msgid "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" msgstr "" +">>> from nntplib import NNTP\n" +">>> with NNTP('news.gmane.org') as n:\n" +"... n.group('gmane.comp.python.committers')\n" +"...\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" +">>>" #: ../../whatsnew/3.3.rst:1574 msgid "(Contributed by Giampaolo Rodolà in :issue:`9795`.)" @@ -3100,13 +3348,16 @@ msgstr "(Contributed by Giampaolo Rodolà in :issue:`9795`.)" msgid "os" msgstr "os" -#: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " -"possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." -"O_NONBLOCK` flags set atomically. This is especially useful to avoid race " -"conditions in multi-threaded programs." +"possible to create a pipe with :const:`~os.O_CLOEXEC` " +"or :const:`~os.O_NONBLOCK` flags set atomically. This is especially useful " +"to avoid race conditions in multi-threaded programs." msgstr "" +":mod:`os` モジュールに :func:`~os.pipe2` 関数が追加されました。\n" +"これはフラグ :const:`~os.O_CLOEXEC` と :const:`~os.O_NONBLOCK` を (論理和指定" +"で) セットしたパイプをアトミックに作ることが出来ます。\n" +"これはマルチスレッドプログラムでの競合状態を避けるために特に有用です。" #: ../../whatsnew/3.3.rst:1585 msgid "" @@ -3137,20 +3388,20 @@ msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " "file descriptors instead of file names. Python 3.3 enhances existing " -"functions and introduces new functions to work on file descriptors (:issue:" -"`4761`, :issue:`10755` and :issue:`14626`)." +"functions and introduces new functions to work on file descriptors " +"(:issue:`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" "シンボリックリンク攻撃や一時ファイル、一時ディレクトリにまつわる問題のような" "競合状態を避けるには、ファイル名の代わりにファイル記述子を操作することがより" "信頼出来ます (そして高速でもあります)。 Python 3.3 はファイル記述子で動作する" -"よう既存関数の強化と新規関数の追加を行ないました。 (:issue:`4761`, :issue:" -"`10755` and :issue:`14626`)" +"よう既存関数の強化と新規関数の追加を行ないました。 " +"(:issue:`4761`, :issue:`10755` and :issue:`14626`)" #: ../../whatsnew/3.3.rst:1601 msgid "" -"The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" -"`~os.walk` except that it also yields file descriptors referring to the " -"directories visited. This is especially useful to avoid symlink races." +"The :mod:`os` module has a new :func:`~os.fwalk` function similar " +"to :func:`~os.walk` except that it also yields file descriptors referring to " +"the directories visited. This is especially useful to avoid symlink races." msgstr "" ":mod:`os` モジュールの新規関数 :func:`~os.fwalk` は :func:`~os.walk` と似てい" "ますが、これは訪問するディレクトリを指すファイル記述子も yield します。これは" @@ -3160,20 +3411,13 @@ msgstr "" msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors `) and/or *follow_symlinks* (:ref:`not " -"following symlinks `): :func:`~os.access`, :func:`~os." -"chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os." -"lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os." -"open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:" -"`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :" -"func:`~os.unlink`, :func:`~os.utime`. Platform support for using these " -"parameters can be checked via the sets :data:`os.supports_dir_fd` and :data:" -"`os.supports_follows_symlinks`." -msgstr "" -"関数 :func:`~os.access`, :func:`~os.chflags`, :func:`~os.chmod`, :func:`~os." -"chown`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os." -"mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:" -"`~os.remove`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :" -"func:`~os.stat`, :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime` " +"following symlinks " +"`): :func:`~os.access`, :func:`~os.chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime`. " +"Platform support for using these parameters can be checked via the " +"sets :data:`os.supports_dir_fd` and :data:`os.supports_follows_symlinks`." +msgstr "" +"関" +"数 :func:`~os.access`, :func:`~os.chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime` " "が、新たな 2 つのオプショナルなキーワード引数のどちらか、または両方をサポート" "するようになりました。 *dir_fd* (:ref:`paths relative to directory " "descriptors `) と *follow_symlinks* (:ref:`not following symlinks " @@ -3184,33 +3428,31 @@ msgstr "" #: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " -"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" -"`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path." -"exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. Platform " -"support for this can be checked via the :data:`os.supports_fd` set." +"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. " +"Platform support for this can be checked via the :data:`os.supports_fd` set." msgstr "" -"関数 :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os." -"execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path." -"exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime` が、パス引" -"数としてファイル記述子をサポートするようになりました。これをプラットフォーム" -"がサポートするかどうかは :data:`os.supports_fd` を調べることでわかります。" +"関" +"数 :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime` " +"が、パス引数としてファイル記述子をサポートするようになりました。これをプラッ" +"トフォームがサポートするかどうかは :data:`os.supports_fd` を調べることでわか" +"ります。" #: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " -"check. Platform support for this can be checked via the :data:`~os." -"supports_effective_ids` set." +"check. Platform support for this can be checked via " +"the :data:`~os.supports_effective_ids` set." msgstr "" ":func:`~os.access` がキーワード引数 ``effective_ids`` を受け取るようになりま" "した。これは実 uid/gid の代わりに実効 uid/gid を使ってアクセスチェックを行う" -"ように振る舞いを変更します。これをプラットフォームがサポートするかどうかは :" -"data:`~os.supports_effective_ids` を調べることでわかります。" +"ように振る舞いを変更します。これをプラットフォームがサポートするかどうか" +"は :data:`~os.supports_effective_ids` を調べることでわかります。" #: ../../whatsnew/3.3.rst:1627 msgid "" -"The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" -"func:`~os.setpriority`. They can be used to get or set process niceness/" +"The :mod:`os` module has two new functions: :func:`~os.getpriority` " +"and :func:`~os.setpriority`. They can be used to get or set process niceness/" "priority in a fashion similar to :func:`os.nice` but extended to all " "processes instead of just the current one." msgstr "" @@ -3237,23 +3479,23 @@ msgstr "" #: ../../whatsnew/3.3.rst:1640 msgid "" -"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" -"`~os.lstat`) now support reading a file's timestamps with nanosecond " -"precision. Symmetrically, :func:`~os.utime` can now write file timestamps " -"with nanosecond precision. (Contributed by Larry Hastings in :issue:" -"`14127`.)" +"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, " +"and :func:`~os.lstat`) now support reading a file's timestamps with " +"nanosecond precision. Symmetrically, :func:`~os.utime` can now write file " +"timestamps with nanosecond precision. (Contributed by Larry Hastings " +"in :issue:`14127`.)" msgstr "" "stat 系関数 (:func:`~os.stat`, :func:`~os.fstat`, :func:`~os.lstat`) がファイ" -"ルのタイムスタンプのナノ秒精度を読み取れるようになりました。これと対となる :" -"func:`~os.utime` もファイルのタイムスタンプをナノ秒精度で書き出せるようになり" -"ました。 (Contributed by Larry Hastings in :issue:`14127`.)" +"ルのタイムスタンプのナノ秒精度を読み取れるようになりました。これと対とな" +"る :func:`~os.utime` もファイルのタイムスタンプをナノ秒精度で書き出せるように" +"なりました。 (Contributed by Larry Hastings in :issue:`14127`.)" #: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " -"terminal attached to a file descriptor. See also :func:`shutil." -"get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-Szmek in :issue:" -"`13609`.)" +"terminal attached to a file descriptor. See " +"also :func:`shutil.get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-" +"Szmek in :issue:`13609`.)" msgstr "" "新規関数 :func:`os.get_terminal_size` はファイル記述子が接続しているターミナ" "ルウィンドウのサイズを取得します。 :func:`shutil.get_terminal_size` も参照し" @@ -3261,31 +3503,21 @@ msgstr "" #: ../../whatsnew/3.3.rst:1653 msgid "" -"New functions to support Linux extended attributes (:issue:`12720`): :func:" -"`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." -"setxattr`." +"New functions to support Linux extended attributes " +"(:issue:`12720`): :func:`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os.setxattr`." msgstr "" -"Linux 拡張属性をサポートするための新たな関数 (:issue:`12720`): :func:`~os." -"getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." -"setxattr`." +"Linux 拡張属性をサポートするための新たな関数 " +"(:issue:`12720`): :func:`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os.setxattr`." #: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " -"allocated CPU time by the operating system. New functions: :func:`~os." -"sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os." -"sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os." -"sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os." -"sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os." -"sched_setscheduler`, :func:`~os.sched_yield`," +"allocated CPU time by the operating system. New " +"functions: :func:`~os.sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os.sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os.sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os.sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os.sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" "スケジューラに対する新たなインターフェイス。これら関数はプロセスに対する OS " -"による CPU 時間割り当てを制御します。新規関数: :func:`~os." -"sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os." -"sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os." -"sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os." -"sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os." -"sched_setscheduler`, :func:`~os.sched_yield`," +"による CPU 時間割り当てを制御します。新規関" +"数: :func:`~os.sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os.sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os.sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os.sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os.sched_setscheduler`, :func:`~os.sched_yield`," #: ../../whatsnew/3.3.rst:1666 msgid "New functions to control the file system:" @@ -3395,12 +3627,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1696 msgid "" -"New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." -"RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" -"`~os.RTLD_NOLOAD`, and :const:`~os.RTLD_DEEPBIND` are available on platforms " -"that support them. These are for use with the :func:`sys.setdlopenflags` " -"function, and supersede the similar constants defined in :mod:`ctypes` and :" -"mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" +"New " +"constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os.RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:`~os.RTLD_NOLOAD`, " +"and :const:`~os.RTLD_DEEPBIND` are available on platforms that support " +"them. These are for use with the :func:`sys.setdlopenflags` function, and " +"supersede the similar constants defined in :mod:`ctypes` and :mod:`DLFCN`. " +"(Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" #: ../../whatsnew/3.3.rst:1704 @@ -3408,9 +3640,9 @@ msgid "" ":func:`os.symlink` now accepts (and ignores) the ``target_is_directory`` " "keyword argument on non-Windows platforms, to ease cross-platform support." msgstr "" -"クロスプラットフォームのサポートを簡単にするために、非 Windows 環境でも :" -"func:`os.symlink` がキーワード引数 ``target_is_directory`` を受け付けるように" -"なりました (単に無視します)。" +"クロスプラットフォームのサポートを簡単にするために、非 Windows 環境で" +"も :func:`os.symlink` がキーワード引数 ``target_is_directory`` を受け付けるよ" +"うになりました (単に無視します)。" #: ../../whatsnew/3.3.rst:1709 msgid "pdb" @@ -3436,8 +3668,9 @@ msgstr "pickle" #: ../../whatsnew/3.3.rst:1721 msgid "" -":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." -"dispatch_table` attribute allowing per-pickler reduction functions to be set." +":class:`pickle.Pickler` objects now have an " +"optional :attr:`~pickle.Pickler.dispatch_table` attribute allowing per-" +"pickler reduction functions to be set." msgstr "" ":class:`pickle.Pickler` オブジェクトに pickler ごとのリダクション関数を設定す" "る、オプショナルな :attr:`~pickle.Pickler.dispatch_table` 属性が追加されまし" @@ -3453,8 +3686,8 @@ msgstr "pydoc" #: ../../whatsnew/3.3.rst:1731 msgid "" -"The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" -"mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " +"The Tk GUI and the :func:`~pydoc.serve` function have been removed from " +"the :mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" "Tk GUI と :func:`~pydoc.serve` 関数は :mod:`pydoc` モジュールから削除されまし" @@ -3502,29 +3735,30 @@ msgstr "" #: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " -"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" -"`8684`.)" +"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà " +"in :issue:`8684`.)" msgstr "" ":class:`~sched.scheduler` クラスをマルチスレッド環境で安全に使えるようになり" -"ました。 (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" -"`8684`.)" +"ました。 (Contributed by Josiah Carlson and Giampaolo Rodolà " +"in :issue:`8684`.)" #: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " -"constructor are now optional and defaults to :func:`time.time` and :func:" -"`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" +"constructor are now optional and defaults to :func:`time.time` " +"and :func:`time.sleep` respectively. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" ":class:`~sched.scheduler` クラスのコンストラクタでのパラメータ *timefunc* と " -"*delayfunc* が省略可能になりました。それぞれデフォルトで順に :func:`time." -"time`, :func:`time.sleep` が使われます。 (Contributed by Chris Clark in :" -"issue:`13245`.)" +"*delayfunc* が省略可能になりました。それぞれデフォルトで順" +"に :func:`time.time`, :func:`time.sleep` が使われます。 (Contributed by " +"Chris Clark in :issue:`13245`.)" #: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " -"*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" -"`13245`.)" +"*argument* parameter is now optional. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" ":meth:`~sched.scheduler.enter` と :meth:`~sched.scheduler.enterabs` の " "*argument* パラメータが省略可能になりました。 (Contributed by Chris Clark " @@ -3549,22 +3783,25 @@ msgid "" "for high performance asynchronous sockets via :file:`/dev/poll`. " "(Contributed by Jesús Cea Avión in :issue:`6397`.)" msgstr "" -"Solaris とその派生プラットフォームにおいて、新規クラス :class:`select." -"devpoll` が追加されました。これはハイパフォーマンスな非同期ソケットを :file:" -"`/dev/poll` 経由で提供するものです。 (Contributed by Jesús Cea Avión in :" -"issue:`6397`.)" +"Solaris とその派生プラットフォームにおいて、新規クラ" +"ス :class:`select.devpoll` が追加されました。これはハイパフォーマンスな非同期" +"ソケットを :file:`/dev/poll` 経由で提供するものです。 (Contributed by Jesús " +"Cea Avión in :issue:`6397`.)" #: ../../whatsnew/3.3.rst:1780 msgid "shlex" msgstr "shlex" -#: ../../whatsnew/3.3.rst:1782 msgid "" "The previously undocumented helper function ``quote`` from the :mod:`!pipes` " -"modules has been moved to the :mod:`shlex` module and documented. :func:" -"`~shlex.quote` properly escapes all characters in a string that might be " -"otherwise given special meaning by the shell." +"modules has been moved to the :mod:`shlex` module and " +"documented. :func:`~shlex.quote` properly escapes all characters in a " +"string that might be otherwise given special meaning by the shell." msgstr "" +"これまで :mod:`!pipes` モジュールにいて文書化もされてこなかったヘルパー関数 " +"``quote`` が、 :mod:`shlex` に移動の上で文書化されました。\n" +"この :func:`~shlex.quote` は、文字列内でシェルによって何か特別な意味を与えら" +"れている全ての文字を適切にエスケープします。" #: ../../whatsnew/3.3.rst:1789 msgid "shutil" @@ -3599,8 +3836,8 @@ msgid "" "Szmek in :issue:`13609`.)" msgstr "" ":func:`shutil.get_terminal_size`: インタプリタが接続しているターミナルウィン" -"ドウのサイズを取得します。 (Contributed by Zbigniew Jędrzejewski-Szmek in :" -"issue:`13609`.)" +"ドウのサイズを取得します。 (Contributed by Zbigniew Jędrzejewski-Szmek " +"in :issue:`13609`.)" #: ../../whatsnew/3.3.rst:1802 msgid "" @@ -3612,8 +3849,8 @@ msgstr "" ":func:`~shutil.copy2` と :func:`~shutil.copystat` がファイルのタイムスタンプ" "を、それをサポートするプラットフォームではナノ秒精度も維持するようになりまし" "た。また、Linux ではこれらは「拡張属性 (extended attributes)」もコピーするよ" -"うになりました。 (Contributed by Larry Hastings in :issue:`14127` and :issue:" -"`15238`.)" +"うになりました。 (Contributed by Larry Hastings in :issue:`14127` " +"and :issue:`15238`.)" #: ../../whatsnew/3.3.rst:1807 msgid "" @@ -3638,16 +3875,16 @@ msgstr "" "ファイルシステムをまたがったファイルのコピーの際に、 :func:`~shutil.move` が" "シンボリックリンクを POSIX の ``move`` コマンドが行うのと同じやり方で扱うよう" "になりました。つまりターゲットのファイルの中身をコピーするのではなくシンボ" -"リックリンクを再作成します。(Contributed by Jonathan Niehof in :issue:" -"`9993`.) また、 :func:`~shutil.move` は ``dst`` 引数を戻り値として返すように" -"なりました。" +"リックリンクを再作成します。(Contributed by Jonathan Niehof " +"in :issue:`9993`.) また、 :func:`~shutil.move` は ``dst`` 引数を戻り値として" +"返すようになりました。" #: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " -"which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." -"unlink`. (Contributed by Martin von Löwis and Hynek Schlawack in :issue:" -"`4489`.)" +"which support the new ``dir_fd`` parameter in :func:`os.open` " +"and :func:`os.unlink`. (Contributed by Martin von Löwis and Hynek Schlawack " +"in :issue:`4489`.)" msgstr "" ":func:`os.open` と :func:`os.unlink` が新パラメータ ``dir_fd`` をサポートして" "いるプラットフォームでは、 :func:`~shutil.rmtree` は今では シンボリックリンク" @@ -3716,19 +3953,23 @@ 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 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.3.rst:1850 msgid "" -"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" -"`1870` (size extension). Per the standard, these extensions are enabled if " -"and only if the client initiates the session with an ``EHLO`` command." +"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) " +"and :rfc:`1870` (size extension). Per the standard, these extensions are " +"enabled if and only if the client initiates the session with an ``EHLO`` " +"command." msgstr "" +":mod:`!smtpd` モジュールが :rfc:`5321` (extended SMTP) と :rfc:`1870` (size " +"extension) をサポートするようになりました。\n" +"標準により、これら拡張を有効にするための必要十分条件はクライアントがセッショ" +"ンを ``EHLO`` コマンドで開始することです。" #: ../../whatsnew/3.3.rst:1854 msgid "" @@ -3746,17 +3987,18 @@ msgstr "smtplib" #: ../../whatsnew/3.3.rst:1862 msgid "" -"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." -"LMTP` classes now accept a ``source_address`` keyword argument to specify " -"the ``(host, port)`` to use as the source address in the bind call when " -"creating the outgoing socket. (Contributed by Paulo Scardine in :issue:" -"`11281`.)" +"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, " +"and :class:`~smtplib.LMTP` classes now accept a ``source_address`` keyword " +"argument to specify the ``(host, port)`` to use as the source address in the " +"bind call when creating the outgoing socket. (Contributed by Paulo Scardine " +"in :issue:`11281`.)" 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`.)" +"クラ" +"ス :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, :class:`~smtplib.LMTP` " +"に新しいキーワード引数 ``source_address`` が追加されました。 ``(host, " +"port)`` の形で指定し、これは外に向かうソケットを作成する際に ``bind()`` 呼び" +"出し内でのソースアドレスとして用いられます。(Contributed by Paulo Scardine " +"in :issue:`11281`.)" #: ../../whatsnew/3.3.rst:1868 msgid "" @@ -3770,14 +4012,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:1872 msgid "" -"The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." -"starttls` method now accept an SSLContext parameter to control parameters of " -"the secure channel. (Contributed by Kasun Herath in :issue:`8809`.)" +"The :class:`~smtplib.SMTP_SSL` constructor and " +"the :meth:`~smtplib.SMTP.starttls` method now accept an SSLContext parameter " +"to control parameters of the secure channel. (Contributed by Kasun Herath " +"in :issue:`8809`.)" msgstr "" ":class:`~smtplib.SMTP_SSL` コンストラクタと :meth:`~smtplib.SMTP.starttls` メ" "ソッドが SSLContext パラメータを受け取るようになりました。これはセキュアな" -"チャネルのパラメータを制御します。 (Contributed by Kasun Herath in :issue:" -"`8809`.)" +"チャネルのパラメータを制御します。 (Contributed by Kasun Herath " +"in :issue:`8809`.)" #: ../../whatsnew/3.3.rst:1878 msgid "socket" @@ -3823,19 +4066,22 @@ msgstr "" #: ../../whatsnew/3.3.rst:1894 msgid "" -"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" -"`10141`.)" +"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves " +"in :issue:`10141`.)" msgstr "" -"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" -"`10141`.)" +"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves " +"in :issue:`10141`.)" -#: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " -"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." -"oracle.com/projects/rds `__)." +"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://" +"oss.oracle.com/projects/rds `__)." msgstr "" +":class:`~socket.socket` クラスが PF_RDS プロトコルファミリーをサポートしまし" +"た (https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets および `https://" +"oss.oracle.com/projects/rds `__)。" #: ../../whatsnew/3.3.rst:1900 msgid "" @@ -3843,15 +4089,17 @@ msgid "" "family on OS X. (Contributed by Michael Goderbauer in :issue:`13777`.)" msgstr "" ":class:`~socket.socket` クラスが OS X で ``PF_SYSTEM`` プロトコルファミリをサ" -"ポートするようになりました。 (Contributed by Michael Goderbauer in :issue:" -"`13777`.)" +"ポートするようになりました。 (Contributed by Michael Goderbauer " +"in :issue:`13777`.)" -#: ../../whatsnew/3.3.rst:1903 msgid "" "New function :func:`~socket.sethostname` allows the hostname to be set on " "Unix systems if the calling process has sufficient privileges. (Contributed " "by Ross Lagerwall in :issue:`10866`.)" msgstr "" +"新しい :func:`~socket.sethostname` 関数を使うと、呼び出すプロセスに十分な権限" +"があれば Unix システムのホスト名を設定できます。\n" +"(Ross Lagerwall による貢献、:issue:`10866`。)" #: ../../whatsnew/3.3.rst:1909 msgid "socketserver" @@ -3859,18 +4107,18 @@ msgstr "socketserver" #: ../../whatsnew/3.3.rst:1911 msgid "" -":class:`~socketserver.BaseServer` now has an overridable method :meth:" -"`~socketserver.BaseServer.service_actions` that is called by the :meth:" -"`~socketserver.BaseServer.serve_forever` method in the service loop. :class:" -"`~socketserver.ForkingMixIn` now uses this to clean up zombie child " -"processes. (Contributed by Justin Warkentin in :issue:`11109`.)" +":class:`~socketserver.BaseServer` now has an overridable " +"method :meth:`~socketserver.BaseServer.service_actions` that is called by " +"the :meth:`~socketserver.BaseServer.serve_forever` method in the service " +"loop. :class:`~socketserver.ForkingMixIn` now uses this to clean up zombie " +"child processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" -":class:`~socketserver.BaseServer` がオーバライド可能な :meth:`~socketserver." -"BaseServer.service_actions` メソッドを持つようになり、これは :meth:" -"`~socketserver.BaseServer.serve_forever` によりサービスループ内で呼び出されま" -"す。 :class:`~socketserver.ForkingMixIn` がこれをゾンビ化した子プロセスのク" -"リーンアップに使っています。 (Contributed by Justin Warkentin in :issue:" -"`11109`.)" +":class:`~socketserver.BaseServer` がオーバライド可能" +"な :meth:`~socketserver.BaseServer.service_actions` メソッドを持つようにな" +"り、これは :meth:`~socketserver.BaseServer.serve_forever` によりサービスルー" +"プ内で呼び出されます。 :class:`~socketserver.ForkingMixIn` がこれをゾンビ化し" +"た子プロセスのクリーンアップに使っています。 (Contributed by Justin " +"Warkentin in :issue:`11109`.)" #: ../../whatsnew/3.3.rst:1919 msgid "sqlite3" @@ -3878,14 +4126,15 @@ msgstr "sqlite3" #: ../../whatsnew/3.3.rst:1921 msgid "" -"New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." -"set_trace_callback` can be used to capture a trace of all sql commands " -"processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" +"New :class:`sqlite3.Connection` " +"method :meth:`~sqlite3.Connection.set_trace_callback` can be used to capture " +"a trace of all sql commands processed by sqlite. (Contributed by Torsten " +"Landschoff in :issue:`11688`.)" msgstr "" -":class:`sqlite3.Connection` の新規のメソッド :meth:`~sqlite3.Connection." -"set_trace_callback` を使うと sqlite3 により処理されるすべての sql コマンドの" -"足跡 (トレース) をキャプチャ出来ます。(Contributed by Torsten Landschoff in :" -"issue:`11688`.)" +":class:`sqlite3.Connection` の新規のメソッ" +"ド :meth:`~sqlite3.Connection.set_trace_callback` を使うと sqlite3 により処理" +"されるすべての sql コマンドの足跡 (トレース) をキャプチャ出来ます。" +"(Contributed by Torsten Landschoff in :issue:`11688`.)" #: ../../whatsnew/3.3.rst:1928 msgid "ssl" @@ -3923,8 +4172,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " -"be used if the private key is encrypted. (Contributed by Adam Simpkins in :" -"issue:`12803`.)" +"be used if the private key is encrypted. (Contributed by Adam Simpkins " +"in :issue:`12803`.)" msgstr "" ":meth:`~ssl.SSLContext.load_cert_chain` が *password* 引数を受け付けるように" "なりました。これは秘密鍵が暗号化されている場合に使われます。 (Contributed by " @@ -3933,14 +4182,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " -"supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." -"SSLContext.set_ecdh_curve` methods. (Contributed by Antoine Pitrou in :issue:" -"`13626` and :issue:`13627`.)" +"supported through the :meth:`~ssl.SSLContext.load_dh_params` " +"and :meth:`~ssl.SSLContext.set_ecdh_curve` methods. (Contributed by Antoine " +"Pitrou in :issue:`13626` and :issue:`13627`.)" msgstr "" -"ディフィー・ヘルマン鍵共有の、通常のものと楕円曲線ベースのもの両方が :meth:" -"`~ssl.SSLContext.load_dh_params` メソッドと :meth:`~ssl.SSLContext." -"set_ecdh_curve` メソッドを通じてサポートされるようになりました。(Contributed " -"by Antoine Pitrou in :issue:`13626` and :issue:`13627`.)" +"ディフィー・ヘルマン鍵共有の、通常のものと楕円曲線ベースのもの両方" +"が :meth:`~ssl.SSLContext.load_dh_params` メソッド" +"と :meth:`~ssl.SSLContext.set_ecdh_curve` メソッドを通じてサポートされるよう" +"になりました。(Contributed by Antoine Pitrou in :issue:`13626` " +"and :issue:`13627`.)" #: ../../whatsnew/3.3.rst:1951 msgid "" @@ -3953,13 +4203,16 @@ msgstr "" "種の認証メカニズムの実装で拡張されることを想定したものです。(Contributed by " "Jacek Konieczny in :issue:`12551`.)" -#: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " -"its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" -"`~ssl.OP_NO_COMPRESSION` can be used to disable compression. (Contributed by " -"Antoine Pitrou in :issue:`13634`.)" +"its new :meth:`~ssl.SSLSocket.compression` method. The new " +"attribute :const:`~ssl.OP_NO_COMPRESSION` can be used to disable " +"compression. (Contributed by Antoine Pitrou in :issue:`13634`.)" msgstr "" +":meth:`~ssl.SSLSocket.compression` メソッドが追加されたので、SSL ソケットで使" +"われている SSL 圧縮アルゴリズムを問い合わせることが出来ます。\n" +"また、新規の属性 :const:`~ssl.OP_NO_COMPRESSION` で圧縮を無効に出来ます。\n" +"(Contributed by Antoine Pitrou in :issue:`13634`.)" #: ../../whatsnew/3.3.rst:1960 msgid "" @@ -3973,9 +4226,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1964 msgid "" -"SSL errors can now be introspected more easily thanks to :attr:`~ssl." -"SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " -"by Antoine Pitrou in :issue:`14837`.)" +"SSL errors can now be introspected more easily thanks " +"to :attr:`~ssl.SSLError.library` and :attr:`~ssl.SSLError.reason` " +"attributes. (Contributed by Antoine Pitrou in :issue:`14837`.)" msgstr "" "属性 :attr:`~ssl.SSLError.library` と :attr:`~ssl.SSLError.reason` が追加され" "たので、SSL のエラーは以前よりもっと簡単に調べることが出来るようになりまし" @@ -3989,12 +4242,15 @@ msgstr "" ":func:`~ssl.get_server_certificate` 関数が IPv6 をサポートするようになりまし" "た。 (Contributed by Charles-François Natali in :issue:`11811`.)" -#: ../../whatsnew/3.3.rst:1971 msgid "" "New attribute :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting SSLv3 " "server sockets to use the server's cipher ordering preference rather than " "the client's (:issue:`13635`)." msgstr "" +"新規属性 :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` は SSLv3 サーバソケットに" +"対し、暗号の優先順位をクライアントのものではなくサーバのものを使うようにしま" +"す。\n" +"(:issue:`13635`)" #: ../../whatsnew/3.3.rst:1977 msgid "stat" @@ -4002,13 +4258,13 @@ msgstr "stat" #: ../../whatsnew/3.3.rst:1979 msgid "" -"The undocumented tarfile.filemode function has been moved to :func:`stat." -"filemode`. It can be used to convert a file's mode to a string of the form '-" -"rwxrwxrwx'." +"The undocumented tarfile.filemode function has been moved " +"to :func:`stat.filemode`. It can be used to convert a file's mode to a " +"string of the form '-rwxrwxrwx'." msgstr "" -"ドキュメントされていなかった ``tarfile.filemode`` 関数が :func:`stat." -"filemode` に移動されました。これはファイルモードを '-rwxrwxrwx' 形式の文字列" -"に変換するのに使えます。" +"ドキュメントされていなかった ``tarfile.filemode`` 関数" +"が :func:`stat.filemode` に移動されました。これはファイルモードを '-" +"rwxrwxrwx' 形式の文字列に変換するのに使えます。" #: ../../whatsnew/3.3.rst:1983 msgid "(Contributed by Giampaolo Rodolà in :issue:`14807`.)" @@ -4018,12 +4274,14 @@ msgstr "(Contributed by Giampaolo Rodolà in :issue:`14807`.)" msgid "struct" msgstr "struct" -#: ../../whatsnew/3.3.rst:1989 msgid "" "The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` " "via the new codes ``n`` and ``N``, respectively. (Contributed by Antoine " "Pitrou in :issue:`3163`.)" msgstr "" +":mod:`struct` モジュールで、新しいコード ``n`` と ``N`` を使ってそれぞ" +"れ :c:type:`ssize_t` と :c:type:`size_t` を扱えるようになりました。\n" +"(Antoine Pitrou による貢献、:issue:`3163`。)" #: ../../whatsnew/3.3.rst:1995 msgid "subprocess" @@ -4037,12 +4295,14 @@ msgstr "" "POSIX プラットフォームにおいて、コマンド文字列として bytes オブジェクトを渡せ" "るようになりました。 (Contributed by Victor Stinner in :issue:`8513`.)" -#: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " -"platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" -"`5870`.)" +"platform-independent fashion. (Contributed by Ross Lagerwall " +"in :issue:`5870`.)" msgstr "" +"新規定数 :const:`~subprocess.DEVNULL` は、プラットフォームに依存しない方法で" +"出力を抑制するのに使えます。\n" +"(Contributed by Ross Lagerwall in :issue:`5870`.)" #: ../../whatsnew/3.3.rst:2006 msgid "sys" @@ -4075,13 +4335,13 @@ msgstr "tempfile" #: ../../whatsnew/3.3.rst:2023 msgid "" -":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." -"SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " -"(Contributed by Ryan Kelly in :issue:`9957`.)" +":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile.SpooledTemporaryFile.truncate` " +"method now accepts a ``size`` parameter. (Contributed by Ryan Kelly " +"in :issue:`9957`.)" msgstr "" -":class:`tempfile.SpooledTemporaryFile` の :meth:`~tempfile." -"SpooledTemporaryFile.truncate` メソッドが ``size`` 引数を受け取るようになりま" -"した。\n" +":class:`tempfile.SpooledTemporaryFile` " +"の :meth:`~tempfile.SpooledTemporaryFile.truncate` メソッドが ``size`` 引数を" +"受け取るようになりました。\n" "(Contributed by Ryan Kelly in :issue:`9957`.)" #: ../../whatsnew/3.3.rst:2029 @@ -4104,17 +4364,15 @@ msgstr "threading" #: ../../whatsnew/3.3.rst:2039 msgid "" -":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" -"`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" -"`threading.Timer`, all of which used to be factory functions returning a " -"class instance, are now classes and may be subclassed. (Contributed by Éric " -"Araujo in :issue:`10968`.)" +":class:`threading.Condition`, :class:`threading.Semaphore`, :class:`threading.BoundedSemaphore`, :class:`threading.Event`, " +"and :class:`threading.Timer`, all of which used to be factory functions " +"returning a class instance, are now classes and may be subclassed. " +"(Contributed by Éric Araujo in :issue:`10968`.)" msgstr "" -"いずれもかつてインスタンスを返すファクトリ関数であった :class:`threading." -"Condition`, :class:`threading.Semaphore`, :class:`threading." -"BoundedSemaphore`, :class:`threading.Event`, :class:`threading.Timer` がクラ" -"スになったので、サブクラス化出来るようになりました。 (Contributed by Éric " -"Araujo in :issue:`10968`.)" +"いずれもかつてインスタンスを返すファクトリ関数であっ" +"た :class:`threading.Condition`, :class:`threading.Semaphore`, :class:`threading.BoundedSemaphore`, :class:`threading.Event`, :class:`threading.Timer` " +"がクラスになったので、サブクラス化出来るようになりました。 (Contributed by " +"Éric Araujo in :issue:`10968`.)" #: ../../whatsnew/3.3.rst:2045 msgid "" @@ -4134,11 +4392,11 @@ msgid "" "that used ``_thread.get_ident`` should likewise be changed to use the new " "public interface." msgstr "" -"かつての非公開関数 ``_thread.get_ident`` が公開関数 :func:`threading." -"get_ident` として利用可能となっています。これは標準ライブラリにおいて多数の " -"``_thread`` モジュールへの直接アクセスを取り除く結果になりました。 ``_thread." -"get_ident`` を使っているサードパーティのコードも同じように、新しく公開化され" -"たインターフェイスに乗り換えるべきです。" +"かつての非公開関数 ``_thread.get_ident`` が公開関" +"数 :func:`threading.get_ident` として利用可能となっています。これは標準ライブ" +"ラリにおいて多数の ``_thread`` モジュールへの直接アクセスを取り除く結果になり" +"ました。 ``_thread.get_ident`` を使っているサードパーティのコードも同じよう" +"に、新しく公開化されたインターフェイスに乗り換えるべきです。" #: ../../whatsnew/3.3.rst:2057 msgid "time" @@ -4180,18 +4438,21 @@ msgstr "" msgid "Other new functions:" msgstr "その他の新たな関数:" -#: ../../whatsnew/3.3.rst:2071 msgid "" -":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." -"clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " -"Victor Stinner in :issue:`10278`.)" +":func:`~time.clock_getres`, :func:`~time.clock_gettime` " +"and :func:`~time.clock_settime` functions with :samp:`CLOCK_{xxx}` " +"constants. (Contributed by Victor Stinner in :issue:`10278`.)" msgstr "" +":samp:`CLOCK_{xxx}` 定数を使" +"う :func:`~time.clock_getres`、:func:`~time.clock_gettime`、:func:`~time.clock_settime` " +"関数。\n" +"(Victor Stinner による貢献、:issue:`10278`。)" #: ../../whatsnew/3.3.rst:2075 msgid "" -"To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" -"`ValueError` when passed a negative sleep value. Previously this was an " -"error on posix, but produced an infinite sleep on Windows." +"To improve cross platform consistency, :func:`~time.sleep` now raises " +"a :exc:`ValueError` when passed a negative sleep value. Previously this was " +"an error on posix, but produced an infinite sleep on Windows." msgstr "" "クロスプラットフォーム間での一貫性を改善するために、 :func:`~time.sleep` が負" "の値を渡すと :exc:`ValueError` を投げるように変更されています。以前から " @@ -4212,11 +4473,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " -"provide support for :pep:`3115` compliant dynamic type creation. (:issue:" -"`14588`)" +"provide support for :pep:`3115` compliant dynamic type creation. " +"(:issue:`14588`)" msgstr "" -"新規関数 :func:`types.new_class` と :func:`types.prepare_class` は :pep:" -"`3115` 準拠の動的な型の生成サポートを提供します。(:issue:`14588`)" +"新規関数 :func:`types.new_class` と :func:`types.prepare_class` " +"は :pep:`3115` 準拠の動的な型の生成サポートを提供します。(:issue:`14588`)" #: ../../whatsnew/3.3.rst:2092 msgid "unittest" @@ -4226,13 +4487,14 @@ msgstr "unittest" msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " -"as context managers. (Contributed by Ezio Melotti and Winston Ewert in :" -"issue:`10775`.)" +"as context managers. (Contributed by Ezio Melotti and Winston Ewert " +"in :issue:`10775`.)" msgstr "" -"メソッド :meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`." -"assertWarns`, :meth:`.assertWarnsRegex` が、コンテキストマネージャとして使わ" -"れる際にキーワード引数 *msg* を受け付けるようになりました。 (Contributed by " -"Ezio Melotti and Winston Ewert in :issue:`10775`.)" +"メソッ" +"ド :meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, :meth:`.assertWarnsRegex` " +"が、コンテキストマネージャとして使われる際にキーワード引数 *msg* を受け付ける" +"ようになりました。 (Contributed by Ezio Melotti and Winston Ewert " +"in :issue:`10775`.)" #: ../../whatsnew/3.3.rst:2099 msgid "" @@ -4252,14 +4514,13 @@ msgid "" "used by :meth:`~urllib.request.Request.get_method` to determine what HTTP " "method should be used. For example, this will send a ``'HEAD'`` request::" msgstr "" -":class:`~urllib.request.Request` クラスが :meth:`~urllib.request.Request." -"get_method` で使われる *method* 引数を受け付けるようになりました。これはどの " -"HTTP メソッドが使われるべきかを指定します。例えば以下は ``'HEAD'`` リクエスト" -"を送信します::" +":class:`~urllib.request.Request` クラス" +"が :meth:`~urllib.request.Request.get_method` で使われる *method* 引数を受け" +"付けるようになりました。これはどの HTTP メソッドが使われるべきかを指定しま" +"す。例えば以下は ``'HEAD'`` リクエストを送信します::" -#: ../../whatsnew/3.3.rst:2110 msgid ">>> urlopen(Request('https://www.python.org', method='HEAD'))" -msgstr "" +msgstr ">>> urlopen(Request('https://www.python.org', method='HEAD'))" #: ../../whatsnew/3.3.rst:2112 msgid "(:issue:`1673007`)" @@ -4272,20 +4533,20 @@ msgstr "webbrowser" #: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " -"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" -"program:`chromium-browser` depending on the version and operating system), " -"and the generic launchers :program:`xdg-open`, from the FreeDesktop.org " -"project, and :program:`gvfs-open`, which is the default URI handler for " -"GNOME 3. (The former contributed by Arnaud Calmettes in :issue:`13620`, the " -"latter by Matthias Klose in :issue:`14493`.)" +"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` " +"or :program:`chromium-browser` depending on the version and operating " +"system), and the generic launchers :program:`xdg-open`, from the " +"FreeDesktop.org project, and :program:`gvfs-open`, which is the default URI " +"handler for GNOME 3. (The former contributed by Arnaud Calmettes " +"in :issue:`13620`, the latter by Matthias Klose in :issue:`14493`.)" msgstr "" ":mod:`webbrowser` モジュールがさらに多くの \"browsers\" をサポートしました: " -"Google Chrome (バージョンと OS 依存で名前が :program:`chrome`, :program:" -"`chromium`, :program:`chrome-browser`, あるいは :program:`chromium-browser`) " -"と、汎用のランチャ :program:`xdg-open` (FreeDesktop.org プロジェクトのもの) " -"と :program:`gvfs-open` (GNOME 3 のデフォルト URI ハンドラ)。 (The former " -"contributed by Arnaud Calmettes in :issue:`13620`, the latter by Matthias " -"Klose in :issue:`14493`.)" +"Google Chrome (バージョンと OS 依存で名前" +"が :program:`chrome`, :program:`chromium`, :program:`chrome-browser`, あるい" +"は :program:`chromium-browser`) と、汎用のランチャ :program:`xdg-open` " +"(FreeDesktop.org プロジェクトのもの) と :program:`gvfs-open` (GNOME 3 のデ" +"フォルト URI ハンドラ)。 (The former contributed by Arnaud Calmettes " +"in :issue:`13620`, the latter by Matthias Klose in :issue:`14493`.)" #: ../../whatsnew/3.3.rst:2128 msgid "xml.etree.ElementTree" @@ -4294,12 +4555,12 @@ msgstr "xml.etree.ElementTree" #: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " -"default; there is no longer a need to explicitly import :mod:`xml.etree." -"cElementTree` (this module stays for backwards compatibility, but is now " -"deprecated). In addition, the ``iter`` family of methods of :class:`~xml." -"etree.ElementTree.Element` has been optimized (rewritten in C). The module's " -"documentation has also been greatly improved with added examples and a more " -"detailed reference." +"default; there is no longer a need to explicitly " +"import :mod:`xml.etree.cElementTree` (this module stays for backwards " +"compatibility, but is now deprecated). In addition, the ``iter`` family of " +"methods of :class:`~xml.etree.ElementTree.Element` has been optimized " +"(rewritten in C). The module's documentation has also been greatly improved " +"with added examples and a more detailed reference." msgstr "" ":mod:`xml.etree.ElementTree` モジュールはデフォルトで C 実装による高速版をイ" "ンポートするようになりました; もう明示的に :mod:`xml.etree.cElementTree` をイ" @@ -4313,19 +4574,23 @@ msgstr "" msgid "zlib" msgstr "zlib" -#: ../../whatsnew/3.3.rst:2142 msgid "" "New attribute :attr:`zlib.Decompress.eof` makes it possible to distinguish " "between a properly formed compressed stream and an incomplete or truncated " "one. (Contributed by Nadeem Vawda in :issue:`12646`.)" msgstr "" +"新しい属性 :attr:`zlib.Decompress.eof` により、正しい形式の圧縮ストリームと、" +"不完全なストリームや途中で切れたストリームを区別できるようになりました。\n" +"(Nadeem Vawda による貢献、:issue:`12646`。)" -#: ../../whatsnew/3.3.rst:2146 msgid "" "New attribute :const:`zlib.ZLIB_RUNTIME_VERSION` reports the version string " "of the underlying ``zlib`` library that is loaded at runtime. (Contributed " "by Torsten Landschoff in :issue:`12306`.)" msgstr "" +"新規属性 :const:`zlib.ZLIB_RUNTIME_VERSION` は実行時にロードされた背後の " +"``zlib`` ライブラリのバージョン文字列です。\n" +"(Contributed by Torsten Landschoff in :issue:`12306`.)" #: ../../whatsnew/3.3.rst:2152 msgid "Optimizations" @@ -4372,11 +4637,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:2167 msgid "" -"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" -"`15026`.)" +"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` " +"and :issue:`15026`.)" msgstr "" -"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" -"`15026`.)" +"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` " +"and :issue:`15026`.)" #: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" @@ -4451,27 +4716,18 @@ msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" #: ../../whatsnew/3.3.rst:2198 -msgid "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -msgstr "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgid ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgstr ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" #: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" -"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" -"`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" +"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" #: ../../whatsnew/3.3.rst:2203 -msgid "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" -msgstr "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" +msgid ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" +msgstr ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" #: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" @@ -4519,14 +4775,14 @@ msgid "" "will produce a :exc:`TypeError` in Python 3.4 (:issue:`9856`)." msgstr "" "object 型そのものの ``object.__format__()`` に空でない文字列が渡すことは非推" -"奨となりました。Python 3.4 ではこれは :exc:`TypeError` となります (:issue:" -"`9856`)。" +"奨となりました。Python 3.4 ではこれは :exc:`TypeError` となります " +"(:issue:`9856`)。" #: ../../whatsnew/3.3.rst:2230 msgid "" -"The ``unicode_internal`` codec has been deprecated because of the :pep:" -"`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " -"(``utf-32-le`` or ``utf-32-be``)" +"The ``unicode_internal`` codec has been deprecated because of " +"the :pep:`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or " +"UTF-32 (``utf-32-le`` or ``utf-32-be``)" msgstr "" ":pep:`393` により、 ``unicode_internal`` コーデックは非推奨となりました。" "UTF-8, UTF-16 (``utf-16-le`` または ``utf-16-be``), あるいは UTF-32 " @@ -4534,19 +4790,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2233 msgid "" -":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: " +"use :meth:`ftplib.FTP.mlsd`" msgstr "" -":meth:`ftplib.FTP.nlst` および :meth:`ftplib.FTP.dir`: :meth:`ftplib.FTP." -"mlsd` を使ってください" +":meth:`ftplib.FTP.nlst` およ" +"び :meth:`ftplib.FTP.dir`: :meth:`ftplib.FTP.mlsd` を使ってください" #: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." msgstr "" -":func:`platform.popen`: :mod:`subprocess` モジュールを使ってください。 :ref:" -"`subprocess-replacements` を是非お読みください (:issue:`11377`)。" +":func:`platform.popen`: :mod:`subprocess` モジュールを使ってくださ" +"い。 :ref:`subprocess-replacements` を是非お読みください (:issue:`11377`)。" #: ../../whatsnew/3.3.rst:2237 msgid "" @@ -4569,8 +4825,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2242 msgid "" -"The behaviour of :func:`time.clock` depends on the platform: use the new :" -"func:`time.perf_counter` or :func:`time.process_time` function instead, " +"The behaviour of :func:`time.clock` depends on the platform: use the " +"new :func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" ":func:`time.clock` の振る舞いがプラットフォーム依存のため、今後は要件に応じて" @@ -4612,163 +4868,185 @@ msgstr "" ":pep:`393` で :c:type:`Py_UNICODE` は非推奨になり、Python 4 で削除されます。" "この型を使用している全ての関数は非推奨です。" -#: ../../whatsnew/3.3.rst:2272 msgid "" -"Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" -"`Py_UNICODE*` types:" +"Unicode functions and methods using :c:type:`Py_UNICODE` " +"and :c:expr:`Py_UNICODE*` types:" msgstr "" +"型 :c:type:`Py_UNICODE` および :c:expr:`Py_UNICODE*` を使用しているユニコード" +"関数ならびにメソッド:" -#: ../../whatsnew/3.3.rst:2275 msgid "" -":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` " +"or :c:func:`PyUnicode_FromKindAndData`" msgstr "" +":c:macro:`!PyUnicode_FromUnicode`: :c:func:`PyUnicode_FromWideChar` また" +"は :c:func:`PyUnicode_FromKindAndData` を使用してください" -#: ../../whatsnew/3.3.rst:2277 msgid "" ":c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`, :c:func:`!" "PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`" msgstr "" +":c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`, :c:func:`!" +"PyUnicode_AsUnicodeAndSize`: :c:func:`PyUnicode_AsWideCharString` を使用して" +"ください" -#: ../../whatsnew/3.3.rst:2279 msgid "" -":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" -"`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" +":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` " +"with :c:macro:`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" msgstr "" +":c:macro:`!PyUnicode_AS_DATA`: :c:macro:`PyUnicode_READ` およ" +"び :c:macro:`PyUnicode_WRITE` とともに :c:macro:`PyUnicode_DATA` を使用してく" +"ださい" -#: ../../whatsnew/3.3.rst:2281 msgid "" -":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" -"`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: " +"use :c:macro:`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" msgstr "" +":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!" +"PyUnicode_GetSize`: :c:macro:`PyUnicode_GET_LENGTH` また" +"は :c:func:`PyUnicode_GetLength` を使用してください" -#: ../../whatsnew/3.3.rst:2283 msgid "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`: use ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)`` (only work on ready strings)" msgstr "" +":c:macro:`!PyUnicode_GET_DATA_SIZE`: ``PyUnicode_GET_LENGTH(str) * " +"PyUnicode_KIND(str)`` を使用してください (既存の文字列でのみうまくいきます)" -#: ../../whatsnew/3.3.rst:2286 msgid "" -":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" -"func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` " +"or :c:func:`PyUnicode_AsWideCharString`" msgstr "" +":c:func:`!PyUnicode_AsUnicodeCopy`: :c:func:`PyUnicode_AsUCS4Copy` また" +"は :c:func:`PyUnicode_AsWideCharString` を使用してください" -#: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" -msgstr "" +msgstr ":c:func:`!PyUnicode_GetMax`" #: ../../whatsnew/3.3.rst:2291 msgid "Functions and macros manipulating Py_UNICODE* strings:" msgstr "Py_UNICODE* 文字列を操作する関数ならびにマクロ:" -#: ../../whatsnew/3.3.rst:2293 msgid "" -":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" +":c:macro:`!Py_UNICODE_strlen()`: :c:func:`PyUnicode_GetLength` また" +"は :c:macro:`PyUnicode_GET_LENGTH` を使ってください。" -#: ../../whatsnew/3.3.rst:2295 msgid "" -":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" +":c:macro:`!Py_UNICODE_strcat()`: :c:func:`PyUnicode_CopyCharacters` また" +"は :c:func:`PyUnicode_FromFormat` を使ってください。" -#: ../../whatsnew/3.3.rst:2297 msgid "" -":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" -"`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!" +"Py_UNICODE_strncpy()`, :c:macro:`!Py_UNICODE_COPY()`: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" +":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!" +"Py_UNICODE_strncpy()`, :c:macro:`!" +"Py_UNICODE_COPY()`: :c:func:`PyUnicode_CopyCharacters` また" +"は :c:func:`PyUnicode_Substring` を使ってください。" -#: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" msgstr "" +":c:macro:`!Py_UNICODE_strcmp()`: :c:func:`PyUnicode_Compare` を使ってくださ" +"い。" -#: ../../whatsnew/3.3.rst:2301 msgid ":c:macro:`!Py_UNICODE_strncmp()`: use :c:func:`PyUnicode_Tailmatch`" msgstr "" +":c:macro:`!Py_UNICODE_strncmp()`: :c:func:`PyUnicode_Tailmatch` を使ってくだ" +"さい。" -#: ../../whatsnew/3.3.rst:2302 msgid "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!" +"Py_UNICODE_strrchr()`: :c:func:`PyUnicode_FindChar` を使ってください。" -#: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" msgstr "" +":c:macro:`!Py_UNICODE_FILL()`: :c:func:`PyUnicode_Fill` を使ってください。" -#: ../../whatsnew/3.3.rst:2305 msgid ":c:macro:`!Py_UNICODE_MATCH`" -msgstr "" +msgstr ":c:macro:`!Py_UNICODE_MATCH`" #: ../../whatsnew/3.3.rst:2307 msgid "Encoders:" msgstr "エンコーダ:" -#: ../../whatsnew/3.3.rst:2309 msgid ":c:func:`!PyUnicode_Encode`: use :c:func:`!PyUnicode_AsEncodedObject`" msgstr "" +":c:func:`!PyUnicode_Encode`: :c:func:`!PyUnicode_AsEncodedObject` を使用して" +"ください" -#: ../../whatsnew/3.3.rst:2310 msgid ":c:func:`!PyUnicode_EncodeUTF7`" -msgstr "" +msgstr ":c:func:`!PyUnicode_EncodeUTF7`" -#: ../../whatsnew/3.3.rst:2311 msgid "" -":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` " +"or :c:func:`PyUnicode_AsUTF8String`" msgstr "" +":c:func:`!PyUnicode_EncodeUTF8`: :c:func:`PyUnicode_AsUTF8` また" +"は :c:func:`PyUnicode_AsUTF8String` を使用してください" -#: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" -msgstr "" +msgstr ":c:func:`!PyUnicode_EncodeUTF32`" -#: ../../whatsnew/3.3.rst:2314 msgid ":c:func:`!PyUnicode_EncodeUTF16`" -msgstr "" +msgstr ":c:func:`!PyUnicode_EncodeUTF16`" -#: ../../whatsnew/3.3.rst:2315 msgid "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` " +"use :c:func:`PyUnicode_AsUnicodeEscapeString`" msgstr "" +":c:func:`!" +"PyUnicode_EncodeUnicodeEscape`: :c:func:`PyUnicode_AsUnicodeEscapeString` を" +"使用してください" -#: ../../whatsnew/3.3.rst:2317 msgid "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` " +"use :c:func:`PyUnicode_AsRawUnicodeEscapeString`" msgstr "" +":c:func:`!" +"PyUnicode_EncodeRawUnicodeEscape`: :c:func:`PyUnicode_AsRawUnicodeEscapeString` " +"を使用してください" -#: ../../whatsnew/3.3.rst:2319 msgid "" ":c:func:`!PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`" msgstr "" +":c:func:`!PyUnicode_EncodeLatin1`: :c:func:`PyUnicode_AsLatin1String` を使用" +"してください" -#: ../../whatsnew/3.3.rst:2320 msgid ":c:func:`!PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`" msgstr "" +":c:func:`!PyUnicode_EncodeASCII`: :c:func:`PyUnicode_AsASCIIString` を使用し" +"てください" -#: ../../whatsnew/3.3.rst:2321 msgid ":c:func:`!PyUnicode_EncodeCharmap`" -msgstr "" +msgstr ":c:func:`!PyUnicode_EncodeCharmap`" -#: ../../whatsnew/3.3.rst:2322 msgid ":c:func:`!PyUnicode_TranslateCharmap`" -msgstr "" +msgstr ":c:func:`!PyUnicode_TranslateCharmap`" -#: ../../whatsnew/3.3.rst:2323 msgid "" -":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" -"func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` " +"or :c:func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" msgstr "" +":c:func:`!PyUnicode_EncodeMBCS`: (``CP_ACP`` code_page ととも" +"に) :c:func:`PyUnicode_AsMBCSString` また" +"は :c:func:`PyUnicode_EncodeCodePage` を使用してください" -#: ../../whatsnew/3.3.rst:2325 msgid "" ":c:func:`!PyUnicode_EncodeDecimal`, :c:func:`!" "PyUnicode_TransformDecimalToASCII`" msgstr "" +":c:func:`!PyUnicode_EncodeDecimal`, :c:func:`!" +"PyUnicode_TransformDecimalToASCII`" #: ../../whatsnew/3.3.rst:2330 msgid "Deprecated features" @@ -4801,12 +5079,12 @@ msgstr "Python コードの移植" #: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " -"environment variable to ``0`` to disable hash randomization. See also the :" -"meth:`object.__hash__` method." +"environment variable to ``0`` to disable hash randomization. See also " +"the :meth:`object.__hash__` method." msgstr "" "ハッシュのランダム化がデフォルトで有効になりました。これを無効にするには環境" -"変数 :envvar:`PYTHONHASHSEED` を ``0`` にセットして下さい。 :meth:`object." -"__hash__` メソッドも参照して下さい。" +"変数 :envvar:`PYTHONHASHSEED` を ``0`` にセットして下さ" +"い。 :meth:`object.__hash__` メソッドも参照して下さい。" #: ../../whatsnew/3.3.rst:2351 msgid "" @@ -4816,38 +5094,40 @@ 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." -"startswith('linux')`` とするか、古い Python バージョンのサポートが不要であれ" -"ば直接的に ``sys.platform == 'linux'`` として下さい。" +":issue:`12326`: Linux では、 ``sys.platform`` はもはやメジャーバージョン番号" +"を含みません。 これは今では常に 'linux' です。以前はこれは Python のビルドに" +"使われた Linux バージョンに依存した ``'linux2'`` や ``'linux3'`` でした。 " +"``sys.platform == 'linux2'`` などとするのではなく、 " +"``sys.platform.startswith('linux')`` とするか、古い Python バージョンのサポー" +"トが不要であれば直接的に ``sys.platform == 'linux'`` として下さい。" #: ../../whatsnew/3.3.rst:2357 msgid "" -":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" -"`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " -"out of range. :exc:`OSError` is now raised if C functions :c:func:`gmtime` " -"or :c:func:`localtime` failed." +":issue:`13847`, :issue:`14180`: :mod:`time` " +"and :mod:`datetime`: :exc:`OverflowError` is now raised instead " +"of :exc:`ValueError` if a timestamp is out of range. :exc:`OSError` is now " +"raised if C functions :c:func:`gmtime` or :c:func:`localtime` failed." msgstr "" ":issue:`13847`, :issue:`14180`: :mod:`time` および :mod:`datetime`: タイムス" "タンプが範囲外の場合に、 :exc:`ValueError` ではなく :exc:`OverflowError` を送" -"出するようになりました。また、C 関数の :c:func:`gmtime` あるいは :c:func:" -"`localtime` が失敗した場合には :exc:`OSError` を送出するようになりました。" +"出するようになりました。また、C 関数の :c:func:`gmtime` あるい" +"は :c:func:`localtime` が失敗した場合には :exc:`OSError` を送出するようになり" +"ました。" #: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " -"sourceless bytecode file, make sure to call :func:`importlib." -"invalidate_caches` to clear out the cache for the finders to notice the new " -"file." +"sourceless bytecode file, make sure to " +"call :func:`importlib.invalidate_caches` to clear out the cache for the " +"finders to notice the new file." msgstr "" "インポートで使われるデフォルトのファインダが、特定のディレクトリに何が含まれ" "るのかについてのキャッシュを利用するようになっています。実行中に Python ソー" "スファイルやバイトコードファイルを作ったら、キャッシュをクリアしてファインダ" -"が新しく作られたファイルに気付けるように、 :func:`importlib." -"invalidate_caches` を呼ぶ必要があることに注意してください。" +"が新しく作られたファイルに気付けるよう" +"に、 :func:`importlib.invalidate_caches` を呼ぶ必要があることに注意してくださ" +"い。" #: ../../whatsnew/3.3.rst:2367 msgid "" @@ -4867,8 +5147,9 @@ msgid "" "was implemented that the default value remained -1. If you need to continue " "to perform a relative import followed by an absolute import, then perform " "the relative import using an index of 1, followed by another import using an " -"index of 0. It is preferred, though, that you use :func:`importlib." -"import_module` rather than call :func:`__import__` directly." +"index of 0. It is preferred, though, that you " +"use :func:`importlib.import_module` rather than call :func:`__import__` " +"directly." msgstr "" ":func:`__import__` の引数 *index* のデフォルトが -1 ではなく 0 となり、また、" "もはや負の値はサポートされません。デフォルト値が -1 で残されたのは(訳注: つま" @@ -4888,25 +5169,32 @@ msgstr "" "与えることは今では許されません。例えば ``__import__('sys', level=1)`` はエ" "ラーです。" -#: ../../whatsnew/3.3.rst:2383 msgid "" "Because :data:`sys.meta_path` and :data:`sys.path_hooks` now have finders on " "them by default, you will most likely want to use :meth:`list.insert` " "instead of :meth:`list.append` to add to those lists." msgstr "" +":data:`sys.meta_path` と :data:`sys.path_hooks` にデフォルトでファインダが含" +"まれるようになったので、これらリストの操作で :meth:`list.append` してきたので" +"あれば、今後はおそらくほとんどは :meth:`list.insert` が相応しいでしょう。" -#: ../../whatsnew/3.3.rst:2387 msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " -"finder, you will need to remove keys paired with values of ``None`` **and** :" -"class:`!imp.NullImporter` to be backwards-compatible. This will lead to " -"extra overhead on older versions of Python that re-insert ``None`` into :" -"data:`sys.path_importer_cache` where it represents the use of implicit " +"finder, you will need to remove keys paired with values of ``None`` " +"**and** :class:`!imp.NullImporter` to be backwards-compatible. This will " +"lead to extra overhead on older versions of Python that re-insert ``None`` " +"into :data:`sys.path_importer_cache` where it represents the use of implicit " "finders, but semantically it should not change anything." msgstr "" +"ファインダが見つからない場合に :data:`sys.path_importer_cache` に ``None`` が" +"挿入されるようになったので、ファインダを持たないパスの辞書エントリをクリアす" +"るには、後方互換性を保つためには :class:`!imp.NullImporter` を値に持つエント" +"リと ``None`` を値に持つエントリ **の両方を** 削除する必要があります。\n" +"古い Python バージョンと比較して、暗黙のファインダを使うことを示すの" +"に :data:`sys.path_importer_cache` に ``None`` を再挿入するという追加のオーバ" +"ヘッドが必要となりますが、意味的には何の変更もないはずです。" -#: ../../whatsnew/3.3.rst:2395 msgid "" ":class:`!importlib.abc.Finder` no longer specifies a ``find_module()`` " "abstract method that must be implemented. If you were relying on subclasses " @@ -4914,16 +5202,22 @@ msgid "" "first. You will probably want to check for ``find_loader()`` first, though, " "in the case of working with :term:`path entry finders `." msgstr "" +":class:`!importlib.abc.Finder` では、実装を必須とする抽象メソッド " +"``find_module()`` を定義しなくなりました。\n" +"サブクラスがこのメソッドを実装していることを前提にしていた場合は、まずメソッ" +"ドが存在するか確認してください。\n" +"ただし :term:`パスエントリファインダー ` を扱う場合は、先" +"に ``find_loader()`` の有無を確認するのがよいでしょう。" #: ../../whatsnew/3.3.rst:2401 msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " "emulation failed to match the behaviour of the real import system. The " -"import emulation itself is still present, but is now deprecated. The :func:" -"`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` functions special " -"case the standard import hooks so they are still supported even though they " -"do not provide the non-standard ``iter_modules()`` method." +"import emulation itself is still present, but is now deprecated. " +"The :func:`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` " +"functions special case the standard import hooks so they are still supported " +"even though they do not provide the non-standard ``iter_modules()`` method." msgstr "" ":mod:`pkgutil` は、内部的に :mod:`importlib` を使うように変更されました。この" "ことは、 :pep:`302` インポートエミュレーションの古い振る舞いが本物のインポー" @@ -4935,8 +5229,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2409 msgid "" -"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" -"func:`email.header.decode_header` has been fixed. Code that uses the " +"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done " +"by :func:`email.header.decode_header` has been fixed. Code that uses the " "standard idiom to convert encoded headers into unicode " "(``str(make_header(decode_header(h))``) will see no change, but code that " "looks at the individual tuples returned by decode_header will see that " @@ -4971,15 +5265,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " -"``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." -"error_proto` errors may need to be changed if errors on ``quit`` are " -"encountered by a particular application (:issue:`11291`)." +"``poplib`` methods. Code that assumes ``quit`` does not " +"raise :exc:`poplib.error_proto` errors may need to be changed if errors on " +"``quit`` are encountered by a particular application (:issue:`11291`)." msgstr "" ":meth:`poplib.POP3.quit` メソッドもほかの全ての ``poplib`` のメソッドと同じ" -"く、今ではプロトコルエラーを送出し得ます。 ``quit`` が :exc:`poplib." -"error_proto` エラーを送出しないことをあてにしていたコードは、 ``quit`` でのエ" -"ラーが特定のアプリケーションにとって問題となるようであれば、修正の必要がある" -"かもしれません (:issue:`11291`)。" +"く、今ではプロトコルエラーを送出し得ます。 ``quit`` " +"が :exc:`poplib.error_proto` エラーを送出しないことをあてにしていたコード" +"は、 ``quit`` でのエラーが特定のアプリケーションにとって問題となるようであれ" +"ば、修正の必要があるかもしれません (:issue:`11291`)。" #: ../../whatsnew/3.3.rst:2430 msgid "" @@ -5003,9 +5297,9 @@ msgstr "非推奨となっていた変数 ``time.accept2dyear`` は削除され #: ../../whatsnew/3.3.rst:2438 msgid "" -"The deprecated ``Context._clamp`` attribute has been removed from the :mod:" -"`decimal` module. It was previously replaced by the public attribute :attr:" -"`~decimal.Context.clamp`. (See :issue:`8540`.)" +"The deprecated ``Context._clamp`` attribute has been removed from " +"the :mod:`decimal` module. It was previously replaced by the public " +"attribute :attr:`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" "非推奨となっていた ``Context._clamp`` 属性が :mod:`decimal` モジュールから削" "除されました。以前に既にこれは公開属性 :attr:`~decimal.Context.clamp` に置き" @@ -5018,8 +5312,8 @@ msgid "" "by :meth:`socket.socket.makefile`." msgstr "" "文書化されていなかった内部ヘルパクラス ``SSLFakeFile`` が :mod:`smtplib` モ" -"ジュールより削除されました。この機能はずっと以前から :meth:`socket.socket." -"makefile` によって直接的に提供されています。" +"ジュールより削除されました。この機能はずっと以前か" +"ら :meth:`socket.socket.makefile` によって直接的に提供されています。" #: ../../whatsnew/3.3.rst:2446 msgid "" @@ -5029,12 +5323,14 @@ msgstr "" "Windows では :func:`time.sleep` に負値を与えた場合に無限に眠っていましたが、" "今ではこれは例外を送出します。POSIX ではこれは以前より常に例外です。" -#: ../../whatsnew/3.3.rst:2449 msgid "" "The ``ast.__version__`` constant has been removed. If you need to make " "decisions affected by the AST version, use :data:`sys.version_info` to make " "the decision." msgstr "" +"定数 ``ast.__version__`` は削除されました。\n" +"AST バージョンに依拠して何かしらの決定をする必要があるのであれ" +"ば、 :data:`sys.version_info` を使ってください。" #: ../../whatsnew/3.3.rst:2453 msgid "" @@ -5082,8 +5378,8 @@ msgid "" "functions using this type are deprecated (but will stay available for at " "least five years). If you were using low-level Unicode APIs to construct " "and access unicode objects and you want to benefit of the memory footprint " -"reduction provided by :pep:`393`, you have to convert your code to the new :" -"doc:`Unicode API <../c-api/unicode>`." +"reduction provided by :pep:`393`, you have to convert your code to the " +"new :doc:`Unicode API <../c-api/unicode>`." msgstr "" ":ref:`PEP 393 ` により、 :c:type:`Py_UNICODE` 型とこの型を使う全ての" "関数は非推奨となりました (ただし最低 5 年は利用可能なまま保たれます)。" @@ -5093,14 +5389,14 @@ msgstr "" #: ../../whatsnew/3.3.rst:2481 msgid "" -"However, if you only have been using high-level functions such as :c:func:" -"`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" -"`PyUnicode_FromFormat()`, your code will automatically take advantage of the " -"new unicode representations." +"However, if you only have been using high-level functions such " +"as :c:func:`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` " +"or :c:func:`PyUnicode_FromFormat()`, your code will automatically take " +"advantage of the new unicode representations." msgstr "" -"一方で :c:func:`PyUnicode_Concat()` 、 :c:func:`PyUnicode_Join` あるいは :c:" -"func:`PyUnicode_FromFormat()` といった高水準関数のみを使ってきたのであれば、" -"あなたのコードは自動的に新しい Unicode 表現に便乗できます。" +"一方で :c:func:`PyUnicode_Concat()` 、 :c:func:`PyUnicode_Join` あるい" +"は :c:func:`PyUnicode_FromFormat()` といった高水準関数のみを使ってきたのであ" +"れば、あなたのコードは自動的に新しい Unicode 表現に便乗できます。" #: ../../whatsnew/3.3.rst:2486 msgid ":c:func:`PyImport_GetMagicNumber` now returns ``-1`` upon failure." @@ -5111,13 +5407,13 @@ msgstr "" msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " -"This also means that the value of *level* used by :c:func:" -"`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." +"This also means that the value of *level* used " +"by :c:func:`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" ":func:`__import__` の *level* 引数に負値を渡すことはもはや有効ではないので、" -"対応する :c:func:`PyImport_ImportModuleLevel` でも同じです。このことは :c:" -"func:`PyImport_ImportModuleEx` に使われる *level* の値が ``-1`` ではなく " -"``0`` を使うようになったことも意味しています。" +"対応する :c:func:`PyImport_ImportModuleLevel` でも同じです。このこと" +"は :c:func:`PyImport_ImportModuleEx` に使われる *level* の値が ``-1`` ではな" +"く ``0`` を使うようになったことも意味しています。" #: ../../whatsnew/3.3.rst:2495 msgid "Building C extensions" @@ -5133,11 +5429,11 @@ msgid "" "remove the ``module`` string from the file names)." msgstr "" "C 拡張のファイル名として認められる範囲が狭められました。滅多に使われてこな" -"かった命名は取りやめられました: POSIX では、 ``xxxmodule.so``, ``xxxmodule." -"abi3.so``, ``xxxmodule.cpython-*.so`` 命名は今後 ``xxx`` モジュールの実装とは" -"認識されません。これまでそのようなファイルを作ってきたのであれば、別の命名に" -"乗り換えてください (つまり ``module`` 文字列をファイル名から取り除いてくださ" -"い)。" +"かった命名は取りやめられました: POSIX では、 ``xxxmodule.so``, " +"``xxxmodule.abi3.so``, ``xxxmodule.cpython-*.so`` 命名は今後 ``xxx`` モジュー" +"ルの実装とは認識されません。これまでそのようなファイルを作ってきたのであれ" +"ば、別の命名に乗り換えてください (つまり ``module`` 文字列をファイル名から取" +"り除いてください)。" #: ../../whatsnew/3.3.rst:2505 msgid "(implemented in :issue:`14040`.)" @@ -5152,8 +5448,9 @@ msgid "" "The -Q command-line flag and related artifacts have been removed. Code " "checking sys.flags.division_warning will need updating." msgstr "" -"``-Q`` コマンドラインスイッチとそれに関係するものは削除されました。 ``sys." -"flags.division_warning`` をチェックしているコードは修正する必要があります。" +"``-Q`` コマンドラインスイッチとそれに関係するものは削除されました。 " +"``sys.flags.division_warning`` をチェックしているコードは修正する必要がありま" +"す。" #: ../../whatsnew/3.3.rst:2514 msgid "(:issue:`10998`, contributed by Éric Araujo.)" @@ -5179,6 +5476,5 @@ msgstr "" msgid "yield" msgstr "yield" -#: ../../whatsnew/3.3.rst:396 msgid "yield from (in What's New)" -msgstr "" +msgstr "yield from (What's New 内)" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index e65895e40..a4f712d9c 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 @@ -42,8 +42,8 @@ msgid "" "`changelog `_." msgstr "" "この記事では 3.3 と比較した Python 3.4 の新機能を解説します。 Python 3.4 は" -"2014年3月16日にリリースされました。全詳細については `変更履歴 `_ をご覧ください。" +"2014年3月16日にリリースされました。全詳細については `変更履歴 `_ をご覧ください。" #: ../../whatsnew/3.4.rst:70 msgid ":pep:`429` -- Python 3.4 Release Schedule" @@ -81,8 +81,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:89 msgid "" -"command line option for :ref:`isolated mode ` (:" -"issue:`16499`)." +"command line option for :ref:`isolated mode ` " +"(:issue:`16499`)." msgstr "" ":ref:`隔離モード (isolated mode) ` の為のコマンドライ" "ンオプション (:issue:`16499`)。" @@ -97,11 +97,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:93 msgid "" -":ref:`A ModuleSpec Type ` for the Import System (:pep:" -"`451`). (Affects importer authors.)" +":ref:`A ModuleSpec Type ` for the Import System " +"(:pep:`451`). (Affects importer authors.)" msgstr "" -"インポートシステムのための :ref:`ModuleSpec 型 ` (:pep:" -"`451`). (インポーターの作者に影響します)" +"インポートシステムのための :ref:`ModuleSpec 型 ` " +"(:pep:`451`). (インポーターの作者に影響します)" #: ../../whatsnew/3.4.rst:95 msgid "" @@ -120,8 +120,8 @@ msgid "" ":mod:`asyncio`: :ref:`New provisional API for asynchronous IO ` (:pep:`3156`)." msgstr "" -":mod:`asyncio`: :ref:`非同期 IO のための新たな暫定 API ` (:" -"pep:`3156`)。" +":mod:`asyncio`: :ref:`非同期 IO のための新たな暫定 API ` " +"(:pep:`3156`)。" #: ../../whatsnew/3.4.rst:102 msgid "" @@ -133,14 +133,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:104 msgid "" -":mod:`enum`: :ref:`Support for enumeration types ` (:pep:" -"`435`)." +":mod:`enum`: :ref:`Support for enumeration types ` " +"(:pep:`435`)." msgstr ":mod:`enum`: :ref:`列挙型のサポート ` (:pep:`435`)。" #: ../../whatsnew/3.4.rst:106 msgid "" -":mod:`pathlib`: :ref:`Object-oriented filesystem paths ` (:" -"pep:`428`)." +":mod:`pathlib`: :ref:`Object-oriented filesystem paths ` " +"(:pep:`428`)." msgstr "" ":mod:`pathlib`: :ref:`オブジェクト指向のファイルシステムパス ` (:pep:`428`)。" @@ -148,11 +148,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:108 msgid "" ":mod:`selectors`: :ref:`High-level and efficient I/O multiplexing `, built upon the :mod:`select` module primitives (part of :pep:" -"`3156`)." +"selectors>`, built upon the :mod:`select` module primitives (part " +"of :pep:`3156`)." msgstr "" -":mod:`selectors`: :ref:`高水準で効率的な I/O の多重化`、:" -"mod:`select` モジュールプリミティブを基にしています (:pep:`3156` の一部)。" +":mod:`selectors`: :ref:`高水準で効率的な I/O の多重化`、:mod:`select` モジュールプリミティブを基にしています " +"(:pep:`3156` の一部)。" #: ../../whatsnew/3.4.rst:111 msgid "" @@ -176,8 +177,8 @@ msgstr "大幅に改善されたライブラリモジュール:" #: ../../whatsnew/3.4.rst:118 msgid "" -":ref:`Single-dispatch generic functions ` in :mod:" -"`functools` (:pep:`443`)." +":ref:`Single-dispatch generic functions ` " +"in :mod:`functools` (:pep:`443`)." msgstr "" ":mod:`functools` の :ref:`シングルディスパッチジェネリック関数 ` (:pep:`443`)。" @@ -186,8 +187,8 @@ msgstr "" msgid "" "New :mod:`pickle` :ref:`protocol 4 ` (:pep:`3154`)." msgstr "" -":mod:`pickle` の新しい :ref:`プロトコル 4 ` (:pep:" -"`3154`)." +":mod:`pickle` の新しい :ref:`プロトコル 4 ` " +"(:pep:`3154`)." #: ../../whatsnew/3.4.rst:121 msgid "" @@ -199,15 +200,16 @@ msgstr "" #: ../../whatsnew/3.4.rst:123 msgid "" -":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a new :" -"mod:`~email.message.Message` subclass (:class:`~email.contentmanager." -"EmailMessage`) that :ref:`simplify MIME handling " -"` (:issue:`18891`)." +":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a " +"new :mod:`~email.message.Message` subclass " +"(:class:`~email.contentmanager.EmailMessage`) that :ref:`simplify MIME " +"handling ` (:issue:`18891`)." msgstr "" ":mod:`email` にサブモジュール :mod:`~email.contentmanager` が追加され、ま" -"た、 :mod:`~email.message.Message` のサブクラス (:class:`~email." -"contentmanager.EmailMessage`) が追加されました。これは :ref:`MIME 処理を簡単" -"にします ` 。 (:issue:`18891`)" +"た、 :mod:`~email.message.Message` のサブクラス " +"(:class:`~email.contentmanager.EmailMessage`) が追加されました。これ" +"は :ref:`MIME 処理を簡単にします ` 。 " +"(:issue:`18891`)" #: ../../whatsnew/3.4.rst:127 msgid "" @@ -216,8 +218,8 @@ msgid "" "the output of the Python :func:`help` system." msgstr "" ":mod:`inspect` と :mod:`pydoc` が以前よりも遥かに幅広い種類の callable オブ" -"ジェクトを正しくイントロスペクション出来るようになり、これは Python :func:" -"`help` システムを改善することになりました。" +"ジェクトを正しくイントロスペクション出来るようになり、これは " +"Python :func:`help` システムを改善することになりました。" #: ../../whatsnew/3.4.rst:130 msgid "The :mod:`ipaddress` module API has been declared stable" @@ -229,11 +231,11 @@ msgstr "セキュリティの改善:" #: ../../whatsnew/3.4.rst:134 msgid "" -":ref:`Secure and interchangeable hash algorithm ` (:pep:" -"`456`)." +":ref:`Secure and interchangeable hash algorithm ` " +"(:pep:`456`)." msgstr "" -":ref:`安全で取り替え可能なハッシュアルゴリズム ` (:pep:" -"`456`)。" +":ref:`安全で取り替え可能なハッシュアルゴリズム ` " +"(:pep:`456`)。" #: ../../whatsnew/3.4.rst:136 msgid "" @@ -245,8 +247,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:138 msgid "" -"New command line option for :ref:`isolated mode `, (:" -"issue:`16499`)." +"New command line option for :ref:`isolated mode `, " +"(:issue:`16499`)." msgstr "" ":ref:`隔離モード (isolated mode) ` のための新たなコマ" "ンドラインオプション (:issue:`16499`)。" @@ -310,9 +312,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:155 msgid "" "All modules in the standard library that support SSL now support server " -"certificate verification, including hostname matching (:func:`ssl." -"match_hostname`) and CRLs (Certificate Revocation lists, see :func:`ssl." -"SSLContext.load_verify_locations`)." +"certificate verification, including hostname matching " +"(:func:`ssl.match_hostname`) and CRLs (Certificate Revocation lists, " +"see :func:`ssl.SSLContext.load_verify_locations`)." msgstr "" "SSL をサポートする全ての標準ライブラリモジュールは今や、ホスト名のマッチング " "(:func:`ssl.match_hostname`) と証明書失効リスト (CRLs=certification " @@ -326,8 +328,8 @@ msgstr "CPython の実装の改善:" #: ../../whatsnew/3.4.rst:162 msgid ":ref:`Safe object finalization ` (:pep:`442`)." msgstr "" -":ref:`オブジェクトの安全なファイナライゼーション ` (:pep:" -"`442`)。" +":ref:`オブジェクトの安全なファイナライゼーション ` " +"(:pep:`442`)。" #: ../../whatsnew/3.4.rst:163 msgid "" @@ -443,7 +445,6 @@ msgstr "" "ない場合でも Windows のための Python ランチャで ``py -m pip`` のようにすれば" "良いです。" -#: ../../whatsnew/3.4.rst:218 msgid "" "As :pep:`discussed in the PEP <0453#recommendations-for-downstream-" "distributors>` platform packagers may choose not to install these commands " @@ -451,6 +452,12 @@ msgid "" "directions on how to install them on that platform (usually using the system " "package manager)." msgstr "" +":pep:`PEP で説明されているように <0453#recommendations-for-downstream-" +"distributors>`、プラットフォームのパッケージ作成者は、これらのコマンドをデ" +"フォルトではインストールしないこともできます。\n" +"ただしその場合、コマンドの実行時に、そのプラットフォームでのインストール方法 " +"(通常はシステムのパッケージマネージャーを使う方法) を明確かつ簡潔に案内する必" +"要があります。" #: ../../whatsnew/3.4.rst:226 msgid "" @@ -492,12 +499,13 @@ msgstr "" "Python Packaging Authority に移動されて、独立したプロジェクトのドキュメンテー" "ションになっています。" -#: ../../whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" +"ただし移行はまだ完了していないため、従来版のガイドは :ref:`install-index` " +"と :ref:`setuptools-index` として引き続き利用できます。" #: ../../whatsnew/3.4.rst:253 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" @@ -547,10 +555,8 @@ msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" msgstr ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" #: ../../whatsnew/3.4.rst:274 -msgid "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -msgstr "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgid ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgstr ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" #: ../../whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" @@ -574,38 +580,40 @@ msgid "" msgstr "" "その最初の導入からずっと、 :mod:`codecs` モジュールとはいつなんどきも、型に中" "立で動的なエンコーディング・デコーディングシステムとして働くものであったので" -"す。そうなのですがその Python テキストモデルとの密接な結合、特に組み込み型 :" -"class:`str`, :class:`bytes`, :class:`bytearray` にある型に制限があるコンビニ" -"エンスメソッドのおかげで、歴史的にその本来の意図を曖昧にしてきたのでした。" +"す。そうなのですがその Python テキストモデルとの密接な結合、特に組み込み" +"型 :class:`str`, :class:`bytes`, :class:`bytearray` にある型に制限があるコン" +"ビニエンスメソッドのおかげで、歴史的にその本来の意図を曖昧にしてきたのでし" +"た。" #: ../../whatsnew/3.4.rst:294 msgid "" -"As a key step in clarifying the situation, the :meth:`codecs.encode` and :" -"meth:`codecs.decode` convenience functions are now properly documented in " -"Python 2.7, 3.3 and 3.4. These functions have existed in the :mod:`codecs` " -"module (and have been covered by the regression test suite) since Python " -"2.4, but were previously only discoverable through runtime introspection." +"As a key step in clarifying the situation, the :meth:`codecs.encode` " +"and :meth:`codecs.decode` convenience functions are now properly documented " +"in Python 2.7, 3.3 and 3.4. These functions have existed in " +"the :mod:`codecs` module (and have been covered by the regression test " +"suite) since Python 2.4, but were previously only discoverable through " +"runtime introspection." msgstr "" -"そんな状況を清く正しくするための重要な一歩として、今ではコンビニエンス関数 :" -"meth:`codecs.encode`, :meth:`codecs.decode` が Python 2.7、3.3、3.4 で適切に" -"ドキュメントされました。これら関数は :mod:`codecs` モジュールに Python 2.4 か" -"らずっと存在している (うえに回帰テストスイートでもずっと網羅してきた) のです" -"が、以前はドキュメントされていなかったわけなので、実行時イントロスペクション" -"でようやく見つけられるというものだったわけです。" +"そんな状況を清く正しくするための重要な一歩として、今ではコンビニエンス関" +"数 :meth:`codecs.encode`, :meth:`codecs.decode` が Python 2.7、3.3、3.4 で適" +"切にドキュメントされました。これら関数は :mod:`codecs` モジュールに Python " +"2.4 からずっと存在している (うえに回帰テストスイートでもずっと網羅してきた) " +"のですが、以前はドキュメントされていなかったわけなので、実行時イントロスペク" +"ションでようやく見つけられるというものだったわけです。" #: ../../whatsnew/3.4.rst:300 msgid "" -"Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" -"`bytearray`, the :mod:`codecs` convenience functions support arbitrary " -"codecs in both Python 2 and Python 3, rather than being limited to Unicode " -"text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " +"Unlike the convenience methods on :class:`str`, :class:`bytes` " +"and :class:`bytearray`, the :mod:`codecs` convenience functions support " +"arbitrary codecs in both Python 2 and Python 3, rather than being limited to " +"Unicode text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " "conversions (in Python 2)." msgstr "" ":class:`str`, :class:`bytes`, :class:`bytearray` でのコンビニエンスメソッド" "が Python 3 では Unicode テキストエンコーディングに制限され、Python 2 では " -"``basestring`` <-> ``basestring`` 変換に制限されるのとは違うのです。 :mod:" -"`codecs` のコンビニエンス関数は Python 2 と Python 3 の両方で任意のコーデック" -"をサポートするのです。" +"``basestring`` <-> ``basestring`` 変換に制限されるのとは違うので" +"す。 :mod:`codecs` のコンビニエンス関数は Python 2 と Python 3 の両方で任意の" +"コーデックをサポートするのです。" #: ../../whatsnew/3.4.rst:306 msgid "" @@ -617,7 +625,6 @@ msgstr "" "ディングについて知っています。そして以下のように適宜、それら汎用目的のコンビ" "ニエンス関数へユーザを誘導します::" -#: ../../whatsnew/3.4.rst:310 msgid "" ">>> b\"abcdef\".decode(\"hex\")\n" "Traceback (most recent call last):\n" @@ -637,6 +644,23 @@ msgid "" "LookupError: 'hex' is not a text encoding; use codecs.open() to handle " "arbitrary codecs" msgstr "" +">>> b\"abcdef\".decode(\"hex\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"LookupError: 'hex' is not a text encoding; use codecs.decode() to handle " +"arbitrary codecs\n" +"\n" +">>> \"hello\".encode(\"rot13\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"LookupError: 'rot13' is not a text encoding; use codecs.encode() to handle " +"arbitrary codecs\n" +"\n" +">>> open(\"foo.txt\", encoding=\"hex\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"LookupError: 'hex' is not a text encoding; use codecs.open() to handle " +"arbitrary codecs" #: ../../whatsnew/3.4.rst:325 msgid "" @@ -649,7 +673,6 @@ msgstr "" "コーディング・デコーディング操作中に起こる例外は、同じ例外型でありエラーを発" "生させることになった原因コーデックの名前に言及する連鎖例外内に包まれます::" -#: ../../whatsnew/3.4.rst:330 msgid "" ">>> import codecs\n" "\n" @@ -683,6 +706,37 @@ msgid "" "TypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not " "support the buffer interface)" msgstr "" +">>> import codecs\n" +"\n" +">>> codecs.decode(b\"abcdefgh\", \"hex\")\n" +"Traceback (most recent call last):\n" +" File \"/usr/lib/python3.4/encodings/hex_codec.py\", line 20, in " +"hex_decode\n" +" return (binascii.a2b_hex(input), len(input))\n" +"binascii.Error: Non-hexadecimal digit found\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"binascii.Error: decoding with 'hex' codec failed (Error: Non-hexadecimal " +"digit found)\n" +"\n" +">>> codecs.encode(\"hello\", \"bz2\")\n" +"Traceback (most recent call last):\n" +" File \"/usr/lib/python3.4/encodings/bz2_codec.py\", line 17, in " +"bz2_encode\n" +" return (bz2.compress(input), len(input))\n" +" File \"/usr/lib/python3.4/bz2.py\", line 498, in compress\n" +" return comp.compress(data) + comp.flush()\n" +"TypeError: 'str' does not support the buffer interface\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not " +"support the buffer interface)" #: ../../whatsnew/3.4.rst:358 msgid "" @@ -699,7 +753,6 @@ msgstr "" "イナリデータの 16 進表現エンコードとそのデコード (たとえば、です) は、今では" "こう書けるということです::" -#: ../../whatsnew/3.4.rst:364 msgid "" ">>> from codecs import encode, decode\n" ">>> encode(b\"hello\", \"hex\")\n" @@ -707,6 +760,11 @@ msgid "" ">>> decode(b\"68656c6c6f\", \"hex\")\n" "b'hello'" msgstr "" +">>> from codecs import encode, decode\n" +">>> encode(b\"hello\", \"hex\")\n" +"b'68656c6c6f'\n" +">>> decode(b\"68656c6c6f\", \"hex\")\n" +"b'hello'" #: ../../whatsnew/3.4.rst:370 msgid "" @@ -718,11 +776,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:373 msgid "" -"(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" -"`17828` and :issue:`19619`.)" +"(Contributed by Nick Coghlan " +"in :issue:`7475`, :issue:`17827`, :issue:`17828` and :issue:`19619`.)" msgstr "" -"(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" -"`17828` and :issue:`19619`.)" +"(Contributed by Nick Coghlan " +"in :issue:`7475`, :issue:`17827`, :issue:`17828` and :issue:`19619`.)" #: ../../whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" @@ -739,8 +797,7 @@ msgstr "" ":pep:`451` は、インポート機構がロードに使うモジュールに関する情報 (つまりモ" "ジュールの仕様) のカプセル化を提供します。これはインポートの実装とインポート" "関連 API の両方を単純化するのに役立ちます。この変更は、 `いくつかの将来のイン" -"ポート関連の改善 `_ の足掛かりでもあります。" +"ポート関連の改善`__ の足掛かりでもあります。" #: ../../whatsnew/3.4.rst:390 msgid "" @@ -748,9 +805,9 @@ msgid "" "Furthermore, they should be transparent to everyone but importer authors. " "Key finder and loader methods have been deprecated, but they will continue " "working. New importers should use the new methods described in the PEP. " -"Existing importers should be updated to implement the new methods. See the :" -"ref:`deprecated-3.4` section for a list of methods that should be replaced " -"and their replacements." +"Existing importers should be updated to implement the new methods. See " +"the :ref:`deprecated-3.4` section for a list of methods that should be " +"replaced and their replacements." msgstr "" "この PEP による公な側面での変化は完全に後方互換です。さらにそれらは、インポー" "ターの作者以外にとっては透過的であるはずです。鍵となるファインダとローダのメ" @@ -775,23 +832,23 @@ msgstr "Unicode データベースを UCD バージョン 6.3 にアップグレ msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " -"evaluating has no elements. (Contributed by Julian Berman in :issue:" -"`18111`.)" +"evaluating has no elements. (Contributed by Julian Berman " +"in :issue:`18111`.)" msgstr "" ":func:`min` と :func:`max` にキーワード専用引数 *default* が追加されました。" "これにはイテラブルが要素なしであると評価される場合に返す値を指定出来ます。 " "(Contributed by Julian Berman in :issue:`18111`.)" -#: ../../whatsnew/3.4.rst:411 msgid "Module objects are now :ref:`weakly referenceable `." msgstr "" +"モジュールオブジェクトが :ref:`弱参照可能 ` になりました。" #: ../../whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " -"contain absolute paths by default, with the sole exception of ``__main__." -"__file__`` when a script has been executed directly using a relative path. " -"(Contributed by Brett Cannon in :issue:`18416`.)" +"contain absolute paths by default, with the sole exception of " +"``__main__.__file__`` when a script has been executed directly using a " +"relative path. (Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" "モジュールの ``__file__`` 属性 (と関連する値) にはデフォルトでは常に絶対パス" "を含むようになりました。ただし、スクリプトがコマンドラインから相対パスを使っ" @@ -833,8 +890,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " -"buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" -"`15958`.)" +"buffer objects as arguments. (Contributed by Antoine Pitrou " +"in :issue:`15958`.)" msgstr "" ":class:`bytes`.join() と :class:`bytearray`.join() が引数として任意のバッファ" "オブジェクトを受け取れるようになりました。 (Contributed by Antoine Pitrou " @@ -847,9 +904,9 @@ msgid "" "Dickinson in :issue:`16772`.)" msgstr "" ":class:`int` コンストラクタの *base* 引数に、 ``__index__`` メソッドを持つ任" -"意のオブジェクトを渡せるようになりました。(Contributed by Mark Dickinson in :" -"issue:`16772`.) (---訳注: `Python API の変更`_ に同じ :issue:`16772` を発端と" -"する変更が書かれているのでそちらも参照して下さい。 ---)" +"意のオブジェクトを渡せるようになりました。(Contributed by Mark Dickinson " +"in :issue:`16772`.) (---訳注: 「Python API の変更」に同じ issue 16772 を発端" +"とする変更が書かれているのでそちらも参照して下さい。 ---)" #: ../../whatsnew/3.4.rst:439 msgid "" @@ -863,14 +920,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:443 msgid "" -":class:`memoryview` is now registered as a :class:`Sequence `, and supports the :func:`reversed` builtin. (Contributed by Nick " -"Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" +":class:`memoryview` is now registered as a :class:`Sequence " +"`, and supports the :func:`reversed` builtin. (Contributed " +"by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" ":class:`memoryview` が :class:`Sequence ` として登録され、ま" "た、組み込み関数 :func:`reversed` をサポートするようになりました。 " -"(Contributed by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:" -"`19078`.)" +"(Contributed by Nick Coghlan and Claudiu Popa in :issue:`18690` " +"and :issue:`19078`.)" #: ../../whatsnew/3.4.rst:447 msgid "" @@ -884,11 +941,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " -"specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" -"`16148`.)" +"specification (see :pep:`424`). (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" -":meth:`~object.__length_hint__` が、公式な言語仕様の一部になりました (see :" -"pep:`424`)。 (Contributed by Armin Ronacher in :issue:`16148`.)" +":meth:`~object.__length_hint__` が、公式な言語仕様の一部になりました " +"(see :pep:`424`)。 (Contributed by Armin Ronacher in :issue:`16148`.)" #: ../../whatsnew/3.4.rst:457 msgid "New Modules" @@ -933,11 +990,11 @@ msgstr "ensurepip" #: ../../whatsnew/3.4.rst:483 msgid "" -"The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" -"`453` implementation. In the normal course of events end users will not " -"need to interact with this module, but it can be used to manually bootstrap " -"``pip`` if the automated bootstrapping into an installation or virtual " -"environment was declined." +"The new :mod:`ensurepip` module is the primary infrastructure for " +"the :pep:`453` implementation. In the normal course of events end users " +"will not need to interact with this module, but it can be used to manually " +"bootstrap ``pip`` if the automated bootstrapping into an installation or " +"virtual environment was declined." msgstr "" "新規の :mod:`ensurepip` モジュールは :pep:`453` 実装のための本質的な基盤で" "す。通常はエンドユーザはこのモジュールを弄ぶ必要はありません。ですが、 " @@ -984,10 +1041,10 @@ msgstr "enum" #: ../../whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " -"implementation of enumeration types, allowing other modules (such as :mod:" -"`socket`) to provide more informative error messages and better debugging " -"support by replacing opaque integer constants with backwards compatible " -"enumeration values." +"implementation of enumeration types, allowing other modules (such " +"as :mod:`socket`) to provide more informative error messages and better " +"debugging support by replacing opaque integer constants with backwards " +"compatible enumeration values." msgstr "" ":mod:`enum` モジュール (:pep:`435` にて定義) は標準の列挙型実装を提供します。" "これにより (:mod:`socket` のような) ほかのモジュールが、不透明な整数定数を後" @@ -1039,9 +1096,9 @@ msgstr "selectors" #: ../../whatsnew/3.4.rst:546 msgid "" -"The new :mod:`selectors` module (created as part of implementing :pep:" -"`3156`) allows high-level and efficient I/O multiplexing, built upon the :" -"mod:`select` module primitives." +"The new :mod:`selectors` module (created as part of " +"implementing :pep:`3156`) allows high-level and efficient I/O multiplexing, " +"built upon the :mod:`select` module primitives." msgstr "" "新規モジュール :mod:`selectors` (:pep:`3156` の一部として作成されました) " "は、高水準で効率的な I/O の多重化を行います。これは :mod:`select` モジュール" @@ -1137,35 +1194,42 @@ msgid "" "(Contributed by Bruno Dupuis in :issue:`16049`.)" msgstr "" "新規クラス :class:`~abc.ABC` はそのメタクラスとして :class:`~abc.ABCMeta` を" -"持ちます。この ``ABC`` を基底クラスとして使うことは ``metaclass=abc." -"ABCMeta`` を指定するのと本質的に同じ効果を持ちますが、少ないタイプ数で単純に" -"書ける上に読みやすいものになります。(Contributed by Bruno Dupuis in :issue:" -"`16049`.)" +"持ちます。この ``ABC`` を基底クラスとして使うことは " +"``metaclass=abc.ABCMeta`` を指定するのと本質的に同じ効果を持ちますが、少ない" +"タイプ数で単純に書ける上に読みやすいものになります。(Contributed by Bruno " +"Dupuis in :issue:`16049`.)" #: ../../whatsnew/3.4.rst:605 msgid "aifc" msgstr "aifc" -#: ../../whatsnew/3.4.rst:607 msgid "" "The :meth:`!getparams` method now returns a namedtuple rather than a plain " "tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" msgstr "" +":meth:`!getparams` メソッドが単なるタプルではなく名前付きタプルを返すようにな" +"りました。\n" +"(Contributed by Claudiu Popa in :issue:`17818`.)" -#: ../../whatsnew/3.4.rst:610 msgid "" ":func:`!aifc.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the :meth:`!close` method of the returned object " "will be called automatically at the end of the block. (Contributed by " "Serhiy Storchacha in :issue:`16486`.)" msgstr "" +":func:`!aifc.open` がコンテキスト管理プロトコルに対応しました。\n" +":keyword:`with` ブロックで使うと、返されたオブジェクトの :meth:`!close` メ" +"ソッドがブロックの終了時に自動的に呼び出されます。\n" +"(Contributed by Serhiy Storchacha in :issue:`16486`.)" -#: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1542 msgid "" -"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" -"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" -"`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept " +"any :term:`bytes-like object`. (Contributed by Serhiy Storchaka " +"in :issue:`8311`.)" msgstr "" +":meth:`!writeframesraw` と :meth:`!writeframes` メソッドが任意" +"の :term:`bytes-like object` を受け付けるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`8311`.)" #: ../../whatsnew/3.4.rst:621 msgid "argparse" @@ -1185,24 +1249,32 @@ msgstr "" msgid "audioop" msgstr "audioop" -#: ../../whatsnew/3.4.rst:631 msgid "" ":mod:`!audioop` now supports 24-bit samples. (Contributed by Serhiy " "Storchaka in :issue:`12866`.)" msgstr "" +":mod:`!audioop` は 24 ビットサンプルをサポートするようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`12866`.)" -#: ../../whatsnew/3.4.rst:634 msgid "" "New :func:`!byteswap` function converts big-endian samples to little-endian " "and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" msgstr "" +"新しい :func:`!byteswap` 関数は、ビッグエンディアンのサンプルをリトルエンディ" +"アンに、またはその逆に変換します。\n" +"(Contributed by Serhiy Storchaka in :issue:`19641`.)" -#: ../../whatsnew/3.4.rst:638 msgid "" "All :mod:`!audioop` functions now accept any :term:`bytes-like object`. " "Strings are not accepted: they didn't work before, now they raise an error " "right away. (Contributed by Serhiy Storchaka in :issue:`16685`.)" msgstr "" +"全ての :mod:`!audioop` 関数が今では任意の :term:`bytes-like object` を受け付" +"けます。\n" +"文字列は許容されません。\n" +"文字列では以前から動作しませんでしたが、ただちに例外を投げるように変更されま" +"した。\n" +"(Contributed by Serhiy Storchaka in :issue:`16685`.)" #: ../../whatsnew/3.4.rst:644 msgid "base64" @@ -1210,25 +1282,26 @@ msgstr "base64" #: ../../whatsnew/3.4.rst:646 msgid "" -"The encoding and decoding functions in :mod:`base64` now accept any :term:" -"`bytes-like object` in cases where it previously required a :class:`bytes` " -"or :class:`bytearray` instance. (Contributed by Nick Coghlan in :issue:" -"`17839`.)" +"The encoding and decoding functions in :mod:`base64` now accept " +"any :term:`bytes-like object` in cases where it previously required " +"a :class:`bytes` or :class:`bytearray` instance. (Contributed by Nick " +"Coghlan in :issue:`17839`.)" msgstr "" ":mod:`base64` のエンコード・デコード関数が任意の :term:`bytes-like object` オ" -"ブジェクトを受け取れるようになりました。以前は :class:`bytes` または :class:" -"`bytearray` インスタンスである必要がありました。 (Contributed by Nick " -"Coghlan in :issue:`17839`.)" +"ブジェクトを受け取れるようになりました。以前は :class:`bytes` また" +"は :class:`bytearray` インスタンスである必要がありました。 (Contributed by " +"Nick Coghlan in :issue:`17839`.)" #: ../../whatsnew/3.4.rst:651 msgid "" -"New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" -"`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " -"encode and decode binary data from and to ``Ascii85`` and the git/mercurial " -"``Base85`` formats, respectively. The ``a85`` functions have options that " -"can be used to make them compatible with the variants of the ``Ascii85`` " -"encoding, including the Adobe variant. (Contributed by Martin Morrison, the " -"Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" +"New " +"functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:`~base64.b85encode`, " +"and :func:`~base64.b85decode` provide the ability to encode and decode " +"binary data from and to ``Ascii85`` and the git/mercurial ``Base85`` " +"formats, respectively. The ``a85`` functions have options that can be used " +"to make them compatible with the variants of the ``Ascii85`` encoding, " +"including the Adobe variant. (Contributed by Martin Morrison, the Mercurial " +"project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" "新規関数 :func:`~base64.a85encode`, :func:`~base64.a85decode` は ``Ascii85`` " "フォーマットの、 :func:`~base64.b85encode`, :func:`~base64.b85decode` は git/" @@ -1289,31 +1362,31 @@ msgstr "" #: ../../whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " -"for utility scripts to handle inflexible APIs that write their output to :" -"data:`sys.stdout` and don't provide any options to redirect it. Using the " -"context manager, the :data:`sys.stdout` output can be redirected to any " +"for utility scripts to handle inflexible APIs that write their output " +"to :data:`sys.stdout` and don't provide any options to redirect it. Using " +"the context manager, the :data:`sys.stdout` output can be redirected to any " "other stream or, in conjunction with :class:`io.StringIO`, to a string. The " "latter can be especially useful, for example, to capture output from a " "function that was written to implement a command line interface. It is " -"recommended only for utility scripts because it affects the global state of :" -"data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" +"recommended only for utility scripts because it affects the global state " +"of :data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" "新規コンテキストマネージャ :func:`contextlib.redirect_stdout` は、ユーティリ" "ティスクリプトにて、その出力を :data:`sys.stdout` に書き出す一方でその向き先" -"を変えれない頑固な API の扱いを簡単にしてくれます。これを使うと、 :data:`sys." -"stdout` 出力をなにかほかのストリームに振り替えたり、あるいは :class:`io." -"StringIO` と組み合わせて文字列化したり出来ます。後者などは特に便利で、たとえ" -"ば元々はコマンドラインインターフェイスとして実装された関数からの出力を取り込" -"む、などということが出来ます。このコンテキストマネージャはユーティリティスク" -"リプト以外では使わない方が肝要です。というのもこれは :data:`sys.stdout` の大" -"域的な状態に影響を与えてしまうからです。 (Contributed by Raymond Hettinger " -"in :issue:`15805`.)" +"を変えれない頑固な API の扱いを簡単にしてくれます。これを使う" +"と、 :data:`sys.stdout` 出力をなにかほかのストリームに振り替えたり、あるい" +"は :class:`io.StringIO` と組み合わせて文字列化したり出来ます。後者などは特に" +"便利で、たとえば元々はコマンドラインインターフェイスとして実装された関数から" +"の出力を取り込む、などということが出来ます。このコンテキストマネージャはユー" +"ティリティスクリプト以外では使わない方が肝要です。というのもこれ" +"は :data:`sys.stdout` の大域的な状態に影響を与えてしまうからです。 " +"(Contributed by Raymond Hettinger in :issue:`15805`.)" #: ../../whatsnew/3.4.rst:697 msgid "" -"The :mod:`contextlib` documentation has also been updated to include a :ref:" -"`discussion ` of the differences " -"between single use, reusable and reentrant context managers." +"The :mod:`contextlib` documentation has also been updated to include " +"a :ref:`discussion ` of the " +"differences between single use, reusable and reentrant context managers." msgstr "" ":mod:`contextlib` ドキュメントにも改善が行われ、コンテキストマネージャを単独" "で使うのと再利用したり再入可能(リエントラント)するのとの違いについての :ref:`" @@ -1341,13 +1414,13 @@ msgstr "dis" #: ../../whatsnew/3.4.rst:714 msgid "" -"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" -"func:`~dis.disassemble` now accept a keyword-only *file* argument that " +"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, " +"and :func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" -"関数 :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, :func:" -"`~dis.disassemble` が新たにキーワード専用引数 *file* を受け取ります。これは出" -"力先を制御します。" +"関" +"数 :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, :func:`~dis.disassemble` " +"が新たにキーワード専用引数 *file* を受け取ります。これは出力先を制御します。" #: ../../whatsnew/3.4.rst:718 msgid "" @@ -1373,7 +1446,6 @@ msgstr "" "コードオブジェクトを調べたり加工するようなプログラムを書くことが出来ます。例" "えばこのように書けます::" -#: ../../whatsnew/3.4.rst:728 msgid "" ">>> import dis\n" ">>> for instr in dis.get_instructions(lambda x: x + 1):\n" @@ -1383,6 +1455,13 @@ msgid "" "BINARY_ADD\n" "RETURN_VALUE" msgstr "" +">>> import dis\n" +">>> for instr in dis.get_instructions(lambda x: x + 1):\n" +"... print(instr.opname)\n" +"LOAD_FAST\n" +"LOAD_CONST\n" +"BINARY_ADD\n" +"RETURN_VALUE" #: ../../whatsnew/3.4.rst:736 msgid "" @@ -1396,24 +1475,24 @@ msgstr "" msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" -"readable form and for iterating over instructions. The :class:`~dis." -"Bytecode` constructor takes the same arguments that :func:`~dis." -"get_instruction` does (plus an optional *current_offset*), and the resulting " -"object can be iterated to produce :class:`~dis.Instruction` objects. But it " -"also has a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis." -"dis` on the constructor argument, but returned as a multi-line string::" +"readable form and for iterating over instructions. " +"The :class:`~dis.Bytecode` constructor takes the same arguments " +"that :func:`~dis.get_instruction` does (plus an optional *current_offset*), " +"and the resulting object can be iterated to " +"produce :class:`~dis.Instruction` objects. But it also has " +"a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis.dis` on " +"the constructor argument, but returned as a multi-line string::" msgstr "" "アプリケーションフレンドリな :class:`~dis.Bytecode` クラスも追加されていま" "す。これはバイトコードを調べるのに、人が読める形式としてもインストラクション" -"列をイテレートするのにも優しい、オブジェクト指向的な API になっています。 :" -"class:`~dis.Bytecode` コンストラクタは :func:`~dis.get_instruction` と同じ引" -"数 (と、追加でオプショナルな *current_offset*) を受け取って、結果のオブジェク" -"トは :class:`~dis.Instruction` オブジェクトを生成するイテレータとして振舞うこ" -"とが出来ます。このオブジェクトは、 :mod:`~dis.dis` にコンストラクタ引数を渡し" -"て呼び出すのと等価な :mod:`~dis.Bytecode.dis` メソッドも持っていますが、マル" -"チライン文字列で返します::" +"列をイテレートするのにも優しい、オブジェクト指向的な API になっていま" +"す。 :class:`~dis.Bytecode` コンストラクタは :func:`~dis.get_instruction` と" +"同じ引数 (と、追加でオプショナルな *current_offset*) を受け取って、結果のオブ" +"ジェクトは :class:`~dis.Instruction` オブジェクトを生成するイテレータとして振" +"舞うことが出来ます。このオブジェクトは、 :mod:`~dis.dis` にコンストラクタ引数" +"を渡して呼び出すのと等価な :mod:`~dis.Bytecode.dis` メソッドも持っています" +"が、マルチライン文字列で返します::" -#: ../../whatsnew/3.4.rst:748 msgid "" ">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" ">>> for instr in bytecode:\n" @@ -1428,26 +1507,38 @@ msgid "" " ' 6 BINARY_ADD',\n" " ' 7 RETURN_VALUE']" msgstr "" +">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" +">>> for instr in bytecode:\n" +"... print('{} ({})'.format(instr.opname, instr.opcode))\n" +"LOAD_FAST (124)\n" +"LOAD_CONST (100)\n" +"BINARY_ADD (23)\n" +"RETURN_VALUE (83)\n" +">>> bytecode.dis().splitlines()\n" +"[' 1 0 LOAD_FAST 0 (x)',\n" +" ' --> 3 LOAD_CONST 1 (1)',\n" +" ' 6 BINARY_ADD',\n" +" ' 7 RETURN_VALUE']" #: ../../whatsnew/3.4.rst:761 msgid "" -":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." -"from_traceback`, that provides the ability to manipulate a traceback (that " -"is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent to " -"``distb(tb)``)." +":class:`~dis.Bytecode` also has a class " +"method, :meth:`~dis.Bytecode.from_traceback`, that provides the ability to " +"manipulate a traceback (that is, " +"``print(Bytecode.from_traceback(tb).dis())`` is equivalent to ``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)`` とするのと同じです。)" +":class:`~dis.Bytecode` にはクラスメソッ" +"ド :meth:`~dis.Bytecode.from_traceback` もあります。トレースバックから " +"``Bytecode`` を構築します。(``print(Bytecode.from_traceback(tb).dis())`` は " +"``distb()`` を使って ``distb(tb)`` とするのと同じです。)" #: ../../whatsnew/3.4.rst:766 msgid "" -"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" -"`11816` and Claudiu Popa in :issue:`17916`.)" +"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver " +"in :issue:`11816` and Claudiu Popa in :issue:`17916`.)" msgstr "" -"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" -"`11816` and Claudiu Popa in :issue:`17916`.)" +"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver " +"in :issue:`11816` and Claudiu Popa in :issue:`17916`.)" #: ../../whatsnew/3.4.rst:769 msgid "" @@ -1466,12 +1557,15 @@ msgstr "" msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.4.rst:777 msgid "" "A new :ref:`option flag `, :const:`~doctest.FAIL_FAST`, " "halts test running as soon as the first failure is detected. (Contributed " "by R. David Murray and Daniel Urban in :issue:`16522`.)" msgstr "" +"新規 :ref:`オプションフラグ ` " +"の :const:`~doctest.FAIL_FAST` により、テスト実行を最初の失敗検出で終了させる" +"ことが出来ます。\n" +"(Contributed by R. David Murray and Daniel Urban in :issue:`16522`.)" #: ../../whatsnew/3.4.rst:781 msgid "" @@ -1479,16 +1573,15 @@ msgid "" "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " "` to be specified on the command line, and ``-f`` is a " "shorthand for ``-o FAIL_FAST`` (to parallel the similar option supported by " -"the :mod:`unittest` CLI). (Contributed by R. David Murray in :issue:" -"`11390`.)" +"the :mod:`unittest` CLI). (Contributed by R. David Murray " +"in :issue:`11390`.)" msgstr "" ":mod:`doctest` コマンドラインインターフェイスは :mod:`argparse` を使うように" "なりました。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,37 +1606,37 @@ 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 "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " "produces a string representation. It does not accept the *maxheaderlen* " -"argument, but does accept the *unixfrom* and *policy* arguments. The :class:" -"`~email.message.Message` :meth:`~email.message.Message.__bytes__` method " -"calls it, meaning that ``bytes(mymsg)`` will now produce the intuitive " -"result: a bytes object containing the fully formatted message. " +"argument, but does accept the *unixfrom* and *policy* arguments. " +"The :class:`~email.message.Message` :meth:`~email.message.Message.__bytes__` " +"method calls it, meaning that ``bytes(mymsg)`` will now produce the " +"intuitive result: a bytes object containing the fully formatted message. " "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" ":meth:`~email.message.Message.as_bytes` メソッドが追加されました。これは " "``as_string`` が文字列表現を生成するのと似たやり方で、メッセージの bytes 表現" "を生成します。これは *maxheaderlen* 引数を取りませんが、 *unixfrom* 引数と " -"*policy* 引数を取ります。 :class:`~email.message.Message` の :meth:`~email." -"message.Message.__bytes__` がこれを呼び出すようにしたので、 ``bytes(mymsg)`` " -"は今や直感に反しない結果、つまり完全にフォーマットされたメッセージを生成しま" -"す。(Contributed by R. David Murray in :issue:`18600`.)" +"*policy* 引数を取ります。 :class:`~email.message.Message` " +"の :meth:`~email.message.Message.__bytes__` がこれを呼び出すようにしたので、 " +"``bytes(mymsg)`` は今や直感に反しない結果、つまり完全にフォーマットされたメッ" +"セージを生成します。(Contributed by R. David Murray in :issue:`18600`.)" #: ../../whatsnew/3.4.rst:810 msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " "changing its location in the list of headers. For backward compatibility, " -"the default is ``False``. (Contributed by R. David Murray in :issue:" -"`18891`.)" +"the default is ``False``. (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" ":meth:`.Message.set_param` メソッドにキーワード引数 *replace* が追加されまし" "た。真を渡すとヘッダリスト内のその位置を変更せずに関連ヘッダを更新します。後" @@ -1559,17 +1652,18 @@ msgid "" "documentation is currently in the new module, which is being added as part " "of email's new :term:`provisional API`. These classes provide a number of " "new methods that make extracting content from and inserting content into " -"email messages much easier. For details, see the :mod:`~email." -"contentmanager` documentation and the :ref:`email-examples`. These API " -"additions complete the bulk of the work that was planned as part of the " -"email6 project. The currently provisional API is scheduled to become final " -"in Python 3.5 (possibly with a few minor additions in the area of error " -"handling). (Contributed by R. David Murray in :issue:`18891`.)" -msgstr "" -"サブモジュール :mod:`~email.contentmanager` と :mod:`~email.policy` 属性の :" -"attr:`~email.policy.EmailPolicy.content_manager` の追加と併せて、 :class:" -"`~email.message.Message` の対となる二つのサブクラス (:class:`.EmailMessage` " -"と :class:`.MIMEPart`) が追加されました。\n" +"email messages much easier. For details, see " +"the :mod:`~email.contentmanager` documentation and the :ref:`email-" +"examples`. These API additions complete the bulk of the work that was " +"planned as part of the email6 project. The currently provisional API is " +"scheduled to become final in Python 3.5 (possibly with a few minor additions " +"in the area of error handling). (Contributed by R. David Murray " +"in :issue:`18891`.)" +msgstr "" +"サブモジュール :mod:`~email.contentmanager` と :mod:`~email.policy` 属性" +"の :attr:`~email.policy.EmailPolicy.content_manager` の追加と併せ" +"て、 :class:`~email.message.Message` の対となる二つのサブクラス " +"(:class:`.EmailMessage` と :class:`.MIMEPart`) が追加されました。\n" "全てのドキュメントは、 email の新規 :term:`暫定 API ` の構成" "要素として追加されたこの新しいモジュールにあります。\n" "これらのクラスは、 email メッセージからの内容抽出や挿入を遥かに簡単に行える、" @@ -1595,19 +1689,22 @@ msgid "" "less time than the resolution of a particular filesystem's file modification " "time field. (Contributed by Mark Levitt in :issue:`18149`.)" msgstr "" -":func:`~filecmp.clear_cache` 関数が追加されました。 :mod:`filecmp` は :func:" -"`os.stat` 情報をキャッシュして最後の比較時点からのファイルの変化をみています" -"が、このキャッシュをクリアします。これはたとえば、ファイルシステムのタイムス" -"タンプフィールドの解像度未満の時間差で再比較したい場合に使えるでしょう。" -"(Contributed by Mark Levitt in :issue:`18149`.)" +":func:`~filecmp.clear_cache` 関数が追加されました。 :mod:`filecmp` " +"は :func:`os.stat` 情報をキャッシュして最後の比較時点からのファイルの変化をみ" +"ていますが、このキャッシュをクリアします。これはたとえば、ファイルシステムの" +"タイムスタンプフィールドの解像度未満の時間差で再比較したい場合に使えるでしょ" +"う。(Contributed by Mark Levitt in :issue:`18149`.)" -#: ../../whatsnew/3.4.rst:843 msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " -"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky in :" -"issue:`15442`.)" +"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky " +"in :issue:`15442`.)" msgstr "" +"新しいモジュール属性 :const:`~filecmp.DEFAULT_IGNORES` " +"は、:func:`~filecmp.dircmp` 関数の *ignore* パラメータのデフォルト値として使" +"われるディレクトリのリストを提供します。\n" +"(Contributed by Eli Bendersky in :issue:`15442`.)" #: ../../whatsnew/3.4.rst:850 msgid "functools" @@ -1658,9 +1755,9 @@ msgstr "PEP written and implemented by Łukasz Langa." #: ../../whatsnew/3.4.rst:873 msgid "" -":func:`~functools.total_ordering` now supports a return value of :data:" -"`NotImplemented` from the underlying comparison function. (Contributed by " -"Katie Miller in :issue:`10042`.)" +":func:`~functools.total_ordering` now supports a return value " +"of :data:`NotImplemented` from the underlying comparison function. " +"(Contributed by Katie Miller in :issue:`10042`.)" msgstr "" #: ../../whatsnew/3.4.rst:877 @@ -1720,18 +1817,18 @@ msgstr "" #: ../../whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " -"now a formally supported interface. It has always existed in CPython's :mod:" -"`hashlib` (although it did not return lower case names for all supported " -"hashes), but it was not a public interface and so some other Python " -"implementations have not previously supported it. (Contributed by Jason R. " -"Coombs in :issue:`18532`.)" +"now a formally supported interface. It has always existed in " +"CPython's :mod:`hashlib` (although it did not return lower case names for " +"all supported hashes), but it was not a public interface and so some other " +"Python implementations have not previously supported it. (Contributed by " +"Jason R. Coombs in :issue:`18532`.)" msgstr "" ":mod:`hashlib` のハッシュオブジェクトの :attr:`~hashlib.hash.name` 属性が、公" -"式にサポートされるインターフェイスになりました。これは CPython の :mod:" -"`hashlib` には以前から存在していました (ただしサポートされるハッシュの名前を" -"必ずしも小文字で返してはいませんでした) が、公開インターフェイスとしていな" -"かったために、ほかのいくつかの Python 実装では以前はサポートされていませんで" -"した。(Contributed by Jason R. Coombs in :issue:`18532`.)" +"式にサポートされるインターフェイスになりました。これは CPython " +"の :mod:`hashlib` には以前から存在していました (ただしサポートされるハッシュ" +"の名前を必ずしも小文字で返してはいませんでした) が、公開インターフェイスとし" +"ていなかったために、ほかのいくつかの Python 実装では以前はサポートされていま" +"せんでした。(Contributed by Jason R. Coombs in :issue:`18532`.)" #: ../../whatsnew/3.4.rst:916 msgid "hmac" @@ -1746,10 +1843,10 @@ msgid "" "Jonas Borgström in :issue:`18240`.)" msgstr "" ":mod:`hmac` は、 :func:`~hmac.new` の *key* 引数として ``bytearray`` と " -"``bytes`` を許容するようになり、また、 :func:`~hmac.new` 関数と :meth:`~hmac." -"HMAC.update` メソッドの両方への *msg* パラメータとして、 :mod:`hashlib` モ" -"ジュールがサポートする任意の型を許容するようになりました。(Contributed by " -"Jonas Borgström in :issue:`18240`.)" +"``bytes`` を許容するようになり、また、 :func:`~hmac.new` 関数" +"と :meth:`~hmac.HMAC.update` メソッドの両方への *msg* パラメータとし" +"て、 :mod:`hashlib` モジュールがサポートする任意の型を許容するようになりまし" +"た。(Contributed by Jonas Borgström in :issue:`18240`.)" #: ../../whatsnew/3.4.rst:924 msgid "" @@ -1767,15 +1864,16 @@ msgstr "" #: ../../whatsnew/3.4.rst:930 msgid "" -"With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." -"name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." -"digest_size` attribute), the :mod:`hmac` module now conforms fully to the :" -"pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" +"With the addition of :attr:`~hmac.HMAC.block_size` " +"and :attr:`~hmac.HMAC.name` attributes (and the formal documentation of " +"the :attr:`~hmac.HMAC.digest_size` attribute), the :mod:`hmac` module now " +"conforms fully to the :pep:`247` API. (Contributed by Christian Heimes " +"in :issue:`18775`.)" msgstr "" -":attr:`~hmac.HMAC.block_size` 属性と :attr:`~hmac.HMAC.name` 属性 (と :attr:" -"`~hmac.HMAC.digest_size` 属性の公式ドキュメント) の追加をもって、 :mod:" -"`hmac` モジュールは完全に :pep:`247` API を遵守するものとなりました。 " -"(Contributed by Christian Heimes in :issue:`18775`.)" +":attr:`~hmac.HMAC.block_size` 属性と :attr:`~hmac.HMAC.name` 属性 " +"(と :attr:`~hmac.HMAC.digest_size` 属性の公式ドキュメント) の追加をもっ" +"て、 :mod:`hmac` モジュールは完全に :pep:`247` API を遵守するものとなりまし" +"た。 (Contributed by Christian Heimes in :issue:`18775`.)" #: ../../whatsnew/3.4.rst:937 msgid "html" @@ -1823,9 +1921,9 @@ msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " "extended error description, overriding the hardcoded default if there is " -"one. This extended error description will be formatted using the :attr:" -"`~http.server.HTTP.error_message_format` attribute and sent as the body of " -"the error response. (Contributed by Karl Cow in :issue:`12921`.)" +"one. This extended error description will be formatted using " +"the :attr:`~http.server.HTTP.error_message_format` attribute and sent as the " +"body of the error response. (Contributed by Karl Cow in :issue:`12921`.)" msgstr "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` がオプショナルなパラ" "メータ *explain* を受け付けるようになりました。指定されると、拡張のエラー説明" @@ -1842,10 +1940,10 @@ msgid "" msgstr "" ":mod:`http.server` の :ref:`コマンドラインインターフェイス ` に ``-b/--bind`` オプションが追加されました。これは特定のアドレスで " -"listen することを指示します。 (Contributed by Malte Swart in :issue:" -"`17764`.) (---訳注: ネットワークプログラミングに詳しい人ほど混乱しそうなので" -"一応。 ``--bind`` というオプション名が示すとおり、より正確に表現するなら" -"「ユーザ指定のネットワークインターフェイスに bind」。コミットログの表現" +"listen することを指示します。 (Contributed by Malte Swart " +"in :issue:`17764`.) (---訳注: ネットワークプログラミングに詳しい人ほど混乱し" +"そうなので一応。 ``--bind`` というオプション名が示すとおり、より正確に表現す" +"るなら「ユーザ指定のネットワークインターフェイスに bind」。コミットログの表現" "「Expose --bind argument for http.server, enable http.server to bind to a " "user specified network interface.」の方がわかりやすいかと。 ---)" @@ -1856,10 +1954,10 @@ msgstr "idlelib と IDLE" #: ../../whatsnew/3.4.rst:972 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :file:" -"`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.3.0, as well " -"as changes made in future 3.4.x releases. This file is also available from " -"the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.3.0, as well as changes made in future 3.4.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" "idlelib は IDLE シェルとエディタを実装するものであってほかのプログラムからイ" "ンポートされることを意図してはいないので、改善は毎度のリリースごとに行われま" @@ -1873,17 +1971,18 @@ msgstr "importlib" #: ../../whatsnew/3.4.rst:982 msgid "" -"The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" -"`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " -"path and returns a code object. The default implementation is equivalent to " -"``compile(data, path, 'exec', dont_inherit=True)``. (Contributed by Eric " -"Snow and Brett Cannon in :issue:`15627`.)" +"The :class:`~importlib.abc.InspectLoader` ABC defines a new " +"method, :meth:`~importlib.abc.InspectLoader.source_to_code` that accepts " +"source data and a path and returns a code object. The default " +"implementation is equivalent to ``compile(data, path, 'exec', " +"dont_inherit=True)``. (Contributed by Eric Snow and Brett Cannon " +"in :issue:`15627`.)" msgstr "" -":class:`~importlib.abc.InspectLoader` ABC に新規メソッド :meth:`~importlib." -"abc.InspectLoader.source_to_code` が追加されました。ソースデータとパスを受け" -"取り、コードオブジェクトを返します。これのデフォルト実装は ``compile(data, " -"path, 'exec', dont_inherit=True)`` と同じです。 (Contributed by Eric Snow " -"and Brett Cannon in :issue:`15627`.)" +":class:`~importlib.abc.InspectLoader` ABC に新規メソッ" +"ド :meth:`~importlib.abc.InspectLoader.source_to_code` が追加されました。ソー" +"スデータとパスを受け取り、コードオブジェクトを返します。これのデフォルト実装" +"は ``compile(data, path, 'exec', dont_inherit=True)`` と同じです。 " +"(Contributed by Eric Snow and Brett Cannon in :issue:`15627`.)" #: ../../whatsnew/3.4.rst:988 msgid "" @@ -1892,69 +1991,78 @@ msgid "" "will normally be desirable to override the default implementation for " "performance reasons. (Contributed by Brett Cannon in :issue:`18072`.)" msgstr "" -":class:`~importlib.abc.InspectLoader` では :meth:`~importlib.abc." -"InspectLoader.get_code` メソッドへのデフォルト実装追加も行われました。とはい" -"え性能面の理由より、通常はデフォルト実装をオーバライドすることが望ましいで" -"す。 (Contributed by Brett Cannon in :issue:`18072`.)" +":class:`~importlib.abc.InspectLoader` で" +"は :meth:`~importlib.abc.InspectLoader.get_code` メソッドへのデフォルト実装追" +"加も行われました。とはいえ性能面の理由より、通常はデフォルト実装をオーバライ" +"ドすることが望ましいです。 (Contributed by Brett Cannon in :issue:`18072`.)" -#: ../../whatsnew/3.4.rst:993 msgid "" -"The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" -"mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " -"by Berker Peksag in :issue:`18193`.)" +"The :func:`~importlib.reload` function has been moved from :mod:`!imp` " +"to :mod:`importlib` as part of the :mod:`!imp` module deprecation. " +"(Contributed by Berker Peksag in :issue:`18193`.)" msgstr "" +":mod:`!imp` モジュール撤廃に向けて、 :mod:`!imp` にあった reload " +"が :mod:`importlib` :func:`~importlib.reload` 関数に移動しました。\n" +"(Contributed by Berker Peksag in :issue:`18193`.)" -#: ../../whatsnew/3.4.rst:997 msgid "" ":mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` " "attribute providing access to the bytecode version number. This replaces " "the :func:`!get_magic` function in the deprecated :mod:`!imp` module. " "(Contributed by Brett Cannon in :issue:`18192`.)" msgstr "" +":mod:`importlib.util` にバイトコードのバージョン番号を取得す" +"る :const:`~importlib.util.MAGIC_NUMBER` 属性が追加されました。\n" +"これは非推奨の :mod:`!imp` モジュールの :func:`!get_magic` 関数を置き換えるも" +"のです。\n" +"(Contributed by Brett Cannon in :issue:`18192`.)" -#: ../../whatsnew/3.4.rst:1002 msgid "" -"New :mod:`importlib.util` functions :func:`~importlib.util." -"cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " -"same-named functions in the deprecated :mod:`!imp` module. (Contributed by " -"Brett Cannon in :issue:`18194`.)" +"New :mod:`importlib.util` " +"functions :func:`~importlib.util.cache_from_source` " +"and :func:`~importlib.util.source_from_cache` replace the same-named " +"functions in the deprecated :mod:`!imp` module. (Contributed by Brett " +"Cannon in :issue:`18194`.)" msgstr "" +"撤廃されるモジュール :mod:`!imp` での同名関数を置き換える新規関数とし" +"て、 :mod:`importlib.util` 関数の :func:`~importlib.util.cache_from_source` " +"と :func:`~importlib.util.source_from_cache` が追加されました。\n" +"(Contributed by Brett Cannon in :issue:`18194`.)" -#: ../../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 -" -"m`` can now be used with namespace packages. (Contributed by Brett Cannon " +"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python " +"-m`` can now be used with namespace packages. (Contributed by Brett Cannon " "in :issue:`18058`.)" msgstr "" -":mod:`importlib` ブートストラップ :class:`.NamespaceLoader` が :class:`." -"InspectLoader` ABC に従うようになりました。つまりこれにより ``runpy`` と " -"``python -m`` が名前空間パッケージに対して使えるようになりました。" -"(Contributed by Brett Cannon in :issue:`18058`.) (訳注: 3.3 以降の名前空間" -"パッケージについては What's New In Python 3.3 (:pep:`420`) 参照。) " +":mod:`importlib` ブートストラップ :class:`.NamespaceLoader` " +"が :class:`.InspectLoader` ABC に従うようになりました。つまりこれにより " +"``runpy`` と ``python -m`` が名前空間パッケージに対して使えるようになりまし" +"た。(Contributed by Brett Cannon in :issue:`18058`.) (訳注: 3.3 以降の名前空" +"間パッケージについては What's New In Python 3.3 (:pep:`420`) 参照。)" #: ../../whatsnew/3.4.rst:1012 msgid "" -":mod:`importlib.util` has a new function :func:`~importlib.util." -"decode_source` that decodes source from bytes using universal newline " -"processing. This is useful for implementing :meth:`.InspectLoader." -"get_source` methods." +":mod:`importlib.util` has a new " +"function :func:`~importlib.util.decode_source` that decodes source from " +"bytes using universal newline processing. This is useful for " +"implementing :meth:`.InspectLoader.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 "" -":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." -"machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " -"omitted in the original implementation. (Contributed by Eric Snow in :issue:" -"`19152`.)" +":class:`importlib.machinery.ExtensionFileLoader` now has " +"a :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. " +"This was inadvertently omitted in the original implementation. (Contributed " +"by Eric Snow in :issue:`19152`.)" msgstr "" -":class:`importlib.machinery.ExtensionFileLoader` に :meth:`~importlib." -"machinery.ExtensionFileLoader.get_filename` メソッドが追加されました。これは" -"本来実装されるべきものでしたが見落とされていました。(Contributed by Eric " -"Snow in :issue:`19152`.)" +":class:`importlib.machinery.ExtensionFileLoader` " +"に :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` メソッドが追" +"加されました。これは本来実装されるべきものでしたが見落とされていました。" +"(Contributed by Eric Snow in :issue:`19152`.)" #: ../../whatsnew/3.4.rst:1023 msgid "inspect" @@ -1988,10 +2096,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:1035 msgid "" -"As part of the implementation of the new :mod:`enum` module, the :mod:" -"`inspect` module now has substantially better support for custom ``__dir__`` " -"methods and dynamic class attributes provided through metaclasses. " -"(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" +"As part of the implementation of the new :mod:`enum` module, " +"the :mod:`inspect` module now has substantially better support for custom " +"``__dir__`` methods and dynamic class attributes provided through " +"metaclasses. (Contributed by Ethan Furman in :issue:`18929` " +"and :issue:`19030`.)" msgstr "" "新規 :mod:`enum` モジュールが実装されたことを受け :mod:`inspect` モジュール" "は、カスタム ``__dir__`` メソッドに対する、またメタクラスを介して提供される動" @@ -2000,29 +2109,30 @@ msgstr "" #: ../../whatsnew/3.4.rst:1041 msgid "" -":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" -"func:`~inspect.signature` API. This allows them to support a much broader " -"range of callables, including those with ``__signature__`` attributes, those " -"with metadata provided by argument clinic, :func:`functools.partial` objects " -"and more. Note that, unlike :func:`~inspect.signature`, these functions " -"still ignore ``__wrapped__`` attributes, and report the already bound first " -"argument for bound methods, so it is still necessary to update your code to " +":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use " +"the :func:`~inspect.signature` API. This allows them to support a much " +"broader range of callables, including those with ``__signature__`` " +"attributes, those with metadata provided by argument " +"clinic, :func:`functools.partial` objects and more. Note that, " +"unlike :func:`~inspect.signature`, these functions still ignore " +"``__wrapped__`` attributes, and report the already bound first argument for " +"bound methods, so it is still necessary to update your code to " "use :func:`~inspect.signature` directly if those features are desired. " "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" -":func:`~inspect.getfullargspec` と :func:`~inspect.getargspec` が :func:" -"`~inspect.signature` API を使うようになりました。このことで、以前より遥かに幅" -"広い callable をサポートするようになっています。それには ``__signature__`` 属" -"性を含むもの、 Argument Clinic で提供されるメタデータを含むもの、あるいは :" -"func:`functools.partial` オブジェクト、なども含まれます。 :func:`~inspect." -"signature` そのものとは違い、今でも :func:`~inspect.getfullargspec`, :func:" -"`~inspect.getargspec` は ``__wrapped__`` 属性を無視し、そして束縛されたメソッ" -"ドで最初に束縛された引数を報告するので、それが望みでないならば :func:" -"`~inspect.signature` を直接使うようにあなたのコードを更新する必要があります。" -"(Contributed by Yury Selivanov in :issue:`17481`.) (---訳注: What's New In " -"Python 3.5 を参照してください。 :func:`~inspect.signature` により :func:" -"`~inspect.getfullargspec` と :func:`~inspect.getargspec` は結果として非推奨と" -"なりました。---)" +":func:`~inspect.getfullargspec` と :func:`~inspect.getargspec` " +"が :func:`~inspect.signature` API を使うようになりました。このことで、以前よ" +"り遥かに幅広い callable をサポートするようになっています。それには " +"``__signature__`` 属性を含むもの、 Argument Clinic で提供されるメタデータを含" +"むもの、あるいは :func:`functools.partial` オブジェクト、なども含まれま" +"す。 :func:`~inspect.signature` そのものとは違い、今で" +"も :func:`~inspect.getfullargspec`, :func:`~inspect.getargspec` は " +"``__wrapped__`` 属性を無視し、そして束縛されたメソッドで最初に束縛された引数" +"を報告するので、それが望みでないならば :func:`~inspect.signature` を直接使う" +"ようにあなたのコードを更新する必要があります。(Contributed by Yury Selivanov " +"in :issue:`17481`.) (---訳注: What's New In Python 3.5 を参照してくださ" +"い。 :func:`~inspect.signature` により :func:`~inspect.getfullargspec` " +"と :func:`~inspect.getargspec` は結果として非推奨となりました。---)" #: ../../whatsnew/3.4.rst:1052 msgid "" @@ -2034,8 +2144,8 @@ msgstr "" "なりました。これは Cython でコンパイルされた関数をサポートすることになりま" "す。 (Contributed by Stefan Behnel and Yury Selivanov in :issue:`17159`.) " "(---訳注: duck type はここでは「 ``types.FunctionType`` であることを要求しな" -"い」の意味。 `_signature_is_functionlike `_ 参照。 ---)" +"い」の意味。 `_signature_is_functionlike `_ 参照。 ---)" #: ../../whatsnew/3.4.rst:1058 msgid "ipaddress" @@ -2043,10 +2153,11 @@ msgstr "ipaddress" #: ../../whatsnew/3.4.rst:1060 msgid "" -":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" -"`provisional API`. With the release of Python 3.4, this qualification has " -"been removed: :mod:`ipaddress` is now considered a stable API, covered by " -"the normal standard library requirements to maintain backwards compatibility." +":mod:`ipaddress` was added to the standard library in Python 3.3 as " +"a :term:`provisional API`. With the release of Python 3.4, this " +"qualification has been removed: :mod:`ipaddress` is now considered a stable " +"API, covered by the normal standard library requirements to maintain " +"backwards compatibility." msgstr "" ":mod:`ipaddress` は Python 3.3 で標準ライブラリに :term:`暫定 API " "` として追加されました。Python 3.4 リリースで、この但し書き" @@ -2056,13 +2167,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:1066 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " -"address is globally routeable. (Contributed by Peter Moody in :issue:" -"`17400`.)" +"address is globally routeable. (Contributed by Peter Moody " +"in :issue:`17400`.)" msgstr "" "新規のプロパティ :attr:`~ipaddress.IPv4Address.is_global` は、アドレスが " -"routeable である場合に ``True`` を返します。 (Contributed by Peter Moody in :" -"issue:`17400`.) (---訳注: リファレンスマニュアルでは routeable という表現では" -"なく「アドレスがパブリックネットワークに割り当てられている場合」。---)" +"routeable である場合に ``True`` を返します。 (Contributed by Peter Moody " +"in :issue:`17400`.) (---訳注: リファレンスマニュアルでは routeable という表現" +"ではなく「アドレスがパブリックネットワークに割り当てられている場合」。---)" #: ../../whatsnew/3.4.rst:1072 msgid "logging" @@ -2080,37 +2191,40 @@ msgstr "" #: ../../whatsnew/3.4.rst:1078 msgid "" -":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." -"DatagramHandler` now support Unix domain sockets (by setting *port* to " -"``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" +":class:`~logging.handlers.SocketHandler` " +"and :class:`~logging.handlers.DatagramHandler` now support Unix domain " +"sockets (by setting *port* to ``None``). (Contributed by Vinay Sajip in " +"commit ce46195b56a9.)" msgstr "" -":class:`~logging.handlers.SocketHandler` と :class:`~logging.handlers." -"DatagramHandler` が Unix ドメインソケットをサポートするようになりました " -"(*port* に ``None`` をセットすることで)。 (Contributed by Vinay Sajip in " -"commit `ce46195b56a9 `_ .)" +":class:`~logging.handlers.SocketHandler` " +"と :class:`~logging.handlers.DatagramHandler` が Unix ドメインソケットをサ" +"ポートするようになりました (*port* に ``None`` をセットすることで)。 " +"(Contributed by Vinay Sajip in commit `ce46195b56a9 `_ .)" #: ../../whatsnew/3.4.rst:1083 msgid "" -":func:`~logging.config.fileConfig` now accepts a :class:`configparser." -"RawConfigParser` subclass instance for the *fname* parameter. This " -"facilitates using a configuration file when logging configuration is just a " -"part of the overall application configuration, or where the application " -"modifies the configuration before passing it to :func:`~logging.config." -"fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" -msgstr "" -":func:`~logging.config.fileConfig` が *fname* パラメータとして :class:" -"`configparser.RawConfigParser` のサブクラスを許容するようになりました。これは" -"ロギングの設定がアプリケーション全体の設定の一部に過ぎない場合や、 :func:" -"`~logging.config.fileConfig` に渡す前にアプリケーションが設定を修正するような" -"場合でも設定ファイルを使用することを容易にします。(Contributed by Vinay " -"Sajip in :issue:`16110`.)" +":func:`~logging.config.fileConfig` now accepts " +"a :class:`configparser.RawConfigParser` subclass instance for the *fname* " +"parameter. This facilitates using a configuration file when logging " +"configuration is just a part of the overall application configuration, or " +"where the application modifies the configuration before passing it " +"to :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip " +"in :issue:`16110`.)" +msgstr "" +":func:`~logging.config.fileConfig` が *fname* パラメータとし" +"て :class:`configparser.RawConfigParser` のサブクラスを許容するようになりまし" +"た。これはロギングの設定がアプリケーション全体の設定の一部に過ぎない場合" +"や、 :func:`~logging.config.fileConfig` に渡す前にアプリケーションが設定を修" +"正するような場合でも設定ファイルを使用することを容易にします。(Contributed " +"by Vinay Sajip in :issue:`16110`.)" #: ../../whatsnew/3.4.rst:1091 msgid "" -"Logging configuration data received from a socket via the :func:`logging." -"config.listen` function can now be validated before being processed by " -"supplying a verification function as the argument to the new *verify* " -"keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" +"Logging configuration data received from a socket via " +"the :func:`logging.config.listen` function can now be validated before being " +"processed by supplying a verification function as the argument to the new " +"*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" ":func:`logging.config.listen` 関数経由でソケットから受信したロギング設定デー" "タを、処理前に検証出来るようになりました。新規のキーワード引数 *verify* に検" @@ -2126,11 +2240,11 @@ msgid "" "implementing the new version restores the Python2 behavior of recording only " "one copy of interned strings and preserving the interning on " "deserialization, and extends this \"one copy\" ability to any object type " -"(including handling recursive references). This reduces both the size of ``." -"pyc`` files and the amount of memory a module occupies in memory when it is " -"loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján Valur " -"Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou in :" -"issue:`19219`.)" +"(including handling recursive references). This reduces both the size of " +"``.pyc`` files and the amount of memory a module occupies in memory when it " +"is loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján " +"Valur Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou " +"in :issue:`19219`.)" msgstr "" ":mod:`marshal` のバージョンが 3 に上げられました。新バージョンを実装している" "コードは、intern された文字列をただ一つのコピーだけ記録しておきデシリアライズ" @@ -2145,11 +2259,12 @@ msgstr "" msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.4.rst:1115 msgid "" "mmap objects are now :ref:`weakly referenceable `. (Contributed " "by Valerie Lambert in :issue:`4885`.)" msgstr "" +"mmap オブジェクトが :ref:`弱参照可能 ` になりました。\n" +"(Contributed by Valerie Lambert in :issue:`4885`.)" #: ../../whatsnew/3.4.rst:1120 msgid "multiprocessing" @@ -2158,12 +2273,13 @@ msgstr "multiprocessing" #: ../../whatsnew/3.4.rst:1124 msgid "" "On Unix two new :ref:`start methods `, " -"``spawn`` and ``forkserver``, have been added for starting processes using :" -"mod:`multiprocessing`. These make the mixing of processes with threads more " -"robust, and the ``spawn`` method matches the semantics that multiprocessing " -"has always used on Windows. New function :func:`~multiprocessing." -"get_all_start_methods` reports all start methods available on the platform, :" -"func:`~multiprocessing.get_start_method` reports the current start method, " +"``spawn`` and ``forkserver``, have been added for starting processes " +"using :mod:`multiprocessing`. These make the mixing of processes with " +"threads more robust, and the ``spawn`` method matches the semantics that " +"multiprocessing has always used on Windows. New " +"function :func:`~multiprocessing.get_all_start_methods` reports all start " +"methods available on the platform, :func:`~multiprocessing.get_start_method` " +"reports the current start method, " "and :func:`~multiprocessing.set_start_method` sets the start method. " "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" @@ -2171,39 +2287,41 @@ msgstr "" "` として、Unix において 2 つ、 ``spawn`` と " "``forkserver`` が追加されました。これらはスレッドとプロセスのミックスをより堅" "牢にし、また、 ``spawn`` は multiprocessing が以前から常に Windows で使ってき" -"たセマンティクスと一致します。新規関数の、 :func:`~multiprocessing." -"get_all_start_methods` はプラットフォームで利用出来るすべての開始方式を報告" -"し、 :func:`~multiprocessing.get_start_method` は現在設定されている開始方式を" -"報告し、 :func:`~multiprocessing.set_start_method` は開始方式を設定します。" +"たセマンティクスと一致します。新規関数" +"の、 :func:`~multiprocessing.get_all_start_methods` はプラットフォームで利用" +"出来るすべての開始方式を報告し、 :func:`~multiprocessing.get_start_method` は" +"現在設定されている開始方式を報告" +"し、 :func:`~multiprocessing.set_start_method` は開始方式を設定します。" "(Contributed by Richard Oudkerk in :issue:`8713`.)" #: ../../whatsnew/3.4.rst:1134 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " -"determines how child processes are created. New function :func:" -"`~multiprocessing.get_context` returns a context that uses a specified start " -"method. It has the same API as the :mod:`multiprocessing` module itself, so " -"you can use it to create :class:`~multiprocessing.pool.Pool`\\ s and other " -"objects that will operate within that context. This allows a framework and " -"an application or different parts of the same application to use " -"multiprocessing without interfering with each other. (Contributed by " -"Richard Oudkerk in :issue:`18999`.)" +"determines how child processes are created. New " +"function :func:`~multiprocessing.get_context` returns a context that uses a " +"specified start method. It has the same API as the :mod:`multiprocessing` " +"module itself, so you can use it to " +"create :class:`~multiprocessing.pool.Pool`\\ s and other objects that will " +"operate within that context. This allows a framework and an application or " +"different parts of the same application to use multiprocessing without " +"interfering with each other. (Contributed by Richard Oudkerk " +"in :issue:`18999`.)" msgstr "" ":mod:`multiprocessing` には、子プロセスがどのように作られるかを決定する " -"``context`` のコンセプトが追加されています。新規関数 :func:`~multiprocessing." -"get_context` は指定した開始方式を使うコンテキストを返します。コンテキストは :" -"mod:`multiprocessing` モジュール自身と同じ API を持っているので、コンテキスト" -"内で操作する :class:`~multiprocessing.pool.Pool` や他のオブジェクトを、それを" -"使って作成することが出来ます。コンテキストによって、フレームワークとアプリ" -"ケーションあるいは同じアプリケーションの別の部分が相互に干渉しあわないように" -"して multiprocessing を使うことが出来ます。(Contributed by Richard Oudkerk " -"in :issue:`18999`.)" +"``context`` のコンセプトが追加されています。新規関" +"数 :func:`~multiprocessing.get_context` は指定した開始方式を使うコンテキスト" +"を返します。コンテキストは :mod:`multiprocessing` モジュール自身と同じ API を" +"持っているので、コンテキスト内で操作する :class:`~multiprocessing.pool.Pool` " +"や他のオブジェクトを、それを使って作成することが出来ます。コンテキストによっ" +"て、フレームワークとアプリケーションあるいは同じアプリケーションの別の部分が" +"相互に干渉しあわないようにして multiprocessing を使うことが出来ます。" +"(Contributed by Richard Oudkerk in :issue:`18999`.)" #: ../../whatsnew/3.4.rst:1144 msgid "" "Except when using the old *fork* start method, child processes no longer " -"inherit unneeded handles/file descriptors from their parents (part of :issue:" -"`8713`)." +"inherit unneeded handles/file descriptors from their parents (part " +"of :issue:`8713`)." msgstr "" "昔からの *fork* 開始方式を除き、子プロセスはもはや必要のないハンドル・ファイ" "ル記述子をその親から継承しません。 (part of :issue:`8713`)." @@ -2235,10 +2353,10 @@ msgid "" "should be used, as part of the :pep:`424` formal specification of this " "language feature. (Contributed by Armin Ronacher in :issue:`16148`.)" msgstr "" -"新規関数 :func:`~operator.length_hint` は、言語仕様となった特殊メソッド :" -"meth:`~object.__length_hint__` の :pep:`424` 公式仕様の一環として、それがどの" -"ように使われるのかについて詳述する実装を提供します。(Contributed by Armin " -"Ronacher in :issue:`16148`.)" +"新規関数 :func:`~operator.length_hint` は、言語仕様となった特殊メソッ" +"ド :meth:`~object.__length_hint__` の :pep:`424` 公式仕様の一環として、それが" +"どのように使われるのかについて詳述する実装を提供します。(Contributed by " +"Armin Ronacher in :issue:`16148`.)" #: ../../whatsnew/3.4.rst:1164 msgid "" @@ -2246,9 +2364,9 @@ msgid "" "for reference and for use by alternate implementations of Python. " "(Contributed by Zachary Ware in :issue:`16694`.)" msgstr "" -"参照実装として、また Python 実装の代替として用いることが出来る、 :mod:" -"`operator` モジュールのピュア Python 版が書かれました。 (Contributed by " -"Zachary Ware in :issue:`16694`.)" +"参照実装として、また Python 実装の代替として用いることが出来" +"る、 :mod:`operator` モジュールのピュア Python 版が書かれました。 " +"(Contributed by Zachary Ware in :issue:`16694`.)" #: ../../whatsnew/3.4.rst:1170 msgid "os" @@ -2257,14 +2375,16 @@ msgstr "os" #: ../../whatsnew/3.4.rst:1172 msgid "" "There are new functions to get and set the :ref:`inheritable flag " -"` of a file descriptor (:func:`os.get_inheritable`, :func:" -"`os.set_inheritable`) or a Windows handle (:func:`os." -"get_handle_inheritable`, :func:`os.set_handle_inheritable`)." +"` of a file descriptor " +"(:func:`os.get_inheritable`, :func:`os.set_inheritable`) or a Windows handle " +"(:func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" "新規関数により :ref:`継承可能フラグ ` を制御出来るようになり" -"ました。ファイル記述子には :func:`os.get_inheritable`, :func:`os." -"set_inheritable` を、Windows のハンドルには :func:`os." -"get_handle_inheritable`, :func:`os.set_handle_inheritable` を使います。" +"ました。ファイル記述子に" +"は :func:`os.get_inheritable`, :func:`os.set_inheritable` を、Windows のハン" +"ドルに" +"は :func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable` を使" +"います。" #: ../../whatsnew/3.4.rst:1177 msgid "" @@ -2272,8 +2392,8 @@ msgid "" "the platform on which Python is running (or ``None`` if the count can't be " "determined). The :func:`multiprocessing.cpu_count` function is now " "implemented in terms of this function). (Contributed by Trent Nelson, " -"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali in :issue:" -"`17914`.)" +"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali " +"in :issue:`17914`.)" msgstr "" "関数 :func:`~os.cpu_count` が追加されました。これは Python を実行しているプ" "ラットフォームで利用可能な CPU 数を返します (決定できない場合は ``None`` を返" @@ -2283,8 +2403,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:1183 msgid "" -":func:`os.path.samestat` is now available on the Windows platform (and the :" -"func:`os.path.samefile` implementation is now shared between Unix and " +":func:`os.path.samestat` is now available on the Windows platform (and " +"the :func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" ":func:`os.path.samestat` が Windows プラットフォームでも動作するようになりま" @@ -2297,18 +2417,24 @@ msgid "" "Windows. (Contributed by Tim Golden in :issue:`9035`.)" msgstr "" ":func:`os.path.ismount` が Windows において、ドライブルートよりも下にあるマウ" -"ントポイントを認識するようになりました。 (Contributed by Tim Golden in :" -"issue:`9035`.)" - -#: ../../whatsnew/3.4.rst:1190 -msgid "" -":func:`os.open` supports two new flags on platforms that provide them, :" -"const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " -"(unnamed temporary file; as of 3.4.0 release available only on Linux systems " -"with a kernel version of 3.11 or newer that have uapi headers). " +"ントポイントを認識するようになりました。 (Contributed by Tim Golden " +"in :issue:`9035`.)" + +msgid "" +":func:`os.open` supports two new flags on platforms that provide " +"them, :const:`~os.O_PATH` (un-opened file descriptor), " +"and :const:`~os.O_TMPFILE` (unnamed temporary file; as of 3.4.0 release " +"available only on Linux systems with a kernel version of 3.11 or newer that " +"have uapi headers). (Contributed by Christian Heimes in :issue:`18673` and " +"Benjamin Peterson, respectively.)" +msgstr "" +":func:`os.open` が新たな 2 つのフラグを、それを提供しているプラットフォームで" +"サポートするようになりました。\n" +":const:`~os.O_PATH` (未オープンファイル記述子)、 :const:`~os.O_TMPFILE` (名前" +"なし一時ファイル; Python 3.4.0 リリース時点では、 uapi ヘッダを持っているカー" +"ネルバージョン 3.11 以降の Linux システムでのみ利用可能) です。\n" "(Contributed by Christian Heimes in :issue:`18673` and Benjamin Peterson, " "respectively.)" -msgstr "" #: ../../whatsnew/3.4.rst:1198 msgid "pdb" @@ -2357,9 +2483,9 @@ msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " "were present in previous protocols, such as the serialization of nested " -"classes, very large strings and containers, and classes whose :meth:" -"`__new__` method takes keyword-only arguments. It also provides some " -"efficiency improvements." +"classes, very large strings and containers, and classes " +"whose :meth:`__new__` method takes keyword-only arguments. It also provides " +"some efficiency improvements." msgstr "" ":mod:`pickle` で新 pickle プロトコル 4 が追加されました (デフォルトにはされて" "いません)。この新プロトコルは、入れ子のクラスや巨大な文字列・コンテナやキー" @@ -2379,16 +2505,25 @@ msgstr "PEP written by Antoine Pitrou and implemented by Alexandre Vassalotti." msgid "plistlib" msgstr "plistlib" -#: ../../whatsnew/3.4.rst:1236 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " -"stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps` " -"functions. (The older API is now deprecated.) In addition to the already " -"supported XML plist format (:const:`~plistlib.FMT_XML`), it also now " -"supports the binary plist format (:const:`~plistlib.FMT_BINARY`). " +"stdlib serialization protocols, with " +"new :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps` functions. (The older API is now deprecated.) " +"In addition to the already supported XML plist format " +"(:const:`~plistlib.FMT_XML`), it also now supports the binary plist format " +"(:const:`~plistlib.FMT_BINARY`). (Contributed by Ronald Oussoren and others " +"in :issue:`14455`.)" +msgstr "" +":mod:`plistlib` が、ほかのシリアライズ化プロトコルを扱う標準ライブラリでのお" +"決まりのパターンに従った新 API を追加しました。\n" +":func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, :func:`~plistlib.dumps` " +"です。\n" +"(なので旧 API は非推奨です。\n" +") また、既にサポートされている XML plist フォーマット " +"(:const:`~plistlib.FMT_XML`) に加えてバイナリ plist フォーマット" +"(:const:`~plistlib.FMT_BINARY`) のサポートも追加されました。\n" "(Contributed by Ronald Oussoren and others in :issue:`14455`.)" -msgstr "" #: ../../whatsnew/3.4.rst:1246 msgid "poplib" @@ -2397,16 +2532,16 @@ msgstr "poplib" #: ../../whatsnew/3.4.rst:1248 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " -"which returns the list of capabilities advertised by the POP server, and :" -"meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an " -"encrypted POP3 session if the POP server supports it. (Contributed by " +"which returns the list of capabilities advertised by the POP server, " +"and :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into " +"an encrypted POP3 session if the POP server supports it. (Contributed by " "Lorenzo Catucci in :issue:`4473`.)" msgstr "" -":mod:`poplib` に 2 つの新規メソッドが追加されました。 :meth:`~poplib.POP3." -"capa` は POP サーバにより公表された機能リストを返します。 :meth:`~poplib." -"POP3.stls` は平文 POP3 セッションを、POP サーバがサポートしていれば暗号化され" -"た POP3 セッションに切り替えます。 (Contributed by Lorenzo Catucci in :issue:" -"`4473`.)" +":mod:`poplib` に 2 つの新規メソッドが追加されまし" +"た。 :meth:`~poplib.POP3.capa` は POP サーバにより公表された機能リストを返し" +"ます。 :meth:`~poplib.POP3.stls` は平文 POP3 セッションを、POP サーバがサポー" +"トしていれば暗号化された POP3 セッションに切り替えます。 (Contributed by " +"Lorenzo Catucci in :issue:`4473`.)" #: ../../whatsnew/3.4.rst:1256 msgid "pprint" @@ -2414,19 +2549,19 @@ msgstr "pprint" #: ../../whatsnew/3.4.rst:1258 msgid "" -"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" -"func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " +"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and " +"its :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " "option, *compact*, that controls how the output is formatted. Currently " "setting *compact* to ``True`` means that sequences will be printed with as " "many sequence elements as will fit within *width* on each (indented) line. " "(Contributed by Serhiy Storchaka in :issue:`19132`.)" msgstr "" -":mod:`pprint` モジュールの、 :class:`~pprint.PrettyPrinter` クラス、 :func:" -"`~pprint.pformat` 関数、 :func:`~pprint.pprint` 関数に、新規オプション " -"*compact* が追加されました。これは出力方法を制御するもので、今のところのこれ" -"の ``True`` での振舞いは、個々の (インデントされた) 行を *width* 幅で出来るだ" -"け多くのシーケンスの要素が収まるように出力します。 (Contributed by Serhiy " -"Storchaka in :issue:`19132`.)" +":mod:`pprint` モジュールの、 :class:`~pprint.PrettyPrinter` クラ" +"ス、 :func:`~pprint.pformat` 関数、 :func:`~pprint.pprint` 関数に、新規オプ" +"ション *compact* が追加されました。これは出力方法を制御するもので、今のところ" +"のこれの ``True`` での振舞いは、個々の (インデントされた) 行を *width* 幅で出" +"来るだけ多くのシーケンスの要素が収まるように出力します。 (Contributed by " +"Serhiy Storchaka in :issue:`19132`.)" #: ../../whatsnew/3.4.rst:1265 msgid "" @@ -2454,11 +2589,12 @@ msgstr "pydoc" #: ../../whatsnew/3.4.rst:1279 msgid "" -"The :mod:`pydoc` module is now based directly on the :func:`inspect." -"signature` introspection API, allowing it to provide signature information " -"for a wider variety of callable objects. This change also means that " -"``__wrapped__`` attributes are now taken into account when displaying help " -"information. (Contributed by Larry Hastings in :issue:`19674`.)" +"The :mod:`pydoc` module is now based directly on " +"the :func:`inspect.signature` introspection API, allowing it to provide " +"signature information for a wider variety of callable objects. This change " +"also means that ``__wrapped__`` attributes are now taken into account when " +"displaying help information. (Contributed by Larry Hastings " +"in :issue:`19674`.)" msgstr "" ":mod:`pydoc` モジュールがイントロスペクション API :func:`inspect.signature` " "に直接基くようになりました。これによりより幅広く callable オブジェクトのシグ" @@ -2470,8 +2606,8 @@ msgstr "" msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " -"signature of the supplied callable. (Contributed by Larry Hastings in :" -"issue:`20710`.)" +"signature of the supplied callable. (Contributed by Larry Hastings " +"in :issue:`20710`.)" msgstr "" ":mod:`pydoc` モジュールはもはや既に束縛済みのメソッドでは ``self`` パラメータ" "を表示しません。それよりも、与えられた callable の正確な現在のシグニチャを常" @@ -2481,8 +2617,8 @@ msgstr "" msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " -"also been improved substantially by the underlying changes in the :mod:" -"`inspect` module." +"also been improved substantially by the underlying changes in " +"the :mod:`inspect` module." msgstr "" ":mod:`pydoc` に直接なされた変更に加え、背後の :mod:`inspect` モジュールの改善" "が、カスタム ``__dir__`` メソッドやさまざまなデスクリプタの扱いについての振る" @@ -2543,21 +2679,28 @@ msgstr "" "glibc 2.13 以降の Linux プラットフォームで利用可能です。 (Contributed by " "Christian Heimes in :issue:`16595`.)" -#: ../../whatsnew/3.4.rst:1324 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " -"specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." -"RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource." -"RLIMIT_RTTIME`, and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by " -"Christian Heimes in :issue:`19324`.)" +"specific " +"constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource.RLIMIT_RTTIME`, " +"and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by Christian Heimes " +"in :issue:`19324`.)" msgstr "" +"Linux カーネル 2.6.36 以降のプラットフォームで、いくつかの Linux 固有の定数も" +"追加されまし" +"た: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource.RLIMIT_RTTIME`, :const:`~resource.RLIMIT_SIGPENDING`. " +"(Contributed by Christian Heimes in :issue:`19324`.)" -#: ../../whatsnew/3.4.rst:1330 msgid "" -"On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" -"const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" -"`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" +"On FreeBSD version 9 and later, there some new FreeBSD specific " +"constants: :const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, " +"and :const:`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa " +"in :issue:`19343`.)" msgstr "" +"FreeBSD バージョン 9 以降のプラットフォームで、いくつかの FreeBSD 固有の定数" +"が追加されまし" +"た: :const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, :const:`~resource.RLIMIT_NPTS`. " +"(Contributed by Claudiu Popa in :issue:`19343`.)" #: ../../whatsnew/3.4.rst:1337 msgid "select" @@ -2578,13 +2721,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:1344 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " -"and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" -"`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" +"and :meth:`~select.devpoll.close` methods, as well as a new " +"attribute :attr:`~select.devpoll.closed`. (Contributed by Victor Stinner " +"in :issue:`18794`.)" msgstr "" -":class:`~select.devpoll` オブジェクトに、メソッド :meth:`~select.devpoll." -"fileno` とメソッド :meth:`~select.devpoll.close` 、それに属性 :attr:`~select." -"devpoll.closed` が追加されました。 (Contributed by Victor Stinner in :issue:" -"`18794`.)" +":class:`~select.devpoll` オブジェクトに、メソッ" +"ド :meth:`~select.devpoll.fileno` とメソッド :meth:`~select.devpoll.close` 、" +"それに属性 :attr:`~select.devpoll.closed` が追加されました。 (Contributed by " +"Victor Stinner in :issue:`18794`.)" #: ../../whatsnew/3.4.rst:1351 msgid "shelve" @@ -2597,7 +2741,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 @@ -2609,27 +2753,32 @@ msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " "the same file, which allows an application to take appropriate action on " -"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack in :" -"issue:`1492704`.)" +"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack " +"in :issue:`1492704`.)" msgstr "" -":func:`~shutil.copyfile` が、コピー元とコピー先が同じファイルの場合に :exc:" -"`~shutil.Error` の限定されたサブクラスである :exc:`~shutil.SameFileError` を" -"投げるようになりました。これにより、アプリケーションはこの特定のエラーでそれ" -"に相応しいアクションを取れます。 (Contributed by Atsuo Ishimoto and Hynek " -"Schlawack in :issue:`1492704`.)" +":func:`~shutil.copyfile` が、コピー元とコピー先が同じファイルの場合" +"に :exc:`~shutil.Error` の限定されたサブクラスであ" +"る :exc:`~shutil.SameFileError` を投げるようになりました。これにより、アプリ" +"ケーションはこの特定のエラーでそれに相応しいアクションを取れます。 " +"(Contributed by Atsuo Ishimoto and Hynek Schlawack in :issue:`1492704`.)" #: ../../whatsnew/3.4.rst:1369 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.4.rst:1371 msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" "asynchat.async_chat` as its *map* argument. This allows an application to " -"avoid affecting the global socket map. (Contributed by Vinay Sajip in :" -"issue:`11959`.)" +"avoid affecting the global socket map. (Contributed by Vinay Sajip " +"in :issue:`11959`.)" msgstr "" +":class:`!SMTPServer` と :class:`!SMTPChannel` クラスが *map* キーワード引数を" +"受け付けるようになりました。\n" +"指定すると :class:`!asynchat.async_chat` の *map* 引数に渡されます。\n" +"これにより、アプリケーションがグローバルなソケットマップに影響を与えずに済み" +"ます。\n" +"(Contributed by Vinay Sajip in :issue:`11959`.)" #: ../../whatsnew/3.4.rst:1379 msgid "smtplib" @@ -2645,28 +2794,30 @@ msgstr "" ":exc:`~smtplib.SMTPException` が :exc:`OSError` のサブクラスになりました。こ" "れによって、とにかくエラーが起こったのだということにしか関心がないコードが、" "ソケット階層でのエラーと SMTP プロトコル階層の両エラーを一撃の try/except 文" -"で捕捉出来るようになりました。 (Contributed by Ned Jackson Lovely in :issue:" -"`2118`.)" +"で捕捉出来るようになりました。 (Contributed by Ned Jackson Lovely " +"in :issue:`2118`.)" #: ../../whatsnew/3.4.rst:1388 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.4.rst:1390 msgid "" "The socket module now supports the :const:`~socket.CAN_BCM` protocol on " "platforms that support it. (Contributed by Brian Thorne in :issue:`15359`.)" msgstr "" +"socket モジュールはそれをサポートしているプラットフォーム" +"で :const:`~socket.CAN_BCM` プロトコルをサポートするようになりました。\n" +"(Contributed by Brian Thorne in :issue:`15359`.)" #: ../../whatsnew/3.4.rst:1393 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " -"`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." -"socket.set_inheritable`." +"`, :meth:`~socket.socket.get_inheritable` " +"and :meth:`~socket.socket.set_inheritable`." msgstr "" "ソケットオブジェクトで :ref:`継承可能フラグ ` を制御出来るよ" -"うになりました。 :meth:`~socket.socket.get_inheritable` で取得し、 :meth:" -"`~socket.socket.set_inheritable` でセットします。" +"うになりました。 :meth:`~socket.socket.get_inheritable` で取得" +"し、 :meth:`~socket.socket.set_inheritable` でセットします。" #: ../../whatsnew/3.4.rst:1397 msgid "" @@ -2678,9 +2829,8 @@ msgstr "" "ルを使った列挙値になりました。つまりデバッグなどで魑魅魍魎な整数ではなく徳高" "い名前で表示されるということです。" -#: ../../whatsnew/3.4.rst:1401 msgid "The :const:`~socket.AF_LINK` constant is now available on BSD and OSX." -msgstr "" +msgstr ":const:`~socket.AF_LINK` 定数が BSD と OSX で利用可能になりました。" #: ../../whatsnew/3.4.rst:1403 msgid "" @@ -2703,8 +2853,8 @@ msgid "" msgstr "" ":func:`~sqlite3.connect` 関数に新規の真偽値パラメータ *uri* が追加されまし" "た。これを真にセットすると *database* パラメータを URI として解釈させることが" -"出来ます。 (`SQLite の URI のドキュメント `_ を参照してください)。 (Contributed by poq in :issue:`13773`.)" +"出来ます。 (`SQLite の URI のドキュメント `_ を参照してください)。 (Contributed by poq in :issue:`13773`.)" #: ../../whatsnew/3.4.rst:1417 msgid "ssl" @@ -2730,10 +2880,11 @@ msgid "" "more stringent than the defaults provided by the :class:`~ssl.SSLContext` " "constructor, and may be adjusted in the future, without prior deprecation, " "if best-practice security requirements change. The new recommended best " -"practice for using stdlib libraries that support SSL is to use :func:`~ssl." -"create_default_context` to obtain an :class:`~ssl.SSLContext` object, modify " -"it if needed, and then pass it as the *context* argument of the appropriate " -"stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" +"practice for using stdlib libraries that support SSL is to " +"use :func:`~ssl.create_default_context` to obtain " +"an :class:`~ssl.SSLContext` object, modify it if needed, and then pass it as " +"the *context* argument of the appropriate stdlib API. (Contributed by " +"Christian Heimes in :issue:`19689`.)" msgstr "" "新規関数 :func:`~ssl.create_default_context` は、互換性とセキュリティの間の程" "よいバランスとなるよう調整された :class:`~ssl.SSLContext` を得るための標準手" @@ -2741,101 +2892,112 @@ msgstr "" "タが与えるデフォルトよりも厳しく、そして将来的にセキュリティにおけるベストプ" "ラクティスによる要請が変化すれば、事前予告なしで調整されるかもしれません。" "SSL をサポートする標準ライブラリの使用においての新しいベストプラクティスとし" -"て、 :class:`~ssl.SSLContext` を得るのには :func:`~ssl." -"create_default_context` を使うことが推奨です。必要に応じ、対応する標準ライブ" -"ラリ API の *context* 引数に渡すためにそれを使うよう修正してください。" -"(Contributed by Christian Heimes in :issue:`19689`.)" +"て、 :class:`~ssl.SSLContext` を得るのに" +"は :func:`~ssl.create_default_context` を使うことが推奨です。必要に応じ、対応" +"する標準ライブラリ API の *context* 引数に渡すためにそれを使うよう修正してく" +"ださい。(Contributed by Christian Heimes in :issue:`19689`.)" #: ../../whatsnew/3.4.rst:1440 msgid "" -":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_verify_locations` accepts a new optional argument *cadata*, which can " -"be used to provide PEM or DER encoded certificates directly via strings or " -"bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" -msgstr "" -":class:`~ssl.SSLContext` のメソッド :meth:`~ssl.SSLContext." -"load_verify_locations` にオプショナル引数 *cadata* が追加されました。これに" -"は PEM あるいは DER エンコードの証明書を直接指定できます。前者の場合は文字列" -"で、後者では :term:`bytes-like object` で指定します。(Contributed by " +":class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_verify_locations` accepts a new optional " +"argument *cadata*, which can be used to provide PEM or DER encoded " +"certificates directly via strings or bytes, respectively. (Contributed by " "Christian Heimes in :issue:`18138`.)" +msgstr "" +":class:`~ssl.SSLContext` のメソッ" +"ド :meth:`~ssl.SSLContext.load_verify_locations` にオプショナル引数 *cadata* " +"が追加されました。これには PEM あるいは DER エンコードの証明書を直接指定でき" +"ます。前者の場合は文字列で、後者では bytes-like object で指定します。" +"(Contributed by Christian Heimes in :issue:`18138`.)" #: ../../whatsnew/3.4.rst:1445 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " -"the paths and environment variables that the :meth:`~ssl.SSLContext." -"set_default_verify_paths` method uses to set OpenSSL's default ``cafile`` " -"and ``capath``. This can be an aid in debugging default verification " -"issues. (Contributed by Christian Heimes in :issue:`18143`.)" -msgstr "" -"関数 :func:`~ssl.get_default_verify_paths` が追加されました。これは :meth:" -"`~ssl.SSLContext.set_default_verify_paths` メソッドが OpenSSL デフォルトの " -"``cafile`` と ``capath`` をセットするのに使うパスと環境変数から成る名前付きタ" -"プルを返します。デフォルトの検証にまつわる問題をデバッグするのに使えるでしょ" -"う。(Contributed by Christian Heimes in :issue:`18143`.)" +"the paths and environment variables that " +"the :meth:`~ssl.SSLContext.set_default_verify_paths` method uses to set " +"OpenSSL's default ``cafile`` and ``capath``. This can be an aid in " +"debugging default verification issues. (Contributed by Christian Heimes " +"in :issue:`18143`.)" +msgstr "" +"関数 :func:`~ssl.get_default_verify_paths` が追加されました。これ" +"は :meth:`~ssl.SSLContext.set_default_verify_paths` メソッドが OpenSSL デフォ" +"ルトの ``cafile`` と ``capath`` をセットするのに使うパスと環境変数から成る名" +"前付きタプルを返します。デフォルトの検証にまつわる問題をデバッグするのに使え" +"るでしょう。(Contributed by Christian Heimes in :issue:`18143`.)" #: ../../whatsnew/3.4.rst:1452 msgid "" -":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." -"cert_store_stats`, that reports the number of loaded ``X.509`` certs, " -"``X.509 CA`` certs, and certificate revocation lists (``crl``\\ s), as well " -"as a :meth:`~ssl.SSLContext.get_ca_certs` method that returns a list of the " -"loaded ``CA`` certificates. (Contributed by Christian Heimes in :issue:" -"`18147`.)" +":class:`~ssl.SSLContext` has a new " +"method, :meth:`~ssl.SSLContext.cert_store_stats`, that reports the number of " +"loaded ``X.509`` certs, ``X.509 CA`` certs, and certificate revocation lists " +"(``crl``\\ s), as well as a :meth:`~ssl.SSLContext.get_ca_certs` method that " +"returns a list of the loaded ``CA`` certificates. (Contributed by Christian " +"Heimes in :issue:`18147`.)" msgstr "" -":class:`~ssl.SSLContext` の新規メソッド :meth:`~ssl.SSLContext." -"cert_store_stats` はロードされた ``X.509`` 証明書、 ``X.509 CA`` 証明書、証明" -"書失効リスト (``crl``) を報告し、また、新規メソッド :meth:`~ssl.SSLContext." -"get_ca_certs` はロードされた ``CA`` 証明書のリストを返します。(Contributed " -"by Christian Heimes in :issue:`18147`.)" +":class:`~ssl.SSLContext` の新規メソッ" +"ド :meth:`~ssl.SSLContext.cert_store_stats` はロードされた ``X.509`` 証明" +"書、 ``X.509 CA`` 証明書、証明書失効リスト (``crl``) を報告し、また、新規メ" +"ソッド :meth:`~ssl.SSLContext.get_ca_certs` はロードされた ``CA`` 証明書のリ" +"ストを返します。(Contributed by Christian Heimes in :issue:`18147`.)" -#: ../../whatsnew/3.4.rst:1459 msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " "the certificate verification process by setting it to some combination of " -"the new constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl." -"VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, or :const:" -"`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL verification by " -"default. (Contributed by Christien Heimes in :issue:`8813`.)" -msgstr "" +"the new " +"constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl.VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, " +"or :const:`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL " +"verification by default. (Contributed by Christien Heimes in :issue:`8813`.)" +msgstr "" +"OpenSSL 0.9.8 以降が利用可能な場合に、 :class:`~ssl.SSLContext` で属" +"性 :attr:`~ssl.SSLContext.verify_flags` を指定出来るようになりました。\n" +"これは証明書の検証プロセスをコントロールします。\n" +"定" +"数 :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl.VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, :const:`~ssl.VERIFY_X509_STRICT` " +"を組み合わせてセットします。\n" +"OpenSSL は頼まない限りは証明書失効リスト(CRLs) の検証はしません。\n" +"(Contributed by Christien Heimes in :issue:`8813`.)" #: ../../whatsnew/3.4.rst:1467 msgid "" -"New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_default_certs` loads a set of default \"certificate authority\" (CA) " -"certificates from default locations, which vary according to the platform. " -"It can be used to load both TLS web server authentication certificates " -"(``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) for a client to use to verify " -"a server, and certificates for a server to use in verifying client " -"certificates (``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed " -"by Christian Heimes in :issue:`19292`.)" -msgstr "" -":class:`~ssl.SSLContext` の新規メソッド :meth:`~ssl.SSLContext." -"load_default_certs` は、プラットフォームによって異なるデフォルトの場所から " -"“認証局” (CA=certification authority) 証明書ファイル一式をロードします。クラ" -"イアントがサーバを検証するための TLS web サーバ証明の証明書をロード " -"(``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) することも、サーバがクライアン" -"ト証明書を検証するのに用いる証明書をロード (``purpose=``:data:`~ssl.Purpose." -"CLIENT_AUTH`) することも出来ます。(Contributed by Christian Heimes in :issue:" -"`19292`.)" +"New :class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_default_certs` loads a set of default " +"\"certificate authority\" (CA) certificates from default locations, which " +"vary according to the platform. It can be used to load both TLS web server " +"authentication certificates (``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) " +"for a client to use to verify a server, and certificates for a server to use " +"in verifying client certificates " +"(``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed by Christian " +"Heimes in :issue:`19292`.)" +msgstr "" +":class:`~ssl.SSLContext` の新規メソッ" +"ド :meth:`~ssl.SSLContext.load_default_certs` は、プラットフォームによって異" +"なるデフォルトの場所から “認証局” (CA=certification authority) 証明書ファイル" +"一式をロードします。クライアントがサーバを検証するための TLS web サーバ証明の" +"証明書をロード (``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) することも、" +"サーバがクライアント証明書を検証するのに用いる証明書をロード " +"(``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`) することも出来ます。" +"(Contributed by Christian Heimes in :issue:`19292`.)" #: ../../whatsnew/3.4.rst:1478 msgid "" -"Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" -"`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " -"information, and CRLs from the Windows cert store. (Contributed by " -"Christian Heimes in :issue:`17134`.)" +"Two new windows-only functions, :func:`~ssl.enum_certificates` " +"and :func:`~ssl.enum_crls` provide the ability to retrieve certificates, " +"certificate information, and CRLs from the Windows cert store. (Contributed " +"by Christian Heimes in :issue:`17134`.)" msgstr "" -"Windows だけで利用出来る関数が 2 つ追加されました。 :func:`~ssl." -"enum_certificates` と :func:`~ssl.enum_crls` で Windows のシステム証明書スト" -"アから、証明書、証明書の情報、CRLs (certification revocation=証明書失効リス" -"ト) を抽出出来ます。(Contributed by Christian Heimes in :issue:`17134`.)" +"Windows だけで利用出来る関数が 2 つ追加されまし" +"た。 :func:`~ssl.enum_certificates` と :func:`~ssl.enum_crls` で Windows のシ" +"ステム証明書ストアから、証明書、証明書の情報、CRLs (certification revocation=" +"証明書失効リスト) を抽出出来ます。(Contributed by Christian Heimes " +"in :issue:`17134`.)" #: ../../whatsnew/3.4.rst:1485 msgid "" -"Support for server-side SNI (Server Name Indication) using the new :meth:" -"`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " -"Black in :issue:`8109`.)" +"Support for server-side SNI (Server Name Indication) using the " +"new :meth:`ssl.SSLContext.set_servername_callback` method. (Contributed by " +"Daniel Black in :issue:`8109`.)" msgstr "" "新規メソッド :meth:`ssl.SSLContext.set_servername_callback` によるサーバサイ" "ド SNI (Server Name Indication) サポートが追加されました。 (Contributed by " @@ -2845,8 +3007,8 @@ msgstr "" msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " -"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes in :" -"issue:`18379`.)" +"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes " +"in :issue:`18379`.)" msgstr "" ":meth:`.SSLSocket.getpeercert` が返す辞書に ``X509v3`` 拡張アイテムを含むよう" "になりました: ``crlDistributionPoints``, ``caIssuers``, ``OCSP`` URI。 " @@ -2856,19 +3018,26 @@ msgstr "" msgid "stat" msgstr "stat" -#: ../../whatsnew/3.4.rst:1497 msgid "" "The :mod:`stat` module is now backed by a C implementation in :mod:`!_stat`. " "A C implementation is required as most of the values aren't standardized and " "are platform-dependent. (Contributed by Christian Heimes in :issue:`11016`.)" msgstr "" +":mod:`stat` モジュールが C 実装 :mod:`!_stat` に基くようになりました。\n" +"C 実装は、標準化されておらずプラットフォーム依存となる値のほとんどを取り込む" +"ために必要とされました。\n" +"(Contributed by Christian Heimes in :issue:`11016`.)" -#: ../../whatsnew/3.4.rst:1501 msgid "" -"The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" -"const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " -"Christian Hiemes in :issue:`11016`.)" +"The module supports new :mod:`~stat.ST_MODE` " +"flags, :mod:`~stat.S_IFDOOR`, :const:`~stat.S_IFPORT`, " +"and :const:`~stat.S_IFWHT`. (Contributed by Christian Hiemes " +"in :issue:`11016`.)" msgstr "" +"新たに :mod:`~stat.ST_MODE` のフラ" +"グ :mod:`~stat.S_IFDOOR`、:const:`~stat.S_IFPORT`、:const:`~stat.S_IFWHT` を" +"サポートしました。\n" +"(Contributed by Christian Hiemes in :issue:`11016`.)" #: ../../whatsnew/3.4.rst:1507 msgid "struct" @@ -2876,15 +3045,15 @@ msgstr "struct" #: ../../whatsnew/3.4.rst:1509 msgid "" -"New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." -"iter_unpack` method on compiled formats provide streamed unpacking of a " -"buffer containing repeated instances of a given format of data. (Contributed " -"by Antoine Pitrou in :issue:`17804`.)" +"New function :mod:`~struct.iter_unpack` and a " +"new :meth:`struct.Struct.iter_unpack` method on compiled formats provide " +"streamed unpacking of a buffer containing repeated instances of a given " +"format of data. (Contributed by Antoine Pitrou in :issue:`17804`.)" msgstr "" -"関数 :mod:`~struct.iter_unpack` と、コンパイル済フォーマットでのメソッド :" -"meth:`struct.Struct.iter_unpack` が追加されました。これは、与えられたデータ" -"フォーマットの繰り返しインスタンスを含むバッファを逐次的にアンパックします。 " -"(Contributed by Antoine Pitrou in :issue:`17804`.)" +"関数 :mod:`~struct.iter_unpack` と、コンパイル済フォーマットでのメソッ" +"ド :meth:`struct.Struct.iter_unpack` が追加されました。これは、与えられたデー" +"タフォーマットの繰り返しインスタンスを含むバッファを逐次的にアンパックしま" +"す。 (Contributed by Antoine Pitrou in :issue:`17804`.)" #: ../../whatsnew/3.4.rst:1516 msgid "subprocess" @@ -2898,8 +3067,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 "" @@ -2909,26 +3078,31 @@ msgid "" msgstr "" ":func:`~subprocess.getstatus` と :func:`~subprocess.getstatusoutput` が " "Windows でも動作するようになりました。ただしこの変更は実際には、不注意で " -"3.3.4 に対して既に行われました。 (Contributed by Tim Golden in :issue:" -"`10197`.)" +"3.3.4 に対して既に行われました。 (Contributed by Tim Golden " +"in :issue:`10197`.)" #: ../../whatsnew/3.4.rst:1528 msgid "sunau" msgstr "sunau" -#: ../../whatsnew/3.4.rst:1530 msgid "" "The :meth:`!getparams` method now returns a namedtuple rather than a plain " "tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" msgstr "" +":meth:`!getparams` メソッドが単なるタプルではなく名前付きタプルを返すようにな" +"りました。\n" +"(Contributed by Claudiu Popa in :issue:`18901`.)" -#: ../../whatsnew/3.4.rst:1533 msgid "" ":meth:`!sunau.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the ``close`` method of the returned object will " "be called automatically at the end of the block. (Contributed by Serhiy " "Storchaka in :issue:`18878`.)" msgstr "" +":meth:`!sunau.open` がコンテキスト管理プロトコルに対応しました。\n" +":keyword:`with` ブロックで使うと、返されたオブジェクトの ``close`` メソッドが" +"ブロックの終了時に自動的に呼び出されます。\n" +"(Contributed by Serhiy Storchaka in :issue:`18878`.)" #: ../../whatsnew/3.4.rst:1538 msgid "" @@ -2936,9 +3110,9 @@ msgid "" "support for writing 24 sample using the module. (Contributed by Serhiy " "Storchaka in :issue:`19261`.)" msgstr "" -"24 ビットサンプルの出力をサポートしました。つまり :meth:`.AU_write." -"setsampwidth` に 24 ビットに対応する値をセット出来ます。 (Contributed by " -"Serhiy Storchaka in :issue:`19261`.)" +"24 ビットサンプルの出力をサポートしました。つま" +"り :meth:`.AU_write.setsampwidth` に 24 ビットに対応する値をセット出来ます。 " +"(Contributed by Serhiy Storchaka in :issue:`19261`.)" #: ../../whatsnew/3.4.rst:1548 msgid "sys" @@ -2948,10 +3122,10 @@ msgstr "sys" msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" -"pymalloc`` setting, this is allocations made through the :c:func:" -"`PyObject_Malloc` API.) This can be useful for tracking memory leaks, " -"especially if automated via a test suite. (Contributed by Antoine Pitrou " -"in :issue:`13390`.)" +"pymalloc`` setting, this is allocations made through " +"the :c:func:`PyObject_Malloc` API.) This can be useful for tracking memory " +"leaks, especially if automated via a test suite. (Contributed by Antoine " +"Pitrou in :issue:`13390`.)" msgstr "" "新規関数 :func:`sys.getallocatedblocks` は、現在インタプリタによりアロケート" "されているブロック数を返します (デフォルトの ``--with-pymalloc`` 設定での " @@ -2969,23 +3143,24 @@ msgid "" "The :mod:`site` module :ref:`sets it ` to a function " "that enables tab completion and history saving (in :file:`~/.python-" "history`) if the platform supports :mod:`readline`. If you do not want this " -"(new) behavior, you can override it in :envvar:`PYTHONSTARTUP`, :mod:" -"`sitecustomize`, or :mod:`usercustomize` by deleting this attribute from :" -"mod:`sys` (or setting it to some other callable). (Contributed by Éric " -"Araujo and Antoine Pitrou in :issue:`5845`.)" +"(new) behavior, you can override it " +"in :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, or :mod:`usercustomize` by " +"deleting this attribute from :mod:`sys` (or setting it to some other " +"callable). (Contributed by Éric Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" "Python インタプリタが :ref:`tut-interactive` で開始する際に :mod:`sys` モ" "ジュールの属性 :data:`~sys.__interactivehook__` をチェックするようになりまし" "た。この属性があると、対話モード開始直前にその設定値が引数なしで呼び出されま" "す。このチェックは :envvar:`PYTHONSTARTUP` ファイルが読み込まれたあとで行われ" -"るので、そのファイル内でセット出来ます。 :mod:`site` モジュールは :mod:" -"`readline` をサポートするプラットフォームではタブ補完と (:file:`~/.python-" -"history` への) 履歴保存を有効にする関数を :ref:`__interactivehook__ にセット" -"します ` 。この (新たな) 振る舞いがお気に召さなければ、 :" -"envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, :mod:`usercustomize` のいずれか" -"で :mod:`sys` からこの属性を削除 (あるいはほかのなにか callable をセット) し" -"てください。 (Contributed by Éric Araujo and Antoine Pitrou in :issue:" -"`5845`.)" +"るので、そのファイル内でセット出来ます。 :mod:`site` モジュール" +"は :mod:`readline` をサポートするプラットフォームではタブ補完と " +"(:file:`~/.python-history` への) 履歴保存を有効にする関数" +"を :ref:`__interactivehook__ にセットします ` 。この (新" +"たな) 振る舞いがお気に召さなけれ" +"ば、 :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, :mod:`usercustomize` のい" +"ずれかで :mod:`sys` からこの属性を削除 (あるいはほかのなにか callable をセッ" +"ト) してください。 (Contributed by Éric Araujo and Antoine Pitrou " +"in :issue:`5845`.)" #: ../../whatsnew/3.4.rst:1572 msgid "tarfile" @@ -2995,11 +3170,11 @@ msgstr "tarfile" msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " -"and extract tarfile archives. (Contributed by Berker Peksag in :issue:" -"`13477`.)" +"and extract tarfile archives. (Contributed by Berker Peksag " +"in :issue:`13477`.)" msgstr "" -":mod:`tarfile` モジュールはスクリプトや直接 ``-m`` で呼ばれた場合、簡単な :" -"ref:`tarfile-commandline` をサポートするようになりました。\n" +":mod:`tarfile` モジュールはスクリプトや直接 ``-m`` で呼ばれた場合、簡単" +"な :ref:`tarfile-commandline` をサポートするようになりました。\n" "これにより tar ファイルアーカイブの作成や解凍が可能です。\n" "(Contributed by Berker Peksag in :issue:`13477`.)" @@ -3017,18 +3192,19 @@ msgid "" "convenience function :func:`~textwrap.shorten` collapses all of the " "whitespace in the input to single spaces and produces a single line of a " "given *width* that ends with the *placeholder* (by default, ``[...]``). " -"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and :" -"issue:`18725`.)" +"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` " +"and :issue:`18725`.)" msgstr "" ":class:`~textwrap.TextWrapper` に 2 つ新しい制御変数が追加されていて、これら" -"は属性値であり、コンストラクタ引数に渡せます。それぞれ :attr:`~textwrap." -"TextWrapper.max_lines` が最大出力行数、 :attr:`~textwrap.TextWrapper." -"placeholder` が *max_lines* により切り詰める場合に出力の最終行に置くテキスト" -"です。これら機能を使った新規のコンビニエンス関数 :func:`~textwrap.shorten` が" -"追加されています。これは入力に含まれる全ての空白文字を単一の空白に置き換え、" -"また幅 *width* に収めて、切り詰める場合は末尾を *placeholder* (デフォルトで " -"``[...]``) で置き換えて、単一行で返します。(Contributed by Antoine Pitrou " -"and Serhiy Storchaka in :issue:`18585` and :issue:`18725`.)" +"は属性値であり、コンストラクタ引数に渡せます。それぞ" +"れ :attr:`~textwrap.TextWrapper.max_lines` が最大出力行" +"数、 :attr:`~textwrap.TextWrapper.placeholder` が *max_lines* により切り詰め" +"る場合に出力の最終行に置くテキストです。これら機能を使った新規のコンビニエン" +"ス関数 :func:`~textwrap.shorten` が追加されています。これは入力に含まれる全て" +"の空白文字を単一の空白に置き換え、また幅 *width* に収めて、切り詰める場合は末" +"尾を *placeholder* (デフォルトで ``[...]``) で置き換えて、単一行で返します。" +"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` " +"and :issue:`18725`.)" #: ../../whatsnew/3.4.rst:1594 msgid "threading" @@ -3054,13 +3230,13 @@ msgstr "traceback" msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " -"amount of memory consumed. (Contributed by Andrew Kuchling in :issue:" -"`1565525`.)" +"amount of memory consumed. (Contributed by Andrew Kuchling " +"in :issue:`1565525`.)" msgstr "" "新規関数 :func:`traceback.clear_frames` は、トレースバックオブジェクトを受け" "取って、それが参照している全てのフレーム内のローカル変数をクリアすることで、" -"メモリ消費量を削減します。 (Contributed by Andrew Kuchling in :issue:" -"`1565525`.)" +"メモリ消費量を削減します。 (Contributed by Andrew Kuchling " +"in :issue:`1565525`.)" #: ../../whatsnew/3.4.rst:1612 msgid "types" @@ -3088,9 +3264,9 @@ msgstr "urllib" #: ../../whatsnew/3.4.rst:1625 msgid "" -":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." -"request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" -"`16423`.)" +":mod:`urllib.request` now supports ``data:`` URLs via " +"the :class:`~urllib.request.DataHandler` class. (Contributed by Mathias " +"Panzenböck in :issue:`16423`.)" msgstr "" ":mod:`urllib.request` が新規クラス :class:`~urllib.request.DataHandler` を介" "して ``data:`` URL をサポートするようになりました。 (Contributed by Mathias " @@ -3099,48 +3275,50 @@ msgstr "" #: ../../whatsnew/3.4.rst:1629 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " -"class can now be specified by setting a :class:`~urllib.request.Request." -"method` class attribute on the subclass. (Contributed by Jason R Coombs in :" -"issue:`18978`.)" +"class can now be specified by setting " +"a :class:`~urllib.request.Request.method` class attribute on the subclass. " +"(Contributed by Jason R Coombs in :issue:`18978`.)" 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 "" -":class:`~urllib.request.Request` objects are now reusable: if the :attr:" -"`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " -"attributes are modified, all relevant internal properties are updated. This " -"means, for example, that it is now possible to use the same :class:`~urllib." -"request.Request` object in more than one :meth:`.OpenerDirector.open` call " -"with different *data* arguments, or to modify a :class:`~urllib.request." -"Request`\\ 's ``url`` rather than recomputing it from scratch. There is " -"also a new :meth:`~urllib.request.Request.remove_header` method that can be " -"used to remove headers from a :class:`~urllib.request.Request`. " -"(Contributed by Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:" -"`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" -msgstr "" -":class:`~urllib.request.Request` オブジェクトは今では再利用可能です: :attr:" -"`~urllib.request.Request.full_url` あるいは :attr:`~urllib.request.Request." -"data` 属性などが変更されると、関連する全ての内部プロパティが更新されます。こ" -"のことによって今や、例えば、 :class:`~urllib.request.Request` オブジェクト" -"を、異なる *data* 引数での :meth:`.OpenerDirector.open` の複数回呼び出し内で" -"使ったり、あるいは、まっさらから作り直すのではなく :class:`~urllib.request." -"Request` の ``url`` を書き換えて使ったり出来ます。新たに :meth:`~urllib." -"request.Request.remove_header` メソッドも追加されていて、これは :class:" -"`~urllib.request.Request` からヘッダを取り除きます。 (Contributed by Alexey " -"Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and Damien " -"Brecht and Senthil Kumaran in :issue:`17272`.)" +":class:`~urllib.request.Request` objects are now reusable: if " +"the :attr:`~urllib.request.Request.full_url` " +"or :attr:`~urllib.request.Request.data` attributes are modified, all " +"relevant internal properties are updated. This means, for example, that it " +"is now possible to use the same :class:`~urllib.request.Request` object in " +"more than one :meth:`.OpenerDirector.open` call with different *data* " +"arguments, or to modify a :class:`~urllib.request.Request`\\ 's ``url`` " +"rather than recomputing it from scratch. There is also a " +"new :meth:`~urllib.request.Request.remove_header` method that can be used to " +"remove headers from a :class:`~urllib.request.Request`. (Contributed by " +"Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and " +"Damien Brecht and Senthil Kumaran in :issue:`17272`.)" +msgstr "" +":class:`~urllib.request.Request` オブジェクトは今では再利用可能で" +"す: :attr:`~urllib.request.Request.full_url` あるい" +"は :attr:`~urllib.request.Request.data` 属性などが変更されると、関連する全て" +"の内部プロパティが更新されます。このことによって今や、例え" +"ば、 :class:`~urllib.request.Request` オブジェクトを、異なる *data* 引数で" +"の :meth:`.OpenerDirector.open` の複数回呼び出し内で使ったり、あるいは、まっ" +"さらから作り直すのではなく :class:`~urllib.request.Request` の ``url`` を書き" +"換えて使ったり出来ます。新たに :meth:`~urllib.request.Request.remove_header` " +"メソッドも追加されていて、これは :class:`~urllib.request.Request` からヘッダ" +"を取り除きます。 (Contributed by Alexey Kachayev in :issue:`16464`, Daniel " +"Wozniak in :issue:`17485`, and Damien Brecht and Senthil Kumaran " +"in :issue:`17272`.)" #: ../../whatsnew/3.4.rst:1647 msgid "" -":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." -"HTTPError.headers` attribute that provides access to the HTTP response " -"headers associated with the error. (Contributed by Berker Peksag in :issue:" -"`15701`.)" +":class:`~urllib.error.HTTPError` objects now have " +"a :attr:`~urllib.error.HTTPError.headers` attribute that provides access to " +"the HTTP response headers associated with the error. (Contributed by Berker " +"Peksag in :issue:`15701`.)" msgstr "" ":class:`~urllib.error.HTTPError` オブジェクトに、エラーに関係する HTTP レスポ" "ンスヘッダへのアクセスを提供する :attr:`~urllib.error.HTTPError.headers` 属性" @@ -3150,18 +3328,26 @@ msgstr "" msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.4.rst:1656 msgid "" -"The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." -"TestCase.subTest`, that produces a context manager whose :keyword:`with` " -"block becomes a \"sub-test\". This context manager allows a test method to " -"dynamically generate subtests by, say, calling the ``subTest`` context " -"manager inside a loop. A single test method can thereby produce an " -"indefinite number of separately identified and separately counted tests, all " -"of which will run even if one or more of them fail. For example::" +"The :class:`~unittest.TestCase` class has a new " +"method, :meth:`~unittest.TestCase.subTest`, that produces a context manager " +"whose :keyword:`with` block becomes a \"sub-test\". This context manager " +"allows a test method to dynamically generate subtests by, say, calling the " +"``subTest`` context manager inside a loop. A single test method can thereby " +"produce an indefinite number of separately identified and separately counted " +"tests, all of which will run even if one or more of them fail. For example::" msgstr "" +":class:`~unittest.TestCase` クラスに新し" +"い :meth:`~unittest.TestCase.subTest` メソッドが追加されました。\n" +"このメソッドが生成するコンテキストマネージャーの :keyword:`with` ブロックは" +"「サブテスト」になります。\n" +"例えばループの中で ``subTest`` コンテキストマネージャーを呼び出すことで、テス" +"トメソッドからサブテストを動的に生成できます。\n" +"これにより、単一のテストメソッドで、個別に識別され個別に数えられるテストをい" +"くつでも作成できます。\n" +"そのうちの一つ以上が失敗しても、すべてのテストが実行されます。\n" +"例えば次のようになります。 ::" -#: ../../whatsnew/3.4.rst:1664 msgid "" "class NumbersTest(unittest.TestCase):\n" " def test_even(self):\n" @@ -3169,6 +3355,11 @@ msgid "" " with self.subTest(i=i):\n" " self.assertEqual(i % 2, 0)" msgstr "" +"class NumbersTest(unittest.TestCase):\n" +" def test_even(self):\n" +" for i in range(6):\n" +" with self.subTest(i=i):\n" +" self.assertEqual(i % 2, 0)" #: ../../whatsnew/3.4.rst:1670 msgid "" @@ -3225,30 +3416,31 @@ msgstr "" ":class:`~unittest.TestSuite` がその実行完了次第すぐに、テスト成功していれば、" "テストへの参照を取り除くようになりました。ガーベージコレクションを行う " "Python インタプリタ上ではこの振る舞いによって、テストへの参照を保持しているも" -"のが他にない場合のテストのガーベージコレクトを可能にします。この振る舞いは :" -"mod:`~unittest.TestSuite` をサブクラス化して何もしない " +"のが他にない場合のテストのガーベージコレクトを可能にします。この振る舞い" +"は :mod:`~unittest.TestSuite` をサブクラス化して何もしない " "``_removeTestAtIndex`` を定義することで上書き出来ます。 (Contributed by Tom " "Wardill, Matt McClure, and Andrew Svetlov in :issue:`11798`.)" #: ../../whatsnew/3.4.rst:1695 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " -"will ensure that a given block of code emits a log message using the :mod:" -"`logging` module. By default the message can come from any logger and have " -"a priority of ``INFO`` or higher, but both the logger name and an " +"will ensure that a given block of code emits a log message using " +"the :mod:`logging` module. By default the message can come from any logger " +"and have a priority of ``INFO`` or higher, but both the logger name and an " "alternative minimum logging level may be specified. The object returned by " "the context manager can be queried for the :class:`~logging.LogRecord`\\ s " "and/or formatted messages that were logged. (Contributed by Antoine Pitrou " "in :issue:`18937`.)" msgstr "" -"テストアサーションの新規コンテキストマネージャ :meth:`~unittest.TestCase." -"assertLogs` が追加されました。これはコードブロックが :mod:`logging` を使って" -"ログメッセージを発行しているか確認します。デフォルトでは任意のロガーからの " -"``INFO`` 以上のプライオリティを持つメッセージを取れますが、ロガー名と最小プラ" -"イオリティの両方とも指定可能です。コンテキストマネージャからの戻りオブジェク" -"トに対して、ログされた :class:`~logging.LogRecord` とフォーマットされたメッ" -"セージの両方あるいはどちらかを問い合わせることが出来ます。 (Contributed by " -"Antoine Pitrou in :issue:`18937`.)" +"テストアサーションの新規コンテキストマネー" +"ジャ :meth:`~unittest.TestCase.assertLogs` が追加されました。これはコードブ" +"ロックが :mod:`logging` を使ってログメッセージを発行しているか確認します。デ" +"フォルトでは任意のロガーからの ``INFO`` 以上のプライオリティを持つメッセージ" +"を取れますが、ロガー名と最小プライオリティの両方とも指定可能です。コンテキス" +"トマネージャからの戻りオブジェクトに対して、ログされ" +"た :class:`~logging.LogRecord` とフォーマットされたメッセージの両方あるいはど" +"ちらかを問い合わせることが出来ます。 (Contributed by Antoine Pitrou " +"in :issue:`18937`.)" #: ../../whatsnew/3.4.rst:1704 msgid "" @@ -3276,8 +3468,8 @@ msgid "" "methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)" msgstr "" ":func:`~mock.mock_open` オブジェクトに ``readline`` メソッドと ``readlines`` " -"メソッドが追加されました。 (Contributed by Toshio Kuratomi in :issue:" -"`17467`.)" +"メソッドが追加されました。 (Contributed by Toshio Kuratomi " +"in :issue:`17467`.)" #: ../../whatsnew/3.4.rst:1717 msgid "venv" @@ -3296,14 +3488,14 @@ msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " "controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is " -"installed in the virtual environment. (Contributed by Nick Coghlan in :" -"issue:`19552` as part of the :pep:`453` implementation.)" +"installed in the virtual environment. (Contributed by Nick Coghlan " +"in :issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" ":class:`~venv.EnvBuilder` クラスとコンビニエンス関数 :func:`~venv.create` が" "新規キーワード引数 *with_pip* を取るようになりました。デフォルトは ``False`` " "です。これは :class:`~venv.EnvBuilder` が仮想環境に ``pip`` がインストールさ" -"れていることを保証するかどうかを制御します。(Contributed by Nick Coghlan in :" -"issue:`19552` as part of the :pep:`453` implementation.)" +"れていることを保証するかどうかを制御します。(Contributed by Nick Coghlan " +"in :issue:`19552` as part of the :pep:`453` implementation.)" #: ../../whatsnew/3.4.rst:1730 msgid "wave" @@ -3314,9 +3506,9 @@ msgid "" "The :meth:`~wave.getparams` method now returns a namedtuple rather than a " "plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)" msgstr "" -":meth:`~wave.getparams` メソッドがプレインなタプルではなく :class:" -"`~collections.namedtuple` を返すようになりました。 (Contributed by Claudiu " -"Popa in :issue:`17487`.)" +":meth:`~wave.getparams` メソッドがプレインなタプルではな" +"く :class:`~collections.namedtuple` を返すようになりました。 (Contributed by " +"Claudiu Popa in :issue:`17487`.)" #: ../../whatsnew/3.4.rst:1735 msgid "" @@ -3338,13 +3530,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:1742 msgid "" -"The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" +"The :meth:`~wave.Wave_write.writeframesraw` " +"and :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-" +"like object`. (Contributed by Serhiy Storchaka in :issue:`8311`.)" msgstr "" -":meth:`~wave.Wave_write.writeframesraw` メソッドと :meth:`~wave.Wave_write." -"writeframes` メソッドが :term:`bytes-like object` を受け付けるようになりまし" -"た。 (Contributed by Serhiy Storchaka in :issue:`8311`.)" +":meth:`~wave.Wave_write.writeframesraw` メソッド" +"と :meth:`~wave.Wave_write.writeframes` メソッドが :term:`bytes-like object` " +"を受け付けるようになりました。 (Contributed by Serhiy Storchaka " +"in :issue:`8311`.)" #: ../../whatsnew/3.4.rst:1748 msgid "weakref" @@ -3376,9 +3569,9 @@ msgid "" "via the :attr:`~weakref.ref.__callback__` attribute. (Contributed by Mark " "Dickinson in :issue:`17643`.)" msgstr "" -":class:`~weakref.ref` に関連付いたコールバック (あれば) を、新規属性 :attr:" -"`~weakref.ref.__callback__` で取得出来るようになりました。(Contributed by " -"Mark Dickinson in :issue:`17643`.)" +":class:`~weakref.ref` に関連付いたコールバック (あれば) を、新規属" +"性 :attr:`~weakref.ref.__callback__` で取得出来るようになりました。" +"(Contributed by Mark Dickinson in :issue:`17643`.)" #: ../../whatsnew/3.4.rst:1764 msgid "xml.etree" @@ -3387,34 +3580,34 @@ msgstr "xml.etree" #: ../../whatsnew/3.4.rst:1766 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" -"blocking applications to parse XML documents. An example can be seen at :" -"ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou in :issue:" -"`17741`.)" -msgstr "" -"ノンブロッキングなアプリケーションでの XML ドキュメントの解析に、新規パーサ :" -"class:`~xml.etree.ElementTree.XMLPullParser` を利用出来ます。実例は :ref:" -"`elementtree-pull-parsing` をみてください。 (Contributed by Antoine Pitrou " +"blocking applications to parse XML documents. An example can be seen " +"at :ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou " "in :issue:`17741`.)" +msgstr "" +"ノンブロッキングなアプリケーションでの XML ドキュメントの解析に、新規パー" +"サ :class:`~xml.etree.ElementTree.XMLPullParser` を利用出来ます。実例" +"は :ref:`elementtree-pull-parsing` をみてください。 (Contributed by Antoine " +"Pitrou in :issue:`17741`.)" #: ../../whatsnew/3.4.rst:1771 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " -"and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" -"`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree." -"ElementTree.write` method, now have a *short_empty_elements* :ref:`keyword-" -"only parameter ` providing control over whether " -"elements with no content are written in abbreviated (````) or " -"expanded (````) form. (Contributed by Ariel Poliak and Serhiy " -"Storchaka in :issue:`14377`.)" -msgstr "" -":mod:`xml.etree.ElementTree` の関数 :func:`~xml.etree.ElementTree." -"tostring` 、:func:`~xml.etree.ElementTree.tostringlist` と、 :class:`~xml." -"etree.ElementTree.ElementTree` クラスの :meth:`~xml.etree.ElementTree." -"ElementTree.write` メソッドに、 :ref:`キーワード専用引数 ` の *short_empty_elements* が追加されました。これはコンテンツ" -"を持たない要素を省略形 (````) で書き出すか展開された形 (````) で書き出すかを制御します。(Contributed by Ariel Poliak and Serhiy " -"Storchaka in :issue:`14377`.)" +"and :func:`~xml.etree.ElementTree.tostringlist` functions, and " +"the :class:`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree.ElementTree.write` " +"method, now have a *short_empty_elements* :ref:`keyword-only parameter " +"` providing control over whether elements with no " +"content are written in abbreviated (````) or expanded (````) form. (Contributed by Ariel Poliak and Serhiy Storchaka " +"in :issue:`14377`.)" +msgstr "" +":mod:`xml.etree.ElementTree` の関" +"数 :func:`~xml.etree.ElementTree.tostring` 、:func:`~xml.etree.ElementTree.tostringlist` " +"と、 :class:`~xml.etree.ElementTree.ElementTree` クラス" +"の :meth:`~xml.etree.ElementTree.ElementTree.write` メソッドに、 :ref:`キー" +"ワード専用引数 ` の *short_empty_elements* が追加され" +"ました。これはコンテンツを持たない要素を省略形 (````) で書き出すか展開" +"された形 (````) で書き出すかを制御します。(Contributed by Ariel " +"Poliak and Serhiy Storchaka in :issue:`14377`.)" #: ../../whatsnew/3.4.rst:1782 msgid "zipfile" @@ -3422,11 +3615,11 @@ msgstr "zipfile" #: ../../whatsnew/3.4.rst:1784 msgid "" -"The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." -"PyZipFile` class has a new *filterfunc* option that can be used to control " -"which directories and files are added to the archive. For example, this " -"could be used to exclude test files from the archive. (Contributed by " -"Christian Tismer in :issue:`19274`.)" +"The :meth:`~zipfile.PyZipFile.writepy` method of " +"the :class:`~zipfile.PyZipFile` class has a new *filterfunc* option that can " +"be used to control which directories and files are added to the archive. " +"For example, this could be used to exclude test files from the archive. " +"(Contributed by Christian Tismer in :issue:`19274`.)" msgstr "" ":class:`~zipfile.PyZipFile` クラスの :meth:`~zipfile.PyZipFile.writepy` メ" "ソッドに *filterfunc* オプションが追加されました。これはアーカイブにどのディ" @@ -3436,9 +3629,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1790 msgid "" -"The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." -"PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" -"issue:`17201`.)" +"The *allowZip64* parameter to :class:`~zipfile.ZipFile` " +"and :class:`~zipfile.PyZipfile` is now ``True`` by default. (Contributed by " +"William Mallard in :issue:`17201`.)" msgstr "" ":class:`~zipfile.ZipFile` クラスと :class:`~zipfile.PyZipfile` クラスの " "*allowZip64* パラメータのデフォルトが ``True`` に変更されました。 " @@ -3479,25 +3672,26 @@ msgstr "" ":pep:`442` は、 CPython でのオブジェクトのファイナライゼーションにまつわる現" "在の制限と奇癖を取り除きます。これによって、 :meth:`__del__` メソッドを持つオ" "ブジェクトと :keyword:`finally` 節を持つジェネレータが、それらが循環参照に含" -"まれる場合もファイナライズ出来ます。(---訳注: ジェネレータの例については :" -"issue:`17468` から派生した :issue:`17807` での修正 `changeset 83688:" -"c89febab4648 `_ の ``Lib/" -"test/test_generators.py`` に追加されたテスト参照。---)" +"まれる場合もファイナライズ出来ます。(---訳注: ジェネレータの例について" +"は :issue:`17468` から派生した :issue:`17807` での修正 `changeset " +"83688:c89febab4648 `_ の " +"``Lib/test/test_generators.py`` に追加されたテスト参照。---)" #: ../../whatsnew/3.4.rst:1824 msgid "" -"As part of this change, module globals are no longer forcibly set to :const:" -"`None` during interpreter shutdown in most cases, instead relying on the " -"normal operation of the cyclic garbage collector. This avoids a whole class " -"of interpreter-shutdown-time errors, usually involving ``__del__`` methods, " -"that have plagued Python since the cyclic GC was first introduced." +"As part of this change, module globals are no longer forcibly set " +"to :const:`None` during interpreter shutdown in most cases, instead relying " +"on the normal operation of the cyclic garbage collector. This avoids a " +"whole class of interpreter-shutdown-time errors, usually involving " +"``__del__`` methods, that have plagued Python since the cyclic GC was first " +"introduced." msgstr "" "この変更の一環で、モジュールのグローバルは、ほとんどのケースではインタプリタ" "のシャットダウン中に強制的に :const:`None` がセットされることはなくなり、代わ" "りに循環ガーベージコレクタの通常のオペレーションに委ねます。このことは、循環 " "GC が最初に導入されて以来悩みの種だった、普通 ``__del__`` メソッドを巻き込ん" -"だ「インタプリタシャットダウン時エラーの類」全体を回避します。(---訳注: :" -"issue:`18214` (superseder for :issue:`812369`), `changeset " +"だ「インタプリタシャットダウン時エラーの類」全体を回避します。(---訳" +"注: :issue:`18214` (superseder for :issue:`812369`), `changeset " "84936:79e2f5bbc30c `_ ---)" #: ../../whatsnew/3.4.rst:1833 @@ -3528,12 +3722,15 @@ msgstr "" "64 ビットデータ型を持つプラットフォームで SipHash に乗り換えます。以前の FNV " "アルゴリズムと比較したどんなパフォーマンスの差異も、些細なものです。" -#: ../../whatsnew/3.4.rst:1851 msgid "" "The PEP adds additional fields to the :data:`sys.hash_info` named tuple to " "describe the hash algorithm in use by the currently executing binary. " "Otherwise, the PEP does not alter any existing CPython APIs." msgstr "" +"この PEP は :data:`sys.hash_info` 名前付きタプルに、現在実行しているバイナリ" +"で使われているハッシュアルゴリズムを記述するためのフィールドを追加します。\n" +"これら以外にはこの PEP が既存の CPython API を何か置き換えることはありませ" +"ん。" #: ../../whatsnew/3.4.rst:1859 msgid "PEP 436: Argument Clinic" @@ -3557,8 +3754,8 @@ msgid "" "accordingly." msgstr "" "Python 3.4 では既にいくつかの標準ライブラリ拡張モジュールが Argument Clinic " -"を使うように変換されていて、またこれの結果として :mod:`pydoc` と :mod:" -"`inspect` が更新されました。" +"を使うように変換されていて、またこれの結果として :mod:`pydoc` " +"と :mod:`inspect` が更新されました。" #: ../../whatsnew/3.4.rst:1870 msgid "" @@ -3606,13 +3803,18 @@ msgstr "" "す。(Contributed by Martin von Löwis in :issue:`17162`.) (---訳注: 安定 ABI, " "制限 API については What's New In Python 3.2 (:pep:`384`) を参照。---)" -#: ../../whatsnew/3.4.rst:1893 msgid "" "The new :c:func:`!Py_SetStandardStreamEncoding` pre-initialization API " "allows applications embedding the CPython interpreter to reliably force a " "particular encoding and error handler for the standard streams. (Contributed " "by Bastien Montagne and Nick Coghlan in :issue:`16129`.)" msgstr "" +"初期化前処理 API の :c:func:`!Py_SetStandardStreamEncoding` が追加されまし" +"た。\n" +"これにより CPython インタプリタを埋め込むアプリケーションは、標準ストリームに" +"対して確実に特定のエンコーディングとエラーハンドラを使わせることが出来ま" +"す。\n" +"(Contributed by Bastien Montagne and Nick Coghlan in :issue:`16129`.)" #: ../../whatsnew/3.4.rst:1898 msgid "" @@ -3645,20 +3847,20 @@ msgstr "" #: ../../whatsnew/3.4.rst:1909 msgid "" -"New function :c:func:`PyStructSequence_InitType2` supplements the existing :" -"c:func:`PyStructSequence_InitType` function. The difference is that it " -"returns ``0`` on success and ``-1`` on failure." +"New function :c:func:`PyStructSequence_InitType2` supplements the " +"existing :c:func:`PyStructSequence_InitType` function. The difference is " +"that it returns ``0`` on success and ``-1`` on failure." msgstr "" -"既存の :c:func:`PyStructSequence_InitType` 関数を補うものとして、 :c:func:" -"`PyStructSequence_InitType2` が追加されました。違いは、これは成功時に " -"``0`` 、失敗時に ``-1`` を返すことです。" +"既存の :c:func:`PyStructSequence_InitType` 関数を補うものとし" +"て、 :c:func:`PyStructSequence_InitType2` が追加されました。違いは、これは成" +"功時に ``0`` 、失敗時に ``-1`` を返すことです。" #: ../../whatsnew/3.4.rst:1913 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " -"object allocator have been silenced. (Contributed by Dhiru Kholia in :issue:" -"`18596`.)" +"object allocator have been silenced. (Contributed by Dhiru Kholia " +"in :issue:`18596`.)" msgstr "" "CPython のソースを、最近の GCC と clang のアドレスサニティチェック機能を使っ" "てコンパイル出来るようにしました: 小さなオブジェクト用アロケータで起こってい" @@ -3666,30 +3868,31 @@ msgstr "" #: ../../whatsnew/3.4.rst:1918 msgid "" -"The Windows build now uses `Address Space Layout Randomization `_ and `Data Execution " -"Prevention `_. " -"(Contributed by Christian Heimes in :issue:`16632`.)" +"The Windows build now uses `Address Space Layout Randomization `_ and `Data " +"Execution Prevention `_. (Contributed by Christian Heimes " +"in :issue:`16632`.)" msgstr "" "Windows ビルドに `アドレス空間配置のランダム化 `_ と `データ実行防止 `_ を使うようにしました。 " +"wiki/Address_space_layout_randomization>`_ と `データ実行防止 `_ を使うようにしました。 " "(Contributed by Christian Heimes in :issue:`16632`.)" #: ../../whatsnew/3.4.rst:1923 msgid "" -"New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" -"`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" +"New function :c:func:`PyObject_LengthHint` is the C API equivalent " +"of :func:`operator.length_hint`. (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" -":func:`operator.length_hint` と等価な C API 関数 :c:func:" -"`PyObject_LengthHint` が追加されました。 (Contributed by Armin Ronacher in :" -"issue:`16148`.)" +":func:`operator.length_hint` と等価な C API 関" +"数 :c:func:`PyObject_LengthHint` が追加されました。 (Contributed by Armin " +"Ronacher in :issue:`16148`.)" #: ../../whatsnew/3.4.rst:1931 msgid "Other Improvements" msgstr "その他の改善" -#: ../../whatsnew/3.4.rst:1935 msgid "" "The :ref:`python ` command has a new :ref:`option `, ``-I``, which causes it to run in \"isolated mode\", " @@ -3702,6 +3905,20 @@ msgid "" "most POSIX systems it can and should be used in the ``#!`` line of system " "scripts. (Contributed by Christian Heimes in :issue:`16499`.)" msgstr "" +":ref:`python ` コマンドに新規 :ref:`オプション ` の ``-I`` が追加されました。\n" +"これは「隔離モード (isolated mode)」で Python を実行します。\n" +"これが意味するのは、 :data:`sys.path` がスクリプトディレクトリもユーザの " +"``site-packages`` ディレクトリも含まず、また、全ての :envvar:`!PYTHON*` 環境" +"変数が無視される、というものです (ので暗黙で ``-s`` と ``-E`` を含んでいると" +"いうことです)。\n" +"ほかの制限も将来適用される可能性があります。\n" +"その目標はユーザ環境からスクリプト実行を隔離することです。\n" +"例えばこれは Python がシステムスクリプトとして実行される場合に適切なもので" +"す。\n" +"ほとんどの POSIX システムではシステムスクリプトの ``#!`` 行で指定できますし、" +"そうすべきです。\n" +"(Contributed by Christian Heimes in :issue:`16499`.)" #: ../../whatsnew/3.4.rst:1946 msgid "" @@ -3710,10 +3927,10 @@ msgid "" "and is written to (and read from) the file :file:`~/.python-history`. " "(Contributed by Antoine Pitrou and Éric Araujo in :issue:`5845`.)" msgstr "" -":mod:`readline` をサポートするプラットフォームで、対話インタプリタでの :kbd:" -"`Tab` キーでの補完がデフォルトで有効になりました。履歴もデフォルトで有効とな" -"り、 :file:`~/.python-history` に書き込まれ (そしてそこから読み込まれ) ま" -"す。 (Contributed by Antoine Pitrou and Éric Araujo in :issue:`5845`.)" +":mod:`readline` をサポートするプラットフォームで、対話インタプリタで" +"の :kbd:`Tab` キーでの補完がデフォルトで有効になりました。履歴もデフォルトで" +"有効となり、 :file:`~/.python-history` に書き込まれ (そしてそこから読み込ま" +"れ) ます。 (Contributed by Antoine Pitrou and Éric Araujo in :issue:`5845`.)" #: ../../whatsnew/3.4.rst:1951 msgid "" @@ -3723,36 +3940,44 @@ msgid "" "have script-like invocation capabilities (:issue:`18922`)." msgstr "" "Python インタプリタの ``--version`` での起動時、標準エラーではなく標準出力に" -"バージョン情報を出力するようになりました (:issue:`18338`)。同じ変更は :mod:" -"`argparse` モジュールに対して (:issue:`18920`)、また、スクリプトとして呼び出" -"せる機能を持つモジュールに対して (:issue:`18922`) も行われました。" +"バージョン情報を出力するようになりました (:issue:`18338`)。同じ変更" +"は :mod:`argparse` モジュールに対して (:issue:`18920`)、また、スクリプトとし" +"て呼び出せる機能を持つモジュールに対して (:issue:`18922`) も行われました。" #: ../../whatsnew/3.4.rst:1956 msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " -"script at the windows command prompt by just typing its name without the ``." -"py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" +"script at the windows command prompt by just typing its name without the " +"``.py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" "CPython の Windows インストーラが、拡張子を登録する際に :envvar:`PATHEXT` に " "``.py`` を追加するようになりました。これをするとユーザは、 Windows コマンドプ" "ロンプトから Python スクリプトを、 ``.py`` 拡張子なしでその名前だけタイプして" "実行出来ます。 (Contributed by Paul Moore in :issue:`18569`.)" -#: ../../whatsnew/3.4.rst:1961 msgid "" "A new ``make`` target `coverage-report `_ will build python, run " "the test suite, and generate an HTML coverage report for the C codebase " "using ``gcov`` and `lcov `_." msgstr "" +"新しい ``make`` ターゲット `coverage-report `_ は Python をビル" +"ドしてテストスイートを実行し、``gcov`` と `lcov `_ を使って C コードの HTML カバレッジレポートを生成しま" +"す。" -#: ../../whatsnew/3.4.rst:1967 msgid "" "The ``-R`` option to the :ref:`python regression test suite ` now " -"also checks for memory allocation leaks, using :func:`sys." -"getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" +"also checks for memory allocation leaks, " +"using :func:`sys.getallocatedblocks`. (Contributed by Antoine Pitrou " +"in :issue:`13390`.)" msgstr "" +":ref:`Python の回帰テストスイート ` の ``-R`` オプション" +"が、:func:`sys.getallocatedblocks` を使ってメモリの割り当て漏れも検査するよう" +"になりました。\n" +"(Contributed by Antoine Pitrou in :issue:`13390`.)" #: ../../whatsnew/3.4.rst:1972 msgid "``python -m`` now works with namespace packages." @@ -3780,23 +4005,26 @@ msgstr "" "内の最初のモジュールだけが返されていました)。 (Contributed by Václav " "Šmilauer in :issue:`16421`.)" -#: ../../whatsnew/3.4.rst:1982 msgid "" "A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " -"uses of :ref:`__prepare__ `. (Contributed by Benjamin Peterson in :" -"issue:`17853`.)" +"uses of :ref:`__prepare__ `. (Contributed by Benjamin Peterson " +"in :issue:`17853`.)" msgstr "" +"新しい命令コード :opcode:`!LOAD_CLASSDEREF` が追加されました。\n" +"これは :ref:`__prepare__ ` のある種の使い方で起こりうる、クラス本体" +"内の自由変数のロードでのバグを修正するために導入されました。\n" +"(Contributed by Benjamin Peterson in :issue:`17853`.)" #: ../../whatsnew/3.4.rst:1987 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " -"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" -"issue:`18520`)." +"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool " +"(:issue:`18408`, :issue:`18520`)." msgstr "" "Victor Stinner が、彼の :pep:`445` ベースの ``pyfailmalloc`` ツールを用いて数" -"多くのメモリエラー関連のクラッシュを特定し、そして修正しました。 (:issue:" -"`18408`, :issue:`18520`)" +"多くのメモリエラー関連のクラッシュを特定し、そして修正しました。 " +"(:issue:`18408`, :issue:`18520`)" #: ../../whatsnew/3.4.rst:1991 msgid "" @@ -3817,20 +4045,20 @@ msgid "" msgstr "" "``pyvenv`` コマンドにはさらに、そうしなければ自動的に仮想環境に pip がブート" "ストラップされてしまうのを抑制するための、 ``--without-pip`` オプションが追加" -"されました。(Contributed by Nick Coghlan in :issue:`19552` as part of the :" -"pep:`453` implementation.)" +"されました。(Contributed by Nick Coghlan in :issue:`19552` as part of " +"the :pep:`453` implementation.)" #: ../../whatsnew/3.4.rst:2000 msgid "" -"The encoding name is now optional in the value set for the :envvar:" -"`PYTHONIOENCODING` environment variable. This makes it possible to set just " -"the error handler, without changing the default encoding. (Contributed by " -"Serhiy Storchaka in :issue:`18818`.)" +"The encoding name is now optional in the value set for " +"the :envvar:`PYTHONIOENCODING` environment variable. This makes it possible " +"to set just the error handler, without changing the default encoding. " +"(Contributed by Serhiy Storchaka in :issue:`18818`.)" msgstr "" "環境変数 :envvar:`PYTHONIOENCODING` の値内で、エンコーディング名を省略出来る" "ようになりました。つまり、デフォルトエンコーディングを変更することなしにエ" -"ラーハンドラだけをセット出来ます。 (Contributed by Serhiy Storchaka in :" -"issue:`18818`.)" +"ラーハンドラだけをセット出来ます。 (Contributed by Serhiy Storchaka " +"in :issue:`18818`.)" #: ../../whatsnew/3.4.rst:2005 msgid "" @@ -3851,8 +4079,8 @@ msgid "" "The UTF-32 decoder is now 3x to 4x faster. (Contributed by Serhiy Storchaka " "in :issue:`14625`.)" msgstr "" -"UTF-32 デコーダが3-4倍速くなりました。 (Contributed by Serhiy Storchaka in :" -"issue:`14625`.)" +"UTF-32 デコーダが3-4倍速くなりました。 (Contributed by Serhiy Storchaka " +"in :issue:`14625`.)" #: ../../whatsnew/3.4.rst:2016 msgid "" @@ -3873,18 +4101,19 @@ msgstr "" "オープンアドレッシング法のハイブリッドとして説明できます。追加的なリニア検査" "の数はデフォルトでは 9 です。この値は、コンパイル時に LINEAR_PROBES を定義す" "ることで任意の値に変更できます。リニア検査を完全に無効にするには " -"LINEAR_PROBES=0 を設定してください。 (Contributed by Raymond Hettinger in :" -"issue:`18771`.)" +"LINEAR_PROBES=0 を設定してください。 (Contributed by Raymond Hettinger " +"in :issue:`18771`.)" #: ../../whatsnew/3.4.rst:2027 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " -"speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" -"`re`, :mod:`collections` and :mod:`locale` modules and their dependencies " -"are no longer imported by default. The marshal module has been improved to " -"load compiled Python code faster. (Contributed by Antoine Pitrou, Christian " -"Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:" -"`19209`, :issue:`19205` and :issue:`9548`.)" +"speedup. The interpreter loads fewer modules on startup, e.g. " +"the :mod:`re`, :mod:`collections` and :mod:`locale` modules and their " +"dependencies are no longer imported by default. The marshal module has been " +"improved to load compiled Python code faster. (Contributed by Antoine " +"Pitrou, Christian Heimes and Victor Stinner " +"in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` " +"and :issue:`9548`.)" msgstr "" "インタプリタの起動が約 30% 高速化されました。この速度向上は、いくつかの手段に" "よってもたらされました。インタプリタは起動時により少数のモジュールをロードす" @@ -3892,8 +4121,9 @@ msgstr "" "ジュール、およびそれらの依存モジュールは、デフォルトではインポートされませ" "ん。 marshal モジュールは、コンパイルされた Python コードをより高速にロードで" "きるように改善されました。 (Contributed by Antoine Pitrou, Christian Heimes " -"and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:" -"`19205` and :issue:`9548`.)" +"and Victor Stinner " +"in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` " +"and :issue:`9548`.)" #: ../../whatsnew/3.4.rst:2035 msgid "" @@ -3901,9 +4131,9 @@ msgid "" "most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed " "by Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.)" msgstr "" -":class:`bz2.BZ2File` が大半の場合 Python2 のバージョン以上に速くなりました。:" -"class:`lzma.LZMAFile` も最適化されました。(Contributed by Serhiy Storchaka " -"and Nadeem Vawda in :issue:`16034`.)" +":class:`bz2.BZ2File` が大半の場合 Python2 のバージョン以上に速くなりまし" +"た。:class:`lzma.LZMAFile` も最適化されました。(Contributed by Serhiy " +"Storchaka and Nadeem Vawda in :issue:`16034`.)" #: ../../whatsnew/3.4.rst:2039 msgid "" @@ -3920,8 +4150,8 @@ msgid "" "Antoine Pitrou in :issue:`15596`.)" msgstr "" "文字列のストレージ形式を変更したことにより、文字列のピックル化は非常に速くな" -"りました。(Contributed by Victor Stinner and Antoine Pitrou in :issue:" -"`15596`.)" +"りました。(Contributed by Victor Stinner and Antoine Pitrou " +"in :issue:`15596`.)" #: ../../whatsnew/3.4.rst:2046 msgid "" @@ -3936,11 +4166,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:2051 msgid "" -":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" -"issue:`18020`.)" +":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant " +"in :issue:`18020`.)" msgstr "" -":func:`html.escape` が10倍速くなりました。(Contributed by Matt Bryant in :" -"issue:`18020`.)" +":func:`html.escape` が10倍速くなりました。(Contributed by Matt Bryant " +"in :issue:`18020`.)" #: ../../whatsnew/3.4.rst:2054 msgid "" @@ -3952,12 +4182,15 @@ msgstr "" "``VirtualAlloc`` を使うようになりました。人工的なベンチマーク結果は、メモリー" "消費が 3% 減ったことを示しています。" -#: ../../whatsnew/3.4.rst:2058 msgid "" ":func:`os.urandom` now uses a lazily opened persistent file descriptor so as " "to avoid using many file descriptors when run in parallel from multiple " "threads. (Contributed by Antoine Pitrou in :issue:`18756`.)" msgstr "" +":func:`os.urandom` が遅延して開く永続的なファイル記述子を使うようになり、複数" +"スレッドから並列に実行したときに大量のファイル記述子を消費しなくなりまし" +"た。\n" +"(Contributed by Antoine Pitrou in :issue:`18756`.)" #: ../../whatsnew/3.4.rst:2066 msgid "Deprecated" @@ -3967,9 +4200,9 @@ msgstr "非推奨" msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " -"most (but not all) cases, using the deprecated APIs will produce a :exc:" -"`DeprecationWarning` when the interpreter is run with deprecation warnings " -"enabled (for example, by using ``-Wd``)." +"most (but not all) cases, using the deprecated APIs will produce " +"a :exc:`DeprecationWarning` when the interpreter is run with deprecation " +"warnings enabled (for example, by using ``-Wd``)." msgstr "" "このセクションでは、Python 3.4 で非推奨となり Python 3.5 以降で削除予定とな" "る、様々な API とその他機能性についてをカバーします。(全てではありませんが) " @@ -3985,30 +4218,34 @@ msgstr "Python API の非推奨項目" msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " -"replaced by :func:`importlib.util.find_spec`; :meth:`!importlib.machinery." -"PathFinder.find_module` is replaced by :meth:`importlib.machinery.PathFinder." -"find_spec`; :meth:`!importlib.abc.MetaPathFinder.find_module` is replaced " -"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!importlib.abc." -"PathEntryFinder.find_loader` and :meth:`!find_module` are replaced by :meth:" -"`importlib.abc.PathEntryFinder.find_spec`; all of the :samp:`{xxx}Loader` " -"ABC ``load_module`` methods (:meth:`!importlib.abc.Loader.load_module`, :" -"meth:`!importlib.abc.InspectLoader.load_module`, :meth:`!importlib.abc." -"FileLoader.load_module`, :meth:`!importlib.abc.SourceLoader.load_module`) " -"should no longer be implemented, instead loaders should implement an " -"``exec_module`` method (:meth:`importlib.abc.Loader.exec_module`, :meth:" -"`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader." -"exec_module`) and let the import system take care of the rest; and :meth:`!" -"importlib.abc.Loader.module_repr`, :meth:`!importlib.util." -"module_for_loader`, :meth:`!importlib.util.set_loader`, and :meth:`!" -"importlib.util.set_package` are no longer needed because their functions are " -"now handled automatically by the import system." -msgstr "" - -#: ../../whatsnew/3.4.rst:2103 +"replaced by :func:`importlib.util.find_spec`; :meth:`!" +"importlib.machinery.PathFinder.find_module` is replaced " +"by :meth:`importlib.machinery.PathFinder.find_spec`; :meth:`!" +"importlib.abc.MetaPathFinder.find_module` is replaced " +"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` and :meth:`!find_module` are " +"replaced by :meth:`importlib.abc.PathEntryFinder.find_spec`; all of " +"the :samp:`{xxx}Loader` ABC ``load_module`` methods (:meth:`!" +"importlib.abc.Loader.load_module`, :meth:`!" +"importlib.abc.InspectLoader.load_module`, :meth:`!" +"importlib.abc.FileLoader.load_module`, :meth:`!" +"importlib.abc.SourceLoader.load_module`) should no longer be implemented, " +"instead loaders should implement an ``exec_module`` method " +"(:meth:`importlib.abc.Loader.exec_module`, :meth:`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader.exec_module`) " +"and let the import system take care of the rest; and :meth:`!" +"importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.util.module_for_loader`, :meth:`!importlib.util.set_loader`, " +"and :meth:`!importlib.util.set_package` are no longer needed because their " +"functions are now handled automatically by the import system." +msgstr "" + msgid "" "The :mod:`!imp` module is pending deprecation. To keep compatibility with " "Python 2/3 code bases, the module's removal is currently not scheduled." msgstr "" +":mod:`!imp` モジュールは非推奨になる予定です。\n" +"Python 2/3 のコードベースとの互換性を維持するため、現時点でモジュールの削除は" +"予定されていません。" #: ../../whatsnew/3.4.rst:2106 msgid "" @@ -4031,13 +4268,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2113 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " -"as deprecated in its docstring for quite some time. It now emits a :exc:" -"`DeprecationWarning` and will be removed completely in Python 3.5." +"as deprecated in its docstring for quite some time. It now emits " +"a :exc:`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" ":mod:`ftplib` モジュール内の内部クラス ``Netrc`` はずっと長いことそのドキュメ" -"ンテーション文字列内で非推奨であることを謳ってきました。これは今や :exc:" -"`DeprecationWarning` を発行します。Python 3.5 ではこのクラスは完全に削除され" -"ます。" +"ンテーション文字列内で非推奨であることを謳ってきました。これは今" +"や :exc:`DeprecationWarning` を発行します。Python 3.5 ではこのクラスは完全に" +"削除されます。" #: ../../whatsnew/3.4.rst:2117 msgid "" @@ -4058,19 +4295,19 @@ msgstr ":class:`~html.parser.HTMLParser` の *strict* 引数は非推奨です #: ../../whatsnew/3.4.rst:2123 msgid "" -"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." -"writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." -"writePlistToBytes` functions are deprecated in favor of the corresponding " -"new functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:" -"`~plistlib.loads`, and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is " -"deprecated in favor of just using the :class:`bytes` constructor." +"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib.writePlist`, :func:`~plistlib.readPlistFromBytes`, " +"and :func:`~plistlib.writePlistToBytes` functions are deprecated in favor of " +"the corresponding new " +"functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is deprecated in favor " +"of just using the :class:`bytes` constructor." msgstr "" -":mod:`plistlib` モジュールに追加された :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, :func:`~plistlib.dumps` により、対" -"応する :func:`~plistlib.readPlist`, :func:`~plistlib.writePlist`, :func:" -"`~plistlib.readPlistFromBytes`, :func:`~plistlib.writePlistToBytes` が非推奨" -"となりました。同じく単に :class:`bytes` コンストラクタを使えば良いので :func:" -"`~plistlib.Data` が非推奨となりました。" +":mod:`plistlib` モジュールに追加され" +"た :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, :func:`~plistlib.dumps` " +"により、対応す" +"る :func:`~plistlib.readPlist`, :func:`~plistlib.writePlist`, :func:`~plistlib.readPlistFromBytes`, :func:`~plistlib.writePlistToBytes` " +"が非推奨となりました。同じく単に :class:`bytes` コンストラクタを使えば良いの" +"で :func:`~plistlib.Data` が非推奨となりました。" #: ../../whatsnew/3.4.rst:2130 msgid "" @@ -4094,14 +4331,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:2138 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " -"deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." -"XMLParser`. To prepare for the removal of the latter, all arguments to " -"``XMLParser`` should be passed by keyword." +"deprecated, as has the *html* argument " +"of :func:`~xml.etree.ElementTree.XMLParser`. To prepare for the removal of " +"the latter, all arguments to ``XMLParser`` should be passed by keyword." msgstr "" -":func:`xml.etree.ElementTree.iterparse` の *parser* 引数と :func:`~xml.etree." -"ElementTree.XMLParser` の *html* 引数が非推奨となりました。後者は (訳注: 第一" -"引数のため) 削除に備えて ``XMLParser`` への全ての引数はキーワード引数として渡" -"すようにしてください。" +":func:`xml.etree.ElementTree.iterparse` の *parser* 引数" +"と :func:`~xml.etree.ElementTree.XMLParser` の *html* 引数が非推奨となりまし" +"た。後者は (訳注: 第一引数のため) 削除に備えて ``XMLParser`` への全ての引数は" +"キーワード引数として渡すようにしてください。" #: ../../whatsnew/3.4.rst:2145 msgid "Deprecated Features" @@ -4121,8 +4358,8 @@ 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." -"path に加えていましたが、これは非推奨となりました。 (:issue:`19375`)" +"``site`` モジュールは \"site-python\" ディレクトリが存在すればこれを " +"sys.path に加えていましたが、これは非推奨となりました。 (:issue:`19375`)" #: ../../whatsnew/3.4.rst:2156 msgid "Removed" @@ -4152,8 +4389,8 @@ msgstr "" msgid "" "Windows systems where ``COMSPEC`` points to ``command.com`` (:issue:`14470`)." msgstr "" -"``COMSPEC`` が ``command.com`` を指している Windows システム (:issue:" -"`14470`)." +"``COMSPEC`` が ``command.com`` を指している Windows システム " +"(:issue:`14470`)." #: ../../whatsnew/3.4.rst:2168 msgid "VMS (:issue:`16136`)." @@ -4177,10 +4414,10 @@ msgid "" "on what to use instead)." msgstr "" "保守されていなかった ``Misc/TextMate`` と ``Misc/vim`` ディレクトリは削除され" -"ました (代わりに何が使えるかの提案は `devguide `_ をみてください --- 訳注: おそらく `Additional Resources `_ に挙げられている `wiki `_ を指している ---)。" +"ました (代わりに何が使えるかの提案は `devguide `_ をみてください --- 訳注: おそらく `Additional " +"Resources `_ に挙げられて" +"いる `wiki `_ を指している ---)。" #: ../../whatsnew/3.4.rst:2181 msgid "" @@ -4193,8 +4430,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2184 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " -"been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" -"issue:`19199`)." +"been meaningless since Python 3.2, when the \"new GIL\" was introduced " +"(:issue:`19199`)." msgstr "" "``PyThreadState.tick_counter`` フィールドは削除されました。これは Python 3.2 " "で「新しい GIL」が導入された際に意味をなくしていました。 (:issue:`19199`)." @@ -4209,13 +4446,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2191 msgid "" -"The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" -"`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " -"Responses\" are no longer supported." +"The *strict* argument to :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style " +"\"Simple Responses\" are no longer supported." msgstr "" -":class:`~http.client.HTTPConnection` と :class:`~http.client." -"HTTPSConnection` の *strict* 引数は削除されました。 HTTP 0.9 スタイルの " -"「Simple Responses」はもはやサポートされません。" +":class:`~http.client.HTTPConnection` " +"と :class:`~http.client.HTTPSConnection` の *strict* 引数は削除されました。 " +"HTTP 0.9 スタイルの 「Simple Responses」はもはやサポートされません。" #: ../../whatsnew/3.4.rst:2195 msgid "" @@ -4232,8 +4469,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2200 msgid "" -"Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" -"`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" +"Support for loading the deprecated ``TYPE_INT64`` has been removed " +"from :mod:`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" "非推奨の ``TYPE_INT64`` ロードのサポートが :mod:`marshal` から削除されまし" "た。 (Contributed by Dan Riti in :issue:`15480`.)" @@ -4254,8 +4491,8 @@ msgid "" "situation where previously working (but incorrect) code would start failing " "if an object gained a __format__ method, which means that your code may now " "raise a :exc:`TypeError` if you are using an ``'s'`` format code with " -"objects that do not have a __format__ method that handles it. See :issue:" -"`7994` for background." +"objects that do not have a __format__ method that handles it. " +"See :issue:`7994` for background." msgstr "" "object 自身の :meth:`object.__format__` はもはや空でないフォーマット文字列を" "受け付けず、 :exc:`TypeError` を投げます。空でない文字列を渡すことは既に " @@ -4268,22 +4505,22 @@ msgstr "" "グラフの中盤が非常にわかりにくい表現で訳者も意味を取りきれていませんが、おそ" "らく Python 2.6/3.0 で動作していた例えば ``format(1+1j, '10s')`` が Python " "2.7/3.1 で動作しなくなったことを指しているのだと思います。問題にされているの" -"は動作しなくなったことではなくてむしろ動作していたことで、そして object." -"__format__ が return str(self).__format__(fmt) で実現されていること。このコー" -"ドでは fmt は何らの意味も持っていませんので、これは一貫性に欠ける要因である、" -"とのことで、「わかりやすく拒絶する」ことが真意であるようです ---)" +"は動作しなくなったことではなくてむしろ動作していたことで、そして " +"object.__format__ が return str(self).__format__(fmt) で実現されていること。" +"このコードでは fmt は何らの意味も持っていませんので、これは一貫性に欠ける要因" +"である、とのことで、「わかりやすく拒絶する」ことが真意であるようです ---)" #: ../../whatsnew/3.4.rst:2215 msgid "" -":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." -"isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." -"bjunk`` and ``x in sm.bpopular``, where *sm* is a :class:`~difflib." -"SequenceMatcher` object (:issue:`13248`)." +":meth:`difflib.SequenceMatcher.isbjunk` " +"and :meth:`difflib.SequenceMatcher.isbpopular` were deprecated in 3.2, and " +"have now been removed: use ``x in sm.bjunk`` and ``x in sm.bpopular``, where " +"*sm* is a :class:`~difflib.SequenceMatcher` object (:issue:`13248`)." msgstr "" -"Python 3.2 で非推奨となった :meth:`difflib.SequenceMatcher.isbjunk` および :" -"meth:`difflib.SequenceMatcher.isbpopular` は削除されました: *sm* が :class:" -"`~difflib.SequenceMatcher` であるとして、 ``x in sm.bjunk`` と ``x in sm." -"bpopular`` を使うようにしてください。 (:issue:`13248`)" +"Python 3.2 で非推奨となった :meth:`difflib.SequenceMatcher.isbjunk` およ" +"び :meth:`difflib.SequenceMatcher.isbpopular` は削除されました: *sm* " +"が :class:`~difflib.SequenceMatcher` であるとして、 ``x in sm.bjunk`` と ``x " +"in sm.bpopular`` を使うようにしてください。 (:issue:`13248`)" #: ../../whatsnew/3.4.rst:2223 msgid "Code Cleanups" @@ -4304,10 +4541,10 @@ msgid "" "``_mac_ver_gstalt``, and ``_bcd2str``, which would only have ever been " "called on badly broken OSX systems (see :issue:`18393`)." msgstr "" -"ひどく壊れていた OSX システムで呼ばれる可能性があるのみだった :mod:" -"`platform` モジュールの非公開関数 ``_mac_ver_lookup``, ``_mac_ver_gstalt``, " -"``_bcd2str`` とあわせて、非公開かつ実質的に未使用だった ``_gestalt`` モジュー" -"ルが削除されました。 (see :issue:`18393`)" +"ひどく壊れていた OSX システムで呼ばれる可能性があるのみだっ" +"た :mod:`platform` モジュールの非公開関数 ``_mac_ver_lookup``, " +"``_mac_ver_gstalt``, ``_bcd2str`` とあわせて、非公開かつ実質的に未使用だった " +"``_gestalt`` モジュールが削除されました。 (see :issue:`18393`)" #: ../../whatsnew/3.4.rst:2233 msgid "" @@ -4336,20 +4573,20 @@ msgstr "'python' コマンドの挙動の変更" #: ../../whatsnew/3.4.rst:2248 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " -"empty value is equivalent to not setting it at all. However, setting :" -"envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it " -"at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to " -"setting it to ``.``, which leads to confusion when reasoning by analogy to " -"how :envvar:`PATH` works. The behavior now conforms to the posix convention " -"for :envvar:`PATH`." +"empty value is equivalent to not setting it at all. However, " +"setting :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not " +"setting it at all: setting :envvar:`PYTHONPATH` to an empty value was " +"equivalent to setting it to ``.``, which leads to confusion when reasoning " +"by analogy to how :envvar:`PATH` works. The behavior now conforms to the " +"posix convention for :envvar:`PATH`." msgstr "" "POSIX シェルでは、環境変数 :envvar:`PATH` に空の値をセットすることは、何も" "セットしないことと同じです。ところが :envvar:`PYTHONPATH` に空の値をセットす" -"ることは、何もセットしないことと *まったく同じではありませんでした*: :envvar:" -"`PYTHONPATH` に空の値をセットすると、 ``.`` をセットしたのと同じ意味になって" -"いて、これは :envvar:`PATH` での振舞いから類推しようとすると混乱を招くもので" -"した。この振る舞いは :envvar:`PATH` での POSIX の慣習に従うように改められまし" -"た。" +"ることは、何もセットしないことと *まったく同じではありませんでした" +"*: :envvar:`PYTHONPATH` に空の値をセットすると、 ``.`` をセットしたのと同じ意" +"味になっていて、これは :envvar:`PATH` での振舞いから類推しようとすると混乱を" +"招くものでした。この振る舞いは :envvar:`PATH` での POSIX の慣習に従うように改" +"められました。" #: ../../whatsnew/3.4.rst:2256 msgid "" @@ -4367,9 +4604,9 @@ msgid "" "output ``--version`` information to ``stdout`` instead of ``stderr`` (for " "issue list see :ref:`other-improvements-3.4` above)." msgstr "" -":program:`python` コマンドとほとんどの標準ライブラリスクリプト (また :mod:" -"`argparse` も) において、 ``--version`` が情報出力を ``stderr`` ではなく " -"``stdout`` に行うようになりました (issue へのリンクは :ref:`other-" +":program:`python` コマンドとほとんどの標準ライブラリスクリプト (ま" +"た :mod:`argparse` も) において、 ``--version`` が情報出力を ``stderr`` では" +"なく ``stdout`` に行うようになりました (issue へのリンクは :ref:`other-" "improvements-3.4` セクション内参照)。" #: ../../whatsnew/3.4.rst:2266 @@ -4379,25 +4616,32 @@ msgstr "Python API の変更" #: ../../whatsnew/3.4.rst:2268 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " -"exception or return a default value instead of raising :exc:" -"`NotImplementedError` blindly. This will only affect code calling :func:" -"`super` and falling through all the way to the ABCs. For compatibility, " -"catch both :exc:`NotImplementedError` or the appropriate exception as needed." -msgstr "" -":mod:`importlib.abc` 内に定義されている ABC は、無分別に :exc:" -"`NotImplementedError` を投げるのではなく、相応しい例外を投げるかデフォルト値" -"を返すかのどちらかになりました。このことは :func:`super` を呼び出して ABC が" -"するがままに任せているコードにのみ影響します。互換性のために、必要であれば :" -"exc:`NotImplementedError` とその投げられる新たな例外の両方を捕捉してくださ" -"い。" - -#: ../../whatsnew/3.4.rst:2274 -msgid "" -"The module type now initializes the :attr:`~module.__package__` and :attr:" -"`~module.__loader__` attributes to ``None`` by default. To determine if " -"these attributes were set in a backwards-compatible fashion, use e.g. " -"``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" -msgstr "" +"exception or return a default value instead of " +"raising :exc:`NotImplementedError` blindly. This will only affect code " +"calling :func:`super` and falling through all the way to the ABCs. For " +"compatibility, catch both :exc:`NotImplementedError` or the appropriate " +"exception as needed." +msgstr "" +":mod:`importlib.abc` 内に定義されている ABC は、無分別" +"に :exc:`NotImplementedError` を投げるのではなく、相応しい例外を投げるかデ" +"フォルト値を返すかのどちらかになりました。このことは :func:`super` を呼び出し" +"て ABC がするがままに任せているコードにのみ影響します。互換性のために、必要で" +"あれば :exc:`NotImplementedError` とその投げられる新たな例外の両方を捕捉して" +"ください。" + +msgid "" +"The module type now initializes the :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes to ``None`` by default. To " +"determine if these attributes were set in a backwards-compatible fashion, " +"use e.g. ``getattr(module, '__loader__', None) is not None``. " +"(:issue:`17115`.)" +msgstr "" +"モジュール型はデフォルトで :attr:`~module.__package__` " +"と :attr:`~module.__loader__` 属性を ``None`` に初期化するようになりまし" +"た。\n" +"これらの属性が設定されているかを後方互換性のある方法で調べるには、例えば " +"``getattr(module, '__loader__', None) is not None`` を使ってください " +"(:issue:`17115`)。" #: ../../whatsnew/3.4.rst:2280 msgid "" @@ -4417,8 +4661,8 @@ msgstr "" "インポートがリロードの際に無条件に関連属性 (例えば ``__name__``, " "``__loader__``, ``__package__``, ``__file__``, ``__cached__``) をリセットする" "ようになりました。これは、3.3 以前のリロードの際にモジュールを再発見する振る" -"舞いと同じものを復元するものであるということを注記しておきます。 (:issue:" -"`19413`)" +"舞いと同じものを復元するものであるということを注記しておきます。 " +"(:issue:`19413`)" #: ../../whatsnew/3.4.rst:2290 msgid "" @@ -4442,9 +4686,9 @@ msgid "" "incorrect for frozen modules to set the attribute as they are not loaded " "from any explicit location. If you must know that a module comes from frozen " "code then you can see if the module's ``__spec__.location`` is set to " -"``'frozen'``, check if the loader is a subclass of :class:`importlib." -"machinery.FrozenImporter`, or if Python 2 compatibility is necessary you can " -"use :func:`!imp.is_frozen`." +"``'frozen'``, check if the loader is a subclass " +"of :class:`importlib.machinery.FrozenImporter`, or if Python 2 compatibility " +"is necessary you can use :func:`!imp.is_frozen`." msgstr "" #: ../../whatsnew/3.4.rst:2305 @@ -4461,23 +4705,24 @@ msgstr "" #: ../../whatsnew/3.4.rst:2310 msgid "" -":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" -"`ImportError` when the source code being loaded triggers a :exc:" -"`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is meant " -"to be raised only when source code cannot be found but it should, it was " -"felt to be over-reaching/overloading of that meaning when the source code is " -"found but improperly structured. If you were catching ImportError before and " -"wish to continue to ignore syntax or decoding issues, catch all three " -"exceptions now." -msgstr "" -"ソースコードをロードしようとして :exc:`SyntaxError` かもしくは :exc:" -"`UnicodeDecodeError` を引き起こした場合に、 :meth:`importlib.abc." -"SourceLoader.get_source` はそれを :exc:`ImportError` に読み替えて投げることを" -"しなくなりました。 :exc:`ImportError` はそうあるべきなのに見つからない場合に" -"のみ投げられるべきなので、ソースコードが見つかったけれども正しくない構造であ" -"る場合の意味にまで及ぶのは、手を伸ばし過ぎで過負荷です。ImportError を捕捉し" -"ていたコードで今後とも構文エラーとデコーディングの問題を無視したいと望むなら" -"ば、これら 3 つ全ての例外を捕捉するようにしてください。 (訳注: `changeset " +":meth:`importlib.abc.SourceLoader.get_source` no longer " +"raises :exc:`ImportError` when the source code being loaded triggers " +"a :exc:`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is " +"meant to be raised only when source code cannot be found but it should, it " +"was felt to be over-reaching/overloading of that meaning when the source " +"code is found but improperly structured. If you were catching ImportError " +"before and wish to continue to ignore syntax or decoding issues, catch all " +"three exceptions now." +msgstr "" +"ソースコードをロードしようとして :exc:`SyntaxError` かもしく" +"は :exc:`UnicodeDecodeError` を引き起こした場合" +"に、 :meth:`importlib.abc.SourceLoader.get_source` はそれ" +"を :exc:`ImportError` に読み替えて投げることをしなくなりまし" +"た。 :exc:`ImportError` はそうあるべきなのに見つからない場合にのみ投げられる" +"べきなので、ソースコードが見つかったけれども正しくない構造である場合の意味に" +"まで及ぶのは、手を伸ばし過ぎで過負荷です。ImportError を捕捉していたコードで" +"今後とも構文エラーとデコーディングの問題を無視したいと望むならば、これら 3 つ" +"全ての例外を捕捉するようにしてください。 (訳注: `changeset " "84172:e353f64dfd95 `_ )" #: ../../whatsnew/3.4.rst:2319 @@ -4502,21 +4747,22 @@ msgstr "" "注: :issue:`17482`. わかりにくいので実例で。中で適切に @wrap を使うデコレー" "タ @deco1、@deco2 があるとして、my_func をこの両方でデコレートするとします。" "この場合に、Python 3.3 までは ``my_func.__wrapped__.__wrapped__`` が " -"AttributeError になります。今回のこの修正で ``my_func.__wrapped__." -"__wrapped__`` は期待通りに振舞います。 ---)" +"AttributeError になります。今回のこの修正で " +"``my_func.__wrapped__.__wrapped__`` は期待通りに振舞います。 ---)" #: ../../whatsnew/3.4.rst:2329 msgid "" -":func:`inspect.getfullargspec` has been reimplemented on top of :func:" -"`inspect.signature` and hence handles a much wider variety of callable " -"objects than it did in the past. It is expected that additional builtin and " -"extension module callables will gain signature metadata over the course of " -"the Python 3.4 series. Code that assumes that :func:`inspect.getfullargspec` " -"will fail on non-Python callables may need to be adjusted accordingly." +":func:`inspect.getfullargspec` has been reimplemented on top " +"of :func:`inspect.signature` and hence handles a much wider variety of " +"callable objects than it did in the past. It is expected that additional " +"builtin and extension module callables will gain signature metadata over the " +"course of the Python 3.4 series. Code that assumes " +"that :func:`inspect.getfullargspec` will fail on non-Python callables may " +"need to be adjusted accordingly." msgstr "" ":func:`inspect.getfullargspec` は、 :func:`inspect.signature` を前提とした再" "実装がなされました。これにより、かつて扱えていたよりも遥かに広い種類の呼び出" -"し可能 (callable) を扱うようになりました (訳注: 例えば :func:`open` などは " +"し可能 (callable) を扱うようになりました (訳注: 例えば ``open()`` などは " "Python 3.3 までは扱えなかった)。Python 3.4 系列の経過のなかで、追加で組み込み" "や拡張モジュールの callable がシグニチャのメタデータを持つことが期待されてい" "ます。 :func:`inspect.getfullargspec` が非 Python callable で失敗することを前" @@ -4532,8 +4778,8 @@ msgid "" "working directory will also now have an absolute path, including when using " "``-m`` with the interpreter (except for ``__main__.__file__`` when a script " "has been executed directly using a relative path) (Contributed by Brett " -"Cannon in :issue:`18416`). is specified on the command-line) (:issue:" -"`18416`)." +"Cannon in :issue:`18416`). is specified on the command-line) " +"(:issue:`18416`)." msgstr "" ":class:`importlib.machinery.PathFinder` は :data:`sys.path_hooks` 内のオブ" "ジェクトに、空文字列の場合は現在作業ディレクトリを渡すようになりました。結果" @@ -4553,19 +4799,19 @@ msgid "" "keyword. If you've been paying attention to deprecation warnings your code " "should already be specifying any additional arguments via keywords." msgstr "" -":class:`~http.client.HTTPConnection` と :class:`~http.client." -"HTTPSConnection` から *strict* 引数が削除されたことは、残りの引数をキーワード" -"引数としてではなく位置引数として使っていたなら意味が変わってしまいます。非推" -"奨警告に注意を払ってきたのであれば、あなたのコードは既に全てのオプショナル引" -"数をキーワードで渡しているはずです。" +":class:`~http.client.HTTPConnection` " +"と :class:`~http.client.HTTPSConnection` から *strict* 引数が削除されたこと" +"は、残りの引数をキーワード引数としてではなく位置引数として使っていたなら意味" +"が変わってしまいます。非推奨警告に注意を払ってきたのであれば、あなたのコード" +"は既に全てのオプショナル引数をキーワードで渡しているはずです。" #: ../../whatsnew/3.4.rst:2354 msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " "interstitial string would sometimes be ignored. This brings CPython into " -"compliance with the language spec; Jython and PyPy already were. (:issue:" -"`17434`)." +"compliance with the language spec; Jython and PyPy already were. " +"(:issue:`17434`)." msgstr "" "``from __future__ import ...`` ステートメントの間に文字列が含まれる場合に *常" "に* :exc:`SyntaxError` となるようになりました。以前はモジュールの docstring " @@ -4577,86 +4823,94 @@ msgstr "" msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " -"connected, instead of the previous behavior of raising an :exc:" -"`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` will " -"raise a :exc:`ValueError` if the handshake has not yet been done." +"connected, instead of the previous behavior of raising " +"an :exc:`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` " +"will raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" ":meth:`ssl.SSLSocket.getpeercert` と :meth:`ssl.SSLSocket.do_handshake` は、 " "``SSLSocket`` が未接続時に以前は :exc:`AttributeError` を投げていましたが、 " -"``ENOTCONN`` を持った :exc:`OSError` を投げるように改められました。加えて :" -"meth:`~ssl.SSLSocket.getpeercert` はハンドシェイクが未実施の場合に :exc:" -"`ValueError` を投げるようになりました。" +"``ENOTCONN`` を持った :exc:`OSError` を投げるように改められました。加え" +"て :meth:`~ssl.SSLSocket.getpeercert` はハンドシェイクが未実施の場合" +"に :exc:`ValueError` を投げるようになりました。" #: ../../whatsnew/3.4.rst:2366 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " -"This particular :exc:`TypeError` was missed when the other :exc:" -"`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka in :issue:" -"`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." -msgstr "" -":func:`base64.b32decode` が入力文字列が非 b32 文字を含む場合に :exc:" -"`TypeError` ではなく :exc:`binascii.Error` を投げるようになりました。今回のこ" -"の :exc:`TypeError` はほか (訳注: if the input is incorrectly padded のとき) " -"の :exc:`TypeError` が置き換えられた際に置き換え忘れられたものでした。 " -"(Contributed by Serhiy Storchaka in :issue:`18011`.) 注意: この修正は後方互換" -"性を保てないので本来メンテナンスリリースの Python 3.3 には入るべきではなかっ" -"たのですが、不注意で Python 3.3.3 にも行われてしまいました。" - -#: ../../whatsnew/3.4.rst:2373 -msgid "" -"The :attr:`!file` attribute is now automatically closed when the creating :" -"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " -"the file object out separately from the :class:`!cgi.FieldStorage` instance " -"and not keeping the instance alive, then you should either store the entire :" -"class:`!cgi.FieldStorage` instance or read the contents of the file before " -"the :class:`!cgi.FieldStorage` instance is garbage collected." -msgstr "" +"This particular :exc:`TypeError` was missed when the " +"other :exc:`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka " +"in :issue:`18011`.) Note: this change was also inadvertently applied in " +"Python 3.3.3." +msgstr "" +":func:`base64.b32decode` が入力文字列が非 b32 文字を含む場合" +"に :exc:`TypeError` ではなく :exc:`binascii.Error` を投げるようになりました。" +"今回のこの :exc:`TypeError` はほか (訳注: if the input is incorrectly padded " +"のとき) の :exc:`TypeError` が置き換えられた際に置き換え忘れられたものでし" +"た。 (Contributed by Serhiy Storchaka in :issue:`18011`.) 注意: この修正は後" +"方互換性を保てないので本来メンテナンスリリースの Python 3.3 には入るべきでは" +"なかったのですが、不注意で Python 3.3.3 にも行われてしまいました。" + +msgid "" +"The :attr:`!file` attribute is now automatically closed when the " +"creating :class:`!cgi.FieldStorage` instance is garbage collected. If you " +"were pulling the file object out separately from the :class:`!" +"cgi.FieldStorage` instance and not keeping the instance alive, then you " +"should either store the entire :class:`!cgi.FieldStorage` instance or read " +"the contents of the file before the :class:`!cgi.FieldStorage` instance is " +"garbage collected." +msgstr "" +":attr:`!file` 属性は、それを作成した :class:`!cgi.FieldStorage` インスタンス" +"がガベージコレクションされると、自動的に閉じられるようになりました。\n" +":class:`!cgi.FieldStorage` インスタンスからファイルオブジェクトだけを取り出し" +"てインスタンスを生存させていなかった場合は、:class:`!cgi.FieldStorage` インス" +"タンス全体を保持するか、:class:`!cgi.FieldStorage` インスタンスがガベージコレ" +"クションされる前にファイルの内容を読み込んでください。" #: ../../whatsnew/3.4.rst:2380 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " -"informative :exc:`ValueError` rather than the previous more mysterious :exc:" -"`AttributeError` (:issue:`9177`)." +"informative :exc:`ValueError` rather than the previous more " +"mysterious :exc:`AttributeError` (:issue:`9177`)." msgstr "" "クローズ済みの SSL ソケットに対する ``read`` や ``write`` 呼び出しで、以前の" -"ようなミステリアスな :exc:`AttributeError` ではなく、役に立つ :exc:" -"`ValueError` を投げるようになりました。 (:issue:`9177`)" +"ようなミステリアスな :exc:`AttributeError` ではなく、役に立" +"つ :exc:`ValueError` を投げるようになりました。 (:issue:`9177`)" #: ../../whatsnew/3.4.rst:2384 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " -"values. As a consequence of this fix, :meth:`slice.indices` now raises a :" -"exc:`ValueError` if given a negative length; previously it returned nonsense " -"values (:issue:`14794`)." +"values. As a consequence of this fix, :meth:`slice.indices` now raises " +"a :exc:`ValueError` if given a negative length; previously it returned " +"nonsense values (:issue:`14794`)." msgstr "" ":meth:`slice.indices` が巨大な値で :exc:`OverflowError` を起こすことはなくな" -"りました。この修正からの流れで :meth:`slice.indices` は負の値に対して :exc:" -"`ValueError` を投げるようになっています。以前はこれは馬鹿げた値を返していまし" -"た。 (:issue:`14794`)" +"りました。この修正からの流れで :meth:`slice.indices` は負の値に対し" +"て :exc:`ValueError` を投げるようになっています。以前はこれは馬鹿げた値を返し" +"ていました。 (:issue:`14794`)" #: ../../whatsnew/3.4.rst:2389 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " -"special method returned one. This now raises a :exc:`TypeError`. (:issue:" -"`16290`.)" +"special method returned one. This now raises a :exc:`TypeError`. " +"(:issue:`16290`.)" msgstr "" "特殊メソッド ``__complex__`` が複素数ではなく :class:`float` を返す実装をして" -"いるオブジェクトを渡すと :mod:`cmath` 関数ではエラーとなり、 :class:" -"`complex` コンストラクタでは受け容れられていましたが、これはいずれも :exc:" -"`TypeError` となるように改められました。(:issue:`16290`.)" +"いるオブジェクトを渡すと :mod:`cmath` 関数ではエラーとな" +"り、 :class:`complex` コンストラクタでは受け容れられていましたが、これはいず" +"れも :exc:`TypeError` となるように改められました。(:issue:`16290`.)" #: ../../whatsnew/3.4.rst:2394 msgid "" -"The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" -"`float` values for the *base* parameter. It is unlikely anyone was doing " -"this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." +"The :class:`int` constructor in 3.2 and 3.3 erroneously " +"accepts :class:`float` values for the *base* parameter. It is unlikely " +"anyone was doing this, but if so, it will now raise a :exc:`TypeError` " +"(:issue:`16772`)." msgstr "" -"3.2 と 3.3 での :class:`int` コンストラクタが *base* パラメータとして誤って :" -"class:`float` を許容してしまっていました。それをわざわざやっているとも思えな" -"いですが、そうしていたなら今後は :exc:`TypeError` になります。 (:issue:" -"`16772`)" +"3.2 と 3.3 での :class:`int` コンストラクタが *base* パラメータとして誤っ" +"て :class:`float` を許容してしまっていました。それをわざわざやっているとも思" +"えないですが、そうしていたなら今後は :exc:`TypeError` になります。 " +"(:issue:`16772`)" #: ../../whatsnew/3.4.rst:2398 msgid "" @@ -4681,12 +4935,14 @@ msgstr "" "(たとえば、スレッドローカル記憶内に維持されたデータベース接続) が解放されるよ" "うになります。 (:issue:`17094`.)" -#: ../../whatsnew/3.4.rst:2407 msgid "" "Parameter names in ``__annotations__`` dicts are now mangled properly, " "similarly to :attr:`~function.__kwdefaults__`. (Contributed by Yury " "Selivanov in :issue:`20625`.)" msgstr "" +"``__annotations__`` 辞書のパラメータ名が、:attr:`~function.__kwdefaults__` と" +"同様に正しくマングリングされるようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`20625`.)" #: ../../whatsnew/3.4.rst:2411 msgid "" @@ -4698,7 +4954,6 @@ msgstr "" "いくつかの組み込みハッシュが大文字名を持っていましたが、公式インターフェイス" "であることから、命名に一貫性を持たせるようにしました。 (:issue:`18532`)" -#: ../../whatsnew/3.4.rst:2415 msgid "" "Because :mod:`unittest.TestSuite` now drops references to tests after they " "are run, test harnesses that reuse a :class:`~unittest.TestSuite` to re-run " @@ -4707,9 +4962,17 @@ msgid "" "isolation that :mod:`unittest` is designed to provide. However, if the lack " "of isolation is considered acceptable, the old behavior can be restored by " "creating a :mod:`~unittest.TestSuite` subclass that defines a " -"``_removeTestAtIndex`` method that does nothing (see :meth:`.TestSuite." -"__iter__`) (:issue:`11798`)." -msgstr "" +"``_removeTestAtIndex`` method that does nothing " +"(see :meth:`.TestSuite.__iter__`) (:issue:`11798`)." +msgstr "" +":mod:`unittest.TestSuite` がテストの実行後にそのテストへの参照を破棄するよう" +"になったため、:class:`~unittest.TestSuite` を再利用して一連のテストを再実行す" +"るテストハーネスは失敗することがあります。\n" +"このような再利用ではテスト実行間で状態が保持され、:mod:`unittest` が提供する" +"テストの分離を損なうため、行わないでください。\n" +"ただし、分離されなくても問題ない場合は、何もしない ``_removeTestAtIndex`` メ" +"ソッドを定義した :mod:`~unittest.TestSuite` のサブクラスを作ると以前の動作を" +"復元できます (:meth:`.TestSuite.__iter__` を参照) (:issue:`11798`)。" #: ../../whatsnew/3.4.rst:2425 msgid "" @@ -4741,25 +5004,28 @@ msgstr "" "たとえば ``bytearray`` になることに依存していたのであれば、コードを修正する必" "要があります。" -#: ../../whatsnew/3.4.rst:2437 msgid "" ":mod:`!audioop` functions now raise an error immediately if passed string " "input, instead of failing randomly later on (:issue:`16685`)." msgstr "" +":mod:`!audioop` 関数が文字列を入力として渡すと即座にエラーを投げるようにしま" +"した。\n" +"以前は不規則に後々の処理でようやく失敗していました。\n" +"(:issue:`16685`)" #: ../../whatsnew/3.4.rst:2440 msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " "eventually be changed to default to ``True``. It is recommended that you " -"add this keyword, with the appropriate value, to any :class:`~html.parser." -"HTMLParser` calls in your code (:issue:`13633`)." +"add this keyword, with the appropriate value, to " +"any :class:`~html.parser.HTMLParser` calls in your code (:issue:`13633`)." msgstr "" ":class:`~html.parser.HTMLParser` の新規引数 *convert_charrefs* は現在は後方互" "換性維持のために ``False`` をデフォルトとしていますが、最終的には ``True`` が" "デフォルトになります。あなたのコードでは :class:`~html.parser.HTMLParser` の" -"全ての呼び出しでこれをキーワード引数として明示することをお勧めします。 (:" -"issue:`13633`)" +"全ての呼び出しでこれをキーワード引数として明示することをお勧めします。 " +"(:issue:`13633`)" #: ../../whatsnew/3.4.rst:2446 msgid "" @@ -4778,10 +5044,10 @@ msgid "" "deprecated. This key should be replaced by ``EXT_SUFFIX`` or " "``SHLIB_SUFFIX``, depending on the context (:issue:`19555`)." msgstr "" -":func:`sysconfig.get_config_var` にキー ``SO`` を渡すことと :func:`sysconfig." -"get_config_vars` の呼び出し結果から ``SO`` キーを探すことは非推奨です。この" -"キーは文脈依存の ``EXT_SUFFIX`` または ``SHLIB_SUFFIX`` で置き換えられるべき" -"です。 (:issue:`19555`)" +":func:`sysconfig.get_config_var` にキー ``SO`` を渡すこと" +"と :func:`sysconfig.get_config_vars` の呼び出し結果から ``SO`` キーを探すこと" +"は非推奨です。このキーは文脈依存の ``EXT_SUFFIX`` または ``SHLIB_SUFFIX`` で" +"置き換えられるべきです。 (:issue:`19555`)" #: ../../whatsnew/3.4.rst:2455 msgid "" @@ -4789,8 +5055,8 @@ msgid "" "is ineffective in Python3 and will eventually raise an error if used. " "Depending on the function, the equivalent of its old Python2 behavior can be " "achieved using either a *newline* argument, or if necessary by wrapping the " -"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument (:issue:" -"`15204`)." +"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument " +"(:issue:`15204`)." msgstr "" "``open`` 系関数にモード ``U`` を使っていたコードは修正すべきです。 ``U`` は " "Python 3 では無力であり、いずれはこれの使用は例外を投げるようになる予定です。" @@ -4836,17 +5102,17 @@ msgstr "" msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " -"the case that importing :mod:`collections` automatically imports :mod:" -"`collections.abc`. If your program depended on the (undocumented) implicit " -"import, you will need to add an explicit ``import collections.abc`` (:issue:" -"`20784`)." +"the case that importing :mod:`collections` automatically " +"imports :mod:`collections.abc`. If your program depended on the " +"(undocumented) implicit import, you will need to add an explicit ``import " +"collections.abc`` (:issue:`20784`)." msgstr "" ":mod:`collections.abc` モジュールが、Python スタートアップの改善の一環で少々" "リファクタリングが行われました。これの結果として :mod:`collections` は自動" "で :mod:`collections.abc` をインポートしなくなりました。もしもこの (文書化さ" "れていなかった) 暗黙でのインポートに依存していたのであれば、 ``import " -"collections.abc`` として明示的にインポートを追加する必要があります。 (:issue:" -"`20784`)" +"collections.abc`` として明示的にインポートを追加する必要があります。 " +"(:issue:`20784`)" #: ../../whatsnew/3.4.rst:2486 msgid "Changes in the C API" @@ -4854,26 +5120,26 @@ msgstr "C API の変更" #: ../../whatsnew/3.4.rst:2488 msgid "" -":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" -"`PyObject_Str`, along with some other internal C APIs, now include a " -"debugging assertion that ensures they are not used in situations where they " -"may silently discard a currently active exception. In cases where discarding " -"the active exception is expected and desired (for example, because it has " -"already been saved locally with :c:func:`PyErr_Fetch` or is being " -"deliberately replaced with a different exception), an explicit :c:func:" -"`PyErr_Clear` call will be needed to avoid triggering the assertion when " -"invoking these operations (directly or indirectly) and running against a " -"version of Python that is compiled with assertions enabled." -msgstr "" -"いくつかの内部 C API とともに :c:func:`PyEval_EvalFrameEx`, :c:func:" -"`PyObject_Repr`, :c:func:`PyObject_Str` に、現在アクティブな例外を黙殺する状" -"況で使われていないことを確かにするためのデバッグアサーションが仕込まれまし" -"た。アクティブな例外を捨てることが期待されて望ましいケース (たとえば、既に" -"ローカルに :c:func:`PyErr_Fetch` で保存済みであるとか、異なる例外に置き換える" -"ことが意図である場合) は、アサーション有効でコンパイルされている Python バー" -"ジョンで実行して、(直接的・間接的によらず) それら操作呼び出しがそのアサーショ" -"ンを発行するのを、明示的に :c:func:`PyErr_Clear` 呼び出しをすることで潰してく" -"ださい。" +":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, " +"and :c:func:`PyObject_Str`, along with some other internal C APIs, now " +"include a debugging assertion that ensures they are not used in situations " +"where they may silently discard a currently active exception. In cases where " +"discarding the active exception is expected and desired (for example, " +"because it has already been saved locally with :c:func:`PyErr_Fetch` or is " +"being deliberately replaced with a different exception), an " +"explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the " +"assertion when invoking these operations (directly or indirectly) and " +"running against a version of Python that is compiled with assertions enabled." +msgstr "" +"いくつかの内部 C API ととも" +"に :c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, :c:func:`PyObject_Str` " +"に、現在アクティブな例外を黙殺する状況で使われていないことを確かにするための" +"デバッグアサーションが仕込まれました。アクティブな例外を捨てることが期待され" +"て望ましいケース (たとえば、既にローカルに :c:func:`PyErr_Fetch` で保存済みで" +"あるとか、異なる例外に置き換えることが意図である場合) は、アサーション有効で" +"コンパイルされている Python バージョンで実行して、(直接的・間接的によらず) そ" +"れら操作呼び出しがそのアサーションを発行するのを、明示的" +"に :c:func:`PyErr_Clear` 呼び出しをすることで潰してください。" #: ../../whatsnew/3.4.rst:2500 msgid "" @@ -4881,22 +5147,23 @@ msgid "" "argument is not set. Previously only ``NULL`` was returned with no exception " "set." msgstr "" -":c:func:`PyErr_SetImportError` が **msg** がセットされていない場合に :exc:" -"`TypeError` をセットするようになりました。以前は例外をセットすることなく " -"``NULL`` を返すだけでした。" +":c:func:`PyErr_SetImportError` が **msg** がセットされていない場合" +"に :exc:`TypeError` をセットするようになりました。以前は例外をセットすること" +"なく ``NULL`` を返すだけでした。" #: ../../whatsnew/3.4.rst:2504 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " -"be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" -"`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of a string " -"allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` (:issue:" -"`16742`)" +"be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of " +"a string allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` " +"(:issue:`16742`)" msgstr "" ":c:data:`PyOS_ReadlineFunctionPointer` コールバックは、エラー時に ``NULL`` を" "返すか :c:func:`PyMem_RawMalloc` または :c:func:`PyMem_RawRealloc` でアロケー" -"トした文字列を返さなければなりません。 :c:func:`PyMem_Malloc` や :c:func:" -"`PyMem_Realloc` でアロケートした文字列はダメです。 (:issue:`16742`)" +"トした文字列を返さなければなりません。 :c:func:`PyMem_Malloc` " +"や :c:func:`PyMem_Realloc` でアロケートした文字列はダメです。 " +"(:issue:`16742`)" #: ../../whatsnew/3.4.rst:2510 msgid "" @@ -4950,7 +5217,6 @@ msgstr "" "以前の古い振る舞いが必要なアプリケーションでは、代わりとなるコンテキストを渡" "せます::" -#: ../../whatsnew/3.4.rst:2535 msgid "" "import urllib.request\n" "import ssl\n" @@ -4964,3 +5230,14 @@ msgid "" "\n" "urllib.request.urlopen(\"https://invalid-cert\", context=context)" msgstr "" +"import urllib.request\n" +"import ssl\n" +"\n" +"# すべての検証を無効にする\n" +"context = ssl._create_unverified_context()\n" +"\n" +"# ホストに特定の証明書を使うことを許可する。\n" +"# その証明書は信頼ストアに含まれていなくてもよい。\n" +"context = ssl.create_default_context(cafile=\"/path/to/file.crt\")\n" +"\n" +"urllib.request.urlopen(\"https://invalid-cert\", context=context)" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index cc346ba4f..48f9913a7 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 @@ -37,12 +37,15 @@ msgstr "エディタ" msgid "Elvis Pranskevichus , Yury Selivanov " msgstr "Elvis Pranskevichus , Yury Selivanov " -#: ../../whatsnew/3.5.rst:47 msgid "" "This article explains the new features in Python 3.5, compared to 3.4. " "Python 3.5 was released on September 13, 2015. See the `changelog `_ for a full list of changes." msgstr "" +"この記事では 3.4 と比較した Python 3.5 の新機能を解説します。\n" +"Python 3.5 は2015年9月13日にリリースされました。\n" +"全詳細については `変更履歴 `_ をご覧ください。" #: ../../whatsnew/3.5.rst:54 msgid ":pep:`478` - Python 3.5 Release Schedule" @@ -142,15 +145,15 @@ msgstr "CPython の実装の改善:" #: ../../whatsnew/3.5.rst:96 msgid "" -"When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:" -"`sys.stdin` and :py:data:`sys.stdout` now use the ``surrogateescape`` error " -"handler, instead of the ``strict`` error handler. (Contributed by Victor " -"Stinner in :issue:`19977`.)" +"When the ``LC_TYPE`` locale is the POSIX locale (``C`` " +"locale), :py:data:`sys.stdin` and :py:data:`sys.stdout` now use the " +"``surrogateescape`` error handler, instead of the ``strict`` error handler. " +"(Contributed by Victor Stinner in :issue:`19977`.)" msgstr "" -"``LC_TYPE`` ロケールが POSIX ロケール (``C`` ロケール) のとき、 :py:data:" -"`sys.stdin` および :py:data:`sys.stdout` は ``strict`` エラーハンドラではな" -"く ``surrogateescape`` を使うようになりました。 (Contributed by Victor " -"Stinner in :issue:`19977`.)" +"``LC_TYPE`` ロケールが POSIX ロケール (``C`` ロケール) のと" +"き、 :py:data:`sys.stdin` および :py:data:`sys.stdout` は ``strict`` エラーハ" +"ンドラではなく ``surrogateescape`` を使うようになりました。 (Contributed by " +"Victor Stinner in :issue:`19977`.)" #: ../../whatsnew/3.5.rst:101 msgid "" @@ -233,13 +236,14 @@ msgstr "セキュリティの改善:" #: ../../whatsnew/3.5.rst:138 msgid "" "SSLv3 is now disabled throughout the standard library. It can still be " -"enabled by instantiating a :class:`ssl.SSLContext` manually. (See :issue:" -"`22638` for more details; this change was backported to CPython 3.4 and 2.7.)" +"enabled by instantiating a :class:`ssl.SSLContext` manually. " +"(See :issue:`22638` for more details; this change was backported to CPython " +"3.4 and 2.7.)" msgstr "" -"SSLv3 が標準ライブラリ全体を通じて無効化されました。ただし :class:`ssl." -"SSLContext` を手動でインスタンス化することによってなら今でも有効には出来ま" -"す。 (詳細に関しては :issue:`22638` を参照してください。この変更は CPython " -"3.4 と 2.7 にもバックポートされました。)" +"SSLv3 が標準ライブラリ全体を通じて無効化されました。ただ" +"し :class:`ssl.SSLContext` を手動でインスタンス化することによってなら今でも有" +"効には出来ます。 (詳細に関しては :issue:`22638` を参照してください。この変更" +"は CPython 3.4 と 2.7 にもバックポートされました。)" #: ../../whatsnew/3.5.rst:143 msgid "" @@ -247,8 +251,8 @@ msgid "" "injection attacks. (Contributed by Antoine Pitrou in :issue:`22796`.)" msgstr "" "潜在的なインジェクション攻撃からの防御のために、HTTP クッキーの解析がより厳密" -"に行われるようになりました。 (Contributed by Antoine Pitrou in :issue:" -"`22796`.)" +"に行われるようになりました。 (Contributed by Antoine Pitrou " +"in :issue:`22796`.)" #: ../../whatsnew/3.5.rst:148 msgid "Windows improvements:" @@ -306,11 +310,12 @@ msgid "" "Coroutine functions are declared using the new :keyword:`async def` syntax::" msgstr "コルーチン関数は新たな構文 :keyword:`async def` を用いて定義されます:" -#: ../../whatsnew/3.5.rst:178 msgid "" ">>> async def coro():\n" "... return 'spam'" msgstr "" +">>> async def coro():\n" +"... return 'spam'" #: ../../whatsnew/3.5.rst:181 msgid "" @@ -336,7 +341,6 @@ msgstr "" msgid "An example of a rudimentary HTTP client written using the new syntax::" msgstr "新たな構文を用いた初歩的な HTTP クライアントの例です::" -#: ../../whatsnew/3.5.rst:191 msgid "" "import asyncio\n" "\n" @@ -361,6 +365,28 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"\n" +"async def http_get(domain):\n" +" reader, writer = await asyncio.open_connection(domain, 80)\n" +"\n" +" writer.write(b'\\r\\n'.join([\n" +" b'GET / HTTP/1.1',\n" +" b'Host: %b' % domain.encode('latin-1'),\n" +" b'Connection: close',\n" +" b'', b''\n" +" ]))\n" +"\n" +" async for line in reader:\n" +" print('>>>', line)\n" +"\n" +" writer.close()\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"try:\n" +" loop.run_until_complete(http_get('example.com'))\n" +"finally:\n" +" loop.close()" #: ../../whatsnew/3.5.rst:215 msgid "" @@ -370,7 +396,6 @@ msgstr "" "非同期イテレーションと同様に、非同期なコンテキストマネージャの新たな構文があ" "ります。以下のスクリプト::" -#: ../../whatsnew/3.5.rst:218 msgid "" "import asyncio\n" "\n" @@ -389,12 +414,27 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"\n" +"async def coro(name, lock):\n" +" print('coro {}: waiting for lock'.format(name))\n" +" async with lock:\n" +" print('coro {}: holding the lock'.format(name))\n" +" await asyncio.sleep(1)\n" +" print('coro {}: releasing the lock'.format(name))\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"lock = asyncio.Lock()\n" +"coros = asyncio.gather(coro(1, lock), coro(2, lock))\n" +"try:\n" +" loop.run_until_complete(coros)\n" +"finally:\n" +" loop.close()" #: ../../whatsnew/3.5.rst:235 msgid "will output::" msgstr "の出力は::" -#: ../../whatsnew/3.5.rst:237 msgid "" "coro 2: waiting for lock\n" "coro 2: holding the lock\n" @@ -403,6 +443,12 @@ msgid "" "coro 1: holding the lock\n" "coro 1: releasing the lock" msgstr "" +"coro 2: waiting for lock\n" +"coro 2: holding the lock\n" +"coro 1: waiting for lock\n" +"coro 2: releasing the lock\n" +"coro 1: holding the lock\n" +"coro 1: releasing the lock" #: ../../whatsnew/3.5.rst:244 msgid "" @@ -422,9 +468,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:253 msgid "" -"Starting with CPython 3.5.2, ``__aiter__`` can directly return :term:" -"`asynchronous iterators `. Returning an :term:" -"`awaitable` object will result in a :exc:`PendingDeprecationWarning`." +"Starting with CPython 3.5.2, ``__aiter__`` can directly " +"return :term:`asynchronous iterators `. Returning " +"an :term:`awaitable` object will result in " +"a :exc:`PendingDeprecationWarning`." msgstr "" "CPython 3.5.2 以降では、 ``__aiter__`` は :term:`非同期イテレータ " "` を直接返せます。\n" @@ -452,15 +499,16 @@ msgstr "PEP 465 - 行列の乗算専用の中置演算子" msgid "" ":pep:`465` adds the ``@`` infix operator for matrix multiplication. " "Currently, no builtin Python types implement the new operator, however, it " -"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, and :" -"meth:`__imatmul__` for regular, reflected, and in-place matrix " +"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, " +"and :meth:`__imatmul__` for regular, reflected, and in-place matrix " "multiplication. The semantics of these methods is similar to that of " "methods defining other infix arithmetic operators." msgstr "" ":pep:`465` により ``@`` 行列の乗算のための中置演算子が追加されました。\n" -"現在のところ Python の型はこの演算子を実装していませんが、:meth:" -"`__matmul__`、:meth:`__rmatmul__`、:meth:`__imatmul__` (それぞれ通常の乗算、" -"反射した乗算、インプレースの乗算) を定義することで実装することが出来ます。\n" +"現在のところ Python の型はこの演算子を実装していません" +"が、:meth:`__matmul__`、:meth:`__rmatmul__`、:meth:`__imatmul__` (それぞれ通" +"常の乗算、反射した乗算、インプレースの乗算) を定義することで実装することが出" +"来ます。\n" "これらのメソッドのセマンティクスは他の中置算術演算子のものと類似です。 " #: ../../whatsnew/3.5.rst:281 @@ -472,25 +520,24 @@ msgstr "" "行列の乗算は数学、科学、工学の多くの分野では非常に一般的です。\n" "``@`` の追加によりコードをより綺麗に書くことが出来ます::" -#: ../../whatsnew/3.5.rst:285 msgid "S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)" -msgstr "" +msgstr "S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)" #: ../../whatsnew/3.5.rst:287 msgid "instead of::" msgstr "これはたとえば NumPy を使っても、以下のように書く必要がありました::" -#: ../../whatsnew/3.5.rst:289 msgid "" "S = dot((dot(H, beta) - r).T,\n" " dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))" msgstr "" +"S = dot((dot(H, beta) - r).T,\n" +" dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))" #: ../../whatsnew/3.5.rst:292 msgid "NumPy 1.10 has support for the new operator::" msgstr "NumPy 1.10 はこの新たな演算子をサポートしています::" -#: ../../whatsnew/3.5.rst:294 msgid "" ">>> import numpy\n" "\n" @@ -507,6 +554,20 @@ msgid "" ">>> x @ m\n" "array([ 1., 1., 1.])" msgstr "" +">>> import numpy\n" +"\n" +">>> x = numpy.ones(3)\n" +">>> x\n" +"array([ 1., 1., 1.])\n" +"\n" +">>> m = numpy.eye(3)\n" +">>> m\n" +"array([[ 1., 0., 0.],\n" +" [ 0., 1., 0.],\n" +" [ 0., 0., 1.]])\n" +"\n" +">>> x @ m\n" +"array([ 1., 1., 1.])" #: ../../whatsnew/3.5.rst:312 msgid ":pep:`465` -- A dedicated infix operator for matrix multiplication" @@ -530,7 +591,6 @@ msgstr "" "ク演算子の利用方法が拡張されました。\n" ":ref:`関数呼び出し ` で任意の数のアンパックで使えるようになりました::" -#: ../../whatsnew/3.5.rst:325 msgid "" ">>> print(*[1], *[2], 3, *[4, 5])\n" "1 2 3 4 5\n" @@ -542,16 +602,24 @@ msgid "" ">>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})\n" "1 2 3 4" msgstr "" +">>> print(*[1], *[2], 3, *[4, 5])\n" +"1 2 3 4 5\n" +"\n" +">>> def fn(a, b, c, d):\n" +"... print(a, b, c, d)\n" +"...\n" +"\n" +">>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})\n" +"1 2 3 4" #: ../../whatsnew/3.5.rst:335 msgid "" "Similarly, tuple, list, set, and dictionary displays allow multiple " "unpackings (see :ref:`exprlists` and :ref:`dict`)::" msgstr "" -"同様に、タプル、リスト、集合、辞書表現でも複数のアンパックが使えます (:ref:" -"`exprlists` および :ref:`dict` を参照してください)::" +"同様に、タプル、リスト、集合、辞書表現でも複数のアンパックが使えます " +"(:ref:`exprlists` および :ref:`dict` を参照してください)::" -#: ../../whatsnew/3.5.rst:338 msgid "" ">>> *range(4), 4\n" "(0, 1, 2, 3, 4)\n" @@ -565,6 +633,17 @@ msgid "" ">>> {'x': 1, **{'y': 2}}\n" "{'x': 1, 'y': 2}" msgstr "" +">>> *range(4), 4\n" +"(0, 1, 2, 3, 4)\n" +"\n" +">>> [*range(4), 4]\n" +"[0, 1, 2, 3, 4]\n" +"\n" +">>> {*range(4), 4, *(5, 6, 7)}\n" +"{0, 1, 2, 3, 4, 5, 6, 7}\n" +"\n" +">>> {'x': 1, **{'y': 2}}\n" +"{'x': 1, 'y': 2}" #: ../../whatsnew/3.5.rst:352 msgid ":pep:`448` -- Additional Unpacking Generalizations" @@ -609,7 +688,6 @@ msgstr "" msgid "Examples::" msgstr "例::" -#: ../../whatsnew/3.5.rst:375 msgid "" ">>> b'Hello %b!' % b'World'\n" "b'Hello World!'\n" @@ -617,6 +695,11 @@ msgid "" ">>> b'x=%i y=%f' % (1, 2.5)\n" "b'x=1 y=2.500000'" msgstr "" +">>> b'Hello %b!' % b'World'\n" +"b'Hello World!'\n" +"\n" +">>> b'x=%i y=%f' % (1, 2.5)\n" +"b'x=1 y=2.500000'" #: ../../whatsnew/3.5.rst:381 msgid "" @@ -626,7 +709,6 @@ msgstr "" "Unicode に対して ``%b`` は使えませんが、 ``%a`` であれば使えます " "(``repr(obj).encode('ascii', 'backslashreplace')`` と同等)::" -#: ../../whatsnew/3.5.rst:384 msgid "" ">>> b'Hello %b!' % 'World'\n" "Traceback (most recent call last):\n" @@ -637,6 +719,14 @@ msgid "" ">>> b'price: %a' % '10€'\n" "b\"price: '10\\\\u20ac'\"" msgstr "" +">>> b'Hello %b!' % 'World'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: %b requires bytes, or an object that implements __bytes__, not " +"'str'\n" +"\n" +">>> b'price: %a' % '10€'\n" +"b\"price: '10\\\\u20ac'\"" #: ../../whatsnew/3.5.rst:392 msgid "" @@ -664,8 +754,8 @@ msgstr "PEP 484 - 型ヒント" #: ../../whatsnew/3.5.rst:407 msgid "" -"Function annotation syntax has been a Python feature since version 3.0 (:pep:" -"`3107`), however the semantics of annotations has been left undefined." +"Function annotation syntax has been a Python feature since version 3.0 " +"(:pep:`3107`), however the semantics of annotations has been left undefined." msgstr "" "関数アノテーション構文はバージョン 3.0 (:pep:`3107`) から Python の仕様になり" "ましたが、アノテーションのセマンティクスは未定義のままでした。" @@ -682,12 +772,13 @@ msgstr "" "標準ライブラリーが型アノテーションの基本的な定義とツールを持てば、Python ユー" "ザに有益であることは明白となりました。" -#: ../../whatsnew/3.5.rst:415 msgid "" ":pep:`484` introduces a :term:`provisional module ` to " "provide these standard definitions and tools, along with some conventions " "for situations where annotations are not available." msgstr "" +":pep:`484` は、標準的な定義とツールを提供する :term:`暫定モジュール " +"` と、アノテーションを使えない状況での記述方法を導入します。" #: ../../whatsnew/3.5.rst:419 msgid "" @@ -697,29 +788,33 @@ msgstr "" "例えば、こちらは引数と返り値の型がアノテーションで定義されている簡単な関数で" "す::" -#: ../../whatsnew/3.5.rst:422 msgid "" "def greeting(name: str) -> str:\n" " return 'Hello ' + name" msgstr "" +"def greeting(name: str) -> str:\n" +" return 'Hello ' + name" -#: ../../whatsnew/3.5.rst:425 msgid "" -"While these annotations are available at runtime through the usual :attr:" -"`~object.__annotations__` attribute, *no automatic type checking happens at " -"runtime*. Instead, it is assumed that a separate off-line type checker (e." -"g. `mypy `_) will be used for on-demand source code " -"analysis." +"While these annotations are available at runtime through the " +"usual :attr:`~object.__annotations__` attribute, *no automatic type checking " +"happens at runtime*. Instead, it is assumed that a separate off-line type " +"checker (e.g. `mypy `_) will be used for on-demand " +"source code analysis." msgstr "" +"これらのアノテーションは通常の :attr:`~object.__annotations__` 属性を通じて実" +"行時にも取得できますが、*実行時に自動的な型検査が行われることはありません" +"*。\n" +"代わりに、独立したオフラインの型検査ツール (例えば `mypy `_) を使い、必要に応じてソースコードを解析することを想定しています。" -#: ../../whatsnew/3.5.rst:431 msgid "" -"The type system supports unions, generic types, and a special type named :" -"class:`~typing.Any` which is consistent with (i.e. assignable to and from) " -"all types." +"The type system supports unions, generic types, and a special type " +"named :class:`~typing.Any` which is consistent with (i.e. assignable to and " +"from) all types." msgstr "" -"型システムはユニオン、一般型、そして :class:`~typing.Any` という全ての型と互" -"換な (すなわち代入可能) 特殊型をサポートしています。" +"型システムは Union、一般型、そして :class:`~typing.Any` という全ての型と互換" +"な (すなわち代入可能) 特殊型をサポートしています。" #: ../../whatsnew/3.5.rst:437 msgid ":mod:`typing` module documentation" @@ -784,16 +879,18 @@ msgid "" "generally not make an additional system call::" msgstr "" "次の例では、 :func:`os.scandir` を使用して、与えられた *path* 内の先頭が " -"``'.'`` でないすべてのファイル (ディレクトリを除く) を表示します。 :meth:" -"`entry.is_file() ` を呼び出しても、通常は追加のシステム" -"コールは行われません::" +"``'.'`` でないすべてのファイル (ディレクトリを除く) を表示しま" +"す。 :meth:`entry.is_file() ` を呼び出しても、通常は追加" +"のシステムコールは行われません::" -#: ../../whatsnew/3.5.rst:466 msgid "" "for entry in os.scandir(path):\n" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" msgstr "" +"for entry in os.scandir(path):\n" +" if not entry.name.startswith('.') and entry.is_file():\n" +" print(entry.name)" #: ../../whatsnew/3.5.rst:472 msgid "" @@ -810,13 +907,17 @@ msgstr "PEP 著・実装 Ben Hoyt 補佐 Victor Stinner。" msgid "PEP 475: Retry system calls failing with EINTR" msgstr "PEP 475: EINTR で失敗したシステムコールの再試行" -#: ../../whatsnew/3.5.rst:481 msgid "" "An :py:const:`errno.EINTR` error code is returned whenever a system call, " "that is waiting for I/O, is interrupted by a signal. Previously, Python " "would raise :exc:`InterruptedError` in such cases. This meant that, when " "writing a Python application, the developer had two choices:" msgstr "" +"I/O を待機しているシステムコールがシグナルで中断されると、エラーコー" +"ド :py:const:`errno.EINTR` が返されます。\n" +"以前の Python はこのような場合に :exc:`InterruptedError` を送出していまし" +"た。\n" +"そのため Python アプリケーションの開発者には、次の二つの選択肢がありました:" #: ../../whatsnew/3.5.rst:486 msgid "Ignore the ``InterruptedError``." @@ -841,15 +942,13 @@ msgstr "" "下がります。\n" "次の2つを比べてみてください::" -#: ../../whatsnew/3.5.rst:494 msgid "print(\"Hello World\")" -msgstr "" +msgstr "print(\"Hello World\")" #: ../../whatsnew/3.5.rst:496 msgid "and::" msgstr "および::" -#: ../../whatsnew/3.5.rst:498 msgid "" "while True:\n" " try:\n" @@ -858,6 +957,12 @@ msgid "" " except InterruptedError:\n" " continue" msgstr "" +"while True:\n" +" try:\n" +" print(\"Hello World\")\n" +" break\n" +" except InterruptedError:\n" +" continue" #: ../../whatsnew/3.5.rst:505 msgid "" @@ -892,55 +997,46 @@ msgstr ":mod:`faulthandler` モジュールの関数;" #: ../../whatsnew/3.5.rst:519 msgid "" -":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os." -"fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :" -"func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os." -"mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os." -"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :" -"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os." -"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:" -"`~os.write`, :func:`~os.writev`;" +":mod:`os` " +"functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os.posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os.wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:`~os.write`, :func:`~os.writev`;" msgstr "" -":mod:`os` モジュールの関数: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:" -"`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os." -"fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :" -"func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os." -"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :" -"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os." -"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:" -"`~os.write`, :func:`~os.writev`;" +":mod:`os` モジュールの関" +"数: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os.posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os.wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:`~os.write`, :func:`~os.writev`;" -#: ../../whatsnew/3.5.rst:529 msgid "" -"special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:" -"`~errno.EINTR` errors; the syscall is not retried (see the PEP for the " -"rationale);" +"special cases: :func:`os.close` and :func:`os.dup2` now " +"ignore :py:const:`~errno.EINTR` errors; the syscall is not retried (see the " +"PEP for the rationale);" msgstr "" +"特殊ケース: :func:`os.close` と :func:`os.dup2` は :py:const:`~errno.EINTR` " +"エラーを無視するようになりました; そのシステムコールは再試行されません (この" +"論拠については PEP を参照してください);" #: ../../whatsnew/3.5.rst:533 msgid "" -":mod:`select` functions: :func:`devpoll.poll() `, :func:" -"`epoll.poll() `, :func:`kqueue.control() `, :func:`poll.poll() `, :func:`~select.select`;" +":mod:`select` functions: :func:`devpoll.poll() " +"`, :func:`epoll.poll() " +"`, :func:`kqueue.control() " +"`, :func:`poll.poll() " +"`, :func:`~select.select`;" msgstr "" -":mod:`select` モジュール関数: :func:`devpoll.poll() `, :" -"func:`epoll.poll() `, :func:`kqueue.control() `, :func:`poll.poll() `, :func:`~select." -"select`;" +":mod:`select` モジュール関数: :func:`devpoll.poll() " +"`, :func:`epoll.poll() " +"`, :func:`kqueue.control() " +"`, :func:`poll.poll() " +"`, :func:`~select.select`;" #: ../../whatsnew/3.5.rst:538 msgid "" -"methods of the :class:`~socket.socket` class: :meth:`~socket.socket." -"accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :" -"meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket." -"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket." -"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" +"methods of the :class:`~socket.socket` " +"class: :meth:`~socket.socket.accept`, :meth:`~socket.socket.connect` (except " +"for non-blocking " +"sockets), :meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" msgstr "" -":class:`~socket.socket` クラスのメソッド: :meth:`~socket.socket.accept`, :" -"meth:`~socket.socket.connect` (ノンブロッキングソケットを除く), :meth:" -"`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket." -"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket." -"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" +":class:`~socket.socket` クラスのメソッ" +"ド: :meth:`~socket.socket.accept`, :meth:`~socket.socket.connect` (ノンブロッ" +"キングソケットを除" +"く), :meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" #: ../../whatsnew/3.5.rst:545 msgid ":func:`signal.sigtimedwait` and :func:`signal.sigwaitinfo`;" @@ -983,12 +1079,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:567 msgid "" ":pep:`479` changes the behavior of generators: when a ``StopIteration`` " -"exception is raised inside a generator, it is replaced with a :exc:" -"`RuntimeError` before it exits the generator frame. The main goal of this " -"change is to ease debugging in the situation where an unguarded :func:`next` " -"call raises ``StopIteration`` and causes the iteration controlled by the " -"generator to terminate silently. This is particularly pernicious in " -"combination with the ``yield from`` construct." +"exception is raised inside a generator, it is replaced with " +"a :exc:`RuntimeError` before it exits the generator frame. The main goal of " +"this change is to ease debugging in the situation where an " +"unguarded :func:`next` call raises ``StopIteration`` and causes the " +"iteration controlled by the generator to terminate silently. This is " +"particularly pernicious in combination with the ``yield from`` construct." msgstr "" ":pep:`479` によってジェネレータのこの振る舞いが変更されました:\n" "ジェネレータ内部で ``StopIteration`` 例外が送出されたときは、ジェネレータのフ" @@ -1000,13 +1096,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:575 msgid "" -"This is a backwards incompatible change, so to enable the new behavior, a :" -"term:`__future__` import is necessary::" +"This is a backwards incompatible change, so to enable the new behavior, " +"a :term:`__future__` import is necessary::" msgstr "" -"これは後方互換性の無い変更ですので、この新しい振る舞いを有効にするには :term:" -"`__future__` のインポートが必要です::" +"これは後方互換性の無い変更ですので、この新しい振る舞いを有効にするに" +"は :term:`__future__` のインポートが必要です::" -#: ../../whatsnew/3.5.rst:578 msgid "" ">>> from __future__ import generator_stop\n" "\n" @@ -1025,6 +1120,22 @@ msgid "" " File \"\", line 1, in \n" "RuntimeError: generator raised StopIteration" msgstr "" +">>> from __future__ import generator_stop\n" +"\n" +">>> def gen():\n" +"... next(iter([]))\n" +"... yield\n" +"...\n" +">>> next(gen())\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in gen\n" +"StopIteration\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"RuntimeError: generator raised StopIteration" #: ../../whatsnew/3.5.rst:595 msgid "" @@ -1032,9 +1143,9 @@ msgid "" "raised whenever a :exc:`StopIteration` exception is raised inside a " "generator." msgstr "" -"``__future__`` をインポートしておらず、ジェネレータの内部で :exc:" -"`StopIteration` 例外が送出されたときには :exc:`PendingDeprecationWarning` が" -"送出されます。" +"``__future__`` をインポートしておらず、ジェネレータの内部" +"で :exc:`StopIteration` 例外が送出されたときに" +"は :exc:`PendingDeprecationWarning` が送出されます。" #: ../../whatsnew/3.5.rst:600 msgid ":pep:`479` -- Change StopIteration handling inside generators" @@ -1052,7 +1163,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 " @@ -1061,13 +1171,12 @@ msgid "" "the maximum allowed difference between ``isclose`` arguments, relative to " "the larger absolute value::" msgstr "" -":pep:`485` により、2値が互いに近似的に等しいか \"近い\" ことを調べる関数 :" -"func:`math.isclose` 及び :func:`cmath.isclose` が追加されました。\n" -"2値が近いと判断されるかどうかは与えられた絶対及び相対許容差で決まります。 \n" +":pep:`485` により、2値が互いに近似的に等しいか \"近い\" ことを調べる関" +"数 :func:`math.isclose` 及び :func:`cmath.isclose` が追加されました。\n" +"2値が近いと判断されるかどうかは与えられた絶対及び相対許容差で決まります。\n" "相対許容差は ``isclose`` 引数間で許される、絶対値の大きい方に対する最大の差で" "す::" -#: ../../whatsnew/3.5.rst:617 msgid "" ">>> import math\n" ">>> a = 5.0\n" @@ -1077,6 +1186,13 @@ msgid "" ">>> math.isclose(a, b, rel_tol=1e-6)\n" "False" msgstr "" +">>> import math\n" +">>> a = 5.0\n" +">>> b = 4.99998\n" +">>> math.isclose(a, b, rel_tol=1e-5)\n" +"True\n" +">>> math.isclose(a, b, rel_tol=1e-6)\n" +"False" #: ../../whatsnew/3.5.rst:625 msgid "" @@ -1086,7 +1202,6 @@ msgstr "" "2値を絶対許容差で比較することも出来ます。絶対許容差は非負数でなければなりませ" "ん::" -#: ../../whatsnew/3.5.rst:628 msgid "" ">>> import math\n" ">>> a = 5.0\n" @@ -1096,6 +1211,13 @@ msgid "" ">>> math.isclose(a, b, abs_tol=0.00001)\n" "False" msgstr "" +">>> import math\n" +">>> a = 5.0\n" +">>> b = 4.99998\n" +">>> math.isclose(a, b, abs_tol=0.00003)\n" +"True\n" +">>> math.isclose(a, b, abs_tol=0.00001)\n" +"False" #: ../../whatsnew/3.5.rst:638 msgid ":pep:`485` -- A function for testing approximate equality" @@ -1137,15 +1259,15 @@ msgstr "PEP 488: PYO ファイルの廃止" #: ../../whatsnew/3.5.rst:664 msgid "" -":pep:`488` does away with the concept of ``.pyo`` files. This means that ``." -"pyc`` files represent both unoptimized and optimized bytecode. To prevent " +":pep:`488` does away with the concept of ``.pyo`` files. This means that " +"``.pyc`` files represent both unoptimized and optimized bytecode. To prevent " "the need to constantly regenerate bytecode files, ``.pyc`` files now have an " "optional ``opt-`` tag in their name when the bytecode is optimized. This has " "the side-effect of no more bytecode file name clashes when running under " "either :option:`-O` or :option:`-OO`. Consequently, bytecode files generated " -"from :option:`-O`, and :option:`-OO` may now exist simultaneously. :func:" -"`importlib.util.cache_from_source` has an updated API to help with this " -"change." +"from :option:`-O`, and :option:`-OO` may now exist " +"simultaneously. :func:`importlib.util.cache_from_source` has an updated API " +"to help with this change." msgstr "" ":pep:`488` は ``.pyo`` ファイルという概念を廃止しました。\n" "つまり、``.pyc`` ファイルは最適化されていないバイトコードと最適化されたバイト" @@ -1177,9 +1299,9 @@ msgid "" ":pep:`489` updates extension module initialization to take advantage of the " "two step module loading mechanism introduced by :pep:`451` in Python 3.4." msgstr "" -":pep:`489` により拡張モジュールの初期化方式が更新され、 Python 3.4 で :pep:" -"`451` によって導入された2段階でモジュールを読み込む仕組みが活用できるようにな" -"りました。" +":pep:`489` により拡張モジュールの初期化方式が更新され、 Python 3.4 " +"で :pep:`451` によって導入された2段階でモジュールを読み込む仕組みが活用できる" +"ようになりました。" #: ../../whatsnew/3.5.rst:688 msgid "" @@ -1223,8 +1345,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:709 msgid "" -"The :option:`-b` option now affects comparisons of :class:`bytes` with :" -"class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" +"The :option:`-b` option now affects comparisons of :class:`bytes` " +"with :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" msgstr "" ":option:`-b` オプションが :class:`bytes` と :class:`int` の比較に影響するよう" "になりました。 (Contributed by Serhiy Storchaka in :issue:`23681`.)" @@ -1232,8 +1354,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:712 msgid "" "New Kazakh ``kz1048`` and Tajik ``koi8_t`` :ref:`codecs `. (Contributed by Serhiy Storchaka in :issue:`22682` and :issue:" -"`22681`.)" +"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` " +"and :issue:`22681`.)" msgstr "" "新たなカザフ語 ``kz1048`` 及びタジク語 ``koi8_t`` :ref:`コーデックス " "`。 (Contributed by Serhiy Storchaka in :issue:`22682` " @@ -1241,9 +1363,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:715 msgid "" -"Property docstrings are now writable. This is especially useful for :func:" -"`collections.namedtuple` docstrings. (Contributed by Berker Peksag in :issue:" -"`24064`.)" +"Property docstrings are now writable. This is especially useful " +"for :func:`collections.namedtuple` docstrings. (Contributed by Berker Peksag " +"in :issue:`24064`.)" msgstr "" "プロパティのドキュメンテーション文字列が書き込み可能になりました。これは特" "に :func:`collections.namedtuple` のドキュメンテーション文字列で有用です。 " @@ -1265,12 +1387,14 @@ msgstr "新たなモジュール" msgid "typing" msgstr "typing" -#: ../../whatsnew/3.5.rst:729 msgid "" "The new :mod:`typing` :term:`provisional ` module provides " "standard definitions and tools for function type annotations. See :ref:`Type " "Hints ` for more information." msgstr "" +"新しい :term:`暫定 ` モジュール :mod:`typing` は、関数の型ア" +"ノテーションのための標準的な定義とツールを提供します。\n" +"詳しくは :ref:`型ヒント ` を参照してください。" #: ../../whatsnew/3.5.rst:736 msgid "zipapp" @@ -1299,16 +1423,17 @@ msgstr "" "``__main__.py`` ファイルを含む全てのファイルをディレクトリ ``myapp`` に置き、" "次のように実行します:" -#: ../../whatsnew/3.5.rst:747 msgid "" "$ python -m zipapp myapp\n" "$ python myapp.pyz" msgstr "" +"$ python -m zipapp myapp\n" +"$ python myapp.pyz" #: ../../whatsnew/3.5.rst:752 msgid "" -"The module implementation has been contributed by Paul Moore in :issue:" -"`23491`." +"The module implementation has been contributed by Paul Moore " +"in :issue:`23491`." msgstr "モジュールの実装は :issue:`23491` の Paul Moore による貢献です。" #: ../../whatsnew/3.5.rst:757 @@ -1326,10 +1451,10 @@ msgstr "argparse" #: ../../whatsnew/3.5.rst:766 msgid "" -"The :class:`~argparse.ArgumentParser` class now allows disabling :ref:" -"`abbreviated usage ` of long options by setting :ref:" -"`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, Steven " -"Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" +"The :class:`~argparse.ArgumentParser` class now allows " +"disabling :ref:`abbreviated usage ` of long options by " +"setting :ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, " +"Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" msgstr "" ":class:`~argparse.ArgumentParser` クラスは、:ref:`allow_abbrev` を ``False`` " "に設定することでロングオプションの :ref:`短縮使用 ` を無効化" @@ -1340,12 +1465,13 @@ msgstr "" msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.5.rst:775 msgid "" "Since the :mod:`asyncio` module is :term:`provisional `, " -"all changes introduced in Python 3.5 have also been backported to Python 3.4." -"x." +"all changes introduced in Python 3.5 have also been backported to Python " +"3.4.x." msgstr "" +":mod:`asyncio` モジュールは :term:`暫定的 ` なため、Python " +"3.5 で導入されたすべての変更は Python 3.4.x にもバックポートされました。" #: ../../whatsnew/3.5.rst:778 msgid "Notable changes in the :mod:`asyncio` module since Python 3.4.0:" @@ -1353,13 +1479,13 @@ msgstr "Python 3.4.0 以後の :mod:`asyncio` モジュールの重要な変更 #: ../../whatsnew/3.5.rst:780 msgid "" -"New debugging APIs: :meth:`loop.set_debug() ` and :" -"meth:`loop.get_debug() ` methods. (Contributed by " -"Victor Stinner.)" +"New debugging APIs: :meth:`loop.set_debug() ` " +"and :meth:`loop.get_debug() ` methods. (Contributed " +"by Victor Stinner.)" msgstr "" -"新たなデバッグ API: :meth:`loop.set_debug() ` と :" -"meth:`loop.get_debug() ` メソッド。 (Contributed by " -"Victor Stinner.)" +"新たなデバッグ API: :meth:`loop.set_debug() ` " +"と :meth:`loop.get_debug() ` メソッド。 (Contributed " +"by Victor Stinner.)" #: ../../whatsnew/3.5.rst:784 msgid "" @@ -1375,8 +1501,8 @@ msgid "" "the event loop is closed. (Contributed by Victor Stinner in :issue:`21326`.)" msgstr "" "イベントループが閉じているかどうか調べる新たな :meth:`loop.is_closed() " -"` メソッド。 (Contributed by Victor Stinner in :" -"issue:`21326`.)" +"` メソッド。 (Contributed by Victor Stinner " +"in :issue:`21326`.)" #: ../../whatsnew/3.5.rst:791 msgid "" @@ -1389,31 +1515,35 @@ msgstr "" "コルーチンの新しい :class:`~asyncio.Task` を便利に作成しスケジュールするため" "の新たな :meth:`loop.create_task() `。\n" "``create_task`` メソッドは\n" -"コルーチンをタスクにラップする全ての asyncio 関数、たとえば :func:`asyncio." -"wait`, :func:`asyncio.gather`、にも使われます。 (Contributed by Victor " -"Stinner.)" +"コルーチンをタスクにラップする全ての asyncio 関数、たとえ" +"ば :func:`asyncio.wait`, :func:`asyncio.gather`、にも使われます。 " +"(Contributed by Victor Stinner.)" -#: ../../whatsnew/3.5.rst:798 msgid "" -"A new :meth:`transport.get_write_buffer_limits() ` method to inquire for *high-* and *low-* water " -"limits of the flow control. (Contributed by Victor Stinner.)" +"A new :meth:`transport.get_write_buffer_limits() " +"` method to inquire for " +"*high-* and *low-* water limits of the flow control. (Contributed by Victor " +"Stinner.)" msgstr "" +"新しい :meth:`transport.get_write_buffer_limits() " +"` メソッドで、フロー制御の *" +"上限* と *下限* のしきい値を調べられます。\n" +"(Contributed by Victor Stinner.)" #: ../../whatsnew/3.5.rst:803 msgid "" -"The :func:`~asyncio.async` function is deprecated in favor of :func:" -"`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" +"The :func:`~asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" msgstr "" ":func:`~asyncio.async` 関数は :func:`~asyncio.ensure_future` により非推奨にな" "りました。(Contributed by Yury Selivanov.)" #: ../../whatsnew/3.5.rst:807 msgid "" -"New :meth:`loop.set_task_factory() ` and :" -"meth:`loop.get_task_factory() ` methods to " -"customize the task factory that :meth:`loop.create_task() ` method uses. (Contributed by Yury Selivanov.)" +"New :meth:`loop.set_task_factory() ` " +"and :meth:`loop.get_task_factory() ` methods " +"to customize the task factory that :meth:`loop.create_task() " +"` method uses. (Contributed by Yury Selivanov.)" msgstr "" ":meth:`loop.create_task() ` メソッドが使うタスク" "ファクトリーをカスタマイズするための新たな :meth:`loop.set_task_factory() " @@ -1425,14 +1555,14 @@ msgid "" "New :meth:`Queue.join() ` and :meth:`Queue.task_done() " "` queue methods. (Contributed by Victor Stinner.)" msgstr "" -"新たな :meth:`Queue.join() ` および :meth:`Queue." -"task_done() ` キューメソッド。(Contributed by " -"Victor Stinner.)" +"新たな :meth:`Queue.join() ` およ" +"び :meth:`Queue.task_done() ` キューメソッド。" +"(Contributed by Victor Stinner.)" #: ../../whatsnew/3.5.rst:818 msgid "" -"The ``JoinableQueue`` class was removed, in favor of the :class:`asyncio." -"Queue` class. (Contributed by Victor Stinner.)" +"The ``JoinableQueue`` class was removed, in favor of " +"the :class:`asyncio.Queue` class. (Contributed by Victor Stinner.)" msgstr "" "``JoinableQueue`` クラスは :class:`asyncio.Queue` クラスにより削除されまし" "た。 (Contributed by Victor Stinner.)" @@ -1441,41 +1571,48 @@ msgstr "" msgid "Updates in 3.5.1:" msgstr "3.5.1 での変更:" -#: ../../whatsnew/3.5.rst:824 msgid "" "The :func:`~asyncio.ensure_future` function and all functions that use it, " "such as :meth:`loop.run_until_complete() `, " "now accept all kinds of :term:`awaitable objects `. (Contributed " "by Yury Selivanov.)" msgstr "" +":func:`~asyncio.ensure_future` 関数と、 :meth:`loop.run_until_complete() " +"` のようなそれを使っている全ての関数であらゆ" +"る :term:`awaitable オブジェクト ` を受け取れるようになりまし" +"た。\n" +"(Contributed by Yury Selivanov.)" #: ../../whatsnew/3.5.rst:829 msgid "" "New :func:`~asyncio.run_coroutine_threadsafe` function to submit coroutines " "to event loops from other threads. (Contributed by Vincent Michel.)" msgstr "" -"他のスレッドからコルーチンをイベントループに送信するための新たな :func:" -"`~asyncio.run_coroutine_threadsafe` 関数。\n" +"他のスレッドからコルーチンをイベントループに送信するための新た" +"な :func:`~asyncio.run_coroutine_threadsafe` 関数。\n" "(Contributed by Vincent Michel.)" -#: ../../whatsnew/3.5.rst:833 msgid "" "New :meth:`Transport.is_closing() ` method " "to check if the transport is closing or closed. (Contributed by Yury " "Selivanov.)" msgstr "" +"新しい :meth:`Transport.is_closing() ` メ" +"ソッドで、トランスポートが終了処理中または終了済みか確認できます。\n" +"(Contributed by Yury Selivanov.)" -#: ../../whatsnew/3.5.rst:837 msgid "" "The :meth:`loop.create_server() ` method can now " "accept a list of hosts. (Contributed by Yann Sionneau.)" msgstr "" +":meth:`loop.create_server() ` メソッドはホストの" +"リストを受け取れるようになりました。\n" +"(Contributed by Yann Sionneau.)" #: ../../whatsnew/3.5.rst:841 msgid "Updates in 3.5.2:" msgstr "3.5.2 での変更:" -#: ../../whatsnew/3.5.rst:843 msgid "" "New :meth:`loop.create_future() ` method to " "create Future objects. This allows alternative event loop implementations, " @@ -1483,13 +1620,21 @@ msgid "" "faster :class:`asyncio.Future` implementation. (Contributed by Yury " "Selivanov.)" msgstr "" +"Future オブジェクトを作成する :meth:`loop.create_future() " +"` メソッドが追加されました。\n" +"これにより `uvloop `_ などの別のイベン" +"トループ実装が、より高速な :class:`asyncio.Future` 実装を提供できます。\n" +"(Contributed by Yury Selivanov.)" -#: ../../whatsnew/3.5.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() ` method to get the current exception handler. " -"(Contributed by Yury Selivanov.)" +"New :meth:`loop.get_exception_handler() " +"` method to get the current exception " +"handler. (Contributed by Yury Selivanov.)" msgstr "" +"新しい :meth:`loop.get_exception_handler() " +"` メソッドで、現在の例外ハンドラが取得で" +"きるようになりました。\n" +"(Contributed by Yury Selivanov.)" #: ../../whatsnew/3.5.rst:854 msgid "" @@ -1502,20 +1647,26 @@ msgstr "" "れるようになりました。\n" "(Contributed by Mark Korenberg.)" -#: ../../whatsnew/3.5.rst:859 msgid "" -"The :meth:`loop.create_connection() ` and :" -"meth:`loop.create_server() ` methods are " +"The :meth:`loop.create_connection() ` " +"and :meth:`loop.create_server() ` methods are " "optimized to avoid calling the system ``getaddrinfo`` function if the " "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" +":meth:`loop.create_connection() ` メソッドお" +"よび :meth:`loop.create_server() ` メソッドが、ア" +"ドレスが解決済みの場合に、システムの ``getaddrinfo`` 関数を呼び出さないように" +"最適化されました。\n" +"(Contributed by A. Jesse Jiryu Davis.)" -#: ../../whatsnew/3.5.rst:865 msgid "" "The :meth:`loop.sock_connect(sock, address) ` no " "longer requires the *address* to be resolved prior to the call. (Contributed " "by A. Jesse Jiryu Davis.)" msgstr "" +":meth:`loop.sock_connect(sock, address) ` を呼び出" +"す前に *address* を解決しておく必要がなくなりました。\n" +"(Contributed by A. Jesse Jiryu Davis.)" #: ../../whatsnew/3.5.rst:871 msgid "bz2" @@ -1536,11 +1687,13 @@ msgstr "" msgid "cgi" msgstr "cgi" -#: ../../whatsnew/3.5.rst:881 msgid "" "The :class:`!FieldStorage` class now supports the :term:`context manager` " "protocol. (Contributed by Berker Peksag in :issue:`20289`.)" msgstr "" +":class:`!FieldStorage` クラスが :term:`context manager` プロトコルに対応しま" +"した。\n" +"(Contributed by Berker Peksag in :issue:`20289`.)" #: ../../whatsnew/3.5.rst:886 msgid "cmath" @@ -1561,14 +1714,14 @@ msgstr "コード" #: ../../whatsnew/3.5.rst:895 msgid "" -"The :func:`InteractiveInterpreter.showtraceback() ` method now prints the full chained " -"traceback, just like the interactive interpreter. (Contributed by Claudiu " -"Popa in :issue:`17442`.)" +"The :func:`InteractiveInterpreter.showtraceback() " +"` method now prints the full " +"chained traceback, just like the interactive interpreter. (Contributed by " +"Claudiu Popa in :issue:`17442`.)" msgstr "" -":func:`InteractiveInterpreter.showtraceback() ` メソッドが、対話的インタープリタのように連なったスタックト" -"レース全体を表示するようになりました。\n" +":func:`InteractiveInterpreter.showtraceback() " +"` メソッドが、対話的インタープリタ" +"のように連なったスタックトレース全体を表示するようになりました。\n" "(Contributed by Claudiu Popa in :issue:`17442`.)" #: ../../whatsnew/3.5.rst:901 @@ -1578,8 +1731,8 @@ msgstr "collections" #: ../../whatsnew/3.5.rst:905 msgid "" "The :class:`~collections.OrderedDict` class is now implemented in C, which " -"makes it 4 to 100 times faster. (Contributed by Eric Snow in :issue:" -"`16991`.)" +"makes it 4 to 100 times faster. (Contributed by Eric Snow " +"in :issue:`16991`.)" msgstr "" ":class:`collections.OrderedDict` が C で実装されました。\n" "これにより 4倍 から 100 倍高速になりました。\n" @@ -1587,29 +1740,32 @@ msgstr "" #: ../../whatsnew/3.5.rst:908 msgid "" -":meth:`OrderedDict.items() `, :meth:" -"`OrderedDict.keys() `, :meth:`OrderedDict." -"values() ` views now support :func:" -"`reversed` iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" -msgstr "" -":meth:`OrderedDict.items() `, :meth:" -"`OrderedDict.keys() `, :meth:`OrderedDict." -"values() ` ビューが :func:`reversed` イテレー" -"ションをサポートしました。\n" +":meth:`OrderedDict.items() " +"`, :meth:`OrderedDict.keys() " +"`, :meth:`OrderedDict.values() " +"` views now support :func:`reversed` " +"iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" +msgstr "" +":meth:`OrderedDict.items() " +"`, :meth:`OrderedDict.keys() " +"`, :meth:`OrderedDict.values() " +"` ビューが :func:`reversed` イテレーションを" +"サポートしました。\n" "(Contributed by Serhiy Storchaka in :issue:`19505`.)" #: ../../whatsnew/3.5.rst:914 msgid "" -"The :class:`~collections.deque` class now defines :meth:`~collections.deque." -"index`, :meth:`~collections.deque.insert`, and :meth:`~collections.deque." -"copy`, and supports the ``+`` and ``*`` operators. This allows deques to be " -"recognized as a :class:`~collections.abc.MutableSequence` and improves their " -"substitutability for lists. (Contributed by Raymond Hettinger in :issue:" -"`23704`.)" -msgstr "" -":class:`~collections.deque` クラスが :meth:`~collections.deque.index`、 :" -"meth:`~collections.deque.insert`、 :meth:`~collections.deque.copy` を定義し、" -"``+`` と ``*`` 演算をサポートしました。\n" +"The :class:`~collections.deque` class now " +"defines :meth:`~collections.deque.index`, :meth:`~collections.deque.insert`, " +"and :meth:`~collections.deque.copy`, and supports the ``+`` and ``*`` " +"operators. This allows deques to be recognized as " +"a :class:`~collections.abc.MutableSequence` and improves their " +"substitutability for lists. (Contributed by Raymond Hettinger " +"in :issue:`23704`.)" +msgstr "" +":class:`~collections.deque` クラス" +"が :meth:`~collections.deque.index`、 :meth:`~collections.deque.insert`、 :meth:`~collections.deque.copy` " +"を定義し、``+`` と ``*`` 演算をサポートしました。\n" "これにより deque インスタンスは :class:`~collections.abc.MutableSequence` と" "認識され、list との代替性が向上しました。\n" "(Contributed by Raymond Hettinger in :issue:`23704`.)" @@ -1621,13 +1777,16 @@ msgstr "" ":func:`~collections.namedtuple` で生成されたドキュメンテーション文字列が更新" "可能となりました::" -#: ../../whatsnew/3.5.rst:923 msgid "" "Point = namedtuple('Point', ['x', 'y'])\n" "Point.__doc__ += ': Cartesian coordinate'\n" "Point.x.__doc__ = 'abscissa'\n" "Point.y.__doc__ = 'ordinate'" msgstr "" +"Point = namedtuple('Point', ['x', 'y'])\n" +"Point.__doc__ += ': Cartesian coordinate'\n" +"Point.x.__doc__ = 'abscissa'\n" +"Point.y.__doc__ = 'ordinate'" #: ../../whatsnew/3.5.rst:928 msgid "(Contributed by Berker Peksag in :issue:`24064`.)" @@ -1635,11 +1794,10 @@ msgstr "(Contributed by Berker Peksag in :issue:`24064`.)" #: ../../whatsnew/3.5.rst:930 msgid "" -"The :class:`~collections.UserString` class now implements the :meth:" -"`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str." -"format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` methods to " -"match the corresponding methods of :class:`str`. (Contributed by Joe Jevnik " -"in :issue:`22189`.)" +"The :class:`~collections.UserString` class now implements " +"the :meth:`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str.format_map`, :meth:`~str.isprintable`, " +"and :meth:`~str.maketrans` methods to match the corresponding methods " +"of :class:`str`. (Contributed by Joe Jevnik in :issue:`22189`.)" msgstr "" #: ../../whatsnew/3.5.rst:938 @@ -1649,9 +1807,9 @@ msgstr "collections.abc" #: ../../whatsnew/3.5.rst:940 msgid "" "The :meth:`Sequence.index() ` method now " -"accepts *start* and *stop* arguments to match the corresponding methods of :" -"class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre in :" -"issue:`23086`.)" +"accepts *start* and *stop* arguments to match the corresponding methods " +"of :class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre " +"in :issue:`23086`.)" msgstr "" #: ../../whatsnew/3.5.rst:945 @@ -1664,87 +1822,110 @@ msgstr "" #: ../../whatsnew/3.5.rst:948 msgid "" -"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc." -"Coroutine`, :class:`~collections.abc.AsyncIterator`, and :class:" -"`~collections.abc.AsyncIterable` abstract base classes. (Contributed by Yury " -"Selivanov in :issue:`24184`.)" +"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc.Coroutine`, :class:`~collections.abc.AsyncIterator`, " +"and :class:`~collections.abc.AsyncIterable` abstract base classes. " +"(Contributed by Yury Selivanov in :issue:`24184`.)" msgstr "" -"新たに :class:`~collections.abc.Awaitable`, :class:`~collections.abc." -"Coroutine`, :class:`~collections.abc.AsyncIterator`, :class:`~collections." -"abc.AsyncIterable` 抽象基底クラスが追加されました。\n" +"新た" +"に :class:`~collections.abc.Awaitable`, :class:`~collections.abc.Coroutine`, :class:`~collections.abc.AsyncIterator`, :class:`~collections.abc.AsyncIterable` " +"抽象基底クラスが追加されました。\n" "(Contributed by Yury Selivanov in :issue:`24184`.)" -#: ../../whatsnew/3.5.rst:953 msgid "" "For earlier Python versions, a backport of the new ABCs is available in an " "external :pypi:`PyPI package `." msgstr "" +"以前の Python バージョン向けには、新しい ABC のバックポートが外部" +"の :pypi:`PyPI パッケージ ` として提供されています。" #: ../../whatsnew/3.5.rst:958 msgid "compileall" msgstr "compileall" -#: ../../whatsnew/3.5.rst:960 msgid "" "A new :mod:`compileall` option, :samp:`-j {N}`, allows running *N* workers " -"simultaneously to perform parallel bytecode compilation. The :func:" -"`~compileall.compile_dir` function has a corresponding ``workers`` " +"simultaneously to perform parallel bytecode compilation. " +"The :func:`~compileall.compile_dir` function has a corresponding ``workers`` " "parameter. (Contributed by Claudiu Popa in :issue:`16104`.)" msgstr "" +":mod:`compileall` の新しいオプション :samp:`-j {N}` を使うと、*N* 個のワー" +"カーを同時に動かしてバイトコードを並列にコンパイルできます。\n" +":func:`~compileall.compile_dir` 関数には対応する ``workers`` パラメータがあり" +"ます。\n" +"(Contributed by Claudiu Popa in :issue:`16104`.)" -#: ../../whatsnew/3.5.rst:965 msgid "" "Another new option, ``-r``, allows controlling the maximum recursion level " "for subdirectories. (Contributed by Claudiu Popa in :issue:`19628`.)" msgstr "" +"もう一つの新しいオプション ``-r`` は、サブディレクトリを再帰的に処理する深さ" +"の上限を制御します。\n" +"(Contributed by Claudiu Popa in :issue:`19628`.)" -#: ../../whatsnew/3.5.rst:968 msgid "" "The ``-q`` command line option can now be specified more than once, in which " "case all output, including errors, will be suppressed. The corresponding " -"``quiet`` parameter in :func:`~compileall.compile_dir`, :func:`~compileall." -"compile_file`, and :func:`~compileall.compile_path` can now accept an " -"integer value indicating the level of output suppression. (Contributed by " -"Thomas Kluyver in :issue:`21338`.)" -msgstr "" +"``quiet`` parameter " +"in :func:`~compileall.compile_dir`, :func:`~compileall.compile_file`, " +"and :func:`~compileall.compile_path` can now accept an integer value " +"indicating the level of output suppression. (Contributed by Thomas Kluyver " +"in :issue:`21338`.)" +msgstr "" +"コマンドラインオプション ``-q`` を複数回指定できるようになりました。\n" +"この場合、エラーも含めたすべての出力を抑制します。\n" +":func:`~compileall.compile_dir`、:func:`~compileall.compile_file`、:func:`~compileall.compile_path` " +"の対応する ``quiet`` パラメータにも、出力抑制のレベルを示す整数値を指定できま" +"す。\n" +"(Contributed by Thomas Kluyver in :issue:`21338`.)" #: ../../whatsnew/3.5.rst:977 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.5.rst:979 msgid "" "The :meth:`Executor.map() ` method now " "accepts a *chunksize* argument to allow batching of tasks to improve " "performance when :meth:`~concurrent.futures.ProcessPoolExecutor` is used. " "(Contributed by Dan O'Reilly in :issue:`11271`.)" msgstr "" +":meth:`Executor.map() ` メソッドに " +"*chunksize* 引数が追加されました。\n" +"タスクをまとめて処理すること" +"で、:meth:`~concurrent.futures.ProcessPoolExecutor` 使用時の性能を向上できま" +"す。\n" +"(Contributed by Dan O'Reilly in :issue:`11271`.)" -#: ../../whatsnew/3.5.rst:984 msgid "" "The number of workers in the :class:`~concurrent.futures.ThreadPoolExecutor` " "constructor is optional now. The default value is 5 times the number of " "CPUs. (Contributed by Claudiu Popa in :issue:`21527`.)" msgstr "" +":class:`~concurrent.futures.ThreadPoolExecutor` のコンストラクタでワーカー数" +"を省略できるようになりました。\n" +"デフォルト値は CPU 数の 5 倍です。\n" +"(Contributed by Claudiu Popa in :issue:`21527`.)" #: ../../whatsnew/3.5.rst:990 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.5.rst:992 msgid "" ":mod:`configparser` now provides a way to customize the conversion of values " -"by specifying a dictionary of converters in the :class:`~configparser." -"ConfigParser` constructor, or by defining them as methods in " -"``ConfigParser`` subclasses. Converters defined in a parser instance are " -"inherited by its section proxies." +"by specifying a dictionary of converters in " +"the :class:`~configparser.ConfigParser` constructor, or by defining them as " +"methods in ``ConfigParser`` subclasses. Converters defined in a parser " +"instance are inherited by its section proxies." msgstr "" +":mod:`configparser` で値の変換方法をカスタマイズできるようになりました。\n" +":class:`~configparser.ConfigParser` のコンストラクタに変換関数の辞書を渡す" +"か、``ConfigParser`` のサブクラスに変換用のメソッドを定義します。\n" +"パーサーのインスタンスに定義した変換関数は、そのセクションプロキシにも引き継" +"がれます。" #: ../../whatsnew/3.5.rst:998 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../whatsnew/3.5.rst:1000 msgid "" ">>> import configparser\n" ">>> conv = {}\n" @@ -1762,6 +1943,21 @@ msgid "" ">>> section.getlist('list')\n" "['a', 'b', 'c', 'd', 'e', 'f', 'g']" msgstr "" +">>> import configparser\n" +">>> conv = {}\n" +">>> conv['list'] = lambda v: [e.strip() for e in v.split() if e.strip()]\n" +">>> cfg = configparser.ConfigParser(converters=conv)\n" +">>> cfg.read_string(\"\"\"\n" +"... [s]\n" +"... list = a b c d e f g\n" +"... \"\"\")\n" +">>> cfg.get('s', 'list')\n" +"'a b c d e f g'\n" +">>> cfg.getlist('s', 'list')\n" +"['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" +">>> section = cfg['s']\n" +">>> section.getlist('list')\n" +"['a', 'b', 'c', 'd', 'e', 'f', 'g']" #: ../../whatsnew/3.5.rst:1016 msgid "(Contributed by Łukasz Langa in :issue:`18159`.)" @@ -1780,10 +1976,9 @@ msgid "" msgstr "" "新規 :term:`context manager` の :func:`contextlib.redirect_stderr` は、ユー" "ティリティスクリプトにて、その出力を :data:`sys.stderr` に書き出す一方でその" -"向き先を変えれない頑固な API の扱いを簡単にしてくれます (:func:`~contextlib." -"redirect_stdout` と対となるものです)。::" +"向き先を変えれない頑固な API の扱いを簡単にしてくれます " +"(:func:`~contextlib.redirect_stdout` と対となるものです)。::" -#: ../../whatsnew/3.5.rst:1027 msgid "" ">>> import contextlib, io, logging\n" ">>> f = io.StringIO()\n" @@ -1793,6 +1988,13 @@ msgid "" ">>> f.getvalue()\n" "'WARNING:root:warning\\n'" msgstr "" +">>> import contextlib, io, logging\n" +">>> f = io.StringIO()\n" +">>> with contextlib.redirect_stderr(f):\n" +"... logging.warning('warning')\n" +"...\n" +">>> f.getvalue()\n" +"'WARNING:root:warning\\n'" #: ../../whatsnew/3.5.rst:1035 msgid "(Contributed by Berker Peksag in :issue:`22389`.)" @@ -1808,8 +2010,8 @@ msgid "" "not just sequences. (Contributed by Serhiy Storchaka in :issue:`23171`.)" msgstr "" ":meth:`~csv.csvwriter.writerow` メソッドは、シーケンスだけでなく、 任意のイテ" -"ラブルをサポートしました。(Contributed by Serhiy Storchaka in :issue:" -"`23171`.)" +"ラブルをサポートしました。(Contributed by Serhiy Storchaka " +"in :issue:`23171`.)" #: ../../whatsnew/3.5.rst:1046 msgid "curses" @@ -1826,50 +2028,64 @@ msgstr "" msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.5.rst:1056 msgid "" ":func:`dumb.open ` always creates a new database when the " -"flag has the value ``\"n\"``. (Contributed by Claudiu Popa in :issue:" -"`18039`.)" +"flag has the value ``\"n\"``. (Contributed by Claudiu Popa " +"in :issue:`18039`.)" msgstr "" +":func:`dumb.open ` は、フラグの値が ``\"n\"`` の場合に常に新し" +"いデータベースを作成するようになりました。\n" +"(Contributed by Claudiu Popa in :issue:`18039`.)" #: ../../whatsnew/3.5.rst:1061 msgid "difflib" msgstr "difflib" -#: ../../whatsnew/3.5.rst:1063 msgid "" "The charset of HTML documents generated by :meth:`HtmlDiff.make_file() " "` can now be customized by using a new *charset* " "keyword-only argument. The default charset of HTML document changed from " -"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag in :issue:" -"`2052`.)" +"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag " +"in :issue:`2052`.)" msgstr "" +":meth:`HtmlDiff.make_file() ` が生成する HTML 文" +"書の文字集合を、新しいキーワード専用引数 *charset* で変更できるようになりまし" +"た。\n" +"HTML 文書のデフォルトの文字集合も ``\"ISO-8859-1\"`` から ``\"utf-8\"`` に変" +"更されました。\n" +"(Contributed by Berker Peksag in :issue:`2052`.)" -#: ../../whatsnew/3.5.rst:1070 msgid "" "The :func:`~difflib.diff_bytes` function can now compare lists of byte " "strings. This fixes a regression from Python 2. (Contributed by Terry J. " "Reedy and Greg Ward in :issue:`17445`.)" msgstr "" +":func:`~difflib.diff_bytes` 関数でバイト文字列のリストを比較できるようになり" +"ました。\n" +"これは Python 2 からのリグレッションの修正です。\n" +"(Contributed by Terry J. Reedy and Greg Ward in :issue:`17445`.)" #: ../../whatsnew/3.5.rst:1076 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.5.rst:1078 msgid "" "Both the ``build`` and ``build_ext`` commands now accept a ``-j`` option to " "enable parallel building of extension modules. (Contributed by Antoine " "Pitrou in :issue:`5309`.)" msgstr "" +"``build`` と ``build_ext`` の両コマンドに ``-j`` オプションが追加され、拡張モ" +"ジュールを並列にビルドできるようになりました。\n" +"(Contributed by Antoine Pitrou in :issue:`5309`.)" -#: ../../whatsnew/3.5.rst:1082 msgid "" "The ``distutils`` module now supports ``xz`` compression, and can be enabled " "by passing ``xztar`` as an argument to ``bdist --format``. (Contributed by " "Serhiy Storchaka in :issue:`16314`.)" msgstr "" +"``distutils`` モジュールが ``xz`` 圧縮に対応しました。\n" +"``bdist --format`` の引数に ``xztar`` を渡すと有効になります。\n" +"(Contributed by Serhiy Storchaka in :issue:`16314`.)" #: ../../whatsnew/3.5.rst:1088 msgid "doctest" @@ -1877,52 +2093,71 @@ msgstr "doctest" #: ../../whatsnew/3.5.rst:1090 msgid "" -"The :func:`~doctest.DocTestSuite` function returns an empty :class:`unittest." -"TestSuite` if *module* contains no docstrings, instead of raising :exc:" -"`ValueError`. (Contributed by Glenn Jones in :issue:`15916`.)" +"The :func:`~doctest.DocTestSuite` function returns an " +"empty :class:`unittest.TestSuite` if *module* contains no docstrings, " +"instead of raising :exc:`ValueError`. (Contributed by Glenn Jones " +"in :issue:`15916`.)" msgstr "" ":func:`~doctest.DocTestSuite` 関数が、 *module* がドキュメンテーション文字列" -"(docstrings)を含まない場合に :exc:`ValueError` を送出するのではなく空の :" -"class:`unittest.TestSuite` を返すようになりました。 (Contributed by Glenn " -"Jones in :issue:`15916`.)" +"(docstrings)を含まない場合に :exc:`ValueError` を送出するのではなく空" +"の :class:`unittest.TestSuite` を返すようになりました。 (Contributed by " +"Glenn Jones in :issue:`15916`.)" #: ../../whatsnew/3.5.rst:1096 msgid "email" msgstr "email" -#: ../../whatsnew/3.5.rst:1098 msgid "" -"A new policy option :attr:`Policy.mangle_from_ ` controls whether or not lines that start with ``\"From \"`` " -"in email bodies are prefixed with a ``\">\"`` character by generators. The " -"default is ``True`` for :attr:`~email.policy.compat32` and ``False`` for all " -"other policies. (Contributed by Milan Oberkirch in :issue:`20098`.)" +"A new policy option :attr:`Policy.mangle_from_ " +"` controls whether or not lines that start " +"with ``\"From \"`` in email bodies are prefixed with a ``\">\"`` character " +"by generators. The default is ``True`` for :attr:`~email.policy.compat32` " +"and ``False`` for all other policies. (Contributed by Milan Oberkirch " +"in :issue:`20098`.)" msgstr "" +"新しいポリシーオプション :attr:`Policy.mangle_from_ " +"` は、メール本文で ``\"From \"`` から始まる" +"行の先頭にジェネレータが ``\">\"`` を付けるかどうかを制御します。\n" +"デフォルトは :attr:`~email.policy.compat32` では ``True``、それ以外のすべての" +"ポリシーでは ``False`` です。\n" +"(Contributed by Milan Oberkirch in :issue:`20098`.)" -#: ../../whatsnew/3.5.rst:1104 msgid "" -"A new :meth:`Message.get_content_disposition() ` method provides easy access to a canonical value " -"for the :mailheader:`Content-Disposition` header. (Contributed by Abhilash " -"Raj in :issue:`21083`.)" +"A new :meth:`Message.get_content_disposition() " +"` method provides easy access " +"to a canonical value for the :mailheader:`Content-Disposition` header. " +"(Contributed by Abhilash Raj in :issue:`21083`.)" msgstr "" +"新しい :meth:`Message.get_content_disposition() " +"` メソッド" +"で、:mailheader:`Content-Disposition` ヘッダーの正規化された値を簡単に取得で" +"きます。\n" +"(Contributed by Abhilash Raj in :issue:`21083`.)" -#: ../../whatsnew/3.5.rst:1110 msgid "" "A new policy option :attr:`EmailPolicy.utf8 ` " "can be set to ``True`` to encode email headers using the UTF-8 charset " "instead of using encoded words. This allows ``Messages`` to be formatted " -"according to :rfc:`6532` and used with an SMTP server that supports the :rfc:" -"`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:" -"`24211`.)" +"according to :rfc:`6532` and used with an SMTP server that supports " +"the :rfc:`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray " +"in :issue:`24211`.)" msgstr "" +"新しいポリシーオプション :attr:`EmailPolicy.utf8 " +"` を ``True`` に設定すると、メールヘッダーを " +"encoded-word ではなく UTF-8 文字集合でエンコードできます。\n" +"これにより ``Messages`` を :rfc:`6532` に従って書式化し、:rfc:`6531` の " +"``SMTPUTF8`` 拡張をサポートする SMTP サーバーで使えます。\n" +"(Contributed by R. David Murray in :issue:`24211`.)" -#: ../../whatsnew/3.5.rst:1117 msgid "" "The :class:`mime.text.MIMEText ` constructor now " "accepts a :class:`charset.Charset ` instance. " "(Contributed by Claude Paroz and Berker Peksag in :issue:`16324`.)" msgstr "" +":class:`mime.text.MIMEText ` のコンストラクタ" +"が :class:`charset.Charset ` インスタンスを受け付ける" +"ようになりました。\n" +"(Contributed by Claude Paroz and Berker Peksag in :issue:`16324`.)" #: ../../whatsnew/3.5.rst:1123 msgid "enum" @@ -1936,7 +2171,6 @@ msgstr "" ":class:`~enum.Enum` 呼び出し可能オブジェクトは、*names* のみが与えられた場合" "に enum 値の初期値を指定する新たな引数 *start* を持ちます::" -#: ../../whatsnew/3.5.rst:1128 msgid "" ">>> Animal = enum.Enum('Animal', 'cat dog', start=10)\n" ">>> Animal.cat\n" @@ -1944,6 +2178,11 @@ msgid "" ">>> Animal.dog\n" "" msgstr "" +">>> Animal = enum.Enum('Animal', 'cat dog', start=10)\n" +">>> Animal.cat\n" +"\n" +">>> Animal.dog\n" +"" #: ../../whatsnew/3.5.rst:1134 msgid "(Contributed by Ethan Furman in :issue:`21706`.)" @@ -1955,13 +2194,13 @@ msgstr "faulthandler" #: ../../whatsnew/3.5.rst:1140 msgid "" -"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" -"`~faulthandler.dump_traceback` and :func:`~faulthandler." -"dump_traceback_later` functions now accept file descriptors in addition to " -"file-like objects. (Contributed by Wei Wu in :issue:`23566`.)" +"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.dump_traceback` " +"and :func:`~faulthandler.dump_traceback_later` functions now accept file " +"descriptors in addition to file-like objects. (Contributed by Wei Wu " +"in :issue:`23566`.)" msgstr "" -"関数 :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" -"`~faulthandler.dump_traceback`, :func:`~faulthandler.dump_traceback_later` " +"関" +"数 :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.dump_traceback`, :func:`~faulthandler.dump_traceback_later` " "が、ファイル様オブジェクトだけでなくファイル記述子を受け取るようになりまし" "た。 (Contributed by Wei Wu in :issue:`23566`.)" @@ -2000,26 +2239,29 @@ msgstr "gzip" #: ../../whatsnew/3.5.rst:1168 msgid "" "The *mode* argument of the :class:`~gzip.GzipFile` constructor now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney in :" -"issue:`19222`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney " +"in :issue:`19222`.)" msgstr "" ":class:`~gzip.GzipFile` コンストラクタの *mode* 引数が排他的作成を要求する " -"``\"x\"`` を受け取るようになりました。 (Contributed by Tim Heaney in :issue:" -"`19222`.)" +"``\"x\"`` を受け取るようになりました。 (Contributed by Tim Heaney " +"in :issue:`19222`.)" #: ../../whatsnew/3.5.rst:1174 msgid "heapq" msgstr "heapq" -#: ../../whatsnew/3.5.rst:1176 msgid "" "Element comparison in :func:`~heapq.merge` can now be customized by passing " "a :term:`key function` in a new optional *key* keyword argument, and a new " "optional *reverse* keyword argument can be used to reverse element " "comparison::" msgstr "" +":func:`~heapq.merge` で、省略可能な新しいキーワード引数 *key* に :term:`キー" +"関数 ` を渡すと要素の比較をカスタマイズできるようになりまし" +"た。\n" +"また、省略可能な新しいキーワード引数 *reverse* を使うと比較の順序を逆にできま" +"す。 ::" -#: ../../whatsnew/3.5.rst:1181 msgid "" ">>> import heapq\n" ">>> a = ['9', '777', '55555']\n" @@ -2029,6 +2271,13 @@ msgid "" ">>> list(heapq.merge(reversed(a), reversed(b), key=len, reverse=True))\n" "['55555', '6666', '777', '88', '9']" msgstr "" +">>> import heapq\n" +">>> a = ['9', '777', '55555']\n" +">>> b = ['88', '6666']\n" +">>> list(heapq.merge(a, b, key=len))\n" +"['9', '88', '777', '6666', '55555']\n" +">>> list(heapq.merge(reversed(a), reversed(b), key=len, reverse=True))\n" +"['55555', '6666', '777', '88', '9']" #: ../../whatsnew/3.5.rst:1189 msgid "(Contributed by Raymond Hettinger in :issue:`13742`.)" @@ -2052,17 +2301,23 @@ msgstr "" msgid "http.client" msgstr "http.client" -#: ../../whatsnew/3.5.rst:1203 msgid "" -":meth:`HTTPConnection.getresponse() ` now raises a :exc:`~http.client.RemoteDisconnected` exception " -"when a remote server connection is closed unexpectedly. Additionally, if a :" -"exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " +":meth:`HTTPConnection.getresponse() " +"` now raises " +"a :exc:`~http.client.RemoteDisconnected` exception when a remote server " +"connection is closed unexpectedly. Additionally, if " +"a :exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " "raised, the client socket is now closed automatically, and will reconnect on " "the next request::" msgstr "" +":meth:`HTTPConnection.getresponse() " +"` は、リモートサーバーとの接続が予期" +"せず閉じられると :exc:`~http.client.RemoteDisconnected` を送出するようになり" +"ました。\n" +"また :exc:`ConnectionError` (``RemoteDisconnected`` の基底クラス) が送出され" +"た場合、クライアントソケットが自動的に閉じられ、次のリクエスト時に再接続しま" +"す。 ::" -#: ../../whatsnew/3.5.rst:1210 msgid "" "import http.client\n" "conn = http.client.HTTPConnection('www.python.org')\n" @@ -2073,6 +2328,14 @@ msgid "" " except http.client.RemoteDisconnected:\n" " pass" msgstr "" +"import http.client\n" +"conn = http.client.HTTPConnection('www.python.org')\n" +"for retries in range(3):\n" +" try:\n" +" conn.request('GET', '/')\n" +" resp = conn.getresponse()\n" +" except http.client.RemoteDisconnected:\n" +" pass" #: ../../whatsnew/3.5.rst:1219 msgid "(Contributed by Martin Panter in :issue:`3566`.)" @@ -2085,10 +2348,10 @@ msgstr "idlelib と IDLE" #: ../../whatsnew/3.5.rst:1225 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :" -"file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0, as " -"well as changes made in future 3.5.x releases. This file is also available " -"from the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.4.0, as well as changes made in future 3.5.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" "idlelib は IDLE シェルとエディタを実装するものであってほかのプログラムからイ" "ンポートされることを意図してはいないので、改善は毎度のリリースごとに行われま" @@ -2112,56 +2375,73 @@ msgstr "" "マンドがブロックの終了時に自動的に呼び出されます。 (Contributed by Tarek " "Ziadé and Serhiy Storchaka in :issue:`4972`.)" -#: ../../whatsnew/3.5.rst:1240 msgid "" -"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" -"rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() ` method. A new :attr:`IMAP4.utf8_enabled ` attribute tracks whether or not :rfc:`6855` support is " -"enabled. (Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " -"in :issue:`21800`.)" +"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) " +"and :rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() " +"` method. A new :attr:`IMAP4.utf8_enabled " +"` attribute tracks whether or not :rfc:`6855` " +"support is enabled. (Contributed by Milan Oberkirch, R. David Murray, and " +"Maciej Szulik in :issue:`21800`.)" msgstr "" +":mod:`imaplib` モジュールが :meth:`IMAP4.enable() ` メ" +"ソッドを通じて :rfc:`5161` (ENABLE 拡張) と :rfc:`6855` (UTF-8 サポート) に対" +"応しました。\n" +"新しい :attr:`IMAP4.utf8_enabled ` 属性" +"は :rfc:`6855` のサポートが有効かどうかを示します。\n" +"(Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " +"in :issue:`21800`.)" -#: ../../whatsnew/3.5.rst:1247 msgid "" "The :mod:`imaplib` module now automatically encodes non-ASCII string " "usernames and passwords using UTF-8, as recommended by the RFCs. " "(Contributed by Milan Oberkirch in :issue:`21800`.)" msgstr "" +":mod:`imaplib` モジュールは RFC の推奨に従い、非 ASCII 文字を含むユーザー名と" +"パスワードを自動的に UTF-8 でエンコードするようになりました。\n" +"(Contributed by Milan Oberkirch in :issue:`21800`.)" #: ../../whatsnew/3.5.rst:1253 msgid "imghdr" msgstr "imghdr" -#: ../../whatsnew/3.5.rst:1255 msgid "" -"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" -"`20295`), and the `WebP `_ format " -"(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" +"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa " +"in :issue:`20295`), and the `WebP `_ " +"format (contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" +":func:`!what` 関数が `OpenEXR `_ 形式 (Martin " +"Vignali と Claudiu Popa による貢献、:issue:`20295`) と `WebP `_ 形式 (Fabrice Aneche と Claudiu Popa による貢" +"献、:issue:`20197`) を認識するようになりました。" #: ../../whatsnew/3.5.rst:1263 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.5.rst:1265 msgid "" "The :class:`util.LazyLoader ` class allows for " "lazy loading of modules in applications where startup time is important. " "(Contributed by Brett Cannon in :issue:`17621`.)" msgstr "" +":class:`util.LazyLoader ` クラスは、起動時間が重要" +"なアプリケーションでモジュールの遅延読み込みを可能にします。\n" +"(Contributed by Brett Cannon in :issue:`17621`.)" -#: ../../whatsnew/3.5.rst:1269 msgid "" -"The :func:`abc.InspectLoader.source_to_code() ` method is now a static method. This makes it easier to " -"initialize a module object with code compiled from a string by running " -"``exec(code, module.__dict__)``. (Contributed by Brett Cannon in :issue:" -"`21156`.)" +"The :func:`abc.InspectLoader.source_to_code() " +"` method is now a static " +"method. This makes it easier to initialize a module object with code " +"compiled from a string by running ``exec(code, module.__dict__)``. " +"(Contributed by Brett Cannon in :issue:`21156`.)" msgstr "" +":func:`abc.InspectLoader.source_to_code() " +"` メソッドが静的メソッドになりま" +"した。\n" +"これにより ``exec(code, module.__dict__)`` を実行し、文字列からコンパイルした" +"コードでモジュールオブジェクトを簡単に初期化できます。\n" +"(Contributed by Brett Cannon in :issue:`21156`.)" -#: ../../whatsnew/3.5.rst:1275 msgid "" "The new :func:`util.module_from_spec() ` " "function is now the preferred way to create a new module. As opposed to " @@ -2169,26 +2449,34 @@ msgid "" "will set the various import-controlled attributes based on the passed-in " "spec object. (Contributed by Brett Cannon in :issue:`20383`.)" msgstr "" +"新しいモジュールを作成するには、新しい :func:`util.module_from_spec() " +"` 関数を使うことが推奨されます。\n" +":class:`types.ModuleType` インスタンスを直接作成する場合と異なり、渡された " +"spec オブジェクトに基づいてインポート機構が管理する各属性を設定します。\n" +"(Contributed by Brett Cannon in :issue:`20383`.)" #: ../../whatsnew/3.5.rst:1283 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.5.rst:1285 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " -"are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" -"`20726` and :issue:`20334`.)" +"are now picklable and hashable. (Contributed by Yury Selivanov " +"in :issue:`20726` and :issue:`20334`.)" msgstr "" +":class:`~inspect.Signature` と :class:`~inspect.Parameter` の両クラスが " +"pickle 化可能かつハッシュ可能になりました。\n" +"(Contributed by Yury Selivanov in :issue:`20726` and :issue:`20334`.)" -#: ../../whatsnew/3.5.rst:1289 msgid "" -"A new :meth:`BoundArguments.apply_defaults() ` method provides a way to set default values for missing " -"arguments::" +"A new :meth:`BoundArguments.apply_defaults() " +"` method provides a way to set " +"default values for missing arguments::" msgstr "" +"新しい :meth:`BoundArguments.apply_defaults() " +"` メソッドで、省略された引数にデフォル" +"ト値を設定できます。 ::" -#: ../../whatsnew/3.5.rst:1293 msgid "" ">>> def foo(a, b='ham', *args): pass\n" ">>> ba = inspect.signature(foo).bind('spam')\n" @@ -2196,68 +2484,90 @@ msgid "" ">>> ba.arguments\n" "OrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())])" msgstr "" +">>> def foo(a, b='ham', *args): pass\n" +">>> ba = inspect.signature(foo).bind('spam')\n" +">>> ba.apply_defaults()\n" +">>> ba.arguments\n" +"OrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())])" #: ../../whatsnew/3.5.rst:1299 msgid "(Contributed by Yury Selivanov in :issue:`24190`.)" msgstr "(Contributed by Yury Selivanov in :issue:`24190`.)" -#: ../../whatsnew/3.5.rst:1301 msgid "" -"A new class method :meth:`Signature.from_callable() ` makes subclassing of :class:`~inspect.Signature` easier. " -"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" +"A new class method :meth:`Signature.from_callable() " +"` makes subclassing " +"of :class:`~inspect.Signature` easier. (Contributed by Yury Selivanov and " +"Eric Snow in :issue:`17373`.)" msgstr "" +"新しいクラスメソッド :meth:`Signature.from_callable() " +"` により、:class:`~inspect.Signature` のサブ" +"クラスを作成しやすくなりました。\n" +"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" -#: ../../whatsnew/3.5.rst:1306 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " -"following of ``__wrapped__`` links. (Contributed by Yury Selivanov in :issue:" -"`20691`.)" +"following of ``__wrapped__`` links. (Contributed by Yury Selivanov " +"in :issue:`20691`.)" msgstr "" +":func:`~inspect.signature` 関数に省略可能なキーワード引数 *follow_wrapped* が" +"追加されました。\n" +"``False`` にすると ``__wrapped__`` リンクを自動的にたどらなくなります。\n" +"(Contributed by Yury Selivanov in :issue:`20691`.)" -#: ../../whatsnew/3.5.rst:1311 msgid "" "A set of new functions to inspect :term:`coroutine functions ` and :term:`coroutine objects ` has been added: :func:" -"`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:" -"`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, and :func:" -"`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov in :issue:" -"`24017` and :issue:`24400`.)" +"function>` and :term:`coroutine objects ` has been " +"added: :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, " +"and :func:`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov " +"in :issue:`24017` and :issue:`24400`.)" msgstr "" +":term:`コルーチン関数 ` と :term:`コルーチンオブジェクト " +"` を調べる新しい関" +"数 :func:`~inspect.iscoroutine`、:func:`~inspect.iscoroutinefunction`、:func:`~inspect.isawaitable`、:func:`~inspect.getcoroutinelocals`、:func:`~inspect.getcoroutinestate` " +"が追加されました。\n" +"(Contributed by Yury Selivanov in :issue:`24017` and :issue:`24400`.)" -#: ../../whatsnew/3.5.rst:1319 msgid "" -"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." -"getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " -"list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" +"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.getouterframes`, " +"and :func:`~inspect.getinnerframes` functions now return a list of named " +"tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" +":func:`~inspect.stack`、:func:`~inspect.trace`、:func:`~inspect.getouterframes`、:func:`~inspect.getinnerframes` " +"関数が名前付きタプルのリストを返すようになりました。\n" +"(Contributed by Daniel Shahaf in :issue:`16808`.)" #: ../../whatsnew/3.5.rst:1326 msgid "io" msgstr "io" -#: ../../whatsnew/3.5.rst:1328 msgid "" "A new :meth:`BufferedIOBase.readinto1() ` " -"method, that uses at most one call to the underlying raw stream's :meth:" -"`RawIOBase.read() ` or :meth:`RawIOBase.readinto() ` methods. (Contributed by Nikolaus Rath in :issue:" -"`20578`.)" +"method, that uses at most one call to the underlying raw " +"stream's :meth:`RawIOBase.read() ` " +"or :meth:`RawIOBase.readinto() ` methods. " +"(Contributed by Nikolaus Rath in :issue:`20578`.)" msgstr "" +"新しい :meth:`BufferedIOBase.readinto1() ` メ" +"ソッドは、下位の raw ストリームの :meth:`RawIOBase.read() " +"` または :meth:`RawIOBase.readinto() " +"` メソッドを最大 1 回呼び出します。\n" +"(Contributed by Nikolaus Rath in :issue:`20578`.)" #: ../../whatsnew/3.5.rst:1336 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.5.rst:1338 msgid "" "Both the :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " "classes now accept an ``(address, netmask)`` tuple argument, so as to easily " "construct network objects from existing addresses::" msgstr "" +":class:`~ipaddress.IPv4Network` と :class:`~ipaddress.IPv6Network` の両クラス" +"が引数に ``(address, netmask)`` タプルを受け付けるようになり、既存のアドレス" +"から簡単にネットワークオブジェクトを作成できます。 ::" -#: ../../whatsnew/3.5.rst:1342 msgid "" ">>> import ipaddress\n" ">>> ipaddress.IPv4Network(('127.0.0.0', 8))\n" @@ -2265,6 +2575,11 @@ msgid "" ">>> ipaddress.IPv4Network(('127.0.0.0', '255.0.0.0'))\n" "IPv4Network('127.0.0.0/8')" msgstr "" +">>> import ipaddress\n" +">>> ipaddress.IPv4Network(('127.0.0.0', 8))\n" +"IPv4Network('127.0.0.0/8')\n" +">>> ipaddress.IPv4Network(('127.0.0.0', '255.0.0.0'))\n" +"IPv4Network('127.0.0.0/8')" #: ../../whatsnew/3.5.rst:1348 msgid "(Contributed by Peter Moody and Antoine Pitrou in :issue:`16531`.)" @@ -2272,12 +2587,11 @@ msgstr "(Contributed by Peter Moody and Antoine Pitrou in :issue:`16531`.)" #: ../../whatsnew/3.5.rst:1350 msgid "" -"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for the :" -"class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes " -"returns the name of the reverse DNS PTR record::" +"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for " +"the :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " +"classes returns the name of the reverse DNS PTR record::" msgstr "" -#: ../../whatsnew/3.5.rst:1354 msgid "" ">>> import ipaddress\n" ">>> addr = ipaddress.IPv4Address('127.0.0.1')\n" @@ -2287,6 +2601,13 @@ msgid "" ">>> addr6.reverse_pointer\n" "'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa'" msgstr "" +">>> import ipaddress\n" +">>> addr = ipaddress.IPv4Address('127.0.0.1')\n" +">>> addr.reverse_pointer\n" +"'1.0.0.127.in-addr.arpa'\n" +">>> addr6 = ipaddress.IPv6Address('::1')\n" +">>> addr6.reverse_pointer\n" +"'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa'" #: ../../whatsnew/3.5.rst:1362 msgid "(Contributed by Leon Weber in :issue:`20480`.)" @@ -2296,26 +2617,31 @@ msgstr "(Contributed by Leon Weber in :issue:`20480`.)" msgid "json" msgstr "json" -#: ../../whatsnew/3.5.rst:1368 msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " -"to sort the keys alphabetically. (Contributed by Berker Peksag in :issue:" -"`21650`.)" +"to sort the keys alphabetically. (Contributed by Berker Peksag " +"in :issue:`21650`.)" msgstr "" +":mod:`json.tool` のコマンドラインインターフェースが、入力された JSON オブジェ" +"クトのキーの順序を保持するようになりました。\n" +"新しい ``--sort-keys`` オプションでキーをアルファベット順に並べ替えられま" +"す。\n" +"(Contributed by Berker Peksag in :issue:`21650`.)" -#: ../../whatsnew/3.5.rst:1373 msgid "" -"JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" -"`ValueError` to provide better context information about the error. " +"JSON decoder now raises :exc:`~json.JSONDecodeError` instead " +"of :exc:`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" +"JSON デコーダーが :exc:`ValueError` の代わりに :exc:`~json.JSONDecodeError` " +"を送出し、エラーの発生箇所について詳しい情報を提供するようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`19361`.)" #: ../../whatsnew/3.5.rst:1379 msgid "linecache" msgstr "linecache" -#: ../../whatsnew/3.5.rst:1381 msgid "" "A new :func:`~linecache.lazycache` function can be used to capture " "information about a non-file-based module to permit getting its lines later " @@ -2323,19 +2649,25 @@ msgid "" "actually needed, without having to carry the module globals around " "indefinitely. (Contributed by Robert Collins in :issue:`17911`.)" msgstr "" +"新しい :func:`~linecache.lazycache` 関数は、ファイルに基づかないモジュールの" +"情報を保存し、後で :func:`~linecache.getline` を使って行を取得できるようにし" +"ます。\n" +"モジュールのグローバル変数をいつまでも保持することなく、実際に行が必要になる" +"まで I/O を行わずに済みます。\n" +"(Contributed by Robert Collins in :issue:`17911`.)" #: ../../whatsnew/3.5.rst:1389 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.5.rst:1391 msgid "" "A new :func:`~locale.delocalize` function can be used to convert a string " "into a normalized number string, taking the ``LC_NUMERIC`` settings into " "account::" msgstr "" +"新しい :func:`~locale.delocalize` 関数を使うと、``LC_NUMERIC`` の設定を考慮し" +"て文字列を正規化された数値文字列に変換できます。 ::" -#: ../../whatsnew/3.5.rst:1394 msgid "" ">>> import locale\n" ">>> locale.setlocale(locale.LC_NUMERIC, 'de_DE.UTF-8')\n" @@ -2347,6 +2679,15 @@ msgid "" ">>> locale.delocalize('1,234.56')\n" "'1234.56'" msgstr "" +">>> import locale\n" +">>> locale.setlocale(locale.LC_NUMERIC, 'de_DE.UTF-8')\n" +"'de_DE.UTF-8'\n" +">>> locale.delocalize('1.234,56')\n" +"'1234.56'\n" +">>> locale.setlocale(locale.LC_NUMERIC, 'en_US.UTF-8')\n" +"'en_US.UTF-8'\n" +">>> locale.delocalize('1,234.56')\n" +"'1234.56'" #: ../../whatsnew/3.5.rst:1404 msgid "(Contributed by Cédric Krier in :issue:`13918`.)" @@ -2356,15 +2697,17 @@ msgstr "(Contributed by Cédric Krier in :issue:`13918`.)" msgid "logging" msgstr "logging" -#: ../../whatsnew/3.5.rst:1410 msgid "" -"All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" -"meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" -"`~logging.Logger.debug`, etc.), now accept exception instances as an " -"*exc_info* argument, in addition to boolean values and exception tuples::" +"All logging methods " +"(:class:`~logging.Logger` :meth:`~logging.Logger.log`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.debug`, " +"etc.), now accept exception instances as an *exc_info* argument, in addition " +"to boolean values and exception tuples::" msgstr "" +"すべてのログ記録メソッド (:class:`~logging.Logger` " +"の :meth:`~logging.Logger.log`、:meth:`~logging.Logger.exception`、:meth:`~logging.Logger.critical`、:meth:`~logging.Logger.debug` " +"など) が、*exc_info* 引数にブール値や例外のタプルだけでなく、例外インスタンス" +"も受け付けるようになりました。 ::" -#: ../../whatsnew/3.5.rst:1416 msgid "" ">>> import logging\n" ">>> try:\n" @@ -2373,37 +2716,52 @@ msgid "" "... logging.error('exception', exc_info=ex)\n" "ERROR:root:exception" msgstr "" +">>> import logging\n" +">>> try:\n" +"... 1/0\n" +"... except ZeroDivisionError as ex:\n" +"... logging.error('exception', exc_info=ex)\n" +"ERROR:root:exception" #: ../../whatsnew/3.5.rst:1423 msgid "(Contributed by Yury Selivanov in :issue:`20537`.)" msgstr "(Contributed by Yury Selivanov in :issue:`20537`.)" -#: ../../whatsnew/3.5.rst:1425 msgid "" "The :class:`handlers.HTTPHandler ` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " -"settings used in an HTTP connection. (Contributed by Alex Gaynor in :issue:" -"`22788`.)" +"settings used in an HTTP connection. (Contributed by Alex Gaynor " +"in :issue:`22788`.)" msgstr "" +":class:`handlers.HTTPHandler ` クラスに、省略可" +"能な :class:`ssl.SSLContext` インスタンスを渡して HTTP 接続の SSL 設定を指定" +"できるようになりました。\n" +"(Contributed by Alex Gaynor in :issue:`22788`.)" -#: ../../whatsnew/3.5.rst:1430 msgid "" "The :class:`handlers.QueueListener ` class " "now takes a *respect_handler_level* keyword argument which, if set to " "``True``, will pass messages to handlers taking handler levels into account. " "(Contributed by Vinay Sajip.)" msgstr "" +":class:`handlers.QueueListener ` クラスに " +"*respect_handler_level* キーワード引数が追加されました。\n" +"``True`` にするとハンドラーのレベルを考慮してメッセージを渡します。\n" +"(Contributed by Vinay Sajip.)" #: ../../whatsnew/3.5.rst:1437 msgid "lzma" msgstr "lzma" -#: ../../whatsnew/3.5.rst:1439 msgid "" "The :meth:`LZMADecompressor.decompress() ` " "method now accepts an optional *max_length* argument to limit the maximum " "size of decompressed data. (Contributed by Martin Panter in :issue:`15955`.)" msgstr "" +":meth:`LZMADecompressor.decompress() ` メ" +"ソッドに、省略可能な引数 *max_length* で展開データの最大サイズを指定できるよ" +"うになりました。\n" +"(Contributed by Martin Panter in :issue:`15955`.)" #: ../../whatsnew/3.5.rst:1446 msgid "math" @@ -2411,9 +2769,9 @@ msgstr "math" #: ../../whatsnew/3.5.rst:1448 msgid "" -"Two new constants have been added to the :mod:`math` module: :data:`~math." -"inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" -"`23185`.)" +"Two new constants have been added to the :mod:`math` " +"module: :data:`~math.inf` and :data:`~math.nan`. (Contributed by Mark " +"Dickinson in :issue:`23185`.)" msgstr "" ":mod:`math` モジュールに定数 :data:`~math.inf` および :data:`~math.nan` が追" "加されました。\n" @@ -2444,31 +2802,34 @@ msgstr "multiprocessing" #: ../../whatsnew/3.5.rst:1462 msgid "" -":func:`sharedctypes.synchronized() ` objects now support the :term:`context manager` protocol. " -"(Contributed by Charles-François Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() " +"` objects now support " +"the :term:`context manager` protocol. (Contributed by Charles-François " +"Natali in :issue:`21565`.)" msgstr "" -":func:`sharedctypes.synchronized() ` オブジェクトが :term:`コンテキストマネージャ ` プロトコルをサポートするようになりました。 (Contributed by Charles-" -"François Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() " +"` オブジェクトが :term:`コンテキス" +"トマネージャ ` プロトコルをサポートするようになりました。 " +"(Contributed by Charles-François Natali in :issue:`21565`.)" #: ../../whatsnew/3.5.rst:1468 msgid "operator" msgstr "operator" -#: ../../whatsnew/3.5.rst:1470 msgid "" -":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" -"`~operator.methodcaller` objects now support pickling. (Contributed by Josh " -"Rosenberg and Serhiy Storchaka in :issue:`22955`.)" +":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, " +"and :func:`~operator.methodcaller` objects now support pickling. " +"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" +":func:`~operator.attrgetter`、:func:`~operator.itemgetter`、:func:`~operator.methodcaller` " +"オブジェクトが pickle 化に対応しました。\n" +"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" #: ../../whatsnew/3.5.rst:1474 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " -"perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" -"`21176`.)" +"perform matrix multiplication. (Contributed by Benjamin Peterson " +"in :issue:`21176`.)" msgstr "" "行列乗算を行う :func:`~operator.matmul` 関数と :func:`~operator.imatmul` 関数" "が新しく追加されました。\n" @@ -2478,29 +2839,36 @@ msgstr "" msgid "os" msgstr "os" -#: ../../whatsnew/3.5.rst:1482 msgid "" -"The new :func:`~os.scandir` function returning an iterator of :class:`~os." -"DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " -"file attributes while scanning a directory, removing the need to perform " -"subsequent system calls to determine file type or attributes, which may " -"significantly improve performance. (Contributed by Ben Hoyt with the help " -"of Victor Stinner in :issue:`22524`.)" +"The new :func:`~os.scandir` function returning an iterator " +"of :class:`~os.DirEntry` objects has been added. If " +"possible, :func:`~os.scandir` extracts file attributes while scanning a " +"directory, removing the need to perform subsequent system calls to determine " +"file type or attributes, which may significantly improve performance. " +"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" msgstr "" +":class:`~os.DirEntry` オブジェクトのイテレータを返す :func:`~os.scandir` 関数" +"が追加されました。\n" +":func:`~os.scandir` は、可能であればディレクトリの走査時にファイル属性を取得" +"します。\n" +"その後でファイルの種類や属性を調べるシステムコールが不要になるため、性能が大" +"幅に向上する可能性があります。\n" +"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" #: ../../whatsnew/3.5.rst:1489 msgid "" -"On Windows, a new :attr:`stat_result.st_file_attributes ` attribute is now available. It corresponds to the " -"``dwFileAttributes`` member of the ``BY_HANDLE_FILE_INFORMATION`` structure " -"returned by ``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :" -"issue:`21719`.)" +"On Windows, a new :attr:`stat_result.st_file_attributes " +"` attribute is now available. It " +"corresponds to the ``dwFileAttributes`` member of the " +"``BY_HANDLE_FILE_INFORMATION`` structure returned by " +"``GetFileInformationByHandle()``. (Contributed by Ben Hoyt " +"in :issue:`21719`.)" msgstr "" -"Windows において、新たに :attr:`stat_result.st_file_attributes ` 属性が利用可能です。これは Windows API の " -"``GetFileInformationByHandle()`` から返る ``BY_HANDLE_FILE_INFORMATION`` 構造" -"体のメンバ ``dwFileAttributes`` に対応します。 (Contributed by Ben Hoyt in :" -"issue:`21719`.)" +"Windows において、新たに :attr:`stat_result.st_file_attributes " +"` 属性が利用可能です。これは Windows API " +"の ``GetFileInformationByHandle()`` から返る ``BY_HANDLE_FILE_INFORMATION`` " +"構造体のメンバ ``dwFileAttributes`` に対応します。 (Contributed by Ben Hoyt " +"in :issue:`21719`.)" #: ../../whatsnew/3.5.rst:1495 msgid "" @@ -2515,12 +2883,15 @@ msgstr "" "起こり得たファイル記述子を使い果たすことによる失敗を避けることに繋がります。 " "(Contributed by Victor Stinner in :issue:`22181`.)" -#: ../../whatsnew/3.5.rst:1500 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " -"getting and setting a file descriptor's blocking mode (:const:`~os." -"O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" +"getting and setting a file descriptor's blocking mode " +"(:const:`~os.O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" +"新たな関数 :func:`~os.get_blocking` および :func:`~os.set_blocking` により、" +"ファイル記述子のブロッキングモード (:const:`~os.O_NONBLOCK`) の取得と設定が出" +"来るようになりました。\n" +"(Contributed by Victor Stinner in :issue:`22054`.)" #: ../../whatsnew/3.5.rst:1504 msgid "" @@ -2530,14 +2901,15 @@ msgstr "" ":func:`~os.truncate` と :func:`~os.ftruncate` が Windows でサポートされるよう" "になりました。 (Contributed by Steve Dower in :issue:`23668`.)" -#: ../../whatsnew/3.5.rst:1507 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " -"common sub-path of each passed pathname. Unlike the :func:`os.path." -"commonprefix` function, it always returns a valid path::" +"common sub-path of each passed pathname. Unlike " +"the :func:`os.path.commonprefix` function, it always returns a valid path::" msgstr "" +"渡された各パス名に共通する最長のサブパスを返す :func:`os.path.commonpath` 関" +"数が追加されました。\n" +":func:`os.path.commonprefix` 関数と異なり、常に有効なパスを返します。 ::" -#: ../../whatsnew/3.5.rst:1512 msgid "" ">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" "'/usr/l'\n" @@ -2545,6 +2917,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`.)" @@ -2554,14 +2931,16 @@ msgstr "(Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)" msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.5.rst:1524 msgid "" "The new :meth:`Path.samefile() ` method can be used " "to check whether the path points to the same file as another path, which can " "be either another :class:`~pathlib.Path` object, or a string::" msgstr "" +"新しい :meth:`Path.samefile() ` メソッドを使うと、パス" +"が別のパスと同じファイルを指すか確認できます。\n" +"比較対象のパスには別の :class:`~pathlib.Path` オブジェクトまたは文字列を指定" +"できます。 ::" -#: ../../whatsnew/3.5.rst:1528 msgid "" ">>> import pathlib\n" ">>> p1 = pathlib.Path('/etc/hosts')\n" @@ -2569,54 +2948,76 @@ msgid "" ">>> p1.samefile(p2)\n" "True" msgstr "" +">>> import pathlib\n" +">>> p1 = pathlib.Path('/etc/hosts')\n" +">>> p2 = pathlib.Path('/etc/../etc/hosts')\n" +">>> p1.samefile(p2)\n" +"True" #: ../../whatsnew/3.5.rst:1534 msgid "(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)" msgstr "(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)" -#: ../../whatsnew/3.5.rst:1536 msgid "" "The :meth:`Path.mkdir() ` method now accepts a new " "optional *exist_ok* argument to match ``mkdir -p`` and :func:`os.makedirs` " "functionality. (Contributed by Berker Peksag in :issue:`21539`.)" msgstr "" +":meth:`Path.mkdir() ` メソッドに、省略可能な引数 " +"*exist_ok* が追加され、``mkdir -p`` や :func:`os.makedirs` と同様の機能を使え" +"るようになりました。\n" +"(Contributed by Berker Peksag in :issue:`21539`.)" -#: ../../whatsnew/3.5.rst:1540 msgid "" "There is a new :meth:`Path.expanduser() ` method to " "expand ``~`` and ``~user`` prefixes. (Contributed by Serhiy Storchaka and " "Claudiu Popa in :issue:`19776`.)" msgstr "" +"``~`` と ``~user`` のプレフィックスを展開する :meth:`Path.expanduser() " +"` メソッドが追加されました。\n" +"(Contributed by Serhiy Storchaka and Claudiu Popa in :issue:`19776`.)" -#: ../../whatsnew/3.5.rst:1544 msgid "" "A new :meth:`Path.home() ` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " -"directory. (Contributed by Victor Salgado and Mayank Tripathi in :issue:" -"`19777`.)" +"directory. (Contributed by Victor Salgado and Mayank Tripathi " +"in :issue:`19777`.)" msgstr "" +"新しいクラスメソッド :meth:`Path.home() ` を使うと、ユー" +"ザーのホームディレクトリを表す :class:`~pathlib.Path` インスタンスを取得でき" +"ます。\n" +"(Contributed by Victor Salgado and Mayank Tripathi in :issue:`19777`.)" -#: ../../whatsnew/3.5.rst:1549 msgid "" -"New :meth:`Path.write_text() `, :meth:`Path." -"read_text() `, :meth:`Path.write_bytes() `, :meth:`Path.read_bytes() ` " -"methods to simplify read/write operations on files." +"New :meth:`Path.write_text() " +"`, :meth:`Path.read_text() " +"`, :meth:`Path.write_bytes() " +"`, :meth:`Path.read_bytes() " +"` methods to simplify read/write operations on " +"files." msgstr "" +"ファイルの読み書きを簡単にする :meth:`Path.write_text() " +"`、:meth:`Path.read_text() " +"`、:meth:`Path.write_bytes() " +"`、:meth:`Path.read_bytes() " +"` メソッドが追加されました。" -#: ../../whatsnew/3.5.rst:1555 msgid "" "The following code snippet will create or rewrite existing file ``~/" "spam42``::" msgstr "" +"次のコードは ``~/spam42`` を作成し、既存のファイルがあれば上書きします。 ::" -#: ../../whatsnew/3.5.rst:1558 msgid "" ">>> import pathlib\n" ">>> p = pathlib.Path('~/spam42')\n" ">>> p.expanduser().write_text('ham')\n" "3" msgstr "" +">>> import pathlib\n" +">>> p = pathlib.Path('~/spam42')\n" +">>> p.expanduser().write_text('ham')\n" +"3" #: ../../whatsnew/3.5.rst:1563 msgid "(Contributed by Christopher Welborn in :issue:`20218`.)" @@ -2626,36 +3027,42 @@ msgstr "(Contributed by Christopher Welborn in :issue:`20218`.)" msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.5.rst:1569 msgid "" "Nested objects, such as unbound methods or nested classes, can now be " "pickled using :ref:`pickle protocols ` older than protocol " "version 4. Protocol version 4 already supports these cases. (Contributed by " "Serhiy Storchaka in :issue:`23611`.)" msgstr "" +"非束縛メソッドや入れ子のクラスなど、入れ子のオブジェクトをバージョン 4 より古" +"い :ref:`pickle プロトコル ` でも pickle 化できるようになり" +"ました。\n" +"プロトコルのバージョン 4 は、これらにすでに対応しています。\n" +"(Contributed by Serhiy Storchaka in :issue:`23611`.)" #: ../../whatsnew/3.5.rst:1576 msgid "poplib" msgstr "poplib" -#: ../../whatsnew/3.5.rst:1578 msgid "" "A new :meth:`POP3.utf8() ` command enables :rfc:`6856` " "(Internationalized Email) support, if a POP server supports it. (Contributed " "by Milan OberKirch in :issue:`21804`.)" msgstr "" +"新しい :meth:`POP3.utf8() ` コマンドは、POP サーバーが対応" +"していれば :rfc:`6856` (電子メールの国際化) のサポートを有効にします。\n" +"(Contributed by Milan OberKirch in :issue:`21804`.)" #: ../../whatsnew/3.5.rst:1584 msgid "re" msgstr "re" -#: ../../whatsnew/3.5.rst:1586 msgid "" "References and conditional references to groups with fixed length are now " "allowed in lookbehind assertions::" msgstr "" +"後読みアサーションで、固定長のグループへの参照や条件付き参照を使えるようにな" +"りました。 ::" -#: ../../whatsnew/3.5.rst:1589 msgid "" ">>> import re\n" ">>> pat = re.compile(r'(a|b).(?<=\\1)c')\n" @@ -2664,33 +3071,41 @@ msgid "" ">>> pat.match('bbc')\n" "<_sre.SRE_Match object; span=(0, 3), match='bbc'>" msgstr "" +">>> import re\n" +">>> pat = re.compile(r'(a|b).(?<=\\1)c')\n" +">>> pat.match('aac')\n" +"<_sre.SRE_Match object; span=(0, 3), match='aac'>\n" +">>> pat.match('bbc')\n" +"<_sre.SRE_Match object; span=(0, 3), match='bbc'>" #: ../../whatsnew/3.5.rst:1596 msgid "(Contributed by Serhiy Storchaka in :issue:`9179`.)" msgstr "(Contributed by Serhiy Storchaka in :issue:`9179`.)" -#: ../../whatsnew/3.5.rst:1598 msgid "" "The number of capturing groups in regular expressions is no longer limited " "to 100. (Contributed by Serhiy Storchaka in :issue:`22437`.)" msgstr "" +"正規表現のキャプチャグループ数の上限が 100 個ではなくなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`22437`.)" -#: ../../whatsnew/3.5.rst:1601 msgid "" "The :func:`~re.sub` and :func:`~re.subn` functions now replace unmatched " "groups with empty strings instead of raising an exception. (Contributed by " "Serhiy Storchaka in :issue:`1519638`.)" msgstr "" +":func:`~re.sub` と :func:`~re.subn` 関数は、マッチしなかったグループについて" +"例外を送出せず、空文字列で置き換えるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`1519638`.)" #: ../../whatsnew/3.5.rst:1605 msgid "" -"The :class:`re.error` exceptions have new attributes, :attr:`~re.error." -"msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error." -"lineno`, and :attr:`~re.error.colno`, that provide better context " -"information about the error::" +"The :class:`re.error` exceptions have new " +"attributes, :attr:`~re.error.msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error.lineno`, " +"and :attr:`~re.error.colno`, that provide better context information about " +"the error::" msgstr "" -#: ../../whatsnew/3.5.rst:1611 msgid "" ">>> re.compile(\"\"\"\n" "... (?x)\n" @@ -2700,6 +3115,13 @@ msgid "" " ...\n" "sre_constants.error: multiple repeat at position 16 (line 3, column 7)" msgstr "" +">>> re.compile(\"\"\"\n" +"... (?x)\n" +"... .++\n" +"... \"\"\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"sre_constants.error: multiple repeat at position 16 (line 3, column 7)" #: ../../whatsnew/3.5.rst:1619 msgid "(Contributed by Serhiy Storchaka in :issue:`22578`.)" @@ -2709,40 +3131,48 @@ msgstr "(Contributed by Serhiy Storchaka in :issue:`22578`.)" msgid "readline" msgstr "readline" -#: ../../whatsnew/3.5.rst:1625 msgid "" "A new :func:`~readline.append_history_file` function can be used to append " "the specified number of trailing elements in history to the given file. " "(Contributed by Bruno Cauet in :issue:`22940`.)" msgstr "" +"新しい :func:`~readline.append_history_file` 関数で、履歴の末尾から指定個数の" +"要素を指定のファイルに追記できます。\n" +"(Contributed by Bruno Cauet in :issue:`22940`.)" #: ../../whatsnew/3.5.rst:1631 msgid "selectors" msgstr "selectors" -#: ../../whatsnew/3.5.rst:1633 msgid "" "The new :class:`~selectors.DevpollSelector` supports efficient ``/dev/poll`` " "polling on Solaris. (Contributed by Giampaolo Rodola' in :issue:`18931`.)" msgstr "" +"新しい :class:`~selectors.DevpollSelector` は、Solaris で ``/dev/poll`` によ" +"る効率的なポーリングをサポートします。\n" +"(Contributed by Giampaolo Rodola' in :issue:`18931`.)" #: ../../whatsnew/3.5.rst:1639 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.5.rst:1641 msgid "" "The :func:`~shutil.move` function now accepts a *copy_function* argument, " "allowing, for example, the :func:`~shutil.copy` function to be used instead " "of the default :func:`~shutil.copy2` if there is a need to ignore file " "metadata when moving. (Contributed by Claudiu Popa in :issue:`19840`.)" msgstr "" +":func:`~shutil.move` 関数に *copy_function* 引数が追加されました。\n" +"例えば移動時にファイルのメタデータを無視する必要がある場合、デフォルト" +"の :func:`~shutil.copy2` の代わりに :func:`~shutil.copy` を使えます。\n" +"(Contributed by Claudiu Popa in :issue:`19840`.)" -#: ../../whatsnew/3.5.rst:1647 msgid "" "The :func:`~shutil.make_archive` function now supports the *xztar* format. " "(Contributed by Serhiy Storchaka in :issue:`5411`.)" msgstr "" +":func:`~shutil.make_archive` 関数が *xztar* 形式に対応しました。\n" +"(Contributed by Serhiy Storchaka in :issue:`5411`.)" #: ../../whatsnew/3.5.rst:1652 msgid "signal" @@ -2754,22 +3184,25 @@ msgid "" "socket handles. (Contributed by Victor Stinner in :issue:`22018`.)" msgstr "" "Windows において、 :func:`~signal.set_wakeup_fd` 関数がソケットハンドルもサ" -"ポートするようになりました。 (Contributed by Victor Stinner in :issue:" -"`22018`.)" +"ポートするようになりました。 (Contributed by Victor Stinner " +"in :issue:`22018`.)" -#: ../../whatsnew/3.5.rst:1657 msgid "" "Various ``SIG*`` constants in the :mod:`signal` module have been converted " "into :mod:`Enums `. This allows meaningful names to be printed during " "debugging, instead of integer \"magic numbers\". (Contributed by Giampaolo " "Rodola' in :issue:`21076`.)" msgstr "" +":mod:`signal` モジュールの各種 ``SIG*`` 定数が :mod:`列挙型 ` に変換さ" +"れました。\n" +"これにより、デバッグ時に整数の「マジックナンバー」ではなく、意味のある名前を" +"表示できます。\n" +"(Contributed by Giampaolo Rodola' in :issue:`21076`.)" #: ../../whatsnew/3.5.rst:1664 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.5.rst:1666 msgid "" "Both the :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*decode_data* keyword argument to determine if the ``DATA`` portion of the " @@ -2780,17 +3213,26 @@ msgid "" "``False``, the ``process_message`` method must be prepared to accept keyword " "arguments. (Contributed by Maciej Szulik in :issue:`19662`.)" msgstr "" +":class:`!SMTPServer` と :class:`!SMTPChannel` の両クラスに *decode_data* キー" +"ワード引数が追加されました。\n" +"SMTP トランザクションの ``DATA`` 部分を ``\"utf-8\"`` コーデックでデコードす" +"るか、それともバイト文字列のまま :meth:`!SMTPServer.process_message` メソッド" +"に渡すかを指定します。\n" +"後方互換性のためデフォルトは ``True`` ですが、Python 3.6 では ``False`` に変" +"更されます。\n" +"*decode_data* が ``False`` の場合、``process_message`` メソッドはキーワード引" +"数を受け付ける必要があります。\n" +"(Contributed by Maciej Szulik in :issue:`19662`.)" #: ../../whatsnew/3.5.rst:1677 msgid "" -"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" -"rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " -"``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" +"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension " +"(:rfc:`6152`) if *decode_data* has been set ``True``. If the client " +"specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" "SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " "Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" -#: ../../whatsnew/3.5.rst:1684 msgid "" "The :class:`!SMTPServer` class now also supports the ``SMTPUTF8`` extension " "(:rfc:`6531`: Internationalized Email). If the client specified ``SMTPUTF8 " @@ -2799,85 +3241,121 @@ msgid "" "responsibility of the ``process_message`` method to correctly handle the " "``SMTPUTF8`` data. (Contributed by Milan Oberkirch in :issue:`21725`.)" msgstr "" +":class:`!SMTPServer` クラスが ``SMTPUTF8`` 拡張 (:rfc:`6531`: 電子メールの国" +"際化) にも対応しました。\n" +"クライアントが ``MAIL`` コマンドに ``SMTPUTF8 BODY=8BITMIME`` を指定すると、" +"*mail_options* キーワードを通じて :meth:`!SMTPServer.process_message` に渡さ" +"れます。\n" +"``SMTPUTF8`` データを適切に処理するのは ``process_message`` メソッドの責任で" +"す。\n" +"(Contributed by Milan Oberkirch in :issue:`21725`.)" -#: ../../whatsnew/3.5.rst:1692 msgid "" "It is now possible to provide, directly or via name resolution, IPv6 " "addresses in the :class:`!SMTPServer` constructor, and have it successfully " "connect. (Contributed by Milan Oberkirch in :issue:`14758`.)" msgstr "" +":class:`!SMTPServer` のコンストラクタに、直接または名前解決によって IPv6 アド" +"レスを指定し、正しく接続できるようになりました。\n" +"(Contributed by Milan Oberkirch in :issue:`14758`.)" #: ../../whatsnew/3.5.rst:1698 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.5.rst:1700 msgid "" "A new :meth:`SMTP.auth() ` method provides a convenient " "way to implement custom authentication mechanisms. (Contributed by Milan " "Oberkirch in :issue:`15014`.)" msgstr "" +"新しい :meth:`SMTP.auth() ` メソッドを使うと、独自の認証機" +"構を簡単に実装できます。\n" +"(Contributed by Milan Oberkirch in :issue:`15014`.)" -#: ../../whatsnew/3.5.rst:1704 msgid "" "The :meth:`SMTP.set_debuglevel() ` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " -"messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:" -"`16914`.)" +"messages. (Contributed by Gavin Chappell and Maciej Szulik " +"in :issue:`16914`.)" msgstr "" +":meth:`SMTP.set_debuglevel() ` メソッドに新しい" +"デバッグレベル 2 が追加され、デバッグメッセージにタイムスタンプを付けられるよ" +"うになりました。\n" +"(Contributed by Gavin Chappell and Maciej Szulik in :issue:`16914`.)" -#: ../../whatsnew/3.5.rst:1708 msgid "" -"Both the :meth:`SMTP.sendmail() ` and :meth:`SMTP." -"send_message() ` methods now support :rfc:`6531` " -"(SMTPUTF8). (Contributed by Milan Oberkirch and R. David Murray in :issue:" -"`22027`.)" +"Both the :meth:`SMTP.sendmail() ` " +"and :meth:`SMTP.send_message() ` methods now " +"support :rfc:`6531` (SMTPUTF8). (Contributed by Milan Oberkirch and R. David " +"Murray in :issue:`22027`.)" msgstr "" +":meth:`SMTP.sendmail() ` " +"と :meth:`SMTP.send_message() ` の両メソッド" +"が :rfc:`6531` (SMTPUTF8) に対応しました。\n" +"(Contributed by Milan Oberkirch and R. David Murray in :issue:`22027`.)" #: ../../whatsnew/3.5.rst:1715 msgid "sndhdr" msgstr "sndhdr" -#: ../../whatsnew/3.5.rst:1717 msgid "" -"The :func:`!what` and :func:`!whathdr` functions now return a :func:" -"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return " +"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa " +"in :issue:`18615`.)" msgstr "" +":func:`!what` と :func:`!whathdr` 関数が :func:`~collections.namedtuple` を返" +"すようになりました。\n" +"(Contributed by Claudiu Popa in :issue:`18615`.)" #: ../../whatsnew/3.5.rst:1723 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.5.rst:1725 msgid "" "Functions with timeouts now use a monotonic clock, instead of a system " "clock. (Contributed by Victor Stinner in :issue:`22043`.)" msgstr "" +"タイムアウトを持つ関数がシステムクロックではなく単調増加クロックを使うように" +"なりました。\n" +"(Contributed by Victor Stinner in :issue:`22043`.)" -#: ../../whatsnew/3.5.rst:1728 msgid "" "A new :meth:`socket.sendfile() ` method allows " -"sending a file over a socket by using the high-performance :func:`os." -"sendfile` function on UNIX, resulting in uploads being from 2 to 3 times " -"faster than when using plain :meth:`socket.send() `. " +"sending a file over a socket by using the high-" +"performance :func:`os.sendfile` function on UNIX, resulting in uploads being " +"from 2 to 3 times faster than when using plain :meth:`socket.send() " +"`. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" +msgstr "" +"新しい :meth:`socket.sendfile() ` メソッドを使うと、" +"UNIX では高速な :func:`os.sendfile` 関数を使ってソケット経由でファイルを送信" +"できます。\n" +"単に :meth:`socket.send() ` を使う場合に比べ、アップロー" +"ドが 2〜3 倍高速になります。\n" "(Contributed by Giampaolo Rodola' in :issue:`17552`.)" -msgstr "" -#: ../../whatsnew/3.5.rst:1734 msgid "" "The :meth:`socket.sendall() ` method no longer resets " "the socket timeout every time bytes are received or sent. The socket " "timeout is now the maximum total duration to send all data. (Contributed by " "Victor Stinner in :issue:`23853`.)" msgstr "" +":meth:`socket.sendall() ` メソッドは、バイトの送受信の" +"たびにソケットのタイムアウトをリセットしなくなりました。\n" +"ソケットのタイムアウトは、すべてのデータを送信するのにかかる合計時間の上限に" +"なります。\n" +"(Contributed by Victor Stinner in :issue:`23853`.)" -#: ../../whatsnew/3.5.rst:1739 msgid "" "The *backlog* argument of the :meth:`socket.listen() ` " -"method is now optional. By default it is set to :data:`SOMAXCONN ` or to ``128``, whichever is less. (Contributed by Charles-" -"François Natali in :issue:`21455`.)" +"method is now optional. By default it is set to :data:`SOMAXCONN " +"` or to ``128``, whichever is less. (Contributed by " +"Charles-François Natali in :issue:`21455`.)" msgstr "" +":meth:`socket.listen() ` メソッドの *backlog* 引数が省" +"略可能になりました。\n" +"デフォルトは :data:`SOMAXCONN ` と ``128`` の小さい方で" +"す。\n" +"(Contributed by Charles-François Natali in :issue:`21455`.)" #: ../../whatsnew/3.5.rst:1746 msgid "ssl" @@ -2891,75 +3369,92 @@ msgstr "メモリ BIO サポート" msgid "(Contributed by Geert Jansen in :issue:`21965`.)" msgstr "(Contributed by Geert Jansen in :issue:`21965`.)" -#: ../../whatsnew/3.5.rst:1755 msgid "" "The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol " -"support for cases when the network I/O capabilities of :class:`~ssl." -"SSLSocket` are not necessary or are suboptimal. ``SSLObject`` represents an " -"SSL protocol instance, but does not implement any network I/O methods, and " -"instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` " -"class can be used to pass data between Python and an SSL protocol instance." +"support for cases when the network I/O capabilities " +"of :class:`~ssl.SSLSocket` are not necessary or are suboptimal. " +"``SSLObject`` represents an SSL protocol instance, but does not implement " +"any network I/O methods, and instead provides a memory buffer interface. " +"The new :class:`~ssl.MemoryBIO` class can be used to pass data between " +"Python and an SSL protocol instance." msgstr "" +":class:`~ssl.SSLSocket` のネットワーク I/O 機能が不要または最適でない場合に " +"SSL プロトコルを扱うため、:class:`~ssl.SSLObject` クラスが追加されました。\n" +"``SSLObject`` は SSL プロトコルのインスタンスを表しますが、ネットワーク I/O " +"メソッドは実装せず、代わりにメモリバッファのインターフェースを提供します。\n" +"新しい :class:`~ssl.MemoryBIO` クラスを使うと、Python と SSL プロトコルのイン" +"スタンスの間でデータを受け渡せます。" -#: ../../whatsnew/3.5.rst:1762 msgid "" "The memory BIO SSL support is primarily intended to be used in frameworks " "implementing asynchronous I/O for which :class:`~ssl.SSLSocket`'s readiness " "model (\"select/poll\") is inefficient." msgstr "" +"メモリ BIO による SSL サポートは、主に非同期 I/O を実装するフレームワーク向け" +"です。\n" +"そのような場面では :class:`~ssl.SSLSocket` の準備完了通知モデル (\"select/" +"poll\") は効率がよくありません。" -#: ../../whatsnew/3.5.rst:1766 msgid "" "A new :meth:`SSLContext.wrap_bio() ` method can be " "used to create a new ``SSLObject`` instance." msgstr "" +"新しい :meth:`SSLContext.wrap_bio() ` メソッドで " +"``SSLObject`` インスタンスを作成できます。" -#: ../../whatsnew/3.5.rst:1771 msgid "Application-Layer Protocol Negotiation Support" -msgstr "" +msgstr "Application-Layer Protocol Negotiation のサポート" #: ../../whatsnew/3.5.rst:1773 msgid "(Contributed by Benjamin Peterson in :issue:`20188`.)" msgstr "(Contributed by Benjamin Peterson in :issue:`20188`.)" -#: ../../whatsnew/3.5.rst:1775 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " -"*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" -"`7301`." +"*Application-Layer Protocol Negotiation* TLS extension as described " +"in :rfc:`7301`." msgstr "" +"OpenSSL が対応している環境では、:mod:`ssl` モジュールが :rfc:`7301` の " +"*Application-Layer Protocol Negotiation* TLS 拡張を実装するようになりました。" -#: ../../whatsnew/3.5.rst:1779 msgid "" -"The new :meth:`SSLContext.set_alpn_protocols() ` can be used to specify which protocols a socket should " -"advertise during the TLS handshake." +"The new :meth:`SSLContext.set_alpn_protocols() " +"` can be used to specify which protocols " +"a socket should advertise during the TLS handshake." msgstr "" +"新しい :meth:`SSLContext.set_alpn_protocols() " +"` を使うと、TLS ハンドシェイク時にソケット" +"が通知するプロトコルを指定できます。" -#: ../../whatsnew/3.5.rst:1783 msgid "" -"The new :meth:`SSLSocket.selected_alpn_protocol() ` returns the protocol that was selected during the " -"TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates whether ALPN " -"support is present." +"The new :meth:`SSLSocket.selected_alpn_protocol() " +"` returns the protocol that was " +"selected during the TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates " +"whether ALPN support is present." msgstr "" +"新しい :meth:`SSLSocket.selected_alpn_protocol() " +"` は、TLS ハンドシェイク時に選択された" +"プロトコルを返します。\n" +":const:`~ssl.HAS_ALPN` フラグは ALPN をサポートしているかどうかを示します。" #: ../../whatsnew/3.5.rst:1790 msgid "Other Changes" msgstr "その他の変更" -#: ../../whatsnew/3.5.rst:1792 msgid "" "There is a new :meth:`SSLSocket.version() ` method to " -"query the actual protocol version in use. (Contributed by Antoine Pitrou in :" -"issue:`20421`.)" +"query the actual protocol version in use. (Contributed by Antoine Pitrou " +"in :issue:`20421`.)" msgstr "" +"実際に使用中のプロトコルのバージョンを調べる :meth:`SSLSocket.version() " +"` メソッドが追加されました。\n" +"(Contributed by Antoine Pitrou in :issue:`20421`.)" #: ../../whatsnew/3.5.rst:1796 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`SSLSocket." -"sendfile() ` method. (Contributed by Giampaolo " -"Rodola' in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements " +"a :meth:`SSLSocket.sendfile() ` method. (Contributed " +"by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1800 @@ -2970,30 +3465,34 @@ msgid "" "return ``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" -#: ../../whatsnew/3.5.rst:1805 msgid "" "The :func:`~ssl.cert_time_to_seconds` function now interprets the input time " "as UTC and not as local time, per :rfc:`5280`. Additionally, the return " "value is always an :class:`int`. (Contributed by Akira Li in :issue:`19940`.)" msgstr "" +":rfc:`5280` に基づき、 :func:`~ssl.cert_time_to_seconds` 関数が入力の時刻を" +"ローカル時刻ではなく UTC として解釈するようになりました。\n" +"また、戻り値は常に :class:`int` となります。\n" +"(Contributed by Akira Li in :issue:`19940`.)" #: ../../whatsnew/3.5.rst:1809 msgid "" -"New :meth:`SSLObject.shared_ciphers() ` and :" -"meth:`SSLSocket.shared_ciphers() ` methods " -"return the list of ciphers sent by the client during the handshake. " +"New :meth:`SSLObject.shared_ciphers() ` " +"and :meth:`SSLSocket.shared_ciphers() ` " +"methods return the list of ciphers sent by the client during the handshake. " "(Contributed by Benjamin Peterson in :issue:`23186`.)" msgstr "" #: ../../whatsnew/3.5.rst:1814 msgid "" -"The :meth:`SSLSocket.do_handshake() `, :meth:" -"`SSLSocket.read() `, :meth:`SSLSocket.shutdown() `, and :meth:`SSLSocket.write() ` " -"methods of the :class:`~ssl.SSLSocket` class no longer reset the socket " -"timeout every time bytes are received or sent. The socket timeout is now the " -"maximum total duration of the method. (Contributed by Victor Stinner in :" -"issue:`23853`.)" +"The :meth:`SSLSocket.do_handshake() " +"`, :meth:`SSLSocket.read() " +"`, :meth:`SSLSocket.shutdown() " +"`, and :meth:`SSLSocket.write() " +"` methods of the :class:`~ssl.SSLSocket` class no " +"longer reset the socket timeout every time bytes are received or sent. The " +"socket timeout is now the maximum total duration of the method. (Contributed " +"by Victor Stinner in :issue:`23853`.)" msgstr "" #: ../../whatsnew/3.5.rst:1822 @@ -3006,13 +3505,17 @@ msgstr "" msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.5.rst:1829 msgid "" "The :class:`~sqlite3.Row` class now fully supports the sequence protocol, in " "particular :func:`reversed` iteration and slice indexing. (Contributed by " "Claudiu Popa in :issue:`10203`; by Lucas Sinclair, Jessica McKellar, and " "Serhiy Storchaka in :issue:`13583`.)" msgstr "" +":class:`~sqlite3.Row` クラスがシーケンスプロトコルに完全に対応し、特" +"に :func:`reversed` による逆順の反復処理やスライスによるインデックス指定が可" +"能になりました。\n" +"(Contributed by Claudiu Popa in :issue:`10203`; by Lucas Sinclair, Jessica " +"McKellar, and Serhiy Storchaka in :issue:`13583`.)" #: ../../whatsnew/3.5.rst:1838 msgid "subprocess" @@ -3035,7 +3538,6 @@ msgstr "" "ドでサブプロセスを起動するのに推奨される方法です。\n" "(Contributed by Thomas Kluyver in :issue:`23342`.)" -#: ../../whatsnew/3.5.rst:1850 msgid "" ">>> subprocess.run([\"ls\", \"-l\"]) # doesn't capture output\n" "CompletedProcess(args=['ls', '-l'], returncode=0)\n" @@ -3050,6 +3552,18 @@ 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')" 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\"], stdout=subprocess.PIPE)\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')" #: ../../whatsnew/3.5.rst:1864 msgid "sys" @@ -3059,29 +3573,34 @@ msgstr "sys" msgid "" "A new :func:`~sys.set_coroutine_wrapper` function allows setting a global " "hook that will be called whenever a :term:`coroutine object ` is " -"created by an :keyword:`async def` function. A corresponding :func:`~sys." -"get_coroutine_wrapper` can be used to obtain a currently set wrapper. Both " -"functions are :term:`provisional `, and are intended for " -"debugging purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)" +"created by an :keyword:`async def` function. A " +"corresponding :func:`~sys.get_coroutine_wrapper` can be used to obtain a " +"currently set wrapper. Both functions are :term:`provisional `, and are intended for debugging purposes only. (Contributed by Yury " +"Selivanov in :issue:`24017`.)" msgstr "" -#: ../../whatsnew/3.5.rst:1874 msgid "" "A new :func:`~sys.is_finalizing` function can be used to check if the Python " "interpreter is :term:`shutting down `. (Contributed by " "Antoine Pitrou in :issue:`22696`.)" msgstr "" +"新しい :func:`~sys.is_finalizing` 関数で、Python インタープリタが :term:`終了" +"処理中 ` かどうかを確認できます。\n" +"(Contributed by Antoine Pitrou in :issue:`22696`.)" #: ../../whatsnew/3.5.rst:1880 msgid "sysconfig" msgstr "sysconfig" -#: ../../whatsnew/3.5.rst:1882 msgid "" "The name of the user scripts directory on Windows now includes the first two " -"components of the Python version. (Contributed by Paul Moore in :issue:" -"`23437`.)" +"components of the Python version. (Contributed by Paul Moore " +"in :issue:`23437`.)" msgstr "" +"Windows のユーザースクリプト用ディレクトリの名前に、Python バージョンの先頭 " +"2 要素が含まれるようになりました。\n" +"(Contributed by Paul Moore in :issue:`23437`.)" #: ../../whatsnew/3.5.rst:1888 msgid "tarfile" @@ -3090,30 +3609,40 @@ msgstr "tarfile" #: ../../whatsnew/3.5.rst:1890 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" -"issue:`21717`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag " +"in :issue:`21717`.)" msgstr "" ":func:`~tarfile.open` 関数の *mode* 引数が排他的作成を要求する ``\"x\"`` を" "受け取るようになりました。 (Contributed by Berker Peksag in :issue:`21717`.)" -#: ../../whatsnew/3.5.rst:1893 msgid "" -"The :meth:`TarFile.extractall() ` and :meth:" -"`TarFile.extract() ` methods now take a keyword " -"argument *numeric_owner*. If set to ``True``, the extracted files and " -"directories will be owned by the numeric ``uid`` and ``gid`` from the " +"The :meth:`TarFile.extractall() ` " +"and :meth:`TarFile.extract() ` methods now take a " +"keyword argument *numeric_owner*. If set to ``True``, the extracted files " +"and directories will be owned by the numeric ``uid`` and ``gid`` from the " "tarfile. If set to ``False`` (the default, and the behavior in versions " "prior to 3.5), they will be owned by the named user and group in the " "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" msgstr "" +":meth:`TarFile.extractall() ` " +"と :meth:`TarFile.extract() ` メソッドに " +"*numeric_owner* キーワード引数が追加されました。\n" +"``True`` の場合、展開したファイルやディレクトリの所有者は tar ファイルの数値" +"の ``uid`` と ``gid`` に設定されます。\n" +"``False`` の場合 (デフォルトであり、3.5 より前のバージョンの動作)、tar ファイ" +"ルのユーザー名とグループ名に基づいて設定されます。\n" +"(Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" -#: ../../whatsnew/3.5.rst:1901 msgid "" "The :meth:`TarFile.list() ` now accepts an optional " "*members* keyword argument that can be set to a subset of the list returned " "by :meth:`TarFile.getmembers() `. (Contributed " "by Serhiy Storchaka in :issue:`21549`.)" msgstr "" +":meth:`TarFile.list() ` に省略可能な *members* キーワー" +"ド引数が追加され、:meth:`TarFile.getmembers() ` " +"が返すリストの一部を指定できるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`21549`.)" #: ../../whatsnew/3.5.rst:1908 msgid "threading" @@ -3121,9 +3650,10 @@ msgstr "threading" #: ../../whatsnew/3.5.rst:1910 msgid "" -"Both the :meth:`Lock.acquire() ` and :meth:`RLock." -"acquire() ` methods now use a monotonic clock for " -"timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" +"Both the :meth:`Lock.acquire() ` " +"and :meth:`RLock.acquire() ` methods now use a " +"monotonic clock for timeout management. (Contributed by Victor Stinner " +"in :issue:`22043`.)" msgstr "" ":meth:`Lock.acquire() ` と :meth:`RLock.acquire() " "` の両メソッドがタイムアウトの管理に単調時計を使用す" @@ -3171,38 +3701,50 @@ msgstr "" msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.5.rst:1938 msgid "" "The :mod:`!tkinter._fix` module used for setting up the Tcl/Tk environment " "on Windows has been replaced by a private function in the :mod:`!_tkinter` " "module which makes no permanent changes to environment variables. " "(Contributed by Zachary Ware in :issue:`20035`.)" msgstr "" +"Windows の Tcl/Tk 環境を設定する :mod:`!tkinter._fix` モジュールが、:mod:`!" +"_tkinter` モジュールの非公開関数に置き換えられました。\n" +"この関数は環境変数を永続的には変更しません。\n" +"(Contributed by Zachary Ware in :issue:`20035`.)" #: ../../whatsnew/3.5.rst:1947 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.5.rst:1949 msgid "" "New :func:`~traceback.walk_stack` and :func:`~traceback.walk_tb` functions " "to conveniently traverse frame and :ref:`traceback objects `. (Contributed by Robert Collins in :issue:`17911`.)" msgstr "" +"フレームと :ref:`トレースバックオブジェクト ` を簡単にたど" +"る :func:`~traceback.walk_stack` と :func:`~traceback.walk_tb` 関数が追加され" +"ました。\n" +"(Contributed by Robert Collins in :issue:`17911`.)" -#: ../../whatsnew/3.5.rst:1954 msgid "" -"New lightweight classes: :class:`~traceback.TracebackException`, :class:" -"`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " -"(Contributed by Robert Collins in :issue:`17911`.)" +"New lightweight " +"classes: :class:`~traceback.TracebackException`, :class:`~traceback.StackSummary`, " +"and :class:`~traceback.FrameSummary`. (Contributed by Robert Collins " +"in :issue:`17911`.)" msgstr "" +"軽量なクラ" +"ス :class:`~traceback.TracebackException`、:class:`~traceback.StackSummary`、:class:`~traceback.FrameSummary` " +"が追加されました。\n" +"(Contributed by Robert Collins in :issue:`17911`.)" -#: ../../whatsnew/3.5.rst:1958 msgid "" "Both the :func:`~traceback.print_tb` and :func:`~traceback.print_stack` " "functions now support negative values for the *limit* argument. (Contributed " "by Dmitry Kazakov in :issue:`22619`.)" msgstr "" +":func:`~traceback.print_tb` と :func:`~traceback.print_stack` の両関数で、" +"*limit* 引数に負の値を指定できるようになりました。\n" +"(Contributed by Dmitry Kazakov in :issue:`22619`.)" #: ../../whatsnew/3.5.rst:1964 msgid "types" @@ -3211,9 +3753,9 @@ msgstr "types" #: ../../whatsnew/3.5.rst:1966 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " -"` and :class:`generator-like ` objects into :term:`awaitables `. (Contributed by " -"Yury Selivanov in :issue:`24017`.)" +"` and :class:`generator-like " +"` objects into :term:`awaitables `. " +"(Contributed by Yury Selivanov in :issue:`24017`.)" msgstr "" "新たに :func:`~types.coroutine` 関数が追加されました。\n" ":term:`ジェネレータ ` と :class:`ジェネレータ様 " @@ -3223,9 +3765,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1972 msgid "" -"A new type called :class:`~types.CoroutineType`, which is used for :term:" -"`coroutine` objects created by :keyword:`async def` functions. (Contributed " -"by Yury Selivanov in :issue:`24400`.)" +"A new type called :class:`~types.CoroutineType`, which is used " +"for :term:`coroutine` objects created by :keyword:`async def` functions. " +"(Contributed by Yury Selivanov in :issue:`24400`.)" msgstr "" "新たに型 :class:`~types.CoroutineType` が追加されました。\n" ":keyword:`async def` 関数で作られた :term:`coroutine` オブジェクトに使われま" @@ -3235,39 +3777,52 @@ msgstr "" msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.5.rst:1980 msgid "" "The :mod:`unicodedata` module now uses data from `Unicode 8.0.0 `_." msgstr "" +":mod:`unicodedata` モジュールが `Unicode 8.0.0 `_ のデータを使うようになりました。" #: ../../whatsnew/3.5.rst:1985 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.5.rst:1987 msgid "" -"The :meth:`TestLoader.loadTestsFromModule() ` method now accepts a keyword-only argument *pattern* " -"which is passed to ``load_tests`` as the third argument. Found packages are " -"now checked for ``load_tests`` regardless of whether their path matches " -"*pattern*, because it is impossible for a package name to match the default " -"pattern. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The :meth:`TestLoader.loadTestsFromModule() " +"` method now accepts a keyword-only " +"argument *pattern* which is passed to ``load_tests`` as the third argument. " +"Found packages are now checked for ``load_tests`` regardless of whether " +"their path matches *pattern*, because it is impossible for a package name to " +"match the default pattern. (Contributed by Robert Collins and Barry A. " +"Warsaw in :issue:`16662`.)" msgstr "" +":meth:`TestLoader.loadTestsFromModule() " +"` メソッドにキーワード専用引数 " +"*pattern* が追加され、``load_tests`` の第 3 引数に渡されるようになりまし" +"た。\n" +"パッケージ名はデフォルトのパターンにマッチしないため、見つかったパッケージで" +"はパスが *pattern* にマッチするかどうかにかかわらず ``load_tests`` を確認する" +"ようになりました。\n" +"(Contributed by Robert Collins and Barry A. Warsaw in :issue:`16662`.)" -#: ../../whatsnew/3.5.rst:1994 msgid "" "Unittest discovery errors now are exposed in the :data:`TestLoader.errors " "` attribute of the :class:`~unittest.TestLoader` " "instance. (Contributed by Robert Collins in :issue:`19746`.)" msgstr "" +"unittest のテスト探索時のエラーが :class:`~unittest.TestLoader` インスタンス" +"の :data:`TestLoader.errors ` 属性に公開されるよ" +"うになりました。\n" +"(Contributed by Robert Collins in :issue:`19746`.)" -#: ../../whatsnew/3.5.rst:1999 msgid "" "A new command line option ``--locals`` to show local variables in " "tracebacks. (Contributed by Robert Collins in :issue:`22936`.)" msgstr "" +"新しいコマンドラインオプション ``--locals`` で、トレースバックにローカル変数" +"を表示できます。\n" +"(Contributed by Robert Collins in :issue:`22936`.)" #: ../../whatsnew/3.5.rst:2004 msgid "unittest.mock" @@ -3277,82 +3832,110 @@ msgstr "unittest.mock" msgid "The :class:`~unittest.mock.Mock` class has the following improvements:" msgstr ":class:`~unittest.mock.Mock` クラスは、次の改善が行われました。" -#: ../../whatsnew/3.5.rst:2008 msgid "" "The class constructor has a new *unsafe* parameter, which causes mock " "objects to raise :exc:`AttributeError` on attribute names starting with " "``\"assert\"``. (Contributed by Kushal Das in :issue:`21238`.)" msgstr "" +"クラスのコンストラクタに *unsafe* パラメータが追加されました。\n" +"これにより、モックオブジェクトは ``\"assert\"`` で始まる属性名に対し" +"て :exc:`AttributeError` を送出します。\n" +"(Contributed by Kushal Das in :issue:`21238`.)" -#: ../../whatsnew/3.5.rst:2013 msgid "" -"A new :meth:`Mock.assert_not_called() ` method to check if the mock object was called. " -"(Contributed by Kushal Das in :issue:`21262`.)" +"A new :meth:`Mock.assert_not_called() " +"` method to check if the mock object " +"was called. (Contributed by Kushal Das in :issue:`21262`.)" msgstr "" +"新しい :meth:`Mock.assert_not_called() " +"` メソッドで、モックオブジェクトが呼び" +"出されていないことを確認できます。\n" +"(Contributed by Kushal Das in :issue:`21262`.)" #: ../../whatsnew/3.5.rst:2017 msgid "" -"The :class:`~unittest.mock.MagicMock` class now supports :meth:" -"`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` operators. " -"(Contributed by Johannes Baiter in :issue:`20968`, and Håkan Lövdahl in :" -"issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now " +"supports :meth:`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` " +"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " +"Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" -#: ../../whatsnew/3.5.rst:2022 msgid "" -"It is no longer necessary to explicitly pass ``create=True`` to the :func:" -"`~unittest.mock.patch` function when patching builtin names. (Contributed by " -"Kushal Das in :issue:`17660`.)" +"It is no longer necessary to explicitly pass ``create=True`` to " +"the :func:`~unittest.mock.patch` function when patching builtin names. " +"(Contributed by Kushal Das in :issue:`17660`.)" msgstr "" +"組み込み名にパッチを当てる場合、:func:`~unittest.mock.patch` 関数に " +"``create=True`` を明示的に渡す必要がなくなりました。\n" +"(Contributed by Kushal Das in :issue:`17660`.)" #: ../../whatsnew/3.5.rst:2028 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.5.rst:2030 msgid "" -"A new :class:`request.HTTPPasswordMgrWithPriorAuth ` class allows HTTP Basic Authentication " -"credentials to be managed so as to eliminate unnecessary ``401`` response " -"handling, or to unconditionally send credentials on the first request in " -"order to communicate with servers that return a ``404`` response instead of " -"a ``401`` if the ``Authorization`` header is not sent. (Contributed by Matej " -"Cepl in :issue:`19494` and Akshit Khurana in :issue:`7159`.)" +"A new :class:`request.HTTPPasswordMgrWithPriorAuth " +"` class allows HTTP Basic " +"Authentication credentials to be managed so as to eliminate unnecessary " +"``401`` response handling, or to unconditionally send credentials on the " +"first request in order to communicate with servers that return a ``404`` " +"response instead of a ``401`` if the ``Authorization`` header is not sent. " +"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " +"in :issue:`7159`.)" msgstr "" +"新しい :class:`request.HTTPPasswordMgrWithPriorAuth " +"` クラスを使うと、HTTP Basic 認" +"証の認証情報を管理して不要な ``401`` 応答の処理を省けます。\n" +"また ``Authorization`` ヘッダーを送らないと ``401`` ではなく ``404`` を返す" +"サーバーと通信するために、最初のリクエストで無条件に認証情報を送信することも" +"できます。\n" +"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " +"in :issue:`7159`.)" -#: ../../whatsnew/3.5.rst:2039 msgid "" -"A new *quote_via* argument for the :func:`parse.urlencode() ` function provides a way to control the encoding of query parts " -"if needed. (Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" +"A new *quote_via* argument for the :func:`parse.urlencode() " +"` function provides a way to control the encoding of " +"query parts if needed. (Contributed by Samwyse and Arnon Yaari " +"in :issue:`13866`.)" msgstr "" +":func:`parse.urlencode() ` 関数の新しい *quote_via* " +"引数で、必要に応じてクエリ部分のエンコード方法を制御できます。\n" +"(Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" -#: ../../whatsnew/3.5.rst:2044 msgid "" -"The :func:`request.urlopen() ` function accepts an :" -"class:`ssl.SSLContext` object as a *context* argument, which will be used " -"for the HTTPS connection. (Contributed by Alex Gaynor in :issue:`22366`.)" +"The :func:`request.urlopen() ` function accepts " +"an :class:`ssl.SSLContext` object as a *context* argument, which will be " +"used for the HTTPS connection. (Contributed by Alex Gaynor " +"in :issue:`22366`.)" msgstr "" +":func:`request.urlopen() ` 関数の *context* 引数" +"に :class:`ssl.SSLContext` オブジェクトを指定できるようになり、HTTPS 接続で使" +"われます。\n" +"(Contributed by Alex Gaynor in :issue:`22366`.)" -#: ../../whatsnew/3.5.rst:2048 msgid "" -"The :func:`parse.urljoin() ` was updated to use the :" -"rfc:`3986` semantics for the resolution of relative URLs, rather than :rfc:" -"`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil Kumaran " -"in :issue:`22118`.)" +"The :func:`parse.urljoin() ` was updated to use " +"the :rfc:`3986` semantics for the resolution of relative URLs, rather " +"than :rfc:`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil " +"Kumaran in :issue:`22118`.)" msgstr "" +":func:`parse.urljoin() ` は、相対 URL の解決" +"に :rfc:`1808` や :rfc:`2396` ではなく :rfc:`3986` の規則を使うように更新され" +"ました。\n" +"(Contributed by Demian Brecht and Senthil Kumaran in :issue:`22118`.)" #: ../../whatsnew/3.5.rst:2055 msgid "wsgiref" msgstr "wsgiref" -#: ../../whatsnew/3.5.rst:2057 msgid "" -"The *headers* argument of the :class:`headers.Headers ` class constructor is now optional. (Contributed by Pablo Torres " -"Navarrete and SilentGhost in :issue:`5800`.)" +"The *headers* argument of the :class:`headers.Headers " +"` class constructor is now optional. (Contributed " +"by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" msgstr "" +":class:`headers.Headers ` クラスのコンストラクタの " +"*headers* 引数が省略可能になりました。\n" +"(Contributed by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" #: ../../whatsnew/3.5.rst:2063 msgid "xmlrpc" @@ -3384,9 +3967,9 @@ msgstr "xml.sax" #: ../../whatsnew/3.5.rst:2077 msgid "" -"SAX parsers now support a character stream of the :class:`xmlreader." -"InputSource ` object. (Contributed by Serhiy " -"Storchaka in :issue:`2175`.)" +"SAX parsers now support a character stream of " +"the :class:`xmlreader.InputSource ` object. " +"(Contributed by Serhiy Storchaka in :issue:`2175`.)" msgstr "" "SAX パーサは :class:`xmlreader.InputSource ` " "オブジェクトの文字ストリームをサポートしました。\n" @@ -3405,11 +3988,12 @@ msgstr "" msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.5.rst:2088 msgid "" "ZIP output can now be written to unseekable streams. (Contributed by Serhiy " "Storchaka in :issue:`23252`.)" msgstr "" +"シークできないストリームにも ZIP を書き出せるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`23252`.)" #: ../../whatsnew/3.5.rst:2091 msgid "" @@ -3425,69 +4009,94 @@ msgstr "" msgid "Other module-level changes" msgstr "その他のモジュールレベルの変更" -#: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" -"`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " -"objects `. (Contributed by Serhiy Storchaka in :issue:" -"`23001`.)" +"Many functions in the :mod:`mmap`, :mod:`!" +"ossaudiodev`, :mod:`socket`, :mod:`ssl`, and :mod:`codecs` modules now " +"accept writable :term:`bytes-like objects `. (Contributed " +"by Serhiy Storchaka in :issue:`23001`.)" msgstr "" +"モジュール :mod:`mmap`, :mod:`!" +"ossaudiodev`, :mod:`socket`, :mod:`ssl`, :mod:`codecs` 内の多くの関数が、書" +"き込み可能な :term:`bytes 様オブジェクト ` を受け付けるよ" +"うになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`23001`.)" #: ../../whatsnew/3.5.rst:2106 msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.5.rst:2108 msgid "" "The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX " -"systems, and by 7 to 20 times on Windows. This was done using the new :func:" -"`os.scandir` function, which exposes file information from the underlying " -"``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " +"systems, and by 7 to 20 times on Windows. This was done using the " +"new :func:`os.scandir` function, which exposes file information from the " +"underlying ``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " "(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" msgstr "" +":func:`os.walk` 関数が POSIX システムで 3〜5 倍、Windows で 7〜20 倍高速にな" +"りました。\n" +"これは新しい :func:`os.scandir` 関数を使うことで実現しました。\n" +"この関数は、下位の ``readdir`` または ``FindFirstFile``/``FindNextFile`` シス" +"テムコールから得られるファイル情報を公開します。\n" +"(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" -#: ../../whatsnew/3.5.rst:2114 msgid "" "Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses " "less memory for large objects. ``calloc()`` is used instead of ``malloc()`` " -"to allocate memory for these objects. (Contributed by Victor Stinner in :" -"issue:`21233`.)" +"to allocate memory for these objects. (Contributed by Victor Stinner " +"in :issue:`21233`.)" msgstr "" +"ゼロバイトで埋められる ``bytes(int)`` の作成が高速になり、大きなオブジェクト" +"ではメモリ使用量も減りました。\n" +"これらのオブジェクトのメモリ割り当てに ``malloc()`` ではなく ``calloc()`` を" +"使うようになりました。\n" +"(Contributed by Victor Stinner in :issue:`21233`.)" -#: ../../whatsnew/3.5.rst:2119 msgid "" -"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and :" -"class:`~ipaddress.IPv6Network` have been massively sped up, such as :meth:" -"`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :" -"func:`~ipaddress.summarize_address_range`, :func:`~ipaddress." -"collapse_addresses`. The speed up can range from 3 to 15 times. (Contributed " -"by Antoine Pitrou, Michel Albert, and Markus in :issue:`21486`, :issue:" -"`21487`, :issue:`20826`, :issue:`23266`.)" +"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` " +"and :class:`~ipaddress.IPv6Network` have been massively sped up, such " +"as :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. " +"The speed up can range from 3 to 15 times. (Contributed by Antoine Pitrou, " +"Michel Albert, and Markus " +"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" msgstr "" +":mod:`ipaddress` の :class:`~ipaddress.IPv4Network` " +"と :class:`~ipaddress.IPv6Network` に対する一部の操作が大幅に高速化されまし" +"た。\n" +"例え" +"ば :meth:`~ipaddress.IPv4Network.subnets`、:meth:`~ipaddress.IPv4Network.supernet`、:func:`~ipaddress.summarize_address_range`、:func:`~ipaddress.collapse_addresses` " +"です。\n" +"速度の向上は 3〜15 倍に及びます。\n" +"(Contributed by Antoine Pitrou, Michel Albert, and Markus " +"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" -#: ../../whatsnew/3.5.rst:2127 msgid "" "Pickling of :mod:`ipaddress` objects was optimized to produce significantly " "smaller output. (Contributed by Serhiy Storchaka in :issue:`23133`.)" msgstr "" +":mod:`ipaddress` オブジェクトの pickle 化が最適化され、出力が大幅に小さくなり" +"ました。\n" +"(Contributed by Serhiy Storchaka in :issue:`23133`.)" #: ../../whatsnew/3.5.rst:2130 msgid "" "Many operations on :class:`io.BytesIO` are now 50% to 100% faster. " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" -"issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " +"in :issue:`22003`.)" msgstr "" ":class:`io.BytesIO` の多くの操作が 50% から 100% 速くなりました。 " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" -"issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " +"in :issue:`22003`.)" -#: ../../whatsnew/3.5.rst:2134 msgid "" "The :func:`marshal.dumps` function is now faster: 65--85% with versions 3 " "and 4, 20--25% with versions 0 to 2 on typical data, and up to 5 times in " -"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:" -"`23344`.)" +"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` " +"and :issue:`23344`.)" msgstr "" +":func:`marshal.dumps` 関数が高速化されました。\n" +"典型的なデータではバージョン 3 と 4 で 65〜85%、バージョン 0〜2 で 20〜25% 高" +"速になり、最も効果的な場合は最大 5 倍になります。\n" +"(Contributed by Serhiy Storchaka in :issue:`20416` and :issue:`23344`.)" #: ../../whatsnew/3.5.rst:2139 msgid "" @@ -3505,26 +4114,30 @@ msgstr "" "正規表現のパースが最高で 10% 速くなりました。 (Contributed by Serhiy " "Storchaka in :issue:`19380`.)" -#: ../../whatsnew/3.5.rst:2145 msgid "" "The :func:`json.dumps` function was optimized to run with " "``ensure_ascii=False`` as fast as with ``ensure_ascii=True``. (Contributed " "by Naoki Inada in :issue:`23206`.)" msgstr "" +":func:`json.dumps` 関数が最適化され、``ensure_ascii=False`` の場合も " +"``ensure_ascii=True`` と同じ速さで実行できるようになりました。\n" +"(Contributed by Naoki Inada in :issue:`23206`.)" -#: ../../whatsnew/3.5.rst:2149 msgid "" "The :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` " -"functions have been sped up in the common case that the second argument has :" -"class:`type` as its metaclass. (Contributed Georg Brandl by in :issue:" -"`22540`.)" +"functions have been sped up in the common case that the second argument " +"has :class:`type` as its metaclass. (Contributed Georg Brandl by " +"in :issue:`22540`.)" msgstr "" +":c:func:`PyObject_IsInstance` と :c:func:`PyObject_IsSubclass` 関数が、第 2 " +"引数のメタクラスが :class:`type` である一般的な場合に高速化されました。\n" +"(Georg Brandl による貢献、:issue:`22540`。)" #: ../../whatsnew/3.5.rst:2154 msgid "" "Method caching was slightly improved, yielding up to 5% performance " -"improvement in some benchmarks. (Contributed by Antoine Pitrou in :issue:" -"`22847`.)" +"improvement in some benchmarks. (Contributed by Antoine Pitrou " +"in :issue:`22847`.)" msgstr "" "メソッドのキャッシュが少し改良されました。ベンチマークによっては性能が最高で " "5% 向上しました。 (Contributed by Antoine Pitrou in :issue:`22847`.)" @@ -3553,13 +4166,18 @@ msgstr "" ":class:`fractions.Fraction` のインスタンス化が最高で 30% 速くなりました。 " "(Contributed by Stefan Behnel in :issue:`22464`.)" -#: ../../whatsnew/3.5.rst:2167 msgid "" -"String methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :" -"meth:`~str.partition` and the :keyword:`in` string operator are now " -"significantly faster for searching 1-character substrings. (Contributed by " -"Serhiy Storchaka in :issue:`23573`.)" +"String " +"methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :meth:`~str.partition` " +"and the :keyword:`in` string operator are now significantly faster for " +"searching 1-character substrings. (Contributed by Serhiy Storchaka " +"in :issue:`23573`.)" msgstr "" +"文字列メソッ" +"ド :meth:`~str.find`、:meth:`~str.rfind`、:meth:`~str.split`、:meth:`~str.partition` " +"と文字列の :keyword:`in` 演算子が、1 文字の部分文字列の検索で大幅に高速化され" +"ました。\n" +"(Contributed by Serhiy Storchaka in :issue:`23573`.)" #: ../../whatsnew/3.5.rst:2174 msgid "Build and C API Changes" @@ -3579,7 +4197,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`.)" @@ -3601,53 +4219,67 @@ msgstr ":c:func:`Py_EncodeLocale` (``_Py_wchar2char()`` の代わり)." msgid "(Contributed by Victor Stinner in :issue:`18395`.)" msgstr "(Contributed by Victor Stinner in :issue:`18395`.)" -#: ../../whatsnew/3.5.rst:2191 msgid "" "A new :c:func:`PyCodec_NameReplaceErrors` function to replace the unicode " -"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka in :" -"issue:`19676`.)" +"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka " +"in :issue:`19676`.)" msgstr "" +"Unicode のエンコードエラーを ``\\N{...}`` エスケープに置き換え" +"る :c:func:`PyCodec_NameReplaceErrors` 関数が追加されました。\n" +"(Contributed by Serhiy Storchaka in :issue:`19676`.)" -#: ../../whatsnew/3.5.rst:2195 msgid "" "A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`, " -"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou in :" -"issue:`18711`.)" +"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou " +"in :issue:`18711`.)" msgstr "" +":c:func:`PyErr_Format` と同様の機能を持ち、:c:type:`va_list` 引数を受け付け" +"る :c:func:`PyErr_FormatV` 関数が追加されました。\n" +"(Contributed by Antoine Pitrou in :issue:`18711`.)" -#: ../../whatsnew/3.5.rst:2199 msgid "" "A new :c:data:`PyExc_RecursionError` exception. (Contributed by Georg Brandl " "in :issue:`19235`.)" msgstr "" +":c:data:`PyExc_RecursionError` 例外が追加されました。\n" +"(Contributed by Georg Brandl in :issue:`19235`.)" -#: ../../whatsnew/3.5.rst:2202 msgid "" "New :c:func:`PyModule_FromDefAndSpec`, :c:func:`PyModule_FromDefAndSpec2`, " "and :c:func:`PyModule_ExecDef` functions introduced by :pep:`489` -- multi-" -"phase extension module initialization. (Contributed by Petr Viktorin in :" -"issue:`24268`.)" +"phase extension module initialization. (Contributed by Petr Viktorin " +"in :issue:`24268`.)" msgstr "" +":pep:`489` の拡張モジュールの複数フェーズ初期化によ" +"り、:c:func:`PyModule_FromDefAndSpec`、:c:func:`PyModule_FromDefAndSpec2`、:c:func:`PyModule_ExecDef` " +"関数が追加されました。\n" +"(Contributed by Petr Viktorin in :issue:`24268`.)" -#: ../../whatsnew/3.5.rst:2207 msgid "" -"New :c:func:`PyNumber_MatrixMultiply` and :c:func:" -"`PyNumber_InPlaceMatrixMultiply` functions to perform matrix multiplication. " -"(Contributed by Benjamin Peterson in :issue:`21176`. See also :pep:`465` " -"for details.)" +"New :c:func:`PyNumber_MatrixMultiply` " +"and :c:func:`PyNumber_InPlaceMatrixMultiply` functions to perform matrix " +"multiplication. (Contributed by Benjamin Peterson in :issue:`21176`. See " +"also :pep:`465` for details.)" msgstr "" +"行列乗算を行う :c:func:`PyNumber_MatrixMultiply` " +"と :c:func:`PyNumber_InPlaceMatrixMultiply` 関数が追加されました。\n" +"(Benjamin Peterson による貢献、:issue:`21176`。詳しくは :pep:`465` も参照して" +"ください。)" -#: ../../whatsnew/3.5.rst:2213 msgid "" "The :c:member:`PyTypeObject.tp_finalize` slot is now part of the stable ABI." msgstr "" +":c:member:`PyTypeObject.tp_finalize` スロットが安定 ABI の一部になりました。" -#: ../../whatsnew/3.5.rst:2215 msgid "" "Windows builds now require Microsoft Visual C++ 14.0, which is available as " "part of `Visual Studio 2015 `_." msgstr "" +"Windows のビルドには Microsoft Visual C++ 14.0 が必要になりました。\n" +"これは `Visual Studio 2015 `_ の一部として入手できま" +"す。" #: ../../whatsnew/3.5.rst:2218 msgid "" @@ -3776,14 +4408,14 @@ msgstr "非推奨の Python の挙動" msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a silent :exc:`PendingDeprecationWarning`, which will become a non-" -"silent deprecation warning in Python 3.6 and will trigger a :exc:" -"`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " +"silent deprecation warning in Python 3.6 and will trigger " +"a :exc:`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " "handling inside generators ` for details." msgstr "" -"ジェネレータ内で :exc:`StopIteration` 例外を送出すると現在は静かな :exc:" -"`PendingDeprecationWarning` が発生します。\n" -"これは、Python 3.6 では静かでない非推奨の警告となり、Python 3.7 では :exc:" -"`RuntimeError` を起こします。\n" +"ジェネレータ内で :exc:`StopIteration` 例外を送出すると現在は静か" +"な :exc:`PendingDeprecationWarning` が発生します。\n" +"これは、Python 3.6 では静かでない非推奨の警告となり、Python 3.7 で" +"は :exc:`RuntimeError` を起こします。\n" "詳細は :ref:`PEP 479: Change StopIteration handling inside generators " "` を参照してください。" @@ -3796,8 +4428,9 @@ msgid "" "Windows XP is no longer supported by Microsoft, thus, per :PEP:`11`, CPython " "3.5 is no longer officially supported on this OS." msgstr "" -"Windows XP は Microsoft によって既にサポートされていません。このため :PEP:" -"`11` により、CPython 3.5 ではこの OS をもはや公式にはサポートしません。" +"Windows XP は Microsoft によって既にサポートされていません。このた" +"め :PEP:`11` により、CPython 3.5 ではこの OS をもはや公式にはサポートしませ" +"ん。" #: ../../whatsnew/3.5.rst:2291 msgid "Deprecated Python modules, functions and methods" @@ -3813,13 +4446,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2296 msgid "" -"The :func:`asyncio.async` function is deprecated in favor of :func:`~asyncio." -"ensure_future`." +"The :func:`asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`." msgstr "" ":func:`asyncio.async` 関数は :func:`~asyncio.ensure_future` により非推奨にな" "りました。" -#: ../../whatsnew/3.5.rst:2299 msgid "" "The :mod:`!smtpd` module has in the past always decoded the DATA portion of " "email messages using the ``utf-8`` codec. This can now be controlled by the " @@ -3827,28 +4459,36 @@ msgid "" "``True``, but this default is deprecated. Specify the *decode_data* keyword " "with an appropriate value to avoid the deprecation warning." msgstr "" +":mod:`!smtpd` モジュールは従来、メールメッセージの DATA 部分を常に ``utf-8`` " +"コーデックでデコードしていました。\n" +"この動作を :class:`!SMTPServer` の新しい *decode_data* キーワードで制御できる" +"ようになりました。\n" +"デフォルト値は ``True`` ですが、このデフォルト値は非推奨です。\n" +"非推奨の警告を避けるには、*decode_data* キーワードに適切な値を指定してくださ" +"い。" #: ../../whatsnew/3.5.rst:2305 msgid "" -"Directly assigning values to the :attr:`~http.cookies.Morsel.key`, :attr:" -"`~http.cookies.Morsel.value` and :attr:`~http.cookies.Morsel.coded_value` " -"of :class:`http.cookies.Morsel` objects is deprecated. Use the :meth:`~http." -"cookies.Morsel.set` method instead. In addition, the undocumented " -"*LegalChars* parameter of :meth:`~http.cookies.Morsel.set` is deprecated, " -"and is now ignored." -msgstr "" -":class:`http.cookies.Morsel` オブジェクトの :attr:`~http.cookies.Morsel." -"key`, :attr:`~http.cookies.Morsel.value`, :attr:`~http.cookies.Morsel." -"coded_value` に対して直接代入することは非推奨です。 :meth:`~http.cookies." -"Morsel.set` メソッドを使うようにしてください。また、 :meth:`~http.cookies." -"Morsel.set` のドキュメントされていなかった *LegalChars* パラメータは非推奨と" -"なり、無視されます。" +"Directly assigning values to " +"the :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of :class:`http.cookies.Morsel` " +"objects is deprecated. Use the :meth:`~http.cookies.Morsel.set` method " +"instead. In addition, the undocumented *LegalChars* parameter " +"of :meth:`~http.cookies.Morsel.set` is deprecated, and is now ignored." +msgstr "" +":class:`http.cookies.Morsel` オブジェクト" +"の :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value`, :attr:`~http.cookies.Morsel.coded_value` " +"に対して直接代入することは非推奨です。 :meth:`~http.cookies.Morsel.set` メ" +"ソッドを使うようにしてください。また、 :meth:`~http.cookies.Morsel.set` のド" +"キュメントされていなかった *LegalChars* パラメータは非推奨となり、無視されま" +"す。" #: ../../whatsnew/3.5.rst:2312 msgid "" -"Passing a format string as keyword argument *format_string* to the :meth:" -"`~string.Formatter.format` method of the :class:`string.Formatter` class has " -"been deprecated. (Contributed by Serhiy Storchaka in :issue:`23671`.)" +"Passing a format string as keyword argument *format_string* to " +"the :meth:`~string.Formatter.format` method of the :class:`string.Formatter` " +"class has been deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`23671`.)" msgstr "" ":class:`string.Formatter` クラスの :meth:`~string.Formatter.format` メソッド" "に対し、キーワード引数 *format_string* としてフォーマット文字列を渡すことは非" @@ -3870,14 +4510,14 @@ msgstr "" #: ../../whatsnew/3.5.rst:2322 msgid "" "The previously undocumented ``from_function`` and ``from_builtin`` methods " -"of :class:`inspect.Signature` are deprecated. Use the new :meth:`Signature." -"from_callable() ` method instead. " -"(Contributed by Yury Selivanov in :issue:`24248`.)" +"of :class:`inspect.Signature` are deprecated. Use the " +"new :meth:`Signature.from_callable() ` " +"method instead. (Contributed by Yury Selivanov in :issue:`24248`.)" msgstr "" ":class:`inspect.Signature` の、以前からドキュメントされていなかったメソッド " -"``from_function`` と ``from_builtin`` は非推奨です。新しい :meth:`Signature." -"from_callable() ` を代わりに使ってくださ" -"い。 (Contributed by Yury Selivanov in :issue:`24248`.)" +"``from_function`` と ``from_builtin`` は非推奨です。新し" +"い :meth:`Signature.from_callable() ` を代わ" +"りに使ってください。 (Contributed by Yury Selivanov in :issue:`24248`.)" #: ../../whatsnew/3.5.rst:2327 msgid "" @@ -3889,17 +4529,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:2330 msgid "" -"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." -"getcallargs`, and :func:`~inspect.formatargspec` functions are deprecated in " -"favor of the :func:`inspect.signature` API. (Contributed by Yury Selivanov " +"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect.getcallargs`, " +"and :func:`~inspect.formatargspec` functions are deprecated in favor of " +"the :func:`inspect.signature` API. (Contributed by Yury Selivanov " "in :issue:`20438`.)" msgstr "" -#: ../../whatsnew/3.5.rst:2335 msgid "" ":func:`~inspect.getargvalues` and :func:`~inspect.formatargvalues` functions " "were inadvertently marked as deprecated with the release of Python 3.5.0." msgstr "" +":func:`~inspect.getargvalues` と :func:`~inspect.formatargvalues` 関数は、" +"Python 3.5.0 のリリース時に誤って非推奨と記載されました。" #: ../../whatsnew/3.5.rst:2338 msgid "" @@ -3907,8 +4548,8 @@ msgid "" "deprecated. (Contributed by Serhiy Storchaka in :issue:`22407`.)" msgstr "" "str のパターンとともに :const:`re.LOCALE` や :const:`re.ASCII` フラグを使用す" -"ることは非推奨となりました。 (Contributed by Serhiy Storchaka in :issue:" -"`22407`.)" +"ることは非推奨となりました。 (Contributed by Serhiy Storchaka " +"in :issue:`22407`.)" #: ../../whatsnew/3.5.rst:2341 msgid "" @@ -3919,15 +4560,15 @@ msgid "" msgstr "" "``'\\'`` と ASCII 文字からなる認識出来ない特殊シーケンスが正規表現内と置き換" "えパターン内で使われた場合に、非推奨警告を出すようになりました。Python 3.6 で" -"は禁止されるようになります。 (Contributed by Serhiy Storchaka in :issue:" -"`23622`.)" +"は禁止されるようになります。 (Contributed by Serhiy Storchaka " +"in :issue:`23622`.)" #: ../../whatsnew/3.5.rst:2346 msgid "" -"The undocumented and unofficial *use_load_tests* default argument of the :" -"meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated and " -"ignored. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The undocumented and unofficial *use_load_tests* default argument of " +"the :meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated " +"and ignored. (Contributed by Robert Collins and Barry A. Warsaw " +"in :issue:`16662`.)" msgstr "" ":meth:`unittest.TestLoader.loadTestsFromModule` メソッドのドキュメントされて" "おらず非公式の *use_load_tests* デフォルト引数は非推奨となり、無視されます。 " @@ -4002,11 +4643,12 @@ msgid "" msgstr "" "以前のバージョンの Python で、誤って以下の構文を許容してしまっていました::" -#: ../../whatsnew/3.5.rst:2389 msgid "" "f(1 for x in [1], *args)\n" "f(1 for x in [1], **kwargs)" msgstr "" +"f(1 for x in [1], *args)\n" +"f(1 for x in [1], **kwargs)" #: ../../whatsnew/3.5.rst:2392 msgid "" @@ -4038,8 +4680,8 @@ msgstr "" msgid "" "Before Python 3.5, a :class:`datetime.time` object was considered to be " "false if it represented midnight in UTC. This behavior was considered " -"obscure and error-prone and has been removed in Python 3.5. See :issue:" -"`13936` for full details." +"obscure and error-prone and has been removed in Python 3.5. " +"See :issue:`13936` for full details." msgstr "" "Python 3.5 以前は、 :class:`.time` オブジェクトは UTC で深夜を表すときに偽と" "みなされていました。\n" @@ -4049,10 +4691,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2408 msgid "" -"The :meth:`ssl.SSLSocket.send` method now raises either :exc:`ssl." -"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " -"if the operation would block. Previously, it would return ``0``. " -"(Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`ssl.SSLSocket.send` method now raises " +"either :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:2413 @@ -4070,15 +4712,21 @@ msgstr "" "り、ジェネレータの表現をする際 (``repr(gen)``) にこれを用いるようになりまし" "た。 (Contributed by Victor Stinner in :issue:`21205`.)" -#: ../../whatsnew/3.5.rst:2420 msgid "" -"The deprecated \"strict\" mode and argument of :class:`~html.parser." -"HTMLParser`, :meth:`!HTMLParser.error`, and the :exc:`!HTMLParserError` " -"exception have been removed. (Contributed by Ezio Melotti in :issue:" -"`15114`.) The *convert_charrefs* argument of :class:`~html.parser." -"HTMLParser` is now ``True`` by default. (Contributed by Berker Peksag in :" -"issue:`21047`.)" +"The deprecated \"strict\" mode and argument " +"of :class:`~html.parser.HTMLParser`, :meth:`!HTMLParser.error`, and " +"the :exc:`!HTMLParserError` exception have been removed. (Contributed by " +"Ezio Melotti in :issue:`15114`.) The *convert_charrefs* argument " +"of :class:`~html.parser.HTMLParser` is now ``True`` by default. " +"(Contributed by Berker Peksag in :issue:`21047`.)" msgstr "" +"非推奨だった :class:`~html.parser.HTMLParser` の \"strict\" モードと引" +"数、:meth:`!HTMLParser.error`、:exc:`!HTMLParserError` 例外が削除されまし" +"た。\n" +"(Ezio Melotti による貢献、:issue:`15114`。)\n" +":class:`~html.parser.HTMLParser` の *convert_charrefs* 引数のデフォルト値が " +"``True`` になりました。\n" +"(Berker Peksag による貢献、:issue:`21047`。)" #: ../../whatsnew/3.5.rst:2426 msgid "" @@ -4096,18 +4744,19 @@ msgstr "" #: ../../whatsnew/3.5.rst:2432 msgid "" -"If the current directory is set to a directory that no longer exists then :" -"exc:`FileNotFoundError` will no longer be raised and instead :meth:" -"`~importlib.machinery.FileFinder.find_spec` will return ``None`` **without** " -"caching ``None`` in :data:`sys.path_importer_cache`, which is different than " -"the typical case (:issue:`22834`)." +"If the current directory is set to a directory that no longer exists " +"then :exc:`FileNotFoundError` will no longer be raised and " +"instead :meth:`~importlib.machinery.FileFinder.find_spec` will return " +"``None`` **without** caching ``None`` in :data:`sys.path_importer_cache`, " +"which is different than the typical case (:issue:`22834`)." msgstr "" "既に存在していないディレクトリをカレントディレクトリとして指していた場合" -"に、 :meth:`~importlib.machinery.FileFinder.find_spec` は以前は :exc:" -"`FileNotFoundError` 例外を送出していましたが、そうではなく ``None`` を返却す" -"るようになりました。この際 :data:`sys.path_importer_cache` に ``None`` を **" -"キャッシュはしません** 。これは典型的なケースとは違います(訳注: `msg231477 " -"`_)。 (:issue:`22834`)" +"に、 :meth:`~importlib.machinery.FileFinder.find_spec` は以前" +"は :exc:`FileNotFoundError` 例外を送出していましたが、そうではなく ``None`` " +"を返却するようになりました。この際 :data:`sys.path_importer_cache` に " +"``None`` を **キャッシュはしません** 。これは典型的なケースとは違います(訳" +"注: `msg231477 `_)。 " +"(:issue:`22834`)" #: ../../whatsnew/3.5.rst:2438 msgid "" @@ -4117,29 +4766,29 @@ msgid "" "compatibility. (Contributed by Demian Brecht in :issue:`21793`.)" msgstr "" ":mod:`http.client` モジュールと :mod:`http.server` モジュールに散らばってい" -"た HTTP ステータスコードと対応するメッセージを、共通の :class:`~http." -"HTTPStatus` enum としてまとめ直しました。:mod:`http.client` 、 :mod:`http." -"server` にあったもとの値も後方互換性のために残してあります。 (Contributed by " -"Demian Brecht in :issue:`21793`.)" +"た HTTP ステータスコードと対応するメッセージを、共通" +"の :class:`~http.HTTPStatus` enum としてまとめ直しまし" +"た。:mod:`http.client` 、 :mod:`http.server` にあったもとの値も後方互換性のた" +"めに残してあります。 (Contributed by Demian Brecht in :issue:`21793`.)" #: ../../whatsnew/3.5.rst:2443 msgid "" "When an import loader defines :meth:`importlib.machinery.Loader.exec_module` " -"it is now expected to also define :meth:`~importlib.machinery.Loader." -"create_module` (raises a :exc:`DeprecationWarning` now, will be an error in " -"Python 3.6). If the loader inherits from :class:`importlib.abc.Loader` then " -"there is nothing to do, else simply define :meth:`~importlib.machinery." -"Loader.create_module` to return ``None``. (Contributed by Brett Cannon in :" -"issue:`23014`.)" +"it is now expected to also " +"define :meth:`~importlib.machinery.Loader.create_module` (raises " +"a :exc:`DeprecationWarning` now, will be an error in Python 3.6). If the " +"loader inherits from :class:`importlib.abc.Loader` then there is nothing to " +"do, else simply define :meth:`~importlib.machinery.Loader.create_module` to " +"return ``None``. (Contributed by Brett Cannon in :issue:`23014`.)" msgstr "" "インポートローダが :meth:`importlib.machinery.Loader.exec_module` を定義する" "場合は、同時に :meth:`~importlib.machinery.Loader.create_module` も定義されて" "いることを要求するように変更されました (今のところ :exc:`DeprecationWarning` " -"となりますが、Python 3.6 ではエラーとなります)。ローダが :class:`importlib." -"abc.Loader` を継承していれば特にこの変更の影響を受けることはありません。そう" -"でないならば、 ``None`` を返すだけの :meth:`~importlib.machinery.Loader." -"create_module` を定義してください。 (Contributed by Brett Cannon in :issue:" -"`23014`.)" +"となりますが、Python 3.6 ではエラーとなります)。ローダ" +"が :class:`importlib.abc.Loader` を継承していれば特にこの変更の影響を受けるこ" +"とはありません。そうでないならば、 ``None`` を返すだけ" +"の :meth:`~importlib.machinery.Loader.create_module` を定義してください。 " +"(Contributed by Brett Cannon in :issue:`23014`.)" #: ../../whatsnew/3.5.rst:2451 msgid "" @@ -4162,45 +4811,58 @@ msgstr "" #: ../../whatsnew/3.5.rst:2459 msgid "" "The :class:`http.cookies.Morsel` dict-like interface has been made self " -"consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel." -"key` and :attr:`~http.cookies.Morsel.value` into account, :meth:`~http." -"cookies.Morsel.copy` now results in a :class:`~http.cookies.Morsel` instance " -"rather than a :class:`dict`, and :meth:`~http.cookies.Morsel.update` will " -"now raise an exception if any of the keys in the update dictionary are " -"invalid. In addition, the undocumented *LegalChars* parameter of :func:" -"`~http.cookies.Morsel.set` is deprecated and is now ignored. (Contributed " -"by Demian Brecht in :issue:`2211`.)" +"consistent: morsel comparison now takes " +"the :attr:`~http.cookies.Morsel.key` and :attr:`~http.cookies.Morsel.value` " +"into account, :meth:`~http.cookies.Morsel.copy` now results in " +"a :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, " +"and :meth:`~http.cookies.Morsel.update` will now raise an exception if any " +"of the keys in the update dictionary are invalid. In addition, the " +"undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is " +"deprecated and is now ignored. (Contributed by Demian Brecht " +"in :issue:`2211`.)" msgstr "" ":class:`http.cookies.Morsel` 辞書風インターフェイスのそれ自身での一貫性を持た" -"せるようにしました: morsel の比較に :attr:`~http.cookies.Morsel.key` と :" -"attr:`~http.cookies.Morsel.value` を考慮するようにし、 :meth:`~http.cookies." -"Morsel.copy` は :class:`dict` を返さずに :class:`~http.cookies.Morsel` インス" -"タンスを返すようにし、 :meth:`~http.cookies.Morsel.update` は更新する辞書内の" -"いずれかのキーが不正(訳注: :rfc:`2109` として不正なキーのことで、update 以外" -"のインターフェイスでは変更前も拒絶される)であれば例外を投げるようにしていま" -"す。加えて、ドキュメントされていない :func:`~http.cookies.Morsel.set` の " -"*LegalChars* パラメータは非推奨となり、また指定しても無視されます。 " -"(Contributed by Demian Brecht in :issue:`2211`.)" - -#: ../../whatsnew/3.5.rst:2469 +"せるようにしました: morsel の比較に :attr:`~http.cookies.Morsel.key` " +"と :attr:`~http.cookies.Morsel.value` を考慮するように" +"し、 :meth:`~http.cookies.Morsel.copy` は :class:`dict` を返さず" +"に :class:`~http.cookies.Morsel` インスタンスを返すように" +"し、 :meth:`~http.cookies.Morsel.update` は更新する辞書内のいずれかのキーが不" +"正(訳注: :rfc:`2109` として不正なキーのことで、update 以外のインターフェイス" +"では変更前も拒絶される)であれば例外を投げるようにしています。加えて、ドキュメ" +"ントされていない :func:`~http.cookies.Morsel.set` の *LegalChars* パラメータ" +"は非推奨となり、また指定しても無視されます。 (Contributed by Demian Brecht " +"in :issue:`2211`.)" + msgid "" ":pep:`488` has removed ``.pyo`` files from Python and introduced the " -"optional ``opt-`` tag in ``.pyc`` file names. The :func:`importlib.util." -"cache_from_source` has gained an *optimization* parameter to help control " -"the ``opt-`` tag. Because of this, the *debug_override* parameter of the " -"function is now deprecated. ``.pyo`` files are also no longer supported as a " -"file argument to the Python interpreter and thus serve no purpose when " -"distributed on their own (i.e. sourceless code distribution). Due to the " -"fact that the magic number for bytecode has changed in Python 3.5, all old " -"``.pyo`` files from previous versions of Python are invalid regardless of " -"this PEP." -msgstr "" +"optional ``opt-`` tag in ``.pyc`` file names. " +"The :func:`importlib.util.cache_from_source` has gained an *optimization* " +"parameter to help control the ``opt-`` tag. Because of this, the " +"*debug_override* parameter of the function is now deprecated. ``.pyo`` files " +"are also no longer supported as a file argument to the Python interpreter " +"and thus serve no purpose when distributed on their own (i.e. sourceless " +"code distribution). Due to the fact that the magic number for bytecode has " +"changed in Python 3.5, all old ``.pyo`` files from previous versions of " +"Python are invalid regardless of this PEP." +msgstr "" +":pep:`488` により ``.pyo`` ファイルが廃止され、``.pyc`` ファイル名に省略可能" +"な ``opt-`` タグが導入されました。\n" +":func:`importlib.util.cache_from_source` に ``opt-`` タグを制御する " +"*optimization* パラメータが追加され、*debug_override* パラメータは非推奨にな" +"りました。\n" +"``.pyo`` ファイルを Python インタープリタのファイル引数に指定することもできな" +"くなったため、単独で配布しても意味がありません (ソースコードなしの配布な" +"ど)。\n" +"なお Python 3.5 ではバイトコードのマジックナンバーが変更されたため、この PEP " +"にかかわらず以前の Python バージョンの ``.pyo`` ファイルはすべて無効です。" -#: ../../whatsnew/3.5.rst:2480 msgid "" "The :mod:`socket` module now exports the :const:`~socket.CAN_RAW_FD_FRAMES` " "constant on linux 3.6 and greater." msgstr "" +":mod:`socket` モジュールが、linux 3.6 以降" +"で :const:`~socket.CAN_RAW_FD_FRAMES` 定数をエクスポートするようになりまし" +"た。" #: ../../whatsnew/3.5.rst:2483 msgid "" @@ -4209,8 +4871,8 @@ msgid "" "value is always an :class:`int`. (Contributed by Akira Li in :issue:`19940`.)" msgstr "" ":rfc:`5280` に基づき、 :func:`ssl.cert_time_to_seconds` 関数が入力の時刻を" -"ローカル時刻ではなく UTC として解釈するようになりました。また、戻り値は常に :" -"class:`int` となります。 (Contributed by Akira Li in :issue:`19940`.)" +"ローカル時刻ではなく UTC として解釈するようになりました。また、戻り値は常" +"に :class:`int` となります。 (Contributed by Akira Li in :issue:`19940`.)" #: ../../whatsnew/3.5.rst:2487 msgid "" @@ -4227,11 +4889,11 @@ msgid "" "(test) program depends on patching the module-level variable to capture the " "debug output, you will need to update it to capture sys.stderr instead." msgstr "" -":mod:`smtplib` モジュールは以前はデバッグ出力のためにモジュールレベルの :" -"data:`stderr` 変数を使っていましたが、 :data:`sys.stderr` を使うようになりま" -"した。もしもあなたの(テスト)プログラムが、そのデバッグ出力をキャプチャするた" -"めにこのモジュールレベル変数に依存してたのであれば、今後は sys.stderr をキャ" -"プチャするようにする必要があります。" +":mod:`smtplib` モジュールは以前はデバッグ出力のためにモジュールレベル" +"の :data:`stderr` 変数を使っていましたが、 :data:`sys.stderr` を使うようにな" +"りました。もしもあなたの(テスト)プログラムが、そのデバッグ出力をキャプチャす" +"るためにこのモジュールレベル変数に依存してたのであれば、今後は sys.stderr を" +"キャプチャするようにする必要があります。" #: ../../whatsnew/3.5.rst:2495 msgid "" @@ -4250,8 +4912,8 @@ msgid "" "duplicated if the inherited documentation is appropriate. To suppress an " "inherited string, an empty string must be specified (or the documentation " "may be filled in). This change affects the output of the :mod:`pydoc` " -"module and the :func:`help` function. (Contributed by Serhiy Storchaka in :" -"issue:`15582`.)" +"module and the :func:`help` function. (Contributed by Serhiy Storchaka " +"in :issue:`15582`.)" msgstr "" ":func:`inspect.getdoc` 関数が基底クラスから継承したドキュメンテーション文字列" "を返すようになりました。その継承したドキュメンテーション文字列が相応しいので" @@ -4263,9 +4925,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2507 msgid "" "Nested :func:`functools.partial` calls are now flattened. If you were " -"relying on the previous behavior, you can now either add an attribute to a :" -"func:`functools.partial` object or you can create a subclass of :func:" -"`functools.partial`. (Contributed by Alexander Belopolsky in :issue:`7830`.)" +"relying on the previous behavior, you can now either add an attribute to " +"a :func:`functools.partial` object or you can create a subclass " +"of :func:`functools.partial`. (Contributed by Alexander Belopolsky " +"in :issue:`7830`.)" msgstr "" "ネストされた :func:`functools.partial` 呼び出しは平坦化されるようになりまし" "た。以前の振る舞いに依存していたのであれば :func:`functools.partial` オブジェ" @@ -4283,88 +4946,101 @@ msgstr "C API の変更" #: ../../whatsnew/3.5.rst:2516 msgid "" -"The undocumented :c:member:`!format` member of the (non-public) :c:type:" -"`PyMemoryViewObject` structure has been removed. All extensions relying on " -"the relevant parts in ``memoryobject.h`` must be rebuilt." +"The undocumented :c:member:`!format` member of the (non-" +"public) :c:type:`PyMemoryViewObject` structure has been removed. All " +"extensions relying on the relevant parts in ``memoryobject.h`` must be " +"rebuilt." msgstr "" #: ../../whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`PyMemAllocator` structure was renamed to :c:type:" -"`PyMemAllocatorEx` and a new ``calloc`` field was added." +"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`` フィールドが追加されました。" -#: ../../whatsnew/3.5.rst:2524 msgid "" "Removed non-documented macro :c:macro:`!PyObject_REPR()` which leaked " "references. Use format character ``%R`` in :c:func:`PyUnicode_FromFormat`-" "like functions to format the :func:`repr` of the object. (Contributed by " "Serhiy Storchaka in :issue:`22453`.)" msgstr "" +"参照をリークしていた、文書化されていないマクロ :c:macro:`!PyObject_REPR()` が" +"削除されました。\n" +"オブジェクトの :func:`repr` を書式化するには、:c:func:`PyUnicode_FromFormat` " +"などの関数で書式指定 ``%R`` を使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`22453`.)" -#: ../../whatsnew/3.5.rst:2529 msgid "" "Because the lack of the :attr:`~type.__module__` attribute breaks pickling " "and introspection, a deprecation warning is now raised for builtin types " -"without the :attr:`~type.__module__` attribute. This will be an :exc:" -"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" -"`20204`.)" +"without the :attr:`~type.__module__` attribute. This will be " +"an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka " +"in :issue:`20204`.)" msgstr "" +":attr:`~type.__module__` 属性がないと pickle 化やイントロスペクションが正しく" +"動作しないため、:attr:`~type.__module__` 属性を持たない組み込み型に対して非推" +"奨の警告が出るようになりました。\n" +"将来は :exc:`AttributeError` になります。\n" +"(Contributed by Serhiy Storchaka in :issue:`20204`.)" -#: ../../whatsnew/3.5.rst:2535 msgid "" -"As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:" -"type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject." -"tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures " -"and functions." +"As part of the :pep:`492` implementation, the ``tp_reserved`` slot " +"of :c:type:`PyTypeObject` was replaced with " +"a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` " +"for new types, structures and functions." msgstr "" +":pep:`492` の実装の一環として、:c:type:`PyTypeObject` の ``tp_reserved`` ス" +"ロットが :c:member:`~PyTypeObject.tp_as_async` スロットに置き換えられまし" +"た。\n" +"新しい型、構造体、関数については :ref:`coro-objects` を参照してください。" -#: ../../whatsnew/3.5.rst:2542 msgid "Notable changes in Python 3.5.4" -msgstr "" +msgstr "Python 3.5.4 の注目すべき変更" -#: ../../whatsnew/3.5.rst:2545 msgid "New ``make regen-all`` build target" -msgstr "" +msgstr "新しいビルドターゲット ``make regen-all``" -#: ../../whatsnew/3.5.rst:2547 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " "available, the autotools-based build system no longer attempts to implicitly " "recompile generated files based on file modification times." msgstr "" +"クロスコンパイルを簡単にし、既存の Python がなくても CPython を確実にコンパイ" +"ルできるようにするため、autotools ベースのビルドシステムは、更新日時に基づい" +"て生成ファイルを暗黙に再コンパイルしなくなりました。" -#: ../../whatsnew/3.5.rst:2552 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" +"代わりに、必要なときにこれらのファイルを強制的に再生成する ``make regen-" +"all`` コマンドが追加されました (例えば、あらかじめ生成されたファイルを使って" +"最初の Python をビルドした後など)。" -#: ../../whatsnew/3.5.rst:2556 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" +"対象を絞った再生成用ターゲットも定義されています。\n" +"詳しくは :source:`Makefile.pre.in` を参照してください。" -#: ../../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" -msgstr "" +msgstr "ビルドターゲット ``make touch`` の削除" -#: ../../whatsnew/3.5.rst:2567 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" +"生成ファイルの更新日時を変更して暗黙の再生成を要求するために使われていた " +"``make touch`` ビルドターゲットが削除されました。" -#: ../../whatsnew/3.5.rst:2570 msgid "It has been replaced by the new ``make regen-all`` target." -msgstr "" +msgstr "代わりに新しい ``make regen-all`` ターゲットを使ってください。" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 721a5dadf..6b98acafb 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 @@ -40,12 +40,15 @@ msgstr "エディタ" msgid "Elvis Pranskevichus , Yury Selivanov " msgstr "Elvis Pranskevichus , Yury Selivanov " -#: ../../whatsnew/3.6.rst:47 msgid "" "This article explains the new features in Python 3.6, compared to 3.5. " "Python 3.6 was released on December 23, 2016. See the `changelog `_ for a full list of changes." msgstr "" +"この記事では 3.5 と比較した Python 3.6 の新機能を解説します。\n" +"Python 3.6 は2016年12月23日にリリースされました。\n" +"全詳細については `変更履歴 `_ をご覧ください。" #: ../../whatsnew/3.6.rst:54 msgid ":pep:`494` - Python 3.6 Release Schedule" @@ -97,17 +100,17 @@ msgstr "CPython の実装の改善:" #: ../../whatsnew/3.6.rst:80 msgid "" -"The :ref:`dict ` type has been reimplemented to use a :ref:" -"`more compact representation ` based on `a proposal " -"by Raymond Hettinger `_ and similar to the `PyPy dict implementation`_. " -"This resulted in dictionaries using 20% to 25% less memory when compared to " -"Python 3.5." -msgstr "" -":ref:`dict ` 型は、 `Raymond Hettinger `_ の提案に基づき、 `PyPy " -"dict implementation`_ と同様の :ref:`よりコンパクトな表現 ` を使うように再実装されました。\n" +"The :ref:`dict ` type has been reimplemented to use " +"a :ref:`more compact representation ` based on `a " +"proposal by Raymond Hettinger `_ and similar to the `PyPy dict " +"implementation`_. This resulted in dictionaries using 20% to 25% less " +"memory when compared to Python 3.5." +msgstr "" +":ref:`dict ` 型は、 `Raymond Hettinger `_ の提案に基" +"づき、 `PyPy dict implementation`_ と同様の :ref:`よりコンパクトな表現 " +"` を使うように再実装されました。\n" "その結果、 Python 3.5 と比較して辞書が使うメモリ 20% から 25% 減少しました。" #: ../../whatsnew/3.6.rst:87 @@ -154,21 +157,28 @@ msgstr "" msgid "Significant improvements in the standard library:" msgstr "標準ライブラリーの顕著な改善" -#: ../../whatsnew/3.6.rst:107 msgid "" "The :mod:`asyncio` module has received new features, significant usability " "and performance improvements, and a fair amount of bug fixes. Starting with " "Python 3.6 the ``asyncio`` module is no longer provisional and its API is " "considered stable." msgstr "" +":mod:`asyncio` モジュールに新機能が追加され、使いやすさと性能が大幅に改善され" +"ました。\n" +"多数のバグも修正されています。\n" +"Python 3.6 から ``asyncio`` モジュールは暫定版ではなくなり、API は安定版とみ" +"なされます。" -#: ../../whatsnew/3.6.rst:112 msgid "" "A new :ref:`file system path protocol ` has been " "implemented to support :term:`path-like objects `. All " "standard library functions operating on paths have been updated to work with " "the new protocol." msgstr "" +":term:`パス類オブジェクト ` をサポートする新しい :ref:`ファ" +"イルシステムパスのプロトコル ` が実装されました。\n" +"パスを扱う標準ライブラリのすべての関数が、このプロトコルに対応するよう更新さ" +"れました。" #: ../../whatsnew/3.6.rst:117 msgid "" @@ -209,13 +219,18 @@ 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 "" "On Linux, :func:`os.urandom` now blocks until the system urandom entropy " "pool is initialized to increase the security. See the :pep:`524` for the " "rationale." msgstr "" +"Linux ではセキュリティを高めるため、システムの urandom エントロピープールが初" +"期化されるまで :func:`os.urandom` がブロックするようになりました。\n" +"理由については :pep:`524` を参照してください。" #: ../../whatsnew/3.6.rst:140 msgid "The :mod:`hashlib` and :mod:`ssl` modules now support OpenSSL 1.1.0." @@ -234,8 +249,8 @@ msgid "" "The :mod:`hashlib` module received support for the BLAKE2, SHA-3 and SHAKE " "hash algorithms and the :func:`~hashlib.scrypt` key derivation function." msgstr "" -":mod:`hashlib` モジュールで BLAKE2, SHA-3, SHAKE ハッシュアルゴリズムと :" -"func:`~hashlib.scrypt` キー導出関数がサポートされるようになりました。" +":mod:`hashlib` モジュールで BLAKE2, SHA-3, SHAKE ハッシュアルゴリズム" +"と :func:`~hashlib.scrypt` キー導出関数がサポートされるようになりました。" #: ../../whatsnew/3.6.rst:149 msgid "Windows improvements:" @@ -263,26 +278,32 @@ msgstr "" "シェバン行の扱いは以前のままで、 \"python\" とあった場合は Python 2 を指して" "います。" -#: ../../whatsnew/3.6.rst:159 msgid "" "``python.exe`` and ``pythonw.exe`` have been marked as long-path aware, " -"which means that the 260 character path limit may no longer apply. See :ref:" -"`removing the MAX_PATH limitation ` for details." +"which means that the 260 character path limit may no longer apply. " +"See :ref:`removing the MAX_PATH limitation ` for details." msgstr "" +"``python.exe`` と ``pythonw.exe`` に長いパスに対応するフラグが設定され、パス" +"の 260 文字制限が適用されない場合があるようになりました。\n" +"詳しくは :ref:`MAX_PATH 制限の解除 ` を参照してください。" -#: ../../whatsnew/3.6.rst:163 msgid "" "A ``._pth`` file can be added to force isolated mode and fully specify all " "search paths to avoid registry and environment lookup. See :ref:`the " "documentation ` for more information." msgstr "" +"``._pth`` ファイルを追加すると、隔離モードを強制し、検索パスをすべて明示的に" +"指定してレジストリと環境変数の参照を避けられます。\n" +"詳しくは :ref:`ドキュメント ` を参照してください。" -#: ../../whatsnew/3.6.rst:167 msgid "" -"A ``python36.zip`` file now works as a landmark to infer :envvar:" -"`PYTHONHOME`. See :ref:`the documentation ` for " -"more information." +"A ``python36.zip`` file now works as a landmark to " +"infer :envvar:`PYTHONHOME`. See :ref:`the documentation " +"` for more information." msgstr "" +"``python36.zip`` ファイルが :envvar:`PYTHONHOME` を推定するための目印として機" +"能するようになりました。\n" +"詳しくは :ref:`ドキュメント ` を参照してください。" #: ../../whatsnew/3.6.rst:176 msgid "New Features" @@ -294,8 +315,8 @@ msgstr "PEP 498: フォーマット済み文字列リテラル" #: ../../whatsnew/3.6.rst:183 msgid "" -":pep:`498` introduces a new kind of string literals: *f-strings*, or :ref:" -"`formatted string literals `." +":pep:`498` introduces a new kind of string literals: *f-strings*, " +"or :ref:`formatted string literals `." msgstr "" ":pep:`498` は新たな種類の文字列リテラル、すなわち *f-strings*、 :ref:`フォー" "マット済み文字列リテラル ` を導入しました。" @@ -308,12 +329,11 @@ msgid "" "which are evaluated at run time, and then formatted using the :func:`format` " "protocol::" msgstr "" -"フォーマット済み文字列リテラルはプレフィックスに ``'f'`` をとり :meth:`str." -"format` による書式文字列に似ています。これらには中括弧で囲まれた置換フィール" -"ドがあります。置換フィールドは実行時に評価される式で、 :func:`format` プロト" -"コルによってフォーマットされます::" +"フォーマット済み文字列リテラルはプレフィックスに ``'f'`` をと" +"り :meth:`str.format` による書式文字列に似ています。これらには中括弧で囲まれ" +"た置換フィールドがあります。置換フィールドは実行時に評価される式" +"で、 :func:`format` プロトコルによってフォーマットされます::" -#: ../../whatsnew/3.6.rst:192 msgid "" ">>> name = \"Fred\"\n" ">>> f\"He said his name is {name}.\"\n" @@ -324,18 +344,23 @@ msgid "" ">>> f\"result: {value:{width}.{precision}}\" # nested fields\n" "'result: 12.35'" msgstr "" +">>> name = \"Fred\"\n" +">>> f\"He said his name is {name}.\"\n" +"'He said his name is Fred.'\n" +">>> width = 10\n" +">>> precision = 4\n" +">>> value = decimal.Decimal(\"12.34567\")\n" +">>> f\"result: {value:{width}.{precision}}\" # 入れ子のフィールド\n" +"'result: 12.35'" -#: ../../whatsnew/3.6.rst:203 msgid ":pep:`498` -- Literal String Interpolation." -msgstr "" +msgstr ":pep:`498` -- 文字列リテラルへの値の埋め込み。" -#: ../../whatsnew/3.6.rst:204 msgid "PEP written and implemented by Eric V. Smith." -msgstr "" +msgstr "PEP の執筆と実装は Eric V. Smith。" -#: ../../whatsnew/3.6.rst:206 msgid ":ref:`Feature documentation `." -msgstr "" +msgstr ":ref:`機能のドキュメント `。" #: ../../whatsnew/3.6.rst:212 msgid "PEP 526: Syntax for variable annotations" @@ -351,7 +376,6 @@ msgstr "" "た。この PEP は Python に、クラス変数およびインスタンス変数を含む変数の型アノ" "テーションの構文を追加しました::" -#: ../../whatsnew/3.6.rst:218 msgid "" "primes: List[int] = []\n" "\n" @@ -360,6 +384,12 @@ msgid "" "class Starship:\n" " stats: Dict[str, int] = {}" msgstr "" +"primes: List[int] = []\n" +"\n" +"captain: str # 注意: 初期値はありません!\n" +"\n" +"class Starship:\n" +" stats: Dict[str, int] = {}" #: ../../whatsnew/3.6.rst:225 msgid "" @@ -386,11 +416,13 @@ msgstr "" msgid ":pep:`526` -- Syntax for variable annotations." msgstr ":pep:`526` -- Syntax for variable annotations" -#: ../../whatsnew/3.6.rst:237 msgid "" "PEP written by Ryan Gonzalez, Philip House, Ivan Levkivskyi, Lisa Roach, and " "Guido van Rossum. Implemented by Ivan Levkivskyi." msgstr "" +"PEP の執筆は Ryan Gonzalez、Philip House、Ivan Levkivskyi、Lisa Roach、Guido " +"van Rossum。\n" +"実装は Ivan Levkivskyi。" #: ../../whatsnew/3.6.rst:240 msgid "" @@ -412,13 +444,16 @@ msgstr "" ":pep:`515` により、可読性向上のために数値リテラル内でアンダースコアを使えるよ" "うになりました。例えば::" -#: ../../whatsnew/3.6.rst:253 msgid "" ">>> 1_000_000_000_000_000\n" "1000000000000000\n" ">>> 0x_FF_FF_FF_FF\n" "4294967295" msgstr "" +">>> 1_000_000_000_000_000\n" +"1000000000000000\n" +">>> 0x_FF_FF_FF_FF\n" +"4294967295" #: ../../whatsnew/3.6.rst:258 msgid "" @@ -428,7 +463,6 @@ msgstr "" "単一のアンダースコアは数字の間と基数指定子の後で許されます。先頭、末尾、ある" "いは複数のアンダースコアを列内で使用することはできません。" -#: ../../whatsnew/3.6.rst:262 msgid "" "The :ref:`string formatting ` language also now has support for " "the ``'_'`` option to signal the use of an underscore for a thousands " @@ -436,22 +470,30 @@ msgid "" "type ``'d'``. For integer presentation types ``'b'``, ``'o'``, ``'x'``, and " "``'X'``, underscores will be inserted every 4 digits::" msgstr "" +":ref:`文字列の書式指定 ` にも ``'_'`` オプションが追加されまし" +"た。\n" +"浮動小数点の表示型と整数の表示型 ``'d'`` では、アンダースコアを 3 桁区切りに" +"使います。\n" +"整数の表示型 ``'b'``、``'o'``、``'x'``、``'X'`` では、4 桁ごとにアンダースコ" +"アを挿入します。 ::" -#: ../../whatsnew/3.6.rst:269 msgid "" ">>> '{:_}'.format(1000000)\n" "'1_000_000'\n" ">>> '{:_x}'.format(0xFFFFFFFF)\n" "'ffff_ffff'" msgstr "" +">>> '{:_}'.format(1000000)\n" +"'1_000_000'\n" +">>> '{:_x}'.format(0xFFFFFFFF)\n" +"'ffff_ffff'" #: ../../whatsnew/3.6.rst:276 msgid ":pep:`515` -- Underscores in Numeric Literals" msgstr ":pep:`515` -- 数値リテラル内のアンダースコア" -#: ../../whatsnew/3.6.rst:277 msgid "PEP written by Georg Brandl and Serhiy Storchaka." -msgstr "" +msgstr "PEP の執筆は Georg Brandl と Serhiy Storchaka。" #: ../../whatsnew/3.6.rst:283 msgid "PEP 525: Asynchronous Generators" @@ -470,7 +512,6 @@ msgstr "" "数実体内で ``await`` と ``yield`` を使えないことでした。Python 3.6 ではこの制" "約はなくなり、 *非同期ジェネレータ* を定義できるようになりました::" -#: ../../whatsnew/3.6.rst:291 msgid "" "async def ticker(delay, to):\n" " \"\"\"Yield numbers from 0 to *to* every *delay* seconds.\"\"\"\n" @@ -478,6 +519,11 @@ msgid "" " yield i\n" " await asyncio.sleep(delay)" msgstr "" +"async def ticker(delay, to):\n" +" \"\"\"*delay* 秒ごとに 0 から *to* までの数値を yield する。\"\"\"\n" +" for i in range(to):\n" +" yield i\n" +" await asyncio.sleep(delay)" #: ../../whatsnew/3.6.rst:297 msgid "The new syntax allows for faster and more concise code." @@ -503,9 +549,8 @@ msgstr "" ":pep:`530` によりリスト、セット、辞書内包表記ならびにジェネレータ式内での " "``async for`` の使用がサポートされました::" -#: ../../whatsnew/3.6.rst:313 msgid "result = [i async for i in aiter() if i % 2]" -msgstr "" +msgstr "result = [i async for i in aiter() if i % 2]" #: ../../whatsnew/3.6.rst:315 msgid "" @@ -513,26 +558,25 @@ msgid "" "comprehensions::" msgstr "加えて、 ``await`` 式が全ての内包表記でサポートされました::" -#: ../../whatsnew/3.6.rst:318 msgid "result = [await fun() for fun in funcs if await condition()]" -msgstr "" +msgstr "result = [await fun() for fun in funcs if await condition()]" #: ../../whatsnew/3.6.rst:322 msgid ":pep:`530` -- Asynchronous Comprehensions" msgstr ":pep:`530` -- 非同期内包表記" -#: ../../whatsnew/3.6.rst:329 msgid "PEP 487: Simpler customization of class creation" -msgstr "" +msgstr "PEP 487: クラス作成のカスタマイズを簡単に" -#: ../../whatsnew/3.6.rst:331 msgid "" "It is now possible to customize subclass creation without using a metaclass. " "The new ``__init_subclass__`` classmethod will be called on the base class " "whenever a new subclass is created::" msgstr "" +"メタクラスを使わずにサブクラスの作成をカスタマイズできるようになりました。\n" +"新しいクラスメソッド ``__init_subclass__`` は、新しいサブクラスが作成されるた" +"びに基底クラスで呼び出されます。 ::" -#: ../../whatsnew/3.6.rst:335 msgid "" "class PluginBase:\n" " subclasses = []\n" @@ -547,43 +591,61 @@ msgid "" "class Plugin2(PluginBase):\n" " pass" msgstr "" +"class PluginBase:\n" +" subclasses = []\n" +"\n" +" def __init_subclass__(cls, **kwargs):\n" +" super().__init_subclass__(**kwargs)\n" +" cls.subclasses.append(cls)\n" +"\n" +"class Plugin1(PluginBase):\n" +" pass\n" +"\n" +"class Plugin2(PluginBase):\n" +" pass" -#: ../../whatsnew/3.6.rst:348 msgid "" -"In order to allow zero-argument :func:`super` calls to work correctly from :" -"meth:`~object.__init_subclass__` implementations, custom metaclasses must " -"ensure that the new ``__classcell__`` namespace entry is propagated to " +"In order to allow zero-argument :func:`super` calls to work correctly " +"from :meth:`~object.__init_subclass__` implementations, custom metaclasses " +"must ensure that the new ``__classcell__`` namespace entry is propagated to " "``type.__new__`` (as described in :ref:`class-object-creation`)." msgstr "" +":meth:`~object.__init_subclass__` の実装内で引数なしの :func:`super` が正しく" +"動作するように、独自のメタクラスは名前空間の新しいエントリー " +"``__classcell__`` を ``type.__new__`` に渡す必要があります (:ref:`class-" +"object-creation` を参照)。" -#: ../../whatsnew/3.6.rst:355 ../../whatsnew/3.6.rst:393 msgid ":pep:`487` -- Simpler customization of class creation" -msgstr "" +msgstr ":pep:`487` -- クラス作成のカスタマイズを簡単に" #: ../../whatsnew/3.6.rst:356 ../../whatsnew/3.6.rst:394 msgid "PEP written and implemented by Martin Teichmann." msgstr "PEP 著と実装 Martin Teichmann." -#: ../../whatsnew/3.6.rst:358 msgid ":ref:`Feature documentation `" -msgstr "" +msgstr ":ref:`機能のドキュメント `" #: ../../whatsnew/3.6.rst:364 msgid "PEP 487: Descriptor Protocol Enhancements" msgstr "PEP 487: 記述子プロトコルの改善" -#: ../../whatsnew/3.6.rst:366 msgid "" -":pep:`487` extends the descriptor protocol to include the new optional :meth:" -"`~object.__set_name__` method. Whenever a new class is defined, the new " -"method will be called on all descriptors included in the definition, " -"providing them with a reference to the class being defined and the name " -"given to the descriptor within the class namespace. In other words, " -"instances of descriptors can now know the attribute name of the descriptor " -"in the owner class::" +":pep:`487` extends the descriptor protocol to include the new " +"optional :meth:`~object.__set_name__` method. Whenever a new class is " +"defined, the new method will be called on all descriptors included in the " +"definition, providing them with a reference to the class being defined and " +"the name given to the descriptor within the class namespace. In other " +"words, instances of descriptors can now know the attribute name of the " +"descriptor in the owner class::" msgstr "" +":pep:`487` はデスクリプタプロトコルを拡張し、省略可能" +"な :meth:`~object.__set_name__` メソッドを追加します。\n" +"新しいクラスが定義されるたびに、その定義に含まれるすべてのデスクリプタでこの" +"メソッドが呼び出され、定義中のクラスへの参照とクラス名前空間内でのデスクリプ" +"タの名前が渡されます。\n" +"つまり、デスクリプタのインスタンスは所有するクラスでの属性名を把握できるよう" +"になりました。 ::" -#: ../../whatsnew/3.6.rst:374 msgid "" "class IntField:\n" " def __get__(self, instance, owner):\n" @@ -601,65 +663,106 @@ msgid "" "class Model:\n" " int_field = IntField()" msgstr "" +"class IntField:\n" +" def __get__(self, instance, owner):\n" +" return instance.__dict__[self.name]\n" +"\n" +" def __set__(self, instance, value):\n" +" if not isinstance(value, int):\n" +" raise ValueError(f'expecting integer in {self.name}')\n" +" instance.__dict__[self.name] = value\n" +"\n" +" # これが新しい初期化メソッド:\n" +" def __set_name__(self, owner, name):\n" +" self.name = name\n" +"\n" +"class Model:\n" +" int_field = IntField()" -#: ../../whatsnew/3.6.rst:396 msgid ":ref:`Feature documentation `" -msgstr "" +msgstr ":ref:`機能のドキュメント `" #: ../../whatsnew/3.6.rst:402 msgid "PEP 519: Adding a file system path protocol" msgstr "PEP 519: ファイルシステムパスプロトコルの追加" -#: ../../whatsnew/3.6.rst:404 msgid "" -"File system paths have historically been represented as :class:`str` or :" -"class:`bytes` objects. This has led to people who write code which operate " -"on file system paths to assume that such objects are only one of those two " -"types (an :class:`int` representing a file descriptor does not count as that " -"is not a file path). Unfortunately that assumption prevents alternative " -"object representations of file system paths like :mod:`pathlib` from working " -"with pre-existing code, including Python's standard library." +"File system paths have historically been represented as :class:`str` " +"or :class:`bytes` objects. This has led to people who write code which " +"operate on file system paths to assume that such objects are only one of " +"those two types (an :class:`int` representing a file descriptor does not " +"count as that is not a file path). Unfortunately that assumption prevents " +"alternative object representations of file system paths like :mod:`pathlib` " +"from working with pre-existing code, including Python's standard library." msgstr "" +"従来、ファイルシステムのパスは :class:`str` または :class:`bytes` オブジェク" +"トで表されていました。\n" +"そのため、パスを操作するコードの作成者は、パスのオブジェクトがそのいずれかの" +"型であると想定してきました (ファイル記述子を表す :class:`int` はファイルパス" +"ではないため除きます)。\n" +"しかし、この想定のために :mod:`pathlib` などの別のオブジェクトで表現されたパ" +"スを、Python の標準ライブラリを含む既存のコードで扱えませんでした。" -#: ../../whatsnew/3.6.rst:413 msgid "" "To fix this situation, a new interface represented by :class:`os.PathLike` " "has been defined. By implementing the :meth:`~os.PathLike.__fspath__` " "method, an object signals that it represents a path. An object can then " "provide a low-level representation of a file system path as a :class:`str` " "or :class:`bytes` object. This means an object is considered :term:`path-" -"like ` if it implements :class:`os.PathLike` or is a :" -"class:`str` or :class:`bytes` object which represents a file system path. " +"like ` if it implements :class:`os.PathLike` or is " +"a :class:`str` or :class:`bytes` object which represents a file system path. " "Code can use :func:`os.fspath`, :func:`os.fsdecode`, or :func:`os.fsencode` " "to explicitly get a :class:`str` and/or :class:`bytes` representation of a " "path-like object." msgstr "" +"この問題を解決するため、:class:`os.PathLike` で表される新しいインターフェース" +"を定義しました。\n" +":meth:`~os.PathLike.__fspath__` メソッドを実装すると、オブジェクトがパスを表" +"すことを示せます。\n" +"このメソッドでファイルシステムパスの低水準な表現を :class:`str` また" +"は :class:`bytes` オブジェクトとして提供できます。\n" +"つまり、:class:`os.PathLike` を実装するオブジェクト、またはファイルシステムの" +"パスを表す :class:`str` や :class:`bytes` オブジェクトが :term:`パス類オブ" +"ジェクト ` とみなされます。\n" +"コードでは :func:`os.fspath`、:func:`os.fsdecode`、:func:`os.fsencode` を使" +"い、パス類オブジェクトの :class:`str` や :class:`bytes` 表現を明示的に取得で" +"きます。" + +msgid "" +"The built-in :func:`open` function has been updated to " +"accept :class:`os.PathLike` objects, as have all relevant functions in " +"the :mod:`os` and :mod:`os.path` modules, and most other functions and " +"classes in the standard library. The :class:`os.DirEntry` class and " +"relevant classes in :mod:`pathlib` have also been updated to " +"implement :class:`os.PathLike`." +msgstr "" +"組み込み関数 :func:`open` と、:mod:`os`、:mod:`os.path` モジュールの関連する" +"すべての関数、および標準ライブラリのほとんどの関数やクラス" +"が :class:`os.PathLike` オブジェクトを受け付けるように更新されました。\n" +":class:`os.DirEntry` クラスと :mod:`pathlib` の関連クラス" +"も、:class:`os.PathLike` を実装するように更新されました。" -#: ../../whatsnew/3.6.rst:426 -msgid "" -"The built-in :func:`open` function has been updated to accept :class:`os." -"PathLike` objects, as have all relevant functions in the :mod:`os` and :mod:" -"`os.path` modules, and most other functions and classes in the standard " -"library. The :class:`os.DirEntry` class and relevant classes in :mod:" -"`pathlib` have also been updated to implement :class:`os.PathLike`." -msgstr "" - -#: ../../whatsnew/3.6.rst:433 msgid "" "The hope is that updating the fundamental functions for operating on file " -"system paths will lead to third-party code to implicitly support all :term:" -"`path-like objects ` without any code changes, or at least " -"very minimal ones (e.g. calling :func:`os.fspath` at the beginning of code " -"before operating on a path-like object)." +"system paths will lead to third-party code to implicitly support " +"all :term:`path-like objects ` without any code changes, " +"or at least very minimal ones (e.g. calling :func:`os.fspath` at the " +"beginning of code before operating on a path-like object)." msgstr "" +"ファイルシステムのパスを操作する基本的な関数の更新により、サードパーティーの" +"コードも、変更なしで暗黙に、あるいは最小限の変更で、すべての :term:`パス類オ" +"ブジェクト ` をサポートすることが期待されます。\n" +"最小限の変更とは、例えばパス類オブジェクトを操作するコードの先頭" +"で :func:`os.fspath` を呼ぶことです。" -#: ../../whatsnew/3.6.rst:440 msgid "" -"Here are some examples of how the new interface allows for :class:`pathlib." -"Path` to be used more easily and transparently with pre-existing code::" +"Here are some examples of how the new interface allows " +"for :class:`pathlib.Path` to be used more easily and transparently with pre-" +"existing code::" msgstr "" +"新しいインターフェースによって、既存のコードでも :class:`pathlib.Path` をより" +"簡単に、意識せず使える例を示します。 ::" -#: ../../whatsnew/3.6.rst:444 msgid "" ">>> import pathlib\n" ">>> with open(pathlib.Path(\"README\")) as f:\n" @@ -674,20 +777,31 @@ msgid "" ">>> os.fspath(pathlib.Path(\"some_file.txt\"))\n" "'some_file.txt'" msgstr "" +">>> import pathlib\n" +">>> with open(pathlib.Path(\"README\")) as f:\n" +"... contents = f.read()\n" +"...\n" +">>> import os.path\n" +">>> os.path.splitext(pathlib.Path(\"some_file.txt\"))\n" +"('some_file', '.txt')\n" +">>> os.path.join(\"/a/b\", pathlib.Path(\"c\"))\n" +"'/a/b/c'\n" +">>> import os\n" +">>> os.fspath(pathlib.Path(\"some_file.txt\"))\n" +"'some_file.txt'" -#: ../../whatsnew/3.6.rst:457 msgid "" "(Implemented by Brett Cannon, Ethan Furman, Dusty Phillips, and Jelle " "Zijlstra.)" msgstr "" +"(Brett Cannon、Ethan Furman、Dusty Phillips、Jelle Zijlstra による実装。)" #: ../../whatsnew/3.6.rst:461 msgid ":pep:`519` -- Adding a file system path protocol" msgstr ":pep:`519` -- ファイルシステムパスプロトコルの追加" -#: ../../whatsnew/3.6.rst:462 msgid "PEP written by Brett Cannon and Koos Zevenhoven." -msgstr "" +msgstr "PEP の執筆は Brett Cannon と Koos Zevenhoven。" #: ../../whatsnew/3.6.rst:468 msgid "PEP 495: Local Time Disambiguation" @@ -708,15 +822,15 @@ msgstr "" #: ../../whatsnew/3.6.rst:476 msgid "" -":pep:`495` adds the new *fold* attribute to instances of :class:`datetime." -"datetime` and :class:`datetime.time` classes to differentiate between two " -"moments in time for which local times are the same::" +":pep:`495` adds the new *fold* attribute to instances " +"of :class:`datetime.datetime` and :class:`datetime.time` classes to " +"differentiate between two moments in time for which local times are the " +"same::" msgstr "" ":pep:`495` は時間内の地域時間が同じ二つの瞬間を区別するために、新たな *fold* " -"属性を :class:`datetime.datetime` インスタンスならびに :class:`datetime." -"time` クラスに追加しました。" +"属性を :class:`datetime.datetime` インスタンスならび" +"に :class:`datetime.time` クラスに追加しました。" -#: ../../whatsnew/3.6.rst:480 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -729,6 +843,16 @@ msgid "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" msgstr "" +">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" +">>> for i in range(4):\n" +"... u = u0 + i*HOUR\n" +"... t = u.astimezone(Eastern)\n" +"... print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)\n" +"...\n" +"04:00:00 UTC = 00:00:00 EDT 0\n" +"05:00:00 UTC = 01:00:00 EDT 0\n" +"06:00:00 UTC = 01:00:00 EST 1\n" +"07:00:00 UTC = 02:00:00 EST 0" #: ../../whatsnew/3.6.rst:491 msgid "" @@ -743,88 +867,108 @@ msgstr "" msgid ":pep:`495` -- Local Time Disambiguation" msgstr ":pep:`495` -- 地域時間の曖昧さ回避" -#: ../../whatsnew/3.6.rst:498 msgid "" "PEP written by Alexander Belopolsky and Tim Peters, implementation by " "Alexander Belopolsky." msgstr "" +"PEP の執筆は Alexander Belopolsky と Tim Peters、実装は Alexander " +"Belopolsky。" #: ../../whatsnew/3.6.rst:505 msgid "PEP 529: Change Windows filesystem encoding to UTF-8" msgstr "PEP 529: Windows ファイルシステムのエンコーディングを UTF-8 に変更" -#: ../../whatsnew/3.6.rst:507 msgid "" "Representing filesystem paths is best performed with str (Unicode) rather " "than bytes. However, there are some situations where using bytes is " "sufficient and correct." msgstr "" +"ファイルシステムのパスは bytes よりも str (Unicode) で表すのが適切です。\n" +"ただし bytes で十分であり、適切でもある場面もあります。" -#: ../../whatsnew/3.6.rst:511 msgid "" "Prior to Python 3.6, data loss could result when using bytes paths on " "Windows. With this change, using bytes to represent paths is now supported " -"on Windows, provided those bytes are encoded with the encoding returned by :" -"func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." +"on Windows, provided those bytes are encoded with the encoding returned " +"by :func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." msgstr "" +"Python 3.6 より前では、Windows で bytes のパスを使うと情報が失われる場合があ" +"りました。\n" +"この変更により Windows でも bytes によるパス表現をサポートします。\n" +"ただし :func:`sys.getfilesystemencoding` が返すエンコーディングでエンコードす" +"る必要があり、そのデフォルトは ``'utf-8'`` になりました。" -#: ../../whatsnew/3.6.rst:516 msgid "" -"Applications that do not use str to represent paths should use :func:`os." -"fsencode` and :func:`os.fsdecode` to ensure their bytes are correctly " -"encoded. To revert to the previous behaviour, set :envvar:" -"`PYTHONLEGACYWINDOWSFSENCODING` or call :func:`sys." -"_enablelegacywindowsfsencoding`." +"Applications that do not use str to represent paths should " +"use :func:`os.fsencode` and :func:`os.fsdecode` to ensure their bytes are " +"correctly encoded. To revert to the previous behaviour, " +"set :envvar:`PYTHONLEGACYWINDOWSFSENCODING` or " +"call :func:`sys._enablelegacywindowsfsencoding`." msgstr "" +"パスを str で表さないアプリケーションでは、:func:`os.fsencode` " +"と :func:`os.fsdecode` を使って bytes を正しくエンコードしてください。\n" +"以前の動作に戻すには :envvar:`PYTHONLEGACYWINDOWSFSENCODING` を設定する" +"か、:func:`sys._enablelegacywindowsfsencoding` を呼び出します。" -#: ../../whatsnew/3.6.rst:522 msgid "" "See :pep:`529` for more information and discussion of code modifications " "that may be required." msgstr "" +"詳細や必要になる可能性があるコードの修正については :pep:`529` を参照してくだ" +"さい。" #: ../../whatsnew/3.6.rst:529 msgid "PEP 528: Change Windows console encoding to UTF-8" msgstr "PEP 528: Windows コンソールのエンコーディングを UTF-8 に変更" -#: ../../whatsnew/3.6.rst:531 msgid "" "The default console on Windows will now accept all Unicode characters and " -"provide correctly read str objects to Python code. ``sys.stdin``, ``sys." -"stdout`` and ``sys.stderr`` now default to utf-8 encoding." +"provide correctly read str objects to Python code. ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` now default to utf-8 encoding." msgstr "" +"Windows のデフォルトのコンソールがすべての Unicode 文字を受け付け、正しく読み" +"取った str オブジェクトを Python コードに渡すようになりました。\n" +"``sys.stdin``、``sys.stdout``、``sys.stderr`` のデフォルトのエンコーディング" +"は utf-8 になりました。" -#: ../../whatsnew/3.6.rst:535 msgid "" "This change only applies when using an interactive console, and not when " "redirecting files or pipes. To revert to the previous behaviour for " "interactive console use, set :envvar:`PYTHONLEGACYWINDOWSSTDIO`." msgstr "" +"この変更は対話型コンソールを使う場合にのみ適用され、ファイルやパイプへのリダ" +"イレクトには適用されません。\n" +"対話型コンソールで以前の動作に戻すには :envvar:`PYTHONLEGACYWINDOWSSTDIO` を" +"設定してください。" #: ../../whatsnew/3.6.rst:541 msgid ":pep:`528` -- Change Windows console encoding to UTF-8" msgstr ":pep:`528` -- Windows コンソールのエンコーディングを UTF-8 に変更" -#: ../../whatsnew/3.6.rst:542 msgid "PEP written and implemented by Steve Dower." -msgstr "" +msgstr "PEP の執筆と実装は Steve Dower。" #: ../../whatsnew/3.6.rst:548 msgid "PEP 520: Preserving Class Attribute Definition Order" msgstr "PEP 520: クラス属性の定義の順番を保持" -#: ../../whatsnew/3.6.rst:550 msgid "" "Attributes in a class definition body have a natural ordering: the same " "order in which the names appear in the source. This order is now preserved " "in the new class's :attr:`~type.__dict__` attribute." msgstr "" +"クラス定義の本体にある属性には、名前がソースに現れる順序という自然な順序があ" +"ります。\n" +"この順序が新しいクラスの :attr:`~type.__dict__` 属性に保持されるようになりま" +"した。" -#: ../../whatsnew/3.6.rst:554 msgid "" -"Also, the effective default class *execution* namespace (returned from :ref:" -"`type.__prepare__() `) is now an insertion-order-preserving mapping." +"Also, the effective default class *execution* namespace (returned " +"from :ref:`type.__prepare__() `) is now an insertion-order-" +"preserving mapping." msgstr "" +"また、クラスの *実行* 名前空間の実質的なデフォルト (:ref:`type.__prepare__() " +"` が返すもの) が、挿入順を保持するマッピングになりました。" #: ../../whatsnew/3.6.rst:560 msgid ":pep:`520` -- Preserving Class Attribute Definition Order" @@ -854,17 +998,22 @@ msgstr ":pep:`468` -- キーワード引数の順番の保持" msgid "New :ref:`dict ` implementation" msgstr "新たな :ref:`dict ` 実装" -#: ../../whatsnew/3.6.rst:583 msgid "" "The :ref:`dict ` type now uses a \"compact\" representation " "based on `a proposal by Raymond Hettinger `_ which was `first implemented by PyPy " -"`_. The memory usage of the new :func:`dict` is between 20% and 25% " -"smaller compared to Python 3.5." -msgstr "" +"`_. The memory usage of the new :func:`dict` is between 20% and " +"25% smaller compared to Python 3.5." +msgstr "" +":ref:`dict ` 型が、`Raymond Hettinger の提案 `_ に基づき、" +"`PyPy が初めて実装した `_ 「コンパクト」な表現を使うようになりまし" +"た。\n" +"新しい :func:`dict` のメモリ使用量は Python 3.5 より 20〜25% 少なくなっていま" +"す。" -#: ../../whatsnew/3.6.rst:591 msgid "" "The order-preserving aspect of this new implementation is considered an " "implementation detail and should not be relied upon (this may change in the " @@ -872,22 +1021,29 @@ msgid "" "language for a few releases before changing the language spec to mandate " "order-preserving semantics for all current and future Python " "implementations; this also helps preserve backwards-compatibility with older " -"versions of the language where random iteration order is still in effect, e." -"g. Python 3.5)." +"versions of the language where random iteration order is still in effect, " +"e.g. Python 3.5)." msgstr "" +"この実装が順序を保持する点は実装詳細とみなされ、依存すべきではありません。\n" +"将来は変わる可能性がありますが、現在および将来のすべての Python 実装で順序の" +"保持を必須にするよう言語仕様を変更する前に、この新しい dict 実装を数回のリ" +"リースにわたって使うことが望まれています。\n" +"これは Python 3.5 など、反復処理の順序がまだ不定な古い言語バージョンとの後方" +"互換性を保つことにも役立ちます。" -#: ../../whatsnew/3.6.rst:600 msgid "" "(Contributed by INADA Naoki in :issue:`27350`. Idea `originally suggested by " "Raymond Hettinger `_.)" msgstr "" +"(INADA Naoki による貢献、:issue:`27350`。アイデアは `Raymond Hettinger の当初" +"の提案 `_。)" #: ../../whatsnew/3.6.rst:608 msgid "PEP 523: Adding a frame evaluation API to CPython" msgstr "PEP 523: CPython にフレーム評価 API を追加" -#: ../../whatsnew/3.6.rst:610 msgid "" "While Python provides extensive support to customize how code executes, one " "place it has not done so is in the evaluation of frame objects. If you " @@ -895,8 +1051,11 @@ msgid "" "any way without directly manipulating function pointers for defined " "functions." msgstr "" +"Python にはコードの実行方法をカスタマイズする幅広い仕組みがありますが、フレー" +"ムオブジェクトの評価にはありませんでした。\n" +"フレームの評価に介入したい場合、定義済みの関数の関数ポインタを直接操作する以" +"外に方法がありませんでした。" -#: ../../whatsnew/3.6.rst:616 msgid "" ":pep:`523` changes this by providing an API to make frame evaluation " "pluggable at the C level. This will allow for tools such as debuggers and " @@ -904,22 +1063,28 @@ msgid "" "begins. This enables the use of alternative evaluation implementations for " "Python code, tracking frame evaluation, etc." msgstr "" +":pep:`523` は C レベルでフレームの評価処理を差し替える API を提供し、この状況" +"を変えます。\n" +"デバッガーや JIT などのツールが、Python コードの実行開始前にフレームの評価に" +"介入できるようになります。\n" +"これにより Python コードの別の評価実装を使ったり、フレームの評価を追跡したり" +"できます。" -#: ../../whatsnew/3.6.rst:623 msgid "" "This API is not part of the limited C API and is marked as private to signal " "that usage of this API is expected to be limited and only applicable to very " "select, low-level use-cases. Semantics of the API will change with Python as " "necessary." msgstr "" +"この API は制限付き C API の一部ではなく、非公開とされています。\n" +"利用が限られ、ごく特定の低水準な用途にのみ適することを示すためです。\n" +"API の意味は必要に応じて Python とともに変わります。" -#: ../../whatsnew/3.6.rst:630 msgid ":pep:`523` -- Adding a frame evaluation API to CPython" -msgstr "" +msgstr ":pep:`523` -- CPython へのフレーム評価 API の追加" -#: ../../whatsnew/3.6.rst:631 msgid "PEP written by Brett Cannon and Dino Viehland." -msgstr "" +msgstr "PEP の執筆は Brett Cannon と Dino Viehland。" #: ../../whatsnew/3.6.rst:637 msgid "PYTHONMALLOC environment variable" @@ -953,12 +1118,13 @@ msgstr "解放されたメモリを ``0xDB`` バイトで埋めます" #: ../../whatsnew/3.6.rst:647 msgid "" -"Detect violations of the Python memory allocator API. For example, :c:func:" -"`PyObject_Free` called on a memory block allocated by :c:func:`PyMem_Malloc`." +"Detect violations of the Python memory allocator API. For " +"example, :c:func:`PyObject_Free` called on a memory block allocated " +"by :c:func:`PyMem_Malloc`." msgstr "" -"Python メモリアロケータ API の違反を検知します。例えば :c:func:" -"`PyMem_Malloc` で割り当てられたメモリブロックに :c:func:`PyObject_Free` を呼" -"ぶこと。" +"Python メモリアロケータ API の違反を検知します。例え" +"ば :c:func:`PyMem_Malloc` で割り当てられたメモリブロック" +"に :c:func:`PyObject_Free` を呼ぶこと。" #: ../../whatsnew/3.6.rst:650 msgid "Detect writes before the start of a buffer (buffer underflows)" @@ -968,45 +1134,54 @@ msgstr "バッファ開始前の書き込み (バッファアンダーフロー) msgid "Detect writes after the end of a buffer (buffer overflows)" msgstr "バッファ終端後の書き込み (バッファオーバーフロー) を検知します" -#: ../../whatsnew/3.6.rst:652 msgid "" "Check that the :term:`GIL ` is held 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:`GIL ` を保持してい" +"るか確認します。" -#: ../../whatsnew/3.6.rst:656 msgid "Checking if the GIL is held is also a new feature of Python 3.6." -msgstr "" +msgstr "GIL を保持しているかどうかの検査も Python 3.6 の新機能です。" -#: ../../whatsnew/3.6.rst:658 msgid "" "See the :c:func:`PyMem_SetupDebugHooks` function for debug hooks on Python " "memory allocators." msgstr "" +"Python のメモリアロケータのデバッグフックについて" +"は :c:func:`PyMem_SetupDebugHooks` を参照してください。" -#: ../../whatsnew/3.6.rst:661 msgid "" "It is now also possible to force the usage of the :c:func:`malloc` allocator " "of the C library for all Python memory allocations using " "``PYTHONMALLOC=malloc``. This is helpful when using external memory " "debuggers like Valgrind on a Python compiled in release mode." msgstr "" +"``PYTHONMALLOC=malloc`` によって、Python のすべてのメモリ割り当てに C ライブ" +"ラリの :c:func:`malloc` アロケータを強制的に使うことも可能になりました。\n" +"リリースモードでコンパイルした Python に対して Valgrind などの外部メモリデ" +"バッガーを使う場合に役立ちます。" -#: ../../whatsnew/3.6.rst:666 msgid "" -"On error, the debug hooks on Python memory allocators now use the :mod:" -"`tracemalloc` module to get the traceback where a memory block was allocated." +"On error, the debug hooks on Python memory allocators now use " +"the :mod:`tracemalloc` module to get the traceback where a memory block was " +"allocated." msgstr "" +"エラー発生時に Python のメモリアロケータのデバッグフック" +"が :mod:`tracemalloc` モジュールを使い、メモリブロックを割り当てた場所のト" +"レースバックを取得するようになりました。" -#: ../../whatsnew/3.6.rst:670 msgid "" "Example of fatal error on buffer overflow using ``python3.6 -X " "tracemalloc=5`` (store 5 frames in traces)::" msgstr "" +"``python3.6 -X tracemalloc=5`` (トレースに 5 フレームを保存) を使った場合の、" +"バッファオーバーフローによる致命的なエラーの例です。 ::" -#: ../../whatsnew/3.6.rst:673 msgid "" "Debug memory block at address p=0x7fbcd41666f8: API 'o'\n" " 4 bytes originally requested\n" @@ -1043,20 +1218,53 @@ msgid "" " File \"unittest/suite.py\", line 84 in __call__\n" " ..." msgstr "" +"Debug memory block at address p=0x7fbcd41666f8: API 'o'\n" +" 4 bytes originally requested\n" +" The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.\n" +" The 8 pad bytes at tail=0x7fbcd41666fc are not all FORBIDDENBYTE " +"(0xfb):\n" +" at tail+0: 0x02 *** OUCH\n" +" at tail+1: 0xfb\n" +" at tail+2: 0xfb\n" +" at tail+3: 0xfb\n" +" at tail+4: 0xfb\n" +" at tail+5: 0xfb\n" +" at tail+6: 0xfb\n" +" at tail+7: 0xfb\n" +" The block was made by call #1233329 to debug malloc/realloc.\n" +" Data at p: 1a 2b 30 00\n" +"\n" +"Memory block allocated at (most recent call first):\n" +" File \"test/test_bytes.py\", line 323\n" +" File \"unittest/case.py\", line 600\n" +" File \"unittest/case.py\", line 648\n" +" File \"unittest/suite.py\", line 122\n" +" File \"unittest/suite.py\", line 84\n" +"\n" +"Fatal Python error: bad trailing pad byte\n" +"\n" +"Current thread 0x00007fbcdbd32700 (most recent call first):\n" +" File \"test/test_bytes.py\", line 323 in test_hex\n" +" File \"unittest/case.py\", line 600 in run\n" +" File \"unittest/case.py\", line 648 in __call__\n" +" File \"unittest/suite.py\", line 122 in run\n" +" File \"unittest/suite.py\", line 84 in __call__\n" +" File \"unittest/suite.py\", line 122 in run\n" +" File \"unittest/suite.py\", line 84 in __call__\n" +" ..." -#: ../../whatsnew/3.6.rst:707 msgid "(Contributed by Victor Stinner in :issue:`26516` and :issue:`26564`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`26516` and :issue:`26564`。)" -#: ../../whatsnew/3.6.rst:713 msgid "DTrace and SystemTap probing support" -msgstr "" +msgstr "DTrace と SystemTap のプローブのサポート" -#: ../../whatsnew/3.6.rst:715 msgid "" "Python can now be built ``--with-dtrace`` which enables static markers for " "the following events in the interpreter:" msgstr "" +"``--with-dtrace`` を指定して Python をビルドできるようになりました。\n" +"これにより、インタープリタの次のイベントに静的マーカーが有効になります:" #: ../../whatsnew/3.6.rst:718 msgid "function call/return" @@ -1070,28 +1278,32 @@ msgstr "ガベージコレクションの開始/終了" msgid "line of code executed." msgstr "実行されたコードの行。" -#: ../../whatsnew/3.6.rst:724 msgid "" "This can be used to instrument running interpreters in production, without " "the need to recompile specific :ref:`debug builds ` or " "providing application-specific profiling/debugging code." msgstr "" +"専用の :ref:`デバッグビルド ` を再コンパイルしたり、アプリケー" +"ション固有のプロファイリングやデバッグ用コードを用意したりせずに、本番環境で" +"実行中のインタープリタを計測できます。" #: ../../whatsnew/3.6.rst:728 msgid "More details in :ref:`instrumentation`." msgstr "詳細については :ref:`instrumentation` を参照してください。" -#: ../../whatsnew/3.6.rst:730 msgid "" "The current implementation is tested on Linux and macOS. Additional markers " "may be added in the future." msgstr "" +"現在の実装は Linux と macOS でテストされています。\n" +"将来マーカーが追加される可能性があります。" -#: ../../whatsnew/3.6.rst:733 msgid "" "(Contributed by Łukasz Langa in :issue:`21590`, based on patches by Jesús " "Cea Avión, David Malcolm, and Nikhil Benesch.)" msgstr "" +"(Jesús Cea Avión、David Malcolm、Nikhil Benesch のパッチを基にした Łukasz " +"Langa による貢献、:issue:`21590`。)" #: ../../whatsnew/3.6.rst:738 msgid "Other Language Changes" @@ -1101,12 +1313,14 @@ msgstr "その他の言語変更" msgid "Some smaller changes made to the core Python language are:" msgstr "Python 言語コアに小さな変更がいくつか行われました:" -#: ../../whatsnew/3.6.rst:742 msgid "" "A ``global`` or ``nonlocal`` statement must now textually appear before the " -"first use of the affected name in the same scope. Previously this was a :exc:" -"`SyntaxWarning`." +"first use of the affected name in the same scope. Previously this was " +"a :exc:`SyntaxWarning`." msgstr "" +"``global`` 文と ``nonlocal`` 文は、同じスコープ内で対象の名前を最初に使う場所" +"よりも前に記述する必要があります。\n" +"以前は違反すると :exc:`SyntaxWarning` になっていました。" #: ../../whatsnew/3.6.rst:746 msgid "" @@ -1116,27 +1330,36 @@ msgid "" "(Contributed by Andrew Barnert and Ivan Levkivskyi in :issue:`25958`.)" msgstr "" -#: ../../whatsnew/3.6.rst:752 msgid "" "Long sequences of repeated traceback lines are now abbreviated as " "``\"[Previous line repeated {count} more times]\"`` (see :ref:`whatsnew36-" "traceback` for an example). (Contributed by Emanuel Barry in :issue:`26823`.)" msgstr "" +"トレースバックで同じ行が長く繰り返される場合、``\"[Previous line repeated " +"{count} more times]\"`` と省略されるようになりました (例は :ref:`whatsnew36-" +"traceback` を参照)。\n" +"(Contributed by Emanuel Barry in :issue:`26823`.)" -#: ../../whatsnew/3.6.rst:757 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that currently checks " -"for ImportError (in try-except) will still work. (Contributed by Eric Snow " -"in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that currently " +"checks for ImportError (in try-except) will still work. (Contributed by Eric " +"Snow in :issue:`15767`.)" msgstr "" +"インポート時にモジュールが見つからない場合、新し" +"い :exc:`ModuleNotFoundError` (:exc:`ImportError` のサブクラス) を送出するよ" +"うになりました。\n" +"現在 try-except で ImportError を検査しているコードは引き続き動作します。\n" +"(Contributed by Eric Snow in :issue:`15767`.)" -#: ../../whatsnew/3.6.rst:762 msgid "" "Class methods relying on zero-argument ``super()`` will now work correctly " "when called from metaclass methods during class creation. (Contributed by " "Martin Teichmann in :issue:`23722`.)" msgstr "" +"引数なしの ``super()`` に依存するクラスメソッドが、クラス作成中にメタクラスの" +"メソッドから呼び出された場合も正しく動作するようになりました。\n" +"(Contributed by Martin Teichmann in :issue:`23722`.)" #: ../../whatsnew/3.6.rst:768 msgid "New Modules" @@ -1146,28 +1369,31 @@ msgstr "新たなモジュール" msgid "secrets" msgstr "secrets" -#: ../../whatsnew/3.6.rst:775 msgid "" "The main purpose of the new :mod:`secrets` module is to provide an obvious " "way to reliably generate cryptographically strong pseudo-random values " "suitable for managing secrets, such as account authentication, tokens, and " "similar." msgstr "" +"新しい :mod:`secrets` モジュールの主な目的は、アカウント認証やトークンなどの" +"秘密情報の管理に適した、暗号学的に強い疑似乱数値を確実に生成する分かりやすい" +"方法を提供することです。" -#: ../../whatsnew/3.6.rst:781 msgid "" "Note that the pseudo-random generators in the :mod:`random` module should " -"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ and :" -"func:`os.urandom` on Python 3.5 and earlier." +"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ " +"and :func:`os.urandom` on Python 3.5 and earlier." msgstr "" +":mod:`random` モジュールの疑似乱数生成器をセキュリティ目的に使っては *いけま" +"せん*。\n" +"Python 3.6 以降では :mod:`secrets` を、Python 3.5 以前で" +"は :func:`os.urandom` を使ってください。" -#: ../../whatsnew/3.6.rst:787 msgid ":pep:`506` -- Adding A Secrets Module To The Standard Library" -msgstr "" +msgstr ":pep:`506` -- 標準ライブラリへの secrets モジュールの追加" -#: ../../whatsnew/3.6.rst:788 msgid "PEP written and implemented by Steven D'Aprano." -msgstr "" +msgstr "PEP の執筆と実装は Steven D'Aprano。" #: ../../whatsnew/3.6.rst:792 msgid "Improved Modules" @@ -1177,85 +1403,97 @@ msgstr "改良されたモジュール" msgid "array" msgstr "array" -#: ../../whatsnew/3.6.rst:797 msgid "" "Exhausted iterators of :class:`array.array` will now stay exhausted even if " "the iterated array is extended. This is consistent with the behavior of " "other mutable sequences." msgstr "" +":class:`array.array` のイテレータが要素を取り尽くした後は、対象の配列が拡張さ" +"れても取り尽くした状態を維持するようになりました。\n" +"これはほかのミュータブルなシーケンスの動作と一致します。" -#: ../../whatsnew/3.6.rst:801 msgid "Contributed by Serhiy Storchaka in :issue:`26492`." -msgstr "" +msgstr "Serhiy Storchaka による貢献、:issue:`26492`。" #: ../../whatsnew/3.6.rst:804 msgid "ast" msgstr "ast" -#: ../../whatsnew/3.6.rst:806 msgid "" "The new :class:`ast.Constant` AST node has been added. It can be used by " "external AST optimizers for the purposes of constant folding." msgstr "" +"新しい AST ノード :class:`ast.Constant` が追加されました。\n" +"外部の AST 最適化ツールで定数畳み込みに利用できます。" -#: ../../whatsnew/3.6.rst:809 msgid "Contributed by Victor Stinner in :issue:`26146`." -msgstr "" +msgstr "Victor Stinner による貢献、:issue:`26146`。" #: ../../whatsnew/3.6.rst:813 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.6.rst:815 msgid "" "Starting with Python 3.6 the ``asyncio`` module is no longer provisional and " "its API is considered stable." msgstr "" +"Python 3.6 から ``asyncio`` モジュールは暫定版ではなくなり、API は安定版とみ" +"なされます。" -#: ../../whatsnew/3.6.rst:818 msgid "" "Notable changes in the :mod:`asyncio` module since Python 3.5.0 (all " "backported to 3.5.x due to the provisional status):" msgstr "" +"Python 3.5.0 以降の :mod:`asyncio` モジュールの注目すべき変更です (暫定版だっ" +"たため、すべて 3.5.x にバックポートされています):" -#: ../../whatsnew/3.6.rst:821 msgid "" "The :func:`~asyncio.get_event_loop` function has been changed to always " "return the currently running loop when called from coroutines and callbacks. " "(Contributed by Yury Selivanov in :issue:`28613`.)" msgstr "" +":func:`~asyncio.get_event_loop` 関数は、コルーチンやコールバックから呼ばれた" +"場合、常に現在実行中のループを返すようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`28613`.)" -#: ../../whatsnew/3.6.rst:826 msgid "" "The :func:`~asyncio.ensure_future` function and all functions that use it, " "such as :meth:`loop.run_until_complete() `, " "now accept all kinds of :term:`awaitable objects `. (Contributed " "by Yury Selivanov.)" msgstr "" +":func:`~asyncio.ensure_future` 関数と、 :meth:`loop.run_until_complete() " +"` のようなそれを使っている全ての関数であらゆ" +"る :term:`awaitable オブジェクト ` を受け取れるようになりまし" +"た。\n" +"(Contributed by Yury Selivanov.)" #: ../../whatsnew/3.6.rst:831 msgid "" "New :func:`~asyncio.run_coroutine_threadsafe` function to submit coroutines " "to event loops from other threads. (Contributed by Vincent Michel.)" msgstr "" -"他のスレッドからコルーチンをイベントループに送信するための新たな :func:" -"`~asyncio.run_coroutine_threadsafe` 関数。\n" +"他のスレッドからコルーチンをイベントループに送信するための新た" +"な :func:`~asyncio.run_coroutine_threadsafe` 関数。\n" "(Contributed by Vincent Michel.)" -#: ../../whatsnew/3.6.rst:835 msgid "" "New :meth:`Transport.is_closing() ` method " "to check if the transport is closing or closed. (Contributed by Yury " "Selivanov.)" msgstr "" +"新しい :meth:`Transport.is_closing() ` メ" +"ソッドで、トランスポートが終了処理中または終了済みか確認できます。\n" +"(Contributed by Yury Selivanov.)" -#: ../../whatsnew/3.6.rst:839 msgid "" "The :meth:`loop.create_server() ` method can now " "accept a list of hosts. (Contributed by Yann Sionneau.)" msgstr "" +":meth:`loop.create_server() ` メソッドはホストの" +"リストを受け取れるようになりました。\n" +"(Contributed by Yann Sionneau.)" -#: ../../whatsnew/3.6.rst:843 msgid "" "New :meth:`loop.create_future() ` method to " "create Future objects. This allows alternative event loop implementations, " @@ -1263,13 +1501,20 @@ msgid "" "faster :class:`asyncio.Future` implementation. (Contributed by Yury " "Selivanov in :issue:`27041`.)" msgstr "" +"Future オブジェクトを作成する :meth:`loop.create_future() " +"` メソッドが追加されました。\n" +"これにより `uvloop `_ などの別のイベン" +"トループ実装が、より高速な :class:`asyncio.Future` 実装を提供できます。\n" +"(Contributed by Yury Selivanov in :issue:`27041`.)" -#: ../../whatsnew/3.6.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() ` method to get the current exception handler. " -"(Contributed by Yury Selivanov in :issue:`27040`.)" +"New :meth:`loop.get_exception_handler() " +"` method to get the current exception " +"handler. (Contributed by Yury Selivanov in :issue:`27040`.)" msgstr "" +"現在の例外ハンドラーを取得する :meth:`loop.get_exception_handler() " +"` メソッドが追加されました。\n" +"(Contributed by Yury Selivanov in :issue:`27040`.)" #: ../../whatsnew/3.6.rst:854 msgid "" @@ -1282,19 +1527,24 @@ msgstr "" "れるようになりました。\n" "(Contributed by Mark Korenberg.)" -#: ../../whatsnew/3.6.rst:859 msgid "" -"The performance of :meth:`StreamReader.readexactly() ` has been improved. (Contributed by Mark Korenberg in :issue:" -"`28370`.)" +"The performance of :meth:`StreamReader.readexactly() " +"` has been improved. (Contributed by Mark " +"Korenberg in :issue:`28370`.)" msgstr "" +":meth:`StreamReader.readexactly() ` の性能" +"が改善されました。\n" +"(Contributed by Mark Korenberg in :issue:`28370`.)" -#: ../../whatsnew/3.6.rst:863 msgid "" "The :meth:`loop.getaddrinfo() ` method is " "optimized to avoid calling the system ``getaddrinfo`` function if the " "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" +":meth:`loop.getaddrinfo() ` メソッドは、アドレスが" +"解決済みであればシステムの ``getaddrinfo`` 関数を呼ばないように最適化されまし" +"た。\n" +"(Contributed by A. Jesse Jiryu Davis.)" #: ../../whatsnew/3.6.rst:868 msgid "" @@ -1311,62 +1561,76 @@ msgid "" "exception. (Contributed by Chris Angelico in :issue:`26221`.)" msgstr "" -#: ../../whatsnew/3.6.rst:879 msgid "" -"New :meth:`loop.connect_accepted_socket() ` method to be used by servers that accept " -"connections outside of asyncio, but that use asyncio to handle them. " +"New :meth:`loop.connect_accepted_socket() " +"` method to be used by servers that " +"accept connections outside of asyncio, but that use asyncio to handle them. " "(Contributed by Jim Fulton in :issue:`27392`.)" msgstr "" +"asyncio の外で接続を受け付け、asyncio でその接続を処理するサーバー向け" +"に :meth:`loop.connect_accepted_socket() " +"` メソッドが追加されました。\n" +"(Contributed by Jim Fulton in :issue:`27392`.)" -#: ../../whatsnew/3.6.rst:884 msgid "" "``TCP_NODELAY`` flag is now set for all TCP transports by default. " "(Contributed by Yury Selivanov in :issue:`27456`.)" msgstr "" +"すべての TCP トランスポートで ``TCP_NODELAY`` フラグがデフォルトで設定される" +"ようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`27456`.)" -#: ../../whatsnew/3.6.rst:887 msgid "" "New :meth:`loop.shutdown_asyncgens() ` to " "properly close pending asynchronous generators before closing the loop. " "(Contributed by Yury Selivanov in :issue:`28003`.)" msgstr "" +"ループを閉じる前に残っている非同期ジェネレータを適切に閉じ" +"る :meth:`loop.shutdown_asyncgens() ` が追加" +"されました。\n" +"(Contributed by Yury Selivanov in :issue:`28003`.)" -#: ../../whatsnew/3.6.rst:892 msgid "" ":class:`Future ` and :class:`Task ` classes " "now have an optimized C implementation which makes asyncio code up to 30% " "faster. (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081` " "and :issue:`28544`.)" msgstr "" +":class:`Future ` と :class:`Task ` に最適化され" +"た C 実装が追加され、asyncio のコードが最大 30% 高速になりました。\n" +"(Contributed by Yury Selivanov and INADA Naoki in :issue:`26081` " +"and :issue:`28544`.)" #: ../../whatsnew/3.6.rst:900 msgid "binascii" msgstr "binascii" -#: ../../whatsnew/3.6.rst:902 msgid "" "The :func:`~binascii.b2a_base64` function now accepts an optional *newline* " "keyword argument to control whether the newline character is appended to the " "return value. (Contributed by Victor Stinner in :issue:`25357`.)" msgstr "" +":func:`~binascii.b2a_base64` 関数に省略可能なキーワード引数 *newline* が追加" +"され、戻り値の末尾に改行文字を付けるかどうかを制御できます。\n" +"(Contributed by Victor Stinner in :issue:`25357`.)" #: ../../whatsnew/3.6.rst:909 msgid "cmath" msgstr "cmath" -#: ../../whatsnew/3.6.rst:911 msgid "" "The new :const:`cmath.tau` (*τ*) constant has been added. (Contributed by " "Lisa Roach in :issue:`12345`, see :pep:`628` for details.)" msgstr "" +"定数 :const:`cmath.tau` (*τ*) が追加されました。\n" +"(Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for details.)" #: ../../whatsnew/3.6.rst:914 msgid "" -"New constants: :const:`cmath.inf` and :const:`cmath.nan` to match :const:" -"`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` and :const:" -"`cmath.nanj` to match the format used by complex repr. (Contributed by Mark " -"Dickinson in :issue:`23229`.)" +"New constants: :const:`cmath.inf` and :const:`cmath.nan` to " +"match :const:`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` " +"and :const:`cmath.nanj` to match the format used by complex repr. " +"(Contributed by Mark Dickinson in :issue:`23229`.)" msgstr "" "新たに定数が追加されました。 :const:`math.inf` と :const:`math.nan` に対応す" "る :const:`cmath.inf` と :const:`cmath.nan`。複素数の repr が使用する書式に対" @@ -1377,12 +1641,14 @@ msgstr "" msgid "collections" msgstr "collections" -#: ../../whatsnew/3.6.rst:923 msgid "" "The new :class:`~collections.abc.Collection` abstract base class has been " "added to represent sized iterable container classes. (Contributed by Ivan " "Levkivskyi, docs by Neil Girdhar in :issue:`27598`.)" msgstr "" +"サイズを持つ反復可能なコンテナクラスを表す抽象基底クラ" +"ス :class:`~collections.abc.Collection` が追加されました。\n" +"(Contributed by Ivan Levkivskyi, docs by Neil Girdhar in :issue:`27598`.)" #: ../../whatsnew/3.6.rst:927 msgid "" @@ -1391,58 +1657,77 @@ msgid "" "(Contributed by Ivan Levkivskyi in :issue:`25987`.)" msgstr "" -#: ../../whatsnew/3.6.rst:931 msgid "" "The new :class:`~collections.abc.AsyncGenerator` abstract base class " -"represents asynchronous generators. (Contributed by Yury Selivanov in :issue:" -"`28720`.)" +"represents asynchronous generators. (Contributed by Yury Selivanov " +"in :issue:`28720`.)" msgstr "" +"新しい抽象基底クラス :class:`~collections.abc.AsyncGenerator` は非同期ジェネ" +"レータを表します。\n" +"(Contributed by Yury Selivanov in :issue:`28720`.)" -#: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the :attr:`~type." -"__module__` attribute of the returned named tuple class. (Contributed by " -"Raymond Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for " +"the :attr:`~type.__module__` attribute of the returned named tuple class. " +"(Contributed by Raymond Hettinger in :issue:`17941`.)" msgstr "" +":func:`~collections.namedtuple` 関数に省略可能なキーワード引数 *module* が追" +"加されました。\n" +"指定すると、返される名前付きタプルのクラスの :attr:`~type.__module__` 属性に" +"使われます。\n" +"(Contributed by Raymond Hettinger in :issue:`17941`.)" -#: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 msgid "" "The *verbose* and *rename* arguments for :func:`~collections.namedtuple` are " "now keyword-only. (Contributed by Raymond Hettinger in :issue:`25628`.)" msgstr "" +":func:`~collections.namedtuple` の *verbose* と *rename* 引数がキーワード専用" +"になりました。\n" +"(Contributed by Raymond Hettinger in :issue:`25628`.)" -#: ../../whatsnew/3.6.rst:944 msgid "" "Recursive :class:`collections.deque` instances can now be pickled. " "(Contributed by Serhiy Storchaka in :issue:`26482`.)" msgstr "" +"再帰的な :class:`collections.deque` インスタンスを pickle 化できるようになり" +"ました。\n" +"(Contributed by Serhiy Storchaka in :issue:`26482`.)" #: ../../whatsnew/3.6.rst:949 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.6.rst:951 msgid "" "The :class:`ThreadPoolExecutor ` " "class constructor now accepts an optional *thread_name_prefix* argument to " "make it possible to customize the names of the threads created by the pool. " "(Contributed by Gregory P. Smith in :issue:`27664`.)" msgstr "" +":class:`ThreadPoolExecutor ` クラスの" +"コンストラクタに省略可能な *thread_name_prefix* 引数が追加され、プールが作成" +"するスレッドの名前をカスタマイズできるようになりました。\n" +"(Contributed by Gregory P. Smith in :issue:`27664`.)" #: ../../whatsnew/3.6.rst:959 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.6.rst:961 msgid "" "The :class:`contextlib.AbstractContextManager` class has been added to " "provide an abstract base class for context managers. It provides a sensible " "default implementation for ``__enter__()`` which returns ``self`` and leaves " -"``__exit__()`` an abstract method. A matching class has been added to the :" -"mod:`typing` module as :class:`typing.ContextManager`. (Contributed by Brett " -"Cannon in :issue:`25609`.)" -msgstr "" +"``__exit__()`` an abstract method. A matching class has been added to " +"the :mod:`typing` module as :class:`typing.ContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" +msgstr "" +"コンテキストマネージャーの抽象基底クラ" +"ス :class:`contextlib.AbstractContextManager` が追加されました。\n" +"``__enter__()`` には ``self`` を返す妥当なデフォルト実装があり、" +"``__exit__()`` は抽象メソッドのままです。\n" +":mod:`typing` モジュールにも対応する :class:`typing.ContextManager` クラスが" +"追加されました。\n" +"(Contributed by Brett Cannon in :issue:`25609`.)" #: ../../whatsnew/3.6.rst:971 msgid "datetime" @@ -1458,109 +1743,139 @@ msgid "" "Belopolsky in :issue:`24773`.)" msgstr "" -#: ../../whatsnew/3.6.rst:981 msgid "" -"The :meth:`datetime.strftime() ` and :meth:`date." -"strftime() ` methods now support ISO 8601 date " -"directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley Anderson in :" -"issue:`12006`.)" +"The :meth:`datetime.strftime() ` " +"and :meth:`date.strftime() ` methods now support ISO " +"8601 date directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley " +"Anderson in :issue:`12006`.)" msgstr "" +":meth:`datetime.strftime() ` " +"と :meth:`date.strftime() ` メソッドが、ISO 8601 の日" +"付書式指定 ``%G``、``%u``、``%V`` に対応しました。\n" +"(Contributed by Ashley Anderson in :issue:`12006`.)" -#: ../../whatsnew/3.6.rst:986 msgid "" "The :func:`datetime.isoformat() ` function now " "accepts an optional *timespec* argument that specifies the number of " "additional components of the time value to include. (Contributed by " "Alessandro Cucci and Alexander Belopolsky in :issue:`19475`.)" msgstr "" +":func:`datetime.isoformat() ` 関数に省略可能な引" +"数 *timespec* が追加され、時刻の構成要素をどこまで含めるか指定できるようにな" +"りました。\n" +"(Contributed by Alessandro Cucci and Alexander Belopolsky in :issue:`19475`.)" -#: ../../whatsnew/3.6.rst:991 msgid "" "The :meth:`datetime.combine() ` now accepts an " -"optional *tzinfo* argument. (Contributed by Alexander Belopolsky in :issue:" -"`27661`.)" +"optional *tzinfo* argument. (Contributed by Alexander Belopolsky " +"in :issue:`27661`.)" msgstr "" +":meth:`datetime.combine() ` に省略可能な *tzinfo* " +"引数が追加されました。\n" +"(Contributed by Alexander Belopolsky in :issue:`27661`.)" #: ../../whatsnew/3.6.rst:997 msgid "decimal" msgstr "decimal" -#: ../../whatsnew/3.6.rst:999 msgid "" "New :meth:`Decimal.as_integer_ratio() ` " -"method that returns a pair ``(n, d)`` of integers that represent the given :" -"class:`~decimal.Decimal` instance as a fraction, in lowest terms and with a " -"positive denominator::" +"method that returns a pair ``(n, d)`` of integers that represent the " +"given :class:`~decimal.Decimal` instance as a fraction, in lowest terms and " +"with a positive denominator::" msgstr "" +"新しい :meth:`Decimal.as_integer_ratio() ` " +"メソッドは、:class:`~decimal.Decimal` インスタンスを分母が正の既約分数で表す" +"整数のペア ``(n, d)`` を返します。 ::" -#: ../../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`.)" -msgstr "" +msgstr "(Stefan Krah と Mark Dickinson による貢献、:issue:`25928`。)" #: ../../whatsnew/3.6.rst:1012 ../../whatsnew/3.6.rst:1990 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.6.rst:1014 msgid "" -"The ``default_format`` attribute has been removed from ``distutils.command." -"sdist.sdist`` and the ``formats`` attribute defaults to ``['gztar']``. " -"Although not anticipated, any code relying on the presence of " +"The ``default_format`` attribute has been removed from " +"``distutils.command.sdist.sdist`` and the ``formats`` attribute defaults to " +"``['gztar']``. Although not anticipated, any code relying on the presence of " "``default_format`` may need to be adapted. See :issue:`27819` for more " "details." msgstr "" +"``distutils.command.sdist.sdist`` の ``default_format`` 属性が削除され、" +"``formats`` 属性のデフォルトは ``['gztar']`` になりました。\n" +"そのようなコードは想定していませんが、``default_format`` の存在に依存するコー" +"ドは修正が必要になる可能性があります。\n" +"詳しくは :issue:`27819` を参照してください。" #: ../../whatsnew/3.6.rst:1022 msgid "email" msgstr "email" -#: ../../whatsnew/3.6.rst:1024 msgid "" "The new email API, enabled via the *policy* keyword to various constructors, " "is no longer provisional. The :mod:`email` documentation has been " "reorganized and rewritten to focus on the new API, while retaining the old " -"documentation for the legacy API. (Contributed by R. David Murray in :issue:" -"`24277`.)" +"documentation for the legacy API. (Contributed by R. David Murray " +"in :issue:`24277`.)" msgstr "" +"各種コンストラクタの *policy* キーワードで有効にする新しい email API が、暫定" +"版ではなくなりました。\n" +":mod:`email` のドキュメントは、新しい API を中心に構成を見直して書き直され、" +"従来の API の古いドキュメントも残されています。\n" +"(Contributed by R. David Murray in :issue:`24277`.)" -#: ../../whatsnew/3.6.rst:1029 msgid "" "The :mod:`email.mime` classes now all accept an optional *policy* keyword. " "(Contributed by Berker Peksag in :issue:`27331`.)" msgstr "" +":mod:`email.mime` のすべてのクラスに、省略可能な *policy* キーワードが追加さ" +"れました。\n" +"(Contributed by Berker Peksag in :issue:`27331`.)" -#: ../../whatsnew/3.6.rst:1032 msgid "" "The :class:`~email.generator.DecodedGenerator` now supports the *policy* " "keyword." msgstr "" +":class:`~email.generator.DecodedGenerator` が *policy* キーワードに対応しまし" +"た。" -#: ../../whatsnew/3.6.rst:1035 msgid "" -"There is a new :mod:`~email.policy` attribute, :attr:`~email.policy.Policy." -"message_factory`, that controls what class is used by default when the " -"parser creates new message objects. For the :attr:`email.policy.compat32` " -"policy this is :class:`~email.message.Message`, for the new policies it is :" -"class:`~email.message.EmailMessage`. (Contributed by R. David Murray in :" -"issue:`20476`.)" +"There is a new :mod:`~email.policy` " +"attribute, :attr:`~email.policy.Policy.message_factory`, that controls what " +"class is used by default when the parser creates new message objects. For " +"the :attr:`email.policy.compat32` policy this " +"is :class:`~email.message.Message`, for the new policies it " +"is :class:`~email.message.EmailMessage`. (Contributed by R. David Murray " +"in :issue:`20476`.)" msgstr "" +":mod:`~email.policy` に :attr:`~email.policy.Policy.message_factory` 属性が追" +"加され、パーサーが新しいメッセージオブジェクトを作成するときのデフォルトのク" +"ラスを制御できます。\n" +":attr:`email.policy.compat32` ポリシーでは :class:`~email.message.Message`、" +"新しいポリシーでは :class:`~email.message.EmailMessage` です。\n" +"(Contributed by R. David Murray in :issue:`20476`.)" #: ../../whatsnew/3.6.rst:1044 msgid "encodings" msgstr "エンコーディング" -#: ../../whatsnew/3.6.rst:1046 msgid "" "On Windows, added the ``'oem'`` encoding to use ``CP_OEMCP``, and the " "``'ansi'`` alias for the existing ``'mbcs'`` encoding, which uses the " "``CP_ACP`` code page. (Contributed by Steve Dower in :issue:`27959`.)" msgstr "" +"Windows で ``CP_OEMCP`` を使う ``'oem'`` エンコーディングが追加されました。\n" +"また ``CP_ACP`` コードページを使う既存の ``'mbcs'`` エンコーディングに " +"``'ansi'`` という別名が追加されました。\n" +"(Contributed by Steve Dower in :issue:`27959`.)" #: ../../whatsnew/3.6.rst:1052 msgid "enum" @@ -1568,25 +1883,25 @@ msgstr "enum" #: ../../whatsnew/3.6.rst:1054 msgid "" -"Two new enumeration base classes have been added to the :mod:`enum` module: :" -"class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to define " -"constants that can be combined using the bitwise operators. (Contributed by " -"Ethan Furman in :issue:`23591`.)" +"Two new enumeration base classes have been added to the :mod:`enum` " +"module: :class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to " +"define constants that can be combined using the bitwise operators. " +"(Contributed by Ethan Furman in :issue:`23591`.)" msgstr "" #: ../../whatsnew/3.6.rst:1059 msgid "" -"Many standard library modules have been updated to use the :class:`~enum." -"IntFlags` class for their constants." +"Many standard library modules have been updated to use " +"the :class:`~enum.IntFlags` class for their constants." msgstr "" -#: ../../whatsnew/3.6.rst:1062 msgid "" "The new :class:`enum.auto` value can be used to assign values to enum " "members automatically::" msgstr "" +"新しい :class:`enum.auto` 値を使うと、列挙型のメンバーに値を自動的に割り当て" +"られます。 ::" -#: ../../whatsnew/3.6.rst:1065 msgid "" ">>> from enum import Enum, auto\n" ">>> class Color(Enum):\n" @@ -1597,39 +1912,52 @@ msgid "" ">>> list(Color)\n" "[, , ]" msgstr "" +">>> from enum import Enum, auto\n" +">>> class Color(Enum):\n" +"... red = auto()\n" +"... blue = auto()\n" +"... green = auto()\n" +"...\n" +">>> list(Color)\n" +"[, , ]" #: ../../whatsnew/3.6.rst:1076 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.6.rst:1078 msgid "" "On Windows, the :mod:`faulthandler` module now installs a handler for " "Windows exceptions: see :func:`faulthandler.enable`. (Contributed by Victor " "Stinner in :issue:`23848`.)" msgstr "" +"Windows では :mod:`faulthandler` モジュールが Windows 例外のハンドラーをイン" +"ストールするようになりました。\n" +":func:`faulthandler.enable` を参照してください。\n" +"(Contributed by Victor Stinner in :issue:`23848`.)" #: ../../whatsnew/3.6.rst:1084 msgid "fileinput" msgstr "fileinput" -#: ../../whatsnew/3.6.rst:1086 msgid "" ":func:`~fileinput.hook_encoded` now supports the *errors* argument. " "(Contributed by Joseph Hackman in :issue:`25788`.)" msgstr "" +":func:`~fileinput.hook_encoded` が *errors* 引数に対応しました。\n" +"(Contributed by Joseph Hackman in :issue:`25788`.)" #: ../../whatsnew/3.6.rst:1091 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.6.rst:1093 msgid "" ":mod:`hashlib` supports OpenSSL 1.1.0. The minimum recommend version is " "1.0.2. (Contributed by Christian Heimes in :issue:`26470`.)" msgstr "" +":mod:`hashlib` が OpenSSL 1.1.0 に対応しました。\n" +"推奨される最小バージョンは 1.0.2 です。\n" +"(Contributed by Christian Heimes in :issue:`26470`.)" -#: ../../whatsnew/3.6.rst:1096 msgid "" "BLAKE2 hash functions were added to the module. :func:`~hashlib.blake2b` " "and :func:`~hashlib.blake2s` are always available and support the full " @@ -1637,41 +1965,57 @@ msgid "" "based on code by Dmitry Chestnykh and Samuel Neves. Documentation written by " "Dmitry Chestnykh.)" msgstr "" +"BLAKE2 ハッシュ関数がモジュールに追加されました。\n" +":func:`~hashlib.blake2b` と :func:`~hashlib.blake2s` は常に利用可能で、" +"BLAKE2 のすべての機能をサポートします。\n" +"(Contributed by Christian Heimes in :issue:`26798` based on code by Dmitry " +"Chestnykh and Samuel Neves. Documentation written by Dmitry Chestnykh.)" -#: ../../whatsnew/3.6.rst:1102 msgid "" -"The SHA-3 hash functions :func:`~hashlib.sha3_224`, :func:`~hashlib." -"sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, and SHAKE " -"hash functions :func:`~hashlib.shake_128` and :func:`~hashlib.shake_256` " -"were added. (Contributed by Christian Heimes in :issue:`16113`. Keccak Code " -"Package by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, " -"and Ronny Van Keer.)" +"The SHA-3 hash " +"functions :func:`~hashlib.sha3_224`, :func:`~hashlib.sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, " +"and SHAKE hash functions :func:`~hashlib.shake_128` " +"and :func:`~hashlib.shake_256` were added. (Contributed by Christian Heimes " +"in :issue:`16113`. Keccak Code Package by Guido Bertoni, Joan Daemen, " +"Michaël Peeters, Gilles Van Assche, and Ronny Van Keer.)" msgstr "" +"SHA-3 ハッシュ関" +"数 :func:`~hashlib.sha3_224`、:func:`~hashlib.sha3_256`、:func:`~hashlib.sha3_384`、:func:`~hashlib.sha3_512` " +"と、SHAKE ハッシュ関" +"数 :func:`~hashlib.shake_128`、:func:`~hashlib.shake_256` が追加されまし" +"た。\n" +"(Contributed by Christian Heimes in :issue:`16113`. Keccak Code Package by " +"Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, and Ronny " +"Van Keer.)" -#: ../../whatsnew/3.6.rst:1109 msgid "" "The password-based key derivation function :func:`~hashlib.scrypt` is now " -"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes in :" -"issue:`27928`.)" +"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes " +"in :issue:`27928`.)" msgstr "" +"パスワードに基づく鍵導出関数 :func:`~hashlib.scrypt` が OpenSSL 1.1.0 以降で" +"利用可能になりました。\n" +"(Contributed by Christian Heimes in :issue:`27928`.)" #: ../../whatsnew/3.6.rst:1114 msgid "http.client" msgstr "http.client" -#: ../../whatsnew/3.6.rst:1116 msgid "" -":meth:`HTTPConnection.request() ` and :" -"meth:`~http.client.HTTPConnection.endheaders` both now support chunked " -"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl in :" -"issue:`12319`.)" +":meth:`HTTPConnection.request() ` " +"and :meth:`~http.client.HTTPConnection.endheaders` both now support chunked " +"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" +":meth:`HTTPConnection.request() ` " +"と :meth:`~http.client.HTTPConnection.endheaders` が、リクエスト本文のチャン" +"クエンコーディングに対応しました。\n" +"(Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)" #: ../../whatsnew/3.6.rst:1123 msgid "idlelib and IDLE" msgstr "idlelib と IDLE" -#: ../../whatsnew/3.6.rst:1125 msgid "" "The idlelib package is being modernized and refactored to make IDLE look and " "work better and to make the code easier to understand, test, and improve. " @@ -1680,91 +2024,121 @@ msgid "" "tk 8.4. It now requires tcl/tk 8.5 or 8.6. We recommend running the latest " "release of either." msgstr "" +"idlelib パッケージは、IDLE の見た目と動作を改善し、コードを理解、テスト、改善" +"しやすくするため、刷新とリファクタリングが進められています。\n" +"特に Linux と Mac での見た目を改善する取り組みの一環として、主にダイアログで " +"ttk ウィジェットを使うようになりました。\n" +"その結果、IDLE は tcl/tk 8.4 では動作せず、tcl/tk 8.5 または 8.6 が必要になり" +"ました。\n" +"どちらも最新リリースの使用を推奨します。" -#: ../../whatsnew/3.6.rst:1132 msgid "" "'Modernizing' includes renaming and consolidation of idlelib modules. The " "renaming of files with partial uppercase names is similar to the renaming " "of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As " "a result, imports of idlelib files that worked in 3.5 will usually not work " -"in 3.6. At least a module name change will be needed (see idlelib/README." -"txt), sometimes more. (Name changes contributed by Al Swiegart and Terry " -"Reedy in :issue:`24225`. Most idlelib patches since have been and will be " -"part of the process.)" -msgstr "" +"in 3.6. At least a module name change will be needed (see idlelib/" +"README.txt), sometimes more. (Name changes contributed by Al Swiegart and " +"Terry Reedy in :issue:`24225`. Most idlelib patches since have been and " +"will be part of the process.)" +msgstr "" +"この刷新には idlelib モジュールの改名と統合も含まれます。\n" +"名前に一部大文字を含むファイルの改名は、例えば 3.0 で Tkinter と TkFont を " +"tkinter と tkinter.font に改名したことと同様です。\n" +"そのため、3.5 で動作した idlelib ファイルのインポートは、通常 3.6 では動作し" +"ません。\n" +"少なくともモジュール名の変更が必要で (idlelib/README.txt を参照)、さらに変更" +"が必要な場合もあります。\n" +"(改名は Al Swiegart と Terry Reedy による貢献、:issue:`24225`。以降の " +"idlelib のパッチの多くは、この取り組みの一部であり、今後もそうなる予定です。)" -#: ../../whatsnew/3.6.rst:1141 msgid "" "In compensation, the eventual result with be that some idlelib classes will " "be easier to use, with better APIs and docstrings explaining them. " "Additional useful information will be added to idlelib when available." msgstr "" +"一方、最終的には idlelib の一部のクラスの API が改善され、その説明の " +"docstring も整い、使いやすくなる予定です。\n" +"役立つ追加情報も、用意でき次第 idlelib に追加されます。" -#: ../../whatsnew/3.6.rst:1145 msgid "New in 3.6.2:" -msgstr "" +msgstr "3.6.2 の新機能:" #: ../../whatsnew/3.6.rst:1147 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" "自動補完におけるいくつもの修正。\n" "(Contributed by Louie Lu in :issue:`15786`.)" -#: ../../whatsnew/3.6.rst:1149 msgid "New in 3.6.3:" -msgstr "" +msgstr "3.6.3 の新機能:" -#: ../../whatsnew/3.6.rst:1151 msgid "" "Module Browser (on the File menu, formerly called Class Browser), now " "displays nested functions and classes in addition to top-level functions and " "classes. (Contributed by Guilherme Polo, Cheryl Sabella, and Terry Jan Reedy " "in :issue:`1612262`.)" msgstr "" +"File メニューの Module Browser (以前の Class Browser) が、トップレベルだけで" +"なく入れ子の関数やクラスも表示するようになりました。\n" +"(Contributed by Guilherme Polo, Cheryl Sabella, and Terry Jan Reedy " +"in :issue:`1612262`.)" -#: ../../whatsnew/3.6.rst:1157 msgid "" "The IDLE features formerly implemented as extensions have been reimplemented " "as normal features. Their settings have been moved from the Extensions tab " "to other dialog tabs. (Contributed by Charles Wohlganger and Terry Jan Reedy " "in :issue:`27099`.)" msgstr "" +"従来は拡張として実装されていた IDLE の機能が通常の機能として再実装されまし" +"た。\n" +"その設定は Extensions タブからほかのダイアログのタブへ移されました。\n" +"(Contributed by Charles Wohlganger and Terry Jan Reedy in :issue:`27099`.)" -#: ../../whatsnew/3.6.rst:1162 msgid "" "The Settings dialog (Options, Configure IDLE) has been partly rewritten to " "improve both appearance and function. (Contributed by Cheryl Sabella and " "Terry Jan Reedy in multiple issues.)" msgstr "" +"設定ダイアログ (Options の Configure IDLE) の一部が、見た目と機能を改善するた" +"めに書き直されました。\n" +"(Contributed by Cheryl Sabella and Terry Jan Reedy in multiple issues.)" -#: ../../whatsnew/3.6.rst:1166 msgid "New in 3.6.4:" -msgstr "" +msgstr "3.6.4 の新機能:" -#: ../../whatsnew/3.6.rst:1168 msgid "" "The font sample now includes a selection of non-Latin characters so that " "users can better see the effect of selecting a particular font. (Contributed " "by Terry Jan Reedy in :issue:`13802`.) The sample can be edited to include " "other characters. (Contributed by Serhiy Storchaka in :issue:`31860`.)" msgstr "" +"フォントのサンプルにラテン文字以外の文字も含まれるようになり、フォントを選ん" +"だ結果をよりよく確認できます。\n" +"(Terry Jan Reedy による貢献、:issue:`13802`。)\n" +"サンプルを編集してほかの文字を追加することもできます。\n" +"(Serhiy Storchaka による貢献、:issue:`31860`。)" -#: ../../whatsnew/3.6.rst:1174 msgid "New in 3.6.6:" -msgstr "" +msgstr "3.6.6 の新機能:" -#: ../../whatsnew/3.6.rst:1176 msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" +"エディターのコードコンテキストオプションが改訂されました。\n" +"ボックスに maxlines までのすべてのコンテキスト行を表示します。\n" +"コンテキスト行をクリックすると、エディターがその行へ移動します。\n" +"設定ダイアログの Highlights タブに、カスタムテーマのコンテキストの色が追加さ" +"れました。\n" +"(Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" -#: ../../whatsnew/3.6.rst:1182 msgid "" "On Windows, a new API call tells Windows that tk scales for DPI. On Windows " "8.1+ or 10, with DPI compatibility properties of the Python binary " @@ -1772,12 +2146,17 @@ msgid "" "text and lines sharper. It should otherwise have no effect. (Contributed by " "Terry Jan Reedy in :issue:`33656`.)" msgstr "" +"Windows で新しい API 呼び出しを使い、tk が DPI に合わせて拡大縮小することを " +"Windows に通知するようになりました。\n" +"Windows 8.1 以降または 10 で、Python バイナリの DPI 互換性プロパティを変更し" +"ておらず、モニターの解像度が 96 DPI を超える場合、文字や線がより鮮明になるは" +"ずです。\n" +"それ以外の場合には影響しないはずです。\n" +"(Contributed by Terry Jan Reedy in :issue:`33656`.)" -#: ../../whatsnew/3.6.rst:1188 msgid "New in 3.6.7:" -msgstr "" +msgstr "3.6.7 の新機能:" -#: ../../whatsnew/3.6.rst:1190 msgid "" "Output over N lines (50 by default) is squeezed down to a button. N can be " "changed in the PyShell section of the General page of the Settings dialog. " @@ -1786,55 +2165,77 @@ msgid "" "button or into the clipboard or a separate window by right-clicking the " "button. (Contributed by Tal Einat in :issue:`1529353`.)" msgstr "" +"N 行 (デフォルトは 50 行) を超える出力は、一つのボタンに折り畳まれます。\n" +"N は設定ダイアログの General ページにある PyShell セクションで変更できま" +"す。\n" +"行数が少なくても各行が非常に長い場合などは、出力を右クリックして折り畳めま" +"す。\n" +"折り畳んだ出力は、ボタンのダブルクリックでその場に展開でき、右クリックでク" +"リップボードや別のウィンドウに展開できます。\n" +"(Contributed by Tal Einat in :issue:`1529353`.)" #: ../../whatsnew/3.6.rst:1199 ../../whatsnew/3.6.rst:2007 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.6.rst:1201 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that current checks " -"for ``ImportError`` (in try-except) will still work. (Contributed by Eric " -"Snow in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that current " +"checks for ``ImportError`` (in try-except) will still work. (Contributed by " +"Eric Snow in :issue:`15767`.)" msgstr "" +"インポート時にモジュールが見つからない場合、新し" +"い :exc:`ModuleNotFoundError` (:exc:`ImportError` のサブクラス) を送出するよ" +"うになりました。\n" +"現在 try-except で ``ImportError`` を検査しているコードは引き続き動作しま" +"す。\n" +"(Contributed by Eric Snow in :issue:`15767`.)" -#: ../../whatsnew/3.6.rst:1206 msgid "" -":class:`importlib.util.LazyLoader` now calls :meth:`~importlib.abc.Loader." -"create_module` on the wrapped loader, removing the restriction that :class:" -"`importlib.machinery.BuiltinImporter` and :class:`importlib.machinery." -"ExtensionFileLoader` couldn't be used with :class:`importlib.util." -"LazyLoader`." +":class:`importlib.util.LazyLoader` now " +"calls :meth:`~importlib.abc.Loader.create_module` on the wrapped loader, " +"removing the restriction that :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader` couldn't be used " +"with :class:`importlib.util.LazyLoader`." msgstr "" +":class:`importlib.util.LazyLoader` は、ラップしたローダー" +"の :meth:`~importlib.abc.Loader.create_module` を呼び出すようになりました。\n" +"これにより、:class:`importlib.machinery.BuiltinImporter` " +"と :class:`importlib.machinery.ExtensionFileLoader` " +"を :class:`importlib.util.LazyLoader` で使えないという制限がなくなりました。" -#: ../../whatsnew/3.6.rst:1212 msgid "" -":func:`importlib.util.cache_from_source`, :func:`importlib.util." -"source_from_cache`, and :func:`importlib.util.spec_from_file_location` now " -"accept a :term:`path-like object`." +":func:`importlib.util.cache_from_source`, :func:`importlib.util.source_from_cache`, " +"and :func:`importlib.util.spec_from_file_location` now accept a :term:`path-" +"like object`." msgstr "" +":func:`importlib.util.cache_from_source`、:func:`importlib.util.source_from_cache`、:func:`importlib.util.spec_from_file_location` " +"が :term:`path-like object` を受け付けるようになりました。" #: ../../whatsnew/3.6.rst:1219 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.6.rst:1221 msgid "" "The :func:`inspect.signature() ` function now reports the " "implicit ``.0`` parameters generated by the compiler for comprehension and " "generator expression scopes as if they were positional-only parameters " "called ``implicit0``. (Contributed by Jelle Zijlstra in :issue:`19611`.)" msgstr "" +":func:`inspect.signature() ` 関数は、内包表記やジェネレー" +"タ式のスコープ用にコンパイラが生成する暗黙の ``.0`` パラメータを、" +"``implicit0`` という名前の位置専用パラメータとして報告するようになりまし" +"た。\n" +"(Contributed by Jelle Zijlstra in :issue:`19611`.)" #: ../../whatsnew/3.6.rst:1226 msgid "" -"To reduce code churn when upgrading from Python 2.7 and the legacy :func:" -"`inspect.getargspec` API, the previously documented deprecation of :func:" -"`inspect.getfullargspec` has been reversed. While this function is " -"convenient for single/source Python 2/3 code bases, the richer :func:" -"`inspect.signature` interface remains the recommended approach for new code. " -"(Contributed by Nick Coghlan in :issue:`27172`)" +"To reduce code churn when upgrading from Python 2.7 and the " +"legacy :func:`inspect.getargspec` API, the previously documented deprecation " +"of :func:`inspect.getfullargspec` has been reversed. While this function is " +"convenient for single/source Python 2/3 code bases, the " +"richer :func:`inspect.signature` interface remains the recommended approach " +"for new code. (Contributed by Nick Coghlan in :issue:`27172`)" msgstr "" #: ../../whatsnew/3.6.rst:1235 @@ -1857,68 +2258,76 @@ msgstr "logging" #: ../../whatsnew/3.6.rst:1245 msgid "" -"The new :meth:`WatchedFileHandler.reopenIfNeeded() ` method has been added to add the ability " -"to check if the log file needs to be reopened. (Contributed by Marian Horban " -"in :issue:`24884`.)" +"The new :meth:`WatchedFileHandler.reopenIfNeeded() " +"` method has been added " +"to add the ability to check if the log file needs to be reopened. " +"(Contributed by Marian Horban in :issue:`24884`.)" msgstr "" -"新しく :meth:`WatchedFileHandler.reopenIfNeeded() ` メソッドが追加され、ログファイルを再オー" -"プンする必要があるかどうかをチェックする機能が追加れました。(Contributed by " -"Marian Horban in :issue:`24884`.)" +"新しく :meth:`WatchedFileHandler.reopenIfNeeded() " +"` メソッドが追加され、ロ" +"グファイルを再オープンする必要があるかどうかをチェックする機能が追加れまし" +"た。(Contributed by Marian Horban in :issue:`24884`.)" #: ../../whatsnew/3.6.rst:1252 msgid "math" msgstr "math" -#: ../../whatsnew/3.6.rst:1254 msgid "" "The tau (*τ*) constant has been added to the :mod:`math` and :mod:`cmath` " "modules. (Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for " "details.)" msgstr "" +":mod:`math` と :mod:`cmath` モジュールに定数 tau (*τ*) が追加されました。\n" +"(Contributed by Lisa Roach in :issue:`12345`, see :pep:`628` for details.)" #: ../../whatsnew/3.6.rst:1260 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.6.rst:1262 msgid "" -":ref:`Proxy Objects ` returned by :func:" -"`multiprocessing.Manager` can now be nested. (Contributed by Davin Potts in :" -"issue:`6766`.)" +":ref:`Proxy Objects ` returned " +"by :func:`multiprocessing.Manager` can now be nested. (Contributed by Davin " +"Potts in :issue:`6766`.)" msgstr "" +":func:`multiprocessing.Manager` が返す :ref:`プロキシオブジェクト " +"` を入れ子にできるようになりました。\n" +"(Contributed by Davin Potts in :issue:`6766`.)" #: ../../whatsnew/3.6.rst:1268 ../../whatsnew/3.6.rst:2021 msgid "os" msgstr "os" -#: ../../whatsnew/3.6.rst:1270 msgid "" "See the summary of :ref:`PEP 519 ` for details on how " "the :mod:`os` and :mod:`os.path` modules now support :term:`path-like " "objects `." msgstr "" +":mod:`os` と :mod:`os.path` モジュールの :term:`パス類オブジェクト ` 対応については、:ref:`PEP 519 の概要 ` を参" +"照してください。" -#: ../../whatsnew/3.6.rst:1274 msgid ":func:`~os.scandir` now supports :class:`bytes` paths on Windows." msgstr "" +"Windows でも :func:`~os.scandir` が :class:`bytes` のパスに対応しました。" #: ../../whatsnew/3.6.rst:1276 msgid "" -"A new :meth:`~os.scandir.close` method allows explicitly closing a :func:" -"`~os.scandir` iterator. The :func:`~os.scandir` iterator now supports the :" -"term:`context manager` protocol. If a :func:`scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor. (Contributed by Serhiy Storchaka in :issue:`25994`.)" +"A new :meth:`~os.scandir.close` method allows explicitly closing " +"a :func:`~os.scandir` iterator. The :func:`~os.scandir` iterator now " +"supports the :term:`context manager` protocol. If a :func:`scandir` " +"iterator is neither exhausted nor explicitly closed a :exc:`ResourceWarning` " +"will be emitted in its destructor. (Contributed by Serhiy Storchaka " +"in :issue:`25994`.)" msgstr "" -#: ../../whatsnew/3.6.rst:1286 msgid "" "The Linux ``getrandom()`` syscall (get random bytes) is now exposed as the " "new :func:`os.getrandom` function. (Contributed by Victor Stinner, part of " "the :pep:`524`)" msgstr "" +"Linux の ``getrandom()`` システムコール (ランダムなバイト列の取得) が、新し" +"い :func:`os.getrandom` 関数として公開されました。\n" +"(Contributed by Victor Stinner, part of the :pep:`524`)" #: ../../whatsnew/3.6.rst:1292 msgid "pathlib" @@ -1952,123 +2361,157 @@ msgstr "" msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.6.rst:1310 msgid "" "Objects that need ``__new__`` called with keyword arguments can now be " "pickled using :ref:`pickle protocols ` older than protocol " "version 4. Protocol version 4 already supports this case. (Contributed by " "Serhiy Storchaka in :issue:`24164`.)" msgstr "" +"``__new__`` をキーワード引数付きで呼ぶ必要があるオブジェクトを、バージョン 4 " +"より古い :ref:`pickle プロトコル ` でも pickle 化できるよう" +"になりました。\n" +"プロトコルのバージョン 4 は、この場合にすでに対応しています。\n" +"(Contributed by Serhiy Storchaka in :issue:`24164`.)" #: ../../whatsnew/3.6.rst:1317 msgid "pickletools" msgstr "pickletools" -#: ../../whatsnew/3.6.rst:1319 msgid "" ":func:`pickletools.dis` now outputs the implicit memo index for the " "``MEMOIZE`` opcode. (Contributed by Serhiy Storchaka in :issue:`25382`.)" msgstr "" +":func:`pickletools.dis` が ``MEMOIZE`` オペコードの暗黙のメモインデックスを出" +"力するようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25382`.)" #: ../../whatsnew/3.6.rst:1325 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.6.rst:1327 msgid "" "The :mod:`pydoc` module has learned to respect the ``MANPAGER`` environment " "variable. (Contributed by Matthias Klose in :issue:`8637`.)" msgstr "" +":mod:`pydoc` モジュールが環境変数 ``MANPAGER`` を参照するようになりました。\n" +"(Contributed by Matthias Klose in :issue:`8637`.)" -#: ../../whatsnew/3.6.rst:1331 msgid "" ":func:`help` and :mod:`pydoc` can now list named tuple fields in the order " "they were defined rather than alphabetically. (Contributed by Raymond " "Hettinger in :issue:`24879`.)" msgstr "" +":func:`help` と :mod:`pydoc` が、名前付きタプルのフィールドをアルファベット順" +"ではなく定義順に表示できるようになりました。\n" +"(Contributed by Raymond Hettinger in :issue:`24879`.)" #: ../../whatsnew/3.6.rst:1337 msgid "random" msgstr "random" -#: ../../whatsnew/3.6.rst:1339 msgid "" "The new :func:`~random.choices` function returns a list of elements of " "specified size from the given population with optional weights. (Contributed " "by Raymond Hettinger in :issue:`18844`.)" msgstr "" +"新しい :func:`~random.choices` 関数は、指定された母集団から指定サイズの要素の" +"リストを返します。\n" +"重みも指定できます。\n" +"(Contributed by Raymond Hettinger in :issue:`18844`.)" #: ../../whatsnew/3.6.rst:1345 ../../whatsnew/3.6.rst:2029 msgid "re" msgstr "re" -#: ../../whatsnew/3.6.rst:1347 msgid "" -"Added support of modifier spans in regular expressions. Examples: ``'(?i:" -"p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; ``'(?" -"i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " +"Added support of modifier spans in regular expressions. Examples: ``'(?" +"i:p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; " +"``'(?i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " "(Contributed by Serhiy Storchaka in :issue:`433028`.)" msgstr "" +"正規表現の一部分に修飾子を適用できるようになりました。\n" +"例えば ``'(?i:p)ython'`` は ``'python'`` と ``'Python'`` にマッチしますが、" +"``'PYTHON'`` にはマッチしません。\n" +"``'(?i)g(?-i:v)r'`` は ``'GvR'`` と ``'gvr'`` にマッチしますが、``'GVR'`` に" +"はマッチしません。\n" +"(Contributed by Serhiy Storchaka in :issue:`433028`.)" -#: ../../whatsnew/3.6.rst:1352 msgid "" "Match object groups can be accessed by ``__getitem__``, which is equivalent " -"to ``group()``. So ``mo['name']`` is now equivalent to ``mo." -"group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" +"to ``group()``. So ``mo['name']`` is now equivalent to " +"``mo.group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" msgstr "" +"マッチオブジェクトのグループに、``group()`` と同等の ``__getitem__`` でアクセ" +"スできるようになりました。\n" +"つまり ``mo['name']`` は ``mo.group('name')`` と同じになります。\n" +"(Contributed by Eric Smith in :issue:`24454`.)" -#: ../../whatsnew/3.6.rst:1356 msgid "" -":class:`~re.Match` objects now support :meth:`index-like objects ` as group indices. (Contributed by Jeroen Demeyer and Xiang Zhang " -"in :issue:`27177`.)" +":class:`~re.Match` objects now support :meth:`index-like objects " +"` as group indices. (Contributed by Jeroen Demeyer and " +"Xiang Zhang in :issue:`27177`.)" msgstr "" +":class:`~re.Match` オブジェクトが、グループのインデックスに :meth:`インデック" +"スとして使えるオブジェクト ` を受け付けるようになりまし" +"た。\n" +"(Contributed by Jeroen Demeyer and Xiang Zhang in :issue:`27177`.)" #: ../../whatsnew/3.6.rst:1363 msgid "readline" msgstr "readline" -#: ../../whatsnew/3.6.rst:1365 msgid "" "Added :func:`~readline.set_auto_history` to enable or disable automatic " -"addition of input to the history list. (Contributed by Tyler Crompton in :" -"issue:`26870`.)" +"addition of input to the history list. (Contributed by Tyler Crompton " +"in :issue:`26870`.)" msgstr "" +":func:`~readline.set_auto_history` が追加され、入力を履歴リストに自動追加する" +"かどうかを切り替えられます。\n" +"(Contributed by Tyler Crompton in :issue:`26870`.)" #: ../../whatsnew/3.6.rst:1371 msgid "rlcompleter" msgstr "rlcompleter" -#: ../../whatsnew/3.6.rst:1373 msgid "" "Private and special attribute names now are omitted unless the prefix starts " "with underscores. A space or a colon is added after some completed " -"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` and :issue:" -"`25209`.)" +"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` " +"and :issue:`25209`.)" msgstr "" +"接頭辞がアンダースコアで始まらない限り、非公開の属性名や特殊な属性名は省かれ" +"るようになりました。\n" +"一部のキーワードでは補完後に空白やコロンが追加されます。\n" +"(Contributed by Serhiy Storchaka in :issue:`25011` and :issue:`25209`.)" #: ../../whatsnew/3.6.rst:1379 msgid "shlex" msgstr "shlex" -#: ../../whatsnew/3.6.rst:1381 msgid "" "The :class:`~shlex.shlex` has much :ref:`improved shell compatibility " "` through the new *punctuation_chars* argument " "to control which characters are treated as punctuation. (Contributed by " "Vinay Sajip in :issue:`1521950`.)" msgstr "" +":class:`~shlex.shlex` に、どの文字を区切り文字とみなすか制御する " +"*punctuation_chars* 引数が追加され、:ref:`シェルとの互換性が大幅に改善されま" +"した `。\n" +"(Contributed by Vinay Sajip in :issue:`1521950`.)" #: ../../whatsnew/3.6.rst:1389 msgid "site" msgstr "site" -#: ../../whatsnew/3.6.rst:1391 msgid "" "When specifying paths to add to :data:`sys.path` in a ``.pth`` file, you may " "now specify file paths on top of directories (e.g. zip files). (Contributed " "by Wolfgang Langner in :issue:`26587`)." msgstr "" +"``.pth`` ファイルで :data:`sys.path` に追加するパスを指定するとき、ディレクト" +"リだけでなくファイル (例えば ZIP ファイル) のパスも指定できるようになりまし" +"た。\n" +"(Contributed by Wolfgang Langner in :issue:`26587`)" #: ../../whatsnew/3.6.rst:1397 msgid "sqlite3" @@ -2086,172 +2529,220 @@ msgstr "" msgid "socket" msgstr "socket" -#: ../../whatsnew/3.6.rst:1406 msgid "" -"The :func:`~socket.socket.ioctl` function now supports the :const:`~socket." -"SIO_LOOPBACK_FAST_PATH` control code. (Contributed by Daniel Stokes in :" -"issue:`26536`.)" +"The :func:`~socket.socket.ioctl` function now supports " +"the :const:`~socket.SIO_LOOPBACK_FAST_PATH` control code. (Contributed by " +"Daniel Stokes in :issue:`26536`.)" msgstr "" +":func:`~socket.socket.ioctl` 関数が :const:`~socket.SIO_LOOPBACK_FAST_PATH` " +"制御コードに対応しました。\n" +"(Contributed by Daniel Stokes in :issue:`26536`.)" -#: ../../whatsnew/3.6.rst:1410 msgid "" "The :meth:`~socket.socket.getsockopt` constants ``SO_DOMAIN``, " "``SO_PROTOCOL``, ``SO_PEERSEC``, and ``SO_PASSSEC`` are now supported. " "(Contributed by Christian Heimes in :issue:`26907`.)" msgstr "" +":meth:`~socket.socket.getsockopt` の定数 ``SO_DOMAIN``、``SO_PROTOCOL``、" +"``SO_PEERSEC``、``SO_PASSSEC`` に対応しました。\n" +"(Contributed by Christian Heimes in :issue:`26907`.)" -#: ../../whatsnew/3.6.rst:1414 msgid "" "The :meth:`~socket.socket.setsockopt` now supports the ``setsockopt(level, " -"optname, None, optlen: int)`` form. (Contributed by Christian Heimes in :" -"issue:`27744`.)" +"optname, None, optlen: int)`` form. (Contributed by Christian Heimes " +"in :issue:`27744`.)" msgstr "" +":meth:`~socket.socket.setsockopt` が ``setsockopt(level, optname, None, " +"optlen: int)`` という形式に対応しました。\n" +"(Contributed by Christian Heimes in :issue:`27744`.)" -#: ../../whatsnew/3.6.rst:1418 msgid "" "The socket module now supports the address family :const:`~socket.AF_ALG` to " -"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` and :meth:" -"`~socket.socket.sendmsg_afalg` were added. (Contributed by Christian Heimes " -"in :issue:`27744` with support from Victor Stinner.)" +"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` " +"and :meth:`~socket.socket.sendmsg_afalg` were added. (Contributed by " +"Christian Heimes in :issue:`27744` with support from Victor Stinner.)" msgstr "" +"socket モジュールがアドレスファミリー :const:`~socket.AF_ALG` に対応し、" +"Linux カーネルの暗号 API を利用できるようになりました。\n" +"``ALG_*``、``SOL_ALG``、:meth:`~socket.socket.sendmsg_afalg` が追加されまし" +"た。\n" +"(Contributed by Christian Heimes in :issue:`27744` with support from Victor " +"Stinner.)" -#: ../../whatsnew/3.6.rst:1424 msgid "" "New Linux constants ``TCP_USER_TIMEOUT`` and ``TCP_CONGESTION`` were added. " "(Contributed by Omar Sandoval, :issue:`26273`)." msgstr "" +"Linux の定数 ``TCP_USER_TIMEOUT`` と ``TCP_CONGESTION`` が追加されました。\n" +"(Contributed by Omar Sandoval, :issue:`26273`)" #: ../../whatsnew/3.6.rst:1429 msgid "socketserver" msgstr "socketserver" -#: ../../whatsnew/3.6.rst:1431 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now support the :term:`context manager` protocol. (Contributed by Aviv " -"Palivoda in :issue:`26404`.)" +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now support the :term:`context manager` " +"protocol. (Contributed by Aviv Palivoda in :issue:`26404`.)" msgstr "" +":mod:`socketserver` モジュールに基づくサーバーが :term:`context manager` プロ" +"トコルに対応しました。\n" +":mod:`http.server`、:mod:`xmlrpc.server`、:mod:`wsgiref.simple_server` で定義" +"されるものも含まれます。\n" +"(Contributed by Aviv Palivoda in :issue:`26404`.)" #: ../../whatsnew/3.6.rst:1437 msgid "" -"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute of :class:" -"`~socketserver.StreamRequestHandler` classes now implements the :class:`io." -"BufferedIOBase` writable interface. In particular, calling :meth:`~io." -"BufferedIOBase.write` is now guaranteed to send the data in full. " -"(Contributed by Martin Panter in :issue:`26721`.)" +"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute " +"of :class:`~socketserver.StreamRequestHandler` classes now implements " +"the :class:`io.BufferedIOBase` writable interface. In particular, " +"calling :meth:`~io.BufferedIOBase.write` is now guaranteed to send the data " +"in full. (Contributed by Martin Panter in :issue:`26721`.)" msgstr "" #: ../../whatsnew/3.6.rst:1445 ../../whatsnew/3.6.rst:2037 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.6.rst:1447 msgid "" ":mod:`ssl` supports OpenSSL 1.1.0. The minimum recommend version is 1.0.2. " "(Contributed by Christian Heimes in :issue:`26470`.)" msgstr "" +":mod:`ssl` が OpenSSL 1.1.0 に対応しました。\n" +"推奨される最小バージョンは 1.0.2 です。\n" +"(Contributed by Christian Heimes in :issue:`26470`.)" -#: ../../whatsnew/3.6.rst:1450 msgid "" "3DES has been removed from the default cipher suites and ChaCha20 Poly1305 " -"cipher suites have been added. (Contributed by Christian Heimes in :issue:" -"`27850` and :issue:`27766`.)" +"cipher suites have been added. (Contributed by Christian Heimes " +"in :issue:`27850` and :issue:`27766`.)" msgstr "" +"デフォルトの暗号スイートから 3DES が削除され、ChaCha20 Poly1305 暗号スイート" +"が追加されました。\n" +"(Contributed by Christian Heimes in :issue:`27850` and :issue:`27766`.)" -#: ../../whatsnew/3.6.rst:1454 msgid "" ":class:`~ssl.SSLContext` has better default configuration for options and " "ciphers. (Contributed by Christian Heimes in :issue:`28043`.)" msgstr "" +":class:`~ssl.SSLContext` のオプションと暗号方式のデフォルト設定が改善されまし" +"た。\n" +"(Contributed by Christian Heimes in :issue:`28043`.)" -#: ../../whatsnew/3.6.rst:1458 msgid "" "SSL session can be copied from one client-side connection to another with " "the new :class:`~ssl.SSLSession` class. TLS session resumption can speed up " "the initial handshake, reduce latency and improve performance (Contributed " "by Christian Heimes in :issue:`19500` based on a draft by Alex Warhawk.)" msgstr "" +"新しい :class:`~ssl.SSLSession` クラスを使って、SSL セッションをクライアント" +"側の接続から別の接続へコピーできるようになりました。\n" +"TLS セッションの再開によって、最初のハンドシェイクを高速化し、待ち時間を減ら" +"して性能を改善できます。\n" +"(Contributed by Christian Heimes in :issue:`19500` based on a draft by Alex " +"Warhawk.)" -#: ../../whatsnew/3.6.rst:1464 msgid "" "The new :meth:`~ssl.SSLContext.get_ciphers` method can be used to get a list " "of enabled ciphers in order of cipher priority." msgstr "" +"新しい :meth:`~ssl.SSLContext.get_ciphers` メソッドで、有効な暗号方式のリスト" +"を優先順位順に取得できます。" #: ../../whatsnew/3.6.rst:1467 msgid "" -"All constants and flags have been converted to :class:`~enum.IntEnum` and :" -"class:`~enum.IntFlags`. (Contributed by Christian Heimes in :issue:`28025`.)" +"All constants and flags have been converted to :class:`~enum.IntEnum` " +"and :class:`~enum.IntFlags`. (Contributed by Christian Heimes " +"in :issue:`28025`.)" msgstr "" -#: ../../whatsnew/3.6.rst:1471 msgid "" "Server and client-side specific TLS protocols for :class:`~ssl.SSLContext` " "were added. (Contributed by Christian Heimes in :issue:`28085`.)" msgstr "" +":class:`~ssl.SSLContext` にサーバー側専用とクライアント側専用の TLS プロトコ" +"ルが追加されました。\n" +"(Contributed by Christian Heimes in :issue:`28085`.)" -#: ../../whatsnew/3.6.rst:1475 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" +"TLS 1.3 のハンドシェイク後認証を有効にす" +"る :attr:`ssl.SSLContext.post_handshake_auth` と、それを開始す" +"る :meth:`ssl.SSLSocket.verify_client_post_handshake` が追加されました。\n" +"(Contributed by Christian Heimes in :gh:`78851`.)" #: ../../whatsnew/3.6.rst:1481 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.6.rst:1483 msgid "" "A new :func:`~statistics.harmonic_mean` function has been added. " "(Contributed by Steven D'Aprano in :issue:`27181`.)" msgstr "" +":func:`~statistics.harmonic_mean` 関数が追加されました。\n" +"(Contributed by Steven D'Aprano in :issue:`27181`.)" #: ../../whatsnew/3.6.rst:1488 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.6.rst:1490 msgid "" ":mod:`struct` now supports IEEE 754 half-precision floats via the ``'e'`` " -"format specifier. (Contributed by Eli Stevens, Mark Dickinson in :issue:" -"`11734`.)" +"format specifier. (Contributed by Eli Stevens, Mark Dickinson " +"in :issue:`11734`.)" msgstr "" +":mod:`struct` が書式指定子 ``'e'`` を通じて IEEE 754 の半精度浮動小数点数に対" +"応しました。\n" +"(Contributed by Eli Stevens, Mark Dickinson in :issue:`11734`.)" #: ../../whatsnew/3.6.rst:1496 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.6.rst:1498 msgid "" ":class:`subprocess.Popen` destructor now emits a :exc:`ResourceWarning` " "warning if the child process is still running. Use the context manager " -"protocol (``with proc: ...``) or explicitly call the :meth:`~subprocess." -"Popen.wait` method to read the exit status of the child process. " +"protocol (``with proc: ...``) or explicitly call " +"the :meth:`~subprocess.Popen.wait` method to read the exit status of the " +"child process. (Contributed by Victor Stinner in :issue:`26741`.)" +msgstr "" +":class:`subprocess.Popen` のデストラクタは、子プロセスがまだ実行中であれ" +"ば :exc:`ResourceWarning` を出すようになりました。\n" +"コンテキスト管理プロトコル (``with proc: ...``) を使う" +"か、:meth:`~subprocess.Popen.wait` メソッドを明示的に呼び出し、子プロセスの終" +"了状態を読み取ってください。\n" "(Contributed by Victor Stinner in :issue:`26741`.)" -msgstr "" -#: ../../whatsnew/3.6.rst:1504 msgid "" "The :class:`subprocess.Popen` constructor and all functions that pass " "arguments through to it now accept *encoding* and *errors* arguments. " "Specifying either of these will enable text mode for the *stdin*, *stdout* " "and *stderr* streams. (Contributed by Steve Dower in :issue:`6135`.)" msgstr "" +":class:`subprocess.Popen` のコンストラクタと、そこに引数を渡すすべての関数が " +"*encoding* と *errors* 引数を受け付けるようになりました。\n" +"いずれかを指定すると、*stdin*、*stdout*、*stderr* ストリームでテキストモード" +"が有効になります。\n" +"(Contributed by Steve Dower in :issue:`6135`.)" #: ../../whatsnew/3.6.rst:1511 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.6.rst:1513 msgid "" "The new :func:`~sys.getfilesystemencodeerrors` function returns the name of " "the error mode used to convert between Unicode filenames and bytes " "filenames. (Contributed by Steve Dower in :issue:`27781`.)" msgstr "" +"新しい :func:`~sys.getfilesystemencodeerrors` 関数は、Unicode のファイル名と " +"bytes のファイル名の間の変換に使われるエラーモードの名前を返します。\n" +"(Contributed by Steve Dower in :issue:`27781`.)" -#: ../../whatsnew/3.6.rst:1517 msgid "" "On Windows the return value of the :func:`~sys.getwindowsversion` function " "now includes the *platform_version* field which contains the accurate major " @@ -2259,16 +2750,22 @@ msgid "" "rather than the version that is being emulated for the process (Contributed " "by Steve Dower in :issue:`27932`.)" msgstr "" +"Windows で :func:`~sys.getwindowsversion` 関数の戻り値に *platform_version* " +"フィールドが追加されました。\n" +"プロセス向けにエミュレートされるバージョンではなく、現在の OS の正確なメ" +"ジャーバージョン、マイナーバージョン、ビルド番号が含まれます。\n" +"(Contributed by Steve Dower in :issue:`27932`.)" #: ../../whatsnew/3.6.rst:1525 msgid "telnetlib" msgstr "telnetlib" -#: ../../whatsnew/3.6.rst:1527 msgid "" ":class:`!telnetlib.Telnet` is now a context manager (contributed by Stéphane " "Wirtel in :issue:`25485`)." msgstr "" +":class:`!telnetlib.Telnet` がコンテキストマネージャーになりました。\n" +"(Stéphane Wirtel による貢献、:issue:`25485`。)" #: ../../whatsnew/3.6.rst:1532 msgid "time" @@ -2276,8 +2773,8 @@ msgstr "time" #: ../../whatsnew/3.6.rst:1534 msgid "" -"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` and :attr:" -"`tm_zone` are now available on all platforms." +"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` " +"and :attr:`tm_zone` are now available on all platforms." msgstr "" ":class:`~time.struct_time` の属性 :attr:`tm_gmtoff` および :attr:`tm_zone` が" "全てのプラットフォームで利用できるようになりました。" @@ -2286,19 +2783,25 @@ msgstr "" msgid "timeit" msgstr "timeit" -#: ../../whatsnew/3.6.rst:1541 msgid "" "The new :meth:`Timer.autorange() ` convenience " "method has been added to call :meth:`Timer.timeit() ` " "repeatedly so that the total run time is greater or equal to 200 " "milliseconds. (Contributed by Steven D'Aprano in :issue:`6422`.)" msgstr "" +"便利な :meth:`Timer.autorange() ` メソッドが追加され" +"ました。\n" +"合計実行時間が 200 ミリ秒以上になるように :meth:`Timer.timeit() " +"` を繰り返し呼び出します。\n" +"(Contributed by Steven D'Aprano in :issue:`6422`.)" -#: ../../whatsnew/3.6.rst:1546 msgid "" ":mod:`timeit` now warns when there is substantial (4x) variance between best " "and worst times. (Contributed by Serhiy Storchaka in :issue:`23552`.)" msgstr "" +":mod:`timeit` は、最良と最悪の時間に大きな差 (4 倍) があると警告するようにな" +"りました。\n" +"(Contributed by Serhiy Storchaka in :issue:`23552`.)" #: ../../whatsnew/3.6.rst:1552 ../../whatsnew/3.6.rst:2054 msgid "tkinter" @@ -2306,27 +2809,28 @@ msgstr "tkinter" #: ../../whatsnew/3.6.rst:1554 msgid "" -"Added methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable." -"trace_remove` and :meth:`~tkinter.Variable.trace_info` in the :class:" -"`tkinter.Variable` class. They replace old methods :meth:`~tkinter.Variable." -"trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable." -"trace_vdelete` and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete " -"Tcl commands and might not work in future versions of Tcl. (Contributed by " -"Serhiy Storchaka in :issue:`22115`)." +"Added " +"methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable.trace_remove` " +"and :meth:`~tkinter.Variable.trace_info` in the :class:`tkinter.Variable` " +"class. They replace old " +"methods :meth:`~tkinter.Variable.trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable.trace_vdelete` " +"and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete Tcl commands and " +"might not work in future versions of Tcl. (Contributed by Serhiy Storchaka " +"in :issue:`22115`)." msgstr "" #: ../../whatsnew/3.6.rst:1567 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.6.rst:1569 msgid "" "Both the traceback module and the interpreter's builtin exception display " "now abbreviate long sequences of repeated lines in tracebacks as shown in " "the following example::" msgstr "" +"traceback モジュールとインタープリタの組み込みの例外表示は、トレースバックで" +"同じ行が長く繰り返される場合、次の例のように省略するようになりました。 ::" -#: ../../whatsnew/3.6.rst:1573 msgid "" ">>> def f(): f()\n" "...\n" @@ -2339,86 +2843,114 @@ msgid "" " [Previous line repeated 995 more times]\n" "RecursionError: maximum recursion depth exceeded" msgstr "" +">>> def f(): f()\n" +"...\n" +">>> f()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 1, in f\n" +" File \"\", line 1, in f\n" +" File \"\", line 1, in f\n" +" [Previous line repeated 995 more times]\n" +"RecursionError: maximum recursion depth exceeded" -#: ../../whatsnew/3.6.rst:1584 msgid "(Contributed by Emanuel Barry in :issue:`26823`.)" -msgstr "" +msgstr "(Emanuel Barry による貢献、:issue:`26823`。)" #: ../../whatsnew/3.6.rst:1588 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.6.rst:1590 msgid "" "The :mod:`tracemalloc` module now supports tracing memory allocations in " "multiple different address spaces." msgstr "" +":mod:`tracemalloc` モジュールが、複数の異なるアドレス空間でのメモリ割り当ての" +"追跡に対応しました。" -#: ../../whatsnew/3.6.rst:1593 msgid "" "The new :class:`~tracemalloc.DomainFilter` filter class has been added to " "filter block traces by their address space (domain)." msgstr "" +"新しいフィルタークラス :class:`~tracemalloc.DomainFilter` を使うと、アドレス" +"空間 (ドメイン) によってブロックのトレースを絞り込めます。" -#: ../../whatsnew/3.6.rst:1596 msgid "(Contributed by Victor Stinner in :issue:`26588`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`26588`。)" #: ../../whatsnew/3.6.rst:1602 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.6.rst:1604 msgid "" "Since the :mod:`typing` module is :term:`provisional `, all " "changes introduced in Python 3.6 have also been backported to Python 3.5.x." msgstr "" +":mod:`typing` モジュールは :term:`暫定的 ` なため、Python " +"3.6 で導入されたすべての変更は Python 3.5.x にもバックポートされました。" -#: ../../whatsnew/3.6.rst:1608 msgid "" "The :mod:`typing` module has a much improved support for generic type " "aliases. For example ``Dict[str, Tuple[S, T]]`` is now a valid type " -"annotation. (Contributed by Guido van Rossum in `Github #195 `_.)" +"annotation. (Contributed by Guido van Rossum in `Github #195 `_.)" msgstr "" +":mod:`typing` モジュールのジェネリック型の別名に対するサポートが大幅に改善さ" +"れました。\n" +"例えば ``Dict[str, Tuple[S, T]]`` が有効な型アノテーションになりました。\n" +"(Contributed by Guido van Rossum in `Github #195 `_.)" -#: ../../whatsnew/3.6.rst:1614 msgid "" -"The :class:`typing.ContextManager` class has been added for representing :" -"class:`contextlib.AbstractContextManager`. (Contributed by Brett Cannon in :" -"issue:`25609`.)" +"The :class:`typing.ContextManager` class has been added for " +"representing :class:`contextlib.AbstractContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" +":class:`contextlib.AbstractContextManager` を表" +"す :class:`typing.ContextManager` クラスが追加されました。\n" +"(Contributed by Brett Cannon in :issue:`25609`.)" -#: ../../whatsnew/3.6.rst:1618 msgid "" -"The :class:`typing.Collection` class has been added for representing :class:" -"`collections.abc.Collection`. (Contributed by Ivan Levkivskyi in :issue:" -"`27598`.)" +"The :class:`typing.Collection` class has been added for " +"representing :class:`collections.abc.Collection`. (Contributed by Ivan " +"Levkivskyi in :issue:`27598`.)" msgstr "" +":class:`collections.abc.Collection` を表す :class:`typing.Collection` クラス" +"が追加されました。\n" +"(Contributed by Ivan Levkivskyi in :issue:`27598`.)" -#: ../../whatsnew/3.6.rst:1622 msgid "" "The :const:`typing.ClassVar` type construct has been added to mark class " "variables. As introduced in :pep:`526`, a variable annotation wrapped in " "ClassVar indicates that a given attribute is intended to be used as a class " "variable and should not be set on instances of that class. (Contributed by " -"Ivan Levkivskyi in `Github #280 `_.)" +"Ivan Levkivskyi in `Github #280 `_.)" msgstr "" +"クラス変数を示す型構成子 :const:`typing.ClassVar` が追加されました。\n" +":pep:`526` で導入されたとおり、ClassVar で囲んだ変数アノテーションは、その属" +"性をクラス変数として使う意図を示し、クラスのインスタンスには設定すべきでない" +"ことを表します。\n" +"(Contributed by Ivan Levkivskyi in `Github #280 `_.)" -#: ../../whatsnew/3.6.rst:1629 msgid "" "A new :const:`~typing.TYPE_CHECKING` constant that is assumed to be ``True`` " "by the static type checkers, but is ``False`` at runtime. (Contributed by " -"Guido van Rossum in `Github #230 `_.)" +"Guido van Rossum in `Github #230 `_.)" msgstr "" +"静的型検査ツールでは ``True`` とみなされ、実行時には ``False`` になる定" +"数 :const:`~typing.TYPE_CHECKING` が追加されました。\n" +"(Contributed by Guido van Rossum in `Github #230 `_.)" -#: ../../whatsnew/3.6.rst:1634 msgid "" "A new :func:`~typing.NewType` helper function has been added to create " "lightweight distinct types for annotations::" msgstr "" +"アノテーション用に軽量で区別される型を作成する補助関" +"数 :func:`~typing.NewType` が追加されました。 ::" #: ../../whatsnew/3.6.rst:1637 msgid "" @@ -2432,22 +2964,27 @@ msgstr "" "UserId = NewType('UserId', int)\n" "some_id = UserId(524313)" -#: ../../whatsnew/3.6.rst:1642 msgid "" "The static type checker will treat the new type as if it were a subclass of " "the original type. (Contributed by Ivan Levkivskyi in `Github #189 `_.)" msgstr "" +"静的型検査ツールは、この新しい型を元の型のサブクラスであるかのように扱いま" +"す。\n" +"(Contributed by Ivan Levkivskyi in `Github #189 `_.)" #: ../../whatsnew/3.6.rst:1648 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.6.rst:1650 msgid "" "The :mod:`unicodedata` module now uses data from `Unicode 9.0.0 `_. (Contributed by Benjamin Peterson.)" msgstr "" +":mod:`unicodedata` モジュールが `Unicode 9.0.0 `_ のデータを使うようになりました。\n" +"(Contributed by Benjamin Peterson.)" #: ../../whatsnew/3.6.rst:1656 msgid "unittest.mock" @@ -2459,22 +2996,24 @@ msgstr ":class:`~unittest.mock.Mock` クラスは、次の改善が行われま #: ../../whatsnew/3.6.rst:1660 msgid "" -"Two new methods, :meth:`Mock.assert_called() ` and :meth:`Mock.assert_called_once() ` to check if the mock object was called. (Contributed by " -"Amit Saha in :issue:`26323`.)" +"Two new methods, :meth:`Mock.assert_called() " +"` and :meth:`Mock.assert_called_once() " +"` to check if the mock object was " +"called. (Contributed by Amit Saha in :issue:`26323`.)" msgstr "" -":meth:`Mock.assert_called() ` と :meth:" -"`Mock.assert_called_once() ` は、mock" -"オブジェクトが呼ばれたかどうかを確認します。 (Contributed by Amit Saha in :" -"issue:`26323`.)" +":meth:`Mock.assert_called() ` " +"と :meth:`Mock.assert_called_once() ` " +"は、mockオブジェクトが呼ばれたかどうかを確認します。 (Contributed by Amit " +"Saha in :issue:`26323`.)" -#: ../../whatsnew/3.6.rst:1666 msgid "" "The :meth:`Mock.reset_mock() ` method now has " "two optional keyword only arguments: *return_value* and *side_effect*. " "(Contributed by Kushal Das in :issue:`21271`.)" msgstr "" +":meth:`Mock.reset_mock() ` メソッドに、省略可" +"能なキーワード専用引数 *return_value* と *side_effect* が追加されました。\n" +"(Contributed by Kushal Das in :issue:`21271`.)" #: ../../whatsnew/3.6.rst:1673 msgid "urllib.request" @@ -2483,21 +3022,24 @@ msgstr "urllib.request" #: ../../whatsnew/3.6.rst:1675 msgid "" "If a HTTP request has a file or iterable body (other than a bytes object) " -"but no ``Content-Length`` header, rather than throwing an error, :class:" -"`~urllib.request.AbstractHTTPHandler` now falls back to use chunked transfer " -"encoding. (Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)" +"but no ``Content-Length`` header, rather than throwing an " +"error, :class:`~urllib.request.AbstractHTTPHandler` now falls back to use " +"chunked transfer encoding. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1683 msgid "urllib.robotparser" msgstr "urllib.robotparser" -#: ../../whatsnew/3.6.rst:1685 msgid "" ":class:`~urllib.robotparser.RobotFileParser` now supports the ``Crawl-" "delay`` and ``Request-rate`` extensions. (Contributed by Nikolay Bogoychev " "in :issue:`16099`.)" msgstr "" +":class:`~urllib.robotparser.RobotFileParser` が ``Crawl-delay`` と ``Request-" +"rate`` 拡張に対応しました。\n" +"(Contributed by Nikolay Bogoychev in :issue:`16099`.)" #: ../../whatsnew/3.6.rst:1691 ../../whatsnew/3.6.rst:2062 msgid "venv" @@ -2519,25 +3061,26 @@ msgstr "warnings" #: ../../whatsnew/3.6.rst:1701 msgid "" -"A new optional *source* parameter has been added to the :func:`warnings." -"warn_explicit` function: the destroyed object which emitted a :exc:" -"`ResourceWarning`. A *source* attribute has also been added to :class:" -"`warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " -"and :issue:`26567`)." +"A new optional *source* parameter has been added to " +"the :func:`warnings.warn_explicit` function: the destroyed object which " +"emitted a :exc:`ResourceWarning`. A *source* attribute has also been added " +"to :class:`warnings.WarningMessage` (contributed by Victor Stinner " +"in :issue:`26568` and :issue:`26567`)." msgstr "" -#: ../../whatsnew/3.6.rst:1707 msgid "" "When a :exc:`ResourceWarning` warning is logged, the :mod:`tracemalloc` " "module is now used to try to retrieve the traceback where the destroyed " "object was allocated." msgstr "" +":exc:`ResourceWarning` の記録時に、:mod:`tracemalloc` モジュールを使って、破" +"棄されたオブジェクトが割り当てられた場所のトレースバックの取得を試みるように" +"なりました。" #: ../../whatsnew/3.6.rst:1710 msgid "Example with the script ``example.py``::" msgstr "スクリプト ``example.py`` での例::" -#: ../../whatsnew/3.6.rst:1712 msgid "" "import warnings\n" "\n" @@ -2547,12 +3090,17 @@ msgid "" "f = func()\n" "f = None" msgstr "" +"import warnings\n" +"\n" +"def func():\n" +" return open(__file__)\n" +"\n" +"f = func()\n" +"f = None" -#: ../../whatsnew/3.6.rst:1720 msgid "Output of the command ``python3.6 -Wd -X tracemalloc=5 example.py``::" -msgstr "" +msgstr "``python3.6 -Wd -X tracemalloc=5 example.py`` コマンドの出力です。 ::" -#: ../../whatsnew/3.6.rst:1722 msgid "" "example.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper " "name='example.py' mode='r' encoding='UTF-8'>\n" @@ -2563,51 +3111,65 @@ msgid "" " File \"example.py\", lineno 6\n" " f = func()" msgstr "" +"example.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper " +"name='example.py' mode='r' encoding='UTF-8'>\n" +" f = None\n" +"Object allocated at (most recent call first):\n" +" File \"example.py\", lineno 4\n" +" return open(__file__)\n" +" File \"example.py\", lineno 6\n" +" f = func()" -#: ../../whatsnew/3.6.rst:1730 msgid "" -"The \"Object allocated at\" traceback is new and is only displayed if :mod:" -"`tracemalloc` is tracing Python memory allocations and if the :mod:" -"`warnings` module was already imported." +"The \"Object allocated at\" traceback is new and is only displayed " +"if :mod:`tracemalloc` is tracing Python memory allocations and if " +"the :mod:`warnings` module was already imported." msgstr "" +"\"Object allocated at\" のトレースバックは新しく追加されたもの" +"で、:mod:`tracemalloc` が Python のメモリ割り当てを追跡してお" +"り、:mod:`warnings` モジュールがインポート済みの場合にのみ表示されます。" #: ../../whatsnew/3.6.rst:1736 msgid "winreg" msgstr "winreg" -#: ../../whatsnew/3.6.rst:1738 msgid "" "Added the 64-bit integer type :data:`REG_QWORD `. " "(Contributed by Clement Rouault in :issue:`23026`.)" msgstr "" +"64 ビット整数型 :data:`REG_QWORD ` が追加されました。\n" +"(Contributed by Clement Rouault in :issue:`23026`.)" #: ../../whatsnew/3.6.rst:1743 msgid "winsound" msgstr "winsound" -#: ../../whatsnew/3.6.rst:1745 msgid "" -"Allowed keyword arguments to be passed to :func:`Beep `, :" -"func:`MessageBeep `, and :func:`PlaySound ` (:issue:`27982`)." +"Allowed keyword arguments to be passed to :func:`Beep " +"`, :func:`MessageBeep `, " +"and :func:`PlaySound ` (:issue:`27982`)." msgstr "" +":func:`Beep `、:func:`MessageBeep " +"`、:func:`PlaySound ` にキーワード" +"引数を渡せるようになりました (:issue:`27982`)。" #: ../../whatsnew/3.6.rst:1751 msgid "xmlrpc.client" msgstr "xmlrpc.client" -#: ../../whatsnew/3.6.rst:1753 msgid "" "The :mod:`xmlrpc.client` module now supports unmarshalling additional data " "types used by the Apache XML-RPC implementation for numerics and ``None``. " "(Contributed by Serhiy Storchaka in :issue:`26885`.)" msgstr "" +":mod:`xmlrpc.client` モジュールは、Apache XML-RPC 実装が数値や ``None`` に使" +"う追加のデータ型のアンマーシャリングに対応しました。\n" +"(Contributed by Serhiy Storchaka in :issue:`26885`.)" #: ../../whatsnew/3.6.rst:1760 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.6.rst:1762 msgid "" "A new :meth:`ZipInfo.from_file() ` class method " "allows making a :class:`~zipfile.ZipInfo` instance from a filesystem file. A " @@ -2615,127 +3177,165 @@ msgid "" "check if the :class:`~zipfile.ZipInfo` instance represents a directory. " "(Contributed by Thomas Kluyver in :issue:`26039`.)" msgstr "" +"新しいクラスメソッド :meth:`ZipInfo.from_file() ` " +"を使うと、ファイルシステム上のファイルから :class:`~zipfile.ZipInfo` インスタ" +"ンスを作成できます。\n" +"新しい :meth:`ZipInfo.is_dir() ` メソッドで" +"は、:class:`~zipfile.ZipInfo` インスタンスがディレクトリを表すかどうかを確認" +"できます。\n" +"(Contributed by Thomas Kluyver in :issue:`26039`.)" -#: ../../whatsnew/3.6.rst:1768 msgid "" "The :meth:`ZipFile.open() ` method can now be used to " "write data into a ZIP file, as well as for extracting data. (Contributed by " "Thomas Kluyver in :issue:`26039`.)" msgstr "" +":meth:`ZipFile.open() ` メソッドを、ZIP ファイルからの" +"データの取り出しだけでなく、データの書き込みにも使えるようになりました。\n" +"(Contributed by Thomas Kluyver in :issue:`26039`.)" #: ../../whatsnew/3.6.rst:1774 msgid "zlib" msgstr "zlib" -#: ../../whatsnew/3.6.rst:1776 msgid "" "The :func:`~zlib.compress` and :func:`~zlib.decompress` functions now accept " "keyword arguments. (Contributed by Aviv Palivoda in :issue:`26243` and Xiang " "Zhang in :issue:`16764` respectively.)" msgstr "" +":func:`~zlib.compress` と :func:`~zlib.decompress` 関数がキーワード引数を受け" +"付けるようになりました。\n" +"(Contributed by Aviv Palivoda in :issue:`26243` and Xiang Zhang " +"in :issue:`16764` respectively.)" #: ../../whatsnew/3.6.rst:1783 msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.6.rst:1785 msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode which " "made a number of opcode optimizations possible. (Contributed by Demur Rumed " -"with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:" -"`26647` and :issue:`28050`.)" +"with input and reviews from Serhiy Storchaka and Victor Stinner " +"in :issue:`26647` and :issue:`28050`.)" msgstr "" +"Python インタープリタがバイトコードの代わりに 16 ビットのワードコードを使うよ" +"うになり、オペコードのさまざまな最適化が可能になりました。\n" +"(Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and " +"Victor Stinner in :issue:`26647` and :issue:`28050`.)" -#: ../../whatsnew/3.6.rst:1790 msgid "" "The :class:`asyncio.Future` class now has an optimized C implementation. " "(Contributed by Yury Selivanov and INADA Naoki in :issue:`26081`.)" msgstr "" +":class:`asyncio.Future` クラスに最適化された C 実装が追加されました。\n" +"(Contributed by Yury Selivanov and INADA Naoki in :issue:`26081`.)" -#: ../../whatsnew/3.6.rst:1793 msgid "" "The :class:`asyncio.Task` class now has an optimized C implementation. " "(Contributed by Yury Selivanov in :issue:`28544`.)" msgstr "" +":class:`asyncio.Task` クラスに最適化された C 実装が追加されました。\n" +"(Contributed by Yury Selivanov in :issue:`28544`.)" -#: ../../whatsnew/3.6.rst:1796 msgid "" "Various implementation improvements in the :mod:`typing` module (such as " "caching of generic types) allow up to 30 times performance improvements and " "reduced memory footprint." msgstr "" +":mod:`typing` モジュールの実装がさまざまな点で改善され (ジェネリック型の" +"キャッシュなど)、最大 30 倍の性能向上とメモリ使用量の削減を実現しました。" -#: ../../whatsnew/3.6.rst:1800 msgid "" "The ASCII decoder is now up to 60 times as fast for error handlers " "``surrogateescape``, ``ignore`` and ``replace`` (Contributed by Victor " "Stinner in :issue:`24870`)." msgstr "" +"ASCII デコーダーは、エラーハンドラーが ``surrogateescape``、``ignore``、" +"``replace`` の場合に最大 60 倍高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`24870`)" -#: ../../whatsnew/3.6.rst:1804 msgid "" "The ASCII and the Latin1 encoders are now up to 3 times as fast for the " -"error handler ``surrogateescape`` (Contributed by Victor Stinner in :issue:" -"`25227`)." +"error handler ``surrogateescape`` (Contributed by Victor Stinner " +"in :issue:`25227`)." msgstr "" +"ASCII と Latin1 のエンコーダーは、エラーハンドラーが ``surrogateescape`` の場" +"合に最大 3 倍高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`25227`)" -#: ../../whatsnew/3.6.rst:1808 msgid "" "The UTF-8 encoder is now up to 75 times as fast for error handlers " "``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass`` (Contributed " "by Victor Stinner in :issue:`25267`)." msgstr "" +"UTF-8 エンコーダーは、エラーハンドラーが ``ignore``、``replace``、" +"``surrogateescape``、``surrogatepass`` の場合に最大 75 倍高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`25267`)" -#: ../../whatsnew/3.6.rst:1812 msgid "" "The UTF-8 decoder is now up to 15 times as fast for error handlers " "``ignore``, ``replace`` and ``surrogateescape`` (Contributed by Victor " "Stinner in :issue:`25301`)." msgstr "" +"UTF-8 デコーダーは、エラーハンドラーが ``ignore``、``replace``、" +"``surrogateescape`` の場合に最大 15 倍高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`25301`)" -#: ../../whatsnew/3.6.rst:1816 msgid "" "``bytes % args`` is now up to 2 times faster. (Contributed by Victor Stinner " "in :issue:`25349`)." msgstr "" +"``bytes % args`` が最大 2 倍高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`25349`)" -#: ../../whatsnew/3.6.rst:1819 msgid "" "``bytearray % args`` is now between 2.5 and 5 times faster. (Contributed by " "Victor Stinner in :issue:`25399`)." msgstr "" +"``bytearray % args`` が 2.5〜5 倍高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`25399`)" -#: ../../whatsnew/3.6.rst:1822 msgid "" "Optimize :meth:`bytes.fromhex` and :meth:`bytearray.fromhex`: they are now " -"between 2x and 3.5x faster. (Contributed by Victor Stinner in :issue:" -"`25401`)." +"between 2x and 3.5x faster. (Contributed by Victor Stinner " +"in :issue:`25401`)." msgstr "" +":meth:`bytes.fromhex` と :meth:`bytearray.fromhex` が最適化され、2〜3.5 倍高" +"速になりました。\n" +"(Contributed by Victor Stinner in :issue:`25401`)" -#: ../../whatsnew/3.6.rst:1825 msgid "" "Optimize ``bytes.replace(b'', b'.')`` and ``bytearray.replace(b'', b'.')``: " "up to 80% faster. (Contributed by Josh Snider in :issue:`26574`)." msgstr "" +"``bytes.replace(b'', b'.')`` と ``bytearray.replace(b'', b'.')`` が最適化さ" +"れ、最大 80% 高速になりました。\n" +"(Contributed by Josh Snider in :issue:`26574`)" -#: ../../whatsnew/3.6.rst:1828 msgid "" -"Allocator functions of the :c:func:`PyMem_Malloc` domain (:c:macro:" -"`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator ` " -"instead of :c:func:`malloc` function of the C library. The pymalloc " -"allocator is optimized for objects smaller or equal to 512 bytes with a " -"short lifetime, and use :c:func:`malloc` for larger memory blocks. " +"Allocator functions of the :c:func:`PyMem_Malloc` domain " +"(:c:macro:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator " +"` instead of :c:func:`malloc` function of the C library. The " +"pymalloc allocator is optimized for objects smaller or equal to 512 bytes " +"with a short lifetime, and use :c:func:`malloc` for larger memory blocks. " "(Contributed by Victor Stinner in :issue:`26249`)." msgstr "" +":c:func:`PyMem_Malloc` ドメイン (:c:macro:`PYMEM_DOMAIN_MEM`) のアロケータ関" +"数が、C ライブラリの :c:func:`malloc` 関数の代わりに :ref:`pymalloc メモリア" +"ロケータ ` を使うようになりました。\n" +"pymalloc は寿命の短い 512 バイト以下のオブジェクト向けに最適化され、より大き" +"なメモリブロックには :c:func:`malloc` を使います。\n" +"(Contributed by Victor Stinner in :issue:`26249`)" -#: ../../whatsnew/3.6.rst:1835 msgid "" ":func:`pickle.load` and :func:`pickle.loads` are now up to 10% faster when " -"deserializing many small objects (Contributed by Victor Stinner in :issue:" -"`27056`)." +"deserializing many small objects (Contributed by Victor Stinner " +"in :issue:`27056`)." msgstr "" +":func:`pickle.load` と :func:`pickle.loads` が、多数の小さなオブジェクトのデ" +"シリアライズで最大 10% 高速になりました。\n" +"(Contributed by Victor Stinner in :issue:`27056`)" -#: ../../whatsnew/3.6.rst:1839 msgid "" "Passing :term:`keyword arguments ` to a function has an " "overhead in comparison with passing :term:`positional arguments ` の受け渡しには、:term:`位" +"置引数 ` に比べてオーバーヘッドがあります。\n" +"Argument Clinic を使って実装された拡張関数では、このオーバーヘッドが大幅に減" +"りました。\n" +"(Contributed by Serhiy Storchaka in :issue:`27574`)" -#: ../../whatsnew/3.6.rst:1845 msgid "" -"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in the :mod:" -"`glob` module; they are now about 3--6 times faster. (Contributed by Serhiy " -"Storchaka in :issue:`25596`)." +"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in " +"the :mod:`glob` module; they are now about 3--6 times faster. (Contributed " +"by Serhiy Storchaka in :issue:`25596`)." msgstr "" +":mod:`glob` モジュールの :func:`~glob.glob` と :func:`~glob.iglob` 関数が最適" +"化され、約 3〜6 倍高速になりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25596`)" -#: ../../whatsnew/3.6.rst:1849 msgid "" "Optimized globbing in :mod:`pathlib` by using :func:`os.scandir`; it is now " -"about 1.5--4 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`26032`)." +"about 1.5--4 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`26032`)." msgstr "" +":mod:`pathlib` の glob 処理が :func:`os.scandir` によって最適化され、約 1.5〜" +"4 倍高速になりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`26032`)" -#: ../../whatsnew/3.6.rst:1853 msgid "" ":class:`xml.etree.ElementTree` parsing, iteration and deepcopy performance " -"has been significantly improved. (Contributed by Serhiy Storchaka in :issue:" -"`25638`, :issue:`25873`, and :issue:`25869`.)" +"has been significantly improved. (Contributed by Serhiy Storchaka " +"in :issue:`25638`, :issue:`25873`, and :issue:`25869`.)" msgstr "" +":class:`xml.etree.ElementTree` の解析、反復処理、深いコピーの性能が大幅に改善" +"されました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25638`, :issue:`25873`, " +"and :issue:`25869`.)" -#: ../../whatsnew/3.6.rst:1858 msgid "" "Creation of :class:`fractions.Fraction` instances from floats and decimals " -"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`25971`.)" +"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`25971`.)" msgstr "" +"float や Decimal からの :class:`fractions.Fraction` インスタンスの作成が 2〜" +"3 倍高速になりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25971`.)" #: ../../whatsnew/3.6.rst:1864 msgid "Build and C API Changes" msgstr "ビルドならびに C API の変更" -#: ../../whatsnew/3.6.rst:1866 msgid "" "Python now requires some C99 support in the toolchain to build. Most " "notably, Python now uses standard integer types and macros in place of " -"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` and :" -"issue:`17884`." +"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` " +"and :issue:`17884`." msgstr "" +"Python のビルドには、ツールチェーンが C99 の一部をサポートする必要がありま" +"す。\n" +"特に ``PY_LONG_LONG`` などの独自マクロに代わり、標準の整数型とマクロを使うよ" +"うになりました。\n" +"詳しくは :pep:`7` と :issue:`17884` を参照してください。" -#: ../../whatsnew/3.6.rst:1871 msgid "" "Cross-compiling CPython with the Android NDK and the Android API level set " "to 21 (Android 5.0 Lollipop) or greater runs successfully. While Android is " "not yet a supported platform, the Python test suite runs on the Android " -"emulator with only about 16 tests failures. See the Android meta-issue :" -"issue:`26865`." +"emulator with only about 16 tests failures. See the Android meta-" +"issue :issue:`26865`." msgstr "" +"Android NDK を使い、Android API レベルを 21 (Android 5.0 Lollipop) 以降に設定" +"した CPython のクロスコンパイルが成功するようになりました。\n" +"Android はまだサポート対象のプラットフォームではありませんが、Python のテスト" +"スイートを Android エミュレーターで実行すると、失敗するのは約 16 テストだけで" +"す。\n" +"Android の関連課題をまとめた :issue:`26865` を参照してください。" -#: ../../whatsnew/3.6.rst:1876 msgid "" "The ``--enable-optimizations`` configure flag has been added. Turning it on " "will activate expensive optimizations like PGO. (Original patch by " "Alecsandru Patrascu of Intel in :issue:`26359`.)" msgstr "" +"configure フラグ ``--enable-optimizations`` が追加されました。\n" +"有効にすると PGO などのコストが高い最適化が有効になります。\n" +"(Intel の Alecsandru Patrascu による元のパッチ、:issue:`26359`。)" -#: ../../whatsnew/3.6.rst:1880 msgid "" "The :term:`GIL ` must now be held 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:`GIL ` を保持する必" +"要があります。" -#: ../../whatsnew/3.6.rst:1884 msgid "" "New :c:func:`Py_FinalizeEx` API which indicates if flushing buffered data " "failed. (Contributed by Martin Panter in :issue:`5319`.)" msgstr "" +"バッファリングされたデータのフラッシュが失敗したかどうかを示" +"す :c:func:`Py_FinalizeEx` API が追加されました。\n" +"(Contributed by Martin Panter in :issue:`5319`.)" -#: ../../whatsnew/3.6.rst:1888 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports :ref:`positional-only " "parameters `. Positional-only parameters are " "defined by empty names. (Contributed by Serhiy Storchaka in :issue:`26282`)." msgstr "" +":c:func:`PyArg_ParseTupleAndKeywords` が :ref:`位置専用パラメータ " +"` に対応しました。\n" +"位置専用パラメータは空の名前で定義します。\n" +"(Contributed by Serhiy Storchaka in :issue:`26282`)" -#: ../../whatsnew/3.6.rst:1893 msgid "" "``PyTraceback_Print`` method now abbreviates long sequences of repeated " "lines as ``\"[Previous line repeated {count} more times]\"``. (Contributed " "by Emanuel Barry in :issue:`26823`.)" msgstr "" +"``PyTraceback_Print`` メソッドは、同じ行が長く繰り返される場合に " +"``\"[Previous line repeated {count} more times]\"`` と省略するようになりまし" +"た。\n" +"(Contributed by Emanuel Barry in :issue:`26823`.)" -#: ../../whatsnew/3.6.rst:1897 msgid "" "The new :c:func:`PyErr_SetImportErrorSubclass` function allows for " "specifying a subclass of :exc:`ImportError` to raise. (Contributed by Eric " "Snow in :issue:`15767`.)" msgstr "" +"新しい :c:func:`PyErr_SetImportErrorSubclass` 関数で、送出す" +"る :exc:`ImportError` のサブクラスを指定できます。\n" +"(Contributed by Eric Snow in :issue:`15767`.)" -#: ../../whatsnew/3.6.rst:1901 msgid "" -"The new :c:func:`PyErr_ResourceWarning` function can be used to generate a :" -"exc:`ResourceWarning` providing the source of the resource allocation. " +"The new :c:func:`PyErr_ResourceWarning` function can be used to generate " +"a :exc:`ResourceWarning` providing the source of the resource allocation. " "(Contributed by Victor Stinner in :issue:`26567`.)" msgstr "" +"新しい :c:func:`PyErr_ResourceWarning` 関数を使うと、リソースの割り当て元を示" +"す :exc:`ResourceWarning` を発生させられます。\n" +"(Contributed by Victor Stinner in :issue:`26567`.)" -#: ../../whatsnew/3.6.rst:1905 msgid "" "The new :c:func:`PyOS_FSPath` function returns the file system " "representation of a :term:`path-like object`. (Contributed by Brett Cannon " "in :issue:`27186`.)" msgstr "" +"新しい :c:func:`PyOS_FSPath` 関数は、:term:`path-like object` のファイルシス" +"テム表現を返します。\n" +"(Contributed by Brett Cannon in :issue:`27186`.)" -#: ../../whatsnew/3.6.rst:1909 msgid "" "The :c:func:`PyUnicode_FSConverter` and :c:func:`PyUnicode_FSDecoder` " "functions will now accept :term:`path-like objects `." msgstr "" +":c:func:`PyUnicode_FSConverter` と :c:func:`PyUnicode_FSDecoder` 関数" +"が :term:`パス類オブジェクト ` を受け付けるようになりまし" +"た。" #: ../../whatsnew/3.6.rst:1914 msgid "Other Improvements" @@ -2864,15 +3508,17 @@ msgid "" "When :option:`--version` (short form: :option:`-V`) is supplied twice, " "Python prints :data:`sys.version` for detailed information." msgstr "" -":option:`--version` (短縮系: :option:`-V`) が2回与えられた場合、Python は :" -"data:`sys.version` で詳細な情報を出力します。" +":option:`--version` (短縮系: :option:`-V`) が2回与えられた場合、Python " +"は :data:`sys.version` で詳細な情報を出力します。" -#: ../../whatsnew/3.6.rst:1919 msgid "" "$ ./python -VV\n" "Python 3.6.0b4+ (3.6:223967b49e49+, Nov 21 2016, 20:55:04)\n" "[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]" msgstr "" +"$ ./python -VV\n" +"Python 3.6.0b4+ (3.6:223967b49e49+, Nov 21 2016, 20:55:04)\n" +"[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]" #: ../../whatsnew/3.6.rst:1927 msgid "Deprecated" @@ -2898,37 +3544,47 @@ msgstr "" msgid "Deprecated Python behavior" msgstr "非推奨の Python 挙動" -#: ../../whatsnew/3.6.rst:1941 msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a :exc:`DeprecationWarning`, and will trigger a :exc:`RuntimeError` " "in Python 3.7. See :ref:`whatsnew-pep-479` for details." msgstr "" +"ジェネレータ内で :exc:`StopIteration` を送出すると :exc:`DeprecationWarning` " +"が発生するようになりました。\n" +"Python 3.7 では :exc:`RuntimeError` になります。\n" +"詳しくは :ref:`whatsnew-pep-479` を参照してください。" #: ../../whatsnew/3.6.rst:1945 msgid "" "The :meth:`__aiter__` method is now expected to return an asynchronous " "iterator directly instead of returning an awaitable as previously. Doing the " "former will trigger a :exc:`DeprecationWarning`. Backward compatibility " -"will be removed in Python 3.7. (Contributed by Yury Selivanov in :issue:" -"`27243`.)" +"will be removed in Python 3.7. (Contributed by Yury Selivanov " +"in :issue:`27243`.)" msgstr "" -#: ../../whatsnew/3.6.rst:1951 msgid "" "A backslash-character pair that is not a valid escape sequence now generates " -"a :exc:`DeprecationWarning`. Although this will eventually become a :exc:" -"`SyntaxError`, that will not be for several Python releases. (Contributed by " -"Emanuel Barry in :issue:`27364`.)" +"a :exc:`DeprecationWarning`. Although this will eventually become " +"a :exc:`SyntaxError`, that will not be for several Python releases. " +"(Contributed by Emanuel Barry in :issue:`27364`.)" msgstr "" +"バックスラッシュと文字の組み合わせが有効なエスケープシーケンスでない場" +"合、:exc:`DeprecationWarning` が発生するようになりました。\n" +"最終的には :exc:`SyntaxError` になりますが、それは今後数回の Python リリース" +"の間には行われません。\n" +"(Contributed by Emanuel Barry in :issue:`27364`.)" -#: ../../whatsnew/3.6.rst:1956 msgid "" "When performing a relative import, falling back on ``__name__`` and " "``__path__`` from the calling module when ``__spec__`` or ``__package__`` " "are not defined now raises an :exc:`ImportWarning`. (Contributed by Rose " "Ames in :issue:`25791`.)" msgstr "" +"相対インポートで ``__spec__`` や ``__package__`` が定義されておらず、呼び出し" +"元モジュールの ``__name__`` と ``__path__`` に頼る場合、:exc:`ImportWarning` " +"が発生するようになりました。\n" +"(Contributed by Rose Ames in :issue:`25791`.)" #: ../../whatsnew/3.6.rst:1963 msgid "Deprecated Python modules, functions and methods" @@ -2938,21 +3594,23 @@ msgstr "非推奨の Python モジュール、関数、メソッド" msgid "asynchat" msgstr "asynchat" -#: ../../whatsnew/3.6.rst:1968 msgid "" "The :mod:`!asynchat` has been deprecated in favor of :mod:`asyncio`. " "(Contributed by Mariatta in :issue:`25002`.)" msgstr "" +":mod:`!asynchat` は :mod:`asyncio` により非推奨になりました。\n" +"(Contributed by Mariatta in :issue:`25002`.)" #: ../../whatsnew/3.6.rst:1973 msgid "asyncore" msgstr "asyncore" -#: ../../whatsnew/3.6.rst:1975 msgid "" "The :mod:`!asyncore` has been deprecated in favor of :mod:`asyncio`. " "(Contributed by Mariatta in :issue:`25002`.)" msgstr "" +":mod:`!asyncore` は :mod:`asyncio` により非推奨になりました。\n" +"(Contributed by Mariatta in :issue:`25002`.)" #: ../../whatsnew/3.6.rst:1980 msgid "dbm" @@ -2966,13 +3624,16 @@ msgid "" "in 3.8. (Contributed by Serhiy Storchaka in :issue:`21708`.)" msgstr "" -#: ../../whatsnew/3.6.rst:1992 msgid "" "The undocumented ``extra_path`` argument to the ``distutils.Distribution`` " "constructor is now considered deprecated and will raise a warning if set. " -"Support for this parameter will be removed in a future Python release. See :" -"issue:`27919` for details." +"Support for this parameter will be removed in a future Python release. " +"See :issue:`27919` for details." msgstr "" +"``distutils.Distribution`` コンストラクタの文書化されていない ``extra_path`` " +"引数が非推奨となり、設定すると警告が発生します。\n" +"将来の Python リリースでサポートを削除する予定です。\n" +"詳しくは :issue:`27919` を参照してください。" #: ../../whatsnew/3.6.rst:1999 msgid "grp" @@ -2988,36 +3649,45 @@ msgstr "" #: ../../whatsnew/3.6.rst:2009 msgid "" -"The :meth:`importlib.machinery.SourceFileLoader.load_module` and :meth:" -"`importlib.machinery.SourcelessFileLoader.load_module` methods are now " -"deprecated. They were the only remaining implementations of :meth:`importlib." -"abc.Loader.load_module` in :mod:`importlib` that had not been deprecated in " -"previous versions of Python in favour of :meth:`importlib.abc.Loader." -"exec_module`." +"The :meth:`importlib.machinery.SourceFileLoader.load_module` " +"and :meth:`importlib.machinery.SourcelessFileLoader.load_module` methods are " +"now deprecated. They were the only remaining implementations " +"of :meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not " +"been deprecated in previous versions of Python in favour " +"of :meth:`importlib.abc.Loader.exec_module`." msgstr "" -#: ../../whatsnew/3.6.rst:2016 msgid "" "The :class:`importlib.machinery.WindowsRegistryFinder` class is now " "deprecated. As of 3.6.0, it is still added to :data:`sys.meta_path` by " "default (on Windows), but this may change in future releases." msgstr "" +":class:`importlib.machinery.WindowsRegistryFinder` クラスが非推奨になりまし" +"た。\n" +"3.6.0 の時点では Windows でデフォルトで :data:`sys.meta_path` に追加されます" +"が、将来のリリースでは変わる可能性があります。" -#: ../../whatsnew/3.6.rst:2023 msgid "" "Undocumented support of general :term:`bytes-like objects ` as paths in :mod:`os` functions, :func:`compile` and similar " -"functions is now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`25791` and :issue:`26754`.)" +"functions is now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`25791` and :issue:`26754`.)" msgstr "" +":mod:`os` の関数や :func:`compile` などで、一般の :term:`バイト列類オブジェク" +"ト ` をパスとして使う、文書化されていない機能は非推奨にな" +"りました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25791` and :issue:`26754`.)" -#: ../../whatsnew/3.6.rst:2031 msgid "" "Support for inline flags ``(?letters)`` in the middle of the regular " "expression has been deprecated and will be removed in a future Python " "version. Flags at the start of a regular expression are still allowed. " "(Contributed by Serhiy Storchaka in :issue:`22493`.)" msgstr "" +"正規表現の途中にインラインフラグ ``(?letters)`` を置くことは非推奨になり、将" +"来の Python バージョンで削除されます。\n" +"正規表現の先頭にフラグを置くことは引き続き可能です。\n" +"(Contributed by Serhiy Storchaka in :issue:`22493`.)" #: ../../whatsnew/3.6.rst:2039 msgid "" @@ -3029,64 +3699,83 @@ msgstr "" "ん。将来的に :mod:`ssl` モジュールは、OpenSSLの1.0.2 もしくは1.1.0が必須にな" "ります。" -#: ../../whatsnew/3.6.rst:2043 msgid "" "SSL-related arguments like ``certfile``, ``keyfile`` and ``check_hostname`` " -"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, and :" -"mod:`smtplib` have been deprecated in favor of ``context``. (Contributed by " -"Christian Heimes in :issue:`28022`.)" +"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, " +"and :mod:`smtplib` have been deprecated in favor of ``context``. " +"(Contributed by Christian Heimes in :issue:`28022`.)" msgstr "" +":mod:`ftplib`、:mod:`http.client`、:mod:`imaplib`、:mod:`poplib`、:mod:`smtplib` " +"の ``certfile``、``keyfile``、``check_hostname`` などの SSL 関連引数が非推奨" +"になりました。\n" +"代わりに ``context`` を使ってください。\n" +"(Contributed by Christian Heimes in :issue:`28022`.)" -#: ../../whatsnew/3.6.rst:2048 msgid "" "A couple of protocols and functions of the :mod:`ssl` module are now " "deprecated. Some features will no longer be available in future versions of " "OpenSSL. Other features are deprecated in favor of a different API. " "(Contributed by Christian Heimes in :issue:`28022` and :issue:`26470`.)" msgstr "" +":mod:`ssl` モジュールの一部のプロトコルと関数が非推奨になりました。\n" +"一部の機能は将来の OpenSSL で利用できなくなります。\n" +"ほかの機能は別の API の使用が推奨されるため非推奨になりました。\n" +"(Contributed by Christian Heimes in :issue:`28022` and :issue:`26470`.)" -#: ../../whatsnew/3.6.rst:2056 msgid "" "The :mod:`!tkinter.tix` module is now deprecated. :mod:`tkinter` users " "should use :mod:`tkinter.ttk` instead." msgstr "" +":mod:`!tkinter.tix` モジュールが非推奨になりました。\n" +":mod:`tkinter` のユーザーは代わりに :mod:`tkinter.ttk` を使ってください。" -#: ../../whatsnew/3.6.rst:2064 msgid "" "The ``pyvenv`` script has been deprecated in favour of ``python3 -m venv``. " "This prevents confusion as to what Python interpreter ``pyvenv`` is " "connected to and thus what Python interpreter will be used by the virtual " "environment. (Contributed by Brett Cannon in :issue:`25154`.)" msgstr "" +"``pyvenv`` スクリプトが非推奨になり、代わりに ``python3 -m venv`` を使うこと" +"が推奨されます。\n" +"これにより、``pyvenv`` がどの Python インタープリタに対応し、仮想環境でどのイ" +"ンタープリタが使われるかという混乱を防げます。\n" +"(Contributed by Brett Cannon in :issue:`25154`.)" #: ../../whatsnew/3.6.rst:2071 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.6.rst:2073 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" +"DTD や外部実体の取得による問題を軽減するため、:mod:`xml.dom.minidom` " +"と :mod:`xml.sax` モジュールはデフォルトでは外部実体を処理しなくなりまし" +"た。\n" +"(Contributed by Christian Heimes in :gh:`61441`.)" #: ../../whatsnew/3.6.rst:2080 msgid "Deprecated functions and types of the C API" msgstr "C API の非推奨の関数ならびに型" -#: ../../whatsnew/3.6.rst:2082 msgid "" "Undocumented functions :c:func:`!PyUnicode_AsEncodedObject`, :c:func:`!" -"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` and :c:" -"func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use the :ref:`generic " -"codec based API ` instead." +"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` " +"and :c:func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use " +"the :ref:`generic codec based API ` instead." msgstr "" +"文書化されていない :c:func:`!PyUnicode_AsEncodedObject`、:c:func:`!" +"PyUnicode_AsDecodedObject`、:c:func:`!PyUnicode_AsEncodedUnicode`、:c:func:`!" +"PyUnicode_AsDecodedUnicode` 関数が非推奨になりました。\n" +"代わりに :ref:`汎用のコーデックベースの API ` を使ってくださ" +"い。" #: ../../whatsnew/3.6.rst:2089 msgid "Deprecated Build Options" msgstr "非推奨のビルドオプション" -#: ../../whatsnew/3.6.rst:2091 msgid "" "The ``--with-system-ffi`` configure flag is now on by default on non-macOS " "UNIX platforms. It may be disabled by using ``--without-system-ffi``, but " @@ -3094,6 +3783,13 @@ msgid "" "is unaffected by this change. Note that many OS distributors already use " "the ``--with-system-ffi`` flag when building their system Python." msgstr "" +"macOS 以外の UNIX プラットフォームでは、configure フラグ ``--with-system-" +"ffi`` がデフォルトで有効になりました。\n" +"``--without-system-ffi`` で無効にできますが、このフラグの使用は非推奨で、" +"Python 3.7 では使えなくなります。\n" +"macOS はこの変更の影響を受けません。\n" +"なお、多くの OS ディストリビューターはシステムの Python をビルドする際、すで" +"に ``--with-system-ffi`` を使っています。" #: ../../whatsnew/3.6.rst:2099 msgid "Removed" @@ -3103,47 +3799,58 @@ msgstr "削除" msgid "API and Feature Removals" msgstr "API と機能の削除" -#: ../../whatsnew/3.6.rst:2104 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in regular " -"expressions will now cause an error. In replacement templates for :func:`re." -"sub` they are still allowed, but deprecated. The :const:`re.LOCALE` flag can " -"now only be used with binary patterns." +"expressions will now cause an error. In replacement templates " +"for :func:`re.sub` they are still allowed, but deprecated. " +"The :const:`re.LOCALE` flag can now only be used with binary patterns." msgstr "" +"正規表現で ``'\\'`` と ASCII 文字からなる未知のエスケープを使うとエラーになり" +"ます。\n" +":func:`re.sub` の置換テンプレートではまだ使えますが、非推奨です。\n" +":const:`re.LOCALE` フラグはバイナリパターンでのみ使えるようになりました。" -#: ../../whatsnew/3.6.rst:2109 msgid "" -"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :" -"func:`inspect.getmodulename` should be used for obtaining the module name " -"for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" +"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython " +"3.3). :func:`inspect.getmodulename` should be used for obtaining the module " +"name for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" msgstr "" +"``inspect.getmoduleinfo()`` が削除されました (CPython 3.3 から非推奨でし" +"た)。\n" +"指定パスのモジュール名を取得するには :func:`inspect.getmodulename` を使ってく" +"ださい。\n" +"(Contributed by Yury Selivanov in :issue:`13248`.)" #: ../../whatsnew/3.6.rst:2114 msgid "" "``traceback.Ignore`` class and ``traceback.usage``, ``traceback.modname``, " -"``traceback.fullmodname``, ``traceback.find_lines_from_code``, ``traceback." -"find_lines``, ``traceback.find_strings``, ``traceback." -"find_executable_lines`` methods were removed from the :mod:`traceback` " -"module. They were undocumented methods deprecated since Python 3.2 and " -"equivalent functionality is available from private methods." +"``traceback.fullmodname``, ``traceback.find_lines_from_code``, " +"``traceback.find_lines``, ``traceback.find_strings``, " +"``traceback.find_executable_lines`` methods were removed from " +"the :mod:`traceback` module. They were undocumented methods deprecated since " +"Python 3.2 and equivalent functionality is available from private methods." msgstr "" -#: ../../whatsnew/3.6.rst:2121 msgid "" -"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods in :mod:" -"`tkinter` widget classes were removed (corresponding Tk commands were " -"obsolete since Tk 4.0)." +"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods " +"in :mod:`tkinter` widget classes were removed (corresponding Tk commands " +"were obsolete since Tk 4.0)." msgstr "" +":mod:`tkinter` のウィジェットクラスから ``tk_menuBar()`` と " +"``tk_bindForTraversal()`` のダミーメソッドが削除されました (対応する Tk コマ" +"ンドは Tk 4.0 から廃止されていました)。" -#: ../../whatsnew/3.6.rst:2125 msgid "" "The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile` " "class no longer supports the ``'U'`` mode (was deprecated since Python 3.4). " -"Use :class:`io.TextIOWrapper` for reading compressed text files in :term:" -"`universal newlines` mode." +"Use :class:`io.TextIOWrapper` for reading compressed text files " +"in :term:`universal newlines` mode." msgstr "" +":class:`zipfile.ZipFile` クラスの :meth:`~zipfile.ZipFile.open` メソッドが " +"``'U'`` モードをサポートしなくなりました (Python 3.4 から非推奨でした)。\n" +"圧縮されたテキストファイルを :term:`universal newlines` モードで読むに" +"は :class:`io.TextIOWrapper` を使ってください。" -#: ../../whatsnew/3.6.rst:2130 msgid "" "The undocumented ``IN``, ``CDROM``, ``DLFCN``, ``TYPES``, ``CDIO``, and " "``STROPTS`` modules have been removed. They had been available in the " @@ -3153,6 +3860,13 @@ msgid "" "distribution at `Tools/scripts/h2py.py `_." msgstr "" +"文書化されていない ``IN``、``CDROM``、``DLFCN``、``TYPES``、``CDIO``、" +"``STROPTS`` モジュールが削除されました。\n" +"これらはプラットフォーム固有の ``Lib/plat-*/`` ディレクトリにありましたが、古" +"い状態のまま保守されず、プラットフォームごとの利用可否も一貫していませんでし" +"た。\n" +"生成に使うスクリプトは引き続きソース配布物の `Tools/scripts/h2py.py `_ にあります。" #: ../../whatsnew/3.6.rst:2138 msgid "The deprecated ``asynchat.fifo`` class has been removed." @@ -3174,136 +3888,165 @@ msgstr "" msgid "Changes in 'python' Command Behavior" msgstr "'python' コマンドの挙動の変更" -#: ../../whatsnew/3.6.rst:2150 msgid "" "The output of a special Python build with defined ``COUNT_ALLOCS``, " "``SHOW_ALLOC_COUNT`` or ``SHOW_TRACK_COUNT`` macros is now off by default. " "It can be re-enabled using the ``-X showalloccount`` option. It now outputs " -"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka in :" -"issue:`23034`.)" +"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka " +"in :issue:`23034`.)" msgstr "" +"``COUNT_ALLOCS``、``SHOW_ALLOC_COUNT``、``SHOW_TRACK_COUNT`` マクロを定義した" +"特別な Python ビルドの出力が、デフォルトでは無効になりました。\n" +"``-X showalloccount`` オプションで再び有効にできます。\n" +"出力先は ``stdout`` から ``stderr`` に変わりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`23034`.)" #: ../../whatsnew/3.6.rst:2158 msgid "Changes in the Python API" msgstr "Python API の変更" -#: ../../whatsnew/3.6.rst:2160 msgid "" ":func:`open() ` will no longer allow combining the ``'U'`` mode flag " -"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor in :issue:" -"`2091`.)" +"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor " +"in :issue:`2091`.)" msgstr "" +":func:`open() ` で ``'U'`` モードフラグと ``'+'`` を組み合わせられなく" +"なりました。\n" +"(Contributed by Jeff Balogh and John O'Connor in :issue:`2091`.)" -#: ../../whatsnew/3.6.rst:2164 msgid "" ":mod:`sqlite3` no longer implicitly commits an open transaction before DDL " "statements." msgstr "" +":mod:`sqlite3` は DDL 文の前に、開いているトランザクションを暗黙にコミットし" +"なくなりました。" -#: ../../whatsnew/3.6.rst:2167 msgid "" "On Linux, :func:`os.urandom` now blocks until the system urandom entropy " "pool is initialized to increase the security." msgstr "" +"Linux ではセキュリティを高めるため、システムの urandom エントロピープールが初" +"期化されるまで :func:`os.urandom` がブロックするようになりました。" -#: ../../whatsnew/3.6.rst:2170 msgid "" -"When :meth:`importlib.abc.Loader.exec_module` is defined, :meth:`importlib." -"abc.Loader.create_module` must also be defined." +"When :meth:`importlib.abc.Loader.exec_module` is " +"defined, :meth:`importlib.abc.Loader.create_module` must also be defined." msgstr "" +":meth:`importlib.abc.Loader.exec_module` を定義する場合" +"は、:meth:`importlib.abc.Loader.create_module` も定義する必要があります。" -#: ../../whatsnew/3.6.rst:2173 msgid "" ":c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg** " "argument is not set. Previously only ``NULL`` was returned." msgstr "" +":c:func:`PyErr_SetImportError` は **msg** 引数が設定されていない場" +"合、:exc:`TypeError` を設定するようになりました。\n" +"以前は ``NULL`` を返すだけでした。" #: ../../whatsnew/3.6.rst:2176 msgid "" "The format of the :attr:`~codeobject.co_lnotab` attribute of code objects " "changed to support a negative line number delta. By default, Python does not " -"emit bytecode with a negative line number delta. Functions using :attr:" -"`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or ``PyCode_Addr2Line()`` are " -"not affected. Functions directly decoding :attr:`!co_lnotab` should be " -"updated to use a signed 8-bit integer type for the line number delta, but " -"this is only required to support applications using a negative line number " -"delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!co_lnotab` format " -"and how to decode it, and see the :pep:`511` for the rationale." +"emit bytecode with a negative line number delta. Functions " +"using :attr:`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or " +"``PyCode_Addr2Line()`` are not affected. Functions directly decoding :attr:`!" +"co_lnotab` should be updated to use a signed 8-bit integer type for the line " +"number delta, but this is only required to support applications using a " +"negative line number delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!" +"co_lnotab` format and how to decode it, and see the :pep:`511` for the " +"rationale." msgstr "" -#: ../../whatsnew/3.6.rst:2187 msgid "" "The functions in the :mod:`compileall` module now return booleans instead of " "``1`` or ``0`` to represent success or failure, respectively. Thanks to " "booleans being a subclass of integers, this should only be an issue if you " "were doing identity checks for ``1`` or ``0``. See :issue:`25768`." msgstr "" +":mod:`compileall` モジュールの関数は、成功と失敗をそれぞれ ``1`` と ``0`` で" +"はなくブール値で返すようになりました。\n" +"ブール型は整数のサブクラスなので、``1`` や ``0`` との同一性を検査していた場合" +"にのみ問題になるはずです。\n" +":issue:`25768` を参照してください。" #: ../../whatsnew/3.6.rst:2192 msgid "" -"Reading the :attr:`~urllib.parse.SplitResult.port` attribute of :func:" -"`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results now " -"raises :exc:`ValueError` for out-of-range values, rather than returning :" -"const:`None`. See :issue:`20059`." +"Reading the :attr:`~urllib.parse.SplitResult.port` attribute " +"of :func:`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results " +"now raises :exc:`ValueError` for out-of-range values, rather than " +"returning :const:`None`. See :issue:`20059`." msgstr "" -#: ../../whatsnew/3.6.rst:2197 msgid "" -"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`." +"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead " +"of :exc:`PendingDeprecationWarning`." msgstr "" +":mod:`!imp` モジュールは :exc:`PendingDeprecationWarning` の代わり" +"に :exc:`DeprecationWarning` を出すようになりました。" #: ../../whatsnew/3.6.rst:2200 msgid "" "The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`!cgi`, :mod:" -"`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" -"`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" -"`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" -"`tarfile`, :mod:`threading` and :mod:`wave`. This means they will export " -"new symbols when ``import *`` is used. (Contributed by Joel Taddei and Jacek " -"Kołodziej in :issue:`23883`.)" +"attributes to match the documented APIs: :mod:`calendar`, :mod:`!" +"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!" +"smtpd`, :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` " +"and :mod:`wave`. This means they will export new symbols when ``import *`` " +"is used. (Contributed by Joel Taddei and Jacek Kołodziej in :issue:`23883`.)" msgstr "" -#: ../../whatsnew/3.6.rst:2211 msgid "" "When performing a relative import, if ``__package__`` does not compare equal " "to ``__spec__.parent`` then :exc:`ImportWarning` is raised. (Contributed by " "Brett Cannon in :issue:`25791`.)" msgstr "" +"相対インポート時に ``__package__`` が ``__spec__.parent`` と等しくない場" +"合、:exc:`ImportWarning` が発生するようになりました。\n" +"(Contributed by Brett Cannon in :issue:`25791`.)" -#: ../../whatsnew/3.6.rst:2215 msgid "" -"When a relative import is performed and no parent package is known, then :" -"exc:`ImportError` will be raised. Previously, :exc:`SystemError` could be " -"raised. (Contributed by Brett Cannon in :issue:`18018`.)" +"When a relative import is performed and no parent package is known, " +"then :exc:`ImportError` will be raised. Previously, :exc:`SystemError` could " +"be raised. (Contributed by Brett Cannon in :issue:`18018`.)" msgstr "" +"親パッケージが分からない状態で相対インポートを行うと、:exc:`ImportError` を送" +"出するようになりました。\n" +"以前は :exc:`SystemError` を送出することがありました。\n" +"(Contributed by Brett Cannon in :issue:`18018`.)" -#: ../../whatsnew/3.6.rst:2219 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now only catch exceptions derived from :exc:`Exception`. Therefore if a " -"request handler raises an exception like :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` is no " -"longer called, and the exception will stop a single-threaded server. " +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now only catch exceptions derived " +"from :exc:`Exception`. Therefore if a request handler raises an exception " +"like :exc:`SystemExit` " +"or :exc:`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` " +"is no longer called, and the exception will stop a single-threaded server. " "(Contributed by Martin Panter in :issue:`23430`.)" msgstr "" +":mod:`http.server`、:mod:`xmlrpc.server`、:mod:`wsgiref.simple_server` を含" +"む :mod:`socketserver` ベースのサーバーは、:exc:`Exception` から派生する例外" +"だけを捕捉するようになりました。\n" +"そのためリクエストハンドラーが :exc:`SystemExit` や :exc:`KeyboardInterrupt` " +"などを送出しても :meth:`~socketserver.BaseServer.handle_error` は呼ばれず、単" +"一スレッドのサーバーは停止します。\n" +"(Contributed by Martin Panter in :issue:`23430`.)" -#: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" -"`KeyError` if the user doesn't have privileges." +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead " +"of :exc:`KeyError` if the user doesn't have privileges." msgstr "" +"ユーザーに権限がない場合、:func:`!spwd.getspnam` は :exc:`KeyError` の代わり" +"に :exc:`PermissionError` を送出するようになりました。" -#: ../../whatsnew/3.6.rst:2231 msgid "" "The :meth:`socket.socket.close` method now raises an exception if an error " "(e.g. ``EBADF``) was reported by the underlying system call. (Contributed by " "Martin Panter in :issue:`26685`.)" msgstr "" +":meth:`socket.socket.close` メソッドは、下位のシステムコールがエラー (例えば " +"``EBADF``) を報告した場合、例外を送出するようになりました。\n" +"(Contributed by Martin Panter in :issue:`26685`.)" -#: ../../whatsnew/3.6.rst:2235 msgid "" "The *decode_data* argument for the :class:`!smtpd.SMTPChannel` and :class:`!" "smtpd.SMTPServer` constructors is now ``False`` by default. This means that " @@ -3312,15 +4055,26 @@ msgid "" "that has already been updated in accordance with the deprecation warning " "generated by 3.5 will not be affected." msgstr "" - -#: ../../whatsnew/3.6.rst:2243 -msgid "" -"All optional arguments of the :func:`~json.dump`, :func:`~json.dumps`, :func:" -"`~json.load` and :func:`~json.loads` functions and :class:`~json." -"JSONEncoder` and :class:`~json.JSONDecoder` class constructors in the :mod:" -"`json` module are now :ref:`keyword-only `. " +":class:`!smtpd.SMTPChannel` と :class:`!smtpd.SMTPServer` のコンストラクタの " +"*decode_data* 引数のデフォルト値が ``False`` になりました。\n" +"つまり、:meth:`!process_message` に渡される引数はデフォルトで bytes オブジェ" +"クトになり、:meth:`!process_message` にはキーワード引数も渡されます。\n" +"3.5 の非推奨の警告に従って更新済みのコードは影響を受けません。" + +msgid "" +"All optional arguments of " +"the :func:`~json.dump`, :func:`~json.dumps`, :func:`~json.load` " +"and :func:`~json.loads` functions and :class:`~json.JSONEncoder` " +"and :class:`~json.JSONDecoder` class constructors in the :mod:`json` module " +"are now :ref:`keyword-only `. (Contributed by Serhiy " +"Storchaka in :issue:`18726`.)" +msgstr "" +":mod:`json` モジュール" +"の :func:`~json.dump`、:func:`~json.dumps`、:func:`~json.load`、:func:`~json.loads` " +"関数と、:class:`~json.JSONEncoder`、:class:`~json.JSONDecoder` クラスのコンス" +"トラクタの省略可能な引数が、すべて :ref:`キーワード専用 ` になりました。\n" "(Contributed by Serhiy Storchaka in :issue:`18726`.)" -msgstr "" #: ../../whatsnew/3.6.rst:2250 msgid "" @@ -3332,17 +4086,17 @@ msgstr "" #: ../../whatsnew/3.6.rst:2253 msgid "" -"As part of :pep:`487`, the handling of keyword arguments passed to :class:" -"`type` (other than the metaclass hint, ``metaclass``) is now consistently " -"delegated to :meth:`object.__init_subclass__`. This means that :meth:`type." -"__new__` and :meth:`type.__init__` both now accept arbitrary keyword " -"arguments, but :meth:`object.__init_subclass__` (which is called from :meth:" -"`type.__new__`) will reject them by default. Custom metaclasses accepting " -"additional keyword arguments will need to adjust their calls to :meth:`type." -"__new__` (whether direct or via :class:`super`) accordingly." +"As part of :pep:`487`, the handling of keyword arguments passed " +"to :class:`type` (other than the metaclass hint, ``metaclass``) is now " +"consistently delegated to :meth:`object.__init_subclass__`. This means " +"that :meth:`type.__new__` and :meth:`type.__init__` both now accept " +"arbitrary keyword arguments, but :meth:`object.__init_subclass__` (which is " +"called from :meth:`type.__new__`) will reject them by default. Custom " +"metaclasses accepting additional keyword arguments will need to adjust their " +"calls to :meth:`type.__new__` (whether direct or via :class:`super`) " +"accordingly." msgstr "" -#: ../../whatsnew/3.6.rst:2262 msgid "" "In ``distutils.command.sdist.sdist``, the ``default_format`` attribute has " "been removed and is no longer honored. Instead, the gzipped tarfile format " @@ -3351,12 +4105,19 @@ msgid "" "distributions are required, configure the project with a ``setup.cfg`` file " "containing the following:" msgstr "" +"``distutils.command.sdist.sdist`` の ``default_format`` 属性が削除され、参照" +"されなくなりました。\n" +"代わりにすべてのプラットフォームで gzip 圧縮された tar ファイル形式がデフォル" +"トになり、プラットフォーム固有の選択は行われません。\n" +"Windows で配布物をビルドし、ZIP 形式の配布物が必要な場合は、プロジェクトの " +"``setup.cfg`` に次の内容を設定してください:" -#: ../../whatsnew/3.6.rst:2270 msgid "" "[sdist]\n" "formats=zip" msgstr "" +"[sdist]\n" +"formats=zip" #: ../../whatsnew/3.6.rst:2275 msgid "" @@ -3366,58 +4127,75 @@ msgstr "" "この挙動は Setuptools 26.0.0 により以前の Python バージョンにバックポートされ" "ました。" -#: ../../whatsnew/3.6.rst:2278 msgid "" -"In the :mod:`urllib.request` module and the :meth:`http.client." -"HTTPConnection.request` method, if no Content-Length header field has been " -"specified and the request body is a file object, it is now sent with HTTP " -"1.1 chunked encoding. If a file object has to be sent to a HTTP 1.0 server, " -"the Content-Length value now has to be specified by the caller. (Contributed " -"by Demian Brecht and Rolf Krahl with tweaks from Martin Panter in :issue:" -"`12319`.)" +"In the :mod:`urllib.request` module and " +"the :meth:`http.client.HTTPConnection.request` method, if no Content-Length " +"header field has been specified and the request body is a file object, it is " +"now sent with HTTP 1.1 chunked encoding. If a file object has to be sent to " +"a HTTP 1.0 server, the Content-Length value now has to be specified by the " +"caller. (Contributed by Demian Brecht and Rolf Krahl with tweaks from Martin " +"Panter in :issue:`12319`.)" msgstr "" +":mod:`urllib.request` モジュール" +"と :meth:`http.client.HTTPConnection.request` メソッドでは、Content-Length " +"ヘッダーフィールドが指定されず、リクエスト本文がファイルオブジェクトの場合、" +"HTTP 1.1 のチャンクエンコーディングで送信するようになりました。\n" +"HTTP 1.0 サーバーにファイルオブジェクトを送る必要がある場合は、呼び出し側で " +"Content-Length の値を指定する必要があります。\n" +"(Contributed by Demian Brecht and Rolf Krahl with tweaks from Martin Panter " +"in :issue:`12319`.)" -#: ../../whatsnew/3.6.rst:2287 msgid "" -"The :class:`~csv.DictReader` now returns rows of type :class:`~collections." -"OrderedDict`. (Contributed by Steve Holden in :issue:`27842`.)" +"The :class:`~csv.DictReader` now returns rows of " +"type :class:`~collections.OrderedDict`. (Contributed by Steve Holden " +"in :issue:`27842`.)" msgstr "" +":class:`~csv.DictReader` は :class:`~collections.OrderedDict` 型の行を返すよ" +"うになりました。\n" +"(Contributed by Steve Holden in :issue:`27842`.)" -#: ../../whatsnew/3.6.rst:2291 msgid "" -"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." -"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" -"issue:`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to " +"``crypt.methods`` if unsupported by the platform. (Contributed by Victor " +"Stinner in :issue:`25287`.)" msgstr "" +"プラットフォームがサポートしていない場合、:const:`!crypt.METHOD_CRYPT` は " +"``crypt.methods`` に追加されなくなりました。\n" +"(Contributed by Victor Stinner in :issue:`25287`.)" -#: ../../whatsnew/3.6.rst:2299 msgid "" "On Linux, :func:`ctypes.util.find_library` now looks in ``LD_LIBRARY_PATH`` " "for shared libraries. (Contributed by Vinay Sajip in :issue:`9998`.)" msgstr "" +"Linux で :func:`ctypes.util.find_library` は、共有ライブラリを探す際に " +"``LD_LIBRARY_PATH`` も参照するようになりました。\n" +"(Contributed by Vinay Sajip in :issue:`9998`.)" -#: ../../whatsnew/3.6.rst:2303 msgid "" "The :class:`imaplib.IMAP4` class now handles flags containing the ``']'`` " "character in messages sent from the server to improve real-world " "compatibility. (Contributed by Lita Cho in :issue:`21815`.)" msgstr "" +":class:`imaplib.IMAP4` クラスは実際の利用環境との互換性を高めるため、サーバー" +"から送られるメッセージで ``']'`` 文字を含むフラグを扱うようになりました。\n" +"(Contributed by Lita Cho in :issue:`21815`.)" #: ../../whatsnew/3.6.rst:2308 msgid "" "The :func:`mmap.write() ` function now returns the number of " -"bytes written like other write methods. (Contributed by Jakub Stasiak in :" -"issue:`26335`.)" +"bytes written like other write methods. (Contributed by Jakub Stasiak " +"in :issue:`26335`.)" msgstr "" -#: ../../whatsnew/3.6.rst:2312 msgid "" "The :func:`pkgutil.iter_modules` and :func:`pkgutil.walk_packages` functions " "now return :class:`~pkgutil.ModuleInfo` named tuples. (Contributed by " "Ramchandra Apte in :issue:`17211`.)" msgstr "" +":func:`pkgutil.iter_modules` と :func:`pkgutil.walk_packages` 関数" +"は :class:`~pkgutil.ModuleInfo` 名前付きタプルを返すようになりました。\n" +"(Contributed by Ramchandra Apte in :issue:`17211`.)" -#: ../../whatsnew/3.6.rst:2316 msgid "" ":func:`re.sub` now raises an error for invalid numerical group references in " "replacement templates even if the pattern is not found in the string. The " @@ -3425,18 +4203,28 @@ msgid "" "the position of the reference. (Contributed by SilentGhost, Serhiy Storchaka " "in :issue:`25953`.)" msgstr "" +":func:`re.sub` は置換テンプレートに無効な数値のグループ参照がある場合、パター" +"ンが文字列に見つからなくてもエラーを送出するようになりました。\n" +"無効なグループ参照のエラーメッセージには、グループのインデックスと参照の位置" +"が含まれるようになりました。\n" +"(Contributed by SilentGhost, Serhiy Storchaka in :issue:`25953`.)" -#: ../../whatsnew/3.6.rst:2322 msgid "" ":class:`zipfile.ZipFile` will now raise :exc:`NotImplementedError` for " "unrecognized compression values. Previously a plain :exc:`RuntimeError` was " "raised. Additionally, calling :class:`~zipfile.ZipFile` methods on a closed " "ZipFile or calling the :meth:`~zipfile.ZipFile.write` method on a ZipFile " -"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:" -"`RuntimeError` was raised in those scenarios." +"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, " +"a :exc:`RuntimeError` was raised in those scenarios." msgstr "" +":class:`zipfile.ZipFile` は、認識できない圧縮値に対し" +"て :exc:`NotImplementedError` を送出するようになりました。\n" +"以前は単なる :exc:`RuntimeError` を送出していました。\n" +"また、閉じた ZipFile の :class:`~zipfile.ZipFile` メソッドを呼んだ場合や、" +"``'r'`` モードで作成した ZipFile の :meth:`~zipfile.ZipFile.write` を呼んだ場" +"合は、:exc:`ValueError` を送出します。\n" +"以前はこれらの場合も :exc:`RuntimeError` を送出していました。" -#: ../../whatsnew/3.6.rst:2329 msgid "" "when custom metaclasses are combined with zero-argument :func:`super` or " "direct references from methods to the implicit ``__class__`` closure " @@ -3445,25 +4233,40 @@ msgid "" "a :exc:`DeprecationWarning` in Python 3.6 and a :exc:`RuntimeError` in " "Python 3.8." msgstr "" +"独自のメタクラスを、引数なしの :func:`super` やメソッドから暗黙のクロージャー" +"変数 ``__class__`` への直接参照と組み合わせる場合、名前空間の暗黙のエント" +"リー ``__classcell__`` を ``type.__new__`` に渡して初期化する必要がありま" +"す。\n" +"渡さない場合は Python 3.6 で :exc:`DeprecationWarning`、Python 3.8 " +"で :exc:`RuntimeError` が発生します。" -#: ../../whatsnew/3.6.rst:2336 msgid "" "With the introduction of :exc:`ModuleNotFoundError`, import system consumers " "may start expecting import system replacements to raise that more specific " -"exception when appropriate, rather than the less-specific :exc:" -"`ImportError`. To provide future compatibility with such consumers, " -"implementers of alternative import systems that completely replace :func:" -"`__import__` will need to update their implementations to raise the new " -"subclass when a module can't be found at all. Implementers of compliant " -"plugins to the default import system shouldn't need to make any changes, as " -"the default import system will raise the new subclass when appropriate." -msgstr "" +"exception when appropriate, rather than the less-" +"specific :exc:`ImportError`. To provide future compatibility with such " +"consumers, implementers of alternative import systems that completely " +"replace :func:`__import__` will need to update their implementations to " +"raise the new subclass when a module can't be found at all. Implementers of " +"compliant plugins to the default import system shouldn't need to make any " +"changes, as the default import system will raise the new subclass when " +"appropriate." +msgstr "" +":exc:`ModuleNotFoundError` の導入により、インポートシステムの利用側は、代替の" +"インポートシステムにも、必要に応じて一般的な :exc:`ImportError` ではなく、こ" +"のより具体的な例外を送出することを期待するようになる可能性があります。\n" +"そのような利用側と将来も互換性を保つため、:func:`__import__` を完全に置き換え" +"るインポートシステムの実装者は、モジュールがまったく見つからないときにこの新" +"しいサブクラスを送出するよう更新する必要があります。\n" +"デフォルトのインポートシステムに準拠するプラグインの実装者は、変更の必要はな" +"いはずです。\n" +"デフォルトのインポートシステムが適切な場合に新しいサブクラスを送出するためで" +"す。" #: ../../whatsnew/3.6.rst:2348 msgid "Changes in the C API" msgstr "C API の変更" -#: ../../whatsnew/3.6.rst:2350 msgid "" "The :c:func:`PyMem_Malloc` allocator family now uses the :ref:`pymalloc " "allocator ` rather than the system :c:func:`malloc`. Applications " @@ -3471,192 +4274,237 @@ msgid "" "the :envvar:`PYTHONMALLOC` environment variable to ``debug`` to validate the " "usage of memory allocators in your application. See :issue:`26249`." msgstr "" +":c:func:`PyMem_Malloc` 系のアロケータが、システムの :c:func:`malloc` ではな" +"く :ref:`pymalloc アロケータ ` を使うようになりました。\n" +"GIL を保持せずに :c:func:`PyMem_Malloc` を呼び出すアプリケーションはクラッ" +"シュする可能性があります。\n" +"環境変数 :envvar:`PYTHONMALLOC` を ``debug`` に設定すると、アプリケーションの" +"メモリアロケータの使用を検証できます。\n" +":issue:`26249` を参照してください。" -#: ../../whatsnew/3.6.rst:2356 msgid "" ":c:func:`Py_Exit` (and the main interpreter) now override the exit status " "with 120 if flushing buffered data failed. See :issue:`5319`." msgstr "" +":c:func:`Py_Exit` (およびメインインタープリタ) は、バッファリングされたデータ" +"のフラッシュに失敗した場合、終了ステータスを 120 に変更するようになりまし" +"た。\n" +":issue:`5319` を参照してください。" #: ../../whatsnew/3.6.rst:2361 msgid "CPython bytecode changes" msgstr "CPython バイトコードの変更" -#: ../../whatsnew/3.6.rst:2363 msgid "" "There have been several major changes to the :term:`bytecode` in Python 3.6." -msgstr "" +msgstr "Python 3.6 では :term:`bytecode` にいくつかの大きな変更があります。" -#: ../../whatsnew/3.6.rst:2365 msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode. " "(Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and " "Victor Stinner in :issue:`26647` and :issue:`28050`.)" msgstr "" +"Python インタープリタがバイトコードの代わりに 16 ビットのワードコードを使うよ" +"うになりました。\n" +"(Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and " +"Victor Stinner in :issue:`26647` and :issue:`28050`.)" -#: ../../whatsnew/3.6.rst:2369 msgid "" "The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " "of the :ref:`formatted string literal ` implementation. " -"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" -"`27078`.)" +"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka " +"in :issue:`27078`.)" msgstr "" +":ref:`フォーマット済み文字列リテラル ` の実装の一部とし" +"て、:opcode:`!FORMAT_VALUE` と :opcode:`BUILD_STRING` オペコードが追加されま" +"した。\n" +"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka " +"in :issue:`27078`.)" -#: ../../whatsnew/3.6.rst:2374 msgid "" "The new :opcode:`!BUILD_CONST_KEY_MAP` opcode to optimize the creation of " -"dictionaries with constant keys. (Contributed by Serhiy Storchaka in :issue:" -"`27140`.)" +"dictionaries with constant keys. (Contributed by Serhiy Storchaka " +"in :issue:`27140`.)" msgstr "" +"定数のキーを持つ辞書の作成を最適化する :opcode:`!BUILD_CONST_KEY_MAP` オペ" +"コードが追加されました。\n" +"(Contributed by Serhiy Storchaka in :issue:`27140`.)" -#: ../../whatsnew/3.6.rst:2378 msgid "" "The function call opcodes have been heavily reworked for better performance " "and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" "CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" -"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " -"added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " -"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" -"issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" -msgstr "" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the " +"new :opcode:`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` " +"have been added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " +"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed " +"in :issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" +msgstr "" +"関数呼び出しのオペコードが、性能向上と実装の簡素化のために大幅に再構成されま" +"した。\n" +":opcode:`MAKE_FUNCTION`、:opcode:`!CALL_FUNCTION`、:opcode:`!" +"CALL_FUNCTION_KW`、:opcode:`!BUILD_MAP_UNPACK_WITH_CALL` が変更さ" +"れ、:opcode:`CALL_FUNCTION_EX` と :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` が" +"追加されました。\n" +"``CALL_FUNCTION_VAR``、``CALL_FUNCTION_VAR_KW``、``MAKE_CLOSURE`` は削除され" +"ました。\n" +"(Contributed by Demur Rumed in :issue:`27095`, and Serhiy Storchaka " +"in :issue:`27213`, :issue:`28257`.)" -#: ../../whatsnew/3.6.rst:2389 msgid "" "The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`!STORE_ANNOTATION` opcodes " "have been added to support the new :term:`variable annotation` syntax. " "(Contributed by Ivan Levkivskyi in :issue:`27985`.)" msgstr "" +"新しい :term:`variable annotation` 構文をサポートするた" +"め、:opcode:`SETUP_ANNOTATIONS` と :opcode:`!STORE_ANNOTATION` オペコードが追" +"加されました。\n" +"(Contributed by Ivan Levkivskyi in :issue:`27985`.)" -#: ../../whatsnew/3.6.rst:2395 msgid "Notable changes in Python 3.6.2" -msgstr "" +msgstr "Python 3.6.2 の注目すべき変更" -#: ../../whatsnew/3.6.rst:2398 msgid "New ``make regen-all`` build target" -msgstr "" +msgstr "新しいビルドターゲット ``make regen-all``" -#: ../../whatsnew/3.6.rst:2400 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " "available, the autotools-based build system no longer attempts to implicitly " "recompile generated files based on file modification times." msgstr "" +"クロスコンパイルを簡単にし、既存の Python がなくても CPython を確実にコンパイ" +"ルできるようにするため、autotools ベースのビルドシステムは、更新日時に基づい" +"て生成ファイルを暗黙に再コンパイルしなくなりました。" -#: ../../whatsnew/3.6.rst:2405 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" +"代わりに、必要なときにこれらのファイルを強制的に再生成する ``make regen-" +"all`` コマンドが追加されました (例えば、あらかじめ生成されたファイルを使って" +"最初の Python をビルドした後など)。" -#: ../../whatsnew/3.6.rst:2409 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" +"対象を絞った再生成用ターゲットも定義されています。\n" +"詳しくは :source:`Makefile.pre.in` を参照してください。" -#: ../../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" -msgstr "" +msgstr "ビルドターゲット ``make touch`` の削除" -#: ../../whatsnew/3.6.rst:2420 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" +"生成ファイルの更新日時を変更して暗黙の再生成を要求するために使われていた " +"``make touch`` ビルドターゲットが削除されました。" -#: ../../whatsnew/3.6.rst:2423 msgid "It has been replaced by the new ``make regen-all`` target." -msgstr "" +msgstr "代わりに新しい ``make regen-all`` ターゲットを使ってください。" -#: ../../whatsnew/3.6.rst:2431 msgid "Notable changes in Python 3.6.4" -msgstr "" +msgstr "Python 3.6.4 の注目すべき変更" -#: ../../whatsnew/3.6.rst:2433 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. (Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`.)" +"during finalization of the interpreter. (Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`.)" msgstr "" +"公開 API の一部だったシングルトン ``PyExc_RecursionErrorInst`` が削除されまし" +"た。\n" +"そのメンバーがクリアされないため、インタープリタの終了処理中にセグメンテー" +"ション違反を引き起こす可能性がありました。\n" +"(Contributed by Xavier de Gaye in :issue:`22898` and :issue:`30697`.)" -#: ../../whatsnew/3.6.rst:2440 msgid "Notable changes in Python 3.6.5" -msgstr "" +msgstr "Python 3.6.5 の注目すべき変更" -#: ../../whatsnew/3.6.rst:2442 msgid "" "The :func:`locale.localeconv` function now sets temporarily the ``LC_CTYPE`` " "locale to the ``LC_NUMERIC`` locale in some cases. (Contributed by Victor " "Stinner in :issue:`31900`.)" msgstr "" +":func:`locale.localeconv` 関数は、一部の場合に ``LC_CTYPE`` ロケールを一時的" +"に ``LC_NUMERIC`` ロケールに設定するようになりました。\n" +"(Contributed by Victor Stinner in :issue:`31900`.)" -#: ../../whatsnew/3.6.rst:2448 msgid "Notable changes in Python 3.6.7" -msgstr "" +msgstr "Python 3.6.7 の注目すべき変更" -#: ../../whatsnew/3.6.rst:2450 msgid "" ":mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process external " "entities by default. See also :gh:`61441`." msgstr "" +":mod:`xml.dom.minidom` と :mod:`xml.sax` モジュールは、デフォルトでは外部実体" +"を処理しなくなりました。\n" +":gh:`61441` も参照してください。" -#: ../../whatsnew/3.6.rst:2453 msgid "" "In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token " "when provided with input that does not have a trailing new line. This " "behavior now matches what the C tokenizer does internally. (Contributed by " "Ammar Askar in :issue:`33899`.)" msgstr "" +"3.6.7 では :mod:`tokenize` モジュールが、末尾に改行のない入力に対して暗黙に " +"``NEWLINE`` トークンを出力するようになりました。\n" +"これにより C のトークナイザーの内部動作と一致します。\n" +"(Contributed by Ammar Askar in :issue:`33899`.)" -#: ../../whatsnew/3.6.rst:2459 msgid "Notable changes in Python 3.6.10" -msgstr "" +msgstr "Python 3.6.10 の注目すべき変更" -#: ../../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 " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" -"セキュリティ上の重大な懸念により、:meth:`asyncio.loop." -"create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" -"``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " -"Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" +"セキュリティ上の重大な懸念によ" +"り、:meth:`asyncio.loop.create_datagram_endpoint` での *reuse_address* 引数は" +"無効になりました。これはソケットオプション ``SO_REUSEADDR`` のUDP における挙" +"動が原因です。詳しくは、``loop.create_datagram_endpoint()`` のドキュメントを" +"参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov による貢" +"献 :issue:`37228`)" -#: ../../whatsnew/3.6.rst:2469 msgid "Notable changes in Python 3.6.13" -msgstr "" +msgstr "Python 3.6.13 の注目すべき変更" -#: ../../whatsnew/3.6.rst:2471 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" -msgstr "" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" +msgstr "" +"以前の Python では :func:`urllib.parse.parse_qs` " +"と :func:`urllib.parse.parse_qsl` のクエリパラメータの区切りに ``;`` と " +"``&`` の両方を使えました。\n" +"セキュリティ上の懸念と、新しい W3C 勧告への準拠のため、区切りは 1 種類のみと" +"なり、デフォルトは ``&`` に変更されました。\n" +"これらの関数を内部で使う :func:`!cgi.parse` と :func:`!cgi.parse_multipart` " +"も影響を受けます。\n" +"詳しくは各関数のドキュメントを参照してください。\n" +"(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" -#: ../../whatsnew/3.6.rst:2482 msgid "Notable changes in Python 3.6.14" -msgstr "" +msgstr "Python 3.6.14 の注目すべき変更" -#: ../../whatsnew/3.6.rst:2484 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -3664,13 +4512,25 @@ msgid "" "old behavior, set a ``trust_server_pasv_ipv4_address`` attribute on your FTP " "instance to ``True``. (See :gh:`87451`)" msgstr "" +"セキュリティ修正により、:class:`ftplib.FTP` はパッシブデータチャネルを確立す" +"るとき、リモートサーバーから送られた IPv4 アドレスを信頼しなくなりました。\n" +"代わりに FTP サーバーの IP アドレスを再利用します。\n" +"従来の動作が必要な特殊なコードでは、FTP インスタンスの " +"``trust_server_pasv_ipv4_address`` 属性を ``True`` に設定してください " +"(:gh:`87451` を参照)。" -#: ../../whatsnew/3.6.rst:2490 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 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" -msgstr "" +"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 仕様に従い、パーサー :func:`urllib.parse` は " +"ASCII の改行 ``\\n``、``\\r`` とタブ ``\\t`` を URL から取り除き、このような" +"攻撃を防ぐようになりました。\n" +"削除対象の文字は、新しいモジュール変数 " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE`` で制御します (:gh:`88048` を参" +"照)。" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 4e2860369..00b3b006a 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 @@ -41,8 +41,8 @@ msgstr "Elvis Pranskevichus " #: ../../whatsnew/3.7.rst:47 msgid "" "This article explains the new features in Python 3.7, compared to 3.6. " -"Python 3.7 was released on June 27, 2018. For full details, see the :ref:" -"`changelog `." +"Python 3.7 was released on June 27, 2018. For full details, see " +"the :ref:`changelog `." msgstr "" "この記事では Python 3.6 と比較した Python 3.7 の新機能を解説します。Python " "3.7 は2018年6月27日にリリースされました。全詳細については :ref:`変更履" @@ -124,7 +124,7 @@ msgid "" "spec." msgstr "" ":ref:`dict ` オブジェクトの挿入順序を保存するという性質が、公" -"式に Python 言語仕様の一部であると `宣言されました `_ 。" +"式に Python 言語仕様の一部であると `宣言されました `_ 。" #: ../../whatsnew/3.7.rst:90 msgid "Significant improvements in the standard library:" @@ -132,8 +132,9 @@ msgstr "標準ライブラリーの顕著な改善" #: ../../whatsnew/3.7.rst:92 msgid "" -"The :mod:`asyncio` module has received new features, significant :ref:" -"`usability and performance improvements `." +"The :mod:`asyncio` module has received new features, " +"significant :ref:`usability and performance improvements " +"`." msgstr "" ":mod:`asyncio` モジュールに新しい機能が加わりました。\n" "顕著な :ref:`使い勝手とパフォーマンスの改善 ` です。" @@ -166,9 +167,8 @@ msgstr ":ref:`PEP 540 `, UTF-8 実行時モードの強制" msgid ":ref:`PEP 552 `, deterministic .pycs" msgstr ":ref:`PEP 552 ` 、決定論的な .pyc" -#: ../../whatsnew/3.7.rst:105 msgid ":ref:`New Python Development Mode `" -msgstr "" +msgstr ":ref:`新しい Python 開発モード `" #: ../../whatsnew/3.7.rst:106 msgid "" @@ -199,8 +199,8 @@ msgstr ":ref:`PEP 545 ` 、 Python ドキュメント翻訳" #: ../../whatsnew/3.7.rst:116 msgid "" "New documentation translations: `Japanese `_, " -"`French `_, and `Korean `_." +"`French `_, and `Korean `_." msgstr "" "新しいドキュメント翻訳: `日本語 `_ 、 `フランス" "語 `_ 、 `韓国語 C:\n" +" ...\n" +"\n" +" def validate_b(self, obj: B) -> bool:\n" +" ...\n" +"\n" +"class B:\n" +" ..." #: ../../whatsnew/3.7.rst:169 msgid "" "Since this change breaks compatibility, the new behavior needs to be enabled " "on a per-module basis in Python 3.7 using a :mod:`__future__` import::" msgstr "" -"この変更は後方互換性を壊してしまうので、新しい振る舞いは Python 3.7 では :" -"mod:`__future__` インポートを使いモジュールごとに有効化する必要があります::" +"この変更は後方互換性を壊してしまうので、新しい振る舞いは Python 3.7 で" +"は :mod:`__future__` インポートを使いモジュールごとに有効化する必要がありま" +"す::" -#: ../../whatsnew/3.7.rst:172 msgid "from __future__ import annotations" -msgstr "" +msgstr "from __future__ import annotations" #: ../../whatsnew/3.7.rst:174 msgid "It will become the default in Python 3.10." @@ -345,16 +354,16 @@ msgid "" "automatically coerce that locale to an available UTF-8 based locale as " "described in the documentation of the new :envvar:`PYTHONCOERCECLOCALE` " "environment variable. Automatically setting ``LC_CTYPE`` this way means that " -"both the core interpreter and locale-aware C extensions (such as :mod:" -"`readline`) will assume the use of UTF-8 as the default text encoding, " -"rather than ASCII." +"both the core interpreter and locale-aware C extensions (such " +"as :mod:`readline`) will assume the use of UTF-8 as the default text " +"encoding, rather than ASCII." msgstr "" ":pep:`538` はインタープリタのデフォルトのコマンドラインインターフェースを更新" "し、新しく加わった :envvar:`PYTHONCOERCECLOCALE` 環境変数のドキュメントにある" "通り、自動的にロケールを UTF-8 に基づいた利用可能なロケールへ強制します。\n" -"この方法で ``LC_CTYPE`` を自動的に設定すると、コアのインタープリタと (:mod:" -"`readline` などの) ロケールを考慮する C 拡張はデフォルトのテキストエンコー" -"ディングとして ASCII ではなく UTF-8 を使うことになります。" +"この方法で ``LC_CTYPE`` を自動的に設定すると、コアのインタープリタと " +"(:mod:`readline` などの) ロケールを考慮する C 拡張はデフォルトのテキストエン" +"コーディングとして ASCII ではなく UTF-8 を使うことになります。" #: ../../whatsnew/3.7.rst:200 msgid "" @@ -369,13 +378,14 @@ msgstr "" msgid "" "As part of this change, the default error handler for :data:`~sys.stdin` " "and :data:`~sys.stdout` is now ``surrogateescape`` (rather than ``strict``) " -"when using any of the defined coercion target locales (currently ``C." -"UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler for :data:" -"`~sys.stderr` continues to be ``backslashreplace``, regardless of locale." -msgstr "" -"この変更の一部として、強制対象として定義されたのロケール (現時点では ``C." -"UTF-8``, ``C.utf8``, ``UTF-8``) を使っているときの :data:`~sys.stdin` と :" -"data:`~sys.stdout` のデフォルトのエラーハンドラは (``strict`` ではなく) " +"when using any of the defined coercion target locales (currently " +"``C.UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler " +"for :data:`~sys.stderr` continues to be ``backslashreplace``, regardless of " +"locale." +msgstr "" +"この変更の一部として、強制対象として定義されたのロケール (現時点では " +"``C.UTF-8``, ``C.utf8``, ``UTF-8``) を使っているときの :data:`~sys.stdin` " +"と :data:`~sys.stdout` のデフォルトのエラーハンドラは (``strict`` ではなく) " "``surrogateescape`` になります。\n" ":data:`~sys.stderr` のデフォルトのエラーハンドラは、ロケールに関係無く引き続" "き ``backslashreplace`` です。" @@ -383,8 +393,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:209 msgid "" "Locale coercion is silent by default, but to assist in debugging potentially " -"locale related integration problems, explicit warnings (emitted directly on :" -"data:`~sys.stderr`) can be requested by setting " +"locale related integration problems, explicit warnings (emitted directly " +"on :data:`~sys.stderr`) can be requested by setting " "``PYTHONCOERCECLOCALE=warn``. This setting will also cause the Python " "runtime to emit a warning if the legacy C locale remains active when the " "core interpreter is initialized." @@ -425,26 +435,32 @@ msgstr "PEP written and implemented by Nick Coghlan." msgid "PEP 540: Forced UTF-8 Runtime Mode" msgstr "PEP 540: 強制 UTF-8 実行モード" -#: ../../whatsnew/3.7.rst:234 msgid "" "The new :option:`-X` ``utf8`` command line option and :envvar:`PYTHONUTF8` " "environment variable can be used to enable the :ref:`Python UTF-8 Mode `." msgstr "" +"新しいコマンドラインオプション :option:`-X` ``utf8`` と環境変" +"数 :envvar:`PYTHONUTF8` を使うと、:ref:`Python UTF-8 モード ` を有" +"効にできます。" -#: ../../whatsnew/3.7.rst:238 msgid "" "When in UTF-8 mode, CPython ignores the locale settings, and uses the UTF-8 " -"encoding by default. The error handlers for :data:`sys.stdin` and :data:" -"`sys.stdout` streams are set to ``surrogateescape``." +"encoding by default. The error handlers for :data:`sys.stdin` " +"and :data:`sys.stdout` streams are set to ``surrogateescape``." msgstr "" +"UTF-8 モードでは CPython はロケール設定を無視し、デフォルトのエンコーディング" +"に UTF-8 を使います。\n" +":data:`sys.stdin` と :data:`sys.stdout` ストリームのエラーハンドラーは " +"``surrogateescape`` に設定されます。" -#: ../../whatsnew/3.7.rst:242 msgid "" "The forced UTF-8 mode can be used to change the text handling behavior in an " "embedded Python interpreter without changing the locale settings of an " "embedding application." msgstr "" +"UTF-8 モードを強制すると、埋め込み先のアプリケーションのロケール設定を変えず" +"に、埋め込まれた Python インタープリタのテキスト処理の動作を変更できます。" #: ../../whatsnew/3.7.rst:246 msgid "" @@ -456,13 +472,17 @@ msgid "" "with such components, Python 3.7 also implements :ref:`whatsnew37-pep540`)." msgstr "" -#: ../../whatsnew/3.7.rst:253 msgid "" "The UTF-8 mode is enabled by default when the locale is ``C`` or ``POSIX``, " "and the :pep:`538` locale coercion feature fails to change it to a UTF-8 " "based alternative (whether that failure is due to ``PYTHONCOERCECLOCALE=0`` " "being set, ``LC_ALL`` being set, or the lack of a suitable target locale)." msgstr "" +"ロケールが ``C`` または ``POSIX`` であり、:pep:`538` のロケール強制変更機能" +"で UTF-8 ベースのロケールに変更できなかった場合、UTF-8 モードはデフォルトで有" +"効になります。\n" +"``PYTHONCOERCECLOCALE=0`` や ``LC_ALL`` が設定されている場合も、適切な変更先" +"のロケールがない場合も同様です。" #: ../../whatsnew/3.7.rst:260 msgid ":pep:`540` -- Add a new UTF-8 mode" @@ -484,15 +504,23 @@ msgstr "" "Python 3.7 には、 Python デバッガへ入って行くための簡単で一貫した手段である、" "新しい組み込みの :func:`breakpoint` 関数があります。" -#: ../../whatsnew/3.7.rst:272 msgid "" "Built-in ``breakpoint()`` calls :func:`sys.breakpointhook`. By default, the " "latter imports :mod:`pdb` and then calls ``pdb.set_trace()``, but by binding " "``sys.breakpointhook()`` to the function of your choosing, ``breakpoint()`` " -"can enter any debugger. Additionally, the environment variable :envvar:" -"`PYTHONBREAKPOINT` can be set to the callable of your debugger of choice. " -"Set ``PYTHONBREAKPOINT=0`` to completely disable built-in ``breakpoint()``." -msgstr "" +"can enter any debugger. Additionally, the environment " +"variable :envvar:`PYTHONBREAKPOINT` can be set to the callable of your " +"debugger of choice. Set ``PYTHONBREAKPOINT=0`` to completely disable built-" +"in ``breakpoint()``." +msgstr "" +"組み込みの ``breakpoint()`` は :func:`sys.breakpointhook` を呼び出します。\n" +"デフォルトでは :mod:`pdb` をインポートして ``pdb.set_trace()`` を呼び出します" +"が、``sys.breakpointhook()`` に好きな関数を割り当てることで、" +"``breakpoint()`` から任意のデバッガーを起動できます。\n" +"環境変数 :envvar:`PYTHONBREAKPOINT` に、使いたいデバッガーの呼び出し可能オブ" +"ジェクトを指定することもできます。\n" +"組み込みの ``breakpoint()`` を完全に無効化するには ``PYTHONBREAKPOINT=0`` を" +"設定します。" #: ../../whatsnew/3.7.rst:282 msgid ":pep:`553` -- Built-in breakpoint()" @@ -506,7 +534,6 @@ msgstr "PEP written and implemented by Barry Warsaw" msgid "PEP 539: New C API for Thread-Local Storage" msgstr "PEP 539: スレッドローカルストレージのための新しい C API" -#: ../../whatsnew/3.7.rst:291 msgid "" "While Python provides a C API for thread-local storage support; the " "existing :ref:`Thread Local Storage (TLS) API ` " @@ -514,20 +541,31 @@ msgid "" "not generally been a problem for officially support platforms, but that is " "neither POSIX-compliant, nor portable in any practical sense." msgstr "" +"Python はスレッドローカルストレージをサポートする C API を提供していますが、" +"既存の :ref:`Thread Local Storage (TLS) API ` は、" +"すべてのプラットフォームで TLS キーを :c:expr:`int` で表していました。\n" +"公式にサポートするプラットフォームでは通常問題になりませんでしたが、POSIX 準" +"拠ではなく、実用的な意味で移植性があるともいえません。" -#: ../../whatsnew/3.7.rst:297 msgid "" ":pep:`539` changes this by providing a new :ref:`Thread Specific Storage " "(TSS) API ` to CPython which supersedes use of " "the existing TLS API within the CPython interpreter, while deprecating the " -"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead of :c:" -"expr:`int` to represent TSS keys--an opaque type the definition of which may " -"depend on the underlying TLS implementation. Therefore, this will allow to " -"build CPython on platforms where the native TLS key is defined in a way that " -"cannot be safely cast to :c:expr:`int`." -msgstr "" +"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead " +"of :c:expr:`int` to represent TSS keys--an opaque type the definition of " +"which may depend on the underlying TLS implementation. Therefore, this will " +"allow to build CPython on platforms where the native TLS key is defined in a " +"way that cannot be safely cast to :c:expr:`int`." +msgstr "" +":pep:`539` は新しい :ref:`Thread Specific Storage (TSS) API ` を CPython に提供し、インタープリタ内部の既存 TLS API の使用を" +"置き換え、既存の API を非推奨にします。\n" +"TSS API はキーを :c:expr:`int` ではなく新しい :c:type:`Py_tss_t` 型で表しま" +"す。\n" +"これは内部の TLS 実装によって定義が異なる可能性のある不透明な型です。\n" +"そのため、ネイティブの TLS キーを安全に :c:expr:`int` にキャストできないプ" +"ラットフォームでも CPython をビルドできるようになります。" -#: ../../whatsnew/3.7.rst:306 msgid "" "Note that on platforms where the native TLS key is defined in a way that " "cannot be safely cast to :c:expr:`int`, all functions of the existing TLS " @@ -535,14 +573,17 @@ msgid "" "that the old API is not supported on platforms where it cannot be used " "reliably, and that no effort will be made to add such support." msgstr "" +"ネイティブの TLS キーを安全に :c:expr:`int` にキャストできないプラットフォー" +"ムでは、既存の TLS API のすべての関数は何もせず、直ちに失敗を返すことに注意し" +"てください。\n" +"これは、旧 API を確実に使えないプラットフォームではサポートしないこと、また今" +"後も対応しないことを明確に示すものです。" -#: ../../whatsnew/3.7.rst:314 msgid ":pep:`539` -- A New C-API for Thread-Local Storage in CPython" -msgstr "" +msgstr ":pep:`539` -- CPython のスレッドローカルストレージ用の新しい C API" -#: ../../whatsnew/3.7.rst:315 msgid "PEP written by Erik M. Bray; implementation by Masayuki Yamamoto." -msgstr "" +msgstr "PEP の執筆は Erik M. Bray、実装は Masayuki Yamamoto。" #: ../../whatsnew/3.7.rst:321 msgid "PEP 562: Customization of Access to Module Attributes" @@ -551,8 +592,8 @@ msgstr "PEP 562: モジュール属性へのアクセスのカスタマイズ" #: ../../whatsnew/3.7.rst:323 msgid "" "Python 3.7 allows defining :meth:`__getattr__` on modules and will call it " -"whenever a module attribute is otherwise not found. Defining :meth:" -"`__dir__` on modules is now also allowed." +"whenever a module attribute is otherwise not found. " +"Defining :meth:`__dir__` on modules is now also allowed." msgstr "" "Python 3.7 ではモジュールに :meth:`__getattr__` が定義でき、モジュール属性が" "あるときでも無いときでもこのメソッドが呼び出されます。\n" @@ -577,7 +618,6 @@ msgstr "PEP written and implemented by Ivan Levkivskyi" msgid "PEP 564: New Time Functions With Nanosecond Resolution" msgstr "PEP 564: ナノ秒単位の分解能を持つ新しい時間関数" -#: ../../whatsnew/3.7.rst:341 msgid "" "The resolution of clocks in modern systems can exceed the limited precision " "of a floating-point number returned by the :func:`time.time` function and " @@ -585,6 +625,10 @@ msgid "" "\"nanosecond\" variants of the existing timer functions to the :mod:`time` " "module:" msgstr "" +"現代のシステムの時計の分解能は、:func:`time.time` とその類似関数が返す浮動小" +"数点数の限られた精度を超えることがあります。\n" +"精度の損失を避けるため、:pep:`564` は既存の時刻関数に対応する次の六つの「ナノ" +"秒」版を :mod:`time` モジュールに追加します:" #: ../../whatsnew/3.7.rst:347 ../../whatsnew/3.7.rst:1451 msgid ":func:`time.clock_gettime_ns`" @@ -614,22 +658,22 @@ msgstr ":func:`time.time_ns`" msgid "The new functions return the number of nanoseconds as an integer value." msgstr "新しい関数は、整数値としてナノ秒単位の数値を返します。" -#: ../../whatsnew/3.7.rst:356 msgid "" ":pep:`Measurements <0564#annex-clocks-resolution-in-python>` show that on " "Linux and Windows the resolution of :func:`time.time_ns` is approximately 3 " "times better than that of :func:`time.time`." msgstr "" +":pep:`測定結果 <0564#annex-clocks-resolution-in-python>` によると、Linux と " +"Windows で :func:`time.time_ns` の分解能は :func:`time.time` の約 3 倍高くな" +"ります。" #: ../../whatsnew/3.7.rst:362 msgid ":pep:`564` -- Add new time functions with nanosecond resolution" msgstr ":pep:`564` -- ナノ秒単位の分解能を持つ新しい時間関数の追加" -#: ../../whatsnew/3.7.rst:369 msgid "PEP 565: Show DeprecationWarning in ``__main__``" -msgstr "" +msgstr "PEP 565: ``__main__`` で DeprecationWarning を表示" -#: ../../whatsnew/3.7.rst:371 msgid "" "The default handling of :exc:`DeprecationWarning` has been changed such that " "these warnings are once more shown by default, but only when the code " @@ -639,46 +683,66 @@ msgid "" "APIs they use, but deprecation warnings triggered by imported application, " "library and framework modules will continue to be hidden by default." msgstr "" +":exc:`DeprecationWarning` のデフォルトの扱いが変更され、警告を発生させるコー" +"ドが :mod:`__main__` モジュール内で直接実行されている場合に限り、再びデフォル" +"トで表示されるようになりました。\n" +"その結果、単一ファイルのスクリプトを書く開発者や Python を対話的に使う開発者" +"は、使っている API の非推奨警告を再び目にするようになります。\n" +"一方、インポートされたアプリケーション、ライブラリ、フレームワークのモジュー" +"ルから発生する非推奨警告は、引き続きデフォルトでは表示されません。" -#: ../../whatsnew/3.7.rst:379 msgid "" "As a result of this change, the standard library now allows developers to " "choose between three different deprecation warning behaviours:" msgstr "" +"この変更により、標準ライブラリでは開発者が次の三つの非推奨警告の動作を選べる" +"ようになりました:" -#: ../../whatsnew/3.7.rst:382 msgid "" ":exc:`FutureWarning`: always displayed by default, recommended for warnings " "intended to be seen by application end users (e.g. for deprecated " "application configuration settings)." msgstr "" +":exc:`FutureWarning`: デフォルトで常に表示されます。\n" +"アプリケーションのエンドユーザー向けの警告 (例えば非推奨のアプリケーション設" +"定) に推奨されます。" -#: ../../whatsnew/3.7.rst:385 msgid "" ":exc:`DeprecationWarning`: displayed by default only in :mod:`__main__` and " "when running tests, recommended for warnings intended to be seen by other " "Python developers where a version upgrade may result in changed behaviour or " "an error." msgstr "" +":exc:`DeprecationWarning`: デフォルトでは :mod:`__main__` とテスト実行時にの" +"み表示されます。\n" +"バージョンアップによって動作が変わったりエラーが発生したりする場合に、ほかの " +"Python 開発者に示す警告として推奨されます。" -#: ../../whatsnew/3.7.rst:389 msgid "" ":exc:`PendingDeprecationWarning`: displayed by default only when running " "tests, intended for cases where a future version upgrade will change the " "warning category to :exc:`DeprecationWarning` or :exc:`FutureWarning`." msgstr "" +":exc:`PendingDeprecationWarning`: デフォルトではテスト実行時にのみ表示されま" +"す。\n" +"将来のバージョンアップで警告カテゴリを :exc:`DeprecationWarning` また" +"は :exc:`FutureWarning` に変更する予定の場合に使います。" -#: ../../whatsnew/3.7.rst:393 msgid "" -"Previously both :exc:`DeprecationWarning` and :exc:" -"`PendingDeprecationWarning` were only visible when running tests, which " -"meant that developers primarily writing single file scripts or using Python " -"interactively could be surprised by breaking changes in the APIs they used." +"Previously both :exc:`DeprecationWarning` " +"and :exc:`PendingDeprecationWarning` were only visible when running tests, " +"which meant that developers primarily writing single file scripts or using " +"Python interactively could be surprised by breaking changes in the APIs they " +"used." msgstr "" +"以前は :exc:`DeprecationWarning` と :exc:`PendingDeprecationWarning` のどちら" +"もテスト実行時にしか表示されませんでした。\n" +"そのため、主に単一ファイルのスクリプトを書いたり Python を対話的に使ったりす" +"る開発者は、使っている API の互換性を損なう変更に不意を突かれることがありまし" +"た。" -#: ../../whatsnew/3.7.rst:400 msgid ":pep:`565` -- Show DeprecationWarning in ``__main__``" -msgstr "" +msgstr ":pep:`565` -- ``__main__`` で DeprecationWarning を表示" #: ../../whatsnew/3.7.rst:401 msgid "PEP written and implemented by Nick Coghlan" @@ -692,22 +756,22 @@ msgstr "" #: ../../whatsnew/3.7.rst:409 msgid "" "Initially :pep:`484` was designed in such way that it would not introduce " -"*any* changes to the core CPython interpreter. Now type hints and the :mod:" -"`typing` module are extensively used by the community, so this restriction " -"is removed. The PEP introduces two special methods :meth:`__class_getitem__` " -"and ``__mro_entries__``, these methods are now used by most classes and " -"special constructs in :mod:`typing`. As a result, the speed of various " -"operations with types increased up to 7 times, the generic types can be used " -"without metaclass conflicts, and several long standing bugs in :mod:`typing` " -"module are fixed." +"*any* changes to the core CPython interpreter. Now type hints and " +"the :mod:`typing` module are extensively used by the community, so this " +"restriction is removed. The PEP introduces two special " +"methods :meth:`__class_getitem__` and ``__mro_entries__``, these methods are " +"now used by most classes and special constructs in :mod:`typing`. As a " +"result, the speed of various operations with types increased up to 7 times, " +"the generic types can be used without metaclass conflicts, and several long " +"standing bugs in :mod:`typing` module are fixed." msgstr "" "当初 :pep:`484` は、 CPython のインタプリタのコア部分に *どんな* 変更も施さな" "いような方法で設計されていました。\n" "今では型ヒントと :mod:`typing` モジュールはコミュニティに広く使われるように" "なったため、この制限は取り除かれました。\n" "この PEP では、2 つの特殊メソッド :meth:`__class_getitem__` と " -"``__mro_entries__`` が導入され、これらのメソッドはほとんどのクラスと :mod:" -"`typing` にある特別な構成物に使われています。\n" +"``__mro_entries__`` が導入され、これらのメソッドはほとんどのクラス" +"と :mod:`typing` にある特別な構成物に使われています。\n" "その結果、型に関する様々な操作の速度が最大で 7 倍にまでなり、ジェネリック型は" "メタクラスの衝突を起こさずに使えるようになり、 :mod:`typing` にずっとあったい" "くつかのバグが修正されました。" @@ -717,11 +781,9 @@ msgid ":pep:`560` -- Core support for typing module and generic types" msgstr "" ":pep:`560` -- typing モジュールとジェネリック型に対する言語コアによるサポート" -#: ../../whatsnew/3.7.rst:428 msgid "PEP 552: Hash-based .pyc Files" -msgstr "" +msgstr "PEP 552: ハッシュベースの .pyc ファイル" -#: ../../whatsnew/3.7.rst:430 msgid "" "Python has traditionally checked the up-to-dateness of bytecode cache files " "(i.e., ``.pyc`` files) by comparing the source metadata (last-modified " @@ -732,18 +794,32 @@ msgid "" "in the cache file is problematic for `build reproducibility `_ and content-based build systems." msgstr "" +"Python は従来、ソースのメタデータ (最終更新日時とサイズ) を、バイトコードの" +"キャッシュファイル (``.pyc`` ファイル) の生成時にヘッダーに保存したメタデータ" +"と比較し、キャッシュが最新かを検査していました。\n" +"この無効化方式は有効ですが欠点もあります。\n" +"ファイルシステムのタイムスタンプの粒度が粗すぎると、ソースの更新を見落として" +"ユーザーを混乱させることがあります。\n" +"また、キャッシュファイル内のタイムスタンプは、`再現可能なビルド `_ や内容に基づくビルドシステムにとっても問題になり" +"ます。" -#: ../../whatsnew/3.7.rst:439 msgid "" ":pep:`552` extends the pyc format to allow the hash of the source file to be " "used for invalidation instead of the source timestamp. Such ``.pyc`` files " "are called \"hash-based\". By default, Python still uses timestamp-based " "invalidation and does not generate hash-based ``.pyc`` files at runtime. " -"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` or :mod:" -"`compileall`." +"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` " +"or :mod:`compileall`." msgstr "" +":pep:`552` は pyc 形式を拡張し、ソースのタイムスタンプの代わりにソースファイ" +"ルのハッシュを無効化の判断に使えるようにします。\n" +"この ``.pyc`` ファイルを「ハッシュベース」と呼びます。\n" +"デフォルトでは Python は引き続きタイムスタンプによる無効化を使い、実行時には" +"ハッシュベースの ``.pyc`` を生成しません。\n" +"ハッシュベースの ``.pyc`` ファイルは :mod:`py_compile` また" +"は :mod:`compileall` で生成できます。" -#: ../../whatsnew/3.7.rst:445 msgid "" "Hash-based ``.pyc`` files come in two variants: checked and unchecked. " "Python validates checked hash-based ``.pyc`` files against the corresponding " @@ -752,32 +828,35 @@ msgid "" "for environments where a system external to Python (e.g., the build system) " "is responsible for keeping ``.pyc`` files up-to-date." msgstr "" +"ハッシュベースの ``.pyc`` ファイルには、検査付きと検査なしの 2 種類がありま" +"す。\n" +"Python は実行時に検査付きのファイルを対応するソースファイルと照合しますが、検" +"査なしの場合は照合しません。\n" +"検査なしのハッシュベース ``.pyc`` ファイルは、ビルドシステムなど Python 外部" +"のシステムが ``.pyc`` を最新に保つ責任を持つ環境で、性能の最適化に役立ちま" +"す。" -#: ../../whatsnew/3.7.rst:452 msgid "See :ref:`pyc-invalidation` for more information." -msgstr "" +msgstr "詳しくは :ref:`pyc-invalidation` を参照してください。" -#: ../../whatsnew/3.7.rst:456 msgid ":pep:`552` -- Deterministic pycs" -msgstr "" +msgstr ":pep:`552` -- 決定的な pyc ファイル" #: ../../whatsnew/3.7.rst:457 msgid "PEP written and implemented by Benjamin Peterson" msgstr "PEP written and implemented by Benjamin Peterson" -#: ../../whatsnew/3.7.rst:463 msgid "PEP 545: Python Documentation Translations" -msgstr "" +msgstr "PEP 545: Python ドキュメントの翻訳" -#: ../../whatsnew/3.7.rst:465 msgid "" ":pep:`545` describes the process of creating and maintaining Python " "documentation translations." msgstr "" +":pep:`545` は Python ドキュメントの翻訳を作成し、保守する手順を定めます。" -#: ../../whatsnew/3.7.rst:468 msgid "Three new translations have been added:" -msgstr "" +msgstr "三つの新しい翻訳が追加されました:" #: ../../whatsnew/3.7.rst:470 msgid "Japanese: https://docs.python.org/ja/" @@ -803,95 +882,130 @@ msgstr "" "PEP written and implemented by Julien Palard, Inada Naoki, and Victor " "Stinner." -#: ../../whatsnew/3.7.rst:484 msgid "Python Development Mode (-X dev)" -msgstr "" +msgstr "Python 開発モード (-X dev)" -#: ../../whatsnew/3.7.rst:486 msgid "" -"The new :option:`-X` ``dev`` command line option or the new :envvar:" -"`PYTHONDEVMODE` environment variable can be used to enable :ref:`Python " -"Development Mode `. When in development mode, Python performs " -"additional runtime checks that are too expensive to be enabled by default. " -"See :ref:`Python Development Mode ` documentation for the full " -"description." +"The new :option:`-X` ``dev`` command line option or the " +"new :envvar:`PYTHONDEVMODE` environment variable can be used to " +"enable :ref:`Python Development Mode `. When in development mode, " +"Python performs additional runtime checks that are too expensive to be " +"enabled by default. See :ref:`Python Development Mode ` " +"documentation for the full description." msgstr "" +"新しいコマンドラインオプション :option:`-X` ``dev`` または環境変" +"数 :envvar:`PYTHONDEVMODE` で :ref:`Python 開発モード ` を有効にでき" +"ます。\n" +"開発モードでは、デフォルトで有効にするにはコストが高すぎる追加の実行時検査を" +"行います。\n" +"詳しい説明は :ref:`Python 開発モード ` のドキュメントを参照してくだ" +"さい。" #: ../../whatsnew/3.7.rst:495 msgid "Other Language Changes" msgstr "その他の言語変更" -#: ../../whatsnew/3.7.rst:497 msgid "" -"An :keyword:`await` expression and comprehensions containing an :keyword:" -"`async for` clause were illegal in the expressions in :ref:`formatted string " -"literals ` due to a problem with the implementation. In Python " -"3.7 this restriction was lifted." +"An :keyword:`await` expression and comprehensions containing " +"an :keyword:`async for` clause were illegal in the expressions " +"in :ref:`formatted string literals ` due to a problem with the " +"implementation. In Python 3.7 this restriction was lifted." msgstr "" +"実装上の問題により、:ref:`フォーマット済み文字列リテラル ` 内の式" +"では :keyword:`await` 式と :keyword:`async for` 節を含む内包表記を使えません" +"でした。\n" +"Python 3.7 ではこの制限がなくなりました。" -#: ../../whatsnew/3.7.rst:502 msgid "" "More than 255 arguments can now be passed to a function, and a function can " -"now have more than 255 parameters. (Contributed by Serhiy Storchaka in :" -"issue:`12844` and :issue:`18896`.)" +"now have more than 255 parameters. (Contributed by Serhiy Storchaka " +"in :issue:`12844` and :issue:`18896`.)" msgstr "" +"関数に 255 個を超える引数を渡せるようになり、関数を 255 個を超えるパラメータ" +"で定義することも可能になりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`12844` and :issue:`18896`.)" -#: ../../whatsnew/3.7.rst:506 msgid "" ":meth:`bytes.fromhex` and :meth:`bytearray.fromhex` now ignore all ASCII " "whitespace, not only spaces. (Contributed by Robert Xiao in :issue:`28927`.)" msgstr "" +":meth:`bytes.fromhex` と :meth:`bytearray.fromhex` は、スペースだけでなくすべ" +"ての ASCII 空白文字を無視するようになりました。\n" +"(Contributed by Robert Xiao in :issue:`28927`.)" -#: ../../whatsnew/3.7.rst:509 msgid "" ":class:`str`, :class:`bytes`, and :class:`bytearray` gained support for the " "new :meth:`isascii() ` method, which can be used to test if a " "string or bytes contain only the ASCII characters. (Contributed by INADA " "Naoki in :issue:`32677`.)" msgstr "" +":class:`str`、:class:`bytes`、:class:`bytearray` に :meth:`isascii() " +"` メソッドが追加され、文字列やバイト列が ASCII 文字だけを含むか" +"検査できるようになりました。\n" +"(Contributed by INADA Naoki in :issue:`32677`.)" -#: ../../whatsnew/3.7.rst:514 msgid "" ":exc:`ImportError` now displays module name and module ``__file__`` path " -"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier in :" -"issue:`29546`.)" +"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier " +"in :issue:`29546`.)" msgstr "" +"``from ... import ...`` が失敗したとき、:exc:`ImportError` にモジュール名とモ" +"ジュールの ``__file__`` パスが表示されるようになりました。\n" +"(Contributed by Matthias Bussonnier in :issue:`29546`.)" -#: ../../whatsnew/3.7.rst:518 msgid "" "Circular imports involving absolute imports with binding a submodule to a " "name are now supported. (Contributed by Serhiy Storchaka in :issue:`30024`.)" msgstr "" +"サブモジュールを名前に束縛する絶対インポートを含む循環インポートをサポートし" +"ました。\n" +"(Contributed by Serhiy Storchaka in :issue:`30024`.)" -#: ../../whatsnew/3.7.rst:522 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " -"``format(str(self), '')``. (Contributed by Serhiy Storchaka in :issue:" -"`28974`.)" +"``format(str(self), '')``. (Contributed by Serhiy Storchaka " +"in :issue:`28974`.)" msgstr "" +"``object.__format__(x, '')`` は ``format(str(self), '')`` ではなく " +"``str(x)`` と等価になりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`28974`.)" -#: ../../whatsnew/3.7.rst:526 msgid "" -"In order to better support dynamic creation of stack traces, :class:`types." -"TracebackType` can now be instantiated from Python code, and the :attr:" -"`~traceback.tb_next` attribute on :ref:`tracebacks ` is " -"now writable. (Contributed by Nathaniel J. Smith in :issue:`30579`.)" +"In order to better support dynamic creation of stack " +"traces, :class:`types.TracebackType` can now be instantiated from Python " +"code, and the :attr:`~traceback.tb_next` attribute on :ref:`tracebacks " +"` is now writable. (Contributed by Nathaniel J. Smith " +"in :issue:`30579`.)" msgstr "" +"スタックトレースの動的な作成をよりよくサポートするた" +"め、:class:`types.TracebackType` を Python コードからインスタンス化できるよう" +"になりました。\n" +"また :ref:`トレースバック ` の :attr:`~traceback.tb_next` " +"属性が書き込み可能になりました。\n" +"(Contributed by Nathaniel J. Smith in :issue:`30579`.)" -#: ../../whatsnew/3.7.rst:532 msgid "" "When using the :option:`-m` switch, ``sys.path[0]`` is now eagerly expanded " "to the full starting directory path, rather than being left as the empty " "directory (which allows imports from the *current* working directory at the " "time when an import occurs) (Contributed by Nick Coghlan in :issue:`33053`.)" msgstr "" +":option:`-m` オプションを使うとき、``sys.path[0]`` を空のディレクトリ名のまま" +"にせず、起動時のディレクトリの完全なパスに直ちに展開するようになりました。\n" +"空のディレクトリ名では、インポートが行われる時点の *現在の* 作業ディレクトリ" +"からインポートできていました。\n" +"(Contributed by Nick Coghlan in :issue:`33053`.)" -#: ../../whatsnew/3.7.rst:538 msgid "" -"The new :option:`-X` ``importtime`` option or the :envvar:" -"`PYTHONPROFILEIMPORTTIME` environment variable can be used to show the " -"timing of each module import. (Contributed by Inada Naoki in :issue:`31415`.)" +"The new :option:`-X` ``importtime`` option or " +"the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable can be used to " +"show the timing of each module import. (Contributed by Inada Naoki " +"in :issue:`31415`.)" msgstr "" +"新しい :option:`-X` ``importtime`` オプションまたは環境変" +"数 :envvar:`PYTHONPROFILEIMPORTTIME` で、各モジュールのインポートにかかった時" +"間を表示できます。\n" +"(Contributed by Inada Naoki in :issue:`31415`.)" #: ../../whatsnew/3.7.rst:545 msgid "New Modules" @@ -901,21 +1015,27 @@ msgstr "新たなモジュール" msgid "contextvars" msgstr "contextvars" -#: ../../whatsnew/3.7.rst:552 msgid "" "The new :mod:`contextvars` module and a set of :ref:`new C APIs " "` introduce support for *context variables*. Context " "variables are conceptually similar to thread-local variables. Unlike TLS, " "context variables support asynchronous code correctly." msgstr "" +"新しい :mod:`contextvars` モジュールと一連の :ref:`新しい C API " +"` により、*コンテキスト変数* をサポートしました。\n" +"コンテキスト変数は概念的にはスレッドローカル変数に似ていますが、TLS と異なり" +"非同期コードも正しくサポートします。" -#: ../../whatsnew/3.7.rst:558 msgid "" "The :mod:`asyncio` and :mod:`decimal` modules have been updated to use and " "support context variables out of the box. Particularly the active decimal " "context is now stored in a context variable, which allows decimal operations " "to work with the correct context in asynchronous code." msgstr "" +":mod:`asyncio` と :mod:`decimal` モジュールが更新され、追加の設定なしでコンテ" +"キスト変数を使用、サポートするようになりました。\n" +"特に、現在の decimal コンテキストがコンテキスト変数に保存されるようになり、非" +"同期コードでも正しいコンテキストで decimal の演算を行えます。" #: ../../whatsnew/3.7.rst:565 msgid ":pep:`567` -- Context Variables" @@ -933,21 +1053,21 @@ msgstr "データクラス" msgid "" "The new :func:`~dataclasses.dataclass` decorator provides a way to declare " "*data classes*. A data class describes its attributes using class variable " -"annotations. Its constructor and other magic methods, such as :meth:" -"`~object.__repr__`, :meth:`~object.__eq__`, and :meth:`~object.__hash__` are " -"generated automatically." +"annotations. Its constructor and other magic methods, such " +"as :meth:`~object.__repr__`, :meth:`~object.__eq__`, " +"and :meth:`~object.__hash__` are generated automatically." msgstr "" "新しい :func:`~dataclasses.dataclass` デコレータにより *データクラス* を宣言" "する方法が提供されます。\n" "データクラスは属性を記述するのに、クラス変数アノテーションを使います。\n" -"コンストラクタや他の :meth:`~object.__repr__`, :meth:`~object.__eq__`, :meth:" -"`~object.__hash__` などのマジックメソッドは自動で生成されます。" +"コンストラクタや他" +"の :meth:`~object.__repr__`, :meth:`~object.__eq__`, :meth:`~object.__hash__` " +"などのマジックメソッドは自動で生成されます。" #: ../../whatsnew/3.7.rst:580 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../whatsnew/3.7.rst:582 msgid "" "@dataclass\n" "class Point:\n" @@ -958,6 +1078,14 @@ msgid "" "p = Point(1.5, 2.5)\n" "print(p) # produces \"Point(x=1.5, y=2.5, z=0.0)\"" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" y: float\n" +" z: float = 0.0\n" +"\n" +"p = Point(1.5, 2.5)\n" +"print(p) # 次を出力: \"Point(x=1.5, y=2.5, z=0.0)\"" #: ../../whatsnew/3.7.rst:593 msgid ":pep:`557` -- Data Classes" @@ -976,21 +1104,22 @@ msgid "" "The new :mod:`importlib.resources` module provides several new APIs and one " "new ABC for access to, opening, and reading *resources* inside packages. " "Resources are roughly similar to files inside packages, but they needn't be " -"actual files on the physical file system. Module loaders can provide a :" -"meth:`get_resource_reader` function which returns a :class:`importlib.abc." -"ResourceReader` instance to support this new API. Built-in file path " -"loaders and zip file loaders both support this." +"actual files on the physical file system. Module loaders can provide " +"a :meth:`get_resource_reader` function which returns " +"a :class:`importlib.abc.ResourceReader` instance to support this new API. " +"Built-in file path loaders and zip file loaders both support this." msgstr "" #: ../../whatsnew/3.7.rst:610 msgid "Contributed by Barry Warsaw and Brett Cannon in :issue:`32248`." msgstr "Contributed by Barry Warsaw and Brett Cannon in :issue:`32248`." -#: ../../whatsnew/3.7.rst:614 msgid "" "`importlib_resources `_ -- a PyPI backport for earlier Python versions." msgstr "" +"`importlib_resources `_ -- 古い Python バージョン向けの PyPI バックポート。" #: ../../whatsnew/3.7.rst:619 msgid "Improved Modules" @@ -1000,133 +1129,190 @@ msgstr "改良されたモジュール" msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.7.rst:625 msgid "" -"The new :meth:`ArgumentParser.parse_intermixed_args() ` method allows intermixing options and " -"positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" +"The new :meth:`ArgumentParser.parse_intermixed_args() " +"` method allows intermixing " +"options and positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" msgstr "" +"新しい :meth:`ArgumentParser.parse_intermixed_args() " +"` メソッドを使うと、オプション" +"と位置引数を混在させられます。\n" +"(Contributed by paul.j3 in :issue:`14191`.)" #: ../../whatsnew/3.7.rst:634 ../../whatsnew/3.7.rst:1964 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.7.rst:636 msgid "" -"The :mod:`asyncio` module has received many new features, usability and :ref:" -"`performance improvements `. Notable changes " -"include:" +"The :mod:`asyncio` module has received many new features, usability " +"and :ref:`performance improvements `. Notable " +"changes include:" msgstr "" +":mod:`asyncio` モジュールに多くの新機能が追加され、使いやすさと :ref:`性能が" +"改善されました `。\n" +"注目すべき変更は次のとおりです:" -#: ../../whatsnew/3.7.rst:640 msgid "" "The new :term:`provisional ` :func:`asyncio.run` function " "can be used to run a coroutine from synchronous code by automatically " -"creating and destroying the event loop. (Contributed by Yury Selivanov in :" -"issue:`32314`.)" +"creating and destroying the event loop. (Contributed by Yury Selivanov " +"in :issue:`32314`.)" msgstr "" +"新しい :term:`暫定的 ` な :func:`asyncio.run` 関数を使うと、" +"イベントループを自動的に作成、破棄して、同期コードからコルーチンを実行できま" +"す。\n" +"(Contributed by Yury Selivanov in :issue:`32314`.)" -#: ../../whatsnew/3.7.rst:645 msgid "" "asyncio gained support for :mod:`contextvars`. :meth:`loop.call_soon() " -"`, :meth:`loop.call_soon_threadsafe() `, :meth:`loop.call_later() `, :meth:`loop.call_at() `, and :meth:" -"`Future.add_done_callback() ` have a new " -"optional keyword-only *context* parameter. :class:`Tasks ` now " -"track their context automatically. See :pep:`567` for more details. " +"`, :meth:`loop.call_soon_threadsafe() " +"`, :meth:`loop.call_later() " +"`, :meth:`loop.call_at() `, " +"and :meth:`Future.add_done_callback() ` " +"have a new optional keyword-only *context* parameter. :class:`Tasks " +"` now track their context automatically. See :pep:`567` for " +"more details. (Contributed by Yury Selivanov in :issue:`32436`.)" +msgstr "" +"asyncio が :mod:`contextvars` に対応しました。\n" +":meth:`loop.call_soon() " +"`、:meth:`loop.call_soon_threadsafe() " +"`、:meth:`loop.call_later() " +"`、:meth:`loop.call_at() " +"`、:meth:`Future.add_done_callback() " +"` に、省略可能なキーワード専用パラメータ " +"*context* が追加されました。\n" +":class:`タスク ` は自分のコンテキストを自動的に追跡します。\n" +"詳しくは :pep:`567` を参照してください。\n" "(Contributed by Yury Selivanov in :issue:`32436`.)" -msgstr "" -#: ../../whatsnew/3.7.rst:656 msgid "" "The new :func:`asyncio.create_task` function has been added as a shortcut to " "``asyncio.get_event_loop().create_task()``. (Contributed by Andrew Svetlov " "in :issue:`32311`.)" msgstr "" +"``asyncio.get_event_loop().create_task()`` の省略形とし" +"て :func:`asyncio.create_task` 関数が追加されました。\n" +"(Contributed by Andrew Svetlov in :issue:`32311`.)" -#: ../../whatsnew/3.7.rst:660 msgid "" "The new :meth:`loop.start_tls() ` method can be used " -"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov in :" -"issue:`23749`.)" +"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov " +"in :issue:`23749`.)" msgstr "" +"新しい :meth:`loop.start_tls() ` メソッドを使うと、既" +"存の接続を TLS に切り替えられます。\n" +"(Contributed by Yury Selivanov in :issue:`23749`.)" -#: ../../whatsnew/3.7.rst:664 msgid "" "The new :meth:`loop.sock_recv_into() ` method " "allows reading data from a socket directly into a provided buffer making it " -"possible to reduce data copies. (Contributed by Antoine Pitrou in :issue:" -"`31819`.)" +"possible to reduce data copies. (Contributed by Antoine Pitrou " +"in :issue:`31819`.)" msgstr "" +"新しい :meth:`loop.sock_recv_into() ` メソッド" +"で、ソケットから指定のバッファへ直接データを読み込めるため、データのコピーを" +"減らせます。\n" +"(Contributed by Antoine Pitrou in :issue:`31819`.)" #: ../../whatsnew/3.7.rst:669 msgid "" -"The new :func:`asyncio.current_task` function returns the currently running :" -"class:`~asyncio.Task` instance, and the new :func:`asyncio.all_tasks` " -"function returns a set of all existing ``Task`` instances in a given loop. " -"The :meth:`!Task.current_task` and :meth:`!Task.all_tasks` methods have been " -"deprecated. (Contributed by Andrew Svetlov in :issue:`32250`.)" +"The new :func:`asyncio.current_task` function returns the currently " +"running :class:`~asyncio.Task` instance, and the " +"new :func:`asyncio.all_tasks` function returns a set of all existing " +"``Task`` instances in a given loop. The :meth:`!Task.current_task` " +"and :meth:`!Task.all_tasks` methods have been deprecated. (Contributed by " +"Andrew Svetlov in :issue:`32250`.)" msgstr "" -#: ../../whatsnew/3.7.rst:676 msgid "" "The new *provisional* :class:`~asyncio.BufferedProtocol` class allows " "implementing streaming protocols with manual control over the receive " "buffer. (Contributed by Yury Selivanov in :issue:`32251`.)" msgstr "" +"新しい *暫定的* な :class:`~asyncio.BufferedProtocol` クラスを使うと、受信" +"バッファを手動で制御するストリーミングプロトコルを実装できます。\n" +"(Contributed by Yury Selivanov in :issue:`32251`.)" -#: ../../whatsnew/3.7.rst:680 msgid "" "The new :func:`asyncio.get_running_loop` function returns the currently " "running loop, and raises a :exc:`RuntimeError` if no loop is running. This " "is in contrast with :func:`asyncio.get_event_loop`, which will *create* a " -"new event loop if none is running. (Contributed by Yury Selivanov in :issue:" -"`32269`.)" -msgstr "" - -#: ../../whatsnew/3.7.rst:686 -msgid "" -"The new :meth:`StreamWriter.wait_closed() ` coroutine method allows waiting until the stream writer is " -"closed. The new :meth:`StreamWriter.is_closing() ` method can be used to determine if the writer is closing. " +"new event loop if none is running. (Contributed by Yury Selivanov " +"in :issue:`32269`.)" +msgstr "" +"新しい :func:`asyncio.get_running_loop` 関数は現在実行中のループを返し、実行" +"中のループがなければ :exc:`RuntimeError` を送出します。\n" +"実行中のループがなければ新しいイベントループを *作成する" +"* :func:`asyncio.get_event_loop` とは異なります。\n" +"(Contributed by Yury Selivanov in :issue:`32269`.)" + +msgid "" +"The new :meth:`StreamWriter.wait_closed() " +"` coroutine method allows waiting until " +"the stream writer is closed. The new :meth:`StreamWriter.is_closing() " +"` method can be used to determine if the " +"writer is closing. (Contributed by Andrew Svetlov in :issue:`32391`.)" +msgstr "" +"新しいコルーチンメソッド :meth:`StreamWriter.wait_closed() " +"` で、ストリームライターが閉じられるまで待" +"機できます。\n" +"新しい :meth:`StreamWriter.is_closing() ` メ" +"ソッドは、ライターが終了処理中かどうかを調べます。\n" "(Contributed by Andrew Svetlov in :issue:`32391`.)" -msgstr "" -#: ../../whatsnew/3.7.rst:692 msgid "" "The new :meth:`loop.sock_sendfile() ` coroutine " "method allows sending files using :mod:`os.sendfile` when possible. " "(Contributed by Andrew Svetlov in :issue:`32410`.)" msgstr "" +"新しいコルーチンメソッド :meth:`loop.sock_sendfile() " +"` は、利用可能であれば :mod:`os.sendfile` を使っ" +"てファイルを送信します。\n" +"(Contributed by Andrew Svetlov in :issue:`32410`.)" -#: ../../whatsnew/3.7.rst:696 msgid "" -"The new :meth:`Future.get_loop() ` and ``Task." -"get_loop()`` methods return the instance of the loop on which a task or a " -"future were created. :meth:`Server.get_loop() ` " -"allows doing the same for :class:`asyncio.Server` objects. (Contributed by " -"Yury Selivanov in :issue:`32415` and Srinivas Reddy Thatiparthy in :issue:" -"`32418`.)" +"The new :meth:`Future.get_loop() ` and " +"``Task.get_loop()`` methods return the instance of the loop on which a task " +"or a future were created. :meth:`Server.get_loop() " +"` allows doing the same for :class:`asyncio.Server` " +"objects. (Contributed by Yury Selivanov in :issue:`32415` and Srinivas Reddy " +"Thatiparthy in :issue:`32418`.)" msgstr "" +"新しい :meth:`Future.get_loop() ` と " +"``Task.get_loop()`` メソッドは、タスクや Future が作成されたループのインスタ" +"ンスを返します。\n" +":class:`asyncio.Server` オブジェクトでは :meth:`Server.get_loop() " +"` で同じことができます。\n" +"(Contributed by Yury Selivanov in :issue:`32415` and Srinivas Reddy " +"Thatiparthy in :issue:`32418`.)" -#: ../../whatsnew/3.7.rst:704 msgid "" "It is now possible to control how instances of :class:`asyncio.Server` begin " "serving. Previously, the server would start serving immediately when " -"created. The new *start_serving* keyword argument to :meth:`loop." -"create_server() ` and :meth:`loop." -"create_unix_server() `, as well as :meth:" -"`Server.start_serving() `, and :meth:`Server." -"serve_forever() ` can be used to decouple " -"server instantiation and serving. The new :meth:`Server.is_serving() " -"` method returns ``True`` if the server is " -"serving. :class:`~asyncio.Server` objects are now asynchronous context " -"managers::" -msgstr "" +"created. The new *start_serving* keyword argument " +"to :meth:`loop.create_server() ` " +"and :meth:`loop.create_unix_server() `, as " +"well as :meth:`Server.start_serving() `, " +"and :meth:`Server.serve_forever() ` can be " +"used to decouple server instantiation and serving. The " +"new :meth:`Server.is_serving() ` method returns " +"``True`` if the server is serving. :class:`~asyncio.Server` objects are now " +"asynchronous context managers::" +msgstr "" +":class:`asyncio.Server` インスタンスが接続の受け付けを開始するタイミングを制" +"御できるようになりました。\n" +"以前はサーバーの作成直後に受け付けを開始していました。\n" +":meth:`loop.create_server() ` " +"と :meth:`loop.create_unix_server() ` の新し" +"い *start_serving* キーワード引数や、:meth:`Server.start_serving() " +"`、:meth:`Server.serve_forever() " +"` を使うと、サーバーの作成と受け付けを分離でき" +"ます。\n" +"新しい :meth:`Server.is_serving() ` メソッドは、" +"サーバーが接続を受け付けていれば ``True`` を返します。\n" +":class:`~asyncio.Server` オブジェクトは非同期コンテキストマネージャーになりま" +"した。 ::" -#: ../../whatsnew/3.7.rst:716 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -1135,103 +1321,145 @@ 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`.)" msgstr "(Contributed by Yury Selivanov in :issue:`32662`.)" -#: ../../whatsnew/3.7.rst:725 msgid "" -"Callback objects returned by :func:`loop.call_later() ` gained the new :meth:`when() ` method " -"which returns an absolute scheduled callback timestamp. (Contributed by " -"Andrew Svetlov in :issue:`32741`.)" +"Callback objects returned by :func:`loop.call_later() " +"` gained the new :meth:`when() " +"` method which returns an absolute scheduled " +"callback timestamp. (Contributed by Andrew Svetlov in :issue:`32741`.)" msgstr "" +":func:`loop.call_later() ` が返すコールバックオブ" +"ジェクトに :meth:`when() ` メソッドが追加され、コー" +"ルバックの実行予定の絶対タイムスタンプを返すようになりました。\n" +"(Contributed by Andrew Svetlov in :issue:`32741`.)" -#: ../../whatsnew/3.7.rst:731 msgid "" -"The :meth:`loop.create_datagram_endpoint() \\ ` method gained support for Unix sockets. " -"(Contributed by Quentin Dawans in :issue:`31245`.)" +"The :meth:`loop.create_datagram_endpoint() \\ " +"` method gained support for Unix " +"sockets. (Contributed by Quentin Dawans in :issue:`31245`.)" msgstr "" +":meth:`loop.create_datagram_endpoint() \\ " +"` メソッドが Unix ソケットに対応しまし" +"た。\n" +"(Contributed by Quentin Dawans in :issue:`31245`.)" -#: ../../whatsnew/3.7.rst:736 msgid "" "The :func:`asyncio.open_connection`, :func:`asyncio.start_server` " -"functions, :meth:`loop.create_connection() `, :meth:`loop.create_server() `, :meth:`loop.create_accepted_socket() ` methods and their corresponding UNIX socket " -"variants now accept the *ssl_handshake_timeout* keyword argument. " +"functions, :meth:`loop.create_connection() " +"`, :meth:`loop.create_server() " +"`, :meth:`loop.create_accepted_socket() " +"` methods and their corresponding UNIX " +"socket variants now accept the *ssl_handshake_timeout* keyword argument. " "(Contributed by Neil Aspinall in :issue:`29970`.)" msgstr "" +":func:`asyncio.open_connection`、:func:`asyncio.start_server` 関" +"数、:meth:`loop.create_connection() " +"`、:meth:`loop.create_server() " +"`、:meth:`loop.create_accepted_socket() " +"` メソッド、および対応する UNIX ソケッ" +"ト版が *ssl_handshake_timeout* キーワード引数を受け付けるようになりました。\n" +"(Contributed by Neil Aspinall in :issue:`29970`.)" -#: ../../whatsnew/3.7.rst:744 msgid "" "The new :meth:`Handle.cancelled() ` method returns " "``True`` if the callback was cancelled. (Contributed by Marat Sharafutdinov " "in :issue:`31943`.)" msgstr "" +"新しい :meth:`Handle.cancelled() ` メソッドは、コー" +"ルバックがキャンセルされていれば ``True`` を返します。\n" +"(Contributed by Marat Sharafutdinov in :issue:`31943`.)" -#: ../../whatsnew/3.7.rst:748 msgid "" -"The asyncio source has been converted to use the :keyword:`async`/:keyword:" -"`await` syntax. (Contributed by Andrew Svetlov in :issue:`32193`.)" +"The asyncio source has been converted to use " +"the :keyword:`async`/:keyword:`await` syntax. (Contributed by Andrew Svetlov " +"in :issue:`32193`.)" msgstr "" +"asyncio のソースコードが :keyword:`async`/:keyword:`await` 構文を使うように書" +"き換えられました。\n" +"(Contributed by Andrew Svetlov in :issue:`32193`.)" -#: ../../whatsnew/3.7.rst:752 msgid "" -"The new :meth:`ReadTransport.is_reading() ` method can be used to determine the reading state of the " -"transport. Additionally, calls to :meth:`ReadTransport.resume_reading() " -"` and :meth:`ReadTransport." -"pause_reading() ` are now idempotent. " -"(Contributed by Yury Selivanov in :issue:`32356`.)" +"The new :meth:`ReadTransport.is_reading() " +"` method can be used to determine the " +"reading state of the transport. Additionally, calls " +"to :meth:`ReadTransport.resume_reading() " +"` " +"and :meth:`ReadTransport.pause_reading() " +"` are now idempotent. (Contributed by " +"Yury Selivanov in :issue:`32356`.)" msgstr "" +"新しい :meth:`ReadTransport.is_reading() ` " +"メソッドで、トランスポートの読み込み状態を確認できます。\n" +"また :meth:`ReadTransport.resume_reading() " +"` " +"と :meth:`ReadTransport.pause_reading() " +"` の呼び出しは冪等になりました。\n" +"(Contributed by Yury Selivanov in :issue:`32356`.)" -#: ../../whatsnew/3.7.rst:760 msgid "" "Loop methods which accept socket paths now support passing :term:`path-like " -"objects `. (Contributed by Yury Selivanov in :issue:" -"`32066`.)" +"objects `. (Contributed by Yury Selivanov " +"in :issue:`32066`.)" msgstr "" +"ソケットのパスを受け付けるループのメソッドに :term:`パス類オブジェクト ` を渡せるようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`32066`.)" -#: ../../whatsnew/3.7.rst:764 msgid "" "In :mod:`asyncio` TCP sockets on Linux are now created with ``TCP_NODELAY`` " -"flag set by default. (Contributed by Yury Selivanov and Victor Stinner in :" -"issue:`27456`.)" +"flag set by default. (Contributed by Yury Selivanov and Victor Stinner " +"in :issue:`27456`.)" msgstr "" +"Linux の :mod:`asyncio` の TCP ソケットは、デフォルトで ``TCP_NODELAY`` フラ" +"グを設定して作成されるようになりました。\n" +"(Contributed by Yury Selivanov and Victor Stinner in :issue:`27456`.)" -#: ../../whatsnew/3.7.rst:768 msgid "" "Exceptions occurring in cancelled tasks are no longer logged. (Contributed " "by Yury Selivanov in :issue:`30508`.)" msgstr "" +"キャンセルされたタスクで発生した例外は、ログに記録されなくなりました。\n" +"(Contributed by Yury Selivanov in :issue:`30508`.)" -#: ../../whatsnew/3.7.rst:771 msgid "" "New ``WindowsSelectorEventLoopPolicy`` and " "``WindowsProactorEventLoopPolicy`` classes. (Contributed by Yury Selivanov " "in :issue:`33792`.)" msgstr "" +"``WindowsSelectorEventLoopPolicy`` と ``WindowsProactorEventLoopPolicy`` クラ" +"スが追加されました。\n" +"(Contributed by Yury Selivanov in :issue:`33792`.)" -#: ../../whatsnew/3.7.rst:775 msgid "" "Several ``asyncio`` APIs have been :ref:`deprecated `." msgstr "" +"いくつかの ``asyncio`` API が :ref:`非推奨になりました `。" #: ../../whatsnew/3.7.rst:780 msgid "binascii" msgstr "binascii" -#: ../../whatsnew/3.7.rst:782 msgid "" "The :func:`~binascii.b2a_uu` function now accepts an optional *backtick* " "keyword argument. When it's true, zeros are represented by ``'`'`` instead " "of spaces. (Contributed by Xiang Zhang in :issue:`30103`.)" msgstr "" +":func:`~binascii.b2a_uu` 関数に省略可能な *backtick* キーワード引数が追加され" +"ました。\n" +"真の場合、ゼロは空白ではなく ``'`'`` で表されます。\n" +"(Contributed by Xiang Zhang in :issue:`30103`.)" #: ../../whatsnew/3.7.rst:788 msgid "calendar" @@ -1263,7 +1491,6 @@ msgstr "" msgid "compileall" msgstr "compileall" -#: ../../whatsnew/3.7.rst:805 msgid "" ":func:`compileall.compile_dir` learned the new *invalidation_mode* " "parameter, which can be used to enable :ref:`hash-based .pyc invalidation " @@ -1271,6 +1498,12 @@ msgid "" "command line using the new ``--invalidation-mode`` argument. (Contributed by " "Benjamin Peterson in :issue:`31650`.)" msgstr "" +":func:`compileall.compile_dir` に *invalidation_mode* パラメータが追加さ" +"れ、:ref:`ハッシュベースの .pyc の無効化 ` を有効にできま" +"す。\n" +"コマンドラインからも新しい ``--invalidation-mode`` 引数で無効化方式を指定でき" +"ます。\n" +"(Contributed by Benjamin Peterson in :issue:`31650`.)" #: ../../whatsnew/3.7.rst:814 msgid "concurrent.futures" @@ -1278,14 +1511,14 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.7.rst:816 msgid "" -":class:`ProcessPoolExecutor ` and :" -"class:`ThreadPoolExecutor ` now " +":class:`ProcessPoolExecutor ` " +"and :class:`ThreadPoolExecutor ` now " "support the new *initializer* and *initargs* constructor arguments. " "(Contributed by Antoine Pitrou in :issue:`21423`.)" msgstr "" -":class:`ProcessPoolExecutor ` と :" -"class:`ThreadPoolExecutor ` が新しいコ" -"ンストラクタ引数 *initializer* と *initargs* をサポートするようになりまし" +":class:`ProcessPoolExecutor ` " +"と :class:`ThreadPoolExecutor ` が新し" +"いコンストラクタ引数 *initializer* と *initargs* をサポートするようになりまし" "た。\n" "(Contributed by Antoine Pitrou in :issue:`21423`.)" @@ -1304,20 +1537,23 @@ msgstr "" msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.7.rst:829 msgid "" "The new :func:`~contextlib.nullcontext` is a simpler and faster no-op " "context manager than :class:`~contextlib.ExitStack`. (Contributed by Jesse-" "Bakker in :issue:`10049`.)" msgstr "" +"新しい :func:`~contextlib.nullcontext` は、:class:`~contextlib.ExitStack` よ" +"り簡単で高速な、何もしないコンテキストマネージャーです。\n" +"(Contributed by Jesse-Bakker in :issue:`10049`.)" #: ../../whatsnew/3.7.rst:833 msgid "" -"The new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib." -"AbstractAsyncContextManager`, and :class:`~contextlib.AsyncExitStack` have " -"been added to complement their synchronous counterparts. (Contributed by " -"Jelle Zijlstra in :issue:`29679` and :issue:`30241`, and by Alexander Mohr " -"and Ilya Kulakov in :issue:`29302`.)" +"The " +"new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib.AbstractAsyncContextManager`, " +"and :class:`~contextlib.AsyncExitStack` have been added to complement their " +"synchronous counterparts. (Contributed by Jelle Zijlstra in :issue:`29679` " +"and :issue:`30241`, and by Alexander Mohr and Ilya Kulakov " +"in :issue:`29302`.)" msgstr "" #: ../../whatsnew/3.7.rst:842 @@ -1327,70 +1563,81 @@ msgstr "cProfile" #: ../../whatsnew/3.7.rst:844 msgid "" "The :mod:`cProfile` command line now accepts ``-m module_name`` as an " -"alternative to script path. (Contributed by Sanyam Khurana in :issue:" -"`21862`.)" +"alternative to script path. (Contributed by Sanyam Khurana " +"in :issue:`21862`.)" msgstr "" #: ../../whatsnew/3.7.rst:849 msgid "crypt" msgstr "crypt" -#: ../../whatsnew/3.7.rst:851 msgid "" "The :mod:`!crypt` module now supports the Blowfish hashing method. " "(Contributed by Serhiy Storchaka in :issue:`31664`.)" msgstr "" +":mod:`!crypt` モジュールが Blowfish ハッシュ方式に対応しました。\n" +"(Contributed by Serhiy Storchaka in :issue:`31664`.)" -#: ../../whatsnew/3.7.rst:854 msgid "" "The :func:`!mksalt` function now allows specifying the number of rounds for " "hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" msgstr "" +":func:`!mksalt` 関数で、ハッシュ計算のラウンド数を指定できるようになりまし" +"た。\n" +"(Contributed by Serhiy Storchaka in :issue:`31702`.)" #: ../../whatsnew/3.7.rst:859 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.7.rst:861 msgid "" "The new :meth:`datetime.fromisoformat() ` " "method constructs a :class:`~datetime.datetime` object from a string in one " -"of the formats output by :meth:`datetime.isoformat() `. (Contributed by Paul Ganssle in :issue:`15873`.)" +"of the formats output by :meth:`datetime.isoformat() " +"`. (Contributed by Paul Ganssle " +"in :issue:`15873`.)" msgstr "" +"新しい :meth:`datetime.fromisoformat() ` メ" +"ソッドは、:meth:`datetime.isoformat() ` が出力す" +"る形式の文字列から :class:`~datetime.datetime` オブジェクトを作成します。\n" +"(Contributed by Paul Ganssle in :issue:`15873`.)" -#: ../../whatsnew/3.7.rst:867 msgid "" "The :class:`tzinfo ` class now supports sub-minute offsets. " "(Contributed by Alexander Belopolsky in :issue:`5288`.)" msgstr "" +":class:`tzinfo ` クラスが、1 分未満の単位のオフセットに対応" +"しました。\n" +"(Contributed by Alexander Belopolsky in :issue:`5288`.)" #: ../../whatsnew/3.7.rst:872 ../../whatsnew/3.7.rst:1988 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.7.rst:874 msgid "" ":mod:`dbm.dumb` now supports reading read-only files and no longer writes " "the index file when it is not changed." msgstr "" +":mod:`dbm.dumb` が読み取り専用ファイルの読み込みに対応し、インデックスファイ" +"ルに変更がなければ書き込まないようになりました。" #: ../../whatsnew/3.7.rst:879 msgid "decimal" msgstr "decimal" -#: ../../whatsnew/3.7.rst:881 msgid "" "The :mod:`decimal` module now uses :ref:`context variables ` to store the decimal context. (Contributed by Yury Selivanov in :" -"issue:`32630`.)" +"pep567>` to store the decimal context. (Contributed by Yury Selivanov " +"in :issue:`32630`.)" msgstr "" +":mod:`decimal` モジュールが decimal コンテキストの保存に :ref:`コンテキスト変" +"数 ` を使うようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`32630`.)" #: ../../whatsnew/3.7.rst:887 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.7.rst:889 msgid "" "The :func:`~dis.dis` function is now able to disassemble nested code objects " "(the code of comprehensions, generator expressions and nested functions, and " @@ -1398,28 +1645,37 @@ msgid "" "disassembly recursion is controlled by the new *depth* parameter. " "(Contributed by Serhiy Storchaka in :issue:`11822`.)" msgstr "" +":func:`~dis.dis` 関数が入れ子のコードオブジェクト (内包表記、ジェネレータ式、" +"入れ子の関数のコードや、入れ子のクラスを作成するコード) を逆アセンブルできる" +"ようになりました。\n" +"再帰的な逆アセンブルの深さの上限は、新しい *depth* パラメータで制御します。\n" +"(Contributed by Serhiy Storchaka in :issue:`11822`.)" #: ../../whatsnew/3.7.rst:898 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.7.rst:900 msgid "" "``README.rst`` is now included in the list of distutils standard READMEs and " "therefore included in source distributions. (Contributed by Ryan Gonzalez " "in :issue:`11913`.)" msgstr "" +"``README.rst`` が distutils の標準 README のリストに追加され、ソース配布物に" +"含まれるようになりました。\n" +"(Contributed by Ryan Gonzalez in :issue:`11913`.)" #: ../../whatsnew/3.7.rst:906 ../../whatsnew/3.7.rst:1998 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.7.rst:908 msgid "" "The :class:`Enum ` learned the new ``_ignore_`` class property, " "which allows listing the names of properties which should not become enum " "members. (Contributed by Ethan Furman in :issue:`31801`.)" msgstr "" +":class:`Enum ` にクラスプロパティ ``_ignore_`` が追加され、列挙型" +"のメンバーにしないプロパティ名を列挙できるようになりました。\n" +"(Contributed by Ethan Furman in :issue:`31801`.)" #: ../../whatsnew/3.7.rst:913 msgid "" @@ -1445,52 +1701,67 @@ msgstr "" msgid "gc" msgstr "gc" -#: ../../whatsnew/3.7.rst:932 msgid "" "The new :func:`gc.freeze` function allows freezing all objects tracked by " "the garbage collector and excluding them from future collections. This can " "be used before a POSIX ``fork()`` call to make the GC copy-on-write friendly " "or to speed up collection. The new :func:`gc.unfreeze` functions reverses " "this operation. Additionally, :func:`gc.get_freeze_count` can be used to " -"obtain the number of frozen objects. (Contributed by Li Zekun in :issue:" -"`31558`.)" +"obtain the number of frozen objects. (Contributed by Li Zekun " +"in :issue:`31558`.)" msgstr "" +"新しい :func:`gc.freeze` 関数は、ガベージコレクタが追跡するすべてのオブジェク" +"トを凍結し、以降の回収の対象から除外します。\n" +"POSIX の ``fork()`` の前に使うと、GC とコピーオンライトの相性をよくしたり、回" +"収を高速化したりできます。\n" +"新しい :func:`gc.unfreeze` 関数はこの操作を元に戻します。\n" +"また :func:`gc.get_freeze_count` で凍結したオブジェクト数を取得できます。\n" +"(Contributed by Li Zekun in :issue:`31558`.)" #: ../../whatsnew/3.7.rst:942 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.7.rst:944 msgid "" "The :mod:`hmac` module now has an optimized one-shot :func:`~hmac.digest` " "function, which is up to three times faster than :func:`~hmac.HMAC`. " "(Contributed by Christian Heimes in :issue:`32433`.)" msgstr "" +":mod:`hmac` モジュールに最適化された単発計算用の :func:`~hmac.digest` 関数が" +"追加され、:func:`~hmac.HMAC` より最大 3 倍高速に処理できます。\n" +"(Contributed by Christian Heimes in :issue:`32433`.)" #: ../../whatsnew/3.7.rst:950 msgid "http.client" msgstr "http.client" -#: ../../whatsnew/3.7.rst:952 msgid "" -":class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` now support the new *blocksize* argument for improved " -"upload throughput. (Contributed by Nir Soffer in :issue:`31945`.)" +":class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` now support the new *blocksize* " +"argument for improved upload throughput. (Contributed by Nir Soffer " +"in :issue:`31945`.)" msgstr "" +":class:`~http.client.HTTPConnection` " +"と :class:`~http.client.HTTPSConnection` に *blocksize* 引数が追加され、アッ" +"プロードのスループットを改善できます。\n" +"(Contributed by Nir Soffer in :issue:`31945`.)" #: ../../whatsnew/3.7.rst:958 msgid "http.server" msgstr "http.server" -#: ../../whatsnew/3.7.rst:960 msgid "" ":class:`~http.server.SimpleHTTPRequestHandler` now supports the HTTP ``If-" "Modified-Since`` header. The server returns the 304 response status if the " "target file was not modified after the time specified in the header. " "(Contributed by Pierre Quentel in :issue:`29654`.)" msgstr "" +":class:`~http.server.SimpleHTTPRequestHandler` が HTTP の ``If-Modified-" +"Since`` ヘッダーに対応しました。\n" +"対象ファイルがヘッダーで指定された時刻以降に変更されていなければ、サーバーは" +"応答ステータス 304 を返します。\n" +"(Contributed by Pierre Quentel in :issue:`29654`.)" -#: ../../whatsnew/3.7.rst:965 msgid "" ":class:`~http.server.SimpleHTTPRequestHandler` accepts the new *directory* " "argument, in addition to the new ``--directory`` command line argument. With " @@ -1498,6 +1769,11 @@ msgid "" "uses the current working directory. (Contributed by Stéphane Wirtel and " "Julien Palard in :issue:`28707`.)" msgstr "" +":class:`~http.server.SimpleHTTPRequestHandler` に *directory* 引数が追加さ" +"れ、コマンドラインにも ``--directory`` 引数が追加されました。\n" +"サーバーはこの引数で指定されたディレクトリを配信し、デフォルトでは現在の作業" +"ディレクトリを使います。\n" +"(Contributed by Stéphane Wirtel and Julien Palard in :issue:`28707`.)" #: ../../whatsnew/3.7.rst:971 msgid "" @@ -1513,53 +1789,70 @@ msgstr "idlelib と IDLE" #: ../../whatsnew/3.7.rst:980 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" "自動補完におけるいくつもの修正。\n" "(Contributed by Louie Lu in :issue:`15786`.)" -#: ../../whatsnew/3.7.rst:982 msgid "" "Module Browser (on the File menu, formerly called Class Browser), now " "displays nested functions and classes in addition to top-level functions and " "classes. (Contributed by Guilherme Polo, Cheryl Sabella, and Terry Jan Reedy " "in :issue:`1612262`.)" msgstr "" +"File メニューの Module Browser (以前の Class Browser) が、トップレベルだけで" +"なく入れ子の関数やクラスも表示するようになりました。\n" +"(Contributed by Guilherme Polo, Cheryl Sabella, and Terry Jan Reedy " +"in :issue:`1612262`.)" -#: ../../whatsnew/3.7.rst:988 msgid "" "The Settings dialog (Options, Configure IDLE) has been partly rewritten to " "improve both appearance and function. (Contributed by Cheryl Sabella and " "Terry Jan Reedy in multiple issues.)" msgstr "" +"設定ダイアログ (Options の Configure IDLE) の一部が、見た目と機能を改善するた" +"めに書き直されました。\n" +"(Contributed by Cheryl Sabella and Terry Jan Reedy in multiple issues.)" -#: ../../whatsnew/3.7.rst:992 msgid "" "The font sample now includes a selection of non-Latin characters so that " "users can better see the effect of selecting a particular font. (Contributed " "by Terry Jan Reedy in :issue:`13802`.) The sample can be edited to include " "other characters. (Contributed by Serhiy Storchaka in :issue:`31860`.)" msgstr "" +"フォントのサンプルにラテン文字以外の文字も含まれるようになり、フォントを選ん" +"だ結果をよりよく確認できます。\n" +"(Terry Jan Reedy による貢献、:issue:`13802`。)\n" +"サンプルを編集してほかの文字を追加することもできます。\n" +"(Serhiy Storchaka による貢献、:issue:`31860`。)" -#: ../../whatsnew/3.7.rst:998 msgid "" "The IDLE features formerly implemented as extensions have been reimplemented " "as normal features. Their settings have been moved from the Extensions tab " "to other dialog tabs. (Contributed by Charles Wohlganger and Terry Jan Reedy " "in :issue:`27099`.)" msgstr "" +"従来は拡張として実装されていた IDLE の機能が通常の機能として再実装されまし" +"た。\n" +"その設定は Extensions タブからほかのダイアログのタブへ移されました。\n" +"(Contributed by Charles Wohlganger and Terry Jan Reedy in :issue:`27099`.)" -#: ../../whatsnew/3.7.rst:1003 msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" +"エディターのコードコンテキストオプションが改訂されました。\n" +"ボックスに maxlines までのすべてのコンテキスト行を表示します。\n" +"コンテキスト行をクリックすると、エディターがその行へ移動します。\n" +"設定ダイアログの Highlights タブに、カスタムテーマのコンテキストの色が追加さ" +"れました。\n" +"(Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" -#: ../../whatsnew/3.7.rst:1009 msgid "" "On Windows, a new API call tells Windows that tk scales for DPI. On Windows " "8.1+ or 10, with DPI compatibility properties of the Python binary " @@ -1567,12 +1860,17 @@ msgid "" "text and lines sharper. It should otherwise have no effect. (Contributed by " "Terry Jan Reedy in :issue:`33656`.)" msgstr "" +"Windows で新しい API 呼び出しを使い、tk が DPI に合わせて拡大縮小することを " +"Windows に通知するようになりました。\n" +"Windows 8.1 以降または 10 で、Python バイナリの DPI 互換性プロパティを変更し" +"ておらず、モニターの解像度が 96 DPI を超える場合、文字や線がより鮮明になるは" +"ずです。\n" +"それ以外の場合には影響しないはずです。\n" +"(Contributed by Terry Jan Reedy in :issue:`33656`.)" -#: ../../whatsnew/3.7.rst:1015 msgid "New in 3.7.1:" -msgstr "" +msgstr "3.7.1 の新機能:" -#: ../../whatsnew/3.7.rst:1017 msgid "" "Output over N lines (50 by default) is squeezed down to a button. N can be " "changed in the PyShell section of the General page of the Settings dialog. " @@ -1581,16 +1879,22 @@ msgid "" "button or into the clipboard or a separate window by right-clicking the " "button. (Contributed by Tal Einat in :issue:`1529353`.)" msgstr "" +"N 行 (デフォルトは 50 行) を超える出力は、一つのボタンに折り畳まれます。\n" +"N は設定ダイアログの General ページにある PyShell セクションで変更できま" +"す。\n" +"行数が少なくても各行が非常に長い場合などは、出力を右クリックして折り畳めま" +"す。\n" +"折り畳んだ出力は、ボタンのダブルクリックでその場に展開でき、右クリックでク" +"リップボードや別のウィンドウに展開できます。\n" +"(Contributed by Tal Einat in :issue:`1529353`.)" #: ../../whatsnew/3.7.rst:1024 msgid "The changes above have been backported to 3.6 maintenance releases." msgstr "上で挙げた変更は 3.6 のメンテナンスリリースにバックポートされました。" -#: ../../whatsnew/3.7.rst:1026 msgid "NEW in 3.7.4:" -msgstr "" +msgstr "3.7.4 の新機能:" -#: ../../whatsnew/3.7.rst:1028 msgid "" "Add \"Run Customized\" to the Run menu to run a module with customized " "settings. Any command line arguments entered are added to sys.argv. They re-" @@ -1598,19 +1902,31 @@ msgid "" "normal Shell main module restart. (Contributed by Cheryl Sabella, Terry Jan " "Reedy, and others in :issue:`5680` and :issue:`37627`.)" msgstr "" +"Run メニューに、設定を変更してモジュールを実行する \"Run Customized\" が追加" +"されました。\n" +"入力したコマンドライン引数は sys.argv に追加され、次回のカスタム実行時にも入" +"力欄に表示されます。\n" +"通常行われる Shell のメインモジュールの再起動を抑制することもできます。\n" +"(Contributed by Cheryl Sabella, Terry Jan Reedy, and others in :issue:`5680` " +"and :issue:`37627`.)" -#: ../../whatsnew/3.7.rst:1034 msgid "New in 3.7.5:" -msgstr "" +msgstr "3.7.5 の新機能:" -#: ../../whatsnew/3.7.rst:1036 msgid "" "Add optional line numbers for IDLE editor windows. Windows open without line " "numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" +"IDLE のエディターウィンドウに、必要に応じて行番号を表示できるようになりまし" +"た。\n" +"設定ダイアログの General タブで指定しない限り、行番号なしでウィンドウが開きま" +"す。\n" +"既存のウィンドウの行番号は Options メニューで表示、非表示を切り替えられま" +"す。\n" +"(Contributed by Tal Einat and Saimadhav Heblikar in :issue:`17535`.)" #: ../../whatsnew/3.7.rst:1044 ../../whatsnew/3.7.rst:2017 msgid "importlib" @@ -1619,23 +1935,25 @@ msgstr "importlib" #: ../../whatsnew/3.7.rst:1046 msgid "" "The :class:`importlib.abc.ResourceReader` ABC was introduced to support the " -"loading of resources from packages. See also :ref:" -"`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, Brett Cannon " -"in :issue:`32248`.)" +"loading of resources from packages. See " +"also :ref:`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, " +"Brett Cannon in :issue:`32248`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1051 msgid "" ":func:`importlib.reload` now raises :exc:`ModuleNotFoundError` if the module " "lacks a spec. (Contributed by Garvit Khatri in :issue:`29851`.)" msgstr "" +":func:`importlib.reload` は、モジュールに spec がない場合" +"に :exc:`ModuleNotFoundError` を送出するようになりました。\n" +"(Contributed by Garvit Khatri in :issue:`29851`.)" #: ../../whatsnew/3.7.rst:1055 msgid "" ":func:`importlib.find_spec` now raises :exc:`ModuleNotFoundError` instead " -"of :exc:`AttributeError` if the specified parent module is not a package (i." -"e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch in :" -"issue:`30436`.)" +"of :exc:`AttributeError` if the specified parent module is not a package " +"(i.e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch " +"in :issue:`30436`.)" msgstr "" #: ../../whatsnew/3.7.rst:1060 @@ -1649,25 +1967,31 @@ msgstr "" msgid "io" msgstr "io" -#: ../../whatsnew/3.7.rst:1068 msgid "" "The new :meth:`TextIOWrapper.reconfigure() ` " "method can be used to reconfigure the text stream with the new settings. " -"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki in :issue:" -"`15216`.)" +"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki " +"in :issue:`15216`.)" msgstr "" +"新しい :meth:`TextIOWrapper.reconfigure() ` メ" +"ソッドで、テキストストリームを新しい設定に変更できます。\n" +"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki " +"in :issue:`15216`.)" #: ../../whatsnew/3.7.rst:1075 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.7.rst:1077 msgid "" -"The new ``subnet_of()`` and ``supernet_of()`` methods of :class:`ipaddress." -"IPv6Network` and :class:`ipaddress.IPv4Network` can be used for network " -"containment tests. (Contributed by Michel Albert and Cheryl Sabella in :" -"issue:`20825`.)" +"The new ``subnet_of()`` and ``supernet_of()`` methods " +"of :class:`ipaddress.IPv6Network` and :class:`ipaddress.IPv4Network` can be " +"used for network containment tests. (Contributed by Michel Albert and Cheryl " +"Sabella in :issue:`20825`.)" msgstr "" +":class:`ipaddress.IPv6Network` と :class:`ipaddress.IPv4Network` の新しい " +"``subnet_of()``、``supernet_of()`` メソッドで、ネットワークの包含関係を検査で" +"きます。\n" +"(Contributed by Michel Albert and Cheryl Sabella in :issue:`20825`.)" #: ../../whatsnew/3.7.rst:1084 msgid "itertools" @@ -1675,28 +1999,31 @@ msgstr "itertools" #: ../../whatsnew/3.7.rst:1086 msgid "" -":func:`itertools.islice` now accepts :meth:`integer-like objects ` as start, stop, and slice arguments. (Contributed by Will " -"Roberts in :issue:`30537`.)" +":func:`itertools.islice` now accepts :meth:`integer-like objects " +"` as start, stop, and slice arguments. (Contributed by " +"Will Roberts in :issue:`30537`.)" msgstr "" #: ../../whatsnew/3.7.rst:1093 ../../whatsnew/3.7.rst:2035 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.7.rst:1095 msgid "" "The new *monetary* argument to :func:`locale.format_string` can be used to " "make the conversion use monetary thousands separators and grouping strings. " "(Contributed by Garvit in :issue:`10379`.)" msgstr "" +":func:`locale.format_string` の新しい *monetary* 引数を使うと、通貨用の桁区切" +"り文字とグループ化の指定で変換できます。\n" +"(Contributed by Garvit in :issue:`10379`.)" -#: ../../whatsnew/3.7.rst:1099 msgid "" "The :func:`locale.getpreferredencoding` function now always returns " "``'UTF-8'`` on Android or when in the :ref:`forced UTF-8 mode `." msgstr "" +":func:`locale.getpreferredencoding` 関数は、Android または :ref:`強制 UTF-8 " +"モード ` では常に ``'UTF-8'`` を返すようになりました。" #: ../../whatsnew/3.7.rst:1104 msgid "logging" @@ -1710,19 +2037,23 @@ msgstr "" ":class:`~logging.Logger` インスタンスが pickle 化できるようになりました。\n" "(Contributed by Vinay Sajip in :issue:`30520`.)" -#: ../../whatsnew/3.7.rst:1109 msgid "" "The new :meth:`StreamHandler.setStream() ` " "method can be used to replace the logger stream after handler creation. " "(Contributed by Vinay Sajip in :issue:`30522`.)" msgstr "" +"新しい :meth:`StreamHandler.setStream() ` メ" +"ソッドで、ハンドラーの作成後にログ出力先のストリームを置き換えられます。\n" +"(Contributed by Vinay Sajip in :issue:`30522`.)" -#: ../../whatsnew/3.7.rst:1113 msgid "" "It is now possible to specify keyword arguments to handler constructors in " "configuration passed to :func:`logging.config.fileConfig`. (Contributed by " "Preston Landers in :issue:`31080`.)" msgstr "" +":func:`logging.config.fileConfig` に渡す設定で、ハンドラーのコンストラクタの" +"キーワード引数を指定できるようになりました。\n" +"(Contributed by Preston Landers in :issue:`31080`.)" #: ../../whatsnew/3.7.rst:1119 msgid "math" @@ -1741,33 +2072,40 @@ msgstr "" msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.7.rst:1128 msgid "" "The MIME type of .bmp has been changed from ``'image/x-ms-bmp'`` to ``'image/" "bmp'``. (Contributed by Nitish Chandra in :issue:`22589`.)" msgstr "" +".bmp の MIME 型が ``'image/x-ms-bmp'`` から ``'image/bmp'`` に変更されまし" +"た。\n" +"(Contributed by Nitish Chandra in :issue:`22589`.)" #: ../../whatsnew/3.7.rst:1134 msgid "msilib" msgstr "msilib" -#: ../../whatsnew/3.7.rst:1136 msgid "" "The new :meth:`!Database.Close` method can be used to close the :abbr:`MSI` " "database. (Contributed by Berker Peksag in :issue:`20486`.)" msgstr "" +"新しい :meth:`!Database.Close` メソッドで :abbr:`MSI` データベースを閉じられ" +"ます。\n" +"(Contributed by Berker Peksag in :issue:`20486`.)" #: ../../whatsnew/3.7.rst:1142 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.7.rst:1144 msgid "" "The new :meth:`Process.close() ` method " "explicitly closes the process object and releases all resources associated " "with it. :exc:`ValueError` is raised if the underlying process is still " "running. (Contributed by Antoine Pitrou in :issue:`30596`.)" msgstr "" +"新しい :meth:`Process.close() ` メソッドは、プ" +"ロセスオブジェクトを明示的に閉じ、関連するすべてのリソースを解放します。\n" +"対象のプロセスがまだ実行中の場合は :exc:`ValueError` を送出します。\n" +"(Contributed by Antoine Pitrou in :issue:`30596`.)" #: ../../whatsnew/3.7.rst:1150 msgid "" @@ -1776,218 +2114,275 @@ msgid "" "(Contributed by Vitor Pereira in :issue:`30794`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1154 msgid "" "Non-daemonic threads created by :class:`~multiprocessing.Process` are now " "joined on process exit. (Contributed by Antoine Pitrou in :issue:`18966`.)" msgstr "" +":class:`~multiprocessing.Process` が作成した非デーモンスレッドは、プロセス終" +"了時に join されるようになりました。\n" +"(Contributed by Antoine Pitrou in :issue:`18966`.)" #: ../../whatsnew/3.7.rst:1160 msgid "os" msgstr "os" -#: ../../whatsnew/3.7.rst:1162 msgid "" ":func:`os.fwalk` now accepts the *path* argument as :class:`bytes`. " "(Contributed by Serhiy Storchaka in :issue:`28682`.)" msgstr "" +":func:`os.fwalk` の *path* 引数に :class:`bytes` を渡せるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`28682`.)" -#: ../../whatsnew/3.7.rst:1165 msgid "" ":func:`os.scandir` gained support for :ref:`file descriptors `. " "(Contributed by Serhiy Storchaka in :issue:`25996`.)" msgstr "" +":func:`os.scandir` が :ref:`ファイル記述子 ` に対応しました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25996`.)" -#: ../../whatsnew/3.7.rst:1168 msgid "" "The new :func:`~os.register_at_fork` function allows registering Python " -"callbacks to be executed at process fork. (Contributed by Antoine Pitrou in :" -"issue:`16500`.)" +"callbacks to be executed at process fork. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" +"新しい :func:`~os.register_at_fork` 関数で、プロセスの fork 時に実行する " +"Python コールバックを登録できます。\n" +"(Contributed by Antoine Pitrou in :issue:`16500`.)" -#: ../../whatsnew/3.7.rst:1172 msgid "" -"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` and :" -"func:`os.pread`) and :func:`os.pwritev` functions (combine the functionality " -"of :func:`os.writev` and :func:`os.pwrite`). (Contributed by Pablo Galindo " -"in :issue:`31368`.)" +"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` " +"and :func:`os.pread`) and :func:`os.pwritev` functions (combine the " +"functionality of :func:`os.writev` and :func:`os.pwrite`). (Contributed by " +"Pablo Galindo in :issue:`31368`.)" msgstr "" +":func:`os.preadv` (:func:`os.readv` と :func:`os.pread` の機能を組み合わせた" +"もの) と :func:`os.pwritev` (:func:`os.writev` と :func:`os.pwrite` の機能を" +"組み合わせたもの) が追加されました。\n" +"(Contributed by Pablo Galindo in :issue:`31368`.)" -#: ../../whatsnew/3.7.rst:1177 msgid "" "The mode argument of :func:`os.makedirs` no longer affects the file " "permission bits of newly created intermediate-level directories. " "(Contributed by Serhiy Storchaka in :issue:`19930`.)" msgstr "" +":func:`os.makedirs` の ``mode`` 引数は、新しく作成される中間ディレクトリのア" +"クセス権ビットに影響しなくなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`19930`.)" -#: ../../whatsnew/3.7.rst:1181 msgid "" ":func:`os.dup2` now returns the new file descriptor. Previously, ``None`` " "was always returned. (Contributed by Benjamin Peterson in :issue:`32441`.)" msgstr "" +":func:`os.dup2` は新しいファイル記述子を返すようになりました。\n" +"以前は常に ``None`` を返していました。\n" +"(Contributed by Benjamin Peterson in :issue:`32441`.)" -#: ../../whatsnew/3.7.rst:1185 msgid "" -"The structure returned by :func:`os.stat` now contains the :attr:`~os." -"stat_result.st_fstype` attribute on Solaris and its derivatives. " -"(Contributed by Jesús Cea Avión in :issue:`32659`.)" +"The structure returned by :func:`os.stat` now contains " +"the :attr:`~os.stat_result.st_fstype` attribute on Solaris and its " +"derivatives. (Contributed by Jesús Cea Avión in :issue:`32659`.)" msgstr "" +"Solaris とその派生 OS では、:func:`os.stat` が返す構造体" +"に :attr:`~os.stat_result.st_fstype` 属性が含まれるようになりました。\n" +"(Contributed by Jesús Cea Avión in :issue:`32659`.)" #: ../../whatsnew/3.7.rst:1191 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.7.rst:1193 msgid "" "The new :meth:`Path.is_mount() ` method is now " "available on POSIX systems and can be used to determine whether a path is a " "mount point. (Contributed by Cooper Ry Lees in :issue:`30897`.)" msgstr "" +"新しい :meth:`Path.is_mount() ` メソッドが POSIX シス" +"テムで利用でき、パスがマウントポイントかどうかを調べられます。\n" +"(Contributed by Cooper Ry Lees in :issue:`30897`.)" #: ../../whatsnew/3.7.rst:1199 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.7.rst:1201 msgid "" ":func:`pdb.set_trace` now takes an optional *header* keyword-only argument. " "If given, it is printed to the console just before debugging begins. " "(Contributed by Barry Warsaw in :issue:`31389`.)" msgstr "" +":func:`pdb.set_trace` に、省略可能なキーワード専用引数 *header* が追加されま" +"した。\n" +"指定すると、デバッグを開始する直前にコンソールに表示されます。\n" +"(Contributed by Barry Warsaw in :issue:`31389`.)" -#: ../../whatsnew/3.7.rst:1205 msgid "" ":mod:`pdb` command line now accepts ``-m module_name`` as an alternative to " "script file. (Contributed by Mario Corchero in :issue:`32206`.)" msgstr "" +":mod:`pdb` のコマンドラインで、スクリプトファイルの代わりに ``-m " +"module_name`` を指定できるようになりました。\n" +"(Contributed by Mario Corchero in :issue:`32206`.)" #: ../../whatsnew/3.7.rst:1210 msgid "py_compile" msgstr "py_compile" -#: ../../whatsnew/3.7.rst:1212 msgid "" ":func:`py_compile.compile` -- and by extension, :mod:`compileall` -- now " "respects the :envvar:`SOURCE_DATE_EPOCH` environment variable by " "unconditionally creating ``.pyc`` files for hash-based validation. This " -"allows for guaranteeing `reproducible builds `_ of ``.pyc`` files when they are created eagerly. (Contributed by " -"Bernhard M. Wiedemann in :issue:`29708`.)" +"allows for guaranteeing `reproducible builds `_ of ``.pyc`` files when they are created eagerly. (Contributed " +"by Bernhard M. Wiedemann in :issue:`29708`.)" msgstr "" +":func:`py_compile.compile` と、それを使う :mod:`compileall` は、環境変" +"数 :envvar:`SOURCE_DATE_EPOCH` が設定されている場合、無条件にハッシュベースの" +"検証用の ``.pyc`` ファイルを作成するようになりました。\n" +"これにより ``.pyc`` をあらかじめ作成する際に、`再現可能なビルド `_ を保証できます。\n" +"(Contributed by Bernhard M. Wiedemann in :issue:`29708`.)" #: ../../whatsnew/3.7.rst:1222 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.7.rst:1224 msgid "" "The pydoc server can now bind to an arbitrary hostname specified by the new " -"``-n`` command-line argument. (Contributed by Feanil Patel in :issue:" -"`31128`.)" +"``-n`` command-line argument. (Contributed by Feanil Patel " +"in :issue:`31128`.)" msgstr "" +"pydoc サーバーが、新しいコマンドライン引数 ``-n`` で指定した任意のホスト名に" +"バインドできるようになりました。\n" +"(Contributed by Feanil Patel in :issue:`31128`.)" #: ../../whatsnew/3.7.rst:1230 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.7.rst:1232 msgid "" "The new :class:`~queue.SimpleQueue` class is an unbounded :abbr:`FIFO` " "queue. (Contributed by Antoine Pitrou in :issue:`14976`.)" msgstr "" +"新しい :class:`~queue.SimpleQueue` クラスは、上限のない :abbr:`FIFO` キューで" +"す。\n" +"(Contributed by Antoine Pitrou in :issue:`14976`.)" #: ../../whatsnew/3.7.rst:1237 msgid "re" msgstr "re" -#: ../../whatsnew/3.7.rst:1239 msgid "" "The flags :const:`re.ASCII`, :const:`re.LOCALE` and :const:`re.UNICODE` can " -"be set within the scope of a group. (Contributed by Serhiy Storchaka in :" -"issue:`31690`.)" +"be set within the scope of a group. (Contributed by Serhiy Storchaka " +"in :issue:`31690`.)" msgstr "" +":const:`re.ASCII`、:const:`re.LOCALE`、:const:`re.UNICODE` フラグをグループの" +"スコープ内で設定できるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`31690`.)" -#: ../../whatsnew/3.7.rst:1243 msgid "" ":func:`re.split` now supports splitting on a pattern like ``r'\\b'``, " "``'^$'`` or ``(?=-)`` that matches an empty string. (Contributed by Serhiy " "Storchaka in :issue:`25054`.)" msgstr "" +":func:`re.split` が、空文字列にマッチする ``r'\\b'``、``'^$'``、``(?=-)`` な" +"どのパターンによる分割に対応しました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25054`.)" -#: ../../whatsnew/3.7.rst:1247 msgid "" "Regular expressions compiled with the :const:`re.LOCALE` flag no longer " "depend on the locale at compile time. Locale settings are applied only when " "the compiled regular expression is used. (Contributed by Serhiy Storchaka " "in :issue:`30215`.)" msgstr "" +":const:`re.LOCALE` フラグでコンパイルした正規表現は、コンパイル時のロケールに" +"依存しなくなりました。\n" +"ロケール設定はコンパイル済みの正規表現を使うときにのみ適用されます。\n" +"(Contributed by Serhiy Storchaka in :issue:`30215`.)" -#: ../../whatsnew/3.7.rst:1252 msgid "" ":exc:`FutureWarning` is now emitted if a regular expression contains " "character set constructs that will change semantically in the future, such " -"as nested sets and set operations. (Contributed by Serhiy Storchaka in :" -"issue:`30349`.)" +"as nested sets and set operations. (Contributed by Serhiy Storchaka " +"in :issue:`30349`.)" msgstr "" +"正規表現に、入れ子の集合や集合演算など、将来意味が変わる文字集合の構文が含ま" +"れる場合、:exc:`FutureWarning` が発生するようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`30349`.)" -#: ../../whatsnew/3.7.rst:1257 msgid "" -"Compiled regular expression and match objects can now be copied using :func:" -"`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy Storchaka in :" -"issue:`10076`.)" +"Compiled regular expression and match objects can now be copied " +"using :func:`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy " +"Storchaka in :issue:`10076`.)" msgstr "" +"コンパイル済みの正規表現オブジェクトとマッチオブジェクト" +"を、:func:`copy.copy` と :func:`copy.deepcopy` でコピーできるようになりまし" +"た。\n" +"(Contributed by Serhiy Storchaka in :issue:`10076`.)" #: ../../whatsnew/3.7.rst:1263 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.7.rst:1265 msgid "" "The new *warn_on_full_buffer* argument to the :func:`signal.set_wakeup_fd` " "function makes it possible to specify whether Python prints a warning on " "stderr when the wakeup buffer overflows. (Contributed by Nathaniel J. Smith " "in :issue:`30050`.)" msgstr "" +":func:`signal.set_wakeup_fd` の新しい *warn_on_full_buffer* 引数で、起床用" +"バッファがあふれたときに Python が stderr に警告を表示するかどうかを指定でき" +"ます。\n" +"(Contributed by Nathaniel J. Smith in :issue:`30050`.)" #: ../../whatsnew/3.7.rst:1272 ../../whatsnew/3.7.rst:2058 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.7.rst:1274 msgid "" "The new :func:`socket.getblocking() ` method " "returns ``True`` if the socket is in blocking mode and ``False`` otherwise. " "(Contributed by Yury Selivanov in :issue:`32373`.)" msgstr "" +"新しい :func:`socket.getblocking() ` メソッドは、" +"ソケットがブロッキングモードなら ``True``、そうでなければ ``False`` を返しま" +"す。\n" +"(Contributed by Yury Selivanov in :issue:`32373`.)" -#: ../../whatsnew/3.7.rst:1278 msgid "" "The new :func:`socket.close` function closes the passed socket file " "descriptor. This function should be used instead of :func:`os.close` for " -"better compatibility across platforms. (Contributed by Christian Heimes in :" -"issue:`32454`.)" +"better compatibility across platforms. (Contributed by Christian Heimes " +"in :issue:`32454`.)" msgstr "" +"新しい :func:`socket.close` 関数は、渡されたソケットのファイル記述子を閉じま" +"す。\n" +"プラットフォーム間の互換性を高めるため、:func:`os.close` の代わりにこの関数を" +"使ってください。\n" +"(Contributed by Christian Heimes in :issue:`32454`.)" #: ../../whatsnew/3.7.rst:1283 msgid "" "The :mod:`socket` module now exposes the :const:`socket.TCP_CONGESTION` " -"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), and :const:" -"`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed by Omar " -"Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" +"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), " +"and :const:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed " +"by Omar Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1289 msgid "" "Support for :const:`socket.AF_VSOCK` sockets has been added to allow " "communication between virtual machines and their hosts. (Contributed by " "Cathy Avery in :issue:`27584`.)" msgstr "" +":const:`socket.AF_VSOCK` ソケットがサポートされ、仮想マシンとホストの間で通信" +"できるようになりました。\n" +"(Contributed by Cathy Avery in :issue:`27584`.)" -#: ../../whatsnew/3.7.rst:1293 msgid "" "Sockets now auto-detect family, type and protocol from file descriptor by " "default. (Contributed by Christian Heimes in :issue:`28134`.)" msgstr "" +"ソケットはデフォルトで、ファイル記述子からファミリー、型、プロトコルを自動検" +"出するようになりました。\n" +"(Contributed by Christian Heimes in :issue:`28134`.)" #: ../../whatsnew/3.7.rst:1299 msgid "socketserver" @@ -2003,28 +2398,33 @@ msgstr "" #: ../../whatsnew/3.7.rst:1305 msgid "" "Add a new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute " -"to :class:`socketserver.ForkingMixIn` and :class:`socketserver." -"ThreadingMixIn` classes. Set the class attribute to ``False`` to get the " -"pre-3.7 behaviour." +"to :class:`socketserver.ForkingMixIn` " +"and :class:`socketserver.ThreadingMixIn` classes. Set the class attribute to " +"``False`` to get the pre-3.7 behaviour." msgstr "" #: ../../whatsnew/3.7.rst:1311 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.7.rst:1313 msgid "" -":class:`sqlite3.Connection` now exposes the :meth:`~sqlite3.Connection." -"backup` method when the underlying SQLite library is at version 3.6.11 or " -"higher. (Contributed by Lele Gaifax in :issue:`27645`.)" +":class:`sqlite3.Connection` now exposes " +"the :meth:`~sqlite3.Connection.backup` method when the underlying SQLite " +"library is at version 3.6.11 or higher. (Contributed by Lele Gaifax " +"in :issue:`27645`.)" msgstr "" +"使用する SQLite ライブラリが 3.6.11 以降の場合、:class:`sqlite3.Connection` " +"が :meth:`~sqlite3.Connection.backup` メソッドを公開するようになりました。\n" +"(Contributed by Lele Gaifax in :issue:`27645`.)" -#: ../../whatsnew/3.7.rst:1317 msgid "" -"The *database* argument of :func:`sqlite3.connect` now accepts any :term:" -"`path-like object`, instead of just a string. (Contributed by Anders " -"Lorentsen in :issue:`31843`.)" +"The *database* argument of :func:`sqlite3.connect` now accepts " +"any :term:`path-like object`, instead of just a string. (Contributed by " +"Anders Lorentsen in :issue:`31843`.)" msgstr "" +":func:`sqlite3.connect` の *database* 引数が、文字列だけでなく任意" +"の :term:`path-like object` を受け付けるようになりました。\n" +"(Contributed by Anders Lorentsen in :issue:`31843`.)" #: ../../whatsnew/3.7.rst:1323 ../../whatsnew/3.7.rst:2067 msgid "ssl" @@ -2032,39 +2432,44 @@ msgstr "ssl" #: ../../whatsnew/3.7.rst:1325 msgid "" -"The :mod:`ssl` module now uses OpenSSL's builtin API instead of :func:`~ssl." -"match_hostname` to check a host name or an IP address. Values are validated " -"during TLS handshake. Any certificate validation error including failing " -"the host name check now raises :exc:`~ssl.SSLCertVerificationError` and " -"aborts the handshake with a proper TLS Alert message. The new exception " -"contains additional information. Host name validation can be customized " -"with :attr:`SSLContext.hostname_checks_common_name `. (Contributed by Christian Heimes in :issue:" -"`31399`.)" +"The :mod:`ssl` module now uses OpenSSL's builtin API instead " +"of :func:`~ssl.match_hostname` to check a host name or an IP address. " +"Values are validated during TLS handshake. Any certificate validation error " +"including failing the host name check now " +"raises :exc:`~ssl.SSLCertVerificationError` and aborts the handshake with a " +"proper TLS Alert message. The new exception contains additional " +"information. Host name validation can be customized " +"with :attr:`SSLContext.hostname_checks_common_name " +"`. (Contributed by Christian " +"Heimes in :issue:`31399`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1336 msgid "" "The improved host name check requires a *libssl* implementation compatible " "with OpenSSL 1.0.2 or 1.1. Consequently, OpenSSL 0.9.8 and 1.0.1 are no " "longer supported (see :ref:`37-platform-support-removals` for more details). " "The ssl module is mostly compatible with LibreSSL 2.7.2 and newer." msgstr "" +"改善されたホスト名の検査には、OpenSSL 1.0.2 または 1.1 と互換性のある " +"*libssl* 実装が必要です。\n" +"そのため OpenSSL 0.9.8 と 1.0.1 はサポートされなくなりました (詳しく" +"は :ref:`37-platform-support-removals` を参照)。\n" +"ssl モジュールは LibreSSL 2.7.2 以降とおおむね互換性があります。" -#: ../../whatsnew/3.7.rst:1341 msgid "" "The ``ssl`` module no longer sends IP addresses in SNI TLS extension. " "(Contributed by Christian Heimes in :issue:`32185`.)" msgstr "" +"``ssl`` モジュールは SNI TLS 拡張で IP アドレスを送信しなくなりました。\n" +"(Contributed by Christian Heimes in :issue:`32185`.)" #: ../../whatsnew/3.7.rst:1344 msgid "" -":func:`~ssl.match_hostname` no longer supports partial wildcards like ``www*." -"example.org``. (Contributed by Mandeep Singh in :issue:`23033` and Christian " -"Heimes in :issue:`31399`.)" +":func:`~ssl.match_hostname` no longer supports partial wildcards like " +"``www*.example.org``. (Contributed by Mandeep Singh in :issue:`23033` and " +"Christian Heimes in :issue:`31399`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1349 msgid "" "The default cipher suite selection of the ``ssl`` module now uses a " "blacklist approach rather than a hard-coded whitelist. Python no longer re-" @@ -2072,184 +2477,257 @@ msgid "" "cipher suite selection can be configured at compile time. (Contributed by " "Christian Heimes in :issue:`31429`.)" msgstr "" +"``ssl`` モジュールのデフォルトの暗号スイートの選択方法は、固定の許可リストか" +"ら拒否リストに変わりました。\n" +"OpenSSL のセキュリティ更新で禁止された暗号方式を Python が再び有効にすること" +"はなくなりました。\n" +"デフォルトの暗号スイートの選択はコンパイル時に設定できます。\n" +"(Contributed by Christian Heimes in :issue:`31429`.)" -#: ../../whatsnew/3.7.rst:1355 msgid "" "Validation of server certificates containing internationalized domain names " -"(IDNs) is now supported. As part of this change, the :attr:`SSLSocket." -"server_hostname ` attribute now stores the " -"expected hostname in A-label form (``\"xn--pythn-mua.org\"``), rather than " -"the U-label form (``\"pythön.org\"``). (Contributed by Nathaniel J. Smith " -"and Christian Heimes in :issue:`28414`.)" +"(IDNs) is now supported. As part of this change, " +"the :attr:`SSLSocket.server_hostname ` " +"attribute now stores the expected hostname in A-label form (``\"xn--pythn-" +"mua.org\"``), rather than the U-label form (``\"pythön.org\"``). " +"(Contributed by Nathaniel J. Smith and Christian Heimes in :issue:`28414`.)" msgstr "" +"国際化ドメイン名 (IDN) を含むサーバー証明書の検証に対応しました。\n" +"この変更に伴い :attr:`SSLSocket.server_hostname " +"` 属性は、期待するホスト名を U-label 形式 " +"(``\"pythön.org\"``) ではなく A-label 形式 (``\"xn--pythn-mua.org\"``) で保存" +"するようになりました。\n" +"(Contributed by Nathaniel J. Smith and Christian Heimes in :issue:`28414`.)" -#: ../../whatsnew/3.7.rst:1362 msgid "" "The ``ssl`` module has preliminary and experimental support for TLS 1.3 and " "OpenSSL 1.1.1. At the time of Python 3.7.0 release, OpenSSL 1.1.1 is still " "under development and TLS 1.3 hasn't been finalized yet. The TLS 1.3 " "handshake and protocol behaves slightly differently than TLS 1.2 and " -"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes in :issue:" -"`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` and :issue:`33618`)" +"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes " +"in :issue:`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` " +"and :issue:`33618`)" msgstr "" +"``ssl`` モジュールに TLS 1.3 と OpenSSL 1.1.1 の予備的、実験的なサポートが追" +"加されました。\n" +"Python 3.7.0 のリリース時点で OpenSSL 1.1.1 はまだ開発中で、TLS 1.3 も確定し" +"ていません。\n" +"TLS 1.3 のハンドシェイクとプロトコルは TLS 1.2 以前と少し動作が異なります。\n" +":ref:`ssl-tlsv1_3` を参照してください。\n" +"(Contributed by Christian Heimes " +"in :issue:`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` " +"and :issue:`33618`)" -#: ../../whatsnew/3.7.rst:1370 msgid "" ":class:`~ssl.SSLSocket` and :class:`~ssl.SSLObject` no longer have a public " "constructor. Direct instantiation was never a documented and supported " -"feature. Instances must be created with :class:`~ssl.SSLContext` methods :" -"meth:`~ssl.SSLContext.wrap_socket` and :meth:`~ssl.SSLContext.wrap_bio`. " +"feature. Instances must be created with :class:`~ssl.SSLContext` " +"methods :meth:`~ssl.SSLContext.wrap_socket` " +"and :meth:`~ssl.SSLContext.wrap_bio`. (Contributed by Christian Heimes " +"in :issue:`32951`)" +msgstr "" +":class:`~ssl.SSLSocket` と :class:`~ssl.SSLObject` の公開コンストラクタがなく" +"なりました。\n" +"直接のインスタンス化は、これまでも文書化、サポートされた機能ではありませんで" +"した。\n" +"インスタンスは :class:`~ssl.SSLContext` " +"の :meth:`~ssl.SSLContext.wrap_socket` と :meth:`~ssl.SSLContext.wrap_bio` メ" +"ソッドで作成する必要があります。\n" "(Contributed by Christian Heimes in :issue:`32951`)" -msgstr "" -#: ../../whatsnew/3.7.rst:1376 msgid "" "OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol version " -"are available as :attr:`SSLContext.minimum_version ` and :attr:`SSLContext.maximum_version `. Supported protocols are indicated by several new flags, " -"such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by Christian Heimes in :issue:" -"`32609`.)" -msgstr "" - -#: ../../whatsnew/3.7.rst:1383 -msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" -msgstr "" +"are available as :attr:`SSLContext.minimum_version " +"` and :attr:`SSLContext.maximum_version " +"`. Supported protocols are indicated by " +"several new flags, such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by " +"Christian Heimes in :issue:`32609`.)" +msgstr "" +"TLS プロトコルの最小、最大バージョンを設定する OpenSSL 1.1 の API " +"が、:attr:`SSLContext.minimum_version ` " +"と :attr:`SSLContext.maximum_version ` として" +"利用できるようになりました。\n" +"サポートするプロトコルは :data:`~ssl.HAS_TLSv1_1` などの新しいフラグで示され" +"ます。\n" +"(Contributed by Christian Heimes in :issue:`32609`.)" + +msgid "" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" +msgstr "" +"TLS 1.3 のハンドシェイク後認証を有効にす" +"る :attr:`ssl.SSLContext.post_handshake_auth` と、それを開始す" +"る :meth:`ssl.SSLSocket.verify_client_post_handshake` が追加されました。\n" +"(Contributed by Christian Heimes in :gh:`78851`.)" #: ../../whatsnew/3.7.rst:1389 msgid "string" msgstr "string" -#: ../../whatsnew/3.7.rst:1391 msgid "" ":class:`string.Template` now lets you to optionally modify the regular " "expression pattern for braced placeholders and non-braced placeholders " "separately. (Contributed by Barry Warsaw in :issue:`1198569`.)" msgstr "" +":class:`string.Template` で、中括弧付きと中括弧なしのプレースホルダーの正規表" +"現パターンを個別に変更できるようになりました。\n" +"(Contributed by Barry Warsaw in :issue:`1198569`.)" #: ../../whatsnew/3.7.rst:1397 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.7.rst:1399 msgid "" "The :func:`subprocess.run` function accepts the new *capture_output* keyword " "argument. When true, stdout and stderr will be captured. This is equivalent " "to passing :const:`subprocess.PIPE` as *stdout* and *stderr* arguments. " "(Contributed by Bo Bayles in :issue:`32102`.)" msgstr "" +":func:`subprocess.run` 関数に *capture_output* キーワード引数が追加されまし" +"た。\n" +"真の場合、stdout と stderr をキャプチャします。\n" +"これは *stdout* と *stderr* 引数に :const:`subprocess.PIPE` を渡すことと同じ" +"です。\n" +"(Contributed by Bo Bayles in :issue:`32102`.)" -#: ../../whatsnew/3.7.rst:1405 msgid "" "The ``subprocess.run`` function and the :class:`subprocess.Popen` " "constructor now accept the *text* keyword argument as an alias to " "*universal_newlines*. (Contributed by Andrew Clegg in :issue:`31756`.)" msgstr "" +"``subprocess.run`` 関数と :class:`subprocess.Popen` コンストラクタに、" +"*universal_newlines* の別名として *text* キーワード引数が追加されました。\n" +"(Contributed by Andrew Clegg in :issue:`31756`.)" -#: ../../whatsnew/3.7.rst:1410 msgid "" "On Windows the default for *close_fds* was changed from ``False`` to " "``True`` when redirecting the standard handles. It's now possible to set " -"*close_fds* to true when redirecting the standard handles. See :class:" -"`subprocess.Popen`. This means that *close_fds* now defaults to ``True`` on " -"all supported platforms. (Contributed by Segev Finer in :issue:`19764`.)" -msgstr "" - -#: ../../whatsnew/3.7.rst:1417 -msgid "" -"The subprocess module is now more graceful when handling :exc:" -"`KeyboardInterrupt` during :func:`subprocess.call`, :func:`subprocess.run`, " -"or in a :class:`~subprocess.Popen` context manager. It now waits a short " -"amount of time for the child to exit, before continuing the handling of the " -"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith in :issue:" -"`25942`.)" -msgstr "" +"*close_fds* to true when redirecting the standard handles. " +"See :class:`subprocess.Popen`. This means that *close_fds* now defaults to " +"``True`` on all supported platforms. (Contributed by Segev Finer " +"in :issue:`19764`.)" +msgstr "" +"Windows で標準ハンドルをリダイレクトする場合、*close_fds* のデフォルト値が " +"``False`` から ``True`` に変わりました。\n" +"標準ハンドルのリダイレクト時にも *close_fds* を真に設定できるようになりまし" +"た。\n" +":class:`subprocess.Popen` を参照してください。\n" +"これにより、サポートするすべてのプラットフォームで *close_fds* のデフォルト" +"は ``True`` になります。\n" +"(Contributed by Segev Finer in :issue:`19764`.)" + +msgid "" +"The subprocess module is now more graceful when " +"handling :exc:`KeyboardInterrupt` " +"during :func:`subprocess.call`, :func:`subprocess.run`, or in " +"a :class:`~subprocess.Popen` context manager. It now waits a short amount " +"of time for the child to exit, before continuing the handling of the " +"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith " +"in :issue:`25942`.)" +msgstr "" +"subprocess モジュール" +"は :func:`subprocess.call`、:func:`subprocess.run`、:class:`~subprocess.Popen` " +"コンテキストマネージャー内での :exc:`KeyboardInterrupt` を、より穏当に処理す" +"るようになりました。\n" +"``KeyboardInterrupt`` 例外の処理を続ける前に、子プロセスの終了を短時間待ちま" +"す。\n" +"(Contributed by Gregory P. Smith in :issue:`25942`.)" #: ../../whatsnew/3.7.rst:1427 ../../whatsnew/3.7.rst:2083 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.7.rst:1429 msgid "" -"The new :func:`sys.breakpointhook` hook function is called by the built-in :" -"func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" +"The new :func:`sys.breakpointhook` hook function is called by the built-" +"in :func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" msgstr "" +"新しいフック関数 :func:`sys.breakpointhook` は、組み込み関" +"数 :func:`breakpoint` から呼び出されます。\n" +"(Contributed by Barry Warsaw in :issue:`31353`.)" -#: ../../whatsnew/3.7.rst:1433 msgid "" "On Android, the new :func:`sys.getandroidapilevel` returns the build-time " "Android API version. (Contributed by Victor Stinner in :issue:`28740`.)" msgstr "" +"Android では、新しい :func:`sys.getandroidapilevel` がビルド時の Android API " +"バージョンを返します。\n" +"(Contributed by Victor Stinner in :issue:`28740`.)" #: ../../whatsnew/3.7.rst:1437 msgid "" "The new :func:`sys.get_coroutine_origin_tracking_depth` function returns the " -"current coroutine origin tracking depth, as set by the new :func:`sys." -"set_coroutine_origin_tracking_depth`. :mod:`asyncio` has been converted to " -"use this new API instead of the deprecated :func:`sys." -"set_coroutine_wrapper`. (Contributed by Nathaniel J. Smith in :issue:" -"`32591`.)" +"current coroutine origin tracking depth, as set by the " +"new :func:`sys.set_coroutine_origin_tracking_depth`. :mod:`asyncio` has " +"been converted to use this new API instead of the " +"deprecated :func:`sys.set_coroutine_wrapper`. (Contributed by Nathaniel J. " +"Smith in :issue:`32591`.)" msgstr "" #: ../../whatsnew/3.7.rst:1446 msgid "time" msgstr "time" -#: ../../whatsnew/3.7.rst:1448 msgid "" -":pep:`564` adds six new functions with nanosecond resolution to the :mod:" -"`time` module:" +":pep:`564` adds six new functions with nanosecond resolution to " +"the :mod:`time` module:" msgstr "" +":pep:`564` により、ナノ秒の分解能を持つ六つの関数が :mod:`time` モジュールに" +"追加されました:" -#: ../../whatsnew/3.7.rst:1458 msgid "New clock identifiers have been added:" -msgstr "" +msgstr "新しいクロック識別子が追加されました:" -#: ../../whatsnew/3.7.rst:1460 msgid "" -":const:`time.CLOCK_BOOTTIME` (Linux): Identical to :const:`time." -"CLOCK_MONOTONIC`, except it also includes any time that the system is " -"suspended." +":const:`time.CLOCK_BOOTTIME` (Linux): Identical " +"to :const:`time.CLOCK_MONOTONIC`, except it also includes any time that the " +"system is suspended." msgstr "" +":const:`time.CLOCK_BOOTTIME` (Linux): :const:`time.CLOCK_MONOTONIC` と同じで" +"すが、システムがサスペンドしていた時間も含みます。" -#: ../../whatsnew/3.7.rst:1463 msgid "" ":const:`time.CLOCK_PROF` (FreeBSD, NetBSD and OpenBSD): High-resolution per-" "process CPU timer." msgstr "" +":const:`time.CLOCK_PROF` (FreeBSD、NetBSD、OpenBSD): プロセスごとの高分解能" +"の CPU タイマー。" -#: ../../whatsnew/3.7.rst:1465 msgid "" ":const:`time.CLOCK_UPTIME` (FreeBSD, OpenBSD): Time whose absolute value is " "the time the system has been running and not suspended, providing accurate " "uptime measurement." msgstr "" +":const:`time.CLOCK_UPTIME` (FreeBSD、OpenBSD): システムがサスペンドせずに稼働" +"していた時間を絶対値として持ち、稼働時間を正確に計測します。" -#: ../../whatsnew/3.7.rst:1469 msgid "" "The new :func:`time.thread_time` and :func:`time.thread_time_ns` functions " "can be used to get per-thread CPU time measurements. (Contributed by Antoine " "Pitrou in :issue:`32025`.)" msgstr "" +"新しい :func:`time.thread_time` と :func:`time.thread_time_ns` 関数で、スレッ" +"ドごとの CPU 時間を計測できます。\n" +"(Contributed by Antoine Pitrou in :issue:`32025`.)" -#: ../../whatsnew/3.7.rst:1473 msgid "" "The new :func:`time.pthread_getcpuclockid` function returns the clock ID of " "the thread-specific CPU-time clock." msgstr "" +"新しい :func:`time.pthread_getcpuclockid` 関数は、スレッド固有の CPU 時間ク" +"ロックの ID を返します。" #: ../../whatsnew/3.7.rst:1478 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.7.rst:1480 msgid "" "The new :class:`tkinter.ttk.Spinbox` class is now available. (Contributed by " "Alan Moore in :issue:`32585`.)" msgstr "" +":class:`tkinter.ttk.Spinbox` クラスが追加されました。\n" +"(Contributed by Alan Moore in :issue:`32585`.)" #: ../../whatsnew/3.7.rst:1485 msgid "tracemalloc" @@ -2269,100 +2747,126 @@ msgstr "" msgid "types" msgstr "types" -#: ../../whatsnew/3.7.rst:1499 msgid "" -"The new :class:`~types.WrapperDescriptorType`, :class:`~types." -"MethodWrapperType`, :class:`~types.MethodDescriptorType`, and :class:`~types." -"ClassMethodDescriptorType` classes are now available. (Contributed by Manuel " -"Krebber and Guido van Rossum in :issue:`29377`, and Serhiy Storchaka in :" -"issue:`32265`.)" +"The " +"new :class:`~types.WrapperDescriptorType`, :class:`~types.MethodWrapperType`, :class:`~types.MethodDescriptorType`, " +"and :class:`~types.ClassMethodDescriptorType` classes are now available. " +"(Contributed by Manuel Krebber and Guido van Rossum in :issue:`29377`, and " +"Serhiy Storchaka in :issue:`32265`.)" msgstr "" +":class:`~types.WrapperDescriptorType`、:class:`~types.MethodWrapperType`、:class:`~types.MethodDescriptorType`、:class:`~types.ClassMethodDescriptorType` " +"クラスが追加されました。\n" +"(Contributed by Manuel Krebber and Guido van Rossum in :issue:`29377`, and " +"Serhiy Storchaka in :issue:`32265`.)" -#: ../../whatsnew/3.7.rst:1505 msgid "" "The new :func:`types.resolve_bases` function resolves MRO entries " -"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi in :" -"issue:`32717`.)" +"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi " +"in :issue:`32717`.)" msgstr "" +"新しい :func:`types.resolve_bases` 関数は、:pep:`560` の定めに従って MRO エン" +"トリーを動的に解決します。\n" +"(Contributed by Ivan Levkivskyi in :issue:`32717`.)" #: ../../whatsnew/3.7.rst:1511 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.7.rst:1513 msgid "" "The internal :mod:`unicodedata` database has been upgraded to use `Unicode " "11 `_. (Contributed by " "Benjamin Peterson.)" msgstr "" +":mod:`unicodedata` の内部データベースが `Unicode 11 `_ に更新されました。\n" +"(Contributed by Benjamin Peterson.)" #: ../../whatsnew/3.7.rst:1519 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.7.rst:1521 msgid "" "The new ``-k`` command-line option allows filtering tests by a name " "substring or a Unix shell-like pattern. For example, ``python -m unittest -k " -"foo`` runs ``foo_tests.SomeTest.test_something``, ``bar_tests.SomeTest." -"test_foo``, but not ``bar_tests.FooTest.test_something``. (Contributed by " -"Jonas Haag in :issue:`32071`.)" -msgstr "" +"foo`` runs ``foo_tests.SomeTest.test_something``, " +"``bar_tests.SomeTest.test_foo``, but not " +"``bar_tests.FooTest.test_something``. (Contributed by Jonas Haag " +"in :issue:`32071`.)" +msgstr "" +"新しいコマンドラインオプション ``-k`` で、名前の部分文字列や Unix シェル風の" +"パターンによってテストを絞り込めます。\n" +"例えば ``python -m unittest -k foo`` は " +"``foo_tests.SomeTest.test_something`` と ``bar_tests.SomeTest.test_foo`` を実" +"行しますが、``bar_tests.FooTest.test_something`` は実行しません。\n" +"(Contributed by Jonas Haag in :issue:`32071`.)" #: ../../whatsnew/3.7.rst:1530 msgid "unittest.mock" msgstr "unittest.mock" -#: ../../whatsnew/3.7.rst:1532 msgid "" "The :const:`~unittest.mock.sentinel` attributes now preserve their identity " "when they are :mod:`copied ` or :mod:`pickled `. (Contributed " "by Serhiy Storchaka in :issue:`20804`.)" msgstr "" +":const:`~unittest.mock.sentinel` の属性は、:mod:`コピー ` " +"や :mod:`pickle 化 ` を行っても同一性を保持するようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`20804`.)" -#: ../../whatsnew/3.7.rst:1536 msgid "" -"The new :func:`~unittest.mock.seal` function allows sealing :class:" -"`~unittest.mock.Mock` instances, which will disallow further creation of " -"attribute mocks. The seal is applied recursively to all attributes that are " -"themselves mocks. (Contributed by Mario Corchero in :issue:`30541`.)" +"The new :func:`~unittest.mock.seal` function allows " +"sealing :class:`~unittest.mock.Mock` instances, which will disallow further " +"creation of attribute mocks. The seal is applied recursively to all " +"attributes that are themselves mocks. (Contributed by Mario Corchero " +"in :issue:`30541`.)" msgstr "" +"新しい :func:`~unittest.mock.seal` 関数で :class:`~unittest.mock.Mock` インス" +"タンスを封印し、それ以降の属性モックの作成を禁止できます。\n" +"封印は、属性自体がモックであるすべての属性にも再帰的に適用されます。\n" +"(Contributed by Mario Corchero in :issue:`30541`.)" #: ../../whatsnew/3.7.rst:1544 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.7.rst:1546 msgid "" ":func:`urllib.parse.quote` has been updated from :rfc:`2396` to :rfc:`3986`, " "adding ``~`` to the set of characters that are never quoted by default. " "(Contributed by Christian Theune and Ratnadeep Debnath in :issue:`16285`.)" msgstr "" +":func:`urllib.parse.quote` は :rfc:`2396` から :rfc:`3986` に対応が更新され、" +"デフォルトで常にクォートしない文字に ``~`` が追加されました。\n" +"(Contributed by Christian Theune and Ratnadeep Debnath in :issue:`16285`.)" #: ../../whatsnew/3.7.rst:1552 msgid "uu" msgstr "uu" -#: ../../whatsnew/3.7.rst:1554 msgid "" "The :func:`!uu.encode` function now accepts an optional *backtick* keyword " "argument. When it's true, zeros are represented by ``'`'`` instead of " "spaces. (Contributed by Xiang Zhang in :issue:`30103`.)" msgstr "" +":func:`!uu.encode` 関数に省略可能な *backtick* キーワード引数が追加されまし" +"た。\n" +"真の場合、ゼロは空白ではなく ``'`'`` で表されます。\n" +"(Contributed by Xiang Zhang in :issue:`30103`.)" #: ../../whatsnew/3.7.rst:1560 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.7.rst:1562 msgid "" "The new :attr:`UUID.is_safe ` attribute relays " "information from the platform about whether generated UUIDs are generated " -"with a multiprocessing-safe method. (Contributed by Barry Warsaw in :issue:" -"`22807`.)" +"with a multiprocessing-safe method. (Contributed by Barry Warsaw " +"in :issue:`22807`.)" msgstr "" +"新しい :attr:`UUID.is_safe ` 属性は、生成された UUID がマ" +"ルチプロセスに対して安全な方法で生成されたかどうか、プラットフォームからの情" +"報を伝えます。\n" +"(Contributed by Barry Warsaw in :issue:`22807`.)" -#: ../../whatsnew/3.7.rst:1567 msgid "" ":func:`uuid.getnode` now prefers universally administered MAC addresses over " "locally administered MAC addresses. This makes a better guarantee for global " @@ -2370,81 +2874,95 @@ msgid "" "administered MAC addresses are available, the first such one found is " "returned. (Contributed by Barry Warsaw in :issue:`32107`.)" msgstr "" +":func:`uuid.getnode` は、ローカル管理の MAC アドレスよりもユニバーサル管理の " +"MAC アドレスを優先するようになりました。\n" +"これにより :func:`uuid.uuid1` が返す UUID の世界全体での一意性がよりよく保証" +"されます。\n" +"ローカル管理の MAC アドレスしかない場合は、最初に見つかったものを返します。\n" +"(Contributed by Barry Warsaw in :issue:`32107`.)" #: ../../whatsnew/3.7.rst:1576 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.7.rst:1578 msgid "" "The initialization of the default warnings filters has changed as follows:" -msgstr "" +msgstr "デフォルトの警告フィルターの初期化が次のように変更されました:" -#: ../../whatsnew/3.7.rst:1580 msgid "" "warnings enabled via command line options (including those for :option:`-b` " "and the new CPython-specific :option:`-X` ``dev`` option) are always passed " "to the warnings machinery via the :data:`sys.warnoptions` attribute." msgstr "" +"コマンドラインオプションで有効にした警告 (:option:`-b` や新しい CPython 固有" +"の :option:`-X` ``dev`` を含む) は、常に :data:`sys.warnoptions` 属性を通じて" +"警告機構に渡されます。" -#: ../../whatsnew/3.7.rst:1584 msgid "" "warnings filters enabled via the command line or the environment now have " "the following order of precedence:" msgstr "" +"コマンドラインまたは環境変数で有効にした警告フィルターは、次の優先順位になり" +"ます:" -#: ../../whatsnew/3.7.rst:1587 msgid "the ``BytesWarning`` filter for :option:`-b` (or ``-bb``)" -msgstr "" +msgstr ":option:`-b` (または ``-bb``) の ``BytesWarning`` フィルター" -#: ../../whatsnew/3.7.rst:1588 msgid "any filters specified with the :option:`-W` option" -msgstr "" +msgstr ":option:`-W` オプションで指定したフィルター" -#: ../../whatsnew/3.7.rst:1589 msgid "" "any filters specified with the :envvar:`PYTHONWARNINGS` environment variable" -msgstr "" +msgstr "環境変数 :envvar:`PYTHONWARNINGS` で指定したフィルター" -#: ../../whatsnew/3.7.rst:1591 msgid "" "any other CPython specific filters (e.g. the ``default`` filter added for " "the new ``-X dev`` mode)" msgstr "" +"そのほかの CPython 固有のフィルター (例えば新しい ``-X dev`` モードで追加され" +"る ``default`` フィルター)" -#: ../../whatsnew/3.7.rst:1593 msgid "any implicit filters defined directly by the warnings machinery" -msgstr "" +msgstr "警告機構が直接定義する暗黙のフィルター" -#: ../../whatsnew/3.7.rst:1595 msgid "" "in :ref:`CPython debug builds `, all warnings are now displayed " "by default (the implicit filter list is empty)" msgstr "" +":ref:`CPython のデバッグビルド ` では、デフォルトですべての警告" +"を表示します (暗黙のフィルターリストは空です)。" -#: ../../whatsnew/3.7.rst:1598 msgid "" -"(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`, :issue:" -"`32043`, and :issue:`32230`.)" +"(Contributed by Nick Coghlan and Victor Stinner " +"in :issue:`20361`, :issue:`32043`, and :issue:`32230`.)" msgstr "" +"(Nick Coghlan と Victor Stinner による貢" +"献、:issue:`20361`、:issue:`32043`、:issue:`32230`。)" -#: ../../whatsnew/3.7.rst:1601 msgid "" "Deprecation warnings are once again shown by default in single-file scripts " "and at the interactive prompt. See :ref:`whatsnew37-pep565` for details. " "(Contributed by Nick Coghlan in :issue:`31975`.)" msgstr "" +"単一ファイルのスクリプトと対話型プロンプトでは、非推奨の警告が再びデフォルト" +"で表示されるようになりました。\n" +"詳しくは :ref:`whatsnew37-pep565` を参照してください。\n" +"(Contributed by Nick Coghlan in :issue:`31975`.)" #: ../../whatsnew/3.7.rst:1607 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.7.rst:1609 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" +"DTD や外部実体の取得による問題を軽減するため、:mod:`xml.dom.minidom` " +"と :mod:`xml.sax` モジュールはデフォルトでは外部実体を処理しなくなりまし" +"た。\n" +"(Contributed by Christian Heimes in :gh:`61441`.)" #: ../../whatsnew/3.7.rst:1616 msgid "xml.etree" @@ -2464,222 +2982,288 @@ msgstr "xmlrpc.server" #: ../../whatsnew/3.7.rst:1627 msgid "" -":meth:`SimpleXMLRPCDispatcher.register_function ` can now be used as a decorator. (Contributed by " -"Xiang Zhang in :issue:`7769`.)" +":meth:`SimpleXMLRPCDispatcher.register_function " +"` can now be used as a decorator. " +"(Contributed by Xiang Zhang in :issue:`7769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1633 msgid "zipapp" msgstr "zipapp" -#: ../../whatsnew/3.7.rst:1635 msgid "" "Function :func:`~zipapp.create_archive` now accepts an optional *filter* " "argument to allow the user to select which files should be included in the " "archive. (Contributed by Irmen de Jong in :issue:`31072`.)" msgstr "" +":func:`~zipapp.create_archive` 関数に省略可能な *filter* 引数が追加され、アー" +"カイブに含めるファイルを選べるようになりました。\n" +"(Contributed by Irmen de Jong in :issue:`31072`.)" -#: ../../whatsnew/3.7.rst:1639 msgid "" "Function :func:`~zipapp.create_archive` now accepts an optional *compressed* " "argument to generate a compressed archive. A command line option ``--" "compress`` has also been added to support compression. (Contributed by " "Zhiming Wang in :issue:`31638`.)" msgstr "" +":func:`~zipapp.create_archive` 関数に、圧縮アーカイブを生成するための省略可能" +"な *compressed* 引数が追加されました。\n" +"圧縮用のコマンドラインオプション ``--compress`` も追加されました。\n" +"(Contributed by Zhiming Wang in :issue:`31638`.)" #: ../../whatsnew/3.7.rst:1646 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.7.rst:1648 msgid "" ":class:`~zipfile.ZipFile` now accepts the new *compresslevel* parameter to " "control the compression level. (Contributed by Bo Bayles in :issue:`21417`.)" msgstr "" +":class:`~zipfile.ZipFile` に、圧縮レベルを制御する *compresslevel* パラメータ" +"が追加されました。\n" +"(Contributed by Bo Bayles in :issue:`21417`.)" -#: ../../whatsnew/3.7.rst:1652 msgid "" "Subdirectories in archives created by ``ZipFile`` are now stored in " "alphabetical order. (Contributed by Bernhard M. Wiedemann in :issue:`30693`.)" msgstr "" +"``ZipFile`` が作成するアーカイブのサブディレクトリは、アルファベット順に格納" +"されるようになりました。\n" +"(Contributed by Bernhard M. Wiedemann in :issue:`30693`.)" #: ../../whatsnew/3.7.rst:1658 msgid "C API Changes" msgstr "C API の変更" -#: ../../whatsnew/3.7.rst:1660 msgid "" -"A new API for thread-local storage has been implemented. See :ref:" -"`whatsnew37-pep539` for an overview and :ref:`thread-specific-storage-api` " -"for a complete reference. (Contributed by Masayuki Yamamoto in :issue:" -"`25658`.)" +"A new API for thread-local storage has been implemented. " +"See :ref:`whatsnew37-pep539` for an overview and :ref:`thread-specific-" +"storage-api` for a complete reference. (Contributed by Masayuki Yamamoto " +"in :issue:`25658`.)" msgstr "" +"スレッドローカルストレージ用の新しい API が実装されました。\n" +"概要は :ref:`whatsnew37-pep539`、完全なリファレンスは :ref:`thread-specific-" +"storage-api` を参照してください。\n" +"(Contributed by Masayuki Yamamoto in :issue:`25658`.)" -#: ../../whatsnew/3.7.rst:1665 msgid "" "The new :ref:`context variables ` functionality exposes a " "number of :ref:`new C APIs `." msgstr "" +"新しい :ref:`コンテキスト変数 ` の機能は、いくつも" +"の :ref:`新しい C API ` を公開します。" -#: ../../whatsnew/3.7.rst:1668 msgid "" "The new :c:func:`PyImport_GetModule` function returns the previously " -"imported module with the given name. (Contributed by Eric Snow in :issue:" -"`28411`.)" +"imported module with the given name. (Contributed by Eric Snow " +"in :issue:`28411`.)" msgstr "" +"新しい :c:func:`PyImport_GetModule` 関数は、指定した名前のインポート済みモ" +"ジュールを返します。\n" +"(Contributed by Eric Snow in :issue:`28411`.)" -#: ../../whatsnew/3.7.rst:1672 msgid "" "The new :c:macro:`Py_RETURN_RICHCOMPARE` macro eases writing rich comparison " "functions. (Contributed by Petr Victorin in :issue:`23699`.)" msgstr "" +"新しい :c:macro:`Py_RETURN_RICHCOMPARE` マクロにより、リッチ比較関数を簡単に" +"記述できます。\n" +"(Contributed by Petr Victorin in :issue:`23699`.)" -#: ../../whatsnew/3.7.rst:1676 msgid "" "The new :c:macro:`Py_UNREACHABLE` macro can be used to mark unreachable code " "paths. (Contributed by Barry Warsaw in :issue:`31338`.)" msgstr "" +"新しい :c:macro:`Py_UNREACHABLE` マクロを使うと、到達不能なコードの経路を示せ" +"ます。\n" +"(Contributed by Barry Warsaw in :issue:`31338`.)" -#: ../../whatsnew/3.7.rst:1680 msgid "" -"The :mod:`tracemalloc` now exposes a C API through the new :c:func:" -"`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` functions. " -"(Contributed by Victor Stinner in :issue:`30054`.)" +"The :mod:`tracemalloc` now exposes a C API through the " +"new :c:func:`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` " +"functions. (Contributed by Victor Stinner in :issue:`30054`.)" msgstr "" +":mod:`tracemalloc` は、新しい :c:func:`PyTraceMalloc_Track` " +"と :c:func:`PyTraceMalloc_Untrack` 関数を通じて C API を公開するようになりま" +"した。\n" +"(Contributed by Victor Stinner in :issue:`30054`.)" #: ../../whatsnew/3.7.rst:1685 msgid "" -"The new :c:func:`import__find__load__start` and :c:func:" -"`import__find__load__done` static markers can be used to trace module " -"imports. (Contributed by Christian Heimes in :issue:`31574`.)" +"The new :c:func:`import__find__load__start` " +"and :c:func:`import__find__load__done` static markers can be used to trace " +"module imports. (Contributed by Christian Heimes in :issue:`31574`.)" msgstr "" #: ../../whatsnew/3.7.rst:1690 msgid "" -"The fields :c:member:`!name` and :c:member:`!doc` of structures :c:type:" -"`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:" -"type:`PyStructSequence_Desc`, and :c:struct:`wrapperbase` are now of type " -"``const char *`` rather of ``char *``. (Contributed by Serhiy Storchaka in :" -"issue:`28761`.)" +"The fields :c:member:`!name` and :c:member:`!doc` of " +"structures :c:type:`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`, " +"and :c:struct:`wrapperbase` are now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1696 msgid "" -"The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:" -"`PyUnicode_AsUTF8` is now of type ``const char *`` rather of ``char *``. " -"(Contributed by Serhiy Storchaka in :issue:`28769`.)" +"The result of :c:func:`PyUnicode_AsUTF8AndSize` " +"and :c:func:`PyUnicode_AsUTF8` is now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28769`.)" msgstr "" +":c:func:`PyUnicode_AsUTF8AndSize` と :c:func:`PyUnicode_AsUTF8` の戻り値の型" +"が、``char *`` から ``const char *`` に変わりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`28769`.)" -#: ../../whatsnew/3.7.rst:1700 msgid "" -"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` and :c:" -"func:`PyMapping_Items` is now always a list, rather than a list or a tuple. " -"(Contributed by Oren Milman in :issue:`28280`.)" +"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` " +"and :c:func:`PyMapping_Items` is now always a list, rather than a list or a " +"tuple. (Contributed by Oren Milman in :issue:`28280`.)" msgstr "" +":c:func:`PyMapping_Keys`、:c:func:`PyMapping_Values`、:c:func:`PyMapping_Items` " +"の戻り値は、リストまたはタプルではなく常にリストになりました。\n" +"(Contributed by Oren Milman in :issue:`28280`.)" -#: ../../whatsnew/3.7.rst:1704 msgid "" -"Added functions :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka in :issue:`27867`.)" +"Added functions :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" +":c:func:`PySlice_Unpack` と :c:func:`PySlice_AdjustIndices` 関数が追加されま" +"した。\n" +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" -#: ../../whatsnew/3.7.rst:1707 msgid "" -":c:func:`PyOS_AfterFork` is deprecated in favour of the new functions :c:" -"func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` and :c:func:" -"`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou in :issue:`16500`.)" +":c:func:`PyOS_AfterFork` is deprecated in favour of the new " +"functions :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" +":c:func:`PyOS_AfterFork` が非推奨になりました。\n" +"代わりに新し" +"い :c:func:`PyOS_BeforeFork`、:c:func:`PyOS_AfterFork_Parent`、:c:func:`PyOS_AfterFork_Child` " +"関数を使ってください。\n" +"(Contributed by Antoine Pitrou in :issue:`16500`.)" -#: ../../whatsnew/3.7.rst:1712 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`." +"during finalization of the interpreter. Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`." msgstr "" +"公開 API の一部だったシングルトン ``PyExc_RecursionErrorInst`` が削除されまし" +"た。\n" +"そのメンバーがクリアされないため、インタープリタの終了処理中にセグメンテー" +"ション違反を引き起こす可能性がありました。\n" +"Xavier de Gaye による貢献、:issue:`22898`、:issue:`30697`。" -#: ../../whatsnew/3.7.rst:1717 msgid "" -"Added C API support for timezones with timezone constructors :c:func:" -"`PyTimeZone_FromOffset` and :c:func:`PyTimeZone_FromOffsetAndName`, and " -"access to the UTC singleton with :c:data:`PyDateTime_TimeZone_UTC`. " -"Contributed by Paul Ganssle in :issue:`10381`." +"Added C API support for timezones with timezone " +"constructors :c:func:`PyTimeZone_FromOffset` " +"and :c:func:`PyTimeZone_FromOffsetAndName`, and access to the UTC singleton " +"with :c:data:`PyDateTime_TimeZone_UTC`. Contributed by Paul Ganssle " +"in :issue:`10381`." msgstr "" +"タイムゾーンの C API として、コンストラク" +"タ :c:func:`PyTimeZone_FromOffset`、:c:func:`PyTimeZone_FromOffsetAndName` " +"と、UTC シングルトンへのアクセスを提供する :c:data:`PyDateTime_TimeZone_UTC` " +"が追加されました。\n" +"Paul Ganssle による貢献、:issue:`10381`。" #: ../../whatsnew/3.7.rst:1722 msgid "" -"The type of results of :c:func:`PyThread_start_new_thread` and :c:func:" -"`PyThread_get_thread_ident`, and the *id* parameter of :c:func:" -"`PyThreadState_SetAsyncExc` changed from :c:expr:`long` to :c:expr:`unsigned " -"long`. (Contributed by Serhiy Storchaka in :issue:`6532`.)" +"The type of results of :c:func:`PyThread_start_new_thread` " +"and :c:func:`PyThread_get_thread_ident`, and the *id* parameter " +"of :c:func:`PyThreadState_SetAsyncExc` changed from :c:expr:`long` " +"to :c:expr:`unsigned long`. (Contributed by Serhiy Storchaka " +"in :issue:`6532`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1728 msgid "" ":c:func:`PyUnicode_AsWideCharString` now raises a :exc:`ValueError` if the " "second argument is ``NULL`` and the :c:expr:`wchar_t*` string contains null " "characters. (Contributed by Serhiy Storchaka in :issue:`30708`.)" msgstr "" +":c:func:`PyUnicode_AsWideCharString` は、第 2 引数が ``NULL`` " +"で :c:expr:`wchar_t*` 文字列にヌル文字が含まれる場合、:exc:`ValueError` を送" +"出するようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`30708`.)" -#: ../../whatsnew/3.7.rst:1732 msgid "" "Changes to the startup sequence and the management of dynamic memory " -"allocators mean that the long documented requirement to call :c:func:" -"`Py_Initialize` before calling most C API functions is now relied on more " -"heavily, and failing to abide by it may lead to segfaults in embedding " -"applications. See the :ref:`porting-to-python-37` section in this document " -"and the :ref:`pre-init-safe` section in the C API documentation for more " -"details." -msgstr "" +"allocators mean that the long documented requirement to " +"call :c:func:`Py_Initialize` before calling most C API functions is now " +"relied on more heavily, and failing to abide by it may lead to segfaults in " +"embedding applications. See the :ref:`porting-to-python-37` section in this " +"document and the :ref:`pre-init-safe` section in the C API documentation for " +"more details." +msgstr "" +"起動手順と動的メモリアロケータの管理の変更により、多くの C API 関数を呼ぶ前" +"に :c:func:`Py_Initialize` を呼ぶという、以前から文書化された要件がより重要に" +"なりました。\n" +"守らない場合、Python を埋め込むアプリケーションでセグメンテーション違反が起き" +"る可能性があります。\n" +"詳しくは、この文書の :ref:`porting-to-python-37` と C API ドキュメント" +"の :ref:`pre-init-safe` を参照してください。" -#: ../../whatsnew/3.7.rst:1740 msgid "" "The new :c:func:`PyInterpreterState_GetID` returns the unique ID for a given " "interpreter. (Contributed by Eric Snow in :issue:`29102`.)" msgstr "" +"新しい :c:func:`PyInterpreterState_GetID` は、指定されたインタープリタの一意" +"な ID を返します。\n" +"(Contributed by Eric Snow in :issue:`29102`.)" -#: ../../whatsnew/3.7.rst:1744 msgid "" ":c:func:`Py_DecodeLocale`, :c:func:`Py_EncodeLocale` now use the UTF-8 " "encoding when the :ref:`UTF-8 mode ` is enabled. " "(Contributed by Victor Stinner in :issue:`29240`.)" msgstr "" +":c:func:`Py_DecodeLocale` と :c:func:`Py_EncodeLocale` は、:ref:`UTF-8 モー" +"ド ` が有効なときに UTF-8 エンコーディングを使うようになり" +"ました。\n" +"(Contributed by Victor Stinner in :issue:`29240`.)" -#: ../../whatsnew/3.7.rst:1748 msgid "" ":c:func:`PyUnicode_DecodeLocaleAndSize` and :c:func:`PyUnicode_EncodeLocale` " "now use the current locale encoding for ``surrogateescape`` error handler. " "(Contributed by Victor Stinner in :issue:`29240`.)" msgstr "" +":c:func:`PyUnicode_DecodeLocaleAndSize` と :c:func:`PyUnicode_EncodeLocale` " +"は、``surrogateescape`` エラーハンドラーで現在のロケールのエンコーディングを" +"使うようになりました。\n" +"(Contributed by Victor Stinner in :issue:`29240`.)" -#: ../../whatsnew/3.7.rst:1752 msgid "" "The *start* and *end* parameters of :c:func:`PyUnicode_FindChar` are now " -"adjusted to behave like string slices. (Contributed by Xiang Zhang in :issue:" -"`28822`.)" +"adjusted to behave like string slices. (Contributed by Xiang Zhang " +"in :issue:`28822`.)" msgstr "" +":c:func:`PyUnicode_FindChar` の *start* と *end* パラメータは、文字列のスライ" +"スと同じ動作になるように調整されるようになりました。\n" +"(Contributed by Xiang Zhang in :issue:`28822`.)" -#: ../../whatsnew/3.7.rst:1758 msgid "Build Changes" -msgstr "" +msgstr "ビルドの変更" -#: ../../whatsnew/3.7.rst:1760 msgid "" -"Support for building ``--without-threads`` has been removed. The :mod:" -"`threading` module is now always available. (Contributed by Antoine Pitrou " -"in :issue:`31370`.)." +"Support for building ``--without-threads`` has been removed. " +"The :mod:`threading` module is now always available. (Contributed by Antoine " +"Pitrou in :issue:`31370`.)." msgstr "" +"``--without-threads`` を指定したビルドのサポートが削除されました。\n" +":mod:`threading` モジュールは常に利用可能になりました。\n" +"(Contributed by Antoine Pitrou in :issue:`31370`.)" -#: ../../whatsnew/3.7.rst:1764 msgid "" -"A full copy of libffi is no longer bundled for use when building the :mod:" -"`_ctypes ` module on non-OSX UNIX platforms. An installed copy of " -"libffi is now required when building ``_ctypes`` on such platforms. " +"A full copy of libffi is no longer bundled for use when building " +"the :mod:`_ctypes ` module on non-OSX UNIX platforms. An installed " +"copy of libffi is now required when building ``_ctypes`` on such platforms. " "(Contributed by Zachary Ware in :issue:`27979`.)" msgstr "" +"OSX 以外の UNIX プラットフォームで :mod:`_ctypes ` モジュールをビルド" +"するための、libffi の完全なコピーは同梱されなくなりました。\n" +"これらの環境で ``_ctypes`` をビルドするには、libffi がインストールされている" +"必要があります。\n" +"(Contributed by Zachary Ware in :issue:`27979`.)" -#: ../../whatsnew/3.7.rst:1769 msgid "" "The Windows build process no longer depends on Subversion to pull in " "external sources, a Python script is used to download zipfiles from GitHub " @@ -2687,6 +3271,12 @@ msgid "" "is used to download a copy of 32-bit Python for this purpose. (Contributed " "by Zachary Ware in :issue:`30450`.)" msgstr "" +"Windows のビルド手順は、外部ソースの取得に Subversion を使わなくなりまし" +"た。\n" +"代わりに Python スクリプトで GitHub から ZIP ファイルをダウンロードします。\n" +"システムで ``py -3.6`` によって Python 3.6 が見つからない場合は、この用途のた" +"めに NuGet で 32 ビット Python をダウンロードします。\n" +"(Contributed by Zachary Ware in :issue:`30450`.)" #: ../../whatsnew/3.7.rst:1775 msgid "" @@ -2700,107 +3290,140 @@ msgstr "" msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.7.rst:1786 msgid "" "The overhead of calling many methods of various standard library classes " "implemented in C has been significantly reduced by porting more code to use " -"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner in :issue:" -"`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" +"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner " +"in :issue:`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" msgstr "" +"より多くのコードを ``METH_FASTCALL`` 規約に移行した結果、C で実装された標準ラ" +"イブラリの各種クラスの多くのメソッドで、呼び出しのオーバーヘッドが大幅に減り" +"ました。\n" +"(Contributed by Victor Stinner " +"in :issue:`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" -#: ../../whatsnew/3.7.rst:1792 msgid "" "Various optimizations have reduced Python startup time by 10% on Linux and " -"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in :issue:" -"`29585`, and Ivan Levkivskyi in :issue:`31333`.)" +"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki " +"in :issue:`29585`, and Ivan Levkivskyi in :issue:`31333`.)" msgstr "" +"さまざまな最適化によって、Python の起動時間が Linux で 10%、macOS で最大 30% " +"短くなりました。\n" +"(Contributed by Victor Stinner, INADA Naoki in :issue:`29585`, and Ivan " +"Levkivskyi in :issue:`31333`.)" -#: ../../whatsnew/3.7.rst:1797 msgid "" "Method calls are now up to 20% faster due to the bytecode changes which " "avoid creating bound method instances. (Contributed by Yury Selivanov and " "INADA Naoki in :issue:`26110`.)" msgstr "" +"バイトコードの変更によって束縛メソッドのインスタンスの作成を避けるようにな" +"り、メソッド呼び出しが最大 20% 高速になりました。\n" +"(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)" -#: ../../whatsnew/3.7.rst:1803 msgid "" "The :mod:`asyncio` module received a number of notable optimizations for " "commonly used functions:" msgstr "" +":mod:`asyncio` モジュールでは、よく使われる関数にいくつもの注目すべき最適化が" +"行われました:" -#: ../../whatsnew/3.7.rst:1806 msgid "" "The :func:`asyncio.get_event_loop` function has been reimplemented in C to " -"make it up to 15 times faster. (Contributed by Yury Selivanov in :issue:" -"`32296`.)" +"make it up to 15 times faster. (Contributed by Yury Selivanov " +"in :issue:`32296`.)" msgstr "" +":func:`asyncio.get_event_loop` 関数が C で再実装され、最大 15 倍高速になりま" +"した。\n" +"(Contributed by Yury Selivanov in :issue:`32296`.)" -#: ../../whatsnew/3.7.rst:1810 msgid "" ":class:`asyncio.Future` callback management has been optimized. (Contributed " "by Yury Selivanov in :issue:`32348`.)" msgstr "" +":class:`asyncio.Future` のコールバック管理が最適化されました。\n" +"(Contributed by Yury Selivanov in :issue:`32348`.)" -#: ../../whatsnew/3.7.rst:1813 msgid "" ":func:`asyncio.gather` is now up to 15% faster. (Contributed by Yury " "Selivanov in :issue:`32355`.)" msgstr "" +":func:`asyncio.gather` が最大 15% 高速になりました。\n" +"(Contributed by Yury Selivanov in :issue:`32355`.)" -#: ../../whatsnew/3.7.rst:1816 msgid "" ":func:`asyncio.sleep` is now up to 2 times faster when the *delay* argument " "is zero or negative. (Contributed by Andrew Svetlov in :issue:`32351`.)" msgstr "" +":func:`asyncio.sleep` は *delay* 引数がゼロまたは負の場合に最大 2 倍高速にな" +"りました。\n" +"(Contributed by Andrew Svetlov in :issue:`32351`.)" -#: ../../whatsnew/3.7.rst:1820 msgid "" "The performance overhead of asyncio debug mode has been reduced. " "(Contributed by Antoine Pitrou in :issue:`31970`.)" msgstr "" +"asyncio のデバッグモードの性能上のオーバーヘッドが減りました。\n" +"(Contributed by Antoine Pitrou in :issue:`31970`.)" -#: ../../whatsnew/3.7.rst:1823 msgid "" -"As a result of :ref:`PEP 560 work `, the import time of :" -"mod:`typing` has been reduced by a factor of 7, and many typing operations " -"are now faster. (Contributed by Ivan Levkivskyi in :issue:`32226`.)" +"As a result of :ref:`PEP 560 work `, the import time " +"of :mod:`typing` has been reduced by a factor of 7, and many typing " +"operations are now faster. (Contributed by Ivan Levkivskyi " +"in :issue:`32226`.)" msgstr "" +":ref:`PEP 560 の取り組み ` により、:mod:`typing` のイン" +"ポート時間が 7 分の 1 になり、多くの型操作が高速化されました。\n" +"(Contributed by Ivan Levkivskyi in :issue:`32226`.)" -#: ../../whatsnew/3.7.rst:1828 msgid "" ":func:`sorted` and :meth:`list.sort` have been optimized for common cases to " -"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky in :issue:" -"`28685`.)" +"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky " +"in :issue:`28685`.)" msgstr "" +":func:`sorted` と :meth:`list.sort` は一般的なケース向けに最適化され、最大 " +"40〜75% 高速になりました。\n" +"(Contributed by Elliot Gorokhovsky in :issue:`28685`.)" -#: ../../whatsnew/3.7.rst:1832 msgid "" ":meth:`dict.copy` is now up to 5.5 times faster. (Contributed by Yury " "Selivanov in :issue:`31179`.)" msgstr "" +":meth:`dict.copy` が最大 5.5 倍高速になりました。\n" +"(Contributed by Yury Selivanov in :issue:`31179`.)" -#: ../../whatsnew/3.7.rst:1835 msgid "" ":func:`hasattr` and :func:`getattr` are now about 4 times faster when *name* " -"is not found and *obj* does not override :meth:`object.__getattr__` or :meth:" -"`object.__getattribute__`. (Contributed by INADA Naoki in :issue:`32544`.)" +"is not found and *obj* does not override :meth:`object.__getattr__` " +"or :meth:`object.__getattribute__`. (Contributed by INADA Naoki " +"in :issue:`32544`.)" msgstr "" +":func:`hasattr` と :func:`getattr` は、*name* が見つからず、*obj* " +"が :meth:`object.__getattr__` や :meth:`object.__getattribute__` をオーバーラ" +"イドしていない場合、約 4 倍高速になりました。\n" +"(Contributed by INADA Naoki in :issue:`32544`.)" -#: ../../whatsnew/3.7.rst:1840 msgid "" "Searching for certain Unicode characters (like Ukrainian capital \"Є\") in a " "string was up to 25 times slower than searching for other characters. It is " "now only 3 times slower in the worst case. (Contributed by Serhiy Storchaka " "in :issue:`24821`.)" msgstr "" +"特定の Unicode 文字 (ウクライナ語の大文字 \"Є\" など) の文字列中の検索は、ほ" +"かの文字の検索より最大 25 倍遅くなっていました。\n" +"最悪の場合でも 3 倍にとどまるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`24821`.)" -#: ../../whatsnew/3.7.rst:1845 msgid "" "The :func:`collections.namedtuple` factory has been reimplemented to make " "the creation of named tuples 4 to 6 times faster. (Contributed by Jelle " "Zijlstra with further improvements by INADA Naoki, Serhiy Storchaka, and " "Raymond Hettinger in :issue:`28638`.)" msgstr "" +":func:`collections.namedtuple` ファクトリが再実装され、名前付きタプルの作成" +"が 4〜6 倍高速になりました。\n" +"(Contributed by Jelle Zijlstra with further improvements by INADA Naoki, " +"Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.)" #: ../../whatsnew/3.7.rst:1850 msgid "" @@ -2808,125 +3431,169 @@ msgid "" "faster in the common case. (Contributed by Paul Ganssle in :issue:`32403`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1854 msgid "" "The :func:`os.fwalk` function is now up to 2 times faster thanks to the use " "of :func:`os.scandir`. (Contributed by Serhiy Storchaka in :issue:`25996`.)" msgstr "" +":func:`os.fwalk` 関数が :func:`os.scandir` の使用によって最大 2 倍高速になり" +"ました。\n" +"(Contributed by Serhiy Storchaka in :issue:`25996`.)" -#: ../../whatsnew/3.7.rst:1858 msgid "" "The speed of the :func:`shutil.rmtree` function has been improved by 20--40% " "thanks to the use of the :func:`os.scandir` function. (Contributed by Serhiy " "Storchaka in :issue:`28564`.)" msgstr "" +":func:`shutil.rmtree` 関数が :func:`os.scandir` の使用によって 20〜40% 高速に" +"なりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`28564`.)" -#: ../../whatsnew/3.7.rst:1862 msgid "" "Optimized case-insensitive matching and searching of :mod:`regular " "expressions `. Searching some patterns can now be up to 20 times " "faster. (Contributed by Serhiy Storchaka in :issue:`30285`.)" msgstr "" +":mod:`正規表現 ` の、大文字と小文字を区別しないマッチと検索が最適化されま" +"した。\n" +"一部のパターンの検索が最大 20 倍高速になりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`30285`.)" -#: ../../whatsnew/3.7.rst:1866 msgid "" ":func:`re.compile` now converts ``flags`` parameter to int object if it is " "``RegexFlag``. It is now as fast as Python 3.5, and faster than Python 3.6 " -"by about 10% depending on the pattern. (Contributed by INADA Naoki in :issue:" -"`31671`.)" +"by about 10% depending on the pattern. (Contributed by INADA Naoki " +"in :issue:`31671`.)" msgstr "" +":func:`re.compile` は、``flags`` パラメータが ``RegexFlag`` の場合に int オブ" +"ジェクトに変換するようになりました。\n" +"Python 3.5 と同じ速さになり、パターンによっては Python 3.6 より約 10% 高速に" +"なりました。\n" +"(Contributed by INADA Naoki in :issue:`31671`.)" -#: ../../whatsnew/3.7.rst:1871 msgid "" -"The :meth:`~selectors.BaseSelector.modify` methods of classes :class:" -"`selectors.EpollSelector`, :class:`selectors.PollSelector` and :class:" -"`selectors.DevpollSelector` may be around 10% faster under heavy loads. " -"(Contributed by Giampaolo Rodola' in :issue:`30014`)" +"The :meth:`~selectors.BaseSelector.modify` methods of " +"classes :class:`selectors.EpollSelector`, :class:`selectors.PollSelector` " +"and :class:`selectors.DevpollSelector` may be around 10% faster under heavy " +"loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)" msgstr "" +":class:`selectors.EpollSelector`、:class:`selectors.PollSelector`、:class:`selectors.DevpollSelector` " +"の :meth:`~selectors.BaseSelector.modify` メソッドが、高負荷時に約 10% 高速に" +"なる可能性があります。\n" +"(Contributed by Giampaolo Rodola' in :issue:`30014`)" -#: ../../whatsnew/3.7.rst:1876 msgid "" "Constant folding has been moved from the peephole optimizer to the new AST " "optimizer, which is able perform optimizations more consistently. " -"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` and :issue:" -"`11549`.)" +"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` " +"and :issue:`11549`.)" msgstr "" +"定数畳み込みがピープホール最適化器から新しい AST 最適化器に移され、より一貫し" +"て最適化できるようになりました。\n" +"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` " +"and :issue:`11549`.)" -#: ../../whatsnew/3.7.rst:1881 msgid "" "Most functions and methods in :mod:`abc` have been rewritten in C. This " -"makes creation of abstract base classes, and calling :func:`isinstance` and :" -"func:`issubclass` on them 1.5x faster. This also reduces Python start-up " -"time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki in :issue:" -"`31333`)" +"makes creation of abstract base classes, and calling :func:`isinstance` " +"and :func:`issubclass` on them 1.5x faster. This also reduces Python start-" +"up time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki " +"in :issue:`31333`)" msgstr "" +":mod:`abc` のほとんどの関数とメソッドが C で書き直されました。\n" +"抽象基底クラスの作成と、それに対する :func:`isinstance`、:func:`issubclass` " +"の呼び出しが 1.5 倍高速になりました。\n" +"Python の起動時間も最大 10% 短くなりました。\n" +"(Contributed by Ivan Levkivskyi and INADA Naoki in :issue:`31333`)" -#: ../../whatsnew/3.7.rst:1887 msgid "" -"Significant speed improvements to alternate constructors for :class:" -"`datetime.date` and :class:`datetime.datetime` by using fast-path " +"Significant speed improvements to alternate constructors " +"for :class:`datetime.date` and :class:`datetime.datetime` by using fast-path " "constructors when not constructing subclasses. (Contributed by Paul Ganssle " "in :issue:`32403`)" msgstr "" +":class:`datetime.date` と :class:`datetime.datetime` の代替コンストラクタは、" +"サブクラスを作成しない場合に高速なコンストラクタを使い、大幅に高速化されまし" +"た。\n" +"(Contributed by Paul Ganssle in :issue:`32403`)" -#: ../../whatsnew/3.7.rst:1892 msgid "" "The speed of comparison of :class:`array.array` instances has been improved " "considerably in certain cases. It is now from 10x to 70x faster when " "comparing arrays holding values of the same integer type. (Contributed by " "Adrian Wielgosik in :issue:`24700`.)" msgstr "" +":class:`array.array` インスタンスの比較が、特定の場合に大幅に高速化されまし" +"た。\n" +"同じ整数型の値を持つ配列の比較では、10〜70 倍高速になりました。\n" +"(Contributed by Adrian Wielgosik in :issue:`24700`.)" -#: ../../whatsnew/3.7.rst:1897 msgid "" "The :func:`math.erf` and :func:`math.erfc` functions now use the (faster) C " "library implementation on most platforms. (Contributed by Serhiy Storchaka " "in :issue:`26121`.)" msgstr "" +":func:`math.erf` と :func:`math.erfc` 関数は、ほとんどのプラットフォームで、" +"より高速な C ライブラリの実装を使うようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`26121`.)" #: ../../whatsnew/3.7.rst:1903 msgid "Other CPython Implementation Changes" msgstr "その他の CPython の実装の変更" -#: ../../whatsnew/3.7.rst:1905 msgid "" "Trace hooks may now opt out of receiving the ``line`` and opt into receiving " -"the ``opcode`` events from the interpreter by setting the corresponding new :" -"attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` attributes on " -"the frame being traced. (Contributed by Nick Coghlan in :issue:`31344`.)" +"the ``opcode`` events from the interpreter by setting the corresponding " +"new :attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` " +"attributes on the frame being traced. (Contributed by Nick Coghlan " +"in :issue:`31344`.)" msgstr "" +"トレースフックは、追跡対象のフレームの新しい :attr:`~frame.f_trace_lines` " +"と :attr:`~frame.f_trace_opcodes` 属性を設定することで、それぞれインタープリ" +"タからの ``line`` イベントを受け取らないようにしたり、``opcode`` イベントを受" +"け取ったりできるようになりました。\n" +"(Contributed by Nick Coghlan in :issue:`31344`.)" -#: ../../whatsnew/3.7.rst:1910 msgid "" "Fixed some consistency problems with namespace package module attributes. " "Namespace module objects now have an ``__file__`` that is set to ``None`` " "(previously unset), and their ``__spec__.origin`` is also set to ``None`` " "(previously the string ``\"namespace\"``). See :issue:`32305`. Also, the " "namespace module object's ``__spec__.loader`` is set to the same value as " -"``__loader__`` (previously, the former was set to ``None``). See :issue:" -"`32303`." +"``__loader__`` (previously, the former was set to ``None``). " +"See :issue:`32303`." msgstr "" +"名前空間パッケージのモジュール属性の一貫性に関する問題を修正しました。\n" +"名前空間モジュールのオブジェクトでは、未設定だった ``__file__`` が ``None`` " +"になり、``__spec__.origin`` も文字列 ``\"namespace\"`` から ``None`` に変わり" +"ました (:issue:`32305`)。\n" +"また、以前は ``None`` だった ``__spec__.loader`` が ``__loader__`` と同じ値に" +"なりました (:issue:`32303`)。" -#: ../../whatsnew/3.7.rst:1918 msgid "" "The :func:`locals` dictionary now displays in the lexical order that " "variables were defined. Previously, the order was undefined. (Contributed " "by Raymond Hettinger in :issue:`32690`.)" msgstr "" +":func:`locals` の辞書は、変数がソース中で定義された順に表示されるようになりま" +"した。\n" +"以前は順序が未定義でした。\n" +"(Contributed by Raymond Hettinger in :issue:`32690`.)" -#: ../../whatsnew/3.7.rst:1922 msgid "" "The ``distutils`` ``upload`` command no longer tries to change CR end-of-" "line characters to CRLF. This fixes a corruption issue with sdists that " -"ended with a byte equivalent to CR. (Contributed by Bo Bayles in :issue:" -"`32304`.)" +"ended with a byte equivalent to CR. (Contributed by Bo Bayles " +"in :issue:`32304`.)" msgstr "" +"``distutils`` の ``upload`` コマンドは、行末文字 CR を CRLF に変換しなくなり" +"ました。\n" +"これにより CR 相当のバイトで終わる sdist が破損する問題が修正されました。\n" +"(Contributed by Bo Bayles in :issue:`32304`.)" #: ../../whatsnew/3.7.rst:1929 msgid "Deprecated Python Behavior" msgstr "非推奨の Python の挙動" -#: ../../whatsnew/3.7.rst:1931 msgid "" "Yield expressions (both ``yield`` and ``yield from`` clauses) are now " "deprecated in comprehensions and generator expressions (aside from the " @@ -2939,14 +3606,28 @@ msgid "" "in Python 3.8 this will be a :exc:`SyntaxError`. (Contributed by Serhiy " "Storchaka in :issue:`10544`.)" msgstr "" +"内包表記とジェネレータ式では、最も左の :keyword:`!for` 節のイテラブル式を除" +"き、yield 式 (``yield`` と ``yield from`` の両方) が非推奨になりました。\n" +"これにより、内包表記は :term:`generator iterator` オブジェクトを返す可能性が" +"なくなり、常に適切な型のコンテナを直ちに返すことが保証されます。\n" +"また、ジェネレータ式が暗黙の出力と明示的な yield 式の出力を交互に行おうとする" +"こともなくなります。\n" +"Python 3.7 ではこのような式のコンパイル時に :exc:`DeprecationWarning` が発生" +"し、Python 3.8 では :exc:`SyntaxError` になります。\n" +"(Contributed by Serhiy Storchaka in :issue:`10544`.)" -#: ../../whatsnew/3.7.rst:1942 msgid "" "Returning a subclass of :class:`complex` from :meth:`object.__complex__` is " "deprecated and will be an error in future Python versions. This makes " -"``__complex__()`` consistent with :meth:`object.__int__` and :meth:`object." -"__float__`. (Contributed by Serhiy Storchaka in :issue:`28894`.)" +"``__complex__()`` consistent with :meth:`object.__int__` " +"and :meth:`object.__float__`. (Contributed by Serhiy Storchaka " +"in :issue:`28894`.)" msgstr "" +":meth:`object.__complex__` から :class:`complex` のサブクラスを返すことが非推" +"奨になり、将来の Python ではエラーになります。\n" +"これにより ``__complex__()`` の動作が :meth:`object.__int__` " +"と :meth:`object.__float__` に揃います。\n" +"(Contributed by Serhiy Storchaka in :issue:`28894`.)" #: ../../whatsnew/3.7.rst:1951 msgid "Deprecated Python modules, functions and methods" @@ -2956,38 +3637,48 @@ msgstr "非推奨の Python モジュール、関数、メソッド" msgid "aifc" msgstr "aifc" -#: ../../whatsnew/3.7.rst:1956 msgid "" ":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" +":func:`!aifc.openfp` が非推奨になり、Python 3.9 で削除されます。\n" +"代わりに :func:`!aifc.open` を使ってください。\n" +"(Contributed by Brian Curtin in :issue:`31985`.)" -#: ../../whatsnew/3.7.rst:1966 msgid "" "Support for directly ``await``-ing instances of :class:`asyncio.Lock` and " "other asyncio synchronization primitives has been deprecated. An " "asynchronous context manager must be used in order to acquire and release " -"the synchronization resource. (Contributed by Andrew Svetlov in :issue:" -"`32253`.)" +"the synchronization resource. (Contributed by Andrew Svetlov " +"in :issue:`32253`.)" msgstr "" +":class:`asyncio.Lock` やその他の asyncio の同期プリミティブのインスタンスを直" +"接 ``await`` することが非推奨になりました。\n" +"同期用リソースの取得と解放には、非同期コンテキストマネージャーを使う必要があ" +"ります。\n" +"(Contributed by Andrew Svetlov in :issue:`32253`.)" -#: ../../whatsnew/3.7.rst:1972 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"methods have been deprecated. (Contributed by Andrew Svetlov in :issue:" -"`32250`.)" +"methods have been deprecated. (Contributed by Andrew Svetlov " +"in :issue:`32250`.)" msgstr "" +":meth:`!asyncio.Task.current_task` と :meth:`!asyncio.Task.all_tasks` メソッ" +"ドが非推奨になりました。\n" +"(Contributed by Andrew Svetlov in :issue:`32250`.)" -#: ../../whatsnew/3.7.rst:1980 msgid "" "In Python 3.8, the abstract base classes in :mod:`collections.abc` will no " "longer be exposed in the regular :mod:`collections` module. This will help " "create a clearer distinction between the concrete classes and the abstract " "base classes. (Contributed by Serhiy Storchaka in :issue:`25988`.)" msgstr "" +"Python 3.8 では :mod:`collections.abc` の抽象基底クラスを通常" +"の :mod:`collections` モジュールで公開しなくなります。\n" +"これにより具象クラスと抽象基底クラスの区別がより明確になります。\n" +"(Contributed by Serhiy Storchaka in :issue:`25988`.)" -#: ../../whatsnew/3.7.rst:1990 msgid "" ":mod:`dbm.dumb` now supports reading read-only files and no longer writes " "the index file when it is not changed. A deprecation warning is now emitted " @@ -2995,6 +3686,11 @@ msgid "" "(this will be an error in future Python releases). (Contributed by Serhiy " "Storchaka in :issue:`28847`.)" msgstr "" +":mod:`dbm.dumb` が読み取り専用ファイルの読み込みに対応し、インデックスファイ" +"ルに変更がなければ書き込まないようになりました。\n" +"``'r'`` と ``'w'`` モードでインデックスファイルがなく、再作成する場合は非推奨" +"の警告が発生します (将来の Python リリースではエラーになります)。\n" +"(Contributed by Serhiy Storchaka in :issue:`28847`.)" #: ../../whatsnew/3.7.rst:2000 msgid "" @@ -3002,30 +3698,40 @@ msgid "" "classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); similarly, " "attempting to check for non-Flag objects in a :class:`Flag` member will " "raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both operations " -"return :const:`False` instead. (Contributed by Ethan Furman in :issue:" -"`33217`.)" +"return :const:`False` instead. (Contributed by Ethan Furman " +"in :issue:`33217`.)" msgstr "" #: ../../whatsnew/3.7.rst:2009 msgid "gettext" msgstr "gettext" -#: ../../whatsnew/3.7.rst:2011 msgid "" "Using non-integer value for selecting a plural form in :mod:`gettext` is now " -"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka in :" -"issue:`28692`.)" -msgstr "" - -#: ../../whatsnew/3.7.rst:2019 -msgid "" -"Methods :meth:`!MetaPathFinder.find_module` (replaced by :meth:" -"`MetaPathFinder.find_spec() `) and :" -"meth:`!PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder." -"find_spec() `) both deprecated in " -"Python 3.4 now emit :exc:`DeprecationWarning`. (Contributed by Matthias " -"Bussonnier in :issue:`29576`.)" +"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka " +"in :issue:`28692`.)" msgstr "" +":mod:`gettext` で複数形を選ぶ際に整数以外の値を使うことが非推奨になりまし" +"た。\n" +"この使い方はこれまでも正しく動作していませんでした。\n" +"(Contributed by Serhiy Storchaka in :issue:`28692`.)" + +msgid "" +"Methods :meth:`!MetaPathFinder.find_module` (replaced " +"by :meth:`MetaPathFinder.find_spec() " +"`) and :meth:`!" +"PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder.find_spec() " +"`) both deprecated in Python 3.4 " +"now emit :exc:`DeprecationWarning`. (Contributed by Matthias Bussonnier " +"in :issue:`29576`.)" +msgstr "" +"Python 3.4 で非推奨になった :meth:`!MetaPathFinder.find_module` " +"(:meth:`MetaPathFinder.find_spec() ` " +"で置き換え) と :meth:`!PathEntryFinder.find_loader` " +"(:meth:`PathEntryFinder.find_spec() " +"` で置き換え) " +"が、:exc:`DeprecationWarning` を出すようになりました。\n" +"(Contributed by Matthias Bussonnier in :issue:`29576`.)" #: ../../whatsnew/3.7.rst:2030 msgid "" @@ -3053,50 +3759,63 @@ msgstr "" msgid "threading" msgstr "threading" -#: ../../whatsnew/3.7.rst:2051 msgid "" ":mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It " -"is no longer possible to build Python with threading disabled. Use :mod:" -"`threading` instead. (Contributed by Antoine Pitrou in :issue:`31370`.)" +"is no longer possible to build Python with threading disabled. " +"Use :mod:`threading` instead. (Contributed by Antoine Pitrou " +"in :issue:`31370`.)" msgstr "" +":mod:`!dummy_threading` と :mod:`!_dummy_thread` が非推奨になりました。\n" +"スレッドを無効にした Python のビルドはできなくなりました。\n" +"代わりに :mod:`threading` を使ってください。\n" +"(Contributed by Antoine Pitrou in :issue:`31370`.)" -#: ../../whatsnew/3.7.rst:2060 msgid "" -"The silent argument value truncation in :func:`socket.htons` and :func:" -"`socket.ntohs` has been deprecated. In future versions of Python, if the " -"passed argument is larger than 16 bits, an exception will be raised. " +"The silent argument value truncation in :func:`socket.htons` " +"and :func:`socket.ntohs` has been deprecated. In future versions of Python, " +"if the passed argument is larger than 16 bits, an exception will be raised. " "(Contributed by Oren Milman in :issue:`28332`.)" msgstr "" +":func:`socket.htons` と :func:`socket.ntohs` が引数の値を通知せず切り詰める動" +"作は非推奨になりました。\n" +"将来の Python では、渡された引数が 16 ビットを超える場合に例外を送出しま" +"す。\n" +"(Contributed by Oren Milman in :issue:`28332`.)" #: ../../whatsnew/3.7.rst:2069 msgid "" -":func:`ssl.wrap_socket` is deprecated. Use :meth:`ssl.SSLContext." -"wrap_socket` instead. (Contributed by Christian Heimes in :issue:`28124`.)" +":func:`ssl.wrap_socket` is deprecated. " +"Use :meth:`ssl.SSLContext.wrap_socket` instead. (Contributed by Christian " +"Heimes in :issue:`28124`.)" msgstr "" #: ../../whatsnew/3.7.rst:2075 msgid "sunau" msgstr "sunau" -#: ../../whatsnew/3.7.rst:2077 msgid "" ":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" +":func:`!sunau.openfp` が非推奨になり、Python 3.9 で削除されます。\n" +"代わりに :func:`!sunau.open` を使ってください。\n" +"(Contributed by Brian Curtin in :issue:`31985`.)" #: ../../whatsnew/3.7.rst:2085 msgid "" -"Deprecated :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper`." +"Deprecated :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper`." msgstr "" -#: ../../whatsnew/3.7.rst:2088 msgid "" "The undocumented ``sys.callstats()`` function has been deprecated and will " -"be removed in a future Python version. (Contributed by Victor Stinner in :" -"issue:`28799`.)" +"be removed in a future Python version. (Contributed by Victor Stinner " +"in :issue:`28799`.)" msgstr "" +"文書化されていない ``sys.callstats()`` 関数が非推奨になり、将来の Python で削" +"除されます。\n" +"(Contributed by Victor Stinner in :issue:`28799`.)" #: ../../whatsnew/3.7.rst:2094 msgid "wave" @@ -3105,30 +3824,37 @@ msgstr "wave" #: ../../whatsnew/3.7.rst:2096 msgid "" ":func:`wave.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`wave.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`wave.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2102 msgid "Deprecated functions and types of the C API" msgstr "C API の非推奨の関数ならびに型" -#: ../../whatsnew/3.7.rst:2104 msgid "" "Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with a " "macro if ``Py_LIMITED_API`` is not set or set to a value in the range " "between ``0x03050400`` and ``0x03060000`` (not inclusive), or is " -"``0x03060100`` or higher. (Contributed by Serhiy Storchaka in :issue:" -"`27867`.)" +"``0x03060100`` or higher. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" +":c:func:`PySlice_GetIndicesEx` 関数が非推奨になりました。\n" +"``Py_LIMITED_API`` が未設定、``0x03050400`` より大きく ``0x03060000`` より小" +"さい値、または ``0x03060100`` 以上の場合は、マクロに置き換えられます。\n" +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" -#: ../../whatsnew/3.7.rst:2109 msgid "" -":c:func:`PyOS_AfterFork` has been deprecated. Use :c:func:" -"`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` or :c:func:" -"`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou in :issue:" -"`16500`.)" +":c:func:`PyOS_AfterFork` has been deprecated. " +"Use :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"or :c:func:`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" +":c:func:`PyOS_AfterFork` が非推奨になりました。\n" +"代わり" +"に :c:func:`PyOS_BeforeFork`、:c:func:`PyOS_AfterFork_Parent`、:c:func:`PyOS_AfterFork_Child()` " +"を使ってください。\n" +"(Contributed by Antoine Pitrou in :issue:`16500`.)" #: ../../whatsnew/3.7.rst:2117 msgid "Platform Support Removals" @@ -3138,81 +3864,97 @@ msgstr "サポート対象プラットフォームからの除外" msgid "FreeBSD 9 and older are no longer officially supported." msgstr "FreeBSD 9 とそれ以前のバージョンは公式にはサポートされなくなりました。" -#: ../../whatsnew/3.7.rst:2120 msgid "" "For full Unicode support, including within extension modules, \\*nix " "platforms are now expected to provide at least one of ``C.UTF-8`` (full " "locale), ``C.utf8`` (full locale) or ``UTF-8`` (``LC_CTYPE``-only locale) as " "an alternative to the legacy ``ASCII``-based ``C`` locale." msgstr "" +"拡張モジュールも含めて Unicode を完全にサポートするため、\\*nix プラット" +"フォームでは、従来の ``ASCII`` ベースの ``C`` ロケールの代わりに、" +"``C.UTF-8`` (完全なロケール)、``C.utf8`` (完全なロケール)、``UTF-8`` " +"(``LC_CTYPE`` のみのロケール) の少なくとも一つを提供することが期待されます。" -#: ../../whatsnew/3.7.rst:2124 msgid "" "OpenSSL 0.9.8 and 1.0.1 are no longer supported, which means building " "CPython 3.7 with SSL/TLS support on older platforms still using these " "versions requires custom build options that link to a more recent version of " "OpenSSL." msgstr "" +"OpenSSL 0.9.8 と 1.0.1 はサポートされなくなりました。\n" +"これらを使い続けている古いプラットフォームで SSL/TLS をサポートする CPython " +"3.7 をビルドするには、より新しい OpenSSL にリンクする独自のビルドオプションが" +"必要です。" -#: ../../whatsnew/3.7.rst:2128 msgid "" "Notably, this issue affects the Debian 8 (aka \"jessie\") and Ubuntu 14.04 " "(aka \"Trusty\") LTS Linux distributions, as they still use OpenSSL 1.0.1 by " "default." msgstr "" +"特に Debian 8 (\"jessie\") と Ubuntu 14.04 (\"Trusty\") の LTS Linux ディスト" +"リビューションは、デフォルトで OpenSSL 1.0.1 を使っているため影響を受けます。" -#: ../../whatsnew/3.7.rst:2132 msgid "" "Debian 9 (\"stretch\") and Ubuntu 16.04 (\"xenial\"), as well as recent " "releases of other LTS Linux releases (e.g. RHEL/CentOS 7.5, SLES 12-SP3), " "use OpenSSL 1.0.2 or later, and remain supported in the default build " "configuration." msgstr "" +"Debian 9 (\"stretch\")、Ubuntu 16.04 (\"xenial\")、その他の LTS Linux の最近" +"のリリース (RHEL/CentOS 7.5、SLES 12-SP3 など) は OpenSSL 1.0.2 以降を使って" +"おり、デフォルトのビルド設定で引き続きサポートされます。" -#: ../../whatsnew/3.7.rst:2136 msgid "" "CPython's own `CI configuration file `_ provides an example of using the SSL :source:" -"`compatibility testing infrastructure ` in " -"CPython's test suite to build and link against OpenSSL 1.1.0 rather than an " -"outdated system provided OpenSSL." +"v3.7.13/.travis.yml>`_ provides an example of using the " +"SSL :source:`compatibility testing infrastructure ` in CPython's test suite to build and link against OpenSSL " +"1.1.0 rather than an outdated system provided OpenSSL." msgstr "" +"CPython 自身の `CI 設定ファイル `_ は、テストスイートの SSL :source:`互換性テスト基盤 " +"` を利用して、システムが提供する古い OpenSSL では" +"なく OpenSSL 1.1.0 に対してビルド、リンクする例を示しています。" #: ../../whatsnew/3.7.rst:2145 msgid "API and Feature Removals" msgstr "API と機能の削除" -#: ../../whatsnew/3.7.rst:2147 msgid "The following features and APIs have been removed from Python 3.7:" -msgstr "" +msgstr "次の機能と API が Python 3.7 から削除されました:" -#: ../../whatsnew/3.7.rst:2149 msgid "" "The ``os.stat_float_times()`` function has been removed. It was introduced " "in Python 2.3 for backward compatibility with Python 2.2, and was deprecated " "since Python 3.1." msgstr "" +"``os.stat_float_times()`` 関数が削除されました。\n" +"Python 2.2 との後方互換性のため Python 2.3 で導入され、Python 3.1 から非推奨" +"でした。" -#: ../../whatsnew/3.7.rst:2153 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in replacement " "templates for :func:`re.sub` were deprecated in Python 3.5, and will now " "cause an error." msgstr "" +":func:`re.sub` の置換テンプレートで ``'\\'`` と ASCII 文字からなる未知のエス" +"ケープを使うことは Python 3.5 で非推奨となり、今回からエラーになります。" -#: ../../whatsnew/3.7.rst:2157 msgid "" "Removed support of the *exclude* argument in :meth:`tarfile.TarFile.add`. It " "was deprecated in Python 2.7 and 3.2. Use the *filter* argument instead." msgstr "" +":meth:`tarfile.TarFile.add` の *exclude* 引数のサポートが削除されました。\n" +"Python 2.7 と 3.2 で非推奨になっていました。\n" +"代わりに *filter* 引数を使ってください。" -#: ../../whatsnew/3.7.rst:2160 msgid "" "The :func:`!ntpath.splitunc` function was deprecated in Python 3.1, and has " "now been removed. Use :func:`~os.path.splitdrive` instead." msgstr "" +"Python 3.1 で非推奨になった :func:`!ntpath.splitunc` 関数が削除されました。\n" +"代わりに :func:`~os.path.splitdrive` を使ってください。" -#: ../../whatsnew/3.7.rst:2164 msgid "" ":func:`collections.namedtuple` no longer supports the *verbose* parameter or " "``_source`` attribute which showed the generated source code for the named " @@ -3220,70 +3962,86 @@ msgid "" "creation. (Contributed by Jelle Zijlstra with further improvements by INADA " "Naoki, Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.)" msgstr "" +":func:`collections.namedtuple` は、名前付きタプルのクラスの生成ソースコードを" +"示す *verbose* パラメータと ``_source`` 属性をサポートしなくなりました。\n" +"これはクラス作成を高速化する最適化の一環です。\n" +"(Contributed by Jelle Zijlstra with further improvements by INADA Naoki, " +"Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.)" -#: ../../whatsnew/3.7.rst:2170 msgid "" "Functions :func:`bool`, :func:`float`, :func:`list` and :func:`tuple` no " "longer take keyword arguments. The first argument of :func:`int` can now be " "passed only as positional argument." msgstr "" +":func:`bool`、:func:`float`、:func:`list`、:func:`tuple` はキーワード引数を受" +"け付けなくなりました。\n" +":func:`int` の第 1 引数は位置引数としてのみ渡せます。" #: ../../whatsnew/3.7.rst:2174 msgid "" "Removed previously deprecated in Python 2.4 classes ``Plist``, ``Dict`` and " "``_InternalDict`` in the :mod:`plistlib` module. Dict values in the result " -"of functions :func:`~plistlib.readPlist` and :func:`~plistlib." -"readPlistFromBytes` are now normal dicts. You no longer can use attribute " -"access to access items of these dictionaries." +"of functions :func:`~plistlib.readPlist` " +"and :func:`~plistlib.readPlistFromBytes` are now normal dicts. You no " +"longer can use attribute access to access items of these dictionaries." msgstr "" -#: ../../whatsnew/3.7.rst:2180 msgid "" "The ``asyncio.windows_utils.socketpair()`` function has been removed. Use " "the :func:`socket.socketpair` function instead, it is available on all " "platforms since Python 3.5. ``asyncio.windows_utils.socketpair`` was just an " "alias to ``socket.socketpair`` on Python 3.5 and newer." msgstr "" +"``asyncio.windows_utils.socketpair()`` 関数が削除されました。\n" +"代わりに :func:`socket.socketpair` を使ってください。\n" +"これは Python 3.5 以降、すべてのプラットフォームで利用できます。\n" +"Python 3.5 以降の ``asyncio.windows_utils.socketpair`` は、単なる " +"``socket.socketpair`` の別名でした。" -#: ../../whatsnew/3.7.rst:2186 msgid "" ":mod:`asyncio` no longer exports the :mod:`selectors` and :mod:`!" "_overlapped` modules as ``asyncio.selectors`` and ``asyncio._overlapped``. " "Replace ``from asyncio import selectors`` with ``import selectors``." msgstr "" +":mod:`asyncio` は :mod:`selectors` と :mod:`!_overlapped` モジュールを " +"``asyncio.selectors`` と ``asyncio._overlapped`` としてエクスポートしなくなり" +"ました。\n" +"``from asyncio import selectors`` を ``import selectors`` に置き換えてくださ" +"い。" #: ../../whatsnew/3.7.rst:2191 msgid "" "Direct instantiation of :class:`ssl.SSLSocket` and :class:`ssl.SSLObject` " "objects is now prohibited. The constructors were never documented, tested, " -"or designed as public constructors. Users were supposed to use :func:`ssl." -"wrap_socket` or :class:`ssl.SSLContext`. (Contributed by Christian Heimes " -"in :issue:`32951`.)" +"or designed as public constructors. Users were supposed to " +"use :func:`ssl.wrap_socket` or :class:`ssl.SSLContext`. (Contributed by " +"Christian Heimes in :issue:`32951`.)" msgstr "" -#: ../../whatsnew/3.7.rst:2197 msgid "" "The unused ``distutils`` ``install_misc`` command has been removed. " "(Contributed by Eric N. Vander Weele in :issue:`29218`.)" msgstr "" +"使われていない ``distutils`` の ``install_misc`` コマンドが削除されました。\n" +"(Contributed by Eric N. Vander Weele in :issue:`29218`.)" -#: ../../whatsnew/3.7.rst:2202 msgid "Module Removals" -msgstr "" +msgstr "モジュールの削除" -#: ../../whatsnew/3.7.rst:2204 msgid "" "The ``fpectl`` module has been removed. It was never enabled by default, " "never worked correctly on x86-64, and it changed the Python ABI in ways that " "caused unexpected breakage of C extensions. (Contributed by Nathaniel J. " "Smith in :issue:`29137`.)" msgstr "" +"``fpectl`` モジュールが削除されました。\n" +"デフォルトで有効だったことはなく、x86-64 では正しく動作せず、Python ABI を変" +"えることで C 拡張に予期しない破損を引き起こしていました。\n" +"(Contributed by Nathaniel J. Smith in :issue:`29137`.)" -#: ../../whatsnew/3.7.rst:2211 ../../whatsnew/3.7.rst:2487 msgid "Windows-only Changes" -msgstr "" +msgstr "Windows 固有の変更" -#: ../../whatsnew/3.7.rst:2213 msgid "" "The python launcher, (py.exe), can accept 32 & 64 bit specifiers **without** " "having to specify a minor version as well. So ``py -3-32`` and ``py -3-64`` " @@ -3292,8 +4050,14 @@ msgid "" "been used. If the specified version is not available py.exe will error exit. " "(Contributed by Steve Barnes in :issue:`30291`.)" msgstr "" +"Python ランチャー (py.exe) は、マイナーバージョンを指定 *しなくても* 32 ビッ" +"トまたは 64 ビットを指定できるようになりました。\n" +"``py -3.7-32`` と同様に ``py -3-32`` と ``py -3-64`` も有効です。\n" +"また -*m*-64 と -*m.n*-64 の形式も受け付け、通常なら 32 ビット版を使う場合で" +"も 64 ビット版を強制できます。\n" +"指定したバージョンがなければ py.exe はエラーで終了します。\n" +"(Contributed by Steve Barnes in :issue:`30291`.)" -#: ../../whatsnew/3.7.rst:2220 msgid "" "The launcher can be run as ``py -0`` to produce a list of the installed " "pythons, *with default marked with an asterisk*. Running ``py -0p`` will " @@ -3301,6 +4065,12 @@ msgid "" "matched it will also print the *short form* list of available specifiers. " "(Contributed by Steve Barnes in :issue:`30362`.)" msgstr "" +"ランチャーを ``py -0`` で実行すると、インストール済みの Python の一覧を表示" +"し、*デフォルトにはアスタリスクを付けます*。\n" +"``py -0p`` ではパスも表示します。\n" +"該当するものがないバージョン指定で py を実行した場合も、利用可能な指定の *短" +"い形式* の一覧を表示します。\n" +"(Contributed by Steve Barnes in :issue:`30362`.)" #: ../../whatsnew/3.7.rst:2230 msgid "Porting to Python 3.7" @@ -3318,26 +4088,33 @@ msgstr "" msgid "Changes in Python Behavior" msgstr "Python の挙動の変更" -#: ../../whatsnew/3.7.rst:2239 msgid "" ":keyword:`async` and :keyword:`await` names are now reserved keywords. Code " "using these names as identifiers will now raise a :exc:`SyntaxError`. " "(Contributed by Jelle Zijlstra in :issue:`30406`.)" msgstr "" +":keyword:`async` と :keyword:`await` は予約済みのキーワードになりました。\n" +"これらの名前を識別子として使うコードは :exc:`SyntaxError` を送出します。\n" +"(Contributed by Jelle Zijlstra in :issue:`30406`.)" -#: ../../whatsnew/3.7.rst:2243 msgid "" -":pep:`479` is enabled for all code in Python 3.7, meaning that :exc:" -"`StopIteration` exceptions raised directly or indirectly in coroutines and " -"generators are transformed into :exc:`RuntimeError` exceptions. (Contributed " -"by Yury Selivanov in :issue:`32670`.)" +":pep:`479` is enabled for all code in Python 3.7, meaning " +"that :exc:`StopIteration` exceptions raised directly or indirectly in " +"coroutines and generators are transformed into :exc:`RuntimeError` " +"exceptions. (Contributed by Yury Selivanov in :issue:`32670`.)" msgstr "" +"Python 3.7 では :pep:`479` がすべてのコードで有効になり、コルーチンやジェネ" +"レータ内から直接または間接的に送出される :exc:`StopIteration` " +"は :exc:`RuntimeError` に変換されます。\n" +"(Contributed by Yury Selivanov in :issue:`32670`.)" -#: ../../whatsnew/3.7.rst:2249 msgid "" ":meth:`object.__aiter__` methods can no longer be declared as asynchronous. " "(Contributed by Yury Selivanov in :issue:`31709`.)" msgstr "" +":meth:`object.__aiter__` メソッドを非同期として宣言することはできなくなりまし" +"た。\n" +"(Contributed by Yury Selivanov in :issue:`31709`.)" #: ../../whatsnew/3.7.rst:2252 msgid "" @@ -3346,24 +4123,30 @@ msgid "" msgstr "" "以前のバージョンの Python で、誤って以下の構文を許容してしまっていました::" -#: ../../whatsnew/3.7.rst:2255 msgid "" "f(1 for x in [1],)\n" "\n" "class C(1 for x in [1]):\n" " pass" msgstr "" +"f(1 for x in [1],)\n" +"\n" +"class C(1 for x in [1]):\n" +" pass" -#: ../../whatsnew/3.7.rst:2260 msgid "" "Python 3.7 now correctly raises a :exc:`SyntaxError`, as a generator " "expression always needs to be directly inside a set of parentheses and " "cannot have a comma on either side, and the duplication of the parentheses " -"can be omitted only on calls. (Contributed by Serhiy Storchaka in :issue:" -"`32012` and :issue:`32023`.)" +"can be omitted only on calls. (Contributed by Serhiy Storchaka " +"in :issue:`32012` and :issue:`32023`.)" msgstr "" +"Python 3.7 では正しく :exc:`SyntaxError` を送出するようになりました。\n" +"ジェネレータ式は常に括弧の直内に置く必要があり、左右にカンマを置くことはでき" +"ません。\n" +"括弧の重複を省略できるのは呼び出しの場合だけです。\n" +"(Contributed by Serhiy Storchaka in :issue:`32012` and :issue:`32023`.)" -#: ../../whatsnew/3.7.rst:2266 msgid "" "When using the :option:`-m` switch, the initial working directory is now " "added to :data:`sys.path`, rather than an empty string (which dynamically " @@ -3374,6 +4157,13 @@ msgid "" "depending on why the code was checking for the empty string in the first " "place)." msgstr "" +":option:`-m` オプションを使うと、:data:`sys.path` には空文字列の代わりに起動" +"時の作業ディレクトリが追加されるようになりました。\n" +"空文字列は各インポート時点の作業ディレクトリを動的に表していました。\n" +"空文字列の有無を調べるなど、以前の動作に依存するプログラムは更新する必要があ" +"ります。\n" +"例えば、空文字列を調べていた目的に応じて、``os.getcwd()`` や " +"``os.path.dirname(__main__.__file__)`` も調べるようにします。" #: ../../whatsnew/3.7.rst:2276 msgid "Changes in the Python API" @@ -3382,101 +4172,133 @@ msgstr "Python API の変更" #: ../../whatsnew/3.7.rst:2278 msgid "" ":meth:`socketserver.ThreadingMixIn.server_close` now waits until all non-" -"daemon threads complete. Set the new :attr:`socketserver.ThreadingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31233` and :issue:`33540`.)" +"daemon threads complete. Set the " +"new :attr:`socketserver.ThreadingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31233` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2284 msgid "" ":meth:`socketserver.ForkingMixIn.server_close` now waits until all child " -"processes complete. Set the new :attr:`socketserver.ForkingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31151` and :issue:`33540`.)" +"processes complete. Set the " +"new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31151` and :issue:`33540`.)" msgstr "" -#: ../../whatsnew/3.7.rst:2290 msgid "" "The :func:`locale.localeconv` function now temporarily sets the ``LC_CTYPE`` " "locale to the value of ``LC_NUMERIC`` in some cases. (Contributed by Victor " "Stinner in :issue:`31900`.)" msgstr "" +":func:`locale.localeconv` 関数は、一部の場合に ``LC_CTYPE`` ロケールを一時的" +"に ``LC_NUMERIC`` の値に設定するようになりました。\n" +"(Contributed by Victor Stinner in :issue:`31900`.)" -#: ../../whatsnew/3.7.rst:2294 msgid "" ":meth:`pkgutil.walk_packages` now raises a :exc:`ValueError` if *path* is a " "string. Previously an empty list was returned. (Contributed by Sanyam " "Khurana in :issue:`24744`.)" msgstr "" +":meth:`pkgutil.walk_packages` は *path* が文字列の場合に :exc:`ValueError` を" +"送出するようになりました。\n" +"以前は空リストを返していました。\n" +"(Contributed by Sanyam Khurana in :issue:`24744`.)" -#: ../../whatsnew/3.7.rst:2298 msgid "" -"A format string argument for :meth:`string.Formatter.format` is now :ref:" -"`positional-only `. Passing it as a keyword " -"argument was deprecated in Python 3.5. (Contributed by Serhiy Storchaka in :" -"issue:`29193`.)" +"A format string argument for :meth:`string.Formatter.format` is " +"now :ref:`positional-only `. Passing it as a " +"keyword argument was deprecated in Python 3.5. (Contributed by Serhiy " +"Storchaka in :issue:`29193`.)" msgstr "" +":meth:`string.Formatter.format` の書式文字列の引数が :ref:`位置専用 " +"` になりました。\n" +"キーワード引数として渡すことは Python 3.5 で非推奨になっていました。\n" +"(Contributed by Serhiy Storchaka in :issue:`29193`.)" -#: ../../whatsnew/3.7.rst:2303 msgid "" -"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel." -"value` and :attr:`~http.cookies.Morsel.coded_value` of class :class:`http." -"cookies.Morsel` are now read-only. Assigning to them was deprecated in " -"Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method for setting " -"them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" +"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of " +"class :class:`http.cookies.Morsel` are now read-only. Assigning to them was " +"deprecated in Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method " +"for setting them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" msgstr "" +":class:`http.cookies.Morsel` " +"の :attr:`~http.cookies.Morsel.key`、:attr:`~http.cookies.Morsel.value`、:attr:`~http.cookies.Morsel.coded_value` " +"属性が読み取り専用になりました。\n" +"これらへの代入は Python 3.5 で非推奨になっていました。\n" +"設定には :meth:`~http.cookies.Morsel.set` メソッドを使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`29192`.)" -#: ../../whatsnew/3.7.rst:2311 msgid "" "The *mode* argument of :func:`os.makedirs` no longer affects the file " "permission bits of newly created intermediate-level directories. To set " "their file permission bits you can set the umask before invoking " "``makedirs()``. (Contributed by Serhiy Storchaka in :issue:`19930`.)" msgstr "" +":func:`os.makedirs` の *mode* 引数は、新しく作成される中間ディレクトリのアク" +"セス権ビットに影響しなくなりました。\n" +"これらのアクセス権ビットを設定するには、``makedirs()`` の呼び出し前に umask " +"を設定できます。\n" +"(Contributed by Serhiy Storchaka in :issue:`19930`.)" -#: ../../whatsnew/3.7.rst:2317 msgid "" -"The :attr:`struct.Struct.format` type is now :class:`str` instead of :class:" -"`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" +"The :attr:`struct.Struct.format` type is now :class:`str` instead " +"of :class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" msgstr "" +":attr:`struct.Struct.format` の型が :class:`bytes` から :class:`str` に変わり" +"ました。\n" +"(Contributed by Victor Stinner in :issue:`21071`.)" -#: ../../whatsnew/3.7.rst:2320 msgid "" ":func:`!cgi.parse_multipart` now accepts the *encoding* and *errors* " "arguments and returns the same results as :class:`!FieldStorage`: for non-" "file fields, the value associated to a key is a list of strings, not bytes. " "(Contributed by Pierre Quentel in :issue:`29979`.)" msgstr "" +":func:`!cgi.parse_multipart` が *encoding* と *errors* 引数を受け付" +"け、:class:`!FieldStorage` と同じ結果を返すようになりました。\n" +"ファイル以外のフィールドでは、キーに対応する値が bytes ではなく文字列のリスト" +"になります。\n" +"(Contributed by Pierre Quentel in :issue:`29979`.)" -#: ../../whatsnew/3.7.rst:2326 msgid "" "Due to internal changes in :mod:`socket`, calling :func:`socket.fromshare` " "on a socket created by :func:`socket.share ` in older " "Python versions is not supported." msgstr "" +":mod:`socket` の内部変更により、古い Python バージョンの :func:`socket.share " +"` で作成したソケットに対する :func:`socket.fromshare` の" +"呼び出しはサポートされません。" -#: ../../whatsnew/3.7.rst:2330 msgid "" "``repr`` for :exc:`BaseException` has changed to not include the trailing " "comma. Most exceptions are affected by this change. (Contributed by Serhiy " "Storchaka in :issue:`30399`.)" msgstr "" +":exc:`BaseException` の ``repr`` に末尾のカンマが含まれなくなりました。\n" +"ほとんどの例外がこの変更の影響を受けます。\n" +"(Contributed by Serhiy Storchaka in :issue:`30399`.)" -#: ../../whatsnew/3.7.rst:2334 msgid "" "``repr`` for :class:`datetime.timedelta` has changed to include the keyword " "arguments in the output. (Contributed by Utkarsh Upadhyay in :issue:`30302`.)" msgstr "" +":class:`datetime.timedelta` の ``repr`` は、出力にキーワード引数を含むように" +"なりました。\n" +"(Contributed by Utkarsh Upadhyay in :issue:`30302`.)" -#: ../../whatsnew/3.7.rst:2337 msgid "" -"Because :func:`shutil.rmtree` is now implemented using the :func:`os." -"scandir` function, the user specified handler *onerror* is now called with " -"the first argument ``os.scandir`` instead of ``os.listdir`` when listing the " -"directory is failed." +"Because :func:`shutil.rmtree` is now implemented using " +"the :func:`os.scandir` function, the user specified handler *onerror* is now " +"called with the first argument ``os.scandir`` instead of ``os.listdir`` when " +"listing the directory is failed." msgstr "" +":func:`shutil.rmtree` が :func:`os.scandir` で実装されるようになったため、" +"ディレクトリの一覧取得に失敗した場合、ユーザーが指定した *onerror* ハンドラー" +"の第 1 引数は ``os.listdir`` ではなく ``os.scandir`` になります。" -#: ../../whatsnew/3.7.rst:2342 msgid "" "Support for nested sets and set operations in regular expressions as in " "`Unicode Technical Standard #18`_ might be added in the future. This would " @@ -3486,8 +4308,16 @@ msgid "" "``'--'``, ``'&&'``, ``'~~'``, and ``'||'``. To avoid a warning, escape them " "with a backslash. (Contributed by Serhiy Storchaka in :issue:`30349`.)" msgstr "" +"将来、`Unicode Technical Standard #18`_ のように、正規表現で入れ子の集合や集" +"合演算をサポートする可能性があります。\n" +"その場合は構文が変わります。\n" +"将来の変更を容易にするため、当面は曖昧な場合に :exc:`FutureWarning` を出しま" +"す。\n" +"これにはリテラルの ``'['`` で始まる集合や、リテラルの文字列 ``'--'``、" +"``'&&'``、``'~~'``、``'||'`` を含む集合が該当します。\n" +"警告を避けるには、バックスラッシュでエスケープしてください。\n" +"(Contributed by Serhiy Storchaka in :issue:`30349`.)" -#: ../../whatsnew/3.7.rst:2353 msgid "" "The result of splitting a string on a :mod:`regular expression ` that " "could match an empty string has been changed. For example splitting on " @@ -3497,8 +4327,13 @@ msgid "" "pattern to ``r'\\s+'``. A :exc:`FutureWarning` was emitted for such " "patterns since Python 3.5." msgstr "" +"空文字列にマッチし得る :mod:`正規表現 ` で文字列を分割したときの結果が変" +"わりました。\n" +"例えば ``r'\\s*'`` では、以前のように空白だけで分割するのではなく、すべての非" +"空白文字の直前と文字列の末尾の直前の空文字列でも分割します。\n" +"パターンを ``r'\\s+'`` に変えると以前の動作に戻せます。\n" +"このようなパターンには Python 3.5 から :exc:`FutureWarning` が出ていました。" -#: ../../whatsnew/3.7.rst:2362 msgid "" "For patterns that match both empty and non-empty strings, the result of " "searching for all matches may also be changed in other cases. For example " @@ -3507,101 +4342,147 @@ msgid "" "positions 2--3. To match only blank lines, the pattern should be rewritten " "as ``r'(?m)^[^\\S\\n]*$'``." msgstr "" +"空文字列と空でない文字列の両方にマッチするパターンでは、すべてのマッチを検索" +"する結果も、ほかの場合に変わることがあります。\n" +"例えば文字列 ``'a\\n\\n'`` に対し、パターン ``r'(?m)^\\s*?$'`` は位置 2 と 3 " +"の空文字列だけでなく、位置 2〜3 の文字列 ``'\\n'`` にもマッチします。\n" +"空白行だけにマッチさせるには ``r'(?m)^[^\\S\\n]*$'`` と書き直してください。" -#: ../../whatsnew/3.7.rst:2369 msgid "" ":func:`re.sub` now replaces empty matches adjacent to a previous non-empty " "match. For example ``re.sub('x*', '-', 'abxd')`` returns now ``'-a-b--d-'`` " "instead of ``'-a-b-d-'`` (the first minus between 'b' and 'd' replaces 'x', " "and the second minus replaces an empty string between 'x' and 'd')." msgstr "" +":func:`re.sub` は、直前の空でないマッチに隣接する空のマッチも置換するようにな" +"りました。\n" +"例えば ``re.sub('x*', '-', 'abxd')`` は ``'-a-b-d-'`` ではなく ``'-a-b--" +"d-'`` を返します ('b' と 'd' の間の最初のマイナスは 'x' を、二つ目は 'x' と " +"'d' の間の空文字列を置き換えたものです)。" -#: ../../whatsnew/3.7.rst:2375 msgid "(Contributed by Serhiy Storchaka in :issue:`25054` and :issue:`32308`.)" -msgstr "" +msgstr "(Serhiy Storchaka による貢献、:issue:`25054`、:issue:`32308`。)" -#: ../../whatsnew/3.7.rst:2377 msgid "" "Change :func:`re.escape` to only escape regex special characters instead of " "escaping all characters other than ASCII letters, numbers, and ``'_'``. " "(Contributed by Serhiy Storchaka in :issue:`29995`.)" msgstr "" +":func:`re.escape` は、ASCII の英数字と ``'_'`` 以外をすべてエスケープするので" +"はなく、正規表現の特殊文字だけをエスケープするようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`29995`.)" -#: ../../whatsnew/3.7.rst:2381 msgid "" ":class:`tracemalloc.Traceback` frames are now sorted from oldest to most " "recent to be more consistent with :mod:`traceback`. (Contributed by Jesse " "Bakker in :issue:`32121`.)" msgstr "" +":class:`tracemalloc.Traceback` のフレームは、:mod:`traceback` と揃うように、" +"古いものから新しいものへ並ぶようになりました。\n" +"(Contributed by Jesse Bakker in :issue:`32121`.)" -#: ../../whatsnew/3.7.rst:2385 msgid "" -"On OSes that support :const:`socket.SOCK_NONBLOCK` or :const:`socket." -"SOCK_CLOEXEC` bit flags, the :attr:`socket.type ` no " -"longer has them applied. Therefore, checks like ``if sock.type == socket." -"SOCK_STREAM`` work as expected on all platforms. (Contributed by Yury " -"Selivanov in :issue:`32331`.)" +"On OSes that support :const:`socket.SOCK_NONBLOCK` " +"or :const:`socket.SOCK_CLOEXEC` bit flags, the :attr:`socket.type " +"` no longer has them applied. Therefore, checks like " +"``if sock.type == socket.SOCK_STREAM`` work as expected on all platforms. " +"(Contributed by Yury Selivanov in :issue:`32331`.)" msgstr "" +":const:`socket.SOCK_NONBLOCK` または :const:`socket.SOCK_CLOEXEC` ビットフラ" +"グをサポートする OS では、:attr:`socket.type ` にこれらの" +"フラグが含まれなくなりました。\n" +"そのため ``if sock.type == socket.SOCK_STREAM`` のような検査が、すべてのプ" +"ラットフォームで期待どおりに動作します。\n" +"(Contributed by Yury Selivanov in :issue:`32331`.)" -#: ../../whatsnew/3.7.rst:2392 msgid "" -"On Windows the default for the *close_fds* argument of :class:`subprocess." -"Popen` was changed from :const:`False` to :const:`True` when redirecting the " -"standard handles. If you previously depended on handles being inherited when " -"using :class:`subprocess.Popen` with standard io redirection, you will have " -"to pass ``close_fds=False`` to preserve the previous behaviour, or use :attr:" -"`STARTUPINFO.lpAttributeList `." +"On Windows the default for the *close_fds* argument " +"of :class:`subprocess.Popen` was changed from :const:`False` " +"to :const:`True` when redirecting the standard handles. If you previously " +"depended on handles being inherited when using :class:`subprocess.Popen` " +"with standard io redirection, you will have to pass ``close_fds=False`` to " +"preserve the previous behaviour, or use :attr:`STARTUPINFO.lpAttributeList " +"`." msgstr "" +"Windows で標準ハンドルをリダイレクトする場合、:class:`subprocess.Popen` の " +"*close_fds* 引数のデフォルト値が :const:`False` から :const:`True` に変わりま" +"した。\n" +"標準 I/O をリダイレクトする :class:`subprocess.Popen` の呼び出しでハンドルが" +"継承されることに依存していた場合、従来の動作を保つには ``close_fds=False`` を" +"渡すか、:attr:`STARTUPINFO.lpAttributeList " +"` を使ってください。" -#: ../../whatsnew/3.7.rst:2400 msgid "" ":meth:`importlib.machinery.PathFinder.invalidate_caches` -- which implicitly " -"affects :func:`importlib.invalidate_caches` -- now deletes entries in :data:" -"`sys.path_importer_cache` which are set to ``None``. (Contributed by Brett " -"Cannon in :issue:`33169`.)" -msgstr "" - -#: ../../whatsnew/3.7.rst:2405 -msgid "" -"In :mod:`asyncio`, :meth:`loop.sock_recv() `, :meth:" -"`loop.sock_sendall() `, :meth:`loop.sock_accept() " -"`, :meth:`loop.getaddrinfo() `, :meth:`loop.getnameinfo() ` have " -"been changed to be proper coroutine methods to match their documentation. " -"Previously, these methods returned :class:`asyncio.Future` instances. " +"affects :func:`importlib.invalidate_caches` -- now deletes entries " +"in :data:`sys.path_importer_cache` which are set to ``None``. (Contributed " +"by Brett Cannon in :issue:`33169`.)" +msgstr "" +":meth:`importlib.machinery.PathFinder.invalidate_caches` " +"は、:data:`sys.path_importer_cache` で ``None`` に設定されたエントリーを削除" +"するようになりました。\n" +"これは :func:`importlib.invalidate_caches` にも暗黙に影響します。\n" +"(Contributed by Brett Cannon in :issue:`33169`.)" + +msgid "" +"In :mod:`asyncio`, :meth:`loop.sock_recv() " +"`, :meth:`loop.sock_sendall() " +"`, :meth:`loop.sock_accept() " +"`, :meth:`loop.getaddrinfo() " +"`, :meth:`loop.getnameinfo() " +"` have been changed to be proper coroutine methods " +"to match their documentation. Previously, these methods " +"returned :class:`asyncio.Future` instances. (Contributed by Yury Selivanov " +"in :issue:`32327`.)" +msgstr "" +":mod:`asyncio` の :meth:`loop.sock_recv() " +"`、:meth:`loop.sock_sendall() " +"`、:meth:`loop.sock_accept() " +"`、:meth:`loop.getaddrinfo() " +"`、:meth:`loop.getnameinfo() " +"` は、ドキュメントどおりのコルーチンメソッドになり" +"ました。\n" +"以前は :class:`asyncio.Future` インスタンスを返していました。\n" "(Contributed by Yury Selivanov in :issue:`32327`.)" -msgstr "" -#: ../../whatsnew/3.7.rst:2416 msgid "" ":attr:`asyncio.Server.sockets` now returns a copy of the internal list of " "server sockets, instead of returning it directly. (Contributed by Yury " "Selivanov in :issue:`32662`.)" msgstr "" +":attr:`asyncio.Server.sockets` は、内部のサーバーソケットのリストを直接返さ" +"ず、コピーを返すようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`32662`.)" -#: ../../whatsnew/3.7.rst:2420 msgid "" ":attr:`Struct.format ` is now a :class:`str` instance " -"instead of a :class:`bytes` instance. (Contributed by Victor Stinner in :" -"issue:`21071`.)" +"instead of a :class:`bytes` instance. (Contributed by Victor Stinner " +"in :issue:`21071`.)" msgstr "" +":attr:`Struct.format ` は :class:`bytes` ではな" +"く :class:`str` インスタンスになりました。\n" +"(Contributed by Victor Stinner in :issue:`21071`.)" -#: ../../whatsnew/3.7.rst:2424 msgid "" ":mod:`argparse` subparsers can now be made mandatory by passing " -"``required=True`` to :meth:`ArgumentParser.add_subparsers() `. (Contributed by Anthony Sottile in :issue:" -"`26510`.)" +"``required=True`` to :meth:`ArgumentParser.add_subparsers() " +"`. (Contributed by Anthony Sottile " +"in :issue:`26510`.)" msgstr "" +":mod:`argparse` で :meth:`ArgumentParser.add_subparsers() " +"` に ``required=True`` を渡すと、サブ" +"パーサーを必須にできるようになりました。\n" +"(Contributed by Anthony Sottile in :issue:`26510`.)" -#: ../../whatsnew/3.7.rst:2428 msgid "" ":meth:`ast.literal_eval` is now stricter. Addition and subtraction of " "arbitrary numbers are no longer allowed. (Contributed by Serhiy Storchaka " "in :issue:`31778`.)" msgstr "" +":meth:`ast.literal_eval` がより厳格になりました。\n" +"任意の数値の加算や減算は許可されなくなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`31778`.)" -#: ../../whatsnew/3.7.rst:2432 msgid "" ":meth:`Calendar.itermonthdates ` will now " "consistently raise an exception when a date falls outside of the " @@ -3609,25 +4490,41 @@ msgid "" "cannot tolerate such exceptions, the new :meth:`Calendar.itermonthdays3 " "` and :meth:`Calendar.itermonthdays4 " "` can be used. The new methods return " -"tuples and are not restricted by the range supported by :class:`datetime." -"date`. (Contributed by Alexander Belopolsky in :issue:`28292`.)" -msgstr "" +"tuples and are not restricted by the range supported " +"by :class:`datetime.date`. (Contributed by Alexander Belopolsky " +"in :issue:`28292`.)" +msgstr "" +":meth:`Calendar.itermonthdates ` は、日付" +"が ``0001-01-01``〜``9999-12-31`` の範囲外になると、一貫して例外を送出するよ" +"うになりました。\n" +"このような例外を許容できないアプリケーションでは、新し" +"い :meth:`Calendar.itermonthdays3 ` " +"と :meth:`Calendar.itermonthdays4 ` を使え" +"ます。\n" +"新しいメソッドはタプルを返し、:class:`datetime.date` がサポートする範囲に制限" +"されません。\n" +"(Contributed by Alexander Belopolsky in :issue:`28292`.)" -#: ../../whatsnew/3.7.rst:2442 msgid "" ":class:`collections.ChainMap` now preserves the order of the underlying " "mappings. (Contributed by Raymond Hettinger in :issue:`32792`.)" msgstr "" +":class:`collections.ChainMap` は、内部のマッピングの順序を保持するようになり" +"ました。\n" +"(Contributed by Raymond Hettinger in :issue:`32792`.)" -#: ../../whatsnew/3.7.rst:2445 msgid "" "The ``submit()`` method of :class:`concurrent.futures.ThreadPoolExecutor` " -"and :class:`concurrent.futures.ProcessPoolExecutor` now raises a :exc:" -"`RuntimeError` if called during interpreter shutdown. (Contributed by Mark " -"Nemec in :issue:`33097`.)" +"and :class:`concurrent.futures.ProcessPoolExecutor` now raises " +"a :exc:`RuntimeError` if called during interpreter shutdown. (Contributed by " +"Mark Nemec in :issue:`33097`.)" msgstr "" +":class:`concurrent.futures.ThreadPoolExecutor` " +"と :class:`concurrent.futures.ProcessPoolExecutor` の ``submit()`` メソッド" +"は、インタープリタの終了処理中に呼ばれると :exc:`RuntimeError` を送出するよう" +"になりました。\n" +"(Contributed by Mark Nemec in :issue:`33097`.)" -#: ../../whatsnew/3.7.rst:2450 msgid "" "The :class:`configparser.ConfigParser` constructor now uses ``read_dict()`` " "to process the default values, making its behavior consistent with the rest " @@ -3635,30 +4532,46 @@ msgid "" "now being implicitly converted to strings. (Contributed by James Tocknell " "in :issue:`23835`.)" msgstr "" +":class:`configparser.ConfigParser` のコンストラクタは、デフォルト値の処理に " +"``read_dict()`` を使い、パーサーのほかの部分と動作が揃うようになりました。\n" +"デフォルト値の辞書の文字列以外のキーや値は、暗黙に文字列に変換されます。\n" +"(Contributed by James Tocknell in :issue:`23835`.)" -#: ../../whatsnew/3.7.rst:2456 msgid "" -"Several undocumented internal imports were removed. One example is that ``os." -"errno`` is no longer available; use ``import errno`` directly instead. Note " -"that such undocumented internal imports may be removed any time without " +"Several undocumented internal imports were removed. One example is that " +"``os.errno`` is no longer available; use ``import errno`` directly instead. " +"Note that such undocumented internal imports may be removed any time without " "notice, even in micro version releases." msgstr "" +"文書化されていない内部のインポートがいくつか削除されました。\n" +"例えば ``os.errno`` は利用できなくなったため、直接 ``import errno`` を使って" +"ください。\n" +"このような内部のインポートは、マイクロバージョンのリリースでも予告なく削除さ" +"れる可能性があります。" #: ../../whatsnew/3.7.rst:2464 msgid "Changes in the C API" msgstr "C API の変更" -#: ../../whatsnew/3.7.rst:2466 msgid "" "The function :c:func:`PySlice_GetIndicesEx` is considered unsafe for " -"resizable sequences. If the slice indices are not instances of :class:" -"`int`, but objects that implement the :meth:`!__index__` method, the " -"sequence can be resized after passing its length to :c:func:`!" +"resizable sequences. If the slice indices are not instances " +"of :class:`int`, but objects that implement the :meth:`!__index__` method, " +"the sequence can be resized after passing its length to :c:func:`!" "PySlice_GetIndicesEx`. This can lead to returning indices out of the length " -"of the sequence. For avoiding possible problems use new functions :c:func:" -"`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy " -"Storchaka in :issue:`27867`.)" -msgstr "" +"of the sequence. For avoiding possible problems use new " +"functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. " +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" +msgstr "" +":c:func:`PySlice_GetIndicesEx` は、サイズ変更可能なシーケンスに対して安全では" +"ないとされています。\n" +"スライスのインデックスが :class:`int` のインスタンスではなく :meth:`!" +"__index__` を実装するオブジェクトの場合、:c:func:`!PySlice_GetIndicesEx` に長" +"さを渡した後にシーケンスのサイズが変わる可能性があります。\n" +"その結果、シーケンスの長さを超えるインデックスを返す場合があります。\n" +"問題を避けるには、新しい :c:func:`PySlice_Unpack` " +"と :c:func:`PySlice_AdjustIndices` を使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" #: ../../whatsnew/3.7.rst:2477 msgid "CPython bytecode changes" @@ -3670,25 +4583,28 @@ msgid "" "(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)" msgstr "" -#: ../../whatsnew/3.7.rst:2482 msgid "" "The :opcode:`!STORE_ANNOTATION` opcode has been removed. (Contributed by " "Mark Shannon in :issue:`32550`.)" msgstr "" +":opcode:`!STORE_ANNOTATION` オペコードが削除されました。\n" +"(Contributed by Mark Shannon in :issue:`32550`.)" -#: ../../whatsnew/3.7.rst:2489 msgid "" "The file used to override :data:`sys.path` is now called ``._pth`` instead of ``'sys.path'``. See :ref:" -"`windows_finding_modules` for more information. (Contributed by Steve Dower " -"in :issue:`28137`.)" +"executable>._pth`` instead of ``'sys.path'``. " +"See :ref:`windows_finding_modules` for more information. (Contributed by " +"Steve Dower in :issue:`28137`.)" msgstr "" +":data:`sys.path` を上書きするファイルの名前が、``'sys.path'`` から ``._pth`` に変わりました。\n" +"詳しくは :ref:`windows_finding_modules` を参照してください。\n" +"(Contributed by Steve Dower in :issue:`28137`.)" #: ../../whatsnew/3.7.rst:2496 msgid "Other CPython implementation changes" msgstr "その他の CPython の実装の変更" -#: ../../whatsnew/3.7.rst:2498 msgid "" "In preparation for potential future changes to the public CPython runtime " "initialization API (see :pep:`432` for an initial, but somewhat outdated, " @@ -3702,81 +4618,116 @@ msgid "" "part of :issue:`22257`, and further updated by Nick, Eric, and Victor " "Stinner in a number of other issues). Some known details affected:" msgstr "" +"将来の公開 CPython ランタイム初期化 API の変更に備え、CPython 内部の起動処理" +"と設定管理が大幅にリファクタリングされました (初期の、やや古い草案" +"は :pep:`432` を参照)。\n" +"埋め込みアプリケーションや通常の CPython CLI の利用者に影響しないことを意図し" +"た更新ですが、起動時の各種処理の内部的な順序が変わるため、埋め込みアプリケー" +"ションや CPython 自身の潜在的な不具合が表面化する可能性があります。\n" +"そのため、ここで変更を説明します。\n" +"(当初は :issue:`22257` の一環として Nick Coghlan と Eric Snow が貢献し、その" +"後 Nick、Eric、Victor Stinner がほかの複数の課題で更新しました。)\n" +"影響が分かっている点は次のとおりです:" -#: ../../whatsnew/3.7.rst:2511 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode` is not currently usable by embedding " "applications due to the requirement to create a Unicode object prior to " "calling ``Py_Initialize``. Use :c:func:`!PySys_AddWarnOption` instead." msgstr "" +":c:func:`!PySys_AddWarnOptionUnicode` は ``Py_Initialize`` の呼び出し前に " +"Unicode オブジェクトを作成する必要があるため、現時点では埋め込みアプリケー" +"ションでは使えません。\n" +"代わりに :c:func:`!PySys_AddWarnOption` を使ってください。" -#: ../../whatsnew/3.7.rst:2515 msgid "" "warnings filters added by an embedding application with :c:func:`!" "PySys_AddWarnOption` should now more consistently take precedence over the " "default filters set by the interpreter" msgstr "" +"埋め込みアプリケーションが :c:func:`!PySys_AddWarnOption` で追加した警告フィ" +"ルターは、インタープリタが設定したデフォルトのフィルターよりも、一貫して優先" +"されるようになります。" -#: ../../whatsnew/3.7.rst:2519 msgid "" "Due to changes in the way the default warnings filters are configured, " "setting :c:data:`Py_BytesWarningFlag` to a value greater than one is no " "longer sufficient to both emit :exc:`BytesWarning` messages and have them " "converted to exceptions. Instead, the flag must be set (to cause the " -"warnings to be emitted in the first place), and an explicit ``error::" -"BytesWarning`` warnings filter added to convert them to exceptions." +"warnings to be emitted in the first place), and an explicit " +"``error::BytesWarning`` warnings filter added to convert them to exceptions." msgstr "" +"デフォルトの警告フィルターの設定方法が変わったた" +"め、:c:data:`Py_BytesWarningFlag` に 1 より大きい値を設定するだけで" +"は、:exc:`BytesWarning` の発生と例外への変換の両方を行えなくなりました。\n" +"警告を発生させるためのフラグ設定に加え、例外に変換するために明示的な " +"``error::BytesWarning`` 警告フィルターを追加する必要があります。" -#: ../../whatsnew/3.7.rst:2526 msgid "" "Due to a change in the way docstrings are handled by the compiler, the " "implicit ``return None`` in a function body consisting solely of a docstring " "is now marked as occurring on the same line as the docstring, not on the " "function's header line." msgstr "" +"コンパイラの docstring の扱いが変わったため、docstring だけの関数本体にある暗" +"黙の ``return None`` は、関数のヘッダー行ではなく docstring と同じ行で発生す" +"るものとして記録されるようになりました。" -#: ../../whatsnew/3.7.rst:2531 msgid "" "The current exception state has been moved from the frame object to the co-" "routine. This simplified the interpreter and fixed a couple of obscure bugs " "caused by having swap exception state when entering or exiting a generator. " "(Contributed by Mark Shannon in :issue:`25612`.)" msgstr "" +"現在の例外状態がフレームオブジェクトからコルーチンに移されました。\n" +"これによりインタープリタが簡素化され、ジェネレータの開始と終了時に例外状態を" +"切り替える必要があることで生じていた、分かりにくいバグがいくつか修正されまし" +"た。\n" +"(Contributed by Mark Shannon in :issue:`25612`.)" #: ../../whatsnew/3.7.rst:2537 msgid "Notable changes in Python 3.7.1" msgstr "Python 3.7.1 での重要な変更点" -#: ../../whatsnew/3.7.rst:2539 msgid "" "Starting in 3.7.1, :c:func:`Py_Initialize` now consistently reads and " "respects all of the same environment settings as :c:func:`Py_Main` (in " "earlier Python versions, it respected an ill-defined subset of those " "environment variables, while in Python 3.7.0 it didn't read any of them due " -"to :issue:`34247`). If this behavior is unwanted, set :c:data:" -"`Py_IgnoreEnvironmentFlag` to 1 before calling :c:func:`Py_Initialize`." +"to :issue:`34247`). If this behavior is unwanted, " +"set :c:data:`Py_IgnoreEnvironmentFlag` to 1 before " +"calling :c:func:`Py_Initialize`." msgstr "" +"3.7.1 から :c:func:`Py_Initialize` は、:c:func:`Py_Main` と同じ環境設定をすべ" +"て一貫して読み取り、反映するようになりました。\n" +"以前の Python では、明確に定義されていない一部の環境変数だけを反映しており、" +"Python 3.7.0 では :issue:`34247` によりどれも読み込んでいませんでした。\n" +"この動作を望まない場合は、:c:func:`Py_Initialize` の呼び出し前" +"に :c:data:`Py_IgnoreEnvironmentFlag` を 1 に設定してください。" -#: ../../whatsnew/3.7.rst:2546 msgid "" "In 3.7.1 the C API for Context Variables :ref:`was updated " "` to use :c:type:`PyObject` " "pointers. See also :issue:`34762`." msgstr "" +"3.7.1 では、コンテキスト変数の C API が :c:type:`PyObject` ポインタを使うよう" +"に :ref:`更新されました `。\n" +":issue:`34762` も参照してください。" -#: ../../whatsnew/3.7.rst:2550 msgid "" "In 3.7.1 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token " "when provided with input that does not have a trailing new line. This " "behavior now matches what the C tokenizer does internally. (Contributed by " "Ammar Askar in :issue:`33899`.)" msgstr "" +"3.7.1 では :mod:`tokenize` モジュールが、末尾に改行のない入力に対して暗黙に " +"``NEWLINE`` トークンを出力するようになりました。\n" +"これにより C のトークナイザーの内部動作と一致します。\n" +"(Contributed by Ammar Askar in :issue:`33899`.)" #: ../../whatsnew/3.7.rst:2556 msgid "Notable changes in Python 3.7.2" msgstr "Python 3.7.2 での重要な変更点" -#: ../../whatsnew/3.7.rst:2558 msgid "" "In 3.7.2, :mod:`venv` on Windows no longer copies the original binaries, but " "creates redirector scripts named ``python.exe`` and ``pythonw.exe`` instead. " @@ -3785,47 +4736,62 @@ msgid "" "this release will still require recreation of virtual environments in order " "to get the new scripts." msgstr "" +"3.7.2 では Windows の :mod:`venv` は、元のバイナリをコピーする代わりに、" +"``python.exe`` と ``pythonw.exe`` という名前のリダイレクタースクリプトを作成" +"するようになりました。\n" +"これにより、Python の更新のたびにすべての仮想環境を更新または再作成する必要が" +"あるという長年の問題が解決します。\n" +"ただし、このリリースでは新しいスクリプトを使うために、まだ仮想環境の再作成が" +"必要です。" #: ../../whatsnew/3.7.rst:2566 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 " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" -"セキュリティ上の重大な懸念により、:meth:`asyncio.loop." -"create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" -"``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " -"Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" +"セキュリティ上の重大な懸念によ" +"り、:meth:`asyncio.loop.create_datagram_endpoint` での *reuse_address* 引数は" +"無効になりました。これはソケットオプション ``SO_REUSEADDR`` のUDP における挙" +"動が原因です。詳しくは、``loop.create_datagram_endpoint()`` のドキュメントを" +"参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov による貢" +"献 :issue:`37228`)" #: ../../whatsnew/3.7.rst:2576 msgid "Notable changes in Python 3.7.10" msgstr "Python 3.7.10 での重要な変更点" -#: ../../whatsnew/3.7.rst:2578 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" -msgstr "" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" +msgstr "" +"以前の Python では :func:`urllib.parse.parse_qs` " +"と :func:`urllib.parse.parse_qsl` のクエリパラメータの区切りに ``;`` と " +"``&`` の両方を使えました。\n" +"セキュリティ上の懸念と、新しい W3C 勧告への準拠のため、区切りは 1 種類のみと" +"なり、デフォルトは ``&`` に変更されました。\n" +"これらの関数を内部で使う :func:`!cgi.parse` と :func:`!cgi.parse_multipart` " +"も影響を受けます。\n" +"詳しくは各関数のドキュメントを参照してください。\n" +"(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" -#: ../../whatsnew/3.7.rst:2589 msgid "Notable changes in Python 3.7.11" -msgstr "" +msgstr "Python 3.7.11 の注目すべき変更" -#: ../../whatsnew/3.7.rst:2591 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -3833,22 +4799,32 @@ msgid "" "old behavior, set a ``trust_server_pasv_ipv4_address`` attribute on your FTP " "instance to ``True``. (See :gh:`87451`)" msgstr "" +"セキュリティ修正により、:class:`ftplib.FTP` はパッシブデータチャネルを確立す" +"るとき、リモートサーバーから送られた IPv4 アドレスを信頼しなくなりました。\n" +"代わりに FTP サーバーの IP アドレスを再利用します。\n" +"従来の動作が必要な特殊なコードでは、FTP インスタンスの " +"``trust_server_pasv_ipv4_address`` 属性を ``True`` に設定してください " +"(:gh:`87451` を参照)。" -#: ../../whatsnew/3.7.rst:2598 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 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"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 仕様に従い、パーサー :func:`urllib.parse` は " +"ASCII の改行 ``\\n``、``\\r`` とタブ ``\\t`` を URL から取り除き、このような" +"攻撃を防ぐようになりました。\n" +"削除対象の文字は、新しいモジュール変数 " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE`` で制御します (:gh:`88048` を参" +"照)。" -#: ../../whatsnew/3.7.rst:2606 msgid "Notable security feature in 3.7.14" -msgstr "" +msgstr "3.7.14 の注目すべきセキュリティ機能" -#: ../../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 +4836,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..da013fcf0 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 @@ -37,12 +37,14 @@ msgstr "編集者" msgid "Raymond Hettinger" msgstr "Raymond Hettinger" -#: ../../whatsnew/3.8.rst:47 msgid "" "This article explains the new features in Python 3.8, compared to 3.7. " -"Python 3.8 was released on October 14, 2019. For full details, see the :ref:" -"`changelog `." +"Python 3.8 was released on October 14, 2019. For full details, see " +"the :ref:`changelog `." msgstr "" +"この記事では Python 3.7 と比較した Python 3.8 の新機能を解説します。\n" +"Python 3.8 は 2019 年 10 月 14 日にリリースされました。\n" +"詳しくは :ref:`変更履歴 ` を参照してください。" #: ../../whatsnew/3.8.rst:61 msgid "Summary -- Release highlights" @@ -60,8 +62,9 @@ msgstr "代入式" msgid "" "There is new syntax ``:=`` that assigns values to variables as part of a " "larger expression. It is affectionately known as \"the walrus operator\" due " -"to its resemblance to `the eyes and tusks of a walrus `_." +"to its resemblance to `the eyes and tusks of a walrus `_." msgstr "" "大きな構文の一部として、変数に値を割り当てる新しい構文 ``:=`` が追加されまし" "た。\n" @@ -77,11 +80,12 @@ msgstr "" "以下の例では、代入式により :func:`len` 関数を二重に呼びだすことを回避していま" "す::" -#: ../../whatsnew/3.8.rst:85 msgid "" "if (n := len(a)) > 10:\n" " print(f\"List is too long ({n} elements, expected <= 10)\")" msgstr "" +"if (n := len(a)) > 10:\n" +" print(f\"List is too long ({n} elements, expected <= 10)\")" #: ../../whatsnew/3.8.rst:88 msgid "" @@ -92,12 +96,14 @@ msgstr "" "同様の利点が、マッチがしたかどうかの判定とサブグループの取得とで2回マッチオブ" "ジェクトが必要になる、正規表現によるマッチでも、発揮されます::" -#: ../../whatsnew/3.8.rst:92 msgid "" "discount = 0.0\n" "if (mo := re.search(r'(\\d+)% discount', advertisement)):\n" " discount = float(mo.group(1)) / 100.0" msgstr "" +"discount = 0.0\n" +"if (mo := re.search(r'(\\d+)% discount', advertisement)):\n" +" discount = float(mo.group(1)) / 100.0" #: ../../whatsnew/3.8.rst:96 msgid "" @@ -108,12 +114,14 @@ msgstr "" "この演算子は、生成した値をループ終了の判定とループ本体の両方で使用するような " "while 文においても、有用です::" -#: ../../whatsnew/3.8.rst:100 msgid "" "# Loop over fixed length blocks\n" "while (block := f.read(256)) != '':\n" " process(block)" msgstr "" +"# 固定長のブロックを繰り返し処理する\n" +"while (block := f.read(256)) != '':\n" +" process(block)" #: ../../whatsnew/3.8.rst:104 msgid "" @@ -123,11 +131,12 @@ msgstr "" "動機となったもう 1 つのユースケースは、リスト内包表記においてフィルター条件の" "中で計算した値が式の本体でも必要になるところから出てきます::" -#: ../../whatsnew/3.8.rst:108 msgid "" "[clean_name.title() for name in names\n" " if (clean_name := normalize('NFC', name)) in allowed_names]" msgstr "" +"[clean_name.title() for name in names\n" +" if (clean_name := normalize('NFC', name)) in allowed_names]" #: ../../whatsnew/3.8.rst:111 msgid "" @@ -149,14 +158,19 @@ msgstr "(Emily Morehouse の貢献による :issue:`35224`)" msgid "Positional-only parameters" msgstr "位置専用引数" -#: ../../whatsnew/3.8.rst:122 msgid "" "There is a new function parameter syntax ``/`` to indicate that some " "function parameters must be specified positionally and cannot be used as " "keyword arguments. This is the same notation shown by ``help()`` for C " -"functions annotated with Larry Hastings' `Argument Clinic `__ tool." +"functions annotated with Larry Hastings' `Argument Clinic `__ tool." msgstr "" +"関数のパラメータに新しい構文 ``/`` が追加され、一部のパラメータを位置引数とし" +"てのみ指定でき、キーワード引数では指定できないことを示せるようになりまし" +"た。\n" +"これは Larry Hastings の `Argument Clinic `__ ツールでアノテーションを付けた C 関数に対し、" +"``help()`` が表示する表記と同じです。" #: ../../whatsnew/3.8.rst:128 msgid "" @@ -167,43 +181,48 @@ msgstr "" "以下の例では、引数 *a* と *b* が位置専用、 *c* と *d* が位置引数でもキーワー" "ド引数でも可、*e* と *f* はキーワード引数専用です::" -#: ../../whatsnew/3.8.rst:132 msgid "" "def f(a, b, /, c, d, *, e, f):\n" " print(a, b, c, d, e, f)" msgstr "" +"def f(a, b, /, c, d, *, e, f):\n" +" print(a, b, c, d, e, f)" #: ../../whatsnew/3.8.rst:135 msgid "The following is a valid call::" msgstr "以下は正しい関数呼び出しです::" -#: ../../whatsnew/3.8.rst:137 msgid "f(10, 20, 30, d=40, e=50, f=60)" -msgstr "" +msgstr "f(10, 20, 30, d=40, e=50, f=60)" #: ../../whatsnew/3.8.rst:139 msgid "However, these are invalid calls::" msgstr "一方、以下は不正です::" -#: ../../whatsnew/3.8.rst:141 msgid "" "f(10, b=20, c=30, d=40, e=50, f=60) # b cannot be a keyword argument\n" "f(10, 20, 30, 40, 50, f=60) # e must be a keyword argument" msgstr "" +"f(10, b=20, c=30, d=40, e=50, f=60) # b はキーワード引数にできない\n" +"f(10, 20, 30, 40, 50, f=60) # e はキーワード引数でなければならない" -#: ../../whatsnew/3.8.rst:144 msgid "" "One use case for this notation is that it allows pure Python functions to " "fully emulate behaviors of existing C coded functions. For example, the " "built-in :func:`divmod` function does not accept keyword arguments::" msgstr "" +"この表記の用途の一つは、純粋な Python の関数で既存の C 実装の関数の動作を完全" +"に再現することです。\n" +"例えば、組み込みの :func:`divmod` 関数はキーワード引数を受け付けません。 ::" -#: ../../whatsnew/3.8.rst:148 msgid "" "def divmod(a, b, /):\n" " \"Emulate the built in divmod() function\"\n" " return (a // b, a % b)" msgstr "" +"def divmod(a, b, /):\n" +" \"Emulate the built in divmod() function\"\n" +" return (a // b, a % b)" #: ../../whatsnew/3.8.rst:152 msgid "" @@ -215,9 +234,8 @@ msgstr "" "用を排除することです。例えば組み込み関数 :func:`len` は ``len(obj, /)`` とい" "うシグニチャです。これにより、以下のようなぎこちない呼び出しが排除されます::" -#: ../../whatsnew/3.8.rst:156 msgid "len(obj='hello') # The \"obj\" keyword argument impairs readability" -msgstr "" +msgstr "len(obj='hello') # \"obj\" キーワード引数は読みやすさを損なう" #: ../../whatsnew/3.8.rst:158 msgid "" @@ -238,15 +256,13 @@ 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 msgid "" ">>> def f(a, b, /, **kwargs):\n" "... print(a, b, kwargs)\n" @@ -254,6 +270,11 @@ msgid "" ">>> f(10, 20, a=1, b=2, c=3) # a and b are used in two ways\n" "10 20 {'a': 1, 'b': 2, 'c': 3}" msgstr "" +">>> def f(a, b, /, **kwargs):\n" +"... print(a, b, kwargs)\n" +"...\n" +">>> f(10, 20, a=1, b=2, c=3) # a と b を二通りに使用\n" +"10 20 {'a': 1, 'b': 2, 'c': 3}" #: ../../whatsnew/3.8.rst:176 msgid "" @@ -265,13 +286,16 @@ msgstr "" "とシンプルになります。例えば、これは :mod:`collections` モジュールから抜き出" "したコードです:" -#: ../../whatsnew/3.8.rst:180 msgid "" "class Counter(dict):\n" "\n" " def __init__(self, iterable=None, /, **kwds):\n" " # Note \"iterable\" is a possible keyword argument" msgstr "" +"class Counter(dict):\n" +"\n" +" def __init__(self, iterable=None, /, **kwds):\n" +" # \"iterable\" はキーワード引数にも使えることに注意" #: ../../whatsnew/3.8.rst:185 msgid "See :pep:`570` for a full description." @@ -294,15 +318,16 @@ msgid "" "subdirectories within each source directory." msgstr "" "暗黙のバイトコードキャッシュは、デフォルトでは各ソースコードのディレクトリ内" -"の ``__pycache__`` サブディレクトリを使用しますが、新たに追加された環境変数 :" -"envvar:`PYTHONPYCACHEPREFIX` (またはコマンドラインオプション :option:`-X` " -"``pycache_prefix``) を指定すると、ソースコードと分離されたディレクトリツリー" -"に格納されるようになります。" +"の ``__pycache__`` サブディレクトリを使用しますが、新たに追加された環境変" +"数 :envvar:`PYTHONPYCACHEPREFIX` (またはコマンドラインオプション :option:`-" +"X` ``pycache_prefix``) を指定すると、ソースコードと分離されたディレクトリツ" +"リーに格納されるようになります。" #: ../../whatsnew/3.8.rst:201 msgid "" -"The location of the cache is reported in :data:`sys.pycache_prefix` (:const:" -"`None` indicates the default location in ``__pycache__`` subdirectories)." +"The location of the cache is reported in :data:`sys.pycache_prefix` " +"(:const:`None` indicates the default location in ``__pycache__`` " +"subdirectories)." msgstr "" "キャッシュの場所は :data:`sys.pycache_prefix` で参照できます" "(``__pycache__`` を使用する場合は :const:`None` になります)。" @@ -331,10 +356,10 @@ msgid "" "Release builds and :ref:`debug builds ` are now ABI compatible: " "defining the ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` " "macro, which introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` " -"macro, which adds the :func:`sys.getobjects` function and the :envvar:" -"`PYTHONDUMPREFS` environment variable, can be set using the new :option:`./" -"configure --with-trace-refs <--with-trace-refs>` build option. (Contributed " -"by Victor Stinner in :issue:`36465`.)" +"macro, which adds the :func:`sys.getobjects` function and " +"the :envvar:`PYTHONDUMPREFS` environment variable, can be set using the " +"new :option:`./configure --with-trace-refs <--with-trace-refs>` build " +"option. (Contributed by Victor Stinner in :issue:`36465`.)" msgstr "" #: ../../whatsnew/3.8.rst:223 @@ -346,8 +371,8 @@ msgid "" msgstr "" "Unix においては、Android とCygwin を除き、C拡張モジュールはlibpython にリン" "クされなくなりました。静的リンクされたPython は、Python 共有ライブラリを用い" -"てビルドされたC拡張モジュールを読み込めます。(Victor Stinner の貢献による :" -"issue:`21536`.)" +"てビルドされたC拡張モジュールを読み込めます。(Victor Stinner の貢献によ" +"る :issue:`21536`.)" #: ../../whatsnew/3.8.rst:230 msgid "" @@ -387,16 +412,16 @@ msgstr "" "ジュールが追加されました: ``pkg-config python-3.8-embed --libs`` の出力は、" "``-lpython3.8`` を含みます。 Python3.8 以前との互換性を保つためには、``pkg-" "config python-X.Y-embed --libs`` をまず試みてから、失敗した場合 ``pkg-config " -"python-X.Y --libs`` (``--embed`` なし) にフォールバックしてください。(``X." -"Y`` を使用するPython のバージョンに置き換えてください)" +"python-X.Y --libs`` (``--embed`` なし) にフォールバックしてください。" +"(``X.Y`` を使用するPython のバージョンに置き換えてください)" #: ../../whatsnew/3.8.rst:247 msgid "" "On the other hand, ``pkg-config python3.8 --libs`` no longer contains ``-" "lpython3.8``. C extensions must not be linked to libpython (except on " "Android and Cygwin, whose cases are handled by the script); this change is " -"backward incompatible on purpose. (Contributed by Victor Stinner in :issue:" -"`36721`.)" +"backward incompatible on purpose. (Contributed by Victor Stinner " +"in :issue:`36721`.)" msgstr "" "一方で、``pkg-config python3.8 --libs`` は出力に ``-lpython3.8`` を含まなくな" "りました。C拡張モジュールは、libpython にリンクされるべきではありません。 (ス" @@ -438,11 +463,12 @@ msgid "" "can be shown::" msgstr "``=`` 指定子は式すべてを表示するので、次のような計算も表示できます::" -#: ../../whatsnew/3.8.rst:277 msgid "" ">>> print(f'{theta=} {cos(radians(theta))=:.3f}')\n" "theta=30 cos(radians(theta))=0.866" msgstr "" +">>> print(f'{theta=} {cos(radians(theta))=:.3f}')\n" +"theta=30 cos(radians(theta))=0.866" #: ../../whatsnew/3.8.rst:280 msgid "(Contributed by Eric V. Smith and Larry Hastings in :issue:`36817`.)" @@ -466,9 +492,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,24 +655,27 @@ 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`.)" msgstr "(Victor Stinner の貢献による :issue:`36763`)" -#: ../../whatsnew/3.8.rst:352 msgid "PEP 590: Vectorcall: a fast calling protocol for CPython" -msgstr "" +msgstr "PEP 590: Vectorcall: CPython の高速な呼び出しプロトコル" -#: ../../whatsnew/3.8.rst:354 msgid "" ":ref:`vectorcall` is added to the Python/C API. It is meant to formalize " -"existing optimizations which were already done for various classes. Any :ref:" -"`static type ` implementing a callable can use this protocol." +"existing optimizations which were already done for various classes. " +"Any :ref:`static type ` implementing a callable can use this " +"protocol." msgstr "" +"Python/C API に :ref:`vectorcall` が追加されました。\n" +"さまざまなクラスで既に行われていた最適化を、正式な仕組みとして定めるもので" +"す。\n" +"呼び出し可能オブジェクトを実装する任意の :ref:`静的型 ` がこの" +"プロトコルを使えます。" #: ../../whatsnew/3.8.rst:360 msgid "" @@ -656,15 +684,14 @@ 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 "" -"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in :issue:" -"`36974`.)" +"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin " +"in :issue:`36974`.)" msgstr "" +"(Jeroen Demeyer、Mark Shannon、Petr Viktorin による貢献、:issue:`36974`。)" #: ../../whatsnew/3.8.rst:369 msgid "Pickle protocol 5 with out-of-band data buffers" @@ -691,9 +718,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`.)" @@ -716,17 +742,17 @@ msgstr "" #: ../../whatsnew/3.8.rst:393 msgid "" "The :class:`bool`, :class:`int`, and :class:`fractions.Fraction` types now " -"have an :meth:`~int.as_integer_ratio` method like that found in :class:" -"`float` and :class:`decimal.Decimal`. This minor API extension makes it " -"possible to write ``numerator, denominator = x.as_integer_ratio()`` and have " -"it work across multiple numeric types. (Contributed by Lisa Roach in :issue:" -"`33073` and Raymond Hettinger in :issue:`37819`.)" -msgstr "" -":class:`bool`, :class:`int`, :class:`fractions.Fraction` タイプは、:class:" -"`float` や :class:`decimal.Decimal` と同様の :meth:`~int.as_integer_ratio` メ" -"ソッドを持つようになりました。このAPI の拡張によって、``numerator, " -"denominator = x.as_integer_ratio()`` のようなコードがより多くの数値型で動作し" -"ます。\n" +"have an :meth:`~int.as_integer_ratio` method like that found " +"in :class:`float` and :class:`decimal.Decimal`. This minor API extension " +"makes it possible to write ``numerator, denominator = x.as_integer_ratio()`` " +"and have it work across multiple numeric types. (Contributed by Lisa Roach " +"in :issue:`33073` and Raymond Hettinger in :issue:`37819`.)" +msgstr "" +":class:`bool`, :class:`int`, :class:`fractions.Fraction` タイプ" +"は、:class:`float` や :class:`decimal.Decimal` と同様" +"の :meth:`~int.as_integer_ratio` メソッドを持つようになりました。このAPI の拡" +"張によって、``numerator, denominator = x.as_integer_ratio()`` のようなコード" +"がより多くの数値型で動作します。\n" "(Lisa Roach の貢献による :issue:`33073` および Raymond Hettinger の貢献によ" "る :issue:`37819`)" @@ -734,28 +760,33 @@ msgstr "" msgid "" "Constructors of :class:`int`, :class:`float` and :class:`complex` will now " "use the :meth:`~object.__index__` special method, if available and the " -"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` or :" -"meth:`~object.__complex__` is not available. (Contributed by Serhiy " +"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` is not available. (Contributed by Serhiy " "Storchaka in :issue:`20092`.)" msgstr "" ":class:`int`, :class:`float`, :class:`complex` のコンストラクタは、可能なら" -"ば :meth:`~object.__index__` 特殊メソッドを利用し、その場合は対応する :meth:" -"`~object.__int__`, :meth:`~object.__float__` や :meth:`~object.__complex__` " -"は使用できません。(Serhiy Storchaka の貢献による :issue:`20092`)" +"ば :meth:`~object.__index__` 特殊メソッドを利用し、その場合は対応す" +"る :meth:`~object.__int__`, :meth:`~object.__float__` " +"や :meth:`~object.__complex__` は使用できません。(Serhiy Storchaka の貢献によ" +"る :issue:`20092`)" -#: ../../whatsnew/3.8.rst:407 msgid "" "Added support of :samp:`\\\\N\\\\{{name}\\\\}` escapes in :mod:`regular " "expressions `::" msgstr "" +":mod:`正規表現 ` で :samp:`\\\\N\\\\{{name}\\\\}` エスケープをサポートし" +"ました。 ::" -#: ../../whatsnew/3.8.rst:409 msgid "" ">>> notice = 'Copyright © 2019'\n" ">>> copyright_year_pattern = re.compile(r'\\N{copyright sign}\\s*(\\d{4})')\n" ">>> int(copyright_year_pattern.search(notice).group(1))\n" "2019" msgstr "" +">>> notice = 'Copyright © 2019'\n" +">>> copyright_year_pattern = re.compile(r'\\N{copyright sign}\\s*(\\d{4})')\n" +">>> int(copyright_year_pattern.search(notice).group(1))\n" +"2019" #: ../../whatsnew/3.8.rst:414 msgid "" @@ -764,8 +795,8 @@ msgstr "(Jonathan Eunice, Serhiy Storchaka の貢献による :issue:`30688`)" #: ../../whatsnew/3.8.rst:416 msgid "" -"Dict and dictviews are now iterable in reversed insertion order using :func:" -"`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" +"Dict and dictviews are now iterable in reversed insertion order " +"using :func:`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" msgstr "" "dict と dictview は、:func:`reversed` を使って逆順でイテレートすることが可能" "になりました。(Rémi Lapeyre の貢献による :issue:`33462`)" @@ -775,8 +806,8 @@ msgid "" "The syntax allowed for keyword names in function calls was further " "restricted. In particular, ``f((keyword)=arg)`` is no longer allowed. It was " "never intended to permit more than a bare name on the left-hand side of a " -"keyword argument assignment term. (Contributed by Benjamin Peterson in :" -"issue:`34641`.)" +"keyword argument assignment term. (Contributed by Benjamin Peterson " +"in :issue:`34641`.)" msgstr "" "関数内でのキーワード名に関する構文の制限が強化されました。具体的には、" "``f((keyword)=arg)`` の表現が許容されなくなりました。キーワード引数への代入の" @@ -794,7 +825,6 @@ msgstr "" "展開のために、全体を覆うかっこが不要になりました。これは *yield* と *return* " "の表現を、一般の展開と同様のわかりやすい形式にします::" -#: ../../whatsnew/3.8.rst:430 msgid "" ">>> def parse(family):\n" "... lastname, *members = family.split()\n" @@ -803,10 +833,15 @@ msgid "" ">>> parse('simpsons homer marge bart lisa maggie')\n" "('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" msgstr "" +">>> def parse(family):\n" +"... lastname, *members = family.split()\n" +"... return lastname.upper(), *members\n" +"...\n" +">>> parse('simpsons homer marge bart lisa maggie')\n" +"('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" -#: ../../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 "" @@ -815,26 +850,27 @@ msgid "" "just having a :exc:`TypeError` indicating that the first tuple was not " "callable. (Contributed by Serhiy Storchaka in :issue:`15248`.)" msgstr "" -"``[(10, 20) (30, 40)]`` のようなコードでコンマが無い場合、コンパイラは :exc:" -"`SyntaxWarning` を、分かりやすい形式で表示します。これで、最初のタプルが呼び" -"出し可能ではないことを :exc:`TypeError` で表示するよりもわかりやすくなりま" -"す。(Serhiy Storchaka の貢献による :issue:`15248`)" +"``[(10, 20) (30, 40)]`` のようなコードでコンマが無い場合、コンパイラ" +"は :exc:`SyntaxWarning` を、分かりやすい形式で表示します。これで、最初のタプ" +"ルが呼び出し可能ではないことを :exc:`TypeError` で表示するよりもわかりやすく" +"なります。(Serhiy Storchaka の貢献による :issue:`15248`)" #: ../../whatsnew/3.8.rst:445 msgid "" -"Arithmetic operations between subclasses of :class:`datetime.date` or :class:" -"`datetime.datetime` and :class:`datetime.timedelta` objects now return an " -"instance of the subclass, rather than the base class. This also affects the " -"return type of operations whose implementation (directly or indirectly) " -"uses :class:`datetime.timedelta` arithmetic, such as :meth:`~datetime." -"datetime.astimezone`. (Contributed by Paul Ganssle in :issue:`32417`.)" -msgstr "" -":class:`datetime.date`, :class:`datetime.datetime`, :class:`datetime." -"timedelta` オブジェクトのサブクラス間の算術演算は、基底クラスではなくサブクラ" -"スのインスタンスを返すようになりました。この変更は、:meth:`~datetime." -"datetime.astimezone` のような、:class:`datetime.timedelta` に対する算術演算を" -"直接ないし間接的に使用する実装の戻り値の型に影響します。(Paul Ganssle の貢献" -"による :issue:`32417`)" +"Arithmetic operations between subclasses of :class:`datetime.date` " +"or :class:`datetime.datetime` and :class:`datetime.timedelta` objects now " +"return an instance of the subclass, rather than the base class. This also " +"affects the return type of operations whose implementation (directly or " +"indirectly) uses :class:`datetime.timedelta` arithmetic, such " +"as :meth:`~datetime.datetime.astimezone`. (Contributed by Paul Ganssle " +"in :issue:`32417`.)" +msgstr "" +":class:`datetime.date`, :class:`datetime.datetime`, :class:`datetime.timedelta` " +"オブジェクトのサブクラス間の算術演算は、基底クラスではなくサブクラスのインス" +"タンスを返すようになりました。この変更" +"は、:meth:`~datetime.datetime.astimezone` のよう" +"な、:class:`datetime.timedelta` に対する算術演算を直接ないし間接的に使用する" +"実装の戻り値の型に影響します。(Paul Ganssle の貢献による :issue:`32417`)" #: ../../whatsnew/3.8.rst:453 msgid "" @@ -845,21 +881,22 @@ msgid "" "POSIX and Windows use this to properly terminate scripts in interactive " "sessions. (Contributed by Google via Gregory P. Smith in :issue:`1054041`.)" msgstr "" -"Python インタープリタがCtrl-C (SIGINT) によって中断され、:exc:" -"`KeyboardInterrupt` 例外の結果が捕捉されなかった場合、Python プロセスは" -"SIGINT シグナルか、呼び出したプロセスが、Ctrl-C によって終了したことを判別で" -"きるような適切な終了コードで終了するようになりました。 POSIX とWindows 上の" -"シェルは、非対話セッション内でスクリプトの終了処理を適切に行うために、これを" -"利用できます。(Gregory P. Smith を通してGoogle の貢献による :issue:`1054041`)" +"Python インタープリタがCtrl-C (SIGINT) によって中断さ" +"れ、:exc:`KeyboardInterrupt` 例外の結果が捕捉されなかった場合、Python プロセ" +"スはSIGINT シグナルか、呼び出したプロセスが、Ctrl-C によって終了したことを判" +"別できるような適切な終了コードで終了するようになりました。 POSIX とWindows " +"上のシェルは、非対話セッション内でスクリプトの終了処理を適切に行うために、こ" +"れを利用できます。(Gregory P. Smith を通してGoogle の貢献によ" +"る :issue:`1054041`)" #: ../../whatsnew/3.8.rst:460 msgid "" -"Some advanced styles of programming require updating the :class:`types." -"CodeType` object for an existing function. Since code objects are " -"immutable, a new code object needs to be created, one that is modeled on the " -"existing code object. With 19 parameters, this was somewhat tedious. Now, " -"the new ``replace()`` method makes it possible to create a clone with a few " -"altered parameters." +"Some advanced styles of programming require updating " +"the :class:`types.CodeType` object for an existing function. Since code " +"objects are immutable, a new code object needs to be created, one that is " +"modeled on the existing code object. With 19 parameters, this was somewhat " +"tedious. Now, the new ``replace()`` method makes it possible to create a " +"clone with a few altered parameters." msgstr "" "先進的なプログラミングにおいて、既存の関数の :class:`types.CodeType` オブジェ" "クトを更新する必要が生じます。code オブジェクトはイミュータブルなので、既存の" @@ -876,7 +913,6 @@ msgstr "" "ここでは、:func:`statistics.mean` 関数がキーワード引数として *data* を使えな" "いように変更する例を見てみましょう::" -#: ../../whatsnew/3.8.rst:470 msgid "" ">>> from statistics import mean\n" ">>> mean(data=[10, 20, 90])\n" @@ -888,12 +924,19 @@ msgid "" "TypeError: mean() got some positional-only arguments passed as keyword " "arguments: 'data'" msgstr "" +">>> from statistics import mean\n" +">>> mean(data=[10, 20, 90])\n" +"40\n" +">>> mean.__code__ = mean.__code__.replace(co_posonlyargcount=1)\n" +">>> mean(data=[10, 20, 90])\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: mean() got some positional-only arguments passed as keyword " +"arguments: 'data'" -#: ../../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 "" "For integers, the three-argument form of the :func:`pow` function now " "permits the exponent to be negative in the case where the base is relatively " @@ -903,22 +946,34 @@ msgid "" "inverse `_ of " "38 modulo 137, write::" msgstr "" +"整数に対する 3 引数形式の :func:`pow` は、底と法が互いに素の場合、負の指数を" +"指定できるようになりました。\n" +"指数が ``-1`` の場合は法に対する底の逆数を、それ以外の負の指数ではその逆数の" +"適切なべき乗を計算します。\n" +"例えば、137 を法とする 38 の `乗法逆元 `_ を計算するには次のように書きます。 ::" -#: ../../whatsnew/3.8.rst:490 msgid "" ">>> pow(38, -1, 137)\n" "119\n" ">>> 119 * 38 % 137\n" "1" msgstr "" +">>> pow(38, -1, 137)\n" +"119\n" +">>> 119 * 38 % 137\n" +"1" -#: ../../whatsnew/3.8.rst:495 msgid "" "Modular inverses arise in the solution of `linear Diophantine equations " "`_. For example, to find " "integer solutions for ``4258𝑥 + 147𝑦 = 369``, first rewrite as ``4258𝑥 ≡ 369 " "(mod 147)`` then solve:" msgstr "" +"法に対する逆数は、`線形ディオファントス方程式 `_ を解く際に現れます。\n" +"例えば ``4258𝑥 + 147𝑦 = 369`` の整数解を求めるには、まず ``4258𝑥 ≡ 369 (mod " +"147)`` と書き直してから解きます:" #: ../../whatsnew/3.8.rst:505 msgid "(Contributed by Mark Dickinson in :issue:`36027`.)" @@ -932,7 +987,6 @@ msgstr "" "辞書内包表現は辞書リテラルと同期されたため、まずキーが解釈され、次に値が解釈" "されます::" -#: ../../whatsnew/3.8.rst:510 msgid "" ">>> # Dict comprehension\n" ">>> cast = {input('role? '): input('actor? ') for i in range(2)}\n" @@ -946,6 +1000,17 @@ msgid "" "role? Sir Robin\n" "actor? Eric Idle" msgstr "" +">>> # 辞書内包表記\n" +">>> cast = {input('role? '): input('actor? ') for i in range(2)}\n" +"role? King Arthur\n" +"actor? Chapman\n" +"role? Black Knight\n" +"actor? Cleese\n" +"\n" +">>> # 辞書リテラル\n" +">>> cast = {input('role? '): input('actor? ')}\n" +"role? Sir Robin\n" +"actor? Eric Idle" #: ../../whatsnew/3.8.rst:522 msgid "" @@ -956,7 +1021,6 @@ msgstr "" "この実行順の保証は代入式の役に立ち、キーの表現で代入されたものは、値の表現で" "使用することができます::" -#: ../../whatsnew/3.8.rst:526 msgid "" ">>> names = ['Martin von Löwis', 'Łukasz Langa', 'Walter Dörwald']\n" ">>> {(n := normalize('NFC', name)).casefold() : n for name in names}\n" @@ -964,6 +1028,11 @@ msgid "" " 'łukasz langa': 'Łukasz Langa',\n" " 'walter dörwald': 'Walter Dörwald'}" msgstr "" +">>> names = ['Martin von Löwis', 'Łukasz Langa', 'Walter Dörwald']\n" +">>> {(n := normalize('NFC', name)).casefold() : n for name in names}\n" +"{'martin von löwis': 'Martin von Löwis',\n" +" 'łukasz langa': 'Łukasz Langa',\n" +" 'walter dörwald': 'Walter Dörwald'}" #: ../../whatsnew/3.8.rst:532 msgid "(Contributed by Jörn Heissler in :issue:`35224`.)" @@ -975,9 +1044,9 @@ msgid "" "elements long. Formerly, five was the limit. The new, optional sixth " "element is a callable with a ``(obj, state)`` signature. This allows the " "direct control over the state-updating behavior of a specific object. If " -"not *None*, this callable will have priority over the object's :meth:" -"`~__setstate__` method. (Contributed by Pierre Glaser and Olivier Grisel in :" -"issue:`35900`.)" +"not *None*, this callable will have priority over the " +"object's :meth:`~__setstate__` method. (Contributed by Pierre Glaser and " +"Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:543 @@ -995,7 +1064,6 @@ msgstr "" "れたパッケージのバージョンを得たり、エントリーポイントの一覧を得たりできま" "す::" -#: ../../whatsnew/3.8.rst:549 msgid "" ">>> # Note following example requires that the popular \"requests\"\n" ">>> # package has been installed.\n" @@ -1012,6 +1080,20 @@ msgid "" " PackagePath('requests-2.22.0.dist-info/RECORD'),\n" " PackagePath('requests-2.22.0.dist-info/WHEEL')]" msgstr "" +">>> # 以下の例には広く使われている \"requests\" パッケージの\n" +">>> # インストールが必要です。\n" +">>>\n" +">>> from importlib.metadata import version, requires, files\n" +">>> version('requests')\n" +"'2.22.0'\n" +">>> list(requires('requests'))\n" +"['chardet (<3.1.0,>=3.0.2)']\n" +">>> list(files('requests'))[:5]\n" +"[PackagePath('requests-2.22.0.dist-info/INSTALLER'),\n" +" PackagePath('requests-2.22.0.dist-info/LICENSE'),\n" +" PackagePath('requests-2.22.0.dist-info/METADATA'),\n" +" PackagePath('requests-2.22.0.dist-info/RECORD'),\n" +" PackagePath('requests-2.22.0.dist-info/WHEEL')]" #: ../../whatsnew/3.8.rst:564 msgid "(Contributed by Barry Warsaw and Jason R. Coombs in :issue:`34632`.)" @@ -1053,11 +1135,11 @@ msgstr ":func:`ast.parse` 関数の新しいフラグが有効になりました #: ../../whatsnew/3.8.rst:584 msgid "" -"``type_comments=True`` causes it to return the text of :pep:`484` and :pep:" -"`526` type comments associated with certain AST nodes;" +"``type_comments=True`` causes it to return the text of :pep:`484` " +"and :pep:`526` type comments associated with certain AST nodes;" msgstr "" -"``type_comments=True`` は、そのAST ノードに関連する、:pep:`484` と :pep:" -"`526` に規定されるような型コメントを返します;" +"``type_comments=True`` は、そのAST ノードに関連する、:pep:`484` " +"と :pep:`526` に規定されるような型コメントを返します;" #: ../../whatsnew/3.8.rst:587 msgid "" @@ -1068,12 +1150,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:590 msgid "" "``feature_version=(3, N)`` allows specifying an earlier Python 3 version. " -"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` and :" -"keyword:`await` as non-reserved words." +"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` " +"and :keyword:`await` as non-reserved words." msgstr "" "``feature_version=(3, N)`` を使うと、以前の Python 3 バージョンを指定できま" -"す。例えば、``feature_version=(3, 4)`` とすると、:keyword:`async` と :" -"keyword:`await` キーワードは、予約語ではないとして扱われます。" +"す。例えば、``feature_version=(3, 4)`` とすると、:keyword:`async` " +"と :keyword:`await` キーワードは、予約語ではないとして扱われます。" #: ../../whatsnew/3.8.rst:594 msgid "(Contributed by Guido van Rossum in :issue:`35766`.)" @@ -1089,11 +1171,10 @@ msgid "" "function can be used to execute a :term:`coroutine` and return the result " "while automatically managing the event loop. For example::" msgstr "" -":func:`asyncio.run` は暫定から安定API に移動しました。この関数は :term:" -"`coroutine` の実行と、イベントループを管理しながら自動的に結果を返すことに使" -"用できます。例えば::" +":func:`asyncio.run` は暫定から安定API に移動しました。この関数" +"は :term:`coroutine` の実行と、イベントループを管理しながら自動的に結果を返す" +"ことに使用できます。例えば::" -#: ../../whatsnew/3.8.rst:604 msgid "" "import asyncio\n" "\n" @@ -1103,12 +1184,17 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" await asyncio.sleep(0)\n" +" return 42\n" +"\n" +"asyncio.run(main())" -#: ../../whatsnew/3.8.rst:612 msgid "This is *roughly* equivalent to::" -msgstr "これは、だいたい次と等価です :: " +msgstr "これは、だいたい次と等価です ::" -#: ../../whatsnew/3.8.rst:614 msgid "" "import asyncio\n" "\n" @@ -1124,11 +1210,25 @@ msgid "" " asyncio.set_event_loop(None)\n" " loop.close()" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" await asyncio.sleep(0)\n" +" return 42\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"asyncio.set_event_loop(loop)\n" +"try:\n" +" loop.run_until_complete(main())\n" +"finally:\n" +" asyncio.set_event_loop(None)\n" +" loop.close()" #: ../../whatsnew/3.8.rst:629 msgid "" -"The actual implementation is significantly more complex. Thus, :func:" -"`asyncio.run` should be the preferred way of running asyncio programs." +"The actual implementation is significantly more complex. " +"Thus, :func:`asyncio.run` should be the preferred way of running asyncio " +"programs." msgstr "" "実装はこれよりもずっと複雑なものになっています。ですが、 :func:`asyncio.run` " "は非同期IOプログラムを動かす際にまず選ぶべき選択肢です。" @@ -1149,7 +1249,6 @@ msgstr "" "す。すべての呼び出しに対して新しいイベントループを作る ``asyncio.run()`` を呼" "び出す必要はありません:" -#: ../../whatsnew/3.8.rst:639 msgid "" "$ python -m asyncio\n" "asyncio REPL 3.8.0\n" @@ -1160,26 +1259,39 @@ msgid "" ">>> await asyncio.sleep(10, result='hello')\n" "hello" msgstr "" +"$ python -m asyncio\n" +"asyncio REPL 3.8.0\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" #: ../../whatsnew/3.8.rst:649 msgid "(Contributed by Yury Selivanov in :issue:`37028`.)" msgstr "(Yury Selivanov の貢献による :issue:`37028`)" -#: ../../whatsnew/3.8.rst:651 ../../whatsnew/3.8.rst:1970 msgid "" -"The exception :class:`asyncio.CancelledError` now inherits from :class:" -"`BaseException` rather than :class:`Exception` and no longer inherits from :" -"class:`concurrent.futures.CancelledError`. (Contributed by Yury Selivanov " -"in :issue:`32528`.)" +"The exception :class:`asyncio.CancelledError` now inherits " +"from :class:`BaseException` rather than :class:`Exception` and no longer " +"inherits from :class:`concurrent.futures.CancelledError`. (Contributed by " +"Yury Selivanov in :issue:`32528`.)" msgstr "" +":class:`asyncio.CancelledError` 例外は :class:`Exception` ではな" +"く :class:`BaseException` を継承" +"し、:class:`concurrent.futures.CancelledError` を継承しなくなりました。\n" +"(Contributed by Yury Selivanov in :issue:`32528`.)" #: ../../whatsnew/3.8.rst:656 msgid "" -"On Windows, the default event loop is now :class:`~asyncio." -"ProactorEventLoop`. (Contributed by Victor Stinner in :issue:`34687`.)" +"On Windows, the default event loop is " +"now :class:`~asyncio.ProactorEventLoop`. (Contributed by Victor Stinner " +"in :issue:`34687`.)" msgstr "" -"Windows では、イベントループのデフォルトが :class:`~asyncio." -"ProactorEventLoop` になりました。(Victor Stinner の貢献による :issue:`34687`)" +"Windows では、イベントループのデフォルト" +"が :class:`~asyncio.ProactorEventLoop` になりました。(Victor Stinner の貢献に" +"よる :issue:`34687`)" #: ../../whatsnew/3.8.rst:659 msgid "" @@ -1191,39 +1303,39 @@ msgstr "" #: ../../whatsnew/3.8.rst:662 msgid "" -":class:`~asyncio.ProactorEventLoop` can now be interrupted by :exc:" -"`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev in :issue:" -"`23057`.)" +":class:`~asyncio.ProactorEventLoop` can now be interrupted " +"by :exc:`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev " +"in :issue:`23057`.)" msgstr "" ":class:`~asyncio.ProactorEventLoop` は :exc:`KeyboardInterrupt` (\"CTRL+C\") " -"によって中断できるようになりました。(Vladimir Matveev の貢献による :issue:" -"`23057`)" +"によって中断できるようになりました。(Vladimir Matveev の貢献によ" +"る :issue:`23057`)" #: ../../whatsnew/3.8.rst:666 msgid "" "Added :meth:`asyncio.Task.get_coro` for getting the wrapped coroutine within " "an :class:`asyncio.Task`. (Contributed by Alex Grönholm in :issue:`36999`.)" msgstr "" -":class:`asyncio.Task` 内で、内包されたコルーチンを得られる :meth:`asyncio." -"Task.get_coro` メソッドが追加されました。(Alex Grönholm の貢献による :issue:" -"`36999`)" +":class:`asyncio.Task` 内で、内包されたコルーチンを得られ" +"る :meth:`asyncio.Task.get_coro` メソッドが追加されました。(Alex Grönholm の" +"貢献による :issue:`36999`)" #: ../../whatsnew/3.8.rst:670 msgid "" "Asyncio tasks can now be named, either by passing the ``name`` keyword " -"argument to :func:`asyncio.create_task` or the :meth:`~asyncio.loop." -"create_task` event loop method, or by calling the :meth:`~asyncio.Task." -"set_name` method on the task object. The task name is visible in the " -"``repr()`` output of :class:`asyncio.Task` and can also be retrieved using " -"the :meth:`~asyncio.Task.get_name` method. (Contributed by Alex Grönholm in :" -"issue:`34270`.)" +"argument to :func:`asyncio.create_task` or " +"the :meth:`~asyncio.loop.create_task` event loop method, or by calling " +"the :meth:`~asyncio.Task.set_name` method on the task object. The task name " +"is visible in the ``repr()`` output of :class:`asyncio.Task` and can also be " +"retrieved using the :meth:`~asyncio.Task.get_name` method. (Contributed by " +"Alex Grönholm in :issue:`34270`.)" msgstr "" ":func:`asyncio.create_task` 関数か :meth:`~asyncio.loop.create_task` の " -"``name`` 引数を指定するか、もしくはタスクに対して :meth:`~asyncio.Task." -"set_name` メソッドを呼ぶことによって、asyncio タスクに名前をつけることができ" -"ます。タスクの名前は、:class:`asyncio.Task` の ``repr()`` 出力で、または :" -"meth:`~asyncio.Task.get_name` メソッドで確認することができます。(Alex " -"Grönholm の貢献による :issue:`34270`)" +"``name`` 引数を指定するか、もしくはタスクに対し" +"て :meth:`~asyncio.Task.set_name` メソッドを呼ぶことによって、asyncio タスク" +"に名前をつけることができます。タスクの名前は、:class:`asyncio.Task` の " +"``repr()`` 出力で、または :meth:`~asyncio.Task.get_name` メソッドで確認するこ" +"とができます。(Alex Grönholm の貢献による :issue:`34270`)" #: ../../whatsnew/3.8.rst:678 msgid "" @@ -1234,12 +1346,13 @@ msgid "" "applications that support IPv4 and IPv6 by attempting to simultaneously " "connect using both. (Contributed by twisteroid ambassador in :issue:`33530`.)" msgstr "" -":func:`asyncio.loop.create_connection` は、`Happy Eyeballs `_ をサポートするようになりました。挙動を定" -"義するため、2つの新しいパラメータ: *happy_eyeballs_delay* と *interleave* が" -"加えられます。Happy Eyeballs アルゴリズムは、アプリケーションが IPv4 と IPv6 " -"をサポートする場合、その両方を使って接続を保つことによって、アプリケーション" -"の応答性を向上させます。(twisteroid ambassador の貢献による :issue:`33530`)" +":func:`asyncio.loop.create_connection` は、`Happy Eyeballs `_ をサポートするようになりました。挙動" +"を定義するため、2つの新しいパラメータ: *happy_eyeballs_delay* と " +"*interleave* が加えられます。Happy Eyeballs アルゴリズムは、アプリケーション" +"が IPv4 と IPv6 をサポートする場合、その両方を使って接続を保つことによって、" +"アプリケーションの応答性を向上させます。(twisteroid ambassador の貢献によ" +"る :issue:`33530`)" #: ../../whatsnew/3.8.rst:688 msgid "builtins" @@ -1247,19 +1360,19 @@ msgstr "builtins" #: ../../whatsnew/3.8.rst:690 msgid "" -"The :func:`compile` built-in has been improved to accept the ``ast." -"PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag passed, :func:" -"`compile` will allow top-level ``await``, ``async for`` and ``async with`` " -"constructs that are usually considered invalid syntax. Asynchronous code " -"object marked with the ``CO_COROUTINE`` flag may then be returned. " -"(Contributed by Matthias Bussonnier in :issue:`34616`)" +"The :func:`compile` built-in has been improved to accept the " +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag " +"passed, :func:`compile` will allow top-level ``await``, ``async for`` and " +"``async with`` constructs that are usually considered invalid syntax. " +"Asynchronous code object marked with the ``CO_COROUTINE`` flag may then be " +"returned. (Contributed by Matthias Bussonnier in :issue:`34616`)" msgstr "" "組み込み関数 :func:`compile` が、``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` フラグを" "受け取るようになりました。このフラグが有効である場合、:func:`compile` は、一" "般には有効な公文ではない、トップレベルの ``await``, ``async for``, ``async " "with`` 構文が有効になります。この場合、``CO_COROUTINE`` フラグを持つ非同期" -"コードオブジェクトが返されるでしょう。(Matthias Bussonnier の貢献による :" -"issue:`34616`)" +"コードオブジェクトが返されるでしょう。(Matthias Bussonnier の貢献によ" +"る :issue:`34616`)" #: ../../whatsnew/3.8.rst:699 msgid "collections" @@ -1267,19 +1380,20 @@ msgstr "collections" #: ../../whatsnew/3.8.rst:701 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns a :class:`dict` instead of a :class:" -"`collections.OrderedDict`. This works because regular dicts have guaranteed " -"ordering since Python 3.7. If the extra features of :class:`OrderedDict` are " -"required, the suggested remediation is to cast the result to the desired " -"type: ``OrderedDict(nt._asdict())``. (Contributed by Raymond Hettinger in :" -"issue:`35864`.)" -msgstr "" -":func:`collections.namedtuple` の :meth:`~collections.somenamedtuple." -"_asdict` メソッドは、:class:`collections.OrderedDict` ではなく :class:`dict` " -"を返すようになりました。Python 3.7 からは一般に辞書の順番が保証されるため、こ" -"のような変更が可能です。:class:`OrderedDict` 特有の機能を使いたい場合は、結果" -"を ``OrderedDict(nt._asdict())`` 型にキャストして使用することを推奨します。" +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns a :class:`dict` instead of " +"a :class:`collections.OrderedDict`. This works because regular dicts have " +"guaranteed ordering since Python 3.7. If the extra features " +"of :class:`OrderedDict` are required, the suggested remediation is to cast " +"the result to the desired type: ``OrderedDict(nt._asdict())``. (Contributed " +"by Raymond Hettinger in :issue:`35864`.)" +msgstr "" +":func:`collections.namedtuple` " +"の :meth:`~collections.somenamedtuple._asdict` メソッド" +"は、:class:`collections.OrderedDict` ではなく :class:`dict` を返すようになり" +"ました。Python 3.7 からは一般に辞書の順番が保証されるため、このような変更が可" +"能です。:class:`OrderedDict` 特有の機能を使いたい場合は、結果を " +"``OrderedDict(nt._asdict())`` 型にキャストして使用することを推奨します。" "(Raymond Hettinger の貢献による :issue:`35864`)" #: ../../whatsnew/3.8.rst:711 @@ -1295,7 +1409,6 @@ msgstr "" "として使用できるようになりました。このようにしてコードブロックをプロファイル" "します::" -#: ../../whatsnew/3.8.rst:716 msgid "" "import cProfile\n" "\n" @@ -1303,6 +1416,11 @@ msgid "" " # code to be profiled\n" " ..." msgstr "" +"import cProfile\n" +"\n" +"with cProfile.Profile() as profiler:\n" +" # プロファイル対象のコード\n" +" ..." #: ../../whatsnew/3.8.rst:722 msgid "(Contributed by Scott Sanderson in :issue:`29235`.)" @@ -1319,10 +1437,10 @@ msgid "" "memory while still preserving the field order. (Contributed by Michael Selik " "in :issue:`34003`.)" msgstr "" -":class:`csv.DictReader` は、:class:`collections.OrderedDict` ではなく :class:" -"`dict` のインスタンスを返すようになりました。この変更によって、順序を保ちなが" -"ら、より高速にかつメモリの使用量を減らして実行できます。(Michael Selik の貢献" -"による :issue:`34003`)" +":class:`csv.DictReader` は、:class:`collections.OrderedDict` ではな" +"く :class:`dict` のインスタンスを返すようになりました。この変更によって、順序" +"を保ちながら、より高速にかつメモリの使用量を減らして実行できます。(Michael " +"Selik の貢献による :issue:`34003`)" #: ../../whatsnew/3.8.rst:735 msgid "curses" @@ -1335,8 +1453,8 @@ msgid "" "Serhiy Storchaka in :issue:`31680`.)" msgstr "" "ncurses ライブラリの、構造化されたバージョン情報を保持する変数を追加しまし" -"た: :data:`~curses.ncurses_version`  (Serhiy Storchaka の貢献による :issue:" -"`31680`)" +"た: :data:`~curses.ncurses_version`  (Serhiy Storchaka の貢献によ" +"る :issue:`31680`)" #: ../../whatsnew/3.8.rst:743 msgid "ctypes" @@ -1348,28 +1466,35 @@ msgid "" "parameter to specify flags for the underlying ``LoadLibraryEx`` call. The " "default flags are set to only load DLL dependencies from trusted locations, " "including the path where the DLL is stored (if a full or partial path is " -"used to load the initial DLL) and paths added by :func:`~os." -"add_dll_directory`. (Contributed by Steve Dower in :issue:`36085`.)" +"used to load the initial DLL) and paths added " +"by :func:`~os.add_dll_directory`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" "Windows では、:class:`~ctypes.CDLL` とそのサブクラスが *winmode* 引数を受け取" "り、根底の ``LoadLibraryEx`` 呼び出しのフラグを指定できるようになりました。デ" "フォルトでは、フラグは (フルパスか部分パスが初期DLL を読み込むのに使われてい" -"た場合) そのDLL が保存されている場所を含んだ信頼済みの場所と、:func:`~os." -"add_dll_directory` によって加えられた場所からのみ、DLL を読み込むようになって" -"います。(Steve Dower の貢献による :issue:`36085`)" +"た場合) そのDLL が保存されている場所を含んだ信頼済みの場所" +"と、:func:`~os.add_dll_directory` によって加えられた場所からのみ、DLL を読み" +"込むようになっています。(Steve Dower の貢献による :issue:`36085`)" #: ../../whatsnew/3.8.rst:754 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.8.rst:756 msgid "" -"Added new alternate constructors :meth:`datetime.date.fromisocalendar` and :" -"meth:`datetime.datetime.fromisocalendar`, which construct :class:`~datetime." -"date` and :class:`~datetime.datetime` objects respectively from ISO year, " -"week number, and weekday; these are the inverse of each class's " -"``isocalendar`` method. (Contributed by Paul Ganssle in :issue:`36004`.)" +"Added new alternate constructors :meth:`datetime.date.fromisocalendar` " +"and :meth:`datetime.datetime.fromisocalendar`, which " +"construct :class:`~datetime.date` and :class:`~datetime.datetime` objects " +"respectively from ISO year, week number, and weekday; these are the inverse " +"of each class's ``isocalendar`` method. (Contributed by Paul Ganssle " +"in :issue:`36004`.)" msgstr "" +"新しい代替コンストラクタ :meth:`datetime.date.fromisocalendar` " +"と :meth:`datetime.datetime.fromisocalendar` が追加されました。\n" +"ISO の年、週番号、曜日から、それぞれ :class:`~datetime.date` " +"と :class:`~datetime.datetime` オブジェクトを作成します。\n" +"各クラスの ``isocalendar`` メソッドの逆操作です。\n" +"(Contributed by Paul Ganssle in :issue:`36004`.)" #: ../../whatsnew/3.8.rst:764 msgid "functools" @@ -1384,7 +1509,6 @@ msgstr "" ":func:`functools.lru_cache` は、デコレータを返す関数としての使い方に加えて、" "デコレータそのものとしても使えるようになりました。両方の使い方ができます::" -#: ../../whatsnew/3.8.rst:769 msgid "" "@lru_cache\n" "def f(x):\n" @@ -1394,6 +1518,13 @@ msgid "" "def f(x):\n" " ..." msgstr "" +"@lru_cache\n" +"def f(x):\n" +" ...\n" +"\n" +"@lru_cache(maxsize=256)\n" +"def f(x):\n" +" ..." #: ../../whatsnew/3.8.rst:777 msgid "(Contributed by Raymond Hettinger in :issue:`36772`.)" @@ -1404,10 +1535,9 @@ msgid "" "Added a new :func:`functools.cached_property` decorator, for computed " "properties cached for the life of the instance. ::" msgstr "" -"インスタンスが存在する間、計算型プロパティをキャッシュする :func:`functools." -"cached_property` デコレータが追加されました::" +"インスタンスが存在する間、計算型プロパティをキャッシュす" +"る :func:`functools.cached_property` デコレータが追加されました::" -#: ../../whatsnew/3.8.rst:782 msgid "" "import functools\n" "import statistics\n" @@ -1420,6 +1550,16 @@ msgid "" " def variance(self):\n" " return statistics.variance(self.data)" msgstr "" +"import functools\n" +"import statistics\n" +"\n" +"class Dataset:\n" +" def __init__(self, sequence_of_numbers):\n" +" self.data = sequence_of_numbers\n" +"\n" +" @functools.cached_property\n" +" def variance(self):\n" +" return statistics.variance(self.data)" #: ../../whatsnew/3.8.rst:793 msgid "(Contributed by Carl Meyer in :issue:`21145`)" @@ -1428,14 +1568,13 @@ msgstr "(Carl Meyer の貢献による :issue:`21145`)" #: ../../whatsnew/3.8.rst:796 msgid "" "Added a new :func:`functools.singledispatchmethod` decorator that converts " -"methods into :term:`generic functions ` using :term:" -"`single dispatch`::" +"methods into :term:`generic functions ` " +"using :term:`single dispatch`::" msgstr "" ":term:`single dispatch` を利用して、メソッドを :term:`ジェネリック関数 " "` に変換する :func:`functools.singledispatchmethod` デコ" "レータが追加されました::" -#: ../../whatsnew/3.8.rst:800 msgid "" "from functools import singledispatchmethod\n" "from contextlib import suppress\n" @@ -1455,6 +1594,23 @@ msgid "" " targets = set(tasks)\n" " self.tasks = [x for x in self.tasks if x not in targets]" msgstr "" +"from functools import singledispatchmethod\n" +"from contextlib import suppress\n" +"\n" +"class TaskManager:\n" +"\n" +" def __init__(self, tasks):\n" +" self.tasks = list(tasks)\n" +"\n" +" @singledispatchmethod\n" +" def discard(self, value):\n" +" with suppress(ValueError):\n" +" self.tasks.remove(value)\n" +"\n" +" @discard.register(list)\n" +" def _(self, tasks):\n" +" targets = set(tasks)\n" +" self.tasks = [x for x in self.tasks if x not in targets]" #: ../../whatsnew/3.8.rst:818 msgid "(Contributed by Ethan Smith in :issue:`32380`)" @@ -1504,16 +1660,15 @@ msgid "" "for certain types of invalid or corrupt gzip files. (Contributed by Filip " "Gruszczyński, Michele Orrù, and Zackery Spytz in :issue:`6584`.)" msgstr "" -"不正な、あるいは破損した gzip ファイルのうち、所定の種類のものについて、:exc:" -"`OSError` にかわって :exc:`~gzip.BadGzipFile` 例外が送出されるようになりまし" -"た。(Filip Gruszczyński, Michele Orrù, Zackery Spytz の貢献による :issue:" -"`6584`)" +"不正な、あるいは破損した gzip ファイルのうち、所定の種類のものについ" +"て、:exc:`OSError` にかわって :exc:`~gzip.BadGzipFile` 例外が送出されるよう" +"になりました。(Filip Gruszczyński, Michele Orrù, Zackery Spytz の貢献によ" +"る :issue:`6584`)" #: ../../whatsnew/3.8.rst:848 msgid "IDLE and idlelib" msgstr "IDLE と idelelib" -#: ../../whatsnew/3.8.rst:850 msgid "" "Output over N lines (50 by default) is squeezed down to a button. N can be " "changed in the PyShell section of the General page of the Settings dialog. " @@ -1522,8 +1677,15 @@ msgid "" "button or into the clipboard or a separate window by right-clicking the " "button. (Contributed by Tal Einat in :issue:`1529353`.)" msgstr "" +"N 行 (デフォルトは 50 行) を超える出力は、一つのボタンに折り畳まれます。\n" +"N は設定ダイアログの General ページにある PyShell セクションで変更できま" +"す。\n" +"行数が少なくても各行が非常に長い場合などは、出力を右クリックして折り畳めま" +"す。\n" +"折り畳んだ出力は、ボタンのダブルクリックでその場に展開でき、右クリックでク" +"リップボードや別のウィンドウに展開できます。\n" +"(Contributed by Tal Einat in :issue:`1529353`.)" -#: ../../whatsnew/3.8.rst:857 msgid "" "Add \"Run Customized\" to the Run menu to run a module with customized " "settings. Any command line arguments entered are added to sys.argv. They " @@ -1531,17 +1693,29 @@ msgid "" "suppress the normal Shell main module restart. (Contributed by Cheryl " "Sabella, Terry Jan Reedy, and others in :issue:`5680` and :issue:`37627`.)" msgstr "" +"Run メニューに、設定を変更してモジュールを実行する \"Run Customized\" が追加" +"されました。\n" +"入力したコマンドライン引数は sys.argv に追加され、次回のカスタム実行時にも入" +"力欄に表示されます。\n" +"通常行われる Shell のメインモジュールの再起動を抑制することもできます。\n" +"(Contributed by Cheryl Sabella, Terry Jan Reedy, and others in :issue:`5680` " +"and :issue:`37627`.)" -#: ../../whatsnew/3.8.rst:863 msgid "" "Added optional line numbers for IDLE editor windows. Windows open without " "line numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" +"IDLE のエディターウィンドウに、必要に応じて行番号を表示できるようになりまし" +"た。\n" +"設定ダイアログの General タブで指定しない限り、行番号なしでウィンドウが開きま" +"す。\n" +"既存のウィンドウの行番号は Options メニューで表示、非表示を切り替えられま" +"す。\n" +"(Contributed by Tal Einat and Saimadhav Heblikar in :issue:`17535`.)" -#: ../../whatsnew/3.8.rst:869 msgid "" "OS native encoding is now used for converting between Python strings and Tcl " "objects. This allows IDLE to work with emoji and other non-BMP characters. " @@ -1550,32 +1724,41 @@ msgid "" "(Many people worked on this for eight years but the problem was finally " "solved by Serhiy Storchaka in :issue:`13153`.)" msgstr "" +"Python の文字列と Tcl オブジェクトの相互変換に、OS ネイティブのエンコーディン" +"グを使うようになりました。\n" +"これにより IDLE で絵文字などの BMP 外の文字を扱えるようになり、表示やクリップ" +"ボードへのコピー、クリップボードからの貼り付けが可能になります。\n" +"Tcl から Python への文字列変換とその逆は、もはや失敗しません。\n" +"(8 年間にわたって多くの人が取り組み、最終的に Serhiy Storchaka " +"が :issue:`13153` で解決しました。)" -#: ../../whatsnew/3.8.rst:876 msgid "New in 3.8.1:" -msgstr "" +msgstr "3.8.1 の新機能:" -#: ../../whatsnew/3.8.rst:878 msgid "" -"Add option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Add option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" +"カーソルの点滅を無効にするオプションが追加されました。\n" +"(Contributed by Zackery Spytz in :issue:`4603`.)" -#: ../../whatsnew/3.8.rst:881 msgid "" "Escape key now closes IDLE completion windows. (Contributed by Johnny " "Najera in :issue:`38944`.)" msgstr "" +"Escape キーで IDLE の補完ウィンドウを閉じられるようになりました。\n" +"(Contributed by Johnny Najera in :issue:`38944`.)" #: ../../whatsnew/3.8.rst:884 msgid "The changes above have been backported to 3.7 maintenance releases." msgstr "上で挙げた変更は 3.7 のメンテナンスリリースにバックポートされました。" -#: ../../whatsnew/3.8.rst:886 msgid "" "Add keywords to module name completion list. (Contributed by Terry J. Reedy " "in :issue:`37765`.)" msgstr "" +"モジュール名の補完候補のリストにキーワードが追加されました。\n" +"(Contributed by Terry J. Reedy in :issue:`37765`.)" #: ../../whatsnew/3.8.rst:890 msgid "inspect" @@ -1593,7 +1776,6 @@ msgstr "" "これは、既に :func:`property`、:func:`classmethod`、:func:`staticmethod` に現" "在あるような、ドキュメント生成の選択肢を提供します::" -#: ../../whatsnew/3.8.rst:897 msgid "" "class AudioClip:\n" " __slots__ = {'bit_rate': 'expressed in kilohertz to one decimal place',\n" @@ -1602,6 +1784,12 @@ msgid "" " self.bit_rate = round(bit_rate / 1000.0, 1)\n" " self.duration = ceil(duration)" msgstr "" +"class AudioClip:\n" +" __slots__ = {'bit_rate': 'expressed in kilohertz to one decimal place',\n" +" 'duration': 'in seconds, rounded up to an integer'}\n" +" def __init__(self, bit_rate, duration):\n" +" self.bit_rate = round(bit_rate / 1000.0, 1)\n" +" self.duration = ceil(duration)" #: ../../whatsnew/3.8.rst:904 msgid "(Contributed by Raymond Hettinger in :issue:`36326`.)" @@ -1631,12 +1819,14 @@ msgstr "" ":func:`itertools.accumulate` 関数に、初期値を定める、オプションの *initial* " "キーワード引数が追加されました::" -#: ../../whatsnew/3.8.rst:922 msgid "" ">>> from itertools import accumulate\n" ">>> list(accumulate([10, 5, 30, 15], initial=1000))\n" "[1000, 1010, 1015, 1045, 1060]" msgstr "" +">>> from itertools import accumulate\n" +">>> list(accumulate([10, 5, 30, 15], initial=1000))\n" +"[1000, 1010, 1015, 1045, 1060]" #: ../../whatsnew/3.8.rst:926 msgid "(Contributed by Lisa Roach in :issue:`34659`.)" @@ -1658,27 +1848,34 @@ msgstr "" msgid "logging" msgstr "logging" -#: ../../whatsnew/3.8.rst:939 msgid "" "Added a *force* keyword argument to :func:`logging.basicConfig`. When set to " "true, any existing handlers attached to the root logger are removed and " "closed before carrying out the configuration specified by the other " "arguments." msgstr "" +":func:`logging.basicConfig` に *force* キーワード引数が追加されました。\n" +"真に設定すると、ほかの引数で指定した設定を行う前に、ルートロガーに取り付けら" +"れた既存のハンドラーをすべて取り外して閉じます。" -#: ../../whatsnew/3.8.rst:944 msgid "" "This solves a long-standing problem. Once a logger or *basicConfig()* had " "been called, subsequent calls to *basicConfig()* were silently ignored. This " "made it difficult to update, experiment with, or teach the various logging " "configuration options using the interactive prompt or a Jupyter notebook." msgstr "" +"これは長年の問題を解決するものです。\n" +"一度ロガーまたは *basicConfig()* を呼び出すと、それ以降の *basicConfig()* の" +"呼び出しは何も通知せず無視されていました。\n" +"そのため、対話型プロンプトや Jupyter notebook でログ設定の各種オプションを更" +"新、試行、説明することが難しくなっていました。" -#: ../../whatsnew/3.8.rst:950 msgid "" "(Suggested by Raymond Hettinger, implemented by Donghee Na, and reviewed by " "Vinay Sajip in :issue:`33897`.)" msgstr "" +"(Raymond Hettinger による提案、Donghee Na による実装、Vinay Sajip によるレ" +"ビュー、:issue:`33897`。)" #: ../../whatsnew/3.8.rst:955 msgid "math" @@ -1699,8 +1896,8 @@ msgid "" "in :issue:`33089`.)" msgstr "" ":func:`math.hypot` 関数は、3次元以上を扱えるように拡張されました。以前は、二" -"次元の場合のみに対応していました。(Raymond Hettinger の貢献による :issue:" -"`33089`)" +"次元の場合のみに対応していました。(Raymond Hettinger の貢献によ" +"る :issue:`33089`)" #: ../../whatsnew/3.8.rst:964 msgid "" @@ -1711,13 +1908,16 @@ msgstr "" ":func:`sum` に類似する関数として、初期値(デフォルトは1) に対してイテレート可" "能なオブジェクトの数を掛けていく :func:`math.prod` 関数が追加されました::" -#: ../../whatsnew/3.8.rst:968 msgid "" ">>> prior = 0.8\n" ">>> likelihoods = [0.625, 0.84, 0.30]\n" ">>> math.prod(likelihoods, start=prior)\n" "0.126" msgstr "" +">>> prior = 0.8\n" +">>> likelihoods = [0.625, 0.84, 0.30]\n" +">>> math.prod(likelihoods, start=prior)\n" +"0.126" #: ../../whatsnew/3.8.rst:973 msgid "(Contributed by Pablo Galindo in :issue:`35606`.)" @@ -1725,19 +1925,22 @@ msgstr "(Pablo Galindo の貢献による :issue:`35606`)" #: ../../whatsnew/3.8.rst:975 msgid "" -"Added two new combinatoric functions :func:`math.perm` and :func:`math." -"comb`::" +"Added two new combinatoric functions :func:`math.perm` " +"and :func:`math.comb`::" msgstr "" "2つの組み合わせの関数 :func:`math.perm` と :func:`math.comb` が追加されまし" "た::" -#: ../../whatsnew/3.8.rst:977 msgid "" ">>> math.perm(10, 3) # Permutations of 10 things taken 3 at a time\n" "720\n" ">>> math.comb(10, 3) # Combinations of 10 things taken 3 at a time\n" "120" msgstr "" +">>> math.perm(10, 3) # 10 個から 3 個を取る順列\n" +"720\n" +">>> math.comb(10, 3) # 10 個から 3 個を取る組み合わせ\n" +"120" #: ../../whatsnew/3.8.rst:982 msgid "" @@ -1754,11 +1957,10 @@ msgid "" "supports arbitrarily large integers. It is faster than ``floor(sqrt(n))`` " "but slower than :func:`math.sqrt`::" msgstr "" -"浮動小数点数を介することなく、正確な整数の二乗根を計算する関数 :func:`math." -"isqrt` が追加されました。この関数は、巨大な整数にも使用できます。" -"``floor(sqrt(n))`` より高速ですが、:func:`math.sqrt` より少し遅いです::" +"浮動小数点数を介することなく、正確な整数の二乗根を計算する関" +"数 :func:`math.isqrt` が追加されました。この関数は、巨大な整数にも使用できま" +"す。``floor(sqrt(n))`` より高速ですが、:func:`math.sqrt` より少し遅いです::" -#: ../../whatsnew/3.8.rst:990 msgid "" ">>> r = 650320427\n" ">>> s = r ** 2\n" @@ -1767,6 +1969,12 @@ msgid "" ">>> floor(sqrt(s - 1)) # incorrect\n" "650320427" msgstr "" +">>> r = 650320427\n" +">>> s = r ** 2\n" +">>> isqrt(s - 1) # 正しい\n" +"650320426\n" +">>> floor(sqrt(s - 1)) # 誤り\n" +"650320427" #: ../../whatsnew/3.8.rst:997 msgid "(Contributed by Mark Dickinson in :issue:`36887`.)" @@ -1784,47 +1992,56 @@ msgstr "" msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.8.rst:1006 msgid "" "The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.madvise` method to " -"access the ``madvise()`` system call. (Contributed by Zackery Spytz in :" -"issue:`32941`.)" +"access the ``madvise()`` system call. (Contributed by Zackery Spytz " +"in :issue:`32941`.)" msgstr "" +":class:`mmap.mmap` クラスに、``madvise()`` システムコールを使" +"う :meth:`~mmap.mmap.madvise` メソッドが追加されました。\n" +"(Contributed by Zackery Spytz in :issue:`32941`.)" #: ../../whatsnew/3.8.rst:1012 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.8.rst:1014 msgid "" "Added new :mod:`multiprocessing.shared_memory` module. (Contributed by Davin " "Potts in :issue:`35813`.)" msgstr "" +":mod:`multiprocessing.shared_memory` モジュールが追加されました。\n" +"(Contributed by Davin Potts in :issue:`35813`.)" -#: ../../whatsnew/3.8.rst:1017 msgid "" "On macOS, the *spawn* start method is now used by default. (Contributed by " "Victor Stinner in :issue:`33725`.)" msgstr "" +"macOS では *spawn* 開始方式がデフォルトになりました。\n" +"(Contributed by Victor Stinner in :issue:`33725`.)" #: ../../whatsnew/3.8.rst:1022 msgid "os" msgstr "os" -#: ../../whatsnew/3.8.rst:1024 msgid "" "Added new function :func:`~os.add_dll_directory` on Windows for providing " "additional search paths for native dependencies when importing extension " -"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower in :" -"issue:`36085`.)" +"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" +"Windows に :func:`~os.add_dll_directory` 関数が追加されました。\n" +"拡張モジュールのインポートや :mod:`ctypes` による DLL の読み込みで、ネイティ" +"ブの依存ライブラリの検索パスを追加できます。\n" +"(Contributed by Steve Dower in :issue:`36085`.)" -#: ../../whatsnew/3.8.rst:1029 msgid "" "A new :func:`os.memfd_create` function was added to wrap the " "``memfd_create()`` syscall. (Contributed by Zackery Spytz and Christian " "Heimes in :issue:`26836`.)" msgstr "" +"``memfd_create()`` システムコールをラップする :func:`os.memfd_create` 関数が" +"追加されました。\n" +"(Contributed by Zackery Spytz and Christian Heimes in :issue:`26836`.)" #: ../../whatsnew/3.8.rst:1033 msgid "" @@ -1832,78 +2049,95 @@ msgid "" "symlinks and directory junctions) has been delegated to the operating " "system. Specifically, :func:`os.stat` will now traverse anything supported " "by the operating system, while :func:`os.lstat` will only open reparse " -"points that identify as \"name surrogates\" while others are opened as for :" -"func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only have " -"``S_IFLNK`` set for symbolic links and not other kinds of reparse points. To " -"identify other kinds of reparse point, check the new :attr:`stat_result." -"st_reparse_tag` attribute." +"points that identify as \"name surrogates\" while others are opened as " +"for :func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only " +"have ``S_IFLNK`` set for symbolic links and not other kinds of reparse " +"points. To identify other kinds of reparse point, check the " +"new :attr:`stat_result.st_reparse_tag` attribute." msgstr "" -#: ../../whatsnew/3.8.rst:1042 msgid "" "On Windows, :func:`os.readlink` is now able to read directory junctions. " "Note that :func:`~os.path.islink` will return ``False`` for directory " "junctions, and so code that checks ``islink`` first will continue to treat " -"junctions as directories, while code that handles errors from :func:`os." -"readlink` may now treat junctions as links." +"junctions as directories, while code that handles errors " +"from :func:`os.readlink` may now treat junctions as links." msgstr "" +"Windows で :func:`os.readlink` がディレクトリジャンクションを読み取れるように" +"なりました。\n" +"ただし :func:`~os.path.islink` はジャンクションに対して ``False`` を返すた" +"め、先に ``islink`` を調べるコードは引き続きディレクトリとして扱います。\n" +"一方、:func:`os.readlink` のエラーを処理するコードは、ジャンクションをリンク" +"として扱う場合があります。" -#: ../../whatsnew/3.8.rst:1048 ../../whatsnew/3.8.rst:1073 msgid "(Contributed by Steve Dower in :issue:`37834`.)" -msgstr "" +msgstr "(Steve Dower による貢献、:issue:`37834`。)" #: ../../whatsnew/3.8.rst:1052 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.8.rst:1054 msgid "" -":mod:`os.path` functions that return a boolean result like :func:`~os.path." -"exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path." -"isfile`, :func:`~os.path.islink`, and :func:`~os.path.ismount` now return " -"``False`` instead of raising :exc:`ValueError` or its subclasses :exc:" -"`UnicodeEncodeError` and :exc:`UnicodeDecodeError` for paths that contain " -"characters or bytes unrepresentable at the OS level. (Contributed by Serhiy " -"Storchaka in :issue:`33721`.)" +":mod:`os.path` functions that return a boolean result " +"like :func:`~os.path.exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path.isfile`, :func:`~os.path.islink`, " +"and :func:`~os.path.ismount` now return ``False`` instead of " +"raising :exc:`ValueError` or its subclasses :exc:`UnicodeEncodeError` " +"and :exc:`UnicodeDecodeError` for paths that contain characters or bytes " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" +":mod:`os.path` " +"の :func:`~os.path.exists`、:func:`~os.path.lexists`、:func:`~os.path.isdir`、:func:`~os.path.isfile`、:func:`~os.path.islink`、:func:`~os.path.ismount` " +"など、ブール値を返す関数の動作が変わりました。\n" +"OS レベルで表現できない文字やバイトを含むパスに対して、:exc:`ValueError` やそ" +"のサブクラスの :exc:`UnicodeEncodeError`、:exc:`UnicodeDecodeError` を送出せ" +"ず、``False`` を返します。\n" +"(Contributed by Serhiy Storchaka in :issue:`33721`.)" -#: ../../whatsnew/3.8.rst:1062 ../../whatsnew/3.8.rst:1965 msgid "" ":func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE` " "environment variable and does not use :envvar:`HOME`, which is not normally " -"set for regular user accounts. (Contributed by Anthony Sottile in :issue:" -"`36264`.)" +"set for regular user accounts. (Contributed by Anthony Sottile " +"in :issue:`36264`.)" msgstr "" +"Windows の :func:`~os.path.expanduser` は環境変数 :envvar:`USERPROFILE` を優" +"先し、通常のユーザーアカウントでは通常設定されない :envvar:`HOME` を使わなく" +"なりました。\n" +"(Contributed by Anthony Sottile in :issue:`36264`.)" -#: ../../whatsnew/3.8.rst:1067 msgid "" ":func:`~os.path.isdir` on Windows no longer returns ``True`` for a link to a " "non-existent directory." msgstr "" +"Windows の :func:`~os.path.isdir` は、存在しないディレクトリへのリンクに対し" +"て ``True`` を返さなくなりました。" -#: ../../whatsnew/3.8.rst:1070 msgid "" ":func:`~os.path.realpath` on Windows now resolves reparse points, including " "symlinks and directory junctions." msgstr "" +"Windows の :func:`~os.path.realpath` は、シンボリックリンクやディレクトリジャ" +"ンクションを含む再解析ポイントを解決するようになりました。" #: ../../whatsnew/3.8.rst:1077 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.8.rst:1079 msgid "" -":mod:`pathlib.Path` methods that return a boolean result like :meth:" -"`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path." -"is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :" -"meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :" -"meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` now return " -"``False`` instead of raising :exc:`ValueError` or its subclass :exc:" -"`UnicodeEncodeError` for paths that contain characters unrepresentable at " -"the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.)" +":mod:`pathlib.Path` methods that return a boolean result " +"like :meth:`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path.is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` " +"now return ``False`` instead of raising :exc:`ValueError` or its " +"subclass :exc:`UnicodeEncodeError` for paths that contain characters " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" +":mod:`pathlib.Path` " +"の :meth:`~pathlib.Path.exists`、:meth:`~pathlib.Path.is_dir`、:meth:`~pathlib.Path.is_file`、:meth:`~pathlib.Path.is_mount`、:meth:`~pathlib.Path.is_symlink`、:meth:`~pathlib.Path.is_block_device`、:meth:`~pathlib.Path.is_char_device`、:meth:`~pathlib.Path.is_fifo`、:meth:`~pathlib.Path.is_socket` " +"など、ブール値を返すメソッドの動作が変わりました。\n" +"OS レベルで表現できない文字を含むパスに対して、:exc:`ValueError` やそのサブク" +"ラスの :exc:`UnicodeEncodeError` を送出せず、``False`` を返します。\n" +"(Contributed by Serhiy Storchaka in :issue:`33721`.)" -#: ../../whatsnew/3.8.rst:1089 msgid "" "Added :meth:`!pathlib.Path.link_to` which creates a hard link pointing to a " "path. (Contributed by Joannah Nanjekye in :issue:`26978`) Note that " @@ -1911,35 +2145,47 @@ msgid "" "``hardlink_to`` method added in 3.10 which matches the semantics of the " "existing ``symlink_to`` method." msgstr "" +"パスを指すハードリンクを作成する :meth:`!pathlib.Path.link_to` が追加されまし" +"た。\n" +"(Joannah Nanjekye による貢献、:issue:`26978`。)\n" +"ただし ``link_to`` は 3.10 で非推奨になり、3.12 で削除されました。\n" +"代わりに、既存の ``symlink_to`` と意味を揃えた ``hardlink_to`` メソッドが " +"3.10 で追加されています。" #: ../../whatsnew/3.8.rst:1098 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.8.rst:1100 msgid "" -":mod:`pickle` extensions subclassing the C-optimized :class:`~pickle." -"Pickler` can now override the pickling logic of functions and classes by " -"defining the special :meth:`~pickle.Pickler.reducer_override` method. " -"(Contributed by Pierre Glaser and Olivier Grisel in :issue:`35900`.)" +":mod:`pickle` extensions subclassing the C-" +"optimized :class:`~pickle.Pickler` can now override the pickling logic of " +"functions and classes by defining the " +"special :meth:`~pickle.Pickler.reducer_override` method. (Contributed by " +"Pierre Glaser and Olivier Grisel in :issue:`35900`.)" msgstr "" +"C で最適化された :class:`~pickle.Pickler` をサブクラス化する :mod:`pickle` の" +"拡張は、特殊メソッド :meth:`~pickle.Pickler.reducer_override` を定義すること" +"で、関数やクラスの pickle 化のロジックをオーバーライドできるようになりまし" +"た。\n" +"(Contributed by Pierre Glaser and Olivier Grisel in :issue:`35900`.)" #: ../../whatsnew/3.8.rst:1107 msgid "plistlib" msgstr "plistlib" -#: ../../whatsnew/3.8.rst:1109 msgid "" "Added new :class:`plistlib.UID` and enabled support for reading and writing " -"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen in :issue:" -"`26707`.)" +"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen " +"in :issue:`26707`.)" msgstr "" +":class:`plistlib.UID` が追加され、NSKeyedArchiver でエンコードされたバイナリ " +"plist の読み書きに対応しました。\n" +"(Contributed by Jon Janzen in :issue:`26707`.)" #: ../../whatsnew/3.8.rst:1115 msgid "pprint" msgstr "pprint" -#: ../../whatsnew/3.8.rst:1117 msgid "" "The :mod:`pprint` module added a *sort_dicts* parameter to several " "functions. By default, those functions continue to sort dictionaries before " @@ -1947,18 +2193,24 @@ msgid "" "dictionaries retain the order that keys were inserted. This can be useful " "for comparison to JSON inputs during debugging." msgstr "" +":mod:`pprint` モジュールの複数の関数に *sort_dicts* パラメータが追加されまし" +"た。\n" +"デフォルトでは、引き続き辞書を並べ替えてから文字列表現を作成、表示します。\n" +"ただし *sort_dicts* を偽にすると、辞書はキーの挿入順を維持します。\n" +"デバッグ時に JSON 入力と比較する場合などに便利です。" -#: ../../whatsnew/3.8.rst:1123 msgid "" "In addition, there is a convenience new function, :func:`pprint.pp` that is " "like :func:`pprint.pprint` but with *sort_dicts* defaulting to ``False``::" msgstr "" +"さらに便利な新しい関数 :func:`pprint.pp` が追加されました。\n" +":func:`pprint.pprint` と似ていますが、*sort_dicts* のデフォルトは ``False`` " +"です。 ::" -#: ../../whatsnew/3.8.rst:1126 msgid "" ">>> from pprint import pprint, pp\n" -">>> d = dict(source='input.txt', operation='filter', destination='output." -"txt')\n" +">>> d = dict(source='input.txt', operation='filter', " +"destination='output.txt')\n" ">>> pp(d, width=40) # Original order\n" "{'source': 'input.txt',\n" " 'operation': 'filter',\n" @@ -1968,124 +2220,162 @@ msgid "" " 'operation': 'filter',\n" " 'source': 'input.txt'}" msgstr "" +">>> from pprint import pprint, pp\n" +">>> d = dict(source='input.txt', operation='filter', " +"destination='output.txt')\n" +">>> pp(d, width=40) # 元の順序\n" +"{'source': 'input.txt',\n" +" 'operation': 'filter',\n" +" 'destination': 'output.txt'}\n" +">>> pprint(d, width=40) # キーをアルファベット順に並べ替え\n" +"{'destination': 'output.txt',\n" +" 'operation': 'filter',\n" +" 'source': 'input.txt'}" -#: ../../whatsnew/3.8.rst:1137 msgid "(Contributed by Rémi Lapeyre in :issue:`30670`.)" -msgstr "" +msgstr "(Rémi Lapeyre による貢献、:issue:`30670`。)" #: ../../whatsnew/3.8.rst:1141 msgid "py_compile" msgstr "py_compile" -#: ../../whatsnew/3.8.rst:1143 msgid "" ":func:`py_compile.compile` now supports silent mode. (Contributed by Joannah " "Nanjekye in :issue:`22640`.)" msgstr "" +":func:`py_compile.compile` がサイレントモードに対応しました。\n" +"(Contributed by Joannah Nanjekye in :issue:`22640`.)" #: ../../whatsnew/3.8.rst:1148 msgid "shlex" msgstr "shlex" -#: ../../whatsnew/3.8.rst:1150 msgid "" -"The new :func:`shlex.join` function acts as the inverse of :func:`shlex." -"split`. (Contributed by Bo Bayles in :issue:`32102`.)" +"The new :func:`shlex.join` function acts as the inverse " +"of :func:`shlex.split`. (Contributed by Bo Bayles in :issue:`32102`.)" msgstr "" +"新しい :func:`shlex.join` 関数は :func:`shlex.split` の逆操作を行います。\n" +"(Contributed by Bo Bayles in :issue:`32102`.)" #: ../../whatsnew/3.8.rst:1155 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.8.rst:1157 msgid "" ":func:`shutil.copytree` now accepts a new ``dirs_exist_ok`` keyword " "argument. (Contributed by Josh Bronson in :issue:`20849`.)" msgstr "" +":func:`shutil.copytree` に ``dirs_exist_ok`` キーワード引数が追加されまし" +"た。\n" +"(Contributed by Josh Bronson in :issue:`20849`.)" -#: ../../whatsnew/3.8.rst:1160 msgid "" ":func:`shutil.make_archive` now defaults to the modern pax (POSIX.1-2001) " "format for new archives to improve portability and standards conformance, " "inherited from the corresponding change to the :mod:`tarfile` module. " "(Contributed by C.A.M. Gerlach in :issue:`30661`.)" msgstr "" +":func:`shutil.make_archive` は、:mod:`tarfile` の対応する変更を受け、新しい" +"アーカイブに新しい pax (POSIX.1-2001) 形式をデフォルトで使うようになりまし" +"た。\n" +"移植性と標準への準拠を改善します。\n" +"(Contributed by C.A.M. Gerlach in :issue:`30661`.)" -#: ../../whatsnew/3.8.rst:1165 msgid "" ":func:`shutil.rmtree` on Windows now removes directory junctions without " -"recursively removing their contents first. (Contributed by Steve Dower in :" -"issue:`37834`.)" +"recursively removing their contents first. (Contributed by Steve Dower " +"in :issue:`37834`.)" msgstr "" +"Windows の :func:`shutil.rmtree` は、ディレクトリジャンクションの内容を先に再" +"帰的に削除することなく、ジャンクションだけを削除するようになりました。\n" +"(Contributed by Steve Dower in :issue:`37834`.)" #: ../../whatsnew/3.8.rst:1171 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.8.rst:1173 msgid "" "Added :meth:`~socket.create_server` and :meth:`~socket.has_dualstack_ipv6` " "convenience functions to automate the necessary tasks usually involved when " "creating a server socket, including accepting both IPv4 and IPv6 connections " "on the same socket. (Contributed by Giampaolo Rodolà in :issue:`17561`.)" msgstr "" +"サーバーソケットの作成に通常必要な処理を自動化する便利な関" +"数 :meth:`~socket.create_server` と :meth:`~socket.has_dualstack_ipv6` が追加" +"されました。\n" +"同じソケットで IPv4 と IPv6 の両方の接続を受け付ける処理も含まれます。\n" +"(Contributed by Giampaolo Rodolà in :issue:`17561`.)" -#: ../../whatsnew/3.8.rst:1178 msgid "" -"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, and :func:" -"`socket.if_indextoname` functions have been implemented on Windows. " -"(Contributed by Zackery Spytz in :issue:`37007`.)" +"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, " +"and :func:`socket.if_indextoname` functions have been implemented on " +"Windows. (Contributed by Zackery Spytz in :issue:`37007`.)" msgstr "" +":func:`socket.if_nameindex`、:func:`socket.if_nametoindex`、:func:`socket.if_indextoname` " +"関数が Windows に実装されました。\n" +"(Contributed by Zackery Spytz in :issue:`37007`.)" #: ../../whatsnew/3.8.rst:1184 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.8.rst:1186 msgid "" -"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable and :meth:`~ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :issue:`34670`.)" +"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`~ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :issue:`34670`.)" msgstr "" +"TLS 1.3 のハンドシェイク後認証を有効にす" +"る :attr:`~ssl.SSLContext.post_handshake_auth` と、それを開始す" +"る :meth:`~ssl.SSLSocket.verify_client_post_handshake` が追加されました。\n" +"(Contributed by Christian Heimes in :issue:`34670`.)" #: ../../whatsnew/3.8.rst:1193 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.8.rst:1195 msgid "" -"Added :func:`statistics.fmean` as a faster, floating-point variant of :func:" -"`statistics.mean`. (Contributed by Raymond Hettinger and Steven D'Aprano " -"in :issue:`35904`.)" +"Added :func:`statistics.fmean` as a faster, floating-point variant " +"of :func:`statistics.mean`. (Contributed by Raymond Hettinger and Steven " +"D'Aprano in :issue:`35904`.)" msgstr "" +":func:`statistics.mean` の高速な浮動小数点版 :func:`statistics.fmean` が追加" +"されました。\n" +"(Contributed by Raymond Hettinger and Steven D'Aprano in :issue:`35904`.)" -#: ../../whatsnew/3.8.rst:1199 msgid "" "Added :func:`statistics.geometric_mean` (Contributed by Raymond Hettinger " "in :issue:`27181`.)" msgstr "" +":func:`statistics.geometric_mean` が追加されました。\n" +"(Contributed by Raymond Hettinger in :issue:`27181`.)" -#: ../../whatsnew/3.8.rst:1202 msgid "" "Added :func:`statistics.multimode` that returns a list of the most common " "values. (Contributed by Raymond Hettinger in :issue:`35892`.)" msgstr "" +"最も出現頻度の高い値のリストを返す :func:`statistics.multimode` が追加されま" +"した。\n" +"(Contributed by Raymond Hettinger in :issue:`35892`.)" -#: ../../whatsnew/3.8.rst:1205 msgid "" "Added :func:`statistics.quantiles` that divides data or a distribution in to " "equiprobable intervals (e.g. quartiles, deciles, or percentiles). " "(Contributed by Raymond Hettinger in :issue:`36546`.)" msgstr "" +"データや分布を同じ確率の区間 (四分位、十分位、百分位など) に分け" +"る :func:`statistics.quantiles` が追加されました。\n" +"(Contributed by Raymond Hettinger in :issue:`36546`.)" -#: ../../whatsnew/3.8.rst:1209 msgid "" "Added :class:`statistics.NormalDist`, a tool for creating and manipulating " "normal distributions of a random variable. (Contributed by Raymond Hettinger " "in :issue:`36018`.)" msgstr "" +"確率変数の正規分布を作成、操作するための :class:`statistics.NormalDist` が追" +"加されました。\n" +"(Contributed by Raymond Hettinger in :issue:`36018`.)" -#: ../../whatsnew/3.8.rst:1215 msgid "" ">>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14])\n" ">>> temperature_feb.mean\n" @@ -2109,12 +2399,32 @@ msgid "" ">>> temperature_feb.samples(3) # Generate random samples\n" "[7.672102882379219, 12.000027119750287, 4.647488369766392]" msgstr "" +">>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14])\n" +">>> temperature_feb.mean\n" +"6.0\n" +">>> temperature_feb.stdev\n" +"6.356099432828281\n" +"\n" +">>> temperature_feb.cdf(3) # 3 度未満になる確率\n" +"0.3184678262814532\n" +">>> # 7 度と 10 度での確率密度の比\n" +">>> temperature_feb.pdf(7) / temperature_feb.pdf(10)\n" +"1.2039930378537762\n" +"\n" +">>> el_niño = NormalDist(4, 2.5)\n" +">>> temperature_feb += el_niño # 気候の影響を加える\n" +">>> temperature_feb\n" +"NormalDist(mu=10.0, sigma=6.830080526611674)\n" +"\n" +">>> temperature_feb * (9/5) + 32 # 華氏に変換\n" +"NormalDist(mu=50.0, sigma=12.294144947901014)\n" +">>> temperature_feb.samples(3) # ランダムな標本を生成\n" +"[7.672102882379219, 12.000027119750287, 4.647488369766392]" #: ../../whatsnew/3.8.rst:1239 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.8.rst:1241 msgid "" "Add new :func:`sys.unraisablehook` function which can be overridden to " "control how \"unraisable exceptions\" are handled. It is called when an " @@ -2122,12 +2432,17 @@ msgid "" "example, when a destructor raises an exception or during garbage collection " "(:func:`gc.collect`). (Contributed by Victor Stinner in :issue:`36829`.)" msgstr "" +"新しい :func:`sys.unraisablehook` 関数が追加され、オーバーライドすることで" +"「送出できない例外」の処理を制御できます。\n" +"例外が発生しても Python が処理できない場合に呼ばれます。\n" +"例えば、デストラクタが例外を送出した場合や、ガベージコレクション " +"(:func:`gc.collect`) 中の例外などです。\n" +"(Contributed by Victor Stinner in :issue:`36829`.)" #: ../../whatsnew/3.8.rst:1250 ../../whatsnew/3.8.rst:2350 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.8.rst:1252 msgid "" "The :mod:`tarfile` module now defaults to the modern pax (POSIX.1-2001) " "format for new archives, instead of the previous GNU-specific one. This " @@ -2135,40 +2450,53 @@ msgid "" "standardized and extensible format, and offers several other benefits. " "(Contributed by C.A.M. Gerlach in :issue:`36268`.)" msgstr "" +":mod:`tarfile` モジュールは、新しいアーカイブのデフォルト形式を従来の GNU 固" +"有の形式から、新しい pax (POSIX.1-2001) 形式に変更しました。\n" +"標準化された拡張可能な形式で一貫したエンコーディング (UTF-8) を使うため、プ" +"ラットフォーム間の移植性が改善され、ほかにも利点があります。\n" +"(Contributed by C.A.M. Gerlach in :issue:`36268`.)" #: ../../whatsnew/3.8.rst:1260 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.8.rst:1262 msgid "" -"Add a new :func:`threading.excepthook` function which handles uncaught :meth:" -"`threading.Thread.run` exception. It can be overridden to control how " -"uncaught :meth:`threading.Thread.run` exceptions are handled. (Contributed " -"by Victor Stinner in :issue:`1230540`.)" +"Add a new :func:`threading.excepthook` function which handles " +"uncaught :meth:`threading.Thread.run` exception. It can be overridden to " +"control how uncaught :meth:`threading.Thread.run` exceptions are handled. " +"(Contributed by Victor Stinner in :issue:`1230540`.)" msgstr "" +":meth:`threading.Thread.run` の捕捉されなかった例外を処理す" +"る :func:`threading.excepthook` 関数が追加されました。\n" +"これをオーバーライドすると、:meth:`threading.Thread.run` の捕捉されなかった例" +"外の処理を制御できます。\n" +"(Contributed by Victor Stinner in :issue:`1230540`.)" #: ../../whatsnew/3.8.rst:1267 msgid "" -"Add a new :func:`threading.get_native_id` function and a :data:`~threading." -"Thread.native_id` attribute to the :class:`threading.Thread` class. These " -"return the native integral Thread ID of the current thread assigned by the " -"kernel. This feature is only available on certain platforms, see :func:" -"`get_native_id ` for more information. (Contributed " -"by Jake Tesler in :issue:`36084`.)" +"Add a new :func:`threading.get_native_id` function and " +"a :data:`~threading.Thread.native_id` attribute to " +"the :class:`threading.Thread` class. These return the native integral Thread " +"ID of the current thread assigned by the kernel. This feature is only " +"available on certain platforms, see :func:`get_native_id " +"` for more information. (Contributed by Jake Tesler " +"in :issue:`36084`.)" msgstr "" #: ../../whatsnew/3.8.rst:1277 msgid "tokenize" msgstr "tokenize" -#: ../../whatsnew/3.8.rst:1279 msgid "" "The :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token when " "provided with input that does not have a trailing new line. This behavior " "now matches what the C tokenizer does internally. (Contributed by Ammar " "Askar in :issue:`33899`.)" msgstr "" +":mod:`tokenize` モジュールは、末尾に改行のない入力に対して暗黙に ``NEWLINE`` " +"トークンを出力するようになりました。\n" +"これにより C のトークナイザーの内部動作と一致します。\n" +"(Contributed by Ammar Askar in :issue:`33899`.)" #: ../../whatsnew/3.8.rst:1286 msgid "tkinter" @@ -2176,10 +2504,10 @@ msgstr "tkinter" #: ../../whatsnew/3.8.rst:1288 msgid "" -"Added methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter." -"Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` and :" -"meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` class. " -"(Contributed by Juliette Monsel in :issue:`34829`.)" +"Added " +"methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter.Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` " +"and :meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` " +"class. (Contributed by Juliette Monsel in :issue:`34829`.)" msgstr "" #: ../../whatsnew/3.8.rst:1295 @@ -2190,140 +2518,167 @@ msgstr "" #: ../../whatsnew/3.8.rst:1299 msgid "" -"The :class:`tkinter.PhotoImage` class now has :meth:`~tkinter.PhotoImage." -"transparency_get` and :meth:`~tkinter.PhotoImage.transparency_set` methods. " -"(Contributed by Zackery Spytz in :issue:`25451`.)" +"The :class:`tkinter.PhotoImage` class now " +"has :meth:`~tkinter.PhotoImage.transparency_get` " +"and :meth:`~tkinter.PhotoImage.transparency_set` methods. (Contributed by " +"Zackery Spytz in :issue:`25451`.)" msgstr "" #: ../../whatsnew/3.8.rst:1306 msgid "time" msgstr "time" -#: ../../whatsnew/3.8.rst:1308 msgid "" "Added new clock :const:`~time.CLOCK_UPTIME_RAW` for macOS 10.12. " "(Contributed by Joannah Nanjekye in :issue:`35702`.)" msgstr "" +"macOS 10.12 向けに新しいクロック :const:`~time.CLOCK_UPTIME_RAW` が追加されま" +"した。\n" +"(Contributed by Joannah Nanjekye in :issue:`35702`.)" #: ../../whatsnew/3.8.rst:1313 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.8.rst:1315 msgid "The :mod:`typing` module incorporates several new features:" -msgstr "" +msgstr ":mod:`typing` モジュールに、いくつかの新機能が追加されました:" -#: ../../whatsnew/3.8.rst:1317 msgid "" -"A dictionary type with per-key types. See :pep:`589` and :class:`typing." -"TypedDict`. TypedDict uses only string keys. By default, every key is " -"required to be present. Specify \"total=False\" to allow keys to be " -"optional::" +"A dictionary type with per-key types. See :pep:`589` " +"and :class:`typing.TypedDict`. TypedDict uses only string keys. By default, " +"every key is required to be present. Specify \"total=False\" to allow keys " +"to be optional::" msgstr "" +"キーごとに型を指定する辞書型。\n" +":pep:`589` と :class:`typing.TypedDict` を参照してください。\n" +"TypedDict のキーは文字列だけです。\n" +"デフォルトではすべてのキーが必須です。\n" +"\"total=False\" を指定すると、キーを省略可能にできます。 ::" -#: ../../whatsnew/3.8.rst:1322 msgid "" "class Location(TypedDict, total=False):\n" " lat_long: tuple\n" " grid_square: str\n" " xy_coordinate: tuple" msgstr "" +"class Location(TypedDict, total=False):\n" +" lat_long: tuple\n" +" grid_square: str\n" +" xy_coordinate: tuple" -#: ../../whatsnew/3.8.rst:1327 msgid "" "Literal types. See :pep:`586` and :class:`typing.Literal`. Literal types " "indicate that a parameter or return value is constrained to one or more " "specific literal values::" msgstr "" +"リテラル型。\n" +":pep:`586` と :class:`typing.Literal` を参照してください。\n" +"リテラル型は、パラメータや戻り値を一つ以上の特定のリテラル値に制限することを" +"示します。 ::" -#: ../../whatsnew/3.8.rst:1331 msgid "" "def get_status(port: int) -> Literal['connected', 'disconnected']:\n" " ..." msgstr "" +"def get_status(port: int) -> Literal['connected', 'disconnected']:\n" +" ..." #: ../../whatsnew/3.8.rst:1334 msgid "" -"\"Final\" variables, functions, methods and classes. See :pep:`591`, :class:" -"`typing.Final` and :func:`typing.final`. The final qualifier instructs a " -"static type checker to restrict subclassing, overriding, or reassignment::" +"\"Final\" variables, functions, methods and classes. " +"See :pep:`591`, :class:`typing.Final` and :func:`typing.final`. The final " +"qualifier instructs a static type checker to restrict subclassing, " +"overriding, or reassignment::" msgstr "" -#: ../../whatsnew/3.8.rst:1339 msgid "pi: Final[float] = 3.1415926536" -msgstr "" +msgstr "pi: Final[float] = 3.1415926536" #: ../../whatsnew/3.8.rst:1341 msgid "" -"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` and :func:" -"`typing.runtime_checkable`. Simple ABCs like :class:`typing.SupportsInt` " -"are now ``Protocol`` subclasses." +"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` " +"and :func:`typing.runtime_checkable`. Simple ABCs " +"like :class:`typing.SupportsInt` are now ``Protocol`` subclasses." msgstr "" -#: ../../whatsnew/3.8.rst:1345 msgid "New protocol class :class:`typing.SupportsIndex`." -msgstr "" +msgstr "新しいプロトコルクラス :class:`typing.SupportsIndex`。" -#: ../../whatsnew/3.8.rst:1347 msgid "New functions :func:`typing.get_origin` and :func:`typing.get_args`." -msgstr "" +msgstr "新しい関数 :func:`typing.get_origin` と :func:`typing.get_args`。" #: ../../whatsnew/3.8.rst:1351 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.8.rst:1353 msgid "" "The :mod:`unicodedata` module has been upgraded to use the `Unicode 12.1.0 " "`_ release." msgstr "" +":mod:`unicodedata` モジュールが `Unicode 12.1.0 `_ のリリースを使うよう更新されました。" -#: ../../whatsnew/3.8.rst:1356 msgid "" "New function :func:`~unicodedata.is_normalized` can be used to verify a " "string is in a specific normal form, often much faster than by actually " "normalizing the string. (Contributed by Max Belanger, David Euresti, and " "Greg Price in :issue:`32285` and :issue:`37966`)." msgstr "" +"新しい :func:`~unicodedata.is_normalized` 関数で、文字列が特定の正規形かどう" +"かを確認できます。\n" +"実際に正規化するより大幅に速い場合が多くあります。\n" +"(Contributed by Max Belanger, David Euresti, and Greg Price " +"in :issue:`32285` and :issue:`37966`)" #: ../../whatsnew/3.8.rst:1363 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.8.rst:1365 msgid "" "Added :class:`~unittest.mock.AsyncMock` to support an asynchronous version " "of :class:`~unittest.mock.Mock`. Appropriate new assert functions for " -"testing have been added as well. (Contributed by Lisa Roach in :issue:" -"`26467`)." +"testing have been added as well. (Contributed by Lisa Roach " +"in :issue:`26467`)." msgstr "" +":class:`~unittest.mock.Mock` の非同期版とし" +"て :class:`~unittest.mock.AsyncMock` が追加されました。\n" +"テスト用の対応する assert 関数も追加されました。\n" +"(Contributed by Lisa Roach in :issue:`26467`)" -#: ../../whatsnew/3.8.rst:1370 msgid "" -"Added :func:`~unittest.addModuleCleanup` and :meth:`~unittest.TestCase." -"addClassCleanup` to unittest to support cleanups for :func:`~unittest." -"setUpModule` and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa " -"Roach in :issue:`24412`.)" +"Added :func:`~unittest.addModuleCleanup` " +"and :meth:`~unittest.TestCase.addClassCleanup` to unittest to support " +"cleanups for :func:`~unittest.setUpModule` " +"and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa Roach " +"in :issue:`24412`.)" msgstr "" +"unittest に :func:`~unittest.addModuleCleanup` " +"と :meth:`~unittest.TestCase.addClassCleanup` が追加さ" +"れ、:func:`~unittest.setUpModule` と :meth:`~unittest.TestCase.setUpClass` の" +"後始末をサポートしました。\n" +"(Contributed by Lisa Roach in :issue:`24412`.)" -#: ../../whatsnew/3.8.rst:1376 msgid "" "Several mock assert functions now also print a list of actual calls upon " "failure. (Contributed by Petter Strandmark in :issue:`35047`.)" msgstr "" +"モックのいくつかの assert 関数は、失敗時に実際の呼び出しの一覧も表示するよう" +"になりました。\n" +"(Contributed by Petter Strandmark in :issue:`35047`.)" -#: ../../whatsnew/3.8.rst:1379 msgid "" ":mod:`unittest` module gained support for coroutines to be used as test " "cases with :class:`unittest.IsolatedAsyncioTestCase`. (Contributed by Andrew " "Svetlov in :issue:`32972`.)" msgstr "" +":mod:`unittest` モジュールは :class:`unittest.IsolatedAsyncioTestCase` を使う" +"ことで、コルーチンをテストケースとして使えるようになりました。\n" +"(Contributed by Andrew Svetlov in :issue:`32972`.)" #: ../../whatsnew/3.8.rst:1383 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../whatsnew/3.8.rst:1385 msgid "" "import unittest\n" "\n" @@ -2344,70 +2699,106 @@ msgid "" "if __name__ == \"__main__\":\n" " unittest.main()" msgstr "" +"import unittest\n" +"\n" +"\n" +"class TestRequest(unittest.IsolatedAsyncioTestCase):\n" +"\n" +" async def asyncSetUp(self):\n" +" self.connection = await AsyncConnection()\n" +"\n" +" async def test_get(self):\n" +" response = await self.connection.get(\"https://example.com\")\n" +" self.assertEqual(response.status_code, 200)\n" +"\n" +" async def asyncTearDown(self):\n" +" await self.connection.close()\n" +"\n" +"\n" +"if __name__ == \"__main__\":\n" +" unittest.main()" #: ../../whatsnew/3.8.rst:1406 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.8.rst:1408 msgid "" ":mod:`venv` now includes an ``Activate.ps1`` script on all platforms for " "activating virtual environments under PowerShell Core 6.1. (Contributed by " "Brett Cannon in :issue:`32718`.)" msgstr "" +":mod:`venv` はすべてのプラットフォームに ``Activate.ps1`` スクリプトを含め、" +"PowerShell Core 6.1 で仮想環境を有効化できるようになりました。\n" +"(Contributed by Brett Cannon in :issue:`32718`.)" #: ../../whatsnew/3.8.rst:1414 msgid "weakref" msgstr "weakref" -#: ../../whatsnew/3.8.rst:1416 msgid "" "The proxy objects returned by :func:`weakref.proxy` now support the matrix " "multiplication operators ``@`` and ``@=`` in addition to the other numeric " "operators. (Contributed by Mark Dickinson in :issue:`36669`.)" msgstr "" +":func:`weakref.proxy` が返すプロキシオブジェクトは、ほかの数値演算子に加えて" +"行列乗算の ``@`` と ``@=`` にも対応しました。\n" +"(Contributed by Mark Dickinson in :issue:`36669`.)" #: ../../whatsnew/3.8.rst:1422 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.8.rst:1424 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :issue:`17239`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :issue:`17239`.)" msgstr "" +"DTD や外部実体の取得による問題を軽減するため、:mod:`xml.dom.minidom` " +"と :mod:`xml.sax` モジュールはデフォルトでは外部実体を処理しなくなりまし" +"た。\n" +"(Contributed by Christian Heimes in :issue:`17239`.)" -#: ../../whatsnew/3.8.rst:1429 msgid "" "The ``.find*()`` methods in the :mod:`xml.etree.ElementTree` module support " "wildcard searches like ``{*}tag`` which ignores the namespace and " "``{namespace}*`` which returns all tags in the given namespace. (Contributed " "by Stefan Behnel in :issue:`28238`.)" msgstr "" +":mod:`xml.etree.ElementTree` の ``.find*()`` メソッドがワイルドカード検索に対" +"応しました。\n" +"例えば ``{*}tag`` は名前空間を無視し、``{namespace}*`` は指定した名前空間のす" +"べてのタグを返します。\n" +"(Contributed by Stefan Behnel in :issue:`28238`.)" #: ../../whatsnew/3.8.rst:1434 msgid "" -"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–xml." -"etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed by " -"Stefan Behnel in :issue:`13611`.)" +"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–" +"xml.etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed " +"by Stefan Behnel in :issue:`13611`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1438 msgid "" "The target object of :class:`xml.etree.ElementTree.XMLParser` can receive " "namespace declaration events through the new callback methods ``start_ns()`` " -"and ``end_ns()``. Additionally, the :class:`xml.etree.ElementTree." -"TreeBuilder` target can be configured to process events about comments and " -"processing instructions to include them in the generated tree. (Contributed " -"by Stefan Behnel in :issue:`36676` and :issue:`36673`.)" -msgstr "" +"and ``end_ns()``. Additionally, " +"the :class:`xml.etree.ElementTree.TreeBuilder` target can be configured to " +"process events about comments and processing instructions to include them in " +"the generated tree. (Contributed by Stefan Behnel in :issue:`36676` " +"and :issue:`36673`.)" +msgstr "" +":class:`xml.etree.ElementTree.XMLParser` のターゲットオブジェクトは、新しい" +"コールバックメソッド ``start_ns()`` と ``end_ns()`` で名前空間宣言のイベント" +"を受信できます。\n" +"また :class:`xml.etree.ElementTree.TreeBuilder` ターゲットは、コメントや処理" +"命令のイベントを処理し、生成されるツリーに含めるよう設定できるようになりまし" +"た。\n" +"(Contributed by Stefan Behnel in :issue:`36676` and :issue:`36673`.)" #: ../../whatsnew/3.8.rst:1448 msgid "xmlrpc" msgstr "xmlrpc" -#: ../../whatsnew/3.8.rst:1450 msgid "" ":class:`xmlrpc.client.ServerProxy` now supports an optional *headers* " "keyword argument for a sequence of HTTP headers to be sent with each " @@ -2415,53 +2806,71 @@ msgid "" "basic authentication to faster session authentication. (Contributed by " "Cédric Krier in :issue:`35153`.)" msgstr "" +":class:`xmlrpc.client.ServerProxy` に省略可能な *headers* キーワード引数が追" +"加され、各リクエストで送る HTTP ヘッダーのシーケンスを指定できます。\n" +"例えば、デフォルトの Basic 認証から高速なセッション認証への切り替えが可能にな" +"ります。\n" +"(Contributed by Cédric Krier in :issue:`35153`.)" #: ../../whatsnew/3.8.rst:1458 msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.8.rst:1460 msgid "" "The :mod:`subprocess` module can now use the :func:`os.posix_spawn` function " "in some cases for better performance. Currently, it is only used on macOS " "and Linux (using glibc 2.24 or newer) if all these conditions are met:" msgstr "" +":mod:`subprocess` モジュールは、一部の場合に :func:`os.posix_spawn` 関数を" +"使って性能を改善できるようになりました。\n" +"現時点では macOS と Linux (glibc 2.24 以降) で、次のすべての条件を満たす場合" +"にのみ使われます:" -#: ../../whatsnew/3.8.rst:1464 msgid "*close_fds* is false;" -msgstr "" +msgstr "*close_fds* が偽である。" -#: ../../whatsnew/3.8.rst:1465 msgid "" "*preexec_fn*, *pass_fds*, *cwd* and *start_new_session* parameters are not " "set;" msgstr "" +"*preexec_fn*、*pass_fds*、*cwd*、*start_new_session* パラメータが設定されてい" +"ない。" -#: ../../whatsnew/3.8.rst:1467 msgid "the *executable* path contains a directory." -msgstr "" +msgstr "*executable* のパスにディレクトリが含まれる。" -#: ../../whatsnew/3.8.rst:1469 msgid "(Contributed by Joannah Nanjekye and Victor Stinner in :issue:`35537`.)" -msgstr "" - -#: ../../whatsnew/3.8.rst:1471 -msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls on Linux and macOS in order to copy the file more " -"efficiently. \"fast-copy\" means that the copying operation occurs within " -"the kernel, avoiding the use of userspace buffers in Python as in \"``outfd." -"write(infd.read())``\". On Windows :func:`shutil.copyfile` uses a bigger " -"default buffer size (1 MiB instead of 16 KiB) and a :func:`memoryview`-based " -"variant of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 " -"MiB file within the same partition is about +26% on Linux, +50% on macOS and " +msgstr "(Joannah Nanjekye と Victor Stinner による貢献、:issue:`35537`。)" + +msgid "" +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls on " +"Linux and macOS in order to copy the file more efficiently. \"fast-copy\" " +"means that the copying operation occurs within the kernel, avoiding the use " +"of userspace buffers in Python as in \"``outfd.write(infd.read())``\". On " +"Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " +"instead of 16 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 MiB " +"file within the same partition is about +26% on Linux, +50% on macOS and " "+40% on Windows. Also, much less CPU cycles are consumed. See :ref:`shutil-" "platform-dependent-efficient-copy-operations` section. (Contributed by " "Giampaolo Rodolà in :issue:`33671`.)" msgstr "" +":func:`shutil.copyfile`、:func:`shutil.copy`、:func:`shutil.copy2`、:func:`shutil.copytree`、:func:`shutil.move` " +"は、Linux と macOS でプラットフォーム固有の「高速コピー」システムコールを使" +"い、より効率的にファイルをコピーするようになりました。\n" +"「高速コピー」とはカーネル内でコピーを行い、``outfd.write(infd.read())`` のよ" +"うな Python のユーザー空間のバッファを使わないことを意味します。\n" +"Windows の :func:`shutil.copyfile` はデフォルトのバッファサイズを 16 KiB か" +"ら 1 MiB に増やし、:func:`shutil.copyfileobj` の :func:`memoryview` を使う変" +"形を利用します。\n" +"同じパーティション内での 512 MiB のファイルのコピーは、Linux で約 26%、macOS " +"で約 50%、Windows で約 40% 高速になります。\n" +"CPU サイクルの消費も大幅に減ります。\n" +":ref:`shutil-platform-dependent-efficient-copy-operations` を参照してくださ" +"い。\n" +"(Contributed by Giampaolo Rodolà in :issue:`33671`.)" -#: ../../whatsnew/3.8.rst:1487 msgid "" ":func:`shutil.copytree` uses :func:`os.scandir` function and all copy " "functions depending from it use cached :func:`os.stat` values. The speedup " @@ -2470,102 +2879,142 @@ msgid "" "syscalls is reduced by 38% making :func:`shutil.copytree` especially faster " "on network filesystems. (Contributed by Giampaolo Rodolà in :issue:`33695`.)" msgstr "" +":func:`shutil.copytree` は :func:`os.scandir` 関数を使い、それに依存するすべ" +"てのコピー関数はキャッシュされた :func:`os.stat` の値を使うようになりまし" +"た。\n" +"8000 個のファイルがあるディレクトリのコピーは、Linux で約 9%、Windows で約 " +"20%、Windows の SMB 共有で約 30% 高速になります。\n" +":func:`os.stat` システムコールの回数も 38% 減り、特にネットワークファイルシス" +"テムで :func:`shutil.copytree` が高速になります。\n" +"(Contributed by Giampaolo Rodolà in :issue:`33695`.)" -#: ../../whatsnew/3.8.rst:1494 msgid "" "The default protocol in the :mod:`pickle` module is now Protocol 4, first " "introduced in Python 3.4. It offers better performance and smaller size " "compared to Protocol 3 available since Python 3.0." msgstr "" +":mod:`pickle` モジュールのデフォルトプロトコルが、Python 3.4 で導入されたプロ" +"トコル 4 になりました。\n" +"Python 3.0 から利用できるプロトコル 3 と比べ、性能がよく、サイズも小さくなり" +"ます。" -#: ../../whatsnew/3.8.rst:1498 msgid "" "Removed one :c:type:`Py_ssize_t` member from ``PyGC_Head``. All GC tracked " "objects (e.g. tuple, list, dict) size is reduced 4 or 8 bytes. (Contributed " "by Inada Naoki in :issue:`33597`.)" msgstr "" +"``PyGC_Head`` から :c:type:`Py_ssize_t` のメンバーが一つ削除されました。\n" +"GC が追跡するすべてのオブジェクト (tuple、list、dict など) のサイズが 4 また" +"は 8 バイト減りました。\n" +"(Contributed by Inada Naoki in :issue:`33597`.)" -#: ../../whatsnew/3.8.rst:1502 msgid "" ":class:`uuid.UUID` now uses ``__slots__`` to reduce its memory footprint. " "(Contributed by Wouter Bolsterlee and Tal Einat in :issue:`30977`)" msgstr "" +":class:`uuid.UUID` は ``__slots__`` を使い、メモリ使用量を減らすようになりま" +"した。\n" +"(Contributed by Wouter Bolsterlee and Tal Einat in :issue:`30977`)" -#: ../../whatsnew/3.8.rst:1505 msgid "" "Improved performance of :func:`operator.itemgetter` by 33%. Optimized " "argument handling and added a fast path for the common case of a single non-" "negative integer index into a tuple (which is the typical use case in the " "standard library). (Contributed by Raymond Hettinger in :issue:`35664`.)" msgstr "" +":func:`operator.itemgetter` の性能が 33% 改善されました。\n" +"引数処理を最適化し、タプルに対して単一の非負整数のインデックスを使う一般的な" +"場合 (標準ライブラリの典型的な用途) に、高速な処理経路を追加しました。\n" +"(Contributed by Raymond Hettinger in :issue:`35664`.)" -#: ../../whatsnew/3.8.rst:1511 msgid "" "Sped-up field lookups in :func:`collections.namedtuple`. They are now more " "than two times faster, making them the fastest form of instance variable " "lookup in Python. (Contributed by Raymond Hettinger, Pablo Galindo, and Joe " "Jevnik, Serhiy Storchaka in :issue:`32492`.)" msgstr "" +":func:`collections.namedtuple` のフィールド検索が 2 倍以上高速になり、Python " +"のインスタンス変数の検索方法の中で最も高速になりました。\n" +"(Contributed by Raymond Hettinger, Pablo Galindo, and Joe Jevnik, Serhiy " +"Storchaka in :issue:`32492`.)" -#: ../../whatsnew/3.8.rst:1516 msgid "" "The :class:`list` constructor does not overallocate the internal item buffer " "if the input iterable has a known length (the input implements ``__len__``). " "This makes the created list 12% smaller on average. (Contributed by Raymond " "Hettinger and Pablo Galindo in :issue:`33234`.)" msgstr "" +":class:`list` コンストラクタは、入力のイテラブルの長さが分かる場合 " +"(``__len__`` を実装している場合)、内部の要素バッファを余分に確保しなくなりま" +"した。\n" +"生成されるリストは平均 12% 小さくなります。\n" +"(Contributed by Raymond Hettinger and Pablo Galindo in :issue:`33234`.)" -#: ../../whatsnew/3.8.rst:1521 msgid "" "Doubled the speed of class variable writes. When a non-dunder attribute was " "updated, there was an unnecessary call to update slots. (Contributed by " "Stefan Behnel, Pablo Galindo Salgado, Raymond Hettinger, Neil Schemenauer, " "and Serhiy Storchaka in :issue:`36012`.)" msgstr "" +"クラス変数への書き込みが 2 倍高速になりました。\n" +"両端がダブルアンダースコアでない属性の更新時に、不要なスロット更新の呼び出し" +"が行われていました。\n" +"(Contributed by Stefan Behnel, Pablo Galindo Salgado, Raymond Hettinger, " +"Neil Schemenauer, and Serhiy Storchaka in :issue:`36012`.)" -#: ../../whatsnew/3.8.rst:1526 msgid "" "Reduced an overhead of converting arguments passed to many builtin functions " "and methods. This sped up calling some simple builtin functions and methods " -"up to 20--50%. (Contributed by Serhiy Storchaka in :issue:`23867`, :issue:" -"`35582` and :issue:`36127`.)" +"up to 20--50%. (Contributed by Serhiy Storchaka " +"in :issue:`23867`, :issue:`35582` and :issue:`36127`.)" msgstr "" +"多くの組み込み関数やメソッドに渡される引数の変換のオーバーヘッドが減りまし" +"た。\n" +"単純な組み込み関数やメソッドの一部の呼び出しが最大 20〜50% 高速になりまし" +"た。\n" +"(Contributed by Serhiy Storchaka in :issue:`23867`, :issue:`35582` " +"and :issue:`36127`.)" -#: ../../whatsnew/3.8.rst:1531 msgid "" "``LOAD_GLOBAL`` instruction now uses new \"per opcode cache\" mechanism. It " -"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in :" -"issue:`26219`.)" +"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki " +"in :issue:`26219`.)" msgstr "" +"``LOAD_GLOBAL`` 命令が新しい「オペコードごとのキャッシュ」機構を使い、約 40% " +"高速になりました。\n" +"(Contributed by Yury Selivanov and Inada Naoki in :issue:`26219`.)" #: ../../whatsnew/3.8.rst:1537 msgid "Build and C API Changes" msgstr "ビルドならびに C API の変更" -#: ../../whatsnew/3.8.rst:1539 msgid "" "Default :data:`sys.abiflags` became an empty string: the ``m`` flag for " "pymalloc became useless (builds with and without pymalloc are ABI " -"compatible) and so has been removed. (Contributed by Victor Stinner in :" -"issue:`36707`.)" +"compatible) and so has been removed. (Contributed by Victor Stinner " +"in :issue:`36707`.)" msgstr "" +"デフォルトの :data:`sys.abiflags` は空文字列になりました。\n" +"pymalloc の有無で ABI が互換であるため、pymalloc を表す ``m`` フラグが不要と" +"なり削除されました。\n" +"(Contributed by Victor Stinner in :issue:`36707`.)" -#: ../../whatsnew/3.8.rst:1543 msgid "Example of changes:" -msgstr "" +msgstr "変更の例:" -#: ../../whatsnew/3.8.rst:1545 msgid "" "Only ``python3.8`` program is installed, ``python3.8m`` program is gone." msgstr "" +"``python3.8`` プログラムだけがインストールされ、``python3.8m`` プログラムはな" +"くなりました。" -#: ../../whatsnew/3.8.rst:1546 msgid "" "Only ``python3.8-config`` script is installed, ``python3.8m-config`` script " "is gone." msgstr "" +"``python3.8-config`` スクリプトだけがインストールされ、``python3.8m-config`` " +"スクリプトはなくなりました。" -#: ../../whatsnew/3.8.rst:1548 msgid "" "The ``m`` flag has been removed from the suffix of dynamic library " "filenames: extension modules in the standard library as well as those " @@ -2573,24 +3022,27 @@ msgid "" "PyPI. On Linux, for example, the Python 3.7 suffix ``.cpython-37m-x86_64-" "linux-gnu.so`` became ``.cpython-38-x86_64-linux-gnu.so`` in Python 3.8." msgstr "" +"動的ライブラリのファイル名の接尾辞から ``m`` フラグが削除されました。\n" +"標準ライブラリの拡張モジュールも、PyPI からダウンロードしたパッケージなどの" +"サードパーティーパッケージが生成、インストールするものも対象です。\n" +"例えば Linux では Python 3.7 の接尾辞 ``.cpython-37m-x86_64-linux-gnu.so`` " +"が、Python 3.8 で ``.cpython-38-x86_64-linux-gnu.so`` になりました。" -#: ../../whatsnew/3.8.rst:1555 msgid "" "The header files have been reorganized to better separate the different " "kinds of APIs:" -msgstr "" +msgstr "API の種類をより明確に分けるため、ヘッダーファイルが再編成されました:" -#: ../../whatsnew/3.8.rst:1558 msgid "``Include/*.h`` should be the portable public stable C API." -msgstr "" +msgstr "``Include/*.h`` は、移植性のある公開の安定 C API を置く場所です。" -#: ../../whatsnew/3.8.rst:1559 msgid "" "``Include/cpython/*.h`` should be the unstable C API specific to CPython; " "public API, with some private API prefixed by ``_Py`` or ``_PY``." msgstr "" +"``Include/cpython/*.h`` は、CPython 固有の不安定な C API を置く場所です。\n" +"公開 API と、``_Py`` または ``_PY`` で始まる一部の非公開 API を含みます。" -#: ../../whatsnew/3.8.rst:1561 msgid "" "``Include/internal/*.h`` is the private internal C API very specific to " "CPython. This API comes with no backward compatibility warranty and should " @@ -2598,58 +3050,70 @@ msgid "" "debuggers and profiles which has to access to CPython internals without " "calling functions. This API is now installed by ``make install``." msgstr "" +"``Include/internal/*.h`` は、CPython に特化した非公開の内部 C API です。\n" +"後方互換性の保証はなく、CPython の外で使うべきではありません。\n" +"関数を呼ばずに CPython 内部へアクセスする必要があるデバッガーやプロファイラー" +"など、ごく特定の用途のためだけに公開されています。\n" +"この API は ``make install`` でインストールされるようになりました。" -#: ../../whatsnew/3.8.rst:1567 msgid "" "(Contributed by Victor Stinner in :issue:`35134` and :issue:`35081`, work " "initiated by Eric Snow in Python 3.7.)" msgstr "" +"(Victor Stinner による貢献、:issue:`35134`、:issue:`35081`。この取り組みは " +"Python 3.7 で Eric Snow が始めました。)" -#: ../../whatsnew/3.8.rst:1570 msgid "" "Some macros have been converted to static inline functions: parameter types " "and return type are well defined, they don't have issues specific to macros, " "variables have a local scopes. Examples:" msgstr "" +"一部のマクロが静的インライン関数に変換されました。\n" +"パラメータと戻り値の型が明確に定まり、マクロ固有の問題がなく、変数がローカル" +"スコープを持つようになります。\n" +"例:" -#: ../../whatsnew/3.8.rst:1574 msgid ":c:func:`Py_INCREF`, :c:func:`Py_DECREF`" -msgstr "" +msgstr ":c:func:`Py_INCREF`, :c:func:`Py_DECREF`" -#: ../../whatsnew/3.8.rst:1575 msgid ":c:func:`Py_XINCREF`, :c:func:`Py_XDECREF`" -msgstr "" +msgstr ":c:func:`Py_XINCREF`, :c:func:`Py_XDECREF`" #: ../../whatsnew/3.8.rst:1576 msgid ":c:func:`PyObject_INIT`, :c:func:`PyObject_INIT_VAR`" msgstr "" -#: ../../whatsnew/3.8.rst:1577 msgid "" "Private functions: :c:func:`!_PyObject_GC_TRACK`, :c:func:`!" "_PyObject_GC_UNTRACK`, :c:func:`!_Py_Dealloc`" msgstr "" +"非公開の関数: :c:func:`!_PyObject_GC_TRACK`、:c:func:`!" +"_PyObject_GC_UNTRACK`、:c:func:`!_Py_Dealloc`" -#: ../../whatsnew/3.8.rst:1580 msgid "(Contributed by Victor Stinner in :issue:`35059`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`35059`。)" -#: ../../whatsnew/3.8.rst:1582 msgid "" "The :c:func:`!PyByteArray_Init` and :c:func:`!PyByteArray_Fini` functions " "have been removed. They did nothing since Python 2.7.4 and Python 3.2.0, " "were excluded from the limited API (stable ABI), and were not documented. " "(Contributed by Victor Stinner in :issue:`35713`.)" msgstr "" +":c:func:`!PyByteArray_Init` と :c:func:`!PyByteArray_Fini` 関数が削除されまし" +"た。\n" +"Python 2.7.4 と Python 3.2.0 以降は何もせず、制限付き API (安定 ABI) からも除" +"外され、文書化されていませんでした。\n" +"(Contributed by Victor Stinner in :issue:`35713`.)" -#: ../../whatsnew/3.8.rst:1587 msgid "" "The result of :c:func:`PyExceptionClass_Name` is now of type ``const char " -"*`` rather of ``char *``. (Contributed by Serhiy Storchaka in :issue:" -"`33818`.)" +"*`` rather of ``char *``. (Contributed by Serhiy Storchaka " +"in :issue:`33818`.)" msgstr "" +":c:func:`PyExceptionClass_Name` の戻り値の型が ``char *`` から ``const char " +"*`` に変わりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`33818`.)" -#: ../../whatsnew/3.8.rst:1591 msgid "" "The duality of ``Modules/Setup.dist`` and ``Modules/Setup`` has been " "removed. Previously, when updating the CPython source tree, one had to " @@ -2659,169 +3123,225 @@ msgid "" "annoyance to developers following CPython development, as forgetting to copy " "the file could produce build failures." msgstr "" +"``Modules/Setup.dist`` と ``Modules/Setup`` の二重構成がなくなりました。\n" +"以前は CPython のソースツリーを更新すると、上流の変更を反映するために、ソース" +"ツリー内の ``Modules/Setup.dist`` をビルドツリー内の ``Modules/Setup`` に手動" +"でコピーする必要がありました。\n" +"これはパッケージ作成者には少し便利でしたが、コピーを忘れるとビルドに失敗する" +"ことがあり、CPython の開発を追う開発者には頻繁な負担になっていました。" -#: ../../whatsnew/3.8.rst:1599 msgid "" "Now the build system always reads from ``Modules/Setup`` inside the source " "tree. People who want to customize that file are encouraged to maintain " "their changes in a git fork of CPython or as patch files, as they would do " "for any other change to the source tree." msgstr "" +"ビルドシステムは、常にソースツリー内の ``Modules/Setup`` を読むようになりまし" +"た。\n" +"このファイルを変更したい場合は、ソースツリーへのほかの変更と同様に、CPython " +"の git フォークやパッチファイルで変更を管理することを推奨します。" -#: ../../whatsnew/3.8.rst:1604 msgid "(Contributed by Antoine Pitrou in :issue:`32430`.)" -msgstr "" - -#: ../../whatsnew/3.8.rst:1606 -msgid "" -"Functions that convert Python number to C integer like :c:func:" -"`PyLong_AsLong` and argument parsing functions like :c:func:" -"`PyArg_ParseTuple` with integer converting format units like ``'i'`` will " -"now use the :meth:`~object.__index__` special method instead of :meth:" -"`~object.__int__`, if available. The deprecation warning will be emitted " -"for objects with the ``__int__()`` method but without the ``__index__()`` " -"method (like :class:`~decimal.Decimal` and :class:`~fractions.Fraction`). :" -"c:func:`PyNumber_Check` will now return ``1`` for objects implementing " -"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` and :c:" -"func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " -"available. (Contributed by Serhiy Storchaka in :issue:`36048` and :issue:" -"`20092`.)" -msgstr "" - -#: ../../whatsnew/3.8.rst:1620 -msgid "" -"Heap-allocated type objects will now increase their reference count in :c:" -"func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) instead of " -"in :c:func:`PyType_GenericAlloc`. Types that modify instance allocation or " -"deallocation may need to be adjusted. (Contributed by Eddie Elizondo in :" -"issue:`35810`.)" -msgstr "" +msgstr "(Antoine Pitrou による貢献、:issue:`32430`。)" + +msgid "" +"Functions that convert Python number to C integer " +"like :c:func:`PyLong_AsLong` and argument parsing functions " +"like :c:func:`PyArg_ParseTuple` with integer converting format units like " +"``'i'`` will now use the :meth:`~object.__index__` special method instead " +"of :meth:`~object.__int__`, if available. The deprecation warning will be " +"emitted for objects with the ``__int__()`` method but without the " +"``__index__()`` method (like :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`). :c:func:`PyNumber_Check` will now return " +"``1`` for objects implementing " +"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` " +"and :c:func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " +"available. (Contributed by Serhiy Storchaka in :issue:`36048` " +"and :issue:`20092`.)" +msgstr "" +":c:func:`PyLong_AsLong` などの Python の数値を C の整数に変換する関数" +"や、:c:func:`PyArg_ParseTuple` などで ``'i'`` のような整数変換用の書式単位を" +"使う引数解析では、利用可能であれば :meth:`~object.__int__` の代わり" +"に :meth:`~object.__index__` 特殊メソッドを使うようになりました。\n" +":class:`~decimal.Decimal` や :class:`~fractions.Fraction` など、" +"``__int__()`` はあっても ``__index__()`` がないオブジェクトには非推奨の警告を" +"出します。\n" +":c:func:`PyNumber_Check` は、``__index__()`` を実装するオブジェクトに ``1`` " +"を返すようになりました。\n" +":c:func:`PyNumber_Long`、:c:func:`PyNumber_Float`、:c:func:`PyFloat_AsDouble` " +"も、利用可能であれば ``__index__()`` を使うようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`36048` and :issue:`20092`.)" + +msgid "" +"Heap-allocated type objects will now increase their reference count " +"in :c:func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) " +"instead of in :c:func:`PyType_GenericAlloc`. Types that modify instance " +"allocation or deallocation may need to be adjusted. (Contributed by Eddie " +"Elizondo in :issue:`35810`.)" +msgstr "" +"ヒープに割り当てられた型オブジェクトの参照カウント" +"は、:c:func:`PyType_GenericAlloc` ではなく :c:func:`PyObject_Init` (および対" +"応する ``PyObject_INIT`` マクロ) で増加するようになりました。\n" +"インスタンスの割り当てや解放を変更する型は、調整が必要になる場合がありま" +"す。\n" +"(Contributed by Eddie Elizondo in :issue:`35810`.)" -#: ../../whatsnew/3.8.rst:1626 msgid "" "The new function :c:func:`!PyCode_NewWithPosOnlyArgs` allows to create code " "objects like :c:func:`!PyCode_New`, but with an extra *posonlyargcount* " "parameter for indicating the number of positional-only arguments. " "(Contributed by Pablo Galindo in :issue:`37221`.)" msgstr "" +"新しい :c:func:`!PyCode_NewWithPosOnlyArgs` 関数は :c:func:`!PyCode_New` と同" +"様にコードオブジェクトを作成しますが、位置専用引数の数を示す " +"*posonlyargcount* パラメータが追加されています。\n" +"(Contributed by Pablo Galindo in :issue:`37221`.)" #: ../../whatsnew/3.8.rst:1631 msgid "" ":c:func:`!Py_SetPath` now sets :data:`sys.executable` to the program full " -"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name (:c:" -"func:`Py_GetProgramName`). (Contributed by Victor Stinner in :issue:`38234`.)" +"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name " +"(:c:func:`Py_GetProgramName`). (Contributed by Victor Stinner " +"in :issue:`38234`.)" msgstr "" #: ../../whatsnew/3.8.rst:1638 msgid "Deprecated" msgstr "非推奨" -#: ../../whatsnew/3.8.rst:1640 msgid "" "The distutils ``bdist_wininst`` command is now deprecated, use " -"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner in :" -"issue:`37481`.)" +"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner " +"in :issue:`37481`.)" msgstr "" +"distutils の ``bdist_wininst`` コマンドが非推奨になりました。\n" +"代わりに ``bdist_wheel`` (wheel パッケージ) を使ってください。\n" +"(Contributed by Victor Stinner in :issue:`37481`.)" -#: ../../whatsnew/3.8.rst:1644 msgid "" -"Deprecated methods ``getchildren()`` and ``getiterator()`` in the :mod:`~xml." -"etree.ElementTree` module now emit a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`. They will be removed in Python 3.9. " -"(Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Deprecated methods ``getchildren()`` and ``getiterator()`` in " +"the :mod:`~xml.etree.ElementTree` module now emit " +"a :exc:`DeprecationWarning` instead of :exc:`PendingDeprecationWarning`. " +"They will be removed in Python 3.9. (Contributed by Serhiy Storchaka " +"in :issue:`29209`.)" msgstr "" +":mod:`~xml.etree.ElementTree` モジュールの非推奨の ``getchildren()`` と " +"``getiterator()`` メソッドは、:exc:`PendingDeprecationWarning` の代わり" +"に :exc:`DeprecationWarning` を出すようになりました。\n" +"Python 3.9 で削除されます。\n" +"(Contributed by Serhiy Storchaka in :issue:`29209`.)" -#: ../../whatsnew/3.8.rst:1650 msgid "" -"Passing an object that is not an instance of :class:`concurrent.futures." -"ThreadPoolExecutor` to :meth:`loop.set_default_executor() ` is deprecated and will be prohibited in Python 3.9. " -"(Contributed by Elvis Pranskevichus in :issue:`34075`.)" +"Passing an object that is not an instance " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"to :meth:`loop.set_default_executor() ` " +"is deprecated and will be prohibited in Python 3.9. (Contributed by Elvis " +"Pranskevichus in :issue:`34075`.)" msgstr "" +":meth:`loop.set_default_executor() ` " +"に :class:`concurrent.futures.ThreadPoolExecutor` のインスタンス以外を渡すこ" +"とが非推奨になり、Python 3.9 では禁止されます。\n" +"(Contributed by Elvis Pranskevichus in :issue:`34075`.)" -#: ../../whatsnew/3.8.rst:1656 msgid "" -"The :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput` have been deprecated." +"The :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput` have been deprecated." msgstr "" +":class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util.FileWrapper`、:class:`fileinput.FileInput` " +"の :meth:`~object.__getitem__` メソッドが非推奨になりました。" -#: ../../whatsnew/3.8.rst:1660 msgid "" "Implementations of these methods have been ignoring their *index* parameter, " -"and returning the next item instead. (Contributed by Berker Peksag in :issue:" -"`9372`.)" +"and returning the next item instead. (Contributed by Berker Peksag " +"in :issue:`9372`.)" msgstr "" +"これらのメソッドの実装は *index* パラメータを無視し、代わりに次の要素を返して" +"いました。\n" +"(Contributed by Berker Peksag in :issue:`9372`.)" -#: ../../whatsnew/3.8.rst:1664 msgid "" "The :class:`typing.NamedTuple` class has deprecated the ``_field_types`` " "attribute in favor of the ``__annotations__`` attribute which has the same " "information. (Contributed by Raymond Hettinger in :issue:`36320`.)" msgstr "" +":class:`typing.NamedTuple` クラスの ``_field_types`` 属性が非推奨になりまし" +"た。\n" +"代わりに同じ情報を持つ ``__annotations__`` 属性を使ってください。\n" +"(Contributed by Raymond Hettinger in :issue:`36320`.)" -#: ../../whatsnew/3.8.rst:1668 msgid "" ":mod:`ast` classes ``Num``, ``Str``, ``Bytes``, ``NameConstant`` and " "``Ellipsis`` are considered deprecated and will be removed in future Python " "versions. :class:`~ast.Constant` should be used instead. (Contributed by " "Serhiy Storchaka in :issue:`32892`.)" msgstr "" +":mod:`ast` の ``Num``、``Str``、``Bytes``、``NameConstant``、``Ellipsis`` ク" +"ラスは非推奨とされ、将来の Python で削除されます。\n" +"代わりに :class:`~ast.Constant` を使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`32892`.)" -#: ../../whatsnew/3.8.rst:1673 msgid "" ":class:`ast.NodeVisitor` methods ``visit_Num()``, ``visit_Str()``, " "``visit_Bytes()``, ``visit_NameConstant()`` and ``visit_Ellipsis()`` are " -"deprecated now and will not be called in future Python versions. Add the :" -"meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant nodes. " +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant " +"nodes. (Contributed by Serhiy Storchaka in :issue:`36917`.)" +msgstr "" +":class:`ast.NodeVisitor` の ``visit_Num()``、``visit_Str()``、" +"``visit_Bytes()``、``visit_NameConstant()``、``visit_Ellipsis()`` メソッドが" +"非推奨になり、将来の Python では呼ばれなくなります。\n" +"すべての定数ノードを処理する :meth:`~ast.NodeVisitor.visit_Constant` メソッド" +"を追加してください。\n" "(Contributed by Serhiy Storchaka in :issue:`36917`.)" -msgstr "" #: ../../whatsnew/3.8.rst:1680 msgid "" "The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be " -"removed in version 3.10. Instead of ``@asyncio.coroutine``, use :keyword:" -"`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)" +"removed in version 3.10. Instead of ``@asyncio.coroutine``, " +"use :keyword:`async def` instead. (Contributed by Andrew Svetlov " +"in :issue:`36921`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1685 msgid "" "In :mod:`asyncio`, the explicit passing of a *loop* argument has been " -"deprecated and will be removed in version 3.10 for the following: :func:" -"`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:" -"`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :" -"class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:" -"`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio." -"BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio." -"create_subprocess_exec`, and :func:`asyncio.create_subprocess_shell`." +"deprecated and will be removed in version 3.10 for the " +"following: :func:`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio.BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio.create_subprocess_exec`, " +"and :func:`asyncio.create_subprocess_shell`." msgstr "" +":mod:`asyncio` の次の関数とクラスで *loop* 引数を明示的に渡すことが非推奨にな" +"り、3.10 で削除されま" +"す: :func:`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio.BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio.create_subprocess_exec`, :func:`asyncio.create_subprocess_shell`。" -#: ../../whatsnew/3.8.rst:1695 msgid "" "The explicit passing of coroutine objects to :func:`asyncio.wait` has been " "deprecated and will be removed in version 3.11. (Contributed by Yury " "Selivanov in :issue:`34790`.)" msgstr "" +":func:`asyncio.wait` にコルーチンオブジェクトを明示的に渡すことが非推奨にな" +"り、3.11 で削除されます。\n" +"(Contributed by Yury Selivanov in :issue:`34790`.)" #: ../../whatsnew/3.8.rst:1699 msgid "" "The following functions and methods are deprecated in the :mod:`gettext` " -"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:" -"`~gettext.lngettext` and :func:`~gettext.ldngettext`. They return encoded " -"bytes, and it's possible that you will get unexpected Unicode-related " -"exceptions if there are encoding problems with the translated strings. It's " -"much better to use alternatives which return Unicode strings in Python 3. " -"These functions have been broken for a long time." +"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:`~gettext.lngettext` " +"and :func:`~gettext.ldngettext`. They return encoded bytes, and it's " +"possible that you will get unexpected Unicode-related exceptions if there " +"are encoding problems with the translated strings. It's much better to use " +"alternatives which return Unicode strings in Python 3. These functions have " +"been broken for a long time." msgstr "" #: ../../whatsnew/3.8.rst:1707 msgid "" -"Function :func:`~gettext.bind_textdomain_codeset`, methods :meth:`~gettext." -"NullTranslations.output_charset` and :meth:`~gettext.NullTranslations." -"set_output_charset`, and the *codeset* parameter of functions :func:" -"`~gettext.translation` and :func:`~gettext.install` are also deprecated, " -"since they are only used for the ``l*gettext()`` functions. (Contributed by " -"Serhiy Storchaka in :issue:`33710`.)" +"Function :func:`~gettext.bind_textdomain_codeset`, " +"methods :meth:`~gettext.NullTranslations.output_charset` " +"and :meth:`~gettext.NullTranslations.set_output_charset`, and the *codeset* " +"parameter of functions :func:`~gettext.translation` " +"and :func:`~gettext.install` are also deprecated, since they are only used " +"for the ``l*gettext()`` functions. (Contributed by Serhiy Storchaka " +"in :issue:`33710`.)" msgstr "" #: ../../whatsnew/3.8.rst:1715 @@ -2830,77 +3350,87 @@ msgid "" "has been deprecated. (Contributed by Donghee Na in :issue:`35283`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1719 msgid "" "Many builtin and extension functions that take integer arguments will now " -"emit a deprecation warning for :class:`~decimal.Decimal`\\ s, :class:" -"`~fractions.Fraction`\\ s and any other objects that can be converted to " -"integers only with a loss (e.g. that have the :meth:`~object.__int__` method " -"but do not have the :meth:`~object.__index__` method). In future version " -"they will be errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" -msgstr "" +"emit a deprecation warning for :class:`~decimal.Decimal`\\ " +"s, :class:`~fractions.Fraction`\\ s and any other objects that can be " +"converted to integers only with a loss (e.g. that have " +"the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). In future version they will be " +"errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" +msgstr "" +"整数引数を受け付ける多くの組み込み関数や拡張関数" +"は、:class:`~decimal.Decimal`、:class:`~fractions.Fraction` など、情報を失わ" +"ずに整数へ変換できないオブジェクトに非推奨の警告を出すようになりました。\n" +"例えば :meth:`~object.__int__` はあっても :meth:`~object.__index__` がないオ" +"ブジェクトです。\n" +"将来のバージョンではエラーになります。\n" +"(Contributed by Serhiy Storchaka in :issue:`36048`.)" -#: ../../whatsnew/3.8.rst:1727 msgid "Deprecated passing the following arguments as keyword arguments:" -msgstr "" +msgstr "次の引数をキーワード引数として渡すことが非推奨になりました:" #: ../../whatsnew/3.8.rst:1729 msgid "" -"*func* in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:" -"`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb." -"runcall`, :meth:`trace.Trace.runfunc` and :func:`curses.wrapper`." +"*func* " +"in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb.runcall`, :meth:`trace.Trace.runfunc` " +"and :func:`curses.wrapper`." msgstr "" -#: ../../whatsnew/3.8.rst:1733 msgid "*function* in :meth:`unittest.TestCase.addCleanup`." -msgstr "" +msgstr ":meth:`unittest.TestCase.addCleanup` の *function*。" -#: ../../whatsnew/3.8.rst:1734 msgid "" -"*fn* in the :meth:`~concurrent.futures.Executor.submit` method of :class:" -"`concurrent.futures.ThreadPoolExecutor` and :class:`concurrent.futures." -"ProcessPoolExecutor`." +"*fn* in the :meth:`~concurrent.futures.Executor.submit` method " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"and :class:`concurrent.futures.ProcessPoolExecutor`." msgstr "" +":class:`concurrent.futures.ThreadPoolExecutor` " +"と :class:`concurrent.futures.ProcessPoolExecutor` " +"の :meth:`~concurrent.futures.Executor.submit` メソッドの *fn*。" #: ../../whatsnew/3.8.rst:1737 msgid "" -"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib." -"AsyncExitStack.callback` and :meth:`contextlib.AsyncExitStack." -"push_async_callback`." +"*callback* " +"in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib.AsyncExitStack.callback` " +"and :meth:`contextlib.AsyncExitStack.push_async_callback`." msgstr "" #: ../../whatsnew/3.8.rst:1740 msgid "" "*c* and *typeid* in the :meth:`~multiprocessing.managers.Server.create` " -"method of :class:`multiprocessing.managers.Server` and :class:" -"`multiprocessing.managers.SharedMemoryServer`." +"method of :class:`multiprocessing.managers.Server` " +"and :class:`multiprocessing.managers.SharedMemoryServer`." msgstr "" -#: ../../whatsnew/3.8.rst:1743 msgid "*obj* in :func:`weakref.finalize`." -msgstr "" +msgstr ":func:`weakref.finalize` の *obj*。" -#: ../../whatsnew/3.8.rst:1745 msgid "" "In future releases of Python, they will be :ref:`positional-only `. (Contributed by Serhiy Storchaka in :issue:`36492`.)" msgstr "" +"将来の Python リリースでは、これらは :ref:`位置専用 ` になります。\n" +"(Contributed by Serhiy Storchaka in :issue:`36492`.)" #: ../../whatsnew/3.8.rst:1751 msgid "API and Feature Removals" msgstr "API と機能の削除" -#: ../../whatsnew/3.8.rst:1753 msgid "The following features and APIs have been removed from Python 3.8:" -msgstr "" +msgstr "次の機能と API が Python 3.8 から削除されました:" -#: ../../whatsnew/3.8.rst:1755 msgid "" "Starting with Python 3.3, importing ABCs from :mod:`collections` was " "deprecated, and importing should be done from :mod:`collections.abc`. Being " "able to import from collections was marked for removal in 3.8, but has been " "delayed to 3.9. (See :gh:`81134`.)" msgstr "" +"Python 3.3 から :mod:`collections` からの ABC のインポートは非推奨であ" +"り、:mod:`collections.abc` からインポートする必要があります。\n" +"collections からのインポートは 3.8 で削除予定でしたが、3.9 に延期されました " +"(:gh:`81134` を参照)。" #: ../../whatsnew/3.8.rst:1760 msgid "" @@ -2918,69 +3448,92 @@ msgstr "" #: ../../whatsnew/3.8.rst:1767 msgid "" "The function :func:`time.clock` has been removed, after having been " -"deprecated since Python 3.3: use :func:`time.perf_counter` or :func:`time." -"process_time` instead, depending on your requirements, to have well-defined " -"behavior. (Contributed by Matthias Bussonnier in :issue:`36895`.)" +"deprecated since Python 3.3: use :func:`time.perf_counter` " +"or :func:`time.process_time` instead, depending on your requirements, to " +"have well-defined behavior. (Contributed by Matthias Bussonnier " +"in :issue:`36895`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1773 msgid "" "The ``pyvenv`` script has been removed in favor of ``python3.8 -m venv`` to " "help eliminate confusion as to what Python interpreter the ``pyvenv`` script " "is tied to. (Contributed by Brett Cannon in :issue:`25427`.)" msgstr "" +"``pyvenv`` スクリプトがどの Python インタープリタに対応するかという混乱を避け" +"るため、スクリプトは削除され、代わりに ``python3.8 -m venv`` を使うようになり" +"ました。\n" +"(Contributed by Brett Cannon in :issue:`25427`.)" -#: ../../whatsnew/3.8.rst:1777 msgid "" "``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`!cgi` " "module. They are deprecated in Python 3.2 or older. They should be imported " "from the ``urllib.parse`` and ``html`` modules instead." msgstr "" +":mod:`!cgi` モジュールから ``parse_qs``、``parse_qsl``、``escape`` が削除され" +"ました。\n" +"これらは Python 3.2 以前から非推奨でした。\n" +"代わりに ``urllib.parse`` と ``html`` モジュールからインポートしてください。" -#: ../../whatsnew/3.8.rst:1781 msgid "" "``filemode`` function is removed from the :mod:`tarfile` module. It is not " "documented and deprecated since Python 3.3." msgstr "" +":mod:`tarfile` モジュールから ``filemode`` 関数が削除されました。\n" +"文書化されておらず、Python 3.3 から非推奨でした。" -#: ../../whatsnew/3.8.rst:1784 msgid "" "The :class:`~xml.etree.ElementTree.XMLParser` constructor no longer accepts " "the *html* argument. It never had an effect and was deprecated in Python " "3.4. All other parameters are now :ref:`keyword-only `. (Contributed by Serhiy Storchaka in :issue:`29209`.)" msgstr "" +":class:`~xml.etree.ElementTree.XMLParser` のコンストラクタは *html* 引数を受" +"け付けなくなりました。\n" +"この引数は元から効果がなく、Python 3.4 で非推奨になっていました。\n" +"ほかのパラメータはすべて :ref:`キーワード専用 ` にな" +"りました。\n" +"(Contributed by Serhiy Storchaka in :issue:`29209`.)" -#: ../../whatsnew/3.8.rst:1789 msgid "" -"Removed the ``doctype()`` method of :class:`~xml.etree.ElementTree." -"XMLParser`. (Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Removed the ``doctype()`` method " +"of :class:`~xml.etree.ElementTree.XMLParser`. (Contributed by Serhiy " +"Storchaka in :issue:`29209`.)" msgstr "" +":class:`~xml.etree.ElementTree.XMLParser` の ``doctype()`` メソッドが削除され" +"ました。\n" +"(Contributed by Serhiy Storchaka in :issue:`29209`.)" -#: ../../whatsnew/3.8.rst:1792 msgid "" -"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki in :issue:" -"`36297`.)" +"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki " +"in :issue:`36297`.)" msgstr "" +"\"unicode_internal\" コーデックが削除されました。\n" +"(Contributed by Inada Naoki in :issue:`36297`.)" -#: ../../whatsnew/3.8.rst:1795 msgid "" "The ``Cache`` and ``Statement`` objects of the :mod:`sqlite3` module are not " "exposed to the user. (Contributed by Aviv Palivoda in :issue:`30262`.)" msgstr "" +":mod:`sqlite3` モジュールの ``Cache`` と ``Statement`` オブジェクトはユーザー" +"に公開されなくなりました。\n" +"(Contributed by Aviv Palivoda in :issue:`30262`.)" -#: ../../whatsnew/3.8.rst:1799 msgid "" -"The ``bufsize`` keyword argument of :func:`fileinput.input` and :func:" -"`fileinput.FileInput` which was ignored and deprecated since Python 3.6 has " -"been removed. :issue:`36952` (Contributed by Matthias Bussonnier.)" +"The ``bufsize`` keyword argument of :func:`fileinput.input` " +"and :func:`fileinput.FileInput` which was ignored and deprecated since " +"Python 3.6 has been removed. :issue:`36952` (Contributed by Matthias " +"Bussonnier.)" msgstr "" +":func:`fileinput.input` と :func:`fileinput.FileInput` の ``bufsize`` キー" +"ワード引数が削除されました。\n" +"Python 3.6 から無視され、非推奨になっていました (:issue:`36952`)。\n" +"(Contributed by Matthias Bussonnier.)" #: ../../whatsnew/3.8.rst:1803 msgid "" -"The functions :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper` deprecated in Python 3.7 have been removed; :issue:" -"`36933` (Contributed by Matthias Bussonnier.)" +"The functions :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper` deprecated in Python 3.7 have been " +"removed; :issue:`36933` (Contributed by Matthias Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1809 @@ -2999,72 +3552,102 @@ msgstr "" msgid "Changes in Python behavior" msgstr "Python の挙動の変更" -#: ../../whatsnew/3.8.rst:1818 msgid "" "Yield expressions (both ``yield`` and ``yield from`` clauses) are now " "disallowed in comprehensions and generator expressions (aside from the " "iterable expression in the leftmost :keyword:`!for` clause). (Contributed by " "Serhiy Storchaka in :issue:`10544`.)" msgstr "" +"内包表記とジェネレータ式では、最も左の :keyword:`!for` 節のイテラブル式を除" +"き、yield 式 (``yield`` と ``yield from`` の両方) を使えなくなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`10544`.)" -#: ../../whatsnew/3.8.rst:1823 msgid "" "The compiler now produces a :exc:`SyntaxWarning` when identity checks " "(``is`` and ``is not``) are used with certain types of literals (e.g. " "strings, numbers). These can often work by accident in CPython, but are not " "guaranteed by the language spec. The warning advises users to use equality " -"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka in :" -"issue:`34850`.)" +"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka " +"in :issue:`34850`.)" msgstr "" +"同一性の検査 (``is`` と ``is not``) を文字列や数値などの特定のリテラルに使う" +"と、コンパイラが :exc:`SyntaxWarning` を出すようになりました。\n" +"CPython では偶然動くことがありますが、言語仕様では保証されません。\n" +"警告では、代わりに等価性の検査 (``==`` と ``!=``) を使うよう案内します。\n" +"(Contributed by Serhiy Storchaka in :issue:`34850`.)" -#: ../../whatsnew/3.8.rst:1830 msgid "" "The CPython interpreter can swallow exceptions in some circumstances. In " "Python 3.8 this happens in fewer cases. In particular, exceptions raised " "when getting the attribute from the type dictionary are no longer ignored. " "(Contributed by Serhiy Storchaka in :issue:`35459`.)" msgstr "" +"CPython インタープリタは、状況によっては例外を握りつぶすことがあります。\n" +"Python 3.8 ではそのような場合が減りました。\n" +"特に、型の辞書から属性を取得するときに発生した例外を無視しなくなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`35459`.)" -#: ../../whatsnew/3.8.rst:1835 msgid "" -"Removed ``__str__`` implementations from builtin types :class:`bool`, :class:" -"`int`, :class:`float`, :class:`complex` and few classes from the standard " -"library. They now inherit ``__str__()`` from :class:`object`. As result, " -"defining the ``__repr__()`` method in the subclass of these classes will " -"affect their string representation. (Contributed by Serhiy Storchaka in :" -"issue:`36793`.)" +"Removed ``__str__`` implementations from builtin " +"types :class:`bool`, :class:`int`, :class:`float`, :class:`complex` and few " +"classes from the standard library. They now inherit ``__str__()`` " +"from :class:`object`. As result, defining the ``__repr__()`` method in the " +"subclass of these classes will affect their string representation. " +"(Contributed by Serhiy Storchaka in :issue:`36793`.)" msgstr "" +"組み込み型の :class:`bool`、:class:`int`、:class:`float`、:class:`complex` " +"と、標準ライブラリのいくつかのクラスから ``__str__`` の実装が削除されまし" +"た。\n" +"これらは :class:`object` から ``__str__()`` を継承します。\n" +"その結果、これらのサブクラスで ``__repr__()`` を定義すると文字列表現に影響す" +"るようになります。\n" +"(Contributed by Serhiy Storchaka in :issue:`36793`.)" -#: ../../whatsnew/3.8.rst:1842 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since older " "Python versions include the version number, so it is recommended to always " -"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt in :issue:" -"`36588`.)" +"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt " +"in :issue:`36588`.)" msgstr "" +"AIX では :data:`sys.platform` にメジャーバージョンが含まれなくなりました。\n" +"``'aix3'``〜``'aix7'`` ではなく、常に ``'aix'`` になります。\n" +"古い Python ではバージョン番号を含むため、常に " +"``sys.platform.startswith('aix')`` を使うことを推奨します。\n" +"(Contributed by M. Felt in :issue:`36588`.)" -#: ../../whatsnew/3.8.rst:1848 msgid "" ":c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_AcquireThread` now " "terminate the current thread if called while the interpreter is finalizing, " -"making them consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this behavior is " -"not desired, guard the call by checking :c:func:`!_Py_IsFinalizing` or :func:" -"`sys.is_finalizing`. (Contributed by Joannah Nanjekye in :issue:`36475`.)" -msgstr "" +"making them consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`. If this behavior is not desired, guard the " +"call by checking :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing`. " +"(Contributed by Joannah Nanjekye in :issue:`36475`.)" +msgstr "" +":c:func:`!PyEval_AcquireLock` と :c:func:`!PyEval_AcquireThread` は、インター" +"プリタの終了処理中に呼ぶと現在のスレッドを終了するようになりました。\n" +":c:func:`PyEval_RestoreThread`、:c:func:`Py_END_ALLOW_THREADS`、:c:func:`PyGILState_Ensure` " +"と同じ動作になります。\n" +"これを望まない場合は、:c:func:`!_Py_IsFinalizing` また" +"は :func:`sys.is_finalizing` を確認して呼び出しを保護してください。\n" +"(Contributed by Joannah Nanjekye in :issue:`36475`.)" #: ../../whatsnew/3.8.rst:1858 ../../whatsnew/3.8.rst:2321 msgid "Changes in the Python API" msgstr "Python API の変更" -#: ../../whatsnew/3.8.rst:1860 msgid "" "The :func:`os.getcwdb` function now uses the UTF-8 encoding on Windows, " "rather than the ANSI code page: see :pep:`529` for the rationale. The " "function is no longer deprecated on Windows. (Contributed by Victor Stinner " "in :issue:`37412`.)" msgstr "" +"Windows の :func:`os.getcwdb` 関数が、ANSI コードページではなく UTF-8 エン" +"コーディングを使うようになりました。\n" +"理由については :pep:`529` を参照してください。\n" +"この関数は Windows でも非推奨ではなくなりました。\n" +"(Contributed by Victor Stinner in :issue:`37412`.)" #: ../../whatsnew/3.8.rst:1865 msgid "" @@ -3076,13 +3659,17 @@ msgid "" "by Joannah Nanjekye and Victor Stinner in :issue:`35537`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1872 msgid "" "The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer " "compatible with subinterpreters. The use of the parameter in a " -"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow in :" -"issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" +"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow " +"in :issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" msgstr "" +":class:`subprocess.Popen` の *preexec_fn* 引数はサブインタープリタでは使えな" +"くなりました。\n" +"サブインタープリタで指定すると :exc:`RuntimeError` を送出します。\n" +"(Contributed by Eric Snow in :issue:`34651`, modified by Christian Heimes " +"in :issue:`37951`.)" #: ../../whatsnew/3.8.rst:1878 msgid "" @@ -3090,54 +3677,74 @@ msgid "" "exceptions. (Contributed by Victor Stinner in :issue:`36348`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1886 msgid "" "The :func:`statistics.mode` function no longer raises an exception when " "given multimodal data. Instead, it returns the first mode encountered in " "the input data. (Contributed by Raymond Hettinger in :issue:`35892`.)" msgstr "" +":func:`statistics.mode` は、最頻値が複数あるデータでも例外を送出せず、入力" +"データで最初に現れた最頻値を返すようになりました。\n" +"(Contributed by Raymond Hettinger in :issue:`35892`.)" -#: ../../whatsnew/3.8.rst:1891 msgid "" -"The :meth:`~tkinter.ttk.Treeview.selection` method of the :class:`tkinter." -"ttk.Treeview` class no longer takes arguments. Using it with arguments for " -"changing the selection was deprecated in Python 3.6. Use specialized " -"methods like :meth:`~tkinter.ttk.Treeview.selection_set` for changing the " -"selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" +"The :meth:`~tkinter.ttk.Treeview.selection` method of " +"the :class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it " +"with arguments for changing the selection was deprecated in Python 3.6. Use " +"specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for " +"changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" msgstr "" +":class:`tkinter.ttk.Treeview` の :meth:`~tkinter.ttk.Treeview.selection` メ" +"ソッドは引数を受け付けなくなりました。\n" +"引数を渡して選択を変更する使い方は Python 3.6 で非推奨になっていました。\n" +"選択を変更するには :meth:`~tkinter.ttk.Treeview.selection_set` などの専用メ" +"ソッドを使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`31508`.)" #: ../../whatsnew/3.8.rst:1897 msgid "" -"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods of :mod:" -"`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, now " -"preserve the attribute order specified by the user. (Contributed by Diego " -"Rojas and Raymond Hettinger in :issue:`34160`.)" +"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods " +"of :mod:`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, " +"now preserve the attribute order specified by the user. (Contributed by " +"Diego Rojas and Raymond Hettinger in :issue:`34160`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1902 msgid "" -"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. :func:" -"`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates a database " -"if it does not exist. (Contributed by Serhiy Storchaka in :issue:`32749`.)" -msgstr "" - -#: ../../whatsnew/3.8.rst:1907 -msgid "" -"The ``doctype()`` method defined in a subclass of :class:`~xml.etree." -"ElementTree.XMLParser` will no longer be called and will emit a :exc:" -"`RuntimeWarning` instead of a :exc:`DeprecationWarning`. Define the :meth:" -"`doctype() ` method on a target " -"for handling an XML doctype declaration. (Contributed by Serhiy Storchaka " -"in :issue:`29209`.)" +"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-" +"only. :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates " +"a database if it does not exist. (Contributed by Serhiy Storchaka " +"in :issue:`32749`.)" msgstr "" +"フラグ ``'r'`` で開いた :mod:`dbm.dumb` データベースは読み取り専用になりまし" +"た。\n" +":func:`dbm.dumb.open` は ``'r'`` と ``'w'`` の場合、データベースが存在しなく" +"ても作成しなくなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`32749`.)" + +msgid "" +"The ``doctype()`` method defined in a subclass " +"of :class:`~xml.etree.ElementTree.XMLParser` will no longer be called and " +"will emit a :exc:`RuntimeWarning` instead of a :exc:`DeprecationWarning`. " +"Define the :meth:`doctype() ` " +"method on a target for handling an XML doctype declaration. (Contributed by " +"Serhiy Storchaka in :issue:`29209`.)" +msgstr "" +":class:`~xml.etree.ElementTree.XMLParser` のサブクラスに定義した " +"``doctype()`` は呼ばれなくなり、:exc:`DeprecationWarning` ではな" +"く :exc:`RuntimeWarning` を出します。\n" +"XML の doctype 宣言を処理するには、ターゲットに :meth:`doctype() " +"` を定義してください。\n" +"(Contributed by Serhiy Storchaka in :issue:`29209`.)" -#: ../../whatsnew/3.8.rst:1914 msgid "" "A :exc:`RuntimeError` is now raised when the custom metaclass doesn't " -"provide the ``__classcell__`` entry in the namespace passed to ``type." -"__new__``. A :exc:`DeprecationWarning` was emitted in Python 3.6--3.7. " -"(Contributed by Serhiy Storchaka in :issue:`23722`.)" +"provide the ``__classcell__`` entry in the namespace passed to " +"``type.__new__``. A :exc:`DeprecationWarning` was emitted in Python " +"3.6--3.7. (Contributed by Serhiy Storchaka in :issue:`23722`.)" msgstr "" +"独自のメタクラスが ``type.__new__`` に渡す名前空間に ``__classcell__`` エント" +"リーを含めない場合、:exc:`RuntimeError` が発生するようになりました。\n" +"Python 3.6〜3.7 では :exc:`DeprecationWarning` でした。\n" +"(Contributed by Serhiy Storchaka in :issue:`23722`.)" #: ../../whatsnew/3.8.rst:1919 msgid "" @@ -3145,27 +3752,30 @@ msgid "" "(Contributed by Scott Sanderson in :issue:`29235`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1922 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls (see :ref:`shutil-platform-dependent-efficient-copy-" -"operations` section)." +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls " +"(see :ref:`shutil-platform-dependent-efficient-copy-operations` section)." msgstr "" +":func:`shutil.copyfile`、:func:`shutil.copy`、:func:`shutil.copy2`、:func:`shutil.copytree`、:func:`shutil.move` " +"がプラットフォーム固有の「高速コピー」システムコールを使うようになりました " +"(:ref:`shutil-platform-dependent-efficient-copy-operations` を参照)。" -#: ../../whatsnew/3.8.rst:1927 msgid "" ":func:`shutil.copyfile` default buffer size on Windows was changed from 16 " "KiB to 1 MiB." msgstr "" +"Windows の :func:`shutil.copyfile` のデフォルトのバッファサイズが 16 KiB か" +"ら 1 MiB に変わりました。" -#: ../../whatsnew/3.8.rst:1930 msgid "" "The ``PyGC_Head`` struct has changed completely. All code that touched the " "struct member should be rewritten. (See :issue:`33597`.)" msgstr "" +"``PyGC_Head`` 構造体が全面的に変更されました。\n" +"そのメンバーに触れるコードはすべて書き直す必要があります (:issue:`33597` を参" +"照)。" -#: ../../whatsnew/3.8.rst:1933 msgid "" "The :c:type:`PyInterpreterState` struct has been moved into the \"internal\" " "header files (specifically Include/internal/pycore_pystate.h). An opaque " @@ -3176,8 +3786,17 @@ msgid "" "issue. We'll work on helping you adjust (possibly including adding accessor " "functions to the public API). (See :issue:`35886`.)" msgstr "" +":c:type:`PyInterpreterState` 構造体は「内部」ヘッダーファイル (具体的には " +"Include/internal/pycore_pystate.h) に移されました。\n" +"不透明な ``PyInterpreterState`` は、引き続き公開 API (および安定 ABI) の一部" +"として利用できます。\n" +"どのフィールドも公開ではないことは文書に明記されているため、使われていないこ" +"とを期待しています。\n" +"ただし、これらの非公開フィールドに依存し、代替手段がない場合は BPO の issue " +"を作成してください。\n" +"公開 API へのアクセサー関数の追加なども含め、移行を支援します " +"(:issue:`35886` を参照)。" -#: ../../whatsnew/3.8.rst:1943 msgid "" "The :meth:`mmap.flush() ` method now returns ``None`` on " "success and raises an exception on error under all platforms. Previously, " @@ -3186,71 +3805,102 @@ msgid "" "returned on success; an exception was raised on error under Unix. " "(Contributed by Berker Peksag in :issue:`2122`.)" msgstr "" +":meth:`mmap.flush() ` はすべてのプラットフォームで、成功時" +"に ``None`` を返し、エラー時に例外を送出するようになりました。\n" +"以前はプラットフォーム依存で、Windows では成功時に非ゼロ、エラー時にゼロを返" +"していました。\n" +"Unix では成功時にゼロを返し、エラー時に例外を送出していました。\n" +"(Contributed by Berker Peksag in :issue:`2122`.)" -#: ../../whatsnew/3.8.rst:1950 msgid "" ":mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process external " "entities by default. (Contributed by Christian Heimes in :issue:`17239`.)" msgstr "" +":mod:`xml.dom.minidom` と :mod:`xml.sax` モジュールは、デフォルトでは外部実体" +"を処理しなくなりました。\n" +"(Contributed by Christian Heimes in :issue:`17239`.)" #: ../../whatsnew/3.8.rst:1954 msgid "" -"Deleting a key from a read-only :mod:`dbm` database (:mod:`dbm.dumb`, :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` (:exc:`dbm.dumb.error`, :" -"exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`. " -"(Contributed by Xiang Zhang in :issue:`33106`.)" +"Deleting a key from a read-only :mod:`dbm` database " +"(:mod:`dbm.dumb`, :mod:`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` " +"(:exc:`dbm.dumb.error`, :exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) " +"instead of :exc:`KeyError`. (Contributed by Xiang Zhang in :issue:`33106`.)" msgstr "" -#: ../../whatsnew/3.8.rst:1959 msgid "" -"Simplified AST for literals. All constants will be represented as :class:" -"`ast.Constant` instances. Instantiating old classes ``Num``, ``Str``, " -"``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an instance of " -"``Constant``. (Contributed by Serhiy Storchaka in :issue:`32892`.)" +"Simplified AST for literals. All constants will be represented " +"as :class:`ast.Constant` instances. Instantiating old classes ``Num``, " +"``Str``, ``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an " +"instance of ``Constant``. (Contributed by Serhiy Storchaka " +"in :issue:`32892`.)" msgstr "" +"リテラルの AST が簡素化され、すべての定数が :class:`ast.Constant` インスタン" +"スで表されるようになりました。\n" +"古い ``Num``、``Str``、``Bytes``、``NameConstant``、``Ellipsis`` クラスをイン" +"スタンス化すると ``Constant`` のインスタンスを返します。\n" +"(Contributed by Serhiy Storchaka in :issue:`32892`.)" -#: ../../whatsnew/3.8.rst:1975 msgid "" "The function :func:`asyncio.wait_for` now correctly waits for cancellation " "when using an instance of :class:`asyncio.Task`. Previously, upon reaching " "*timeout*, it was cancelled and immediately returned. (Contributed by Elvis " "Pranskevichus in :issue:`32751`.)" msgstr "" +":func:`asyncio.wait_for` 関数は、:class:`asyncio.Task` インスタンスを使う場" +"合、キャンセルが完了するまで正しく待つようになりました。\n" +"以前は *timeout* に達するとキャンセルして直ちに戻っていました。\n" +"(Contributed by Elvis Pranskevichus in :issue:`32751`.)" -#: ../../whatsnew/3.8.rst:1980 msgid "" "The function :func:`asyncio.BaseTransport.get_extra_info` now returns a safe " "to use socket object when 'socket' is passed to the *name* parameter. " "(Contributed by Yury Selivanov in :issue:`37027`.)" msgstr "" +":func:`asyncio.BaseTransport.get_extra_info` は、*name* パラメータに " +"'socket' を渡すと、安全に使えるソケットオブジェクトを返すようになりました。\n" +"(Contributed by Yury Selivanov in :issue:`37027`.)" -#: ../../whatsnew/3.8.rst:1984 msgid ":class:`asyncio.BufferedProtocol` has graduated to the stable API." -msgstr "" +msgstr ":class:`asyncio.BufferedProtocol` が安定 API になりました。" -#: ../../whatsnew/3.8.rst:1988 msgid "" "DLL dependencies for extension modules and DLLs loaded with :mod:`ctypes` on " "Windows are now resolved more securely. Only the system paths, the directory " -"containing the DLL or PYD file, and directories added with :func:`~os." -"add_dll_directory` are searched for load-time dependencies. Specifically, :" -"envvar:`PATH` and the current working directory are no longer used, and " -"modifications to these will no longer have any effect on normal DLL " -"resolution. If your application relies on these mechanisms, you should check " -"for :func:`~os.add_dll_directory` and if it exists, use it to add your DLLs " -"directory while loading your library. Note that Windows 7 users will need to " -"ensure that Windows Update KB2533623 has been installed (this is also " -"verified by the installer). (Contributed by Steve Dower in :issue:`36085`.)" -msgstr "" +"containing the DLL or PYD file, and directories added " +"with :func:`~os.add_dll_directory` are searched for load-time dependencies. " +"Specifically, :envvar:`PATH` and the current working directory are no longer " +"used, and modifications to these will no longer have any effect on normal " +"DLL resolution. If your application relies on these mechanisms, you should " +"check for :func:`~os.add_dll_directory` and if it exists, use it to add your " +"DLLs directory while loading your library. Note that Windows 7 users will " +"need to ensure that Windows Update KB2533623 has been installed (this is " +"also verified by the installer). (Contributed by Steve Dower " +"in :issue:`36085`.)" +msgstr "" +"Windows で、拡張モジュールと :mod:`ctypes` で読み込んだ DLL の依存 DLL が、よ" +"り安全に解決されるようになりました。\n" +"読み込み時の依存ライブラリの検索対象は、システムパス、DLL または PYD ファイル" +"のあるディレクトリ、:func:`~os.add_dll_directory` で追加したディレクトリだけ" +"です。\n" +"特に :envvar:`PATH` と現在の作業ディレクトリは使われなくなり、これらを変更し" +"ても通常の DLL 解決に影響しません。\n" +"この仕組みに依存するアプリケーションは :func:`~os.add_dll_directory` の有無を" +"確認し、あればライブラリを読み込む間、DLL のディレクトリを追加してくださ" +"い。\n" +"Windows 7 では Windows Update KB2533623 がインストール済みであることを確認す" +"る必要があります (インストーラーでも確認します)。\n" +"(Contributed by Steve Dower in :issue:`36085`.)" -#: ../../whatsnew/3.8.rst:2001 msgid "" "The header files and functions related to pgen have been removed after its " "replacement by a pure Python implementation. (Contributed by Pablo Galindo " "in :issue:`36623`.)" msgstr "" +"pgen が純粋な Python の実装に置き換えられたため、関連するヘッダーファイルと関" +"数が削除されました。\n" +"(Contributed by Pablo Galindo in :issue:`36623`.)" -#: ../../whatsnew/3.8.rst:2005 msgid "" ":class:`types.CodeType` has a new parameter in the second position of the " "constructor (*posonlyargcount*) to support positional-only arguments defined " @@ -3259,33 +3909,47 @@ msgid "" "new ``replace()`` method of :class:`types.CodeType` can be used to make the " "code future-proof." msgstr "" +":class:`types.CodeType` のコンストラクタの第 2 パラメータとして " +"*posonlyargcount* が追加され、:pep:`570` の位置専用引数をサポートしました。\n" +"第 1 パラメータの *argcount* は、位置専用引数を含む位置引数の合計数を表しま" +"す。\n" +":class:`types.CodeType` の新しい ``replace()`` メソッドを使うと、将来の変更に" +"強いコードにできます。" -#: ../../whatsnew/3.8.rst:2012 msgid "" "The parameter ``digestmod`` for :func:`hmac.new` no longer uses the MD5 " "digest by default." msgstr "" +":func:`hmac.new` の ``digestmod`` パラメータは、デフォルトで MD5 ダイジェスト" +"を使わなくなりました。" #: ../../whatsnew/3.8.rst:2016 msgid "Changes in the C API" msgstr "C API の変更" -#: ../../whatsnew/3.8.rst:2018 msgid "" "The :c:struct:`PyCompilerFlags` structure got a new *cf_feature_version* " "field. It should be initialized to ``PY_MINOR_VERSION``. The field is " "ignored by default, and is used if and only if ``PyCF_ONLY_AST`` flag is set " "in *cf_flags*. (Contributed by Guido van Rossum in :issue:`35766`.)" msgstr "" +":c:struct:`PyCompilerFlags` に *cf_feature_version* フィールドが追加されまし" +"た。\n" +"``PY_MINOR_VERSION`` で初期化する必要があります。\n" +"デフォルトでは無視され、*cf_flags* に ``PyCF_ONLY_AST`` フラグが設定されてい" +"る場合に限って使われます。\n" +"(Contributed by Guido van Rossum in :issue:`35766`.)" -#: ../../whatsnew/3.8.rst:2024 msgid "" "The :c:func:`!PyEval_ReInitThreads` function has been removed from the C " "API. It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child` " "instead. (Contributed by Victor Stinner in :issue:`36728`.)" msgstr "" +":c:func:`!PyEval_ReInitThreads` が C API から削除されました。\n" +"明示的に呼ぶべき関数ではありません。\n" +"代わりに :c:func:`PyOS_AfterFork_Child` を使ってください。\n" +"(Contributed by Victor Stinner in :issue:`36728`.)" -#: ../../whatsnew/3.8.rst:2029 msgid "" "On Unix, C extensions are no longer linked to libpython except on Android " "and Cygwin. When Python is embedded, ``libpython`` must not be loaded with " @@ -3295,31 +3959,44 @@ msgid "" "by the ``*shared*`` section of ``Modules/Setup``. (Contributed by Victor " "Stinner in :issue:`21536`.)" msgstr "" - -#: ../../whatsnew/3.8.rst:2037 -msgid "" -"Use of ``#`` variants of formats in parsing or building value (e.g. :c:func:" -"`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:" -"`PyObject_CallFunction`, etc.) without ``PY_SSIZE_T_CLEAN`` defined raises " -"``DeprecationWarning`` now. It will be removed in 3.10 or 4.0. Read :ref:" -"`arg-parsing` for detail. (Contributed by Inada Naoki in :issue:`36381`.)" -msgstr "" +"Unix では Android と Cygwin を除き、C 拡張は libpython にリンクしなくなりまし" +"た。\n" +"Python を埋め込む場合、``libpython`` は ``RTLD_LOCAL`` ではなく " +"``RTLD_GLOBAL`` で読み込む必要があります。\n" +"以前から ``RTLD_LOCAL`` では、``Modules/Setup`` の ``*shared*`` 節でビルドし" +"た標準ライブラリの拡張など、``libpython`` にリンクしていない C 拡張は読み込め" +"ませんでした。\n" +"(Contributed by Victor Stinner in :issue:`21536`.)" + +msgid "" +"Use of ``#`` variants of formats in parsing or building value " +"(e.g. :c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`, " +"etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` " +"now. It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail. " +"(Contributed by Inada Naoki in :issue:`36381`.)" +msgstr "" +"値の解析や構築 " +"(:c:func:`PyArg_ParseTuple`、:c:func:`Py_BuildValue`、:c:func:`PyObject_CallFunction` " +"など) で、``PY_SSIZE_T_CLEAN`` を定義せずに ``#`` 付きの書式を使うと " +"``DeprecationWarning`` が発生するようになりました。\n" +"この使い方は 3.10 または 4.0 で削除されます。\n" +"詳しくは :ref:`arg-parsing` を参照してください。\n" +"(Contributed by Inada Naoki in :issue:`36381`.)" #: ../../whatsnew/3.8.rst:2043 msgid "" -"Instances of heap-allocated types (such as those created with :c:func:" -"`PyType_FromSpec`) hold a reference to their type object. Increasing the " -"reference count of these type objects has been moved from :c:func:" -"`PyType_GenericAlloc` to the more low-level functions, :c:func:" -"`PyObject_Init` and :c:func:`PyObject_INIT`. This makes types created " -"through :c:func:`PyType_FromSpec` behave like other classes in managed code." +"Instances of heap-allocated types (such as those created " +"with :c:func:`PyType_FromSpec`) hold a reference to their type object. " +"Increasing the reference count of these type objects has been moved " +"from :c:func:`PyType_GenericAlloc` to the more low-level " +"functions, :c:func:`PyObject_Init` and :c:func:`PyObject_INIT`. This makes " +"types created through :c:func:`PyType_FromSpec` behave like other classes in " +"managed code." msgstr "" -#: ../../whatsnew/3.8.rst:2051 msgid ":ref:`Statically allocated types ` are not affected." -msgstr "" +msgstr ":ref:`静的に割り当てられた型 ` は影響を受けません。" -#: ../../whatsnew/3.8.rst:2053 msgid "" "For the vast majority of cases, there should be no side effect. However, " "types that manually increase the reference count after allocating an " @@ -3327,19 +4004,23 @@ msgid "" "this, these classes need to call Py_DECREF on the type object during " "instance deallocation." msgstr "" +"ほとんどの場合、副作用はないはずです。\n" +"ただし、インスタンスの割り当て後に手動で参照カウントを増やす型 (バグを回避す" +"るためにそうしていた場合など) は、解放されなくなる可能性があります。\n" +"避けるには、インスタンスの解放時に型オブジェクトに対して Py_DECREF を呼ぶ必要" +"があります。" -#: ../../whatsnew/3.8.rst:2059 msgid "" "To correctly port these types into 3.8, please apply the following changes:" -msgstr "" +msgstr "これらの型を 3.8 に正しく移行するには、次の変更を行ってください:" #: ../../whatsnew/3.8.rst:2062 msgid "" "Remove :c:macro:`Py_INCREF` on the type object after allocating an instance " -"- if any. This may happen after calling :c:macro:`PyObject_New`, :c:macro:" -"`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " -"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:func:" -"`PyObject_INIT`." +"- if any. This may happen after " +"calling :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " +"or any other custom allocator that uses :c:func:`PyObject_Init` " +"or :c:func:`PyObject_INIT`." msgstr "" #: ../../whatsnew/3.8.rst:2069 ../../whatsnew/3.8.rst:2088 @@ -3362,13 +4043,13 @@ msgid "" "}" msgstr "" -#: ../../whatsnew/3.8.rst:2085 msgid "" "Ensure that all custom ``tp_dealloc`` functions of heap-allocated types " "decrease the type's reference count." msgstr "" +"ヒープ型の独自の ``tp_dealloc`` 関数が、すべて型の参照カウントを減らすことを" +"確認してください。" -#: ../../whatsnew/3.8.rst:2090 msgid "" "static void\n" "foo_dealloc(foo_struct *instance) {\n" @@ -3380,47 +4061,61 @@ msgid "" "#endif\n" "}" msgstr "" +"static void\n" +"foo_dealloc(foo_struct *instance) {\n" +" PyObject *type = Py_TYPE(instance);\n" +" PyObject_GC_Del(instance);\n" +"#if PY_VERSION_HEX >= 0x03080000\n" +" // Python 3.8 より前には不要だった (Python issue 35810)\n" +" Py_DECREF(type);\n" +"#endif\n" +"}" -#: ../../whatsnew/3.8.rst:2102 msgid "(Contributed by Eddie Elizondo in :issue:`35810`.)" -msgstr "" +msgstr "(Eddie Elizondo による貢献、:issue:`35810`。)" -#: ../../whatsnew/3.8.rst:2104 msgid "" "The :c:macro:`Py_DEPRECATED()` macro has been implemented for MSVC. The " "macro now must be placed before the symbol name." msgstr "" +":c:macro:`Py_DEPRECATED()` マクロが MSVC 向けに実装されました。\n" +"このマクロはシンボル名の前に置く必要があります。" #: ../../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`.)" -msgstr "" +msgstr "(Zackery Spytz による貢献、:issue:`33407`。)" -#: ../../whatsnew/3.8.rst:2115 msgid "" "The interpreter does not pretend to support binary compatibility of " "extension types across feature releases, anymore. A :c:type:`PyTypeObject` " "exported by a third-party extension module is supposed to have all the slots " -"expected in the current Python version, including :c:member:`~PyTypeObject." -"tp_finalize` (:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore " -"before reading :c:member:`~PyTypeObject.tp_finalize`)." -msgstr "" +"expected in the current Python version, " +"including :c:member:`~PyTypeObject.tp_finalize` " +"(:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore before " +"reading :c:member:`~PyTypeObject.tp_finalize`)." +msgstr "" +"インタープリタは、拡張型の機能リリース間でのバイナリ互換性をサポートしている" +"かのように振る舞うことをやめました。\n" +"サードパーティーの拡張モジュールが公開する :c:type:`PyTypeObject` " +"は、:c:member:`~PyTypeObject.tp_finalize` を含め、現在の Python バージョンで" +"期待されるすべてのスロットを持つ必要があります。\n" +":c:member:`~PyTypeObject.tp_finalize` を読む前" +"に :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` を確認しなくなりました。" -#: ../../whatsnew/3.8.rst:2122 msgid "(Contributed by Antoine Pitrou in :issue:`32388`.)" -msgstr "" +msgstr "(Antoine Pitrou による貢献、:issue:`32388`。)" -#: ../../whatsnew/3.8.rst:2124 msgid "" "The functions :c:func:`!PyNode_AddChild` and :c:func:`!PyParser_AddToken` " "now accept two additional ``int`` arguments *end_lineno* and " "*end_col_offset*." msgstr "" +":c:func:`!PyNode_AddChild` と :c:func:`!PyParser_AddToken` 関数に、``int`` 型" +"の引数 *end_lineno* と *end_col_offset* が追加されました。" -#: ../../whatsnew/3.8.rst:2127 msgid "" "The :file:`libpython38.a` file to allow MinGW tools to link directly " "against :file:`python38.dll` is no longer included in the regular Windows " @@ -3428,39 +4123,50 @@ msgid "" "``gendef`` and ``dlltool`` tools, which are part of the MinGW binutils " "package:" msgstr "" +"MinGW ツールが :file:`python38.dll` に直接リンクするため" +"の :file:`libpython38.a` は、通常の Windows 配布物に含まれなくなりました。\n" +"必要な場合は、MinGW binutils パッケージの ``gendef`` と ``dlltool`` で生成で" +"きます:" -#: ../../whatsnew/3.8.rst:2132 msgid "" "gendef - python38.dll > tmp.def\n" "dlltool --dllname python38.dll --def tmp.def --output-lib libpython38.a" msgstr "" +"gendef - python38.dll > tmp.def\n" +"dlltool --dllname python38.dll --def tmp.def --output-lib libpython38.a" -#: ../../whatsnew/3.8.rst:2137 msgid "" "The location of an installed :file:`pythonXY.dll` will depend on the " -"installation options and the version and language of Windows. See :ref:" -"`using-on-windows` for more information. The resulting library should be " -"placed in the same directory as :file:`pythonXY.lib`, which is generally " -"the :file:`libs` directory under your Python installation." -msgstr "" +"installation options and the version and language of Windows. " +"See :ref:`using-on-windows` for more information. The resulting library " +"should be placed in the same directory as :file:`pythonXY.lib`, which is " +"generally the :file:`libs` directory under your Python installation." +msgstr "" +"インストールされた :file:`pythonXY.dll` の場所は、インストールオプションと " +"Windows のバージョンや言語によって異なります。\n" +"詳しくは :ref:`using-on-windows` を参照してください。\n" +"生成したライブラリは :file:`pythonXY.lib` と同じディレクトリに置いてくださ" +"い。\n" +"通常は Python のインストール先の :file:`libs` ディレクトリです。" -#: ../../whatsnew/3.8.rst:2143 msgid "(Contributed by Steve Dower in :issue:`37351`.)" -msgstr "" +msgstr "(Steve Dower による貢献、:issue:`37351`。)" #: ../../whatsnew/3.8.rst:2147 msgid "CPython bytecode changes" msgstr "CPython バイトコードの変更" -#: ../../whatsnew/3.8.rst:2149 msgid "" "The interpreter loop has been simplified by moving the logic of unrolling " "the stack of blocks into the compiler. The compiler emits now explicit " "instructions for adjusting the stack of values and calling the cleaning-up " "code for :keyword:`break`, :keyword:`continue` and :keyword:`return`." msgstr "" +"ブロックのスタックを巻き戻すロジックをコンパイラに移すことで、インタープリタ" +"のループが簡素化されました。\n" +"コンパイラは :keyword:`break`、:keyword:`continue`、:keyword:`return` に対し" +"て、値スタックを調整して後始末のコードを呼ぶ命令を明示的に出力します。" -#: ../../whatsnew/3.8.rst:2155 msgid "" "Removed opcodes :opcode:`!BREAK_LOOP`, :opcode:`!CONTINUE_LOOP`, :opcode:`!" "SETUP_LOOP` and :opcode:`!SETUP_EXCEPT`. Added new opcodes :opcode:`!" @@ -3468,44 +4174,55 @@ msgid "" "POP_FINALLY`. Changed the behavior of :opcode:`!END_FINALLY` and :opcode:`!" "WITH_CLEANUP_START`." msgstr "" +":opcode:`!BREAK_LOOP`、:opcode:`!CONTINUE_LOOP`、:opcode:`!" +"SETUP_LOOP`、:opcode:`!SETUP_EXCEPT` オペコードが削除されました。\n" +":opcode:`!ROT_FOUR`、:opcode:`!BEGIN_FINALLY`、:opcode:`!" +"CALL_FINALLY`、:opcode:`!POP_FINALLY` が追加されました。\n" +":opcode:`!END_FINALLY` と :opcode:`!WITH_CLEANUP_START` の動作が変わりまし" +"た。" -#: ../../whatsnew/3.8.rst:2161 msgid "" -"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in :issue:" -"`17611`.)" +"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka " +"in :issue:`17611`.)" msgstr "" +"(Mark Shannon、Antoine Pitrou、Serhiy Storchaka による貢献、:issue:`17611`。)" -#: ../../whatsnew/3.8.rst:2164 msgid "" "Added new opcode :opcode:`END_ASYNC_FOR` for handling exceptions raised when " "awaiting a next item in an :keyword:`async for` loop. (Contributed by Serhiy " "Storchaka in :issue:`33041`.)" msgstr "" +":keyword:`async for` ループで次の要素を待つ際に発生する例外を処理する、新し" +"い :opcode:`END_ASYNC_FOR` オペコードが追加されました。\n" +"(Contributed by Serhiy Storchaka in :issue:`33041`.)" -#: ../../whatsnew/3.8.rst:2168 msgid "" "The :opcode:`MAP_ADD` now expects the value as the first element in the " "stack and the key as the second element. This change was made so the key is " "always evaluated before the value in dictionary comprehensions, as proposed " "by :pep:`572`. (Contributed by Jörn Heissler in :issue:`35224`.)" msgstr "" +":opcode:`MAP_ADD` は、スタックの第 1 要素を値、第 2 要素をキーとみなすように" +"なりました。\n" +":pep:`572` の提案どおり、辞書内包表記でキーを常に値より先に評価するための変更" +"です。\n" +"(Contributed by Jörn Heissler in :issue:`35224`.)" -#: ../../whatsnew/3.8.rst:2175 msgid "Demos and Tools" -msgstr "" +msgstr "デモとツール" -#: ../../whatsnew/3.8.rst:2177 msgid "" "Added a benchmark script for timing various ways to access variables: " "``Tools/scripts/var_access_benchmark.py``. (Contributed by Raymond Hettinger " "in :issue:`35884`.)" msgstr "" +"変数にアクセスする各種の方法を計測するベンチマークスクリプト ``Tools/scripts/" +"var_access_benchmark.py`` が追加されました。\n" +"(Contributed by Raymond Hettinger in :issue:`35884`.)" -#: ../../whatsnew/3.8.rst:2181 msgid "Here's a summary of performance improvements since Python 3.3:" -msgstr "" +msgstr "Python 3.3 以降の性能改善の概要です:" -#: ../../whatsnew/3.8.rst:2183 msgid "" "Python version 3.3 3.4 3.5 3.6 3.7 " "3.8\n" @@ -3580,8 +4297,79 @@ msgid "" " loop_overhead 0.3 0.5 0.6 0.4 0.3 " "0.3" msgstr "" +"Python version 3.3 3.4 3.5 3.6 3.7 " +"3.8\n" +"-------------- --- --- --- --- --- " +"---\n" +"\n" +"Variable and attribute read access:\n" +" read_local 4.0 7.1 7.1 5.4 5.1 " +"3.9\n" +" read_nonlocal 5.3 7.1 8.1 5.8 5.4 " +"4.4\n" +" read_global 13.3 15.5 19.0 14.3 13.6 " +"7.6\n" +" read_builtin 20.0 21.1 21.6 18.5 19.0 " +"7.5\n" +" read_classvar_from_class 20.5 25.6 26.5 20.7 19.5 " +"18.4\n" +" read_classvar_from_instance 18.5 22.8 23.5 18.8 17.1 " +"16.4\n" +" read_instancevar 26.8 32.4 33.1 28.0 26.3 " +"25.4\n" +" read_instancevar_slots 23.7 27.8 31.3 20.8 20.8 " +"20.2\n" +" read_namedtuple 68.5 73.8 57.5 45.0 46.8 " +"18.4\n" +" read_boundmethod 29.8 37.6 37.9 29.6 26.9 " +"27.7\n" +"\n" +"Variable and attribute write access:\n" +" write_local 4.6 8.7 9.3 5.5 5.3 " +"4.3\n" +" write_nonlocal 7.3 10.5 11.1 5.6 5.5 " +"4.7\n" +" write_global 15.9 19.7 21.2 18.0 18.0 " +"15.8\n" +" write_classvar 81.9 92.9 96.0 104.6 102.1 " +"39.2\n" +" write_instancevar 36.4 44.6 45.8 40.0 38.9 " +"35.5\n" +" write_instancevar_slots 28.7 35.6 36.1 27.3 26.6 " +"25.7\n" +"\n" +"Data structure read access:\n" +" read_list 19.2 24.2 24.5 20.8 20.8 " +"19.0\n" +" read_deque 19.9 24.7 25.5 20.2 20.6 " +"19.8\n" +" read_dict 19.7 24.3 25.7 22.3 23.0 " +"21.0\n" +" read_strdict 17.9 22.6 24.3 19.5 21.2 " +"18.9\n" +"\n" +"Data structure write access:\n" +" write_list 21.2 27.1 28.5 22.5 21.6 " +"20.0\n" +" write_deque 23.8 28.7 30.1 22.7 21.8 " +"23.5\n" +" write_dict 25.9 31.4 33.3 29.3 29.2 " +"24.7\n" +" write_strdict 22.9 28.4 29.9 27.5 25.2 " +"23.1\n" +"\n" +"Stack (or queue) operations:\n" +" list_append_pop 144.2 93.4 112.7 75.4 74.2 " +"50.8\n" +" deque_append_pop 30.4 43.5 57.0 49.4 49.2 " +"42.5\n" +" deque_append_popleft 30.8 43.7 57.3 49.7 49.7 " +"42.8\n" +"\n" +"Timing loop:\n" +" loop_overhead 0.3 0.5 0.6 0.4 0.3 " +"0.3" -#: ../../whatsnew/3.8.rst:2228 msgid "" "The benchmarks were measured on an `Intel® Core™ i7-4960HQ processor " "`_. The " "benchmark script displays timings in nanoseconds." msgstr "" +"ベンチマークは `Intel® Core™ i7-4960HQ プロセッサー `_ で、`python.org `_ の macOS 64 ビットビルドを使って計測しました。\n" +"スクリプトは時間をナノ秒単位で表示します。" #: ../../whatsnew/3.8.rst:2237 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 " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" -"セキュリティ上の重大な懸念により、:meth:`asyncio.loop." -"create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" -"``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " -"Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" +"セキュリティ上の重大な懸念によ" +"り、:meth:`asyncio.loop.create_datagram_endpoint` での *reuse_address* 引数は" +"無効になりました。これはソケットオプション ``SO_REUSEADDR`` のUDP における挙" +"動が原因です。詳しくは、``loop.create_datagram_endpoint()`` のドキュメントを" +"参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov による貢" +"献 :issue:`37228`)" #: ../../whatsnew/3.8.rst:2247 msgid "Notable changes in Python 3.8.2" msgstr "Python3.8.2 での重要な変更点" -#: ../../whatsnew/3.8.rst:2249 msgid "" "Fixed a regression with the ``ignore`` callback of :func:`shutil.copytree`. " "The argument types are now str and List[str] again. (Contributed by Manuel " "Barkhau and Giampaolo Rodola in :gh:`83571`.)" msgstr "" +":func:`shutil.copytree` の ``ignore`` コールバックのリグレッションが修正され" +"ました。\n" +"引数の型は再び str と List[str] になりました。\n" +"(Contributed by Manuel Barkhau and Giampaolo Rodola in :gh:`83571`.)" -#: ../../whatsnew/3.8.rst:2254 msgid "Notable changes in Python 3.8.3" -msgstr "" +msgstr "Python 3.8.3 の注目すべき変更" -#: ../../whatsnew/3.8.rst:2256 msgid "" "The constant values of future flags in the :mod:`__future__` module are " "updated in order to prevent collision with compiler flags. Previously " "``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``. " "(Contributed by Batuhan Taskaya in :gh:`83743`)" msgstr "" +":mod:`__future__` モジュールの future フラグの定数値が、コンパイラフラグとの" +"衝突を避けるために更新されました。\n" +"以前は ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` が ``CO_FUTURE_DIVISION`` と衝突してい" +"ました。\n" +"(Contributed by Batuhan Taskaya in :gh:`83743`)" #: ../../whatsnew/3.8.rst:2262 msgid "Notable changes in Python 3.8.8" msgstr "Python3.8.8 での重要な変更点" -#: ../../whatsnew/3.8.rst:2264 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" -msgstr "" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" +msgstr "" +"以前の Python では :func:`urllib.parse.parse_qs` " +"と :func:`urllib.parse.parse_qsl` のクエリパラメータの区切りに ``;`` と " +"``&`` の両方を使えました。\n" +"セキュリティ上の懸念と、新しい W3C 勧告への準拠のため、区切りは 1 種類のみと" +"なり、デフォルトは ``&`` に変更されました。\n" +"これらの関数を内部で使う :func:`!cgi.parse` と :func:`!cgi.parse_multipart` " +"も影響を受けます。\n" +"詳しくは各関数のドキュメントを参照してください。\n" +"(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" -#: ../../whatsnew/3.8.rst:2275 msgid "Notable changes in Python 3.8.9" -msgstr "" +msgstr "Python 3.8.9 の注目すべき変更" -#: ../../whatsnew/3.8.rst:2277 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -3660,16 +4467,20 @@ msgid "" "old behavior, set a ``trust_server_pasv_ipv4_address`` attribute on your FTP " "instance to ``True``. (See :gh:`87451`)" msgstr "" +"セキュリティ修正により、:class:`ftplib.FTP` はパッシブデータチャネルを確立す" +"るとき、リモートサーバーから送られた IPv4 アドレスを信頼しなくなりました。\n" +"代わりに FTP サーバーの IP アドレスを再利用します。\n" +"従来の動作が必要な特殊なコードでは、FTP インスタンスの " +"``trust_server_pasv_ipv4_address`` 属性を ``True`` に設定してください " +"(:gh:`87451` を参照)。" -#: ../../whatsnew/3.8.rst:2284 ../../whatsnew/3.8.rst:2304 msgid "Notable changes in Python 3.8.10" -msgstr "" +msgstr "Python 3.8.10 の注目すべき変更" #: ../../whatsnew/3.8.rst:2287 msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート" -#: ../../whatsnew/3.8.rst:2289 msgid "" "As of 3.8.10, Python now supports building and running on macOS 11 (Big Sur) " "and on Apple Silicon Macs (based on the ``ARM64`` architecture). A new " @@ -3681,33 +4492,49 @@ msgid "" "3.9; to support a range of macOS versions, continue to target for and build " "on the oldest version in the range." msgstr "" +"3.8.10 から、macOS 11 (Big Sur) と Apple Silicon Mac (``ARM64`` アーキテク" +"チャ) でのビルドと実行をサポートしました。\n" +"新しいユニバーサルビルド ``universal2`` により、一組の実行ファイルで " +"``ARM64`` と ``Intel 64`` の両方をネイティブにサポートできます。\n" +"ただし、新しい macOS 向けのバイナリをビルドし、実行時に不足する機能を確認する" +"ことで古い macOS でも正しく動作させる「弱いリンク」のサポートは、Python 3.9 " +"からのこのバックポートには含まれません。\n" +"複数の macOS バージョンに対応するには、引き続き対象のうち最も古いバージョン向" +"けに、そのバージョン上でビルドしてください。" -#: ../../whatsnew/3.8.rst:2299 msgid "" -"(Originally contributed by Ronald Oussoren and Lawrence D'Anna in :gh:" -"`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to 3.8 by " -"Maxime Bélanger and Ned Deily)" +"(Originally contributed by Ronald Oussoren and Lawrence D'Anna " +"in :gh:`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to " +"3.8 by Maxime Bélanger and Ned Deily)" msgstr "" +"(Ronald Oussoren と Lawrence D'Anna による元の貢献、:gh:`85272`。FX Coudert " +"と Eli Rykoff による修正を含み、Maxime Bélanger と Ned Deily が 3.8 にバック" +"ポートしました。)" #: ../../whatsnew/3.8.rst:2307 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.8.rst:2309 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:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)" -msgstr "" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :issue:`43882`)" +msgstr "" +"URL の一部に改行やタブ文字が含まれると、特定の攻撃が可能になります。\n" +":rfc:`3986` を更新する WHATWG 仕様に従い、:mod:`urllib.parse` のパーサーは " +"ASCII の改行 ``\\n``、``\\r`` とタブ ``\\t`` を URL から取り除き、このような" +"攻撃を防ぐようになりました。\n" +"削除対象の文字は新しいモジュール変数 " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE`` で制御します (:issue:`43882` を" +"参照)。" -#: ../../whatsnew/3.8.rst:2318 msgid "Notable changes in Python 3.8.12" -msgstr "" +msgstr "Python 3.8.12 の注目すべき変更" -#: ../../whatsnew/3.8.rst:2323 msgid "" "Starting with Python 3.8.12 the :mod:`ipaddress` module no longer accepts " "any leading zeros in IPv4 address strings. Leading zeros are ambiguous and " @@ -3716,18 +4543,24 @@ msgid "" "glibc implementation of modern :func:`~socket.inet_pton` does not accept any " "leading zeros." msgstr "" +"Python 3.8.12 から :mod:`ipaddress` は、IPv4 アドレス文字列の先頭のゼロを一切" +"受け付けなくなりました。\n" +"先頭のゼロは曖昧で、一部のライブラリは 8 進表記と解釈します。\n" +"例えば従来の :func:`socket.inet_aton` は先頭のゼロを 8 進表記として扱いま" +"す。\n" +"新しい :func:`~socket.inet_pton` の glibc 実装は、先頭のゼロを一切受け付けま" +"せん。" -#: ../../whatsnew/3.8.rst:2330 msgid "" "(Originally contributed by Christian Heimes in :issue:`36384`, and " "backported to 3.8 by Achraf Merzouki.)" msgstr "" +"(Christian Heimes による元の貢献、:issue:`36384`。Achraf Merzouki が 3.8 に" +"バックポートしました。)" -#: ../../whatsnew/3.8.rst:2334 msgid "Notable security feature in 3.8.14" -msgstr "" +msgstr "3.8.14 の注目すべきセキュリティ機能" -#: ../../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 +4572,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.8.rst:2347 msgid "Notable changes in 3.8.17" -msgstr "" +msgstr "3.8.17 の注目すべき変更" -#: ../../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 +4595,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..7140af6b6 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 @@ -40,12 +40,14 @@ msgstr "編集者" msgid "Łukasz Langa" msgstr "Łukasz Langa" -#: ../../whatsnew/3.9.rst:45 msgid "" "This article explains the new features in Python 3.9, compared to 3.8. " -"Python 3.9 was released on October 5, 2020. For full details, see the :ref:" -"`changelog `." +"Python 3.9 was released on October 5, 2020. For full details, see " +"the :ref:`changelog `." msgstr "" +"この記事では Python 3.8 と比較した Python 3.9 の新機能を解説します。\n" +"Python 3.9 は 2020 年 10 月 5 日にリリースされました。\n" +"詳しくは :ref:`変更履歴 ` を参照してください。" #: ../../whatsnew/3.9.rst:51 msgid ":pep:`596` - Python 3.9 Release Schedule" @@ -101,10 +103,9 @@ msgstr "" msgid "Interpreter improvements:" msgstr "インタプリタの改善:" -#: ../../whatsnew/3.9.rst:78 msgid "" ":pep:`573`, fast access to module state from methods of C extension types;" -msgstr "" +msgstr ":pep:`573`: C 拡張型のメソッドからモジュール状態へ高速にアクセス。" #: ../../whatsnew/3.9.rst:80 msgid ":pep:`617`, CPython now uses a new parser based on PEG;" @@ -117,29 +118,36 @@ msgid "" "a number of Python builtins (range, tuple, set, frozenset, list, dict) are " "now sped up using :pep:`590` vectorcall;" msgstr "" -"いくつかのPythonの組み込み型(range, tuple, set, frozenset, list, dict) を :" -"pep:`590` vectorcall を用いて高速化しました。" +"いくつかのPythonの組み込み型(range, tuple, set, frozenset, list, dict) " +"を :pep:`590` vectorcall を用いて高速化しました。" -#: ../../whatsnew/3.9.rst:83 msgid "garbage collection does not block on resurrected objects;" msgstr "" +"復活したオブジェクトがあっても、ガベージコレクションを妨げなくなりました。" -#: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" -"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" -"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" -"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " -"as defined by PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" +"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" +"_functools`, :mod:`!_json`, :mod:`!" +"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" +"_weakref`) now use multiphase initialization as defined by PEP 489;" msgstr "" +"いくつかの Python モジュール (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" +"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" +"_functools`, :mod:`!_json`, :mod:`!" +"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" +"_weakref`) が PEP 489 の複数フェーズ初期化を使うようになりました。" -#: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" -"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" -"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " -"using the stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!" +"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" +"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " +"are now using the stable ABI defined by PEP 384." msgstr "" +"いくつかの標準ライブラリモジュール (:mod:`!" +"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" +"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " +"が PEP 384 の安定 ABI を使うようになりました。" #: ../../whatsnew/3.9.rst:94 msgid "New library modules:" @@ -153,11 +161,12 @@ msgstr "" ":pep:`615`、IANAのTime Zone Databaseが標準ライブラリの :mod:`zoneinfo` モ" "ジュールで提供されるようになりました。" -#: ../../whatsnew/3.9.rst:98 msgid "" "an implementation of a topological sort of a graph is now provided in the " "new :mod:`graphlib` module." msgstr "" +"新しい :mod:`graphlib` モジュールに、グラフのトポロジカルソートの実装が追加さ" +"れました。" #: ../../whatsnew/3.9.rst:101 msgid "Release process changes:" @@ -183,10 +192,10 @@ msgid "" msgstr "" "Python 2.7がまだサポートされていた期間、Python 3の多くの機能はPython 2.7との" "後方互換性を保っていました。Python 2サポートの終了とともに、この後方互換性レ" -"イヤは除去されたか、間もなく除去されます。ここ数年で、それらの多くは警告 :" -"exc:`DeprecationWarning` を出すようになりました。例えば、2012年にリリースされ" -"たPython 3.3以降、``collections.abc.Mapping`` の代りに ``collections." -"Mapping`` を使うと、警告 :exc:`DeprecationWarning` が出ます。" +"イヤは除去されたか、間もなく除去されます。ここ数年で、それらの多くは警" +"告 :exc:`DeprecationWarning` を出すようになりました。例えば、2012年にリリース" +"されたPython 3.3以降、``collections.abc.Mapping`` の代りに " +"``collections.Mapping`` を使うと、警告 :exc:`DeprecationWarning` が出ます。" #: ../../whatsnew/3.9.rst:117 msgid "" @@ -212,13 +221,17 @@ msgstr "" "イヤは、Pythonプロジェクトの保守管理者に、Python 2サポートを止めてPython 3.9" "サポートを追加する時間的な余裕を与えるためのものです。" -#: ../../whatsnew/3.9.rst:126 msgid "" "Aliases to :ref:`Abstract Base Classes ` " -"in the :mod:`collections` module, like ``collections.Mapping`` alias to :" -"class:`collections.abc.Mapping`, are kept for one last release for backward " -"compatibility. They will be removed from Python 3.10." +"in the :mod:`collections` module, like ``collections.Mapping`` alias " +"to :class:`collections.abc.Mapping`, are kept for one last release for " +"backward compatibility. They will be removed from Python 3.10." msgstr "" +":class:`collections.abc.Mapping` の別名である ``collections.Mapping`` な" +"ど、:mod:`collections` モジュール内の :ref:`抽象基底クラス ` の別名は、後方互換性のため今回のリリースを最後に残さ" +"れます。\n" +"Python 3.10 で削除されます。" #: ../../whatsnew/3.9.rst:131 msgid "" @@ -226,8 +239,8 @@ msgid "" "` which helps to prepare your code to make it compatible with the " "next Python version." msgstr "" -"より一般的には、あなたのコードが次のバージョンのPythonと互換性を保てるよう、:" -"ref:`Python Development Mode ` でテストするようにしてください。" +"より一般的には、あなたのコードが次のバージョンのPythonと互換性を保てるよ" +"う、:ref:`Python Development Mode ` でテストするようにしてください。" #: ../../whatsnew/3.9.rst:135 msgid "" @@ -247,8 +260,8 @@ msgstr "辞書のマージと更新演算子" #: ../../whatsnew/3.9.rst:145 msgid "" -"Merge (``|``) and update (``|=``) operators have been added to the built-in :" -"class:`dict` class. Those complement the existing ``dict.update`` and " +"Merge (``|``) and update (``|=``) operators have been added to the built-" +"in :class:`dict` class. Those complement the existing ``dict.update`` and " "``{**d1, **d2}`` methods of merging dictionaries." msgstr "" "組み込みの :class:`dict` クラスにマージ(``|``)と更新(``|=``)演算子が追加され" @@ -259,7 +272,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../whatsnew/3.9.rst:151 msgid "" ">>> x = {\"key1\": \"value1 from x\", \"key2\": \"value2 from x\"}\n" ">>> y = {\"key2\": \"value2 from y\", \"key3\": \"value3 from y\"}\n" @@ -268,14 +280,20 @@ msgid "" ">>> y | x\n" "{'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'}" msgstr "" +">>> x = {\"key1\": \"value1 from x\", \"key2\": \"value2 from x\"}\n" +">>> y = {\"key2\": \"value2 from y\", \"key3\": \"value3 from y\"}\n" +">>> x | y\n" +"{'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'}\n" +">>> y | x\n" +"{'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'}" #: ../../whatsnew/3.9.rst:158 msgid "" -"See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" -"issue:`36144`.)" +"See :pep:`584` for a full description. (Contributed by Brandt Bucher " +"in :issue:`36144`.)" msgstr "" -"詳細は :pep:`584` を参照してください。(Brandt Bucher の貢献による :issue:" -"`36144`)" +"詳細は :pep:`584` を参照してください。(Brandt Bucher の貢献によ" +"る :issue:`36144`)" #: ../../whatsnew/3.9.rst:162 msgid "New String Methods to Remove Prefixes and Suffixes" @@ -283,19 +301,19 @@ msgstr "prefixとsuffixを削除する新しい文字列メソッド" #: ../../whatsnew/3.9.rst:164 msgid "" -":meth:`str.removeprefix(prefix)` and :meth:`str." -"removesuffix(suffix)` have been added to easily remove an " -"unneeded prefix or a suffix from a string. Corresponding ``bytes``, " -"``bytearray``, and ``collections.UserString`` methods have also been added. " -"See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :" -"issue:`39939`.)" +":meth:`str.removeprefix(prefix)` " +"and :meth:`str.removesuffix(suffix)` have been added to " +"easily remove an unneeded prefix or a suffix from a string. Corresponding " +"``bytes``, ``bytearray``, and ``collections.UserString`` methods have also " +"been added. See :pep:`616` for a full description. (Contributed by Dennis " +"Sweeney in :issue:`39939`.)" msgstr "" -"文字列から不要な prefix や suffix を簡単に削除する :meth:`str." -"removeprefix(prefix)` と :meth:`str." -"removesuffix(suffix)` が追加されました。 ``bytes``, " -"``bytearray``, ``collections.UserString`` にも同様のメソッドが追加されまし" -"た。詳細は :pep:`616` を参照してください。(Dennis Sweeney の貢献による :" -"issue:`39939`)" +"文字列から不要な prefix や suffix を簡単に削除す" +"る :meth:`str.removeprefix(prefix)` " +"と :meth:`str.removesuffix(suffix)` が追加されました。 " +"``bytes``, ``bytearray``, ``collections.UserString`` にも同様のメソッドが追加" +"されました。詳細は :pep:`616` を参照してください。(Dennis Sweeney の貢献によ" +"る :issue:`39939`)" #: ../../whatsnew/3.9.rst:172 msgid "Type Hinting Generics in Standard Collections" @@ -318,12 +336,14 @@ msgstr "" msgid "Example:" msgstr "例:" -#: ../../whatsnew/3.9.rst:182 msgid "" "def greet_all(names: list[str]) -> None:\n" " for name in names:\n" " print(\"Hello\", name)" msgstr "" +"def greet_all(names: list[str]) -> None:\n" +" for name in names:\n" +" print(\"Hello\", name)" #: ../../whatsnew/3.9.rst:188 msgid "" @@ -360,7 +380,6 @@ msgstr "" ":mod:`ast` モジュールは、新しいパーサーを使って古いパーサーと同じASTを生成し" "ます。" -#: ../../whatsnew/3.9.rst:205 msgid "" "In Python 3.10, the old parser will be deleted and so will all functionality " "that depends on it (primarily the :mod:`!parser` module, which has long been " @@ -368,6 +387,10 @@ msgid "" "using a command line switch (``-X oldparser``) or an environment variable " "(``PYTHONOLDPARSER=1``)." msgstr "" +"Python 3.10 では古いパーサーと、それに依存するすべての機能 (主に長く非推奨" +"だった :mod:`!parser` モジュール) が削除されます。\n" +"Python 3.9 で *のみ*、コマンドラインオプション ``-X oldparser`` または環境変" +"数 ``PYTHONOLDPARSER=1`` で LL(1) パーサーに戻せます。" #: ../../whatsnew/3.9.rst:211 msgid "" @@ -381,55 +404,77 @@ msgstr "" msgid "Other Language Changes" msgstr "その他の言語変更" -#: ../../whatsnew/3.9.rst:218 msgid "" -":func:`__import__` now raises :exc:`ImportError` instead of :exc:" -"`ValueError`, which used to occur when a relative import went past its top-" -"level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" +":func:`__import__` now raises :exc:`ImportError` instead " +"of :exc:`ValueError`, which used to occur when a relative import went past " +"its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" +"相対インポートがトップレベルのパッケージを越えた場合、:func:`__import__` は従" +"来の :exc:`ValueError` ではなく :exc:`ImportError` を送出するようになりまし" +"た。\n" +"(Contributed by Ngalim Siregar in :issue:`37444`.)" -#: ../../whatsnew/3.9.rst:223 msgid "" "Python now gets the absolute path of the script filename specified on the " -"command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :" -"mod:`__main__` module became an absolute path, rather than a relative path. " -"These paths now remain valid after the current directory is changed by :func:" -"`os.chdir`. As a side effect, the traceback also displays the absolute path " -"for :mod:`__main__` module frames in this case. (Contributed by Victor " -"Stinner in :issue:`20443`.)" -msgstr "" +"command line (ex: ``python3 script.py``): the ``__file__`` attribute of " +"the :mod:`__main__` module became an absolute path, rather than a relative " +"path. These paths now remain valid after the current directory is changed " +"by :func:`os.chdir`. As a side effect, the traceback also displays the " +"absolute path for :mod:`__main__` module frames in this case. (Contributed " +"by Victor Stinner in :issue:`20443`.)" +msgstr "" +"コマンドラインで指定したスクリプトファイル名 (例: ``python3 script.py``) の絶" +"対パスを取得するようになりました。\n" +":mod:`__main__` モジュールの ``__file__`` 属性は相対パスではなく絶対パスにな" +"ります。\n" +":func:`os.chdir` で現在のディレクトリを変更しても、このパスは有効なままで" +"す。\n" +"副作用として、この場合の :mod:`__main__` モジュールのフレームは、トレースバッ" +"クにも絶対パスで表示されます。\n" +"(Contributed by Victor Stinner in :issue:`20443`.)" -#: ../../whatsnew/3.9.rst:231 msgid "" "In the :ref:`Python Development Mode ` and in :ref:`debug build " "`, the *encoding* and *errors* arguments are now checked for " -"string encoding and decoding operations. Examples: :func:`open`, :meth:`str." -"encode` and :meth:`bytes.decode`." +"string encoding and decoding operations. " +"Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" +":ref:`Python 開発モード ` と :ref:`デバッグビルド ` で" +"は、文字列のエンコードとデコード時に *encoding* と *errors* 引数を検査するよ" +"うになりました。\n" +"例えば :func:`open`、:meth:`str.encode`、:meth:`bytes.decode` です。" -#: ../../whatsnew/3.9.rst:236 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. (Contributed by Victor Stinner in :issue:`37388`.)" msgstr "" +"デフォルトでは性能を優先し、*errors* 引数は最初のエンコードまたはデコードのエ" +"ラー時にだけ検査し、空文字列では *encoding* 引数を無視する場合があります。\n" +"(Contributed by Victor Stinner in :issue:`37388`.)" -#: ../../whatsnew/3.9.rst:241 msgid "" "``\"\".replace(\"\", s, n)`` now returns ``s`` instead of an empty string " "for all non-zero ``n``. It is now consistent with ``\"\".replace(\"\", " "s)``. There are similar changes for :class:`bytes` and :class:`bytearray` " "objects. (Contributed by Serhiy Storchaka in :issue:`28029`.)" msgstr "" +"``\"\".replace(\"\", s, n)`` は、ゼロでないすべての ``n`` について、空文字列" +"ではなく ``s`` を返すようになりました。\n" +"``\"\".replace(\"\", s)`` と動作が揃います。\n" +":class:`bytes` と :class:`bytearray` オブジェクトにも同様の変更があります。\n" +"(Contributed by Serhiy Storchaka in :issue:`28029`.)" -#: ../../whatsnew/3.9.rst:246 msgid "" "Any valid expression can now be used as a :term:`decorator`. Previously, " "the grammar was much more restrictive. See :pep:`614` for details. " "(Contributed by Brandt Bucher in :issue:`39702`.)" msgstr "" +"有効な式であれば任意の式を :term:`decorator` として使えるようになりました。\n" +"以前の文法にはかなり強い制限がありました。\n" +"詳しくは :pep:`614` を参照してください。\n" +"(Contributed by Brandt Bucher in :issue:`39702`.)" -#: ../../whatsnew/3.9.rst:250 msgid "" "Improved help for the :mod:`typing` module. Docstrings are now shown for all " "special forms and special generic aliases (like ``Union`` and ``List``). " @@ -437,43 +482,59 @@ msgid "" "for the correspondent concrete type (``list`` in this case). (Contributed by " "Serhiy Storchaka in :issue:`40257`.)" msgstr "" +":mod:`typing` モジュールのヘルプが改善されました。\n" +"``Union`` や ``List`` など、すべての特殊形式と特殊なジェネリックエイリアスの " +"docstring を表示するようになりました。\n" +"``List[int]`` などのジェネリックエイリアスに :func:`help` を使うと、対応する" +"具象型 (この場合は ``list``) のヘルプを表示します。\n" +"(Contributed by Serhiy Storchaka in :issue:`40257`.)" -#: ../../whatsnew/3.9.rst:256 msgid "" -"Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:" -"`~agen.athrow` is now prohibited, and ``ag_running`` now reflects the actual " -"running status of the async generator. (Contributed by Yury Selivanov in :" -"issue:`30773`.)" +"Parallel running " +"of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:`~agen.athrow` is now " +"prohibited, and ``ag_running`` now reflects the actual running status of the " +"async generator. (Contributed by Yury Selivanov in :issue:`30773`.)" msgstr "" +":meth:`~agen.aclose`、:meth:`~agen.asend`、:meth:`~agen.athrow` の並行実行は" +"禁止され、``ag_running`` は非同期ジェネレータの実際の実行状態を反映するように" +"なりました。\n" +"(Contributed by Yury Selivanov in :issue:`30773`.)" -#: ../../whatsnew/3.9.rst:261 msgid "" "Unexpected errors in calling the ``__iter__`` method are no longer masked by " -"``TypeError`` in the :keyword:`in` operator and functions :func:`~operator." -"contains`, :func:`~operator.indexOf` and :func:`~operator.countOf` of the :" -"mod:`operator` module. (Contributed by Serhiy Storchaka in :issue:`40824`.)" +"``TypeError`` in the :keyword:`in` operator and " +"functions :func:`~operator.contains`, :func:`~operator.indexOf` " +"and :func:`~operator.countOf` of the :mod:`operator` module. (Contributed by " +"Serhiy Storchaka in :issue:`40824`.)" msgstr "" +":keyword:`in` 演算子と :mod:`operator` " +"の :func:`~operator.contains`、:func:`~operator.indexOf`、:func:`~operator.countOf` " +"関数で、``__iter__`` 呼び出し時の予期しないエラーが ``TypeError`` に隠されな" +"くなりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`40824`.)" -#: ../../whatsnew/3.9.rst:267 msgid "" "Unparenthesized lambda expressions can no longer be the expression part in " -"an ``if`` clause in comprehensions and generator expressions. See :issue:" -"`41848` and :issue:`43755` for details." +"an ``if`` clause in comprehensions and generator expressions. " +"See :issue:`41848` and :issue:`43755` for details." msgstr "" +"内包表記とジェネレータ式の ``if`` 節の式には、括弧で囲まない lambda 式を使え" +"なくなりました。\n" +"詳しくは :issue:`41848` と :issue:`43755` を参照してください。" #: ../../whatsnew/3.9.rst:273 msgid "New Modules" msgstr "新たなモジュール" -#: ../../whatsnew/3.9.rst:276 msgid "zoneinfo" -msgstr "" +msgstr "zoneinfo" #: ../../whatsnew/3.9.rst:278 msgid "" "The :mod:`zoneinfo` module brings support for the IANA time zone database to " -"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete :class:" -"`datetime.tzinfo` implementation backed by the system's time zone data." +"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a " +"concrete :class:`datetime.tzinfo` implementation backed by the system's time " +"zone data." msgstr "" ":mod:`zoneinfo` モジュールにより標準ライブラリにIANAのタイムゾーンデータベー" "スへのサポートを導入されます。:class:`zoneinfo.ZoneInfo` という、システムのタ" @@ -501,17 +562,19 @@ msgid "" "PST" msgstr "" -#: ../../whatsnew/3.9.rst:302 msgid "" "As a fall-back source of data for platforms that don't ship the IANA " "database, the :pypi:`tzdata` module was released as a first-party package -- " "distributed via PyPI and maintained by the CPython core team." msgstr "" +"IANA データベースを同梱しないプラットフォームの代替データソースとし" +"て、:pypi:`tzdata` モジュールが公式パッケージとしてリリースされました。\n" +"PyPI で配布され、CPython コアチームが保守します。" -#: ../../whatsnew/3.9.rst:308 msgid "" ":pep:`615` -- Support for the IANA Time Zone Database in the Standard Library" msgstr "" +":pep:`615` -- 標準ライブラリでの IANA タイムゾーンデータベースのサポート" #: ../../whatsnew/3.9.rst:309 msgid "PEP written and implemented by Paul Ganssle" @@ -521,13 +584,16 @@ msgstr "PEP作成と実装は Paul Ganssle による。" msgid "graphlib" msgstr "graphlib" -#: ../../whatsnew/3.9.rst:315 msgid "" -"A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." -"TopologicalSorter` class to offer functionality to perform topological " -"sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and Larry " -"Hastings in :issue:`17005`.)" +"A new module, :mod:`graphlib`, was added that contains " +"the :class:`graphlib.TopologicalSorter` class to offer functionality to " +"perform topological sorting of graphs. (Contributed by Pablo Galindo, Tim " +"Peters and Larry Hastings in :issue:`17005`.)" msgstr "" +"グラフのトポロジカルソートを行う :class:`graphlib.TopologicalSorter` クラスを" +"含む、新しい :mod:`graphlib` モジュールが追加されました。\n" +"(Contributed by Pablo Galindo, Tim Peters and Larry Hastings " +"in :issue:`17005`.)" #: ../../whatsnew/3.9.rst:322 msgid "Improved Modules" @@ -537,132 +603,182 @@ msgstr "改良されたモジュール" msgid "ast" msgstr "ast" -#: ../../whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " -"multiline indented output. (Contributed by Serhiy Storchaka in :issue:" -"`37995`.)" +"multiline indented output. (Contributed by Serhiy Storchaka " +"in :issue:`37995`.)" msgstr "" +":func:`~ast.dump` に *indent* オプションが追加され、インデント付きの複数行出" +"力を生成できるようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`37995`.)" -#: ../../whatsnew/3.9.rst:331 msgid "" "Added :func:`ast.unparse` as a function in the :mod:`ast` module that can be " "used to unparse an :class:`ast.AST` object and produce a string with code " "that would produce an equivalent :class:`ast.AST` object when parsed. " "(Contributed by Pablo Galindo and Batuhan Taskaya in :issue:`38870`.)" msgstr "" +":mod:`ast` に :func:`ast.unparse` 関数が追加されました。\n" +":class:`ast.AST` オブジェクトからコードの文字列を生成し、その文字列を解析する" +"と同等の :class:`ast.AST` オブジェクトを得られます。\n" +"(Contributed by Pablo Galindo and Batuhan Taskaya in :issue:`38870`.)" -#: ../../whatsnew/3.9.rst:336 msgid "" "Added docstrings to AST nodes that contains the ASDL signature used to " "construct that node. (Contributed by Batuhan Taskaya in :issue:`39638`.)" msgstr "" +"AST ノードに、そのノードの作成に使う ASDL シグネチャを含む docstring が追加さ" +"れました。\n" +"(Contributed by Batuhan Taskaya in :issue:`39638`.)" #: ../../whatsnew/3.9.rst:340 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 " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" -"セキュリティ上の重大な懸念により、:meth:`asyncio.loop." -"create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" -"``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " -"Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" +"セキュリティ上の重大な懸念によ" +"り、:meth:`asyncio.loop.create_datagram_endpoint` での *reuse_address* 引数は" +"無効になりました。これはソケットオプション ``SO_REUSEADDR`` のUDP における挙" +"動が原因です。詳しくは、``loop.create_datagram_endpoint()`` のドキュメントを" +"参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov による貢" +"献 :issue:`37228`)" -#: ../../whatsnew/3.9.rst:349 msgid "" -"Added a new :term:`coroutine` :meth:`~asyncio.loop." -"shutdown_default_executor` that schedules a shutdown for the default " -"executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` " -"to finish closing. Also, :func:`asyncio.run` has been updated to use the " -"new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" +"Added a " +"new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that " +"schedules a shutdown for the default executor that waits on " +"the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. " +"Also, :func:`asyncio.run` has been updated to use the new :term:`coroutine`. " +"(Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" +"新しい :term:`コルーチン " +"` :meth:`~asyncio.loop.shutdown_default_executor` が追加されまし" +"た。\n" +"デフォルトのエグゼキューターのシャットダウンをスケジュール" +"し、:class:`~concurrent.futures.ThreadPoolExecutor` の終了処理が完了するまで" +"待ちます。\n" +":func:`asyncio.run` も、この新しい :term:`コルーチン ` を使うよう" +"更新されました。\n" +"(Contributed by Kyle Stanley in :issue:`34037`.)" -#: ../../whatsnew/3.9.rst:355 msgid "" "Added :class:`!asyncio.PidfdChildWatcher`, a Linux-specific child watcher " "implementation that polls process file descriptors. (:issue:`38692`)" msgstr "" +"Linux 固有の子プロセス監視実装として、プロセスのファイル記述子をポーリングす" +"る :class:`!asyncio.PidfdChildWatcher` が追加されました (:issue:`38692`)。" -#: ../../whatsnew/3.9.rst:358 msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " -"event loop, and essentially works as a high-level version of :meth:`~asyncio." -"loop.run_in_executor` that can directly take keyword arguments. (Contributed " -"by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" +"event loop, and essentially works as a high-level version " +"of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword " +"arguments. (Contributed by Kyle Stanley and Yury Selivanov " +"in :issue:`32309`.)" msgstr "" +"新しい :term:`コルーチン ` :func:`asyncio.to_thread` が追加されま" +"した。\n" +"主に I/O 待ちが中心の関数を別スレッドで実行し、イベントループのブロックを避け" +"るために使います。\n" +"実質的には :meth:`~asyncio.loop.run_in_executor` の高水準版で、キーワード引数" +"を直接受け付けられます。\n" +"(Contributed by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" -#: ../../whatsnew/3.9.rst:364 msgid "" "When cancelling the task due to a timeout, :meth:`asyncio.wait_for` will now " "wait until the cancellation is complete also in the case when *timeout* is " "<= 0, like it does with positive timeouts. (Contributed by Elvis " "Pranskevichus in :issue:`32751`.)" msgstr "" +":meth:`asyncio.wait_for` は、タイムアウトによってタスクをキャンセルする際、" +"*timeout* が 0 以下の場合でも、正の場合と同様にキャンセルの完了まで待つように" +"なりました。\n" +"(Contributed by Elvis Pranskevichus in :issue:`32751`.)" -#: ../../whatsnew/3.9.rst:369 msgid "" ":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " -"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" -"`37404`.)" +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " +"in :issue:`37404`.)" msgstr "" +":mod:`asyncio` は、:class:`ssl.SSLSocket` ソケットで互換性のないメソッドを呼" +"ぶと :exc:`TypeError` を送出するようになりました。\n" +"(Contributed by Ido Michael in :issue:`37404`.)" #: ../../whatsnew/3.9.rst:374 msgid "compileall" msgstr "compileall" -#: ../../whatsnew/3.9.rst:376 msgid "" "Added new possibility to use hardlinks for duplicated ``.pyc`` files: " "*hardlink_dupes* parameter and --hardlink-dupes command line option. " "(Contributed by Lumír 'Frenzy' Balhar in :issue:`40495`.)" msgstr "" +"重複する ``.pyc`` ファイルにハードリンクを使う機能が追加されました。\n" +"*hardlink_dupes* パラメータと --hardlink-dupes コマンドラインオプションで指定" +"します。\n" +"(Contributed by Lumír 'Frenzy' Balhar in :issue:`40495`.)" -#: ../../whatsnew/3.9.rst:379 msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " "line options. Added the possibility to specify the option for an " -"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar in :" -"issue:`38112`.)" +"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar " +"in :issue:`38112`.)" msgstr "" +"生成される ``.pyc`` 内のパスを操作するオプションとして、*stripdir*、" +"*prependdir*、*limit_sl_dest* パラメータと -s、-p、-e コマンドラインオプショ" +"ンが追加されました。\n" +"最適化レベルのオプションも複数回指定できるようになりました。\n" +"(Contributed by Lumír 'Frenzy' Balhar in :issue:`38112`.)" #: ../../whatsnew/3.9.rst:384 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.9.rst:386 msgid "" -"Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." -"shutdown` that cancels all pending futures which have not started running, " -"instead of waiting for them to complete before shutting down the executor. " -"(Contributed by Kyle Stanley in :issue:`39349`.)" +"Added a new *cancel_futures* parameter " +"to :meth:`concurrent.futures.Executor.shutdown` that cancels all pending " +"futures which have not started running, instead of waiting for them to " +"complete before shutting down the executor. (Contributed by Kyle Stanley " +"in :issue:`39349`.)" msgstr "" +":meth:`concurrent.futures.Executor.shutdown` に *cancel_futures* パラメータが" +"追加されました。\n" +"まだ実行を開始していない保留中の Future をすべてキャンセルし、完了を待たずに" +"エグゼキューターをシャットダウンします。\n" +"(Contributed by Kyle Stanley in :issue:`39349`.)" -#: ../../whatsnew/3.9.rst:392 msgid "" "Removed daemon threads from :class:`~concurrent.futures.ThreadPoolExecutor` " "and :class:`~concurrent.futures.ProcessPoolExecutor`. This improves " "compatibility with subinterpreters and predictability in their shutdown " "processes. (Contributed by Kyle Stanley in :issue:`39812`.)" msgstr "" +":class:`~concurrent.futures.ThreadPoolExecutor` " +"と :class:`~concurrent.futures.ProcessPoolExecutor` がデーモンスレッドを使わ" +"なくなりました。\n" +"これによりサブインタープリタとの互換性と、終了処理の予測しやすさが改善されま" +"す。\n" +"(Contributed by Kyle Stanley in :issue:`39812`.)" -#: ../../whatsnew/3.9.rst:397 msgid "" "Workers in :class:`~concurrent.futures.ProcessPoolExecutor` are now spawned " "on demand, only when there are no available idle workers to reuse. This " "optimizes startup overhead and reduces the amount of lost CPU time to idle " "workers. (Contributed by Kyle Stanley in :issue:`39207`.)" msgstr "" +":class:`~concurrent.futures.ProcessPoolExecutor` のワーカーは、再利用できる待" +"機中のワーカーがない場合にのみ、必要に応じて生成されるようになりました。\n" +"これにより起動時のオーバーヘッドと、待機中のワーカーが浪費する CPU 時間を削減" +"します。\n" +"(Contributed by Kyle Stanley in :issue:`39207`.)" #: ../../whatsnew/3.9.rst:403 msgid "curses" @@ -670,36 +786,43 @@ msgstr "curses" #: ../../whatsnew/3.9.rst:405 msgid "" -"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" -"`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " -"by Anthony Sottile in :issue:`38312`.)" +"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, " +"and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile " +"in :issue:`38312`.)" msgstr "" -":func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses." -"get_tabsize`, :func:`curses.set_tabsize` の関数が追加されました。(Anthony " -"Sottileによる :issue:`38312` でのコントリビュート。)" +":func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, :func:`curses.set_tabsize` " +"の関数が追加されました。(Anthony Sottileによる :issue:`38312` でのコントリ" +"ビュート。)" #: ../../whatsnew/3.9.rst:410 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" -"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " -"returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " -"(Contributed by Donghee Na in :issue:`24416`.)" +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` " +"and :meth:`~datetime.datetime.isocalendar` of :class:`datetime.datetime` " +"methods now returns a :func:`~collections.namedtuple` instead of " +"a :class:`tuple`. (Contributed by Donghee Na in :issue:`24416`.)" msgstr "" +":class:`datetime.date` の :meth:`~datetime.date.isocalendar` " +"と :class:`datetime.datetime` の :meth:`~datetime.datetime.isocalendar` " +"は、:class:`tuple` の代わりに :func:`~collections.namedtuple` を返すようにな" +"りました。\n" +"(Contributed by Donghee Na in :issue:`24416`.)" #: ../../whatsnew/3.9.rst:417 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.9.rst:419 msgid "" "The :command:`upload` command now creates SHA2-256 and Blake2b-256 hash " "digests. It skips MD5 on platforms that block MD5 digest. (Contributed by " "Christian Heimes in :issue:`40698`.)" msgstr "" +":command:`upload` コマンドが SHA2-256 と Blake2b-256 のハッシュダイジェストを" +"作成するようになりました。\n" +"MD5 ダイジェストが禁止されているプラットフォームでは MD5 を省略します。\n" +"(Contributed by Christian Heimes in :issue:`40698`.)" #: ../../whatsnew/3.9.rst:424 msgid "fcntl" @@ -708,140 +831,175 @@ msgstr "fcntl" #: ../../whatsnew/3.9.rst:426 msgid "" "Added constants :const:`~fcntl.F_OFD_GETLK`, :const:`~fcntl.F_OFD_SETLK` " -"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" -"`38602`.)" +"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na " +"in :issue:`38602`.)" msgstr "" #: ../../whatsnew/3.9.rst:431 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.9.rst:433 msgid "" -":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" +":class:`~ftplib.FTP` と :class:`~ftplib.FTP_TLS` は、非ブロッキングソケットの" +"作成を防ぐため、コンストラクタのタイムアウトにゼロを指定する" +"と :class:`ValueError` を送出するようになりました。\n" +"(Contributed by Donghee Na in :issue:`39259`.)" #: ../../whatsnew/3.9.rst:438 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.9.rst:440 msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " "finalizers have been executed), do not block the collection of all objects " -"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters in :" -"issue:`38379`.)" +"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters " +"in :issue:`38379`.)" msgstr "" +"ガベージコレクション中に一部のオブジェクトが復活した場合 (ファイナライザーの" +"実行後に、孤立した循環の外から到達可能になった場合) でも、到達不能なままのオ" +"ブジェクトの回収を妨げなくなりました。\n" +"(Contributed by Pablo Galindo and Tim Peters in :issue:`38379`.)" -#: ../../whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " -"finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" -"`39322`.)" +"finalized by the garbage collector. (Contributed by Pablo Galindo " +"in :issue:`39322`.)" msgstr "" +"オブジェクトがガベージコレクタによって終了処理済みか確認す" +"る :func:`gc.is_finalized` 関数が追加されました。\n" +"(Contributed by Pablo Galindo in :issue:`39322`.)" #: ../../whatsnew/3.9.rst:450 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.9.rst:452 msgid "" "The :mod:`hashlib` module can now use SHA3 hashes and SHAKE XOF from OpenSSL " "when available. (Contributed by Christian Heimes in :issue:`37630`.)" msgstr "" +":mod:`hashlib` モジュールは、利用可能な場合に OpenSSL の SHA3 ハッシュと " +"SHAKE XOF を使えるようになりました。\n" +"(Contributed by Christian Heimes in :issue:`37630`.)" -#: ../../whatsnew/3.9.rst:456 msgid "" "Builtin hash modules can now be disabled with ``./configure --without-" "builtin-hashlib-hashes`` or selectively enabled with e.g. ``./configure --" "with-builtin-hashlib-hashes=sha3,blake2`` to force use of OpenSSL based " "implementation. (Contributed by Christian Heimes in :issue:`40479`)" msgstr "" +"OpenSSL ベースの実装を強制的に使うため、``./configure --without-builtin-" +"hashlib-hashes`` で組み込みのハッシュモジュールを無効にできるようになりまし" +"た。\n" +"``./configure --with-builtin-hashlib-hashes=sha3,blake2`` などで選択的に有効" +"にすることもできます。\n" +"(Contributed by Christian Heimes in :issue:`40479`)" #: ../../whatsnew/3.9.rst:464 msgid "http" msgstr "http" -#: ../../whatsnew/3.9.rst:466 msgid "" "HTTP status codes ``103 EARLY_HINTS``, ``418 IM_A_TEAPOT`` and ``425 " "TOO_EARLY`` are added to :class:`http.HTTPStatus`. (Contributed by Donghee " "Na in :issue:`39509` and Ross Rhodes in :issue:`39507`.)" msgstr "" +":class:`http.HTTPStatus` に HTTP ステータスコード ``103 EARLY_HINTS``、``418 " +"IM_A_TEAPOT``、``425 TOO_EARLY`` が追加されました。\n" +"(Contributed by Donghee Na in :issue:`39509` and Ross Rhodes " +"in :issue:`39507`.)" #: ../../whatsnew/3.9.rst:470 msgid "IDLE and idlelib" msgstr "IDLE と idelelib" -#: ../../whatsnew/3.9.rst:472 msgid "" -"Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Added option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" +"カーソルの点滅を無効にするオプションが追加されました。\n" +"(Contributed by Zackery Spytz in :issue:`4603`.)" -#: ../../whatsnew/3.9.rst:475 msgid "" "Escape key now closes IDLE completion windows. (Contributed by Johnny " "Najera in :issue:`38944`.)" msgstr "" +"Escape キーで IDLE の補完ウィンドウを閉じられるようになりました。\n" +"(Contributed by Johnny Najera in :issue:`38944`.)" -#: ../../whatsnew/3.9.rst:478 msgid "" "Added keywords to module name completion list. (Contributed by Terry J. " "Reedy in :issue:`37765`.)" msgstr "" +"モジュール名の補完候補のリストにキーワードが追加されました。\n" +"(Contributed by Terry J. Reedy in :issue:`37765`.)" -#: ../../whatsnew/3.9.rst:481 msgid "New in 3.9 maintenance releases" -msgstr "" +msgstr "3.9 のメンテナンスリリースの新機能" -#: ../../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`.)" +"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 "" +msgstr "上記の変更は、3.8 のメンテナンスリリースにもバックポートされています。" -#: ../../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 " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" -msgstr "" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new 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" msgstr "imaplib" -#: ../../whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " -"*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." -"open` method now has an optional *timeout* parameter with this change. The " -"overridden methods of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib." -"IMAP4_stream` were applied to this change. (Contributed by Donghee Na in :" -"issue:`38615`.)" +"*timeout* parameter for their constructors. Also, " +"the :meth:`~imaplib.IMAP4.open` method now has an optional *timeout* " +"parameter with this change. The overridden methods " +"of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib.IMAP4_stream` were " +"applied to this change. (Contributed by Donghee Na in :issue:`38615`.)" msgstr "" +":class:`~imaplib.IMAP4` と :class:`~imaplib.IMAP4_SSL` のコンストラクタに、省" +"略可能な *timeout* パラメータが追加されました。\n" +"この変更に伴い :meth:`~imaplib.IMAP4.open` にも省略可能な *timeout* が追加さ" +"れ、:class:`~imaplib.IMAP4_SSL` と :class:`~imaplib.IMAP4_stream` のオーバー" +"ライドされたメソッドにも変更が適用されました。\n" +"(Contributed by Donghee Na in :issue:`38615`.)" -#: ../../whatsnew/3.9.rst:510 msgid "" ":meth:`imaplib.IMAP4.unselect` is added. :meth:`imaplib.IMAP4.unselect` " "frees server's resources associated with the selected mailbox and returns " @@ -850,37 +1008,52 @@ msgid "" "permanently removed from the currently selected mailbox. (Contributed by " "Donghee Na in :issue:`40375`.)" msgstr "" +":meth:`imaplib.IMAP4.unselect` が追加されました。\n" +":meth:`imaplib.IMAP4.unselect` は、選択中のメールボックスに関連するサーバーの" +"リソースを解放し、サーバーを認証済み状態に戻します。\n" +":meth:`imaplib.IMAP4.close` と同じ操作を行いますが、現在選択中のメールボック" +"スからメッセージを恒久的に削除することはありません。\n" +"(Contributed by Donghee Na in :issue:`40375`.)" #: ../../whatsnew/3.9.rst:518 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.9.rst:520 msgid "" -"To improve consistency with import statements, :func:`importlib.util." -"resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " -"invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:" -"`37444`.)" +"To improve consistency with import " +"statements, :func:`importlib.util.resolve_name` now " +"raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative " +"import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" +"import 文と動作を揃えるため、:func:`importlib.util.resolve_name` は、不正な相" +"対インポートに対して :exc:`ValueError` ではなく :exc:`ImportError` を送出する" +"ようになりました。\n" +"(Contributed by Ngalim Siregar in :issue:`37444`.)" -#: ../../whatsnew/3.9.rst:525 msgid "" "Import loaders which publish immutable module objects can now publish " "immutable packages in addition to individual modules. (Contributed by Dino " "Viehland in :issue:`39336`.)" msgstr "" +"イミュータブルなモジュールオブジェクトを公開するインポートローダーは、個々の" +"モジュールに加えて、イミュータブルなパッケージも公開できるようになりまし" +"た。\n" +"(Contributed by Dino Viehland in :issue:`39336`.)" -#: ../../whatsnew/3.9.rst:529 msgid "" "Added :func:`importlib.resources.files` function with support for " "subdirectories in package data, matching backport in ``importlib_resources`` " "version 1.5. (Contributed by Jason R. Coombs in :issue:`39791`.)" msgstr "" +"パッケージデータ内のサブディレクトリをサポートす" +"る :func:`importlib.resources.files` 関数が追加され、``importlib_resources`` " +"1.5 のバックポートと揃いました。\n" +"(Contributed by Jason R. Coombs in :issue:`39791`.)" -#: ../../whatsnew/3.9.rst:534 msgid "" "Refreshed ``importlib.metadata`` from ``importlib_metadata`` version 1.6.1." msgstr "" +"``importlib.metadata`` が ``importlib_metadata`` 1.6.1 を基に更新されました。" #: ../../whatsnew/3.9.rst:537 msgid "inspect" @@ -889,8 +1062,8 @@ msgstr "inspect" #: ../../whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " -"regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" -"`39775`.)" +"regular dict. (Contributed by Inada Naoki in :issue:`36350` " +"and :issue:`39775`.)" msgstr "" ":attr:`inspect.BoundArguments.arguments` は ``OrderedDict`` から標準のdictに" "変更されました。(Inada Naoki の貢献による :issue:`36350`, :issue:`39775`)" @@ -899,102 +1072,125 @@ msgstr "" msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.9.rst:545 msgid "" ":mod:`ipaddress` now supports IPv6 Scoped Addresses (IPv6 address with " "suffix ``%``)." msgstr "" +":mod:`ipaddress` が IPv6 のスコープ付きアドレス (接尾辞 ``%`` を持" +"つ IPv6 アドレス) に対応しました。" -#: ../../whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " -"present, scope zone ID is available through the :attr:`~ipaddress." -"IPv6Address.scope_id` attribute. (Contributed by Oleksandr Pavliuk in :issue:" -"`34788`.)" +"present, scope zone ID is available through " +"the :attr:`~ipaddress.IPv6Address.scope_id` attribute. (Contributed by " +"Oleksandr Pavliuk in :issue:`34788`.)" msgstr "" +"スコープ付き IPv6 アドレスを :class:`ipaddress.IPv6Address` で解析できま" +"す。\n" +"スコープのゾーン ID がある場合は :attr:`~ipaddress.IPv6Address.scope_id` 属性" +"から取得できます。\n" +"(Contributed by Oleksandr Pavliuk in :issue:`34788`.)" -#: ../../whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " -"leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" -"issue:`36384`)." +"leading zeros in IPv4 address strings. (Contributed by Christian Heimes " +"in :issue:`36384`)." msgstr "" +"Python 3.9.5 から :mod:`ipaddress` は、IPv4 アドレス文字列の先頭のゼロを一切" +"受け付けなくなりました。\n" +"(Contributed by Christian Heimes in :issue:`36384`)" #: ../../whatsnew/3.9.rst:556 msgid "math" msgstr "math" -#: ../../whatsnew/3.9.rst:558 msgid "" "Expanded the :func:`math.gcd` function to handle multiple arguments. " "Formerly, it only supported two arguments. (Contributed by Serhiy Storchaka " "in :issue:`39648`.)" msgstr "" +":func:`math.gcd` 関数が複数の引数を処理するよう拡張されました。\n" +"以前は 2 引数だけをサポートしていました。\n" +"(Contributed by Serhiy Storchaka in :issue:`39648`.)" -#: ../../whatsnew/3.9.rst:562 msgid "" "Added :func:`math.lcm`: return the least common multiple of specified " "arguments. (Contributed by Mark Dickinson, Ananthakrishnan and Serhiy " "Storchaka in :issue:`39479` and :issue:`39648`.)" msgstr "" +"指定した引数の最小公倍数を返す :func:`math.lcm` が追加されました。\n" +"(Contributed by Mark Dickinson, Ananthakrishnan and Serhiy Storchaka " +"in :issue:`39479` and :issue:`39648`.)" -#: ../../whatsnew/3.9.rst:566 msgid "" "Added :func:`math.nextafter`: return the next floating-point value after *x* " "towards *y*. (Contributed by Victor Stinner in :issue:`39288`.)" msgstr "" +"*x* から *y* の方向へ進んだ次の浮動小数点値を返す :func:`math.nextafter` が追" +"加されました。\n" +"(Contributed by Victor Stinner in :issue:`39288`.)" -#: ../../whatsnew/3.9.rst:570 msgid "" "Added :func:`math.ulp`: return the value of the least significant bit of a " "float. (Contributed by Victor Stinner in :issue:`39310`.)" msgstr "" +"浮動小数点数の最下位ビットの値を返す :func:`math.ulp` が追加されました。\n" +"(Contributed by Victor Stinner in :issue:`39310`.)" #: ../../whatsnew/3.9.rst:575 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.9.rst:577 msgid "" -"The :class:`multiprocessing.SimpleQueue` class has a new :meth:" -"`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " -"(Contributed by Victor Stinner in :issue:`30966`.)" +"The :class:`multiprocessing.SimpleQueue` class has a " +"new :meth:`~multiprocessing.SimpleQueue.close` method to explicitly close " +"the queue. (Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" +":class:`multiprocessing.SimpleQueue` クラスに、キューを明示的に閉じ" +"る :meth:`~multiprocessing.SimpleQueue.close` メソッドが追加されました。\n" +"(Contributed by Victor Stinner in :issue:`30966`.)" #: ../../whatsnew/3.9.rst:583 msgid "nntplib" msgstr "nntplib" -#: ../../whatsnew/3.9.rst:585 msgid "" ":class:`!NNTP` and :class:`!NNTP_SSL` now raise a :class:`ValueError` if the " "given timeout for their constructor is zero to prevent the creation of a non-" "blocking socket. (Contributed by Donghee Na in :issue:`39259`.)" msgstr "" +":class:`!NNTP` と :class:`!NNTP_SSL` は、非ブロッキングソケットの作成を防ぐた" +"め、コンストラクタのタイムアウトにゼロを指定すると :class:`ValueError` を送出" +"するようになりました。\n" +"(Contributed by Donghee Na in :issue:`39259`.)" #: ../../whatsnew/3.9.rst:590 msgid "os" msgstr "os" -#: ../../whatsnew/3.9.rst:592 msgid "" "Added :const:`~os.CLD_KILLED` and :const:`~os.CLD_STOPPED` for :attr:`!" "si_code`. (Contributed by Donghee Na in :issue:`38493`.)" msgstr "" +":attr:`!si_code` 用に :const:`~os.CLD_KILLED` と :const:`~os.CLD_STOPPED` が" +"追加されました。\n" +"(Contributed by Donghee Na in :issue:`38493`.)" -#: ../../whatsnew/3.9.rst:595 msgid "" -"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" -"`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." +"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) " +"and :const:`os.P_PIDFD` (:issue:`38713`) for process management with file " +"descriptors." msgstr "" +"ファイル記述子によるプロセス管理のため、Linux 固有の :func:`os.pidfd_open` " +"(:issue:`38692`) と :const:`os.P_PIDFD` (:issue:`38713`) が公開されました。" #: ../../whatsnew/3.9.rst:599 msgid "" "The :func:`os.unsetenv` function is now also available on Windows. " "(Contributed by Victor Stinner in :issue:`39413`.)" msgstr "" -":func:`os.unsetenv` 関数が、Windowsでも使えるようになりました。(:issue:" -"`39413` におけるVictor Stinnerの貢献による)" +":func:`os.unsetenv` 関数が、Windowsでも使えるようになりました。" +"(:issue:`39413` におけるVictor Stinnerの貢献による)" #: ../../whatsnew/3.9.rst:602 msgid "" @@ -1004,64 +1200,77 @@ msgstr "" ":func:`os.putenv` と :func:`os.unsetenv` 関数が、常に利用できるようになりまし" "た。(:issue:`39395` におけるVictor Stinnerの貢献による)" -#: ../../whatsnew/3.9.rst:606 msgid "" "Added :func:`os.waitstatus_to_exitcode` function: convert a wait status to " "an exit code. (Contributed by Victor Stinner in :issue:`40094`.)" msgstr "" +"待機ステータスを終了コードに変換する :func:`os.waitstatus_to_exitcode` 関数が" +"追加されました。\n" +"(Contributed by Victor Stinner in :issue:`40094`.)" #: ../../whatsnew/3.9.rst:611 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." -"readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" +"Added :meth:`pathlib.Path.readlink` which acts similarly " +"to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" +":func:`os.readlink` と同様に動作する :meth:`pathlib.Path.readlink` が追加され" +"ました。\n" +"(Contributed by Girts Folkmanis in :issue:`30618`)" #: ../../whatsnew/3.9.rst:618 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.9.rst:620 msgid "" "On Windows now :class:`~pdb.Pdb` supports ``~/.pdbrc``. (Contributed by Tim " "Hopper and Dan Lidral-Porter in :issue:`20523`.)" msgstr "" +"Windows でも :class:`~pdb.Pdb` が ``~/.pdbrc`` をサポートしました。\n" +"(Contributed by Tim Hopper and Dan Lidral-Porter in :issue:`20523`.)" #: ../../whatsnew/3.9.rst:624 msgid "poplib" msgstr "poplib" -#: ../../whatsnew/3.9.rst:626 msgid "" -":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" +":class:`~poplib.POP3` と :class:`~poplib.POP3_SSL` は、非ブロッキングソケット" +"の作成を防ぐため、コンストラクタのタイムアウトにゼロを指定する" +"と :class:`ValueError` を送出するようになりました。\n" +"(Contributed by Donghee Na in :issue:`39259`.)" #: ../../whatsnew/3.9.rst:631 msgid "pprint" msgstr "pprint" -#: ../../whatsnew/3.9.rst:633 msgid "" ":mod:`pprint` can now pretty-print :class:`types.SimpleNamespace`. " "(Contributed by Carl Bordum Hansen in :issue:`37376`.)" msgstr "" +":mod:`pprint` で :class:`types.SimpleNamespace` を整形して表示できるようにな" +"りました。\n" +"(Contributed by Carl Bordum Hansen in :issue:`37376`.)" #: ../../whatsnew/3.9.rst:637 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.9.rst:639 msgid "" "The documentation string is now shown not only for class, function, method " "etc, but for any object that has its own :attr:`~definition.__doc__` " "attribute. (Contributed by Serhiy Storchaka in :issue:`40257`.)" msgstr "" +"クラス、関数、メソッドなどだけでなく、独自の :attr:`~definition.__doc__` 属性" +"を持つすべてのオブジェクトのドキュメンテーション文字列を表示するようになりま" +"した。\n" +"(Contributed by Serhiy Storchaka in :issue:`40257`.)" #: ../../whatsnew/3.9.rst:645 msgid "random" @@ -1079,72 +1288,87 @@ msgstr "" msgid "signal" msgstr "signal" -#: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " -"signals to a process using a file descriptor instead of a pid. (:issue:" -"`38712`)" +"signals to a process using a file descriptor instead of a pid. " +"(:issue:`38712`)" msgstr "" +"pid ではなくファイル記述子を使ってプロセスにシグナルを送る、Linux 固有" +"の :func:`signal.pidfd_send_signal` が公開されました (:issue:`38712`)。" #: ../../whatsnew/3.9.rst:657 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.9.rst:659 msgid "" -":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" +":class:`~smtplib.SMTP` と :class:`~smtplib.SMTP_SSL` は、非ブロッキングソケッ" +"トの作成を防ぐため、コンストラクタのタイムアウトにゼロを指定する" +"と :class:`ValueError` を送出するようになりました。\n" +"(Contributed by Donghee Na in :issue:`39259`.)" -#: ../../whatsnew/3.9.rst:663 msgid "" ":class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter. " "(Contributed by Donghee Na in :issue:`39329`.)" msgstr "" +":class:`~smtplib.LMTP` のコンストラクタに省略可能な *timeout* パラメータが追" +"加されました。\n" +"(Contributed by Donghee Na in :issue:`39329`.)" #: ../../whatsnew/3.9.rst:667 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.9.rst:669 msgid "" -"The :mod:`socket` module now exports the :const:`~socket." -"CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " -"Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" +"The :mod:`socket` module now exports " +"the :const:`~socket.CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. " +"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" +":mod:`socket` モジュールが Linux 4.1 以降" +"で :const:`~socket.CAN_RAW_JOIN_FILTERS` 定数を公開するようになりました。\n" +"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" -#: ../../whatsnew/3.9.rst:673 msgid "" "The socket module now supports the :const:`~socket.CAN_J1939` protocol on " "platforms that support it. (Contributed by Karl Ding in :issue:`40291`.)" msgstr "" +"socket モジュールは、対応するプラットフォームで :const:`~socket.CAN_J1939` プ" +"ロトコルをサポートするようになりました。\n" +"(Contributed by Karl Ding in :issue:`40291`.)" -#: ../../whatsnew/3.9.rst:676 msgid "" -"The socket module now has the :func:`socket.send_fds` and :func:`socket." -"recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " -"Victor Stinner in :issue:`28724`.)" +"The socket module now has the :func:`socket.send_fds` " +"and :func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, " +"Shinya Okano and Victor Stinner in :issue:`28724`.)" msgstr "" +"socket モジュールに :func:`socket.send_fds` と :func:`socket.recv_fds` 関数が" +"追加されました。\n" +"(Contributed by Joannah Nanjekye, Shinya Okano and Victor Stinner " +"in :issue:`28724`.)" #: ../../whatsnew/3.9.rst:682 msgid "time" msgstr "time" -#: ../../whatsnew/3.9.rst:684 msgid "" "On AIX, :func:`~time.thread_time` is now implemented with " "``thread_cputime()`` which has nanosecond resolution, rather than " "``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` which has a resolution of 10 " "milliseconds. (Contributed by Batuhan Taskaya in :issue:`40192`)" msgstr "" +"AIX の :func:`~time.thread_time` は、分解能が 10 ミリ秒の " +"``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` ではなく、ナノ秒の分解能を持つ " +"``thread_cputime()`` で実装されるようになりました。\n" +"(Contributed by Batuhan Taskaya in :issue:`40192`)" #: ../../whatsnew/3.9.rst:690 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.9.rst:692 msgid "" "Added a new :data:`sys.platlibdir` attribute: name of the platform-specific " "library directory. It is used to build the path of standard library and the " @@ -1153,36 +1377,54 @@ msgid "" "platforms. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " "and Victor Stinner in :issue:`1294959`.)" msgstr "" +"プラットフォーム固有のライブラリディレクトリ名を示す :data:`sys.platlibdir` " +"属性が追加されました。\n" +"標準ライブラリやインストール済みの拡張モジュールのパスを構築するために使いま" +"す。\n" +"ほとんどのプラットフォームでは ``\"lib\"`` です。\n" +"Fedora と SuSE の 64 ビットプラットフォームでは ``\"lib64\"`` です。\n" +"(Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor " +"Stinner in :issue:`1294959`.)" -#: ../../whatsnew/3.9.rst:698 msgid "" "Previously, :data:`sys.stderr` was block-buffered when non-interactive. Now " "``stderr`` defaults to always being line-buffered. (Contributed by Jendrik " "Seipp in :issue:`13601`.)" msgstr "" +"以前の :data:`sys.stderr` は、非対話時にはブロック単位でバッファリングされて" +"いました。\n" +"今後は ``stderr`` のデフォルトは常に行単位のバッファリングになります。\n" +"(Contributed by Jendrik Seipp in :issue:`13601`.)" #: ../../whatsnew/3.9.rst:703 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.9.rst:705 msgid "" "Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory " "blocks to the current size, to measure the peak of specific pieces of code. " "(Contributed by Huon Wilson in :issue:`40630`.)" msgstr "" +"追跡対象のメモリブロックのピークサイズを現在のサイズにリセットす" +"る :func:`tracemalloc.reset_peak` が追加され、特定のコード部分のピークを計測" +"できます。\n" +"(Contributed by Huon Wilson in :issue:`40630`.)" #: ../../whatsnew/3.9.rst:710 ../../whatsnew/3.9.rst:1494 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.9.rst:712 msgid "" ":pep:`593` introduced an :data:`typing.Annotated` type to decorate existing " "types with context-specific metadata and new ``include_extras`` parameter " "to :func:`typing.get_type_hints` to access the metadata at runtime. " "(Contributed by Till Varoquaux and Konstantin Kashin.)" msgstr "" +":pep:`593` により、既存の型に文脈固有のメタデータを付け" +"る :data:`typing.Annotated` 型と、実行時にそのメタデータにアクセスするため" +"の :func:`typing.get_type_hints` の ``include_extras`` パラメータが導入されま" +"した。\n" +"(Contributed by Till Varoquaux and Konstantin Kashin.)" #: ../../whatsnew/3.9.rst:718 msgid "unicodedata" @@ -1198,7 +1440,6 @@ msgstr "" msgid "venv" msgstr "venv" -#: ../../whatsnew/3.9.rst:725 msgid "" "The activation scripts provided by :mod:`venv` now all specify their prompt " "customization consistently by always using the value specified by " @@ -1207,45 +1448,56 @@ msgid "" "default case), and one used ``__VENV_NAME__`` instead. (Contributed by Brett " "Cannon in :issue:`37663`.)" msgstr "" +":mod:`venv` の有効化スクリプトは、プロンプトの変更に常に ``__VENV_PROMPT__`` " +"の値を使うよう統一されました。\n" +"以前は無条件に使うスクリプトと、設定されている場合だけ使うスクリプト (デフォ" +"ルトでは設定されていました) があり、一つは代わりに ``__VENV_NAME__`` を使って" +"いました。\n" +"(Contributed by Brett Cannon in :issue:`37663`.)" #: ../../whatsnew/3.9.rst:733 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.9.rst:735 msgid "" -"White space characters within attributes are now preserved when serializing :" -"mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " -"\"\\n\". This is the result of discussion about how to interpret section " -"2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" +"White space characters within attributes are now preserved when " +"serializing :mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer " +"normalized to \"\\n\". This is the result of discussion about how to " +"interpret section 2.11 of XML spec. (Contributed by Mefistotelis " +"in :issue:`39011`.)" msgstr "" +":mod:`xml.etree.ElementTree` を XML ファイルにシリアライズするとき、属性内の" +"空白文字が保持されるようになりました。\n" +"改行は \"\\n\" に正規化されなくなりました。\n" +"これは XML 仕様の 2.11 節の解釈についての議論を受けた変更です。\n" +"(Contributed by Mefistotelis in :issue:`39011`.)" #: ../../whatsnew/3.9.rst:743 msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.9.rst:745 msgid "" "Optimized the idiom for assignment a temporary variable in comprehensions. " "Now ``for y in [expr]`` in comprehensions is as fast as a simple assignment " "``y = expr``. For example:" msgstr "" +"内包表記内で一時変数に代入するイディオムが最適化されました。\n" +"内包表記内の ``for y in [expr]`` は、単純な代入 ``y = expr`` と同じ速さになり" +"ました。\n" +"例えば次のようになります:" -#: ../../whatsnew/3.9.rst:749 msgid "sums = [s for s in [0] for x in data for s in [s + x]]" -msgstr "" +msgstr "sums = [s for s in [0] for x in data for s in [s + x]]" -#: ../../whatsnew/3.9.rst:751 msgid "" "Unlike the ``:=`` operator this idiom does not leak a variable to the outer " "scope." msgstr "" +"``:=`` 演算子と異なり、このイディオムは変数を外側のスコープに漏らしません。" -#: ../../whatsnew/3.9.rst:754 msgid "(Contributed by Serhiy Storchaka in :issue:`32856`.)" -msgstr "" +msgstr "(Serhiy Storchaka による貢献、:issue:`32856`。)" -#: ../../whatsnew/3.9.rst:756 msgid "" "Optimized signal handling in multithreaded applications. If a thread " "different than the main thread gets a signal, the bytecode evaluation loop " @@ -1253,34 +1505,50 @@ msgid "" "signals which cannot be handled. Only the main thread of the main " "interpreter can handle signals." msgstr "" +"マルチスレッドアプリケーションのシグナル処理が最適化されました。\n" +"メインスレッド以外がシグナルを受け取っても、処理できない保留中のシグナルを確" +"認するために、バイトコード評価ループを各命令で中断しなくなりました。\n" +"シグナルを処理できるのは、メインインタープリタのメインスレッドだけです。" -#: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " -"until the main thread handles signals. (Contributed by Victor Stinner in :" -"issue:`40010`.)" +"until the main thread handles signals. (Contributed by Victor Stinner " +"in :issue:`40010`.)" msgstr "" +"以前は、メインスレッドがシグナルを処理するまで、バイトコード評価ループを命令" +"ごとに中断していました。\n" +"(Contributed by Victor Stinner in :issue:`40010`.)" -#: ../../whatsnew/3.9.rst:766 msgid "" "Optimized the :mod:`subprocess` module on FreeBSD using ``closefrom()``. " "(Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor " "Stinner in :issue:`38061`.)" msgstr "" +"FreeBSD の :mod:`subprocess` モジュールが ``closefrom()`` を使って最適化され" +"ました。\n" +"(Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor " +"Stinner in :issue:`38061`.)" -#: ../../whatsnew/3.9.rst:770 msgid "" ":c:func:`PyLong_FromDouble` is now up to 1.87x faster for values that fit " "into :c:expr:`long`. (Contributed by Sergey Fedoseev in :issue:`37986`.)" msgstr "" +":c:func:`PyLong_FromDouble` は、:c:expr:`long` に収まる値について最大 1.87 倍" +"高速になりました。\n" +"(Contributed by Sergey Fedoseev in :issue:`37986`.)" -#: ../../whatsnew/3.9.rst:774 msgid "" -"A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" -"class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" -"pep:`590` vectorcall protocol. (Contributed by Donghee Na, Mark Shannon, " -"Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" +"A number of Python builtins " +"(:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) " +"are now sped up by using :pep:`590` vectorcall protocol. (Contributed by " +"Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " +"in :issue:`37207`.)" msgstr "" +"いくつかの Python の組み込み型 " +"(:class:`range`、:class:`tuple`、:class:`set`、:class:`frozenset`、:class:`list`、:class:`dict`) " +"が :pep:`590` の vectorcall プロトコルを使い、高速化されました。\n" +"(Contributed by Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " +"in :issue:`37207`.)" #: ../../whatsnew/3.9.rst:779 msgid "" @@ -1289,7 +1557,6 @@ msgid "" "contributed by Michele Orrù in :issue:`8425`.)" msgstr "" -#: ../../whatsnew/3.9.rst:783 msgid "" "Python's small object allocator (``obmalloc.c``) now allows (no more than) " "one empty arena to remain available for immediate reuse, without returning " @@ -1297,27 +1564,34 @@ msgid "" "be created and destroyed anew on each iteration. (Contributed by Tim Peters " "in :issue:`37257`.)" msgstr "" +"Python の小さなオブジェクト用アロケータ (``obmalloc.c``) は、空のアリーナを最" +"大一つだけ OS に返さずに保持し、直ちに再利用できるようになりました。\n" +"これにより、単純なループの反復ごとにアリーナを作成、破棄してしまう無駄を防ぎ" +"ます。\n" +"(Contributed by Tim Peters in :issue:`37257`.)" -#: ../../whatsnew/3.9.rst:789 msgid "" ":term:`floor division` of float operation now has a better performance. Also " "the message of :exc:`ZeroDivisionError` for this operation is updated. " "(Contributed by Donghee Na in :issue:`39434`.)" msgstr "" +"float の :term:`切り下げ除算 ` の性能が改善されました。\n" +"この操作の :exc:`ZeroDivisionError` のメッセージも更新されました。\n" +"(Contributed by Donghee Na in :issue:`39434`.)" -#: ../../whatsnew/3.9.rst:793 msgid "" "Decoding short ASCII strings with UTF-8 and ascii codecs is now about 15% " "faster. (Contributed by Inada Naoki in :issue:`37348`.)" msgstr "" +"UTF-8 と ascii コーデックによる短い ASCII 文字列のデコードが約 15% 高速になり" +"ました。\n" +"(Contributed by Inada Naoki in :issue:`37348`.)" -#: ../../whatsnew/3.9.rst:796 msgid "" "Here's a summary of performance improvements from Python 3.4 through Python " "3.9:" -msgstr "" +msgstr "Python 3.4 から Python 3.9 までの性能改善の概要です:" -#: ../../whatsnew/3.9.rst:798 msgid "" "Python version 3.4 3.5 3.6 3.7 3.8 " "3.9\n" @@ -1392,17 +1666,95 @@ msgid "" " loop_overhead 0.5 0.6 0.4 0.3 0.3 " "0.3" msgstr "" +"Python version 3.4 3.5 3.6 3.7 3.8 " +"3.9\n" +"-------------- --- --- --- --- --- " +"---\n" +"\n" +"Variable and attribute read access:\n" +" read_local 7.1 7.1 5.4 5.1 3.9 " +"3.9\n" +" read_nonlocal 7.1 8.1 5.8 5.4 4.4 " +"4.5\n" +" read_global 15.5 19.0 14.3 13.6 7.6 " +"7.8\n" +" read_builtin 21.1 21.6 18.5 19.0 7.5 " +"7.8\n" +" read_classvar_from_class 25.6 26.5 20.7 19.5 18.4 " +"17.9\n" +" read_classvar_from_instance 22.8 23.5 18.8 17.1 16.4 " +"16.9\n" +" read_instancevar 32.4 33.1 28.0 26.3 25.4 " +"25.3\n" +" read_instancevar_slots 27.8 31.3 20.8 20.8 20.2 " +"20.5\n" +" read_namedtuple 73.8 57.5 45.0 46.8 18.4 " +"18.7\n" +" read_boundmethod 37.6 37.9 29.6 26.9 27.7 " +"41.1\n" +"\n" +"Variable and attribute write access:\n" +" write_local 8.7 9.3 5.5 5.3 4.3 " +"4.3\n" +" write_nonlocal 10.5 11.1 5.6 5.5 4.7 " +"4.8\n" +" write_global 19.7 21.2 18.0 18.0 15.8 " +"16.7\n" +" write_classvar 92.9 96.0 104.6 102.1 39.2 " +"39.8\n" +" write_instancevar 44.6 45.8 40.0 38.9 35.5 " +"37.4\n" +" write_instancevar_slots 35.6 36.1 27.3 26.6 25.7 " +"25.8\n" +"\n" +"Data structure read access:\n" +" read_list 24.2 24.5 20.8 20.8 19.0 " +"19.5\n" +" read_deque 24.7 25.5 20.2 20.6 19.8 " +"20.2\n" +" read_dict 24.3 25.7 22.3 23.0 21.0 " +"22.4\n" +" read_strdict 22.6 24.3 19.5 21.2 18.9 " +"21.5\n" +"\n" +"Data structure write access:\n" +" write_list 27.1 28.5 22.5 21.6 20.0 " +"20.0\n" +" write_deque 28.7 30.1 22.7 21.8 23.5 " +"21.7\n" +" write_dict 31.4 33.3 29.3 29.2 24.7 " +"25.4\n" +" write_strdict 28.4 29.9 27.5 25.2 23.1 " +"24.5\n" +"\n" +"Stack (or queue) operations:\n" +" list_append_pop 93.4 112.7 75.4 74.2 50.8 " +"50.6\n" +" deque_append_pop 43.5 57.0 49.4 49.2 42.5 " +"44.2\n" +" deque_append_popleft 43.7 57.3 49.7 49.7 42.8 " +"46.4\n" +"\n" +"Timing loop:\n" +" loop_overhead 0.5 0.6 0.4 0.3 0.3 " +"0.3" -#: ../../whatsnew/3.9.rst:843 msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " "timings in nanoseconds. The benchmarks were measured on an `Intel® Core™ " -"i7-4960HQ processor `_ running the macOS 64-bit builds found at `python.org `_." -msgstr "" +"i7-4960HQ processor `_ running " +"the macOS 64-bit builds found at `python.org `_." +msgstr "" +"これらの結果は変数アクセスのベンチマークスクリプト ``Tools/scripts/" +"var_access_benchmark.py`` で生成しました。\n" +"時間はナノ秒単位で表示します。\n" +"ベンチマークは `Intel® Core™ i7-4960HQ プロセッサー `_ で、`python.org `_ の macOS 64 ビットビルドを使って計測しました。" #: ../../whatsnew/3.9.rst:853 msgid "Deprecated" @@ -1411,14 +1763,13 @@ msgstr "非推奨" #: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " -"(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" -"`39586`.)" +"(wheel packages) instead. (Contributed by Hugo van Kemenade " +"in :issue:`39586`.)" msgstr "" "distutilsの ``bdist_msi`` コマンドは、現在非推奨です。代わりに、" "``bdist_wheel`` (wheelパッケージ)を使って下さい。 ( :issue:`39586` でのHugo " "van Kemenadeによる貢献による)" -#: ../../whatsnew/3.9.rst:859 msgid "" "Currently :func:`math.factorial` accepts :class:`float` instances with non-" "negative integer values (like ``5.0``). It raises a :exc:`ValueError` for " @@ -1426,82 +1777,110 @@ msgid "" "versions it will raise a :exc:`TypeError` for all floats. (Contributed by " "Serhiy Storchaka in :issue:`37315`.)" msgstr "" +"現在の :func:`math.factorial` は、非負の整数値を持つ :class:`float` (``5.0`` " +"など) を受け付け、整数でない値や負の浮動小数点数には :exc:`ValueError` を送出" +"します。\n" +"この使い方は非推奨になりました。\n" +"将来の Python では、すべての float に対して :exc:`TypeError` を送出します。\n" +"(Contributed by Serhiy Storchaka in :issue:`37315`.)" -#: ../../whatsnew/3.9.rst:865 msgid "" "The :mod:`!parser` and :mod:`!symbol` modules are deprecated and will be " "removed in future versions of Python. For the majority of use cases, users " "can leverage the Abstract Syntax Tree (AST) generation and compilation " "stage, using the :mod:`ast` module." msgstr "" +":mod:`!parser` と :mod:`!symbol` モジュールが非推奨になり、将来の Python で削" +"除されます。\n" +"ほとんどの用途では、:mod:`ast` による抽象構文木 (AST) の生成とコンパイルの段" +"階を利用できます。" -#: ../../whatsnew/3.9.rst:870 msgid "" -"The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" -"func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" +"The Public C API functions :c:func:`!" +"PyParser_SimpleParseStringFlags`, :c:func:`!" +"PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" "PyParser_SimpleParseFileFlags` and :c:func:`!PyNode_Compile` are deprecated " "and will be removed in Python 3.10 together with the old parser." msgstr "" +"公開 C API の :c:func:`!PyParser_SimpleParseStringFlags`、:c:func:`!" +"PyParser_SimpleParseStringFlagsFilename`、:c:func:`!" +"PyParser_SimpleParseFileFlags`、:c:func:`!PyNode_Compile` 関数が非推奨にな" +"り、古いパーサーとともに Python 3.10 で削除されます。" -#: ../../whatsnew/3.9.rst:875 msgid "" "Using :data:`NotImplemented` in a boolean context has been deprecated, as it " "is almost exclusively the result of incorrect rich comparator " "implementations. It will be made a :exc:`TypeError` in a future version of " "Python. (Contributed by Josh Rosenberg in :issue:`35712`.)" msgstr "" +":data:`NotImplemented` をブール値の文脈で使うことは、ほとんどの場合リッチ比較" +"の実装ミスによるため、非推奨になりました。\n" +"将来の Python では :exc:`TypeError` になります。\n" +"(Contributed by Josh Rosenberg in :issue:`35712`.)" -#: ../../whatsnew/3.9.rst:881 msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " "deterministic hash value. After Python 3.9, the module will restrict its " -"seeds to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:" -"`bytes`, and :class:`bytearray`." +"seeds " +"to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, " +"and :class:`bytearray`." msgstr "" +"現在の :mod:`random` モジュールは、ハッシュ可能な任意の型をシード値として受け" +"付けます。\n" +"しかし、一部の型ではハッシュ値が決定的である保証がありません。\n" +"Python 3.9 より後では、シード" +"は :const:`None`、:class:`int`、:class:`float`、:class:`str`、:class:`bytes`、:class:`bytearray` " +"に制限されます。" -#: ../../whatsnew/3.9.rst:887 msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " "opened for reading by default. Specify the *mode* argument for opening it " -"for writing and silencing a warning. (Contributed by Serhiy Storchaka in :" -"issue:`28286`.)" +"for writing and silencing a warning. (Contributed by Serhiy Storchaka " +"in :issue:`28286`.)" msgstr "" +"*mode* 引数を指定せずに :class:`~gzip.GzipFile` を書き込み用に開くことが非推" +"奨になりました。\n" +"将来の Python では、デフォルトで常に読み取り用に開きます。\n" +"書き込み用に開き、警告を避けるには *mode* を指定してください。\n" +"(Contributed by Serhiy Storchaka in :issue:`28286`.)" -#: ../../whatsnew/3.9.rst:893 msgid "" "Deprecated the ``split()`` method of :class:`!_tkinter.TkappType` in favour " "of the ``splitlist()`` method which has more consistent and predictable " "behavior. (Contributed by Serhiy Storchaka in :issue:`38371`.)" msgstr "" +":class:`!_tkinter.TkappType` の ``split()`` メソッドが非推奨になりました。\n" +"代わりに、より一貫した予測しやすい動作をする ``splitlist()`` を使ってくださ" +"い。\n" +"(Contributed by Serhiy Storchaka in :issue:`38371`.)" -#: ../../whatsnew/3.9.rst:898 msgid "" "The explicit passing of coroutine objects to :func:`asyncio.wait` has been " "deprecated and will be removed in version 3.11. (Contributed by Yury " "Selivanov and Kyle Stanley in :issue:`34790`.)" msgstr "" +":func:`asyncio.wait` にコルーチンオブジェクトを明示的に渡すことが非推奨にな" +"り、3.11 で削除されます。\n" +"(Contributed by Yury Selivanov and Kyle Stanley in :issue:`34790`.)" -#: ../../whatsnew/3.9.rst:902 msgid "" "binhex4 and hexbin4 standards are now deprecated. The :mod:`!binhex` module " "and the following :mod:`binascii` functions are now deprecated:" msgstr "" +"binhex4 と hexbin4 の規格が非推奨になりました。\n" +":mod:`!binhex` モジュールと、:mod:`binascii` の次の関数が非推奨になりました:" -#: ../../whatsnew/3.9.rst:905 msgid ":func:`!b2a_hqx`, :func:`!a2b_hqx`" -msgstr "" +msgstr ":func:`!b2a_hqx`, :func:`!a2b_hqx`" -#: ../../whatsnew/3.9.rst:906 msgid ":func:`!rlecode_hqx`, :func:`!rledecode_hqx`" -msgstr "" +msgstr ":func:`!rlecode_hqx`, :func:`!rledecode_hqx`" -#: ../../whatsnew/3.9.rst:908 msgid "(Contributed by Victor Stinner in :issue:`39353`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`39353`。)" -#: ../../whatsnew/3.9.rst:910 msgid "" ":mod:`ast` classes ``slice``, ``Index`` and ``ExtSlice`` are considered " "deprecated and will be removed in future Python versions. ``value`` itself " @@ -1509,39 +1888,54 @@ msgid "" "should be used instead of ``ExtSlice(slices)``. (Contributed by Serhiy " "Storchaka in :issue:`34822`.)" msgstr "" +":mod:`ast` の ``slice``、``Index``、``ExtSlice`` クラスは非推奨とされ、将来" +"の Python で削除されます。\n" +"``Index(value)`` には ``value`` 自体を、``ExtSlice(slices)`` には " +"``Tuple(slices, Load())`` を使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`34822`.)" -#: ../../whatsnew/3.9.rst:916 msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " "were not generated by the parser and not accepted by the code generator in " -"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:" -"`39969` and Serhiy Storchaka in :issue:`39988`.)" +"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` " +"and :issue:`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" +":mod:`ast` の ``Suite``、``Param``、``AugLoad``、``AugStore`` クラスは非推奨" +"とされ、将来の Python で削除されます。\n" +"Python 3 ではパーサーが生成せず、コード生成器も受け付けないものでした。\n" +"(Contributed by Batuhan Taskaya in :issue:`39639` and :issue:`39969` and " +"Serhiy Storchaka in :issue:`39988`.)" -#: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " -"functions are now deprecated and will be removed in Python 3.11. Calling :c:" -"func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized " -"by :c:func:`Py_Initialize` since Python 3.7. (Contributed by Victor Stinner " -"in :issue:`39877`.)" +"functions are now deprecated and will be removed in Python 3.11. " +"Calling :c:func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is " +"initialized by :c:func:`Py_Initialize` since Python 3.7. (Contributed by " +"Victor Stinner in :issue:`39877`.)" msgstr "" +":c:func:`!PyEval_InitThreads` と :c:func:`!PyEval_ThreadsInitialized` 関数が" +"非推奨になり、Python 3.11 で削除されます。\n" +":c:func:`!PyEval_InitThreads` を呼んでも何もしなくなりました。\n" +"Python 3.7 から :term:`GIL` は :c:func:`Py_Initialize` で初期化されます。\n" +"(Contributed by Victor Stinner in :issue:`39877`.)" -#: ../../whatsnew/3.9.rst:929 msgid "" "Passing ``None`` as the first argument to the :func:`shlex.split` function " "has been deprecated. (Contributed by Zackery Spytz in :issue:`33262`.)" msgstr "" +":func:`shlex.split` の第 1 引数に ``None`` を渡すことが非推奨になりました。\n" +"(Contributed by Zackery Spytz in :issue:`33262`.)" -#: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " -"external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" -"`35800`.)" +"external module, ``mailman``. (Contributed by Samuel Colvin " +"in :issue:`35800`.)" msgstr "" +":func:`!smtpd.MailmanProxy` は、外部の ``mailman`` モジュールなしでは使えない" +"ため、非推奨になりました。\n" +"(Contributed by Samuel Colvin in :issue:`35800`.)" -#: ../../whatsnew/3.9.rst:935 msgid "" "The :mod:`!lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " "Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may " @@ -1550,6 +1944,15 @@ msgid "" "future Python version. Consider third-party alternatives such as `LibCST`_ " "or `parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" msgstr "" +":mod:`!lib2to3` モジュールが :exc:`PendingDeprecationWarning` を出すようにな" +"りました。\n" +"Python 3.9 は PEG パーサーに切り替わり (:pep:`617`)、Python 3.10 には " +"lib2to3 の LL(1) パーサーで解析できない新しい構文が含まれる可能性がありま" +"す。\n" +":mod:`!lib2to3` は将来の Python で標準ライブラリから削除される可能性がありま" +"す。\n" +"`LibCST`_ や `parso`_ などのサードパーティーの代替を検討してください。\n" +"(Contributed by Carl Meyer in :issue:`40360`.)" #: ../../whatsnew/3.9.rst:943 msgid "" @@ -1563,130 +1966,192 @@ msgstr "" msgid "Removed" msgstr "削除" -#: ../../whatsnew/3.9.rst:954 msgid "" "The erroneous version at :data:`!unittest.mock.__version__` has been removed." msgstr "" +":data:`!unittest.mock.__version__` の誤ったバージョン表記が削除されました。" -#: ../../whatsnew/3.9.rst:956 msgid "" ":class:`!nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " "For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" -"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" -"`39366`.)" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na " +"in :issue:`39366`.)" msgstr "" +":class:`!nntplib.NNTP` の ``xpath()`` と ``xgtitle()`` メソッドが削除されまし" +"た。\n" +"Python 3.3 から非推奨でした。\n" +"通常、これらの拡張はサポートされていないか、NNTP サーバーの管理者が有効にして" +"いません。\n" +"``xgtitle()`` の代わりに :meth:`!nntplib.NNTP.descriptions` または :meth:`!" +"nntplib.NNTP.description` を使ってください。\n" +"(Contributed by Donghee Na in :issue:`39366`.)" -#: ../../whatsnew/3.9.rst:963 msgid "" ":class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been " "removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated " "since Python 3.2. (Contributed by Victor Stinner in :issue:`38916`.)" msgstr "" +":class:`array.array` の ``tostring()`` と ``fromstring()`` メソッドが削除され" +"ました。\n" +"``tobytes()`` と ``frombytes()`` の別名で、Python 3.2 から非推奨でした。\n" +"(Contributed by Victor Stinner in :issue:`38916`.)" -#: ../../whatsnew/3.9.rst:968 msgid "" "The undocumented ``sys.callstats()`` function has been removed. Since Python " "3.7, it was deprecated and always returned :const:`None`. It required a " "special build option ``CALL_PROFILE`` which was already removed in Python " "3.7. (Contributed by Victor Stinner in :issue:`37414`.)" msgstr "" +"文書化されていない ``sys.callstats()`` 関数が削除されました。\n" +"Python 3.7 から非推奨で、常に :const:`None` を返していました。\n" +"必要だった特別なビルドオプション ``CALL_PROFILE`` は Python 3.7 で削除済みで" +"した。\n" +"(Contributed by Victor Stinner in :issue:`37414`.)" -#: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " -"been removed. They were deprecated since Python 3.2. Use :func:`sys." -"getswitchinterval` and :func:`sys.setswitchinterval` instead. (Contributed " -"by Victor Stinner in :issue:`37392`.)" +"been removed. They were deprecated since Python 3.2. " +"Use :func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead. " +"(Contributed by Victor Stinner in :issue:`37392`.)" msgstr "" +"Python 3.2 から非推奨だった ``sys.getcheckinterval()`` と " +"``sys.setcheckinterval()`` 関数が削除されました。\n" +"代わりに :func:`sys.getswitchinterval` と :func:`sys.setswitchinterval` を" +"使ってください。\n" +"(Contributed by Victor Stinner in :issue:`37392`.)" -#: ../../whatsnew/3.9.rst:978 msgid "" "The C function ``PyImport_Cleanup()`` has been removed. It was documented " "as: \"Empty the module table. For internal use only.\" (Contributed by " "Victor Stinner in :issue:`36710`.)" msgstr "" +"C 関数 ``PyImport_Cleanup()`` が削除されました。\n" +"「モジュールテーブルを空にする。内部使用専用」と文書化されていました。\n" +"(Contributed by Victor Stinner in :issue:`36710`.)" -#: ../../whatsnew/3.9.rst:982 msgid "" "``_dummy_thread`` and ``dummy_threading`` modules have been removed. These " "modules were deprecated since Python 3.7 which requires threading support. " "(Contributed by Victor Stinner in :issue:`37312`.)" msgstr "" +"``_dummy_thread`` と ``dummy_threading`` モジュールが削除されました。\n" +"スレッドのサポートを必須にした Python 3.7 から非推奨でした。\n" +"(Contributed by Victor Stinner in :issue:`37312`.)" -#: ../../whatsnew/3.9.rst:986 msgid "" "``aifc.openfp()`` alias to ``aifc.open()``, ``sunau.openfp()`` alias to " "``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open` have been " "removed. They were deprecated since Python 3.7. (Contributed by Victor " "Stinner in :issue:`37320`.)" msgstr "" +"``aifc.open()`` の別名 ``aifc.openfp()``、``sunau.open()`` の別名 " +"``sunau.openfp()``、:func:`wave.open` の別名 ``wave.openfp()`` が削除されまし" +"た。\n" +"Python 3.7 から非推奨でした。\n" +"(Contributed by Victor Stinner in :issue:`37320`.)" -#: ../../whatsnew/3.9.rst:991 msgid "" "The :meth:`!isAlive` method of :class:`threading.Thread` has been removed. " "It was deprecated since Python 3.8. Use :meth:`~threading.Thread.is_alive` " "instead. (Contributed by Donghee Na in :issue:`37804`.)" msgstr "" +":class:`threading.Thread` の :meth:`!isAlive` メソッドが削除されました。\n" +"Python 3.8 から非推奨でした。\n" +"代わりに :meth:`~threading.Thread.is_alive` を使ってください。\n" +"(Contributed by Donghee Na in :issue:`37804`.)" -#: ../../whatsnew/3.9.rst:996 msgid "" -"Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." -"etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " -"in the :mod:`~xml.etree.ElementTree` module have been removed. They were " -"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of ``x." -"getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of ``x." -"getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" +"Methods ``getchildren()`` and ``getiterator()`` of " +"classes :class:`~xml.etree.ElementTree.ElementTree` " +"and :class:`~xml.etree.ElementTree.Element` in " +"the :mod:`~xml.etree.ElementTree` module have been removed. They were " +"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of " +"``x.getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of " +"``x.getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" +":mod:`~xml.etree.ElementTree` モジュール" +"の :class:`~xml.etree.ElementTree.ElementTree` " +"と :class:`~xml.etree.ElementTree.Element` クラスの ``getchildren()`` と " +"``getiterator()`` メソッドが削除されました。\n" +"Python 3.2 で非推奨になっていました。\n" +"``x.getchildren()`` の代わりに ``iter(x)`` または ``list(x)`` を、" +"``x.getiterator()`` の代わりに ``x.iter()`` または ``list(x.iter())`` を使っ" +"てください。\n" +"(Contributed by Serhiy Storchaka in :issue:`36543`.)" -#: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " -"3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" -"`~plistlib.dump`, and :func:`~plistlib.dumps` functions. Additionally, the " -"*use_builtin_types* parameter was removed, standard :class:`bytes` objects " -"are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" +"3.4. Use " +"the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, " +"and :func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* " +"parameter was removed, standard :class:`bytes` objects are always used " +"instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" +"Python 3.4 から非推奨だった :mod:`plistlib` の古い API が削除されました。\n" +":func:`~plistlib.load`、:func:`~plistlib.loads`、:func:`~plistlib.dump`、:func:`~plistlib.dumps` " +"関数を使ってください。\n" +"また、*use_builtin_types* パラメータが削除され、常に標準の :class:`bytes` オ" +"ブジェクトが使われるようになりました。\n" +"(Contributed by Jon Janzen in :issue:`36409`.)" -#: ../../whatsnew/3.9.rst:1010 msgid "" "The C function ``PyGen_NeedsFinalizing`` has been removed. It was not " "documented, tested, or used anywhere within CPython after the implementation " "of :pep:`442`. Patch by Joannah Nanjekye. (Contributed by Joannah Nanjekye " "in :issue:`15088`)" msgstr "" +"C 関数 ``PyGen_NeedsFinalizing`` が削除されました。\n" +"文書化もテストもされておらず、:pep:`442` の実装後は CPython 内のどこでも使わ" +"れていませんでした。\n" +"パッチは Joannah Nanjekye によるものです。\n" +"(Contributed by Joannah Nanjekye in :issue:`15088`)" -#: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " -"since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" -"func:`base64.decodebytes` instead. (Contributed by Victor Stinner in :issue:" -"`39351`.)" +"since Python 3.1, have been removed: use :func:`base64.encodebytes` " +"and :func:`base64.decodebytes` instead. (Contributed by Victor Stinner " +"in :issue:`39351`.)" msgstr "" +"Python 3.1 から非推奨だった別名 ``base64.encodestring()`` と " +"``base64.decodestring()`` が削除されました。\n" +"代わりに :func:`base64.encodebytes` と :func:`base64.decodebytes` を使ってく" +"ださい。\n" +"(Contributed by Victor Stinner in :issue:`39351`.)" -#: ../../whatsnew/3.9.rst:1020 msgid "" "``fractions.gcd()`` function has been removed, it was deprecated since " "Python 3.5 (:issue:`22486`): use :func:`math.gcd` instead. (Contributed by " "Victor Stinner in :issue:`39350`.)" msgstr "" +"Python 3.5 から非推奨だった ``fractions.gcd()`` 関数 (:issue:`22486`) が削除" +"されました。\n" +"代わりに :func:`math.gcd` を使ってください。\n" +"(Contributed by Victor Stinner in :issue:`39350`.)" -#: ../../whatsnew/3.9.rst:1024 msgid "" "The *buffering* parameter of :class:`bz2.BZ2File` has been removed. Since " "Python 3.0, it was ignored and using it emitted a :exc:`DeprecationWarning`. " "Pass an open file object to control how the file is opened. (Contributed by " "Victor Stinner in :issue:`39357`.)" msgstr "" +":class:`bz2.BZ2File` の *buffering* パラメータが削除されました。\n" +"Python 3.0 から無視され、使うと :exc:`DeprecationWarning` が出ていました。\n" +"ファイルの開き方を制御するには、開いたファイルオブジェクトを渡してくださ" +"い。\n" +"(Contributed by Victor Stinner in :issue:`39357`.)" -#: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " -"Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" -"`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:" -"`39377`)" +"Python 3.1, it was deprecated and ignored; using it has emitted " +"a :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki " +"in :issue:`39377`)" msgstr "" +":func:`json.loads` の *encoding* パラメータが削除されました。\n" +"Python 3.1 から非推奨で無視されており、Python 3.8 からは使う" +"と :exc:`DeprecationWarning` が出ていました。\n" +"(Contributed by Inada Naoki in :issue:`39377`)" #: ../../whatsnew/3.9.rst:1034 msgid "" @@ -1696,45 +2161,63 @@ msgid "" "(Contributed by Andrew Svetlov in :issue:`34793`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " -"option and the ``show_alloc_count`` field of the C structure :c:type:" -"`PyConfig` have been removed. They required a special Python build by " -"defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" -"`39489`.)" +"option and the ``show_alloc_count`` field of the C " +"structure :c:type:`PyConfig` have been removed. They required a special " +"Python build by defining ``COUNT_ALLOCS`` macro. (Contributed by Victor " +"Stinner in :issue:`39489`.)" msgstr "" +":func:`!sys.getcounts` 関数、コマンドラインオプション ``-X showalloccount``、" +"C 構造体 :c:type:`PyConfig` の ``show_alloc_count`` フィールドが削除されまし" +"た。\n" +"これらには、``COUNT_ALLOCS`` マクロを定義した特別な Python ビルドが必要でし" +"た。\n" +"(Contributed by Victor Stinner in :issue:`39489`.)" -#: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " -"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka in :" -"issue:`40182`.)" +"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka " +"in :issue:`40182`.)" msgstr "" +":class:`typing.NamedTuple` クラスの ``_field_types`` 属性が削除されました。\n" +"Python 3.8 から非推奨でした。\n" +"代わりに ``__annotations__`` 属性を使ってください。\n" +"(Contributed by Serhiy Storchaka in :issue:`40182`.)" -#: ../../whatsnew/3.9.rst:1050 msgid "" "The :meth:`!symtable.SymbolTable.has_exec` method has been removed. It was " "deprecated since 2006, and only returning ``False`` when it's called. " "(Contributed by Batuhan Taskaya in :issue:`40208`)" msgstr "" +":meth:`!symtable.SymbolTable.has_exec` メソッドが削除されました。\n" +"2006 年から非推奨で、呼び出しても ``False`` を返すだけでした。\n" +"(Contributed by Batuhan Taskaya in :issue:`40208`)" -#: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"have been removed. They were deprecated since Python 3.7 and you can use :" -"func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " +"have been removed. They were deprecated since Python 3.7 and you can " +"use :func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" +":meth:`!asyncio.Task.current_task` と :meth:`!asyncio.Task.all_tasks` が削除" +"されました。\n" +"Python 3.7 から非推奨でした。\n" +"代わりに :func:`asyncio.current_task` と :func:`asyncio.all_tasks` を使えま" +"す。\n" +"(Contributed by Rémi Lapeyre in :issue:`40967`)" -#: ../../whatsnew/3.9.rst:1059 msgid "" "The ``unescape()`` method in the :class:`html.parser.HTMLParser` class has " "been removed (it was deprecated since Python 3.4). :func:`html.unescape` " "should be used for converting character references to the corresponding " "unicode characters." msgstr "" +":class:`html.parser.HTMLParser` クラスの ``unescape()`` メソッドが削除されま" +"した (Python 3.4 から非推奨でした)。\n" +"文字参照を対応する Unicode 文字に変換するには :func:`html.unescape` を使って" +"ください。" #: ../../whatsnew/3.9.rst:1066 ../../whatsnew/3.9.rst:1334 msgid "Porting to Python 3.9" @@ -1752,99 +2235,141 @@ msgstr "" msgid "Changes in the Python API" msgstr "Python API の変更" -#: ../../whatsnew/3.9.rst:1075 msgid "" -":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" -"`ImportError` where it previously raised :exc:`ValueError`. Callers catching " -"the specific exception type and supporting both Python 3.9 and earlier " -"versions will need to catch both using ``except (ImportError, ValueError):``." +":func:`__import__` and :func:`importlib.util.resolve_name` now " +"raise :exc:`ImportError` where it previously raised :exc:`ValueError`. " +"Callers catching the specific exception type and supporting both Python 3.9 " +"and earlier versions will need to catch both using ``except (ImportError, " +"ValueError):``." msgstr "" +":func:`__import__` と :func:`importlib.util.resolve_name` は、以" +"前 :exc:`ValueError` を送出していた場合に :exc:`ImportError` を送出するように" +"なりました。\n" +"この例外型を捕捉し、Python 3.9 とそれ以前の両方に対応する呼び出し側は、" +"``except (ImportError, ValueError):`` で両方を捕捉する必要があります。" -#: ../../whatsnew/3.9.rst:1080 msgid "" "The :mod:`venv` activation scripts no longer special-case when " "``__VENV_PROMPT__`` is set to ``\"\"``." msgstr "" +":mod:`venv` の有効化スクリプトは、``__VENV_PROMPT__`` が ``\"\"`` に設定され" +"ている場合を特別扱いしなくなりました。" -#: ../../whatsnew/3.9.rst:1083 msgid "" -"The :meth:`select.epoll.unregister` method no longer ignores the :const:" -"`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" +"The :meth:`select.epoll.unregister` method no longer ignores " +"the :const:`~errno.EBADF` error. (Contributed by Victor Stinner " +"in :issue:`39239`.)" msgstr "" +":meth:`select.epoll.unregister` メソッドは :const:`~errno.EBADF` エラーを無視" +"しなくなりました。\n" +"(Contributed by Victor Stinner in :issue:`39239`.)" -#: ../../whatsnew/3.9.rst:1087 msgid "" "The *compresslevel* parameter of :class:`bz2.BZ2File` became keyword-only, " "since the *buffering* parameter has been removed. (Contributed by Victor " "Stinner in :issue:`39357`.)" msgstr "" +"*buffering* パラメータの削除に伴い、:class:`bz2.BZ2File` の *compresslevel* " +"パラメータはキーワード専用になりました。\n" +"(Contributed by Victor Stinner in :issue:`39357`.)" -#: ../../whatsnew/3.9.rst:1091 msgid "" "Simplified AST for subscription. Simple indices will be represented by their " "value, extended slices will be represented as tuples. ``Index(value)`` will " "return a ``value`` itself, ``ExtSlice(slices)`` will return ``Tuple(slices, " "Load())``. (Contributed by Serhiy Storchaka in :issue:`34822`.)" msgstr "" +"添字参照の AST が簡略化されました。\n" +"単純なインデックスはその値で、拡張スライスはタプルで表されます。\n" +"``Index(value)`` は ``value`` 自体を、``ExtSlice(slices)`` は " +"``Tuple(slices, Load())`` を返します。\n" +"(Contributed by Serhiy Storchaka in :issue:`34822`.)" -#: ../../whatsnew/3.9.rst:1097 msgid "" "The :mod:`importlib` module now ignores the :envvar:`PYTHONCASEOK` " "environment variable when the :option:`-E` or :option:`-I` command line " "options are being used." msgstr "" +":mod:`importlib` モジュールは、コマンドラインオプション :option:`-E` また" +"は :option:`-I` が使われている場合、環境変数 :envvar:`PYTHONCASEOK` を無視す" +"るようになりました。" -#: ../../whatsnew/3.9.rst:1101 msgid "" "The *encoding* parameter has been added to the classes :class:`ftplib.FTP` " "and :class:`ftplib.FTP_TLS` as a keyword-only parameter, and the default " "encoding is changed from Latin-1 to UTF-8 to follow :rfc:`2640`." msgstr "" +":class:`ftplib.FTP` と :class:`ftplib.FTP_TLS` クラスにキーワード専用の " +"*encoding* パラメータが追加され、:rfc:`2640` に従ってデフォルトのエンコーディ" +"ングが Latin-1 から UTF-8 に変わりました。" -#: ../../whatsnew/3.9.rst:1105 msgid "" -":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" -"`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " -"from it should have this method defined. (Contributed by Kyle Stanley in :" -"issue:`34037`.)" +":meth:`asyncio.loop.shutdown_default_executor` has been added " +"to :class:`~asyncio.AbstractEventLoop`, meaning alternative event loops that " +"inherit from it should have this method defined. (Contributed by Kyle " +"Stanley in :issue:`34037`.)" msgstr "" +":class:`~asyncio.AbstractEventLoop` " +"に :meth:`asyncio.loop.shutdown_default_executor` が追加されました。\n" +"このクラスを継承する別のイベントループ実装も、このメソッドを定義する必要があ" +"ります。\n" +"(Contributed by Kyle Stanley in :issue:`34037`.)" -#: ../../whatsnew/3.9.rst:1110 msgid "" "The constant values of future flags in the :mod:`__future__` module is " "updated in order to prevent collision with compiler flags. Previously " "``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``. " "(Contributed by Batuhan Taskaya in :issue:`39562`)" msgstr "" +"コンパイラフラグとの衝突を防ぐため、:mod:`__future__` モジュールの future フ" +"ラグの定数値が更新されました。\n" +"以前は ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` と ``CO_FUTURE_DIVISION`` が衝突してい" +"ました。\n" +"(Contributed by Batuhan Taskaya in :issue:`39562`)" -#: ../../whatsnew/3.9.rst:1115 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of " "``Py_UNICODE``. This change doesn't affect to its behavior because " "``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3. (Contributed " "by Inada Naoki in :issue:`34538`.)" msgstr "" +"``array('u')`` が使う C の型が ``Py_UNICODE`` から :c:type:`wchar_t` に変わり" +"ました。\n" +"Python 3.3 から ``Py_UNICODE`` は :c:type:`wchar_t` の別名なので、動作に影響" +"はありません。\n" +"(Contributed by Inada Naoki in :issue:`34538`.)" -#: ../../whatsnew/3.9.rst:1120 msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " "``'root'``. This could affect cases where user code explicitly wants a non-" -"root logger named ``'root'``, or instantiates a logger using ``logging." -"getLogger(__name__)`` in some top-level module called ``'root.py'``. " +"root logger named ``'root'``, or instantiates a logger using " +"``logging.getLogger(__name__)`` in some top-level module called " +"``'root.py'``. (Contributed by Vinay Sajip in :issue:`37742`.)" +msgstr "" +":func:`logging.getLogger` API に名前 ``'root'`` を渡すと、ルートロガーを返す" +"ようになりました。\n" +"以前はルートロガーではない、``'root'`` という名前のロガーを返していました。\n" +"この変更は、ユーザーコードが明示的にそのようなロガーを求める場合や、" +"``'root.py'`` という名前のトップレベルモジュールで " +"``logging.getLogger(__name__)`` を使ってロガーを作る場合に影響する可能性があ" +"ります。\n" "(Contributed by Vinay Sajip in :issue:`37742`.)" -msgstr "" -#: ../../whatsnew/3.9.rst:1127 msgid "" -"Division handling of :class:`~pathlib.PurePath` now returns :data:" -"`NotImplemented` instead of raising a :exc:`TypeError` when passed something " -"other than an instance of ``str`` or :class:`~pathlib.PurePath`. This " -"allows creating compatible classes that don't inherit from those mentioned " -"types. (Contributed by Roger Aiudi in :issue:`34775`)." +"Division handling of :class:`~pathlib.PurePath` now " +"returns :data:`NotImplemented` instead of raising a :exc:`TypeError` when " +"passed something other than an instance of ``str`` " +"or :class:`~pathlib.PurePath`. This allows creating compatible classes that " +"don't inherit from those mentioned types. (Contributed by Roger Aiudi " +"in :issue:`34775`)." msgstr "" +":class:`~pathlib.PurePath` の除算処理は、``str`` また" +"は :class:`~pathlib.PurePath` のインスタンス以外を渡すと、:exc:`TypeError` を" +"送出する代わりに :data:`NotImplemented` を返すようになりました。\n" +"これにより、これらの型を継承せずに互換性のあるクラスを作れます。\n" +"(Contributed by Roger Aiudi in :issue:`34775`)" -#: ../../whatsnew/3.9.rst:1133 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " "leading zeros in IPv4 address strings. Leading zeros are ambiguous and " @@ -1853,32 +2378,52 @@ msgid "" "glibc implementation of modern :func:`~socket.inet_pton` does not accept any " "leading zeros. (Contributed by Christian Heimes in :issue:`36384`)." msgstr "" - -#: ../../whatsnew/3.9.rst:1141 -msgid "" -":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" -"`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " -"converts the name to lower case. For example, ``\"latex+latin1\"`` encoding " -"name is now normalized to ``\"latex_latin1\"``. (Contributed by Jordon Xu " -"in :issue:`37751`.)" -msgstr "" +"Python 3.9.5 から :mod:`ipaddress` モジュールは、IPv4 アドレス文字列の先頭の" +"ゼロを一切受け付けなくなりました。\n" +"先頭のゼロは曖昧で、一部のライブラリは 8 進表記と解釈します。\n" +"例えば、古い関数 :func:`socket.inet_aton` は先頭のゼロを 8 進表記と解釈しま" +"す。\n" +"新しい :func:`~socket.inet_pton` の glibc 実装は先頭のゼロを一切受け付けませ" +"ん。\n" +"(Contributed by Christian Heimes in :issue:`36384`)" + +msgid "" +":func:`codecs.lookup` now normalizes the encoding name the same way " +"as :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` " +"also converts the name to lower case. For example, ``\"latex+latin1\"`` " +"encoding name is now normalized to ``\"latex_latin1\"``. (Contributed by " +"Jordon Xu in :issue:`37751`.)" +msgstr "" +":func:`codecs.lookup` は :func:`encodings.normalize_encoding` と同じ方法でエ" +"ンコーディング名を正規化するようになりました。\n" +"ただし :func:`codecs.lookup` は名前を小文字にも変換します。\n" +"例えば、エンコーディング名 ``\"latex+latin1\"`` は ``\"latex_latin1\"`` に正" +"規化されます。\n" +"(Contributed by Jordon Xu in :issue:`37751`.)" #: ../../whatsnew/3.9.rst:1149 msgid "Changes in the C API" msgstr "C API の変更" -#: ../../whatsnew/3.9.rst:1151 msgid "" "Instances of :ref:`heap-allocated types ` (such as those created " "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " "type object since Python 3.8. As indicated in the \"Changes in the C API\" " "of Python 3.8, for the vast majority of cases, there should be no side " -"effect but for types that have a custom :c:member:`~PyTypeObject." -"tp_traverse` function, ensure that all custom ``tp_traverse`` functions of " -"heap-allocated types visit the object's type." +"effect but for types that have a " +"custom :c:member:`~PyTypeObject.tp_traverse` function, ensure that all " +"custom ``tp_traverse`` functions of heap-allocated types visit the object's " +"type." msgstr "" +"Python 3.8 から、:c:func:`PyType_FromSpec` などの API で作成する :ref:`ヒープ" +"に割り当てられた型 ` のインスタンスは、型オブジェクトへの参照を保" +"持します。\n" +"Python 3.8 の「C API の変更」に記載したとおり、ほとんどの場合に副作用はありま" +"せん。\n" +"ただし、独自の :c:member:`~PyTypeObject.tp_traverse` 関数を持つ型については、" +"ヒープに割り当てられた型のすべての独自 ``tp_traverse`` 関数が、オブジェクトの" +"型を訪問することを確認してください。" -#: ../../whatsnew/3.9.rst:1161 msgid "" "int\n" "foo_traverse(PyObject *self, visitproc visit, void *arg)\n" @@ -1890,28 +2435,35 @@ msgid "" "#endif\n" "}" msgstr "" +"int\n" +"foo_traverse(PyObject *self, visitproc visit, void *arg)\n" +"{\n" +"// 走査関数の残りの処理\n" +"#if PY_VERSION_HEX >= 0x03090000\n" +" // Python 3.9 より前は不要でした (Python issue 35810 と 40217)\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif\n" +"}" -#: ../../whatsnew/3.9.rst:1173 msgid "" "If your traverse function delegates to ``tp_traverse`` of its base class (or " "another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that " "only :ref:`heap type ` are expected to visit the type in " "``tp_traverse``." msgstr "" +"走査関数が基底クラス (または別の型) の ``tp_traverse`` に処理を委譲する場合、" +"``Py_TYPE(self)`` を訪問するのが一度だけになるようにしてください。\n" +"``tp_traverse`` で型を訪問するのは :ref:`ヒープ型 ` だけです。" -#: ../../whatsnew/3.9.rst:1178 msgid "For example, if your ``tp_traverse`` function includes:" -msgstr "" +msgstr "例えば、``tp_traverse`` 関数に次の処理がある場合:" -#: ../../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:" -msgstr "" +msgstr "次の処理を追加してください:" -#: ../../whatsnew/3.9.rst:1186 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)\n" @@ -1922,90 +2474,107 @@ msgid "" " }\n" "#else" msgstr "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" // Python 3.9 より前は不要でした (bpo-35810 と bpo-40217)\n" +" if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" // ヒープ型の tp_traverse がすでに Py_TYPE(self) を訪問しています\n" +" } else {\n" +" Py_VISIT(Py_TYPE(self));\n" +" }\n" +"#else" -#: ../../whatsnew/3.9.rst:1197 msgid "(See :issue:`35810` and :issue:`40217` for more information.)" -msgstr "" +msgstr "(詳細は :issue:`35810` と :issue:`40217` を参照してください。)" -#: ../../whatsnew/3.9.rst:1199 msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " -"Use :c:func:`PyObject_Call` and its variants instead. (See more details in :" -"issue:`29548`.)" +"Use :c:func:`PyObject_Call` and its variants instead. (See more details " +"in :issue:`29548`.)" msgstr "" +"``PyEval_CallObject``、``PyEval_CallFunction``、``PyEval_CallMethod``、" +"``PyEval_CallObjectWithKeywords`` 関数が非推奨になりました。\n" +"代わりに :c:func:`PyObject_Call` とその派生形を使ってください。\n" +"(詳細は :issue:`29548` を参照してください。)" #: ../../whatsnew/3.9.rst:1205 msgid "CPython bytecode changes" msgstr "CPython バイトコードの変更" -#: ../../whatsnew/3.9.rst:1207 msgid "" -"The :opcode:`!LOAD_ASSERTION_ERROR` opcode was added for handling the :" -"keyword:`assert` statement. Previously, the assert statement would not work " -"correctly if the :exc:`AssertionError` exception was being shadowed. " +"The :opcode:`!LOAD_ASSERTION_ERROR` opcode was added for handling " +"the :keyword:`assert` statement. Previously, the assert statement would not " +"work correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" +":keyword:`assert` 文を処理する :opcode:`!LOAD_ASSERTION_ERROR` 命令が追加され" +"ました。\n" +"以前は :exc:`AssertionError` 例外の名前が別の値で隠されていると、assert 文が" +"正しく動作しませんでした。\n" +"(Contributed by Zackery Spytz in :issue:`34880`.)" -#: ../../whatsnew/3.9.rst:1212 msgid "" "The :opcode:`COMPARE_OP` opcode was split into four distinct instructions:" -msgstr "" +msgstr ":opcode:`COMPARE_OP` 命令が次の四つの命令に分かれました:" -#: ../../whatsnew/3.9.rst:1214 msgid "``COMPARE_OP`` for rich comparisons" -msgstr "" +msgstr "リッチ比較用の ``COMPARE_OP``" -#: ../../whatsnew/3.9.rst:1215 msgid "``IS_OP`` for 'is' and 'is not' tests" -msgstr "" +msgstr "is と is not の判定用の ``IS_OP``" -#: ../../whatsnew/3.9.rst:1216 msgid "``CONTAINS_OP`` for 'in' and 'not in' tests" -msgstr "" +msgstr "in と not in の判定用の ``CONTAINS_OP``" -#: ../../whatsnew/3.9.rst:1217 msgid "" "``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' statements." -msgstr "" +msgstr "try-except 文での例外の照合用の ``JUMP_IF_NOT_EXC_MATCH``。" -#: ../../whatsnew/3.9.rst:1220 msgid "(Contributed by Mark Shannon in :issue:`39156`.)" -msgstr "" +msgstr "(Mark Shannon による貢献、:issue:`39156`。)" -#: ../../whatsnew/3.9.rst:1224 msgid "Build Changes" -msgstr "" +msgstr "ビルドの変更" -#: ../../whatsnew/3.9.rst:1226 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " -"platform-specific library directory, stored in the new :data:`sys." -"platlibdir` attribute. See :data:`sys.platlibdir` attribute for more " -"information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " -"and Victor Stinner in :issue:`1294959`.)" +"platform-specific library directory, stored in the " +"new :data:`sys.platlibdir` attribute. See :data:`sys.platlibdir` attribute " +"for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos " +"Stratakis and Victor Stinner in :issue:`1294959`.)" msgstr "" +"``configure`` スクリプトに ``--with-platlibdir`` オプションが追加されまし" +"た。\n" +"プラットフォーム固有のライブラリディレクトリ名を指定し、新し" +"い :data:`sys.platlibdir` 属性に格納します。\n" +"詳細は :data:`sys.platlibdir` 属性を参照してください。\n" +"(Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor " +"Stinner in :issue:`1294959`.)" -#: ../../whatsnew/3.9.rst:1232 msgid "" "The ``COUNT_ALLOCS`` special build macro has been removed. (Contributed by " "Victor Stinner in :issue:`39489`.)" msgstr "" +"特殊なビルド用マクロ ``COUNT_ALLOCS`` が削除されました。\n" +"(Contributed by Victor Stinner in :issue:`39489`.)" -#: ../../whatsnew/3.9.rst:1235 msgid "" "On non-Windows platforms, the :c:func:`!setenv` and :c:func:`!unsetenv` " "functions are now required to build Python. (Contributed by Victor Stinner " "in :issue:`39395`.)" msgstr "" +"Windows 以外のプラットフォームで Python をビルドするには、:c:func:`!setenv` " +"と :c:func:`!unsetenv` 関数が必要になりました。\n" +"(Contributed by Victor Stinner in :issue:`39395`.)" -#: ../../whatsnew/3.9.rst:1239 msgid "" "On non-Windows platforms, creating ``bdist_wininst`` installers is now " "officially unsupported. (See :issue:`10945` for more details.)" msgstr "" +"Windows 以外のプラットフォームでの ``bdist_wininst`` インストーラの作成は、正" +"式にサポート対象外になりました。\n" +"(詳細は :issue:`10945` を参照してください。)" -#: ../../whatsnew/3.9.rst:1242 msgid "" "When building Python on macOS from source, ``_tkinter`` now links with non-" "system Tcl and Tk frameworks if they are installed in ``/Library/" @@ -2015,14 +2584,23 @@ msgid "" "be overridden with ``--with-tcltk-includes`` and ``--with-tcltk-libs``. " "(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" +"macOS で Python をソースからビルドするとき、``/Library/Frameworks`` にシステ" +"ム付属ではない Tcl と Tk のフレームワークがあれば、``_tkinter`` はそれらにリ" +"ンクするようになりました。\n" +"これは古い macOS リリースでの動作と同じです。\n" +":option:`--enable-universalsdk` または ``-isysroot`` で macOS SDK を明示的に" +"設定した場合は、その SDK 内だけを探します。\n" +"引き続き ``--with-tcltk-includes`` と ``--with-tcltk-libs`` でデフォルトの動" +"作を変更できます。\n" +"(Contributed by Ned Deily in :issue:`34956`.)" -#: ../../whatsnew/3.9.rst:1251 msgid "" "Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower " "in :issue:`33125`.)" msgstr "" +"Windows 10 ARM64 向けに Python をビルドできるようになりました。\n" +"(Contributed by Steve Dower in :issue:`33125`.)" -#: ../../whatsnew/3.9.rst:1254 msgid "" "Some individual tests are now skipped when ``--pgo`` is used. The tests in " "question increased the PGO task time significantly and likely didn't help " @@ -2037,56 +2615,84 @@ msgid "" "and compiler tool chain. (See :issue:`36044` and :issue:`37707` for more " "details.)" msgstr "" +"``--pgo`` を使うと、一部のテストをスキップするようになりました。\n" +"これらのテストは PGO タスクの所要時間を大幅に増やし、最終的な実行ファイルの最" +"適化にはあまり役立たないと考えられます。\n" +"この変更により、タスクは約 15 倍高速になります。\n" +"ユニットテスト全体の実行には時間がかかります。\n" +"実行するコードの分岐が減るため、この変更でビルド結果の最適化がわずかに弱まる" +"可能性があります。\n" +"ビルドが大幅に遅くなっても構わない場合は、``./configure [..] PROFILE_TASK=\"-" +"m test --pgo-extended\"`` で以前の動作に戻せます。\n" +"どちらの PGO タスク群がより高速なビルド結果を生むかは保証しません。\n" +"結果は環境、負荷、コンパイラのツールチェーンによって変わるため、気になる場合" +"は用途に合ったベンチマークを実行してください。\n" +"(詳細は :issue:`36044` と :issue:`37707` を参照してください。)" #: ../../whatsnew/3.9.rst:1269 msgid "C API Changes" msgstr "C API の変更" -#: ../../whatsnew/3.9.rst:1274 msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " -"to retrieve the module and its state; and :c:type:`PyCMethod` and :c:macro:" -"`METH_METHOD` to allow a method to access the class it was defined in. " +"to retrieve the module and its state; and :c:type:`PyCMethod` " +"and :c:macro:`METH_METHOD` to allow a method to access the class it was " +"defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" +msgstr "" +":pep:`573`: モジュールとクラスを関連付け" +"る :c:func:`PyType_FromModuleAndSpec`、そのモジュールと状態を取得す" +"る :c:func:`PyType_GetModule` と :c:func:`PyType_GetModuleState`、メソッドが" +"自分の定義されたクラスにアクセスできるようにする :c:type:`PyCMethod` " +"と :c:macro:`METH_METHOD` が追加されました。\n" "(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" -msgstr "" -#: ../../whatsnew/3.9.rst:1281 msgid "" -"Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" -"`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " -"Victor Stinner in :issue:`40421`.)" +"Added :c:func:`PyFrame_GetCode` function: get a frame code. " +"Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. " +"(Contributed by Victor Stinner in :issue:`40421`.)" msgstr "" +"フレームのコードを取得する :c:func:`PyFrame_GetCode` 関数と、フレームの一つ外" +"側のフレームを取得する :c:func:`PyFrame_GetBack` 関数が追加されました。\n" +"(Contributed by Victor Stinner in :issue:`40421`.)" -#: ../../whatsnew/3.9.rst:1285 msgid "" "Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" +"限定 C API に :c:func:`PyFrame_GetLineNumber` が追加されました。\n" +"(Contributed by Victor Stinner in :issue:`40421`.)" -#: ../../whatsnew/3.9.rst:1288 msgid "" -"Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" -"`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" -"`PyThreadState_GetFrame` function to get the current frame of a Python " -"thread state. Added :c:func:`PyThreadState_GetID` function: get the unique " -"identifier of a Python thread state. (Contributed by Victor Stinner in :" -"issue:`39947`.)" +"Added :c:func:`PyThreadState_GetInterpreter` " +"and :c:func:`PyInterpreterState_Get` functions to get the interpreter. " +"Added :c:func:`PyThreadState_GetFrame` function to get the current frame of " +"a Python thread state. Added :c:func:`PyThreadState_GetID` function: get the " +"unique identifier of a Python thread state. (Contributed by Victor Stinner " +"in :issue:`39947`.)" msgstr "" +"インタープリタを取得する :c:func:`PyThreadState_GetInterpreter` " +"と :c:func:`PyInterpreterState_Get` 関数が追加されました。\n" +"Python スレッド状態の現在のフレームを取得す" +"る :c:func:`PyThreadState_GetFrame` 関数と、Python スレッド状態の一意な識別子" +"を取得する :c:func:`PyThreadState_GetID` 関数も追加されました。\n" +"(Contributed by Victor Stinner in :issue:`39947`.)" -#: ../../whatsnew/3.9.rst:1296 msgid "" "Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, " "which calls a callable Python object without any arguments. It is the most " "efficient way to call a callable Python object without any argument. " "(Contributed by Victor Stinner in :issue:`37194`.)" msgstr "" +"引数なしで Python の呼び出し可能オブジェクトを呼び出す公開関" +"数 :c:func:`PyObject_CallNoArgs` が C API に追加されました。\n" +"引数なしで Python の呼び出し可能オブジェクトを呼び出す最も効率的な方法で" +"す。\n" +"(Contributed by Victor Stinner in :issue:`37194`.)" -#: ../../whatsnew/3.9.rst:1301 ../../whatsnew/3.9.rst:1419 msgid "Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):" -msgstr "" +msgstr "限定 C API (``Py_LIMITED_API`` マクロを定義した場合) の変更:" -#: ../../whatsnew/3.9.rst:1303 msgid "" "Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` " "as regular functions for the limited API. Previously, there were defined as " @@ -2094,187 +2700,250 @@ msgid "" "access ``PyThreadState.recursion_depth`` field (the structure is opaque in " "the limited C API)." msgstr "" +"限定 API で :c:func:`Py_EnterRecursiveCall` " +"と :c:func:`Py_LeaveRecursiveCall` を通常の関数として提供するようになりまし" +"た。\n" +"以前はマクロとして定義されていましたが、限定 C API ではコンパイルできませんで" +"した。\n" +"限定 C API では構造体が不透明なため、``PyThreadState.recursion_depth`` フィー" +"ルドにアクセスできないからです。" -#: ../../whatsnew/3.9.rst:1309 msgid "" "``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become regular \"opaque\" " "function to hide implementation details." msgstr "" +"実装の詳細を隠すため、``PyObject_INIT()`` と ``PyObject_INIT_VAR()`` が通常の" +"「不透明な」関数になりました。" -#: ../../whatsnew/3.9.rst:1312 ../../whatsnew/3.9.rst:1446 msgid "(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`38644` と :issue:`39542`。)" -#: ../../whatsnew/3.9.rst:1314 msgid "" "The :c:func:`PyModule_AddType` function is added to help adding a type to a " "module. (Contributed by Donghee Na in :issue:`40024`.)" msgstr "" +"モジュールへの型の追加を支援する :c:func:`PyModule_AddType` 関数が追加されま" +"した。\n" +"(Contributed by Donghee Na in :issue:`40024`.)" -#: ../../whatsnew/3.9.rst:1318 msgid "" -"Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" -"`PyObject_GC_IsFinalized` to the public API to allow to query if Python " -"objects are being currently tracked or have been already finalized by the " -"garbage collector respectively. (Contributed by Pablo Galindo Salgado in :" -"issue:`40241`.)" +"Added the functions :c:func:`PyObject_GC_IsTracked` " +"and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if " +"Python objects are being currently tracked or have been already finalized by " +"the garbage collector respectively. (Contributed by Pablo Galindo Salgado " +"in :issue:`40241`.)" msgstr "" +"公開 API に :c:func:`PyObject_GC_IsTracked` " +"と :c:func:`PyObject_GC_IsFinalized` 関数が追加されました。\n" +"それぞれ、Python オブジェクトが現在ガベージコレクタの追跡対象か、すでにガベー" +"ジコレクタによってファイナライズされているかを調べられます。\n" +"(Contributed by Pablo Galindo Salgado in :issue:`40241`.)" -#: ../../whatsnew/3.9.rst:1324 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " -"representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" -"`37645`.)" +"representation of a function-like object. (Patch by Jeroen Demeyer " +"in :issue:`37645`.)" msgstr "" +"関数のようなオブジェクトの、ユーザーに分かりやすい文字列表現を取得す" +"る :c:func:`!_PyObject_FunctionStr` が追加されました。\n" +"(Jeroen Demeyer によるパッチ、:issue:`37645`。)" -#: ../../whatsnew/3.9.rst:1328 msgid "" "Added :c:func:`PyObject_CallOneArg` for calling an object with one " "positional argument (Patch by Jeroen Demeyer in :issue:`37483`.)" msgstr "" +"一つの位置引数を渡してオブジェクトを呼び出す :c:func:`PyObject_CallOneArg` が" +"追加されました。\n" +"(Jeroen Demeyer によるパッチ、:issue:`37483`。)" -#: ../../whatsnew/3.9.rst:1336 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " -"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" -"issue:`38500`.)" -msgstr "" - -#: ../../whatsnew/3.9.rst:1340 -msgid "" -"Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" -"`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" -"type:`PyModuleDef` are no longer called if the module state was requested " -"but is not allocated yet. This is the case immediately after the module is " -"created and before the module is executed (:c:data:`Py_mod_exec` function). " -"More precisely, these functions are not called if :c:member:`~PyModuleDef." -"m_size` is greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." -msgstr "" +"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner " +"in :issue:`38500`.)" +msgstr "" +"``PyInterpreterState.eval_frame`` (:pep:`523`) に必須パラメータ *tstate* " +"(``PyThreadState*``) が追加されました。\n" +"(Contributed by Victor Stinner in :issue:`38500`.)" + +msgid "" +"Extension " +"modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:`~PyModuleDef.m_clear` " +"and :c:member:`~PyModuleDef.m_free` functions of :c:type:`PyModuleDef` are " +"no longer called if the module state was requested but is not allocated yet. " +"This is the case immediately after the module is created and before the " +"module is executed (:c:data:`Py_mod_exec` function). More precisely, these " +"functions are not called if :c:member:`~PyModuleDef.m_size` is greater than " +"0 and the module state (as returned by :c:func:`PyModule_GetState`) is " +"``NULL``." +msgstr "" +"拡張モジュール: モジュール状態が要求されていてもまだ割り当てられていない場" +"合、:c:type:`PyModuleDef` " +"の :c:member:`~PyModuleDef.m_traverse`、:c:member:`~PyModuleDef.m_clear`、:c:member:`~PyModuleDef.m_free` " +"関数を呼び出さなくなりました。\n" +"これは、モジュールの作成直後から実行 (:c:data:`Py_mod_exec` 関数) までの間に" +"当てはまります。\n" +"正確には、:c:member:`~PyModuleDef.m_size` が 0 より大きく、モジュール状態 " +"(:c:func:`PyModule_GetState` の戻り値) が ``NULL`` の場合に、これらの関数を呼" +"び出しません。" -#: ../../whatsnew/3.9.rst:1349 msgid "" "Extension modules without module state (``m_size <= 0``) are not affected." msgstr "" +"モジュール状態を持たない拡張モジュール (``m_size <= 0``) は影響を受けません。" -#: ../../whatsnew/3.9.rst:1351 msgid "" "If :c:func:`Py_AddPendingCall` is called in a subinterpreter, the function " "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. (Contributed by Victor Stinner in :issue:`39984`.)" msgstr "" +"サブインタープリタで :c:func:`Py_AddPendingCall` を呼び出すと、関数はメインイ" +"ンタープリタではなく、そのサブインタープリタから呼び出されるように登録されま" +"す。\n" +"サブインタープリタごとに、呼び出し予定の関数のリストを持つようになりまし" +"た。\n" +"(Contributed by Victor Stinner in :issue:`39984`.)" -#: ../../whatsnew/3.9.rst:1357 msgid "" "The Windows registry is no longer used to initialize :data:`sys.path` when " "the ``-E`` option is used (if :c:member:`PyConfig.use_environment` is set to " "``0``). This is significant when embedding Python on Windows. (Contributed " "by Zackery Spytz in :issue:`8901`.)" msgstr "" +"``-E`` オプションを使った場合 (:c:member:`PyConfig.use_environment` が ``0`` " +"の場合)、:data:`sys.path` の初期化に Windows レジストリを使わなくなりまし" +"た。\n" +"Windows で Python を埋め込む場合に重要な変更です。\n" +"(Contributed by Zackery Spytz in :issue:`8901`.)" -#: ../../whatsnew/3.9.rst:1362 msgid "" "The global variable :c:data:`PyStructSequence_UnnamedField` is now a " "constant and refers to a constant string. (Contributed by Serhiy Storchaka " "in :issue:`38650`.)" msgstr "" +"グローバル変数 :c:data:`PyStructSequence_UnnamedField` が定数になり、定数文字" +"列を参照するようになりました。\n" +"(Contributed by Serhiy Storchaka in :issue:`38650`.)" -#: ../../whatsnew/3.9.rst:1366 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " -"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" -"`40241`.)" +"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner " +"in :issue:`40241`.)" msgstr "" +":c:type:`!PyGC_Head` 構造体が不透明になりました。\n" +"内部 C API (``pycore_gc.h``) だけで定義されています。\n" +"(Contributed by Victor Stinner in :issue:`40241`.)" -#: ../../whatsnew/3.9.rst:1370 msgid "" -"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" -"func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " -"``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are " -"marked as deprecated in C. They have been deprecated by :pep:`393` since " -"Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" +"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, " +"``PyUnicode_WSTR_LENGTH``, :c:func:`!PyUnicode_FromUnicode`, :c:func:`!" +"PyUnicode_AsUnicode`, ``_PyUnicode_AsUnicode``, and :c:func:`!" +"PyUnicode_AsUnicodeAndSize` are marked as deprecated in C. They have been " +"deprecated by :pep:`393` since Python 3.3. (Contributed by Inada Naoki " +"in :issue:`36346`.)" msgstr "" +"``Py_UNICODE_COPY``、``Py_UNICODE_FILL``、" +"``PyUnicode_WSTR_LENGTH``、:c:func:`!PyUnicode_FromUnicode`、:c:func:`!" +"PyUnicode_AsUnicode`、``_PyUnicode_AsUnicode``、:c:func:`!" +"PyUnicode_AsUnicodeAndSize` が、C でも非推奨とマークされました。\n" +"これらは :pep:`393` によって Python 3.3 から非推奨になっていました。\n" +"(Contributed by Inada Naoki in :issue:`36346`.)" -#: ../../whatsnew/3.9.rst:1377 msgid "" "The :c:func:`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. (Contributed by Victor Stinner in :" -"issue:`39882`.)" +"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner " +"in :issue:`39882`.)" msgstr "" +"``Py_LIMITED_API`` マクロが定義されている場合を除き、:c:func:`Py_FatalError` " +"関数が、現在の関数名を自動的に記録するマクロに置き換えられました。\n" +"(Contributed by Victor Stinner in :issue:`39882`.)" -#: ../../whatsnew/3.9.rst:1382 msgid "" "The vectorcall protocol now requires that the caller passes only strings as " "keyword names. (See :issue:`37540` for more information.)" msgstr "" +"vectorcall プロトコルでは、呼び出し側がキーワード名として渡せるのが文字列だけ" +"になりました。\n" +"(詳細は :issue:`37540` を参照してください。)" -#: ../../whatsnew/3.9.rst:1385 msgid "" "Implementation details of a number of macros and functions are now hidden:" -msgstr "" +msgstr "いくつかのマクロや関数の実装の詳細が隠されるようになりました:" -#: ../../whatsnew/3.9.rst:1387 msgid ":c:func:`PyObject_IS_GC` macro was converted to a function." -msgstr "" +msgstr ":c:func:`PyObject_IS_GC` マクロが関数に変わりました。" -#: ../../whatsnew/3.9.rst:1389 msgid "" -"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" -"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " -"alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " -"directly the :c:member:`PyTypeObject.tp_basicsize` member." +"The :c:func:`!PyObject_NEW` macro becomes an alias to " +"the :c:macro:`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro " +"becomes an alias to the :c:macro:`PyObject_NewVar` macro. They no longer " +"access directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" +":c:func:`!PyObject_NEW` マクロは :c:macro:`PyObject_New` マクロの別名" +"に、:c:func:`!PyObject_NEW_VAR` マクロは :c:macro:`PyObject_NewVar` マクロの" +"別名になりました。\n" +":c:member:`PyTypeObject.tp_basicsize` メンバーに直接アクセスしなくなりまし" +"た。" -#: ../../whatsnew/3.9.rst:1394 msgid "" ":c:func:`!PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " "the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` " "member." msgstr "" +":c:member:`PyTypeObject.tp_weaklistoffset` メンバーに直接アクセスしてい" +"た :c:func:`!PyObject_GET_WEAKREFS_LISTPTR` マクロが関数に変わりました。" -#: ../../whatsnew/3.9.rst:1398 msgid "" ":c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro " "accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member." msgstr "" +":c:member:`PyTypeObject.tp_as_buffer` メンバーに直接アクセスしてい" +"た :c:func:`PyObject_CheckBuffer` マクロが関数に変わりました。" -#: ../../whatsnew/3.9.rst:1401 msgid "" ":c:func:`PyIndex_Check` is now always declared as an opaque function to hide " "implementation details: removed the ``PyIndex_Check()`` macro. The macro " "accessed directly the :c:member:`PyTypeObject.tp_as_number` member." msgstr "" +":c:func:`PyIndex_Check` は、実装の詳細を隠すため常に不透明な関数として宣言さ" +"れるようになりました。\n" +":c:member:`PyTypeObject.tp_as_number` メンバーに直接アクセスしていた " +"``PyIndex_Check()`` マクロは削除されました。" -#: ../../whatsnew/3.9.rst:1405 msgid "(See :issue:`40170` for more details.)" -msgstr "" +msgstr "(詳細は :issue:`40170` を参照してください。)" -#: ../../whatsnew/3.9.rst:1410 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " -"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" -"`38835`.)" +"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner " +"in :issue:`38835`.)" msgstr "" +"``pyfpe.h`` の ``PyFPE_START_PROTECT()`` と ``PyFPE_END_PROTECT()`` マクロが" +"限定 C API から除外されました。\n" +"(Contributed by Victor Stinner in :issue:`38835`.)" -#: ../../whatsnew/3.9.rst:1414 msgid "" "The ``tp_print`` slot of :ref:`PyTypeObject ` has been " "removed. It was used for printing objects to files in Python 2.7 and before. " "Since Python 3.0, it has been ignored and unused. (Contributed by Jeroen " "Demeyer in :issue:`36974`.)" msgstr "" +":ref:`PyTypeObject ` の ``tp_print`` スロットが削除されまし" +"た。\n" +"Python 2.7 以前ではオブジェクトをファイルに出力するために使われていました。\n" +"Python 3.0 からは無視され、使われていませんでした。\n" +"(Contributed by Jeroen Demeyer in :issue:`36974`.)" -#: ../../whatsnew/3.9.rst:1421 msgid "Excluded the following functions from the limited C API:" -msgstr "" +msgstr "次の関数が限定 C API から除外されました:" -#: ../../whatsnew/3.9.rst:1423 msgid "" -"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" -"`37878`.)" +"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye " +"in :issue:`37878`.)" msgstr "" +"``PyThreadState_DeleteCurrent()``\n" +"(Contributed by Joannah Nanjekye in :issue:`37878`.)" #: ../../whatsnew/3.9.rst:1425 msgid "``_Py_CheckRecursionLimit``" @@ -2296,9 +2965,8 @@ msgstr "``_PyTraceMalloc_NewReference()``" msgid "``_Py_GetRefTotal()``" msgstr "``_Py_GetRefTotal()``" -#: ../../whatsnew/3.9.rst:1430 msgid "The trashcan mechanism which never worked in the limited C API." -msgstr "" +msgstr "限定 C API では元々動作していなかった trashcan の仕組み。" #: ../../whatsnew/3.9.rst:1431 msgid "``PyTrash_UNWIND_LEVEL``" @@ -2324,9 +2992,8 @@ msgstr "``Py_TRASHCAN_SAFE_BEGIN``" msgid "``Py_TRASHCAN_SAFE_END``" msgstr "``Py_TRASHCAN_SAFE_END``" -#: ../../whatsnew/3.9.rst:1438 msgid "Moved following functions and definitions to the internal C API:" -msgstr "" +msgstr "次の関数と定義が内部 C API に移されました:" #: ../../whatsnew/3.9.rst:1440 msgid "``_PyDebug_PrintTotalRefs()``" @@ -2344,24 +3011,31 @@ msgstr "``_Py_PrintReferenceAddresses()``" msgid "``_Py_tracemalloc_config``" msgstr "``_Py_tracemalloc_config``" -#: ../../whatsnew/3.9.rst:1444 msgid "``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)" -msgstr "" +msgstr "``_Py_AddToAllObjects()`` (``Py_TRACE_REFS`` ビルド専用)" -#: ../../whatsnew/3.9.rst:1448 msgid "" "Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` " "macro which was an alias to ``_PyRuntime.getframe``. They were only exposed " "by the internal C API. Removed also ``PyThreadFrameGetter`` type. " "(Contributed by Victor Stinner in :issue:`39946`.)" msgstr "" +"``_PyRuntime.getframe`` フックと、その別名だった ``_PyThreadState_GetFrame`` " +"マクロが削除されました。\n" +"これらは内部 C API だけで公開されていました。\n" +"``PyThreadFrameGetter`` 型も削除されました。\n" +"(Contributed by Victor Stinner in :issue:`39946`.)" -#: ../../whatsnew/3.9.rst:1453 msgid "" "Removed the following functions from the C API. Call :c:func:`PyGC_Collect` " "explicitly to clear all free lists. (Contributed by Inada Naoki and Victor " "Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" msgstr "" +"次の関数が C API から削除されました。\n" +"すべてのフリーリストを空にするには、:c:func:`PyGC_Collect` を明示的に呼び出し" +"てください。\n" +"(Contributed by Inada Naoki and Victor Stinner " +"in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" #: ../../whatsnew/3.9.rst:1458 msgid "``PyAsyncGen_ClearFreeLists()``" @@ -2387,41 +3061,46 @@ msgstr "``PyFrame_ClearFreeList()``" msgid "``PyList_ClearFreeList()``" msgstr "``PyList_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1464 msgid "" "``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``: the free " "lists of bound method objects have been removed." msgstr "" +"``PyMethod_ClearFreeList()`` と ``PyCFunction_ClearFreeList()``: 束縛メソッド" +"オブジェクトのフリーリストは削除されました。" -#: ../../whatsnew/3.9.rst:1466 msgid "" "``PySet_ClearFreeList()``: the set free list has been removed in Python 3.4." msgstr "" +"``PySet_ClearFreeList()``: 集合のフリーリストは Python 3.4 で削除されました。" #: ../../whatsnew/3.9.rst:1468 msgid "``PyTuple_ClearFreeList()``" msgstr "``PyTuple_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1469 msgid "" "``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in " "Python 3.3." msgstr "" +"``PyUnicode_ClearFreeList()``: Unicode のフリーリストは Python 3.3 で削除され" +"ました。" -#: ../../whatsnew/3.9.rst:1472 msgid "" "Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor " "Stinner in :issue:`39465`.)" msgstr "" +"``_PyUnicode_ClearStaticStrings()`` 関数が削除されました。\n" +"(Contributed by Victor Stinner in :issue:`39465`.)" -#: ../../whatsnew/3.9.rst:1475 msgid "" "Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and " "broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be " "used instead. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" +"``Py_UNICODE_MATCH`` が削除されました。\n" +":pep:`393` によって非推奨になり、Python 3.3 から動作しなくなっていました。\n" +"代わりに :c:func:`PyUnicode_Tailmatch` 関数を使えます。\n" +"(Contributed by Inada Naoki in :issue:`36346`.)" -#: ../../whatsnew/3.9.rst:1480 msgid "" "Cleaned header files of interfaces defined but with no implementation. The " "public API symbols being removed are: " @@ -2430,46 +3109,61 @@ msgid "" "``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, " "``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, " "``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, " -"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:" -"`39372`.)" -msgstr "" +"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado " +"in :issue:`39372`.)" +msgstr "" +"ヘッダーファイルから、定義はあるものの実装がないインターフェースが整理・削除" +"されました。\n" +"削除された公開 API のシンボルは ``_PyBytes_InsertThousandsGroupingLocale``、" +"``_PyBytes_InsertThousandsGrouping``、``_Py_InitializeFromArgs``、" +"``_Py_InitializeFromWideArgs``、``_PyFloat_Repr``、``_PyFloat_Digits``、" +"``_PyFloat_DigitsInit``、``PyFrame_ExtendStack``、``_PyAIterWrapper_Type``、" +"``PyNullImporter_Type``、``PyCmpWrapper_Type``、``PySortWrapper_Type``、" +"``PyNoArgsFunction`` です。\n" +"(Contributed by Pablo Galindo Salgado in :issue:`39372`.)" #: ../../whatsnew/3.9.rst:1491 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." +"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 "" "``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 mutable parameters will not throw an " "error::" msgstr "" +"``Literal`` オブジェクトの等価比較で、パラメータのいずれか" +"が :term:`hashable` でない場合に :exc:`TypeError` を送出するようになりまし" +"た。\n" +"ミュータブルなパラメータを指定して ``Literal`` を宣言するだけではエラーになり" +"ません。 ::" -#: ../../whatsnew/3.9.rst:1510 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2478,6 +3172,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`.)" @@ -2487,7 +3187,6 @@ msgstr "(:issue:`42345` でのYurii Karabasの貢献による)" msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート" -#: ../../whatsnew/3.9.rst:1522 msgid "" "As of 3.9.1, Python now fully supports building and running on macOS 11.0 " "(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture). A " @@ -2498,6 +3197,14 @@ msgid "" "functions and options conditionally available based on the operating system " "version in use at runtime (\"weaklinking\")." msgstr "" +"3.9.1 から、macOS 11.0 (Big Sur) と Apple Silicon Mac (``ARM64`` アーキテク" +"チャ) での Python のビルドと実行を完全にサポートするようになりました。\n" +"一組の実行ファイルで ``ARM64`` と ``Intel 64`` の両方をネイティブにサポートす" +"る、新しいユニバーサルビルド ``universal2`` が利用できます。\n" +"また、現在の macOS でビルドしたバイナリを、さまざまな古い macOS バージョン " +"(10.9 までテスト済み) に配布できるようになりました。\n" +"その際、実行時の OS バージョンに応じて、新しい OS の関数やオプションの一部を" +"条件付きで利用できます (「弱いリンク」)。" #: ../../whatsnew/3.9.rst:1531 msgid "(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)" @@ -2511,43 +3218,66 @@ msgstr "Python 3.9.2 での重要な変更点" msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.9.rst:1539 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " "``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of " "``(int, str, str)``; previously this was ``([int, str], str)``. To allow " "this change, :class:`types.GenericAlias` can now be subclassed, and a " -"subclass will be returned when subscripting the :class:`collections.abc." -"Callable` type. Code which accesses the arguments via :func:`typing." -"get_args` or ``__args__`` need to account for this change. A :exc:" -"`DeprecationWarning` may be emitted for invalid forms of parameterizing :" -"class:`collections.abc.Callable` which may have passed silently in Python " -"3.9.1. This :exc:`DeprecationWarning` will become a :exc:`TypeError` in " -"Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" -msgstr "" +"subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Code which accesses the " +"arguments via :func:`typing.get_args` or ``__args__`` need to account for " +"this change. A :exc:`DeprecationWarning` may be emitted for invalid forms " +"of parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9.1. This :exc:`DeprecationWarning` will become " +"a :exc:`TypeError` in Python 3.10. (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)`` ではなく ``(int, str, str)`` になります。\n" +"この変更を可能にするため、:class:`types.GenericAlias` をサブクラス化できるよ" +"うになり、:class:`collections.abc.Callable` 型に添字を付けるとサブクラスを返" +"します。\n" +":func:`typing.get_args` または ``__args__`` から引数にアクセスするコードは、" +"この変更を考慮する必要があります。\n" +"Python 3.9.1 では黙って受け付けていた :class:`collections.abc.Callable` の不" +"正なパラメータ指定で、:exc:`DeprecationWarning` が出る場合があります。\n" +"この :exc:`DeprecationWarning` は Python 3.10 で :exc:`TypeError` になりま" +"す。\n" +"(Contributed by Ken Jin in :issue:`42195`.)" #: ../../whatsnew/3.9.rst:1553 ../../whatsnew/3.9.rst:1578 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.9.rst:1555 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" -msgstr "" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" +msgstr "" +"以前の Python では :func:`urllib.parse.parse_qs` " +"と :func:`urllib.parse.parse_qsl` のクエリパラメータの区切りに ``;`` と " +"``&`` の両方を使えました。\n" +"セキュリティ上の懸念と、新しい W3C 勧告への準拠のため、区切りは 1 種類のみと" +"なり、デフォルトは ``&`` に変更されました。\n" +"これらの関数を内部で使う :func:`!cgi.parse` と :func:`!cgi.parse_multipart` " +"も影響を受けます。\n" +"詳しくは各関数のドキュメントを参照してください。\n" +"(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" #: ../../whatsnew/3.9.rst:1566 msgid "Notable changes in Python 3.9.3" msgstr "Python 3.9.3 での重要な変更点" -#: ../../whatsnew/3.9.rst:1568 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -2555,26 +3285,37 @@ msgid "" "old behavior, set a ``trust_server_pasv_ipv4_address`` attribute on your FTP " "instance to ``True``. (See :gh:`87451`)" msgstr "" +"セキュリティ修正により、:class:`ftplib.FTP` はパッシブデータチャネルを確立す" +"るとき、リモートサーバーから送られた IPv4 アドレスを信頼しなくなりました。\n" +"代わりに FTP サーバーの IP アドレスを再利用します。\n" +"従来の動作が必要な特殊なコードでは、FTP インスタンスの " +"``trust_server_pasv_ipv4_address`` 属性を ``True`` に設定してください " +"(:gh:`87451` を参照)。" #: ../../whatsnew/3.9.rst:1575 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:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" -msgstr "" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such 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 "" +msgstr "3.9.14 の注目すべきセキュリティ機能" -#: ../../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,16 +3327,24 @@ 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" -msgstr "" +msgstr "3.9.17 の注目すべき変更" #: ../../whatsnew/3.9.rst:1604 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 +3354,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..59837fea0 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -19,19 +19,18 @@ 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 msgid "Changelog" msgstr "変更履歴" -#: ../NEWS:3 msgid "Python next" -msgstr "次のPython" +msgstr "次の Python バージョン" #: ../NEWS:5 msgid "*Release date: XXXX-XX-XX*" @@ -55,19 +54,21 @@ msgstr "*リリース日: XXXX-XX-XX*" msgid "Windows" msgstr "Windows" -#: ../NEWS:10 msgid "" ":gh:`130727`: Fix a race in internal calls into WMI that can result in an " "\"invalid handle\" exception under high load. Patch by Chris Eibl." msgstr "" +":gh:`130727`: 高負荷時に \"invalid handle\" 例外を引き起こすことがある、WMI " +"への内部呼び出しの競合を修正しました。\n" +"Chris Eibl によるパッチです。" -#: ../NEWS:13 msgid "" ":gh:`76023`: Make :func:`os.path.realpath` ignore Windows error 1005 when in " "non-strict mode." msgstr "" +":gh:`76023`: :func:`os.path.realpath` が、非厳密モードでは Windows のエラー " +"1005 を無視するようにしました。" -#: ../NEWS:16 msgid "" ":gh:`133779`: Reverts the change to generate different :file:`pyconfig.h` " "files based on compiler settings, as it was frequently causing extension " @@ -77,32 +78,30 @@ msgid "" "function can be used to determine whether the current runtime was compiled " "with that flag or not." msgstr "" +":gh:`133779`: 拡張モジュールのビルドを頻繁に壊していたため、コンパイラー設定" +"に応じて異なる :file:`pyconfig.h` を生成する変更を取り消しました。\n" +"特に、実験的なフリースレッドのランタイム向けにコンパイルする際は、" +"``Py_GIL_DISABLED`` プリプロセッサー変数を常に明示的に定義する必要がありま" +"す。\n" +"現在のランタイムがこのフラグ付きでコンパイルされたかどうか" +"は、:func:`sysconfig.get_config_var` で確認できます。" -#: ../NEWS:24 msgid "" ":gh:`133626`: Ensures packages are not accidentally bundled into the " "traditional installer." msgstr "" +":gh:`133626`: 従来のインストーラーにパッケージが誤って同梱されないようにしま" +"した。" -#: ../NEWS:28 ../NEWS:255 ../NEWS:1065 ../NEWS:1425 ../NEWS:1991 ../NEWS:2528 -#: ../NEWS:2865 ../NEWS:3324 ../NEWS:3997 ../NEWS:7860 ../NEWS:8382 -#: ../NEWS:9819 ../NEWS:12084 ../NEWS:13286 ../NEWS:13621 ../NEWS:14612 -#: ../NEWS:14942 ../NEWS:17433 ../NEWS:18319 ../NEWS:18926 ../NEWS:23002 -#: ../NEWS:25108 ../NEWS:25602 ../NEWS:27521 ../NEWS:27983 ../NEWS:28456 -#: ../NEWS:31438 ../NEWS:32301 ../NEWS:32840 ../NEWS:33182 ../NEWS:36305 -#: ../NEWS:36927 ../NEWS:37144 ../NEWS:37404 ../NEWS:38010 ../NEWS:38598 -#: ../NEWS:40913 ../NEWS:41301 ../NEWS:41642 ../NEWS:42065 ../NEWS:42552 -#: ../NEWS:42917 ../NEWS:43311 ../NEWS:43385 ../NEWS:44370 ../NEWS:44831 -#: ../NEWS:45139 ../NEWS:46399 ../NEWS:47508 ../NEWS:48334 ../NEWS:48857 -#: ../NEWS:49544 ../NEWS:49763 ../NEWS:49971 ../NEWS:51883 msgid "Tools/Demos" -msgstr "ツール/デモ" +msgstr "ツールとデモ" -#: ../NEWS:30 msgid "" ":gh:`134215`: :term:`REPL` import autocomplete only suggests private modules " "when explicitly specified." msgstr "" +":gh:`134215`: :term:`REPL` のインポートの自動補完は、明示的に指定した場合にだ" +"け非公開モジュールを提案するようになりました。" #: ../NEWS:34 ../NEWS:264 ../NEWS:1074 ../NEWS:1448 ../NEWS:2000 ../NEWS:2535 #: ../NEWS:2871 ../NEWS:3333 ../NEWS:4003 ../NEWS:7307 ../NEWS:7770 @@ -124,25 +123,33 @@ msgstr "" msgid "Tests" msgstr "テスト" -#: ../NEWS:36 msgid "" ":gh:`133744`: Fix multiprocessing interrupt test. Add an event to " "synchronize the parent process with the child process: wait until the child " "process starts sleeping. Patch by Victor Stinner." msgstr "" +":gh:`133744`: multiprocessing の割り込みテストを修正しました。\n" +"親プロセスと子プロセスを同期するイベントを追加し、子プロセスがスリープを開始" +"するまで待つようにしました。\n" +"Victor Stinner によるパッチです。" -#: ../NEWS:40 msgid "" -":gh:`133682`: Fixed test case ``test.test_annotationlib.TestStringFormat." -"test_displays`` which ensures proper handling of complex data structures " -"(lists, sets, dictionaries, and tuples) in string annotations." +":gh:`133682`: Fixed test case " +"``test.test_annotationlib.TestStringFormat.test_displays`` which ensures " +"proper handling of complex data structures (lists, sets, dictionaries, and " +"tuples) in string annotations." msgstr "" +":gh:`133682`: 文字列アノテーション内の複雑なデータ構造 (リスト、集合、辞書、" +"タプル) が適切に扱われるか検証する、" +"``test.test_annotationlib.TestStringFormat.test_displays`` テストを修正しまし" +"た。" -#: ../NEWS:45 msgid "" ":gh:`133639`: Fix ``TestPyReplAutoindent.test_auto_indent_default()`` " "doesn't run ``input_code``." msgstr "" +":gh:`133639`: ``TestPyReplAutoindent.test_auto_indent_default()`` が " +"``input_code`` を実行していなかった問題を修正しました。" #: ../NEWS:49 ../NEWS:285 ../NEWS:1085 ../NEWS:1465 ../NEWS:2016 ../NEWS:2888 #: ../NEWS:3344 ../NEWS:4069 ../NEWS:6306 ../NEWS:7443 ../NEWS:7887 @@ -158,11 +165,12 @@ msgstr "" msgid "Security" msgstr "セキュリティ" -#: ../NEWS:51 msgid "" ":gh:`133767`: Fix use-after-free in the \"unicode-escape\" decoder with a " "non-\"strict\" error handler." msgstr "" +":gh:`133767`: \"strict\" 以外のエラーハンドラーを使う \"unicode-escape\" デ" +"コーダーでの、解放済みメモリーの使用を修正しました。" #: ../NEWS:55 ../NEWS:295 ../NEWS:1100 ../NEWS:1473 ../NEWS:2044 ../NEWS:2542 #: ../NEWS:2896 ../NEWS:3349 ../NEWS:4120 ../NEWS:6509 ../NEWS:7063 @@ -187,185 +195,243 @@ msgstr "" msgid "Library" msgstr "ライブラリ" -#: ../NEWS:57 msgid "" ":gh:`134451`: Converted ``asyncio.tools.CycleFoundException`` from dataclass " "to a regular exception type." msgstr "" +":gh:`134451`: ``asyncio.tools.CycleFoundException`` をデータクラスから通常の" +"例外型に変更しました。" -#: ../NEWS:60 msgid "" ":gh:`114177`: Fix :mod:`asyncio` to not close subprocess pipes which would " "otherwise error out when the event loop is already closed." msgstr "" +":gh:`114177`: イベントループが既に閉じられている場合、:mod:`asyncio` がサブプ" +"ロセスのパイプを閉じてエラーになることを避けるため、パイプを閉じないように修" +"正しました。" -#: ../NEWS:63 msgid "" -":gh:`90871`: Fixed an off by one error concerning the backlog parameter in :" -"meth:`~asyncio.loop.create_unix_server`. Contributed by Christian Harries." +":gh:`90871`: Fixed an off by one error concerning the backlog parameter " +"in :meth:`~asyncio.loop.create_unix_server`. Contributed by Christian " +"Harries." msgstr "" +":gh:`90871`: :meth:`~asyncio.loop.create_unix_server` の backlog パラメータに" +"関わる、値が 1 ずれる誤りを修正しました。\n" +"Christian Harries が貢献しました。" -#: ../NEWS:67 msgid ":gh:`134323`: Fix the :meth:`threading.RLock.locked` method." -msgstr "" +msgstr ":gh:`134323`: :meth:`threading.RLock.locked` メソッドを修正しました。" -#: ../NEWS:69 msgid "" ":gh:`86802`: Fixed asyncio memory leak in cancelled shield tasks. For " "shielded tasks where the shield was cancelled, log potential exceptions " "through the exception handler. Contributed by Christian Harries." msgstr "" +":gh:`86802`: キャンセルされた shield タスクにおける asyncio のメモリリークを" +"修正しました。\n" +"保護がキャンセルされたタスクでは、発生した例外を例外ハンドラ経由でログに記録" +"するようにしました。\n" +"Christian Harries が貢献しました。" -#: ../NEWS:73 msgid "" -":gh:`134209`: :mod:`curses`: The :meth:`curses.window.instr` and :meth:" -"`curses.window.getstr` methods now allocate their internal buffer on the " -"heap instead of the stack; in addition, the max buffer size is increased " -"from 1023 to 2047." +":gh:`134209`: :mod:`curses`: The :meth:`curses.window.instr` " +"and :meth:`curses.window.getstr` methods now allocate their internal buffer " +"on the heap instead of the stack; in addition, the max buffer size is " +"increased from 1023 to 2047." msgstr "" +":gh:`134209`: :mod:`curses`: :meth:`curses.window.instr` " +"と :meth:`curses.window.getstr` が内部バッファをスタックではなくヒープに割り" +"当てるようになりました。\n" +"また、最大バッファサイズを 1023 から 2047 に増やしました。" -#: ../NEWS:78 msgid "" ":gh:`134235`: Updated tab completion on REPL to include builtin modules. " "Contributed by Tom Wang, Hunter Young" msgstr "" +":gh:`134235`: REPL のタブ補完に組み込みモジュールを含めるようにしました。\n" +"Tom Wang と Hunter Young が貢献しました。" -#: ../NEWS:81 msgid "" ":gh:`62184`: Remove import of C implementation of :class:`io.FileIO` from " "Python implementation which has its own implementation" msgstr "" +":gh:`62184`: 独自の実装を持つ Python 実装から、:class:`io.FileIO` の C 実装の" +"インポートを削除しました。" -#: ../NEWS:84 msgid "" -":gh:`133982`: Emit :exc:`RuntimeWarning` in the Python implementation of :" -"mod:`io` when the :term:`file-like object ` is not closed " +":gh:`133982`: Emit :exc:`RuntimeWarning` in the Python implementation " +"of :mod:`io` when the :term:`file-like object ` is not closed " "explicitly in the presence of multiple I/O layers." msgstr "" +":gh:`133982`: :mod:`io` の Python 実装で、複数の I/O 層がある場合に :term:`" +"ファイルのようなオブジェクト ` を明示的に閉じなけれ" +"ば :exc:`RuntimeWarning` を発するようにしました。" -#: ../NEWS:88 msgid "" -":gh:`133890`: The :mod:`tarfile` module now handles :exc:" -"`UnicodeEncodeError` in the same way as :exc:`OSError` when cannot extract a " -"member." +":gh:`133890`: The :mod:`tarfile` module now " +"handles :exc:`UnicodeEncodeError` in the same way as :exc:`OSError` when " +"cannot extract a member." msgstr "" +":gh:`133890`: :mod:`tarfile` モジュールがメンバーを展開できない場" +"合、:exc:`UnicodeEncodeError` を :exc:`OSError` と同様に扱うようになりまし" +"た。" -#: ../NEWS:91 msgid "" ":gh:`134097`: Fix interaction of the new :term:`REPL` and :option:`-X " "showrefcount <-X>` command line option." msgstr "" +":gh:`134097`: 新しい :term:`REPL` とコマンドラインオプション :option:`-X " +"showrefcount <-X>` の組み合わせに関する問題を修正しました。" -#: ../NEWS:94 msgid "" -":gh:`133889`: The generated directory listing page in :class:`http.server." -"SimpleHTTPRequestHandler` now only shows the decoded path component of the " -"requested URL, and not the query and fragment." +":gh:`133889`: The generated directory listing page " +"in :class:`http.server.SimpleHTTPRequestHandler` now only shows the decoded " +"path component of the requested URL, and not the query and fragment." msgstr "" +":gh:`133889`: :class:`http.server.SimpleHTTPRequestHandler` が生成するディレ" +"クトリ一覧ページに、要求された URL のデコード済みパス部分だけを表示し、クエリ" +"とフラグメントは表示しないようにしました。" -#: ../NEWS:98 msgid "" ":gh:`134098`: Fix handling paths that end with a percent-encoded slash " "(``%2f`` or ``%2F``) in :class:`http.server.SimpleHTTPRequestHandler`." msgstr "" +":gh:`134098`: :class:`http.server.SimpleHTTPRequestHandler` でパーセントエン" +"コードされたスラッシュ (``%2f`` または ``%2F``) で終わるパスの処理を修正しま" +"した。" -#: ../NEWS:101 msgid "" -":gh:`132124`: On POSIX-compliant systems, :func:`!multiprocessing.util." -"get_temp_dir` now ignores :envvar:`TMPDIR` (and similar environment " -"variables) if the path length of ``AF_UNIX`` socket files exceeds the " -"platform-specific maximum length when using the :ref:`forkserver " +":gh:`132124`: On POSIX-compliant systems, :func:`!" +"multiprocessing.util.get_temp_dir` now ignores :envvar:`TMPDIR` (and similar " +"environment variables) if the path length of ``AF_UNIX`` socket files " +"exceeds the platform-specific maximum length when using the :ref:`forkserver " "` start method. Patch by Bénédikt " "Tran." msgstr "" +":gh:`132124`: POSIX 準拠システムで :ref:`forkserver ` 開始方式を使う際、``AF_UNIX`` ソケットファイルのパス長が" +"プラットフォーム固有の上限を超える場合、:func:`!" +"multiprocessing.util.get_temp_dir` が :envvar:`TMPDIR` (および同様の環境変" +"数) を無視するようになりました。\n" +"パッチは Bénédikt Tran によるものです。" -#: ../NEWS:108 msgid "" ":gh:`134062`: :mod:`ipaddress`: fix collisions in :meth:`~object.__hash__` " "for :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " "objects." msgstr "" +":gh:`134062`: :mod:`ipaddress`: :class:`~ipaddress.IPv4Network` オブジェクト" +"と :class:`~ipaddress.IPv6Network` オブジェクトの :meth:`~object.__hash__` の" +"衝突を修正しました。" -#: ../NEWS:112 msgid "" -":gh:`133970`: Make :class:`!string.templatelib.Template` and :class:`!string." -"templatelib.Interpolation` generic." +":gh:`133970`: Make :class:`!string.templatelib.Template` and :class:`!" +"string.templatelib.Interpolation` generic." msgstr "" +":gh:`133970`: :class:`!string.templatelib.Template` と :class:`!" +"string.templatelib.Interpolation` をジェネリックにしました。" -#: ../NEWS:115 msgid "" ":gh:`71253`: Raise :exc:`ValueError` in :func:`open` if *opener* returns a " "negative file-descriptor in the Python implementation of :mod:`io` to match " "the C implementation." msgstr "" +":gh:`71253`: :mod:`io` の Python 実装で、*opener* が負のファイル記述子を返し" +"た場合に :func:`open` が :exc:`ValueError` を送出するようにし、C 実装と一致さ" +"せました。" -#: ../NEWS:119 msgid "" ":gh:`133925`: Make the private class ``typing._UnionGenericAlias`` hashable." msgstr "" +":gh:`133925`: 非公開クラス ``typing._UnionGenericAlias`` をハッシュ可能にしま" +"した。" -#: ../NEWS:121 msgid "" ":gh:`133653`: Fix :class:`argparse.ArgumentParser` with the " "*formatter_class* argument. Fix TypeError when *formatter_class* is a custom " "subclass of :class:`!HelpFormatter`. Fix TypeError when *formatter_class* is " "not a subclass of :class:`!HelpFormatter` and non-standard *prefix_char* is " -"used. Fix support of colorizing when *formatter_class* is not a subclass of :" -"class:`!HelpFormatter`." +"used. Fix support of colorizing when *formatter_class* is not a subclass " +"of :class:`!HelpFormatter`." msgstr "" +":gh:`133653`: *formatter_class* 引数を指定し" +"た :class:`argparse.ArgumentParser` を修正しました。\n" +"*formatter_class* が :class:`!HelpFormatter` の独自のサブクラスである場合の " +"TypeError を修正しました。\n" +"*formatter_class* が :class:`!HelpFormatter` のサブクラスではなく、非標準の " +"*prefix_char* を使う場合の TypeError を修正しました。\n" +"*formatter_class* が :class:`!HelpFormatter` のサブクラスでない場合の色付けの" +"サポートを修正しました。" -#: ../NEWS:128 msgid "" ":gh:`132641`: Fixed a race in :func:`functools.lru_cache` under free-" "threading." msgstr "" +":gh:`132641`: フリースレッドでの :func:`functools.lru_cache` の競合を修正しま" +"した。" -#: ../NEWS:131 msgid "" ":gh:`133783`: Fix bug with applying :func:`copy.replace` to :mod:`ast` " "objects. Attributes that default to ``None`` were incorrectly treated as " "required for manually created AST nodes." msgstr "" +":gh:`133783`: :mod:`ast` オブジェクトに :func:`copy.replace` を適用する際のバ" +"グを修正しました。\n" +"手動で作成した AST ノードで、デフォルトが ``None`` の属性が誤って必須として扱" +"われていました。" -#: ../NEWS:135 msgid "" -":gh:`77057`: Fix handling of invalid markup declarations in :class:`html." -"parser.HTMLParser`." +":gh:`77057`: Fix handling of invalid markup declarations " +"in :class:`html.parser.HTMLParser`." msgstr "" +":gh:`77057`: :class:`html.parser.HTMLParser` における無効なマークアップ宣言の" +"処理を修正しました。" -#: ../NEWS:138 msgid "" ":gh:`133701`: Fix bug where :class:`typing.TypedDict` classes defined under " "``from __future__ import annotations`` and inheriting from another " "``TypedDict`` had an incorrect ``__annotations__`` attribute." msgstr "" +":gh:`133701`: ``from __future__ import annotations`` を使って定義し、別の " +"``TypedDict`` から継承した :class:`typing.TypedDict` クラスの " +"``__annotations__`` 属性が誤っていたバグを修正しました。" -#: ../NEWS:142 msgid "" ":gh:`133581`: Improve unparsing of t-strings in :func:`ast.unparse` and " "``from __future__ import annotations``. Empty t-strings now round-trip " "correctly and formatting in interpolations is preserved. Patch by Jelle " "Zijlstra." msgstr "" +":gh:`133581`: :func:`ast.unparse` と ``from __future__ import annotations`` " +"で t 文字列をソースに戻す処理を改善しました。\n" +"空の t 文字列を正しく往復変換できるようになり、補間内の書式が保持されるように" +"なりました。\n" +"パッチは Jelle Zijlstra によるものです。" -#: ../NEWS:147 msgid "" ":gh:`133551`: Support t-strings (:pep:`750`) in :mod:`annotationlib`. Patch " "by Jelle Zijlstra." msgstr "" +":gh:`133551`: :mod:`annotationlib` で t 文字列 (:pep:`750`) をサポートしまし" +"た。\n" +"パッチは Jelle Zijlstra によるものです。" -#: ../NEWS:150 msgid "" ":gh:`133439`: Fix dot commands with trailing spaces are mistaken for multi-" "line SQL statements in the sqlite3 command-line interface." msgstr "" +":gh:`133439`: sqlite3 のコマンドラインインターフェースで、末尾にスペースのあ" +"るドットコマンドが複数行の SQL 文と誤認される問題を修正しました。" -#: ../NEWS:153 msgid "" -":gh:`133009`: :mod:`xml.etree.ElementTree`: Fix a crash in :meth:`Element." -"__deepcopy__ ` when the element is concurrently " -"mutated. Patch by Bénédikt Tran." +":gh:`133009`: :mod:`xml.etree.ElementTree`: Fix a crash " +"in :meth:`Element.__deepcopy__ ` when the element is " +"concurrently mutated. Patch by Bénédikt Tran." msgstr "" +":gh:`133009`: :mod:`xml.etree.ElementTree`: 要素が同時に変更される" +"と :meth:`Element.__deepcopy__ ` がクラッシュする問題を" +"修正しました。\n" +"パッチは Bénédikt Tran によるものです。" #: ../NEWS:157 msgid "" @@ -373,139 +439,148 @@ msgid "" "to avoid deadlock or infinite recursion." msgstr "" -#: ../NEWS:160 msgid "" -":gh:`125028`: :data:`functools.Placeholder` cannot be passed to :func:" -"`functools.partial` as a keyword argument." +":gh:`125028`: :data:`functools.Placeholder` cannot be passed " +"to :func:`functools.partial` as a keyword argument." msgstr "" +":gh:`125028`: :data:`functools.Placeholder` を :func:`functools.partial` に" +"キーワード引数として渡せなくなりました。" -#: ../NEWS:163 msgid "" ":gh:`62824`: Fix aliases for ``iso8859_8`` encoding. Patch by Dave Goncalves." msgstr "" +":gh:`62824`: ``iso8859_8`` エンコーディングのエイリアスを修正しました。\n" +"パッチは Dave Goncalves によるものです。" -#: ../NEWS:165 msgid "" ":gh:`86155`: :meth:`html.parser.HTMLParser.close` no longer loses data when " "the ``